Skip to content

Commit

Permalink
fixed puzzle rooms, god altars, painting rooms and factory rooms, sto…
Browse files Browse the repository at this point in the history
…pped constant print to console from performance measurement
  • Loading branch information
ImplementsLegend committed Mar 16, 2024
1 parent 82ba622 commit e4e1272
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ mod_name=vaultFaster
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT
# The mod version. See https://semver.org/
mod_version=1.0-SNAPSHOT
mod_version=1.0.1
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=implementsLegend.mod
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=
mod_authors=implementsLegend
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=
7 changes: 5 additions & 2 deletions src/main/java/implementslegend/mod/vaultfaster/Performance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package implementslegend.mod.vaultfaster
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.atomic.AtomicLong

private val printInterval = System.getProperties().getProperty("implementslegend.vaultfaster.performanceprintinterval","-1").toInt()

class Performance {
var count = AtomicInteger()
var start = System.currentTimeMillis()
Expand All @@ -12,11 +14,12 @@ class Performance {

fun record() {
val c = count.incrementAndGet()
if(printInterval>=0)
lastPrint.updateAndGet {
if(it+400<System.currentTimeMillis()){
if(it+ printInterval<System.currentTimeMillis()){
println("totalChunks: $c, time: ${System.currentTimeMillis()-start}, chunksPerS: ${(1000*c)/(System.currentTimeMillis()-start).toDouble()}, chunkDelta: ${c-lastCount}")
lastCount=c
it+400
it+printInterval
}else it
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import iskallia.vault.core.world.processor.tile.*;
import iskallia.vault.core.world.template.PlacementSettings;
import iskallia.vault.core.world.template.StructureTemplate;
import iskallia.vault.init.ModBlocks;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.registries.ForgeRegistries;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
Expand All @@ -20,7 +22,7 @@
import java.util.List;
import java.util.Map;
/*
* applies tile mapper when processing all tiles except spawners
* applies tile mapper when processing all tiles except blacklisted
* */
@SuppressWarnings("ALL")
@Mixin(StructureTemplate.class)
Expand Down Expand Up @@ -48,7 +50,14 @@ public Iterator<PartialTile> getTiles(TilePredicate filter, PlacementSettings se
tile = null;
return tile;
}
var isSpawner = ((IndexedBlock)tile.getState().getBlock()).getRegistryIndex()==getSpawnerId();
var tileID = ((IndexedBlock)tile.getState().getBlock()).getRegistryIndex();
//some blocks would not be processed correctly
var dontUseTileMapper = tileID==getSpawnerId()/*order would be messed up and mobs would not spawn*/ ||
tileID == ((IndexedBlock)ModBlocks.GOD_ALTAR).getRegistryIndex() /*you wold get template challange*/ ||
tileID==((IndexedBlock) Blocks.WHITE_CONCRETE).getRegistryIndex() || //some room-specific stuff seems to be broken
tileID==((IndexedBlock) Blocks.LIME_GLAZED_TERRACOTTA).getRegistryIndex() ||
tileID==((IndexedBlock) Blocks.GRAY_GLAZED_TERRACOTTA).getRegistryIndex() ||
tileID==((IndexedBlock) Blocks.COMMAND_BLOCK).getRegistryIndex();

for(Processor<PartialTile> processor : settings.getTileProcessors()) {

Expand All @@ -59,12 +68,12 @@ public Iterator<PartialTile> getTiles(TilePredicate filter, PlacementSettings se
if((processor instanceof TargetTileProcessor<?> ||
processor instanceof VaultLootTileProcessor ||
processor instanceof ReferenceTileProcessor ||
processor instanceof LeveledTileProcessor) && !isSpawner
processor instanceof LeveledTileProcessor) && !dontUseTileMapper
); else
processNotTargetted(processor,tile,settings.getProcessorContext());
}

if(!isSpawner)tile=((TileMapperContainer)settings).getTileMapper().mapBlock(tile,settings.getProcessorContext());
if(!dontUseTileMapper)tile=((TileMapperContainer)settings).getTileMapper().mapBlock(tile,settings.getProcessorContext());
/*
for(Processor<PartialTile> processor : settings.getTileProcessors()) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ license="${mod_license}"
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
issueTrackerURL="https://github.com/ImplementsLegend/VaultFaster/issues" #optional
# The modid of the mod
modId="${mod_id}" #mandatory
# The version number of the mod
Expand Down

0 comments on commit e4e1272

Please sign in to comment.