diff --git a/changelog b/changelog index c866d443b..38205883a 100644 --- a/changelog +++ b/changelog @@ -17,12 +17,16 @@ * New server configs * `CRATE_OPEN_HELD` can toggle whether crates can be opened when held * `CRATE_KEEP_CONTENTS` can toggle whether crates keep their contents when broken + * `ITEM_HAZARD_DROP_TICKRATE` can change the time between ticks for dropped item hazard checks (gunpowder, lithium), default is 2, lowest is 1 * Duds now have multiple variants * Dismantling different variants yields different drops * Magnetic extraction can no longer be performed +* `isItemBlacklisted` on the item hazard checks now employs caching instead of doing a full ore dictionary lookup for every single check, this should make it marginally more performant ## Fixed * Fixed RoR controller having the wrong recipe * Either fixed the crate dupe/voiding issues or made them even worse * Fixed skeletons and pedestals allowing blocks to be placed inside the player -* Fixed artillery shells not playing the explosion animation when directly impacting entities \ No newline at end of file +* Fixed artillery shells not playing the explosion animation when directly impacting entities +* Fixed bauxite and malachite vein toggles being on backwards +* Fixed penumatic tube order settings not saving \ No newline at end of file diff --git a/src/main/java/com/hbm/config/ServerConfig.java b/src/main/java/com/hbm/config/ServerConfig.java index b52910eca..0ca1ccdcf 100644 --- a/src/main/java/com/hbm/config/ServerConfig.java +++ b/src/main/java/com/hbm/config/ServerConfig.java @@ -19,6 +19,7 @@ public class ServerConfig extends RunningConfig { public static ConfigWrapper TAINT_TRAILS = new ConfigWrapper(false); public static ConfigWrapper CRATE_OPEN_HELD = new ConfigWrapper(true); public static ConfigWrapper CRATE_KEEP_CONTENTS = new ConfigWrapper(true); + public static ConfigWrapper ITEM_HAZARD_DROP_TICKRATE = new ConfigWrapper(2); private static void initDefaults() { configMap.put("DAMAGE_COMPATIBILITY_MODE", DAMAGE_COMPATIBILITY_MODE); @@ -30,6 +31,7 @@ public class ServerConfig extends RunningConfig { configMap.put("TAINT_TRAILS", TAINT_TRAILS); configMap.put("CRATE_OPEN_HELD", CRATE_OPEN_HELD); configMap.put("CRATE_KEEP_CONTENTS", CRATE_KEEP_CONTENTS); + configMap.put("ITEM_HAZARD_DROP_TICKRATE", ITEM_HAZARD_DROP_TICKRATE); } /** Initializes defaults, then reads the config file if it exists, then writes the config file. */ diff --git a/src/main/java/com/hbm/hazard/HazardSystem.java b/src/main/java/com/hbm/hazard/HazardSystem.java index 3df3590a7..07e59a7da 100644 --- a/src/main/java/com/hbm/hazard/HazardSystem.java +++ b/src/main/java/com/hbm/hazard/HazardSystem.java @@ -80,15 +80,18 @@ public class HazardSystem { public static boolean isItemBlacklisted(ItemStack stack) { - if(stackBlacklist.contains(new ComparableStack(stack).makeSingular())) + ComparableStack comp = new ComparableStack(stack).makeSingular(); + if(stackBlacklist.contains(comp)) return true; int[] ids = OreDictionary.getOreIDs(stack); for(int id : ids) { String name = OreDictionary.getOreName(id); - if(dictBlacklist.contains(name)) + if(dictBlacklist.contains(name)) { + stackBlacklist.add(comp); // caching! return true; + } } return false; diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index 55eedd3df..95df82f43 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -890,8 +890,8 @@ public class MainRegistry { if(WorldConfig.enableSulfurCave) new OreCave(ModBlocks.stone_resource, 0).setThreshold(1.5D).setRangeMult(20).setYLevel(30).setMaxRange(20).withFluid(ModBlocks.sulfuric_acid_block); //sulfur if(WorldConfig.enableAsbestosCave) new OreCave(ModBlocks.stone_resource, 1).setThreshold(1.75D).setRangeMult(20).setYLevel(25).setMaxRange(20); //asbestos if(WorldConfig.enableHematite) new OreLayer3D(ModBlocks.stone_resource, EnumStoneType.HEMATITE.ordinal()).setScaleH(0.04D).setScaleV(0.25D).setThreshold(230); - if(WorldConfig.enableMalachite) new OreLayer3D(ModBlocks.stone_resource, EnumStoneType.BAUXITE.ordinal()).setScaleH(0.03D).setScaleV(0.15D).setThreshold(300); - if(WorldConfig.enableBauxite) new OreLayer3D(ModBlocks.stone_resource, EnumStoneType.MALACHITE.ordinal()).setScaleH(0.1D).setScaleV(0.15D).setThreshold(275); + if(WorldConfig.enableBauxite) new OreLayer3D(ModBlocks.stone_resource, EnumStoneType.BAUXITE.ordinal()).setScaleH(0.03D).setScaleV(0.15D).setThreshold(300); + if(WorldConfig.enableMalachite) new OreLayer3D(ModBlocks.stone_resource, EnumStoneType.MALACHITE.ordinal()).setScaleH(0.1D).setScaleV(0.15D).setThreshold(275); //new BiomeCave().setThreshold(1.5D).setRangeMult(20).setYLevel(40).setMaxRange(20); //new OreLayer(Blocks.coal_ore, 0.2F).setThreshold(4).setRangeMult(3).setYLevel(70); BedrockOre.init(); diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index 8751c5ca7..2d27eadb8 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -8,6 +8,7 @@ import com.hbm.blocks.generic.BlockAshes; import com.hbm.config.GeneralConfig; import com.hbm.config.MobConfig; import com.hbm.config.RadiationConfig; +import com.hbm.config.ServerConfig; import com.hbm.entity.mob.*; import com.hbm.entity.mob.ai.EntityAIFireGun; import com.hbm.entity.mob.EntityCreeperTainted; @@ -655,14 +656,18 @@ public class ModEventHandler { if(event.phase == Phase.END) { - List loadedEntityList = new ArrayList(); - loadedEntityList.addAll(event.world.loadedEntityList); // ConcurrentModificationException my balls + int tickrate = Math.max(1, ServerConfig.ITEM_HAZARD_DROP_TICKRATE.get()); - for(Object e : loadedEntityList) { - - if(e instanceof EntityItem) { - EntityItem item = (EntityItem) e; - HazardSystem.updateDroppedItem(item); + if(event.world.getTotalWorldTime() % tickrate == 0) { + List loadedEntityList = new ArrayList(); + loadedEntityList.addAll(event.world.loadedEntityList); // ConcurrentModificationException my balls + + for(Object e : loadedEntityList) { + + if(e instanceof EntityItem) { + EntityItem item = (EntityItem) e; + HazardSystem.updateDroppedItem(item); + } } } diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityPneumoTube.java b/src/main/java/com/hbm/tileentity/network/TileEntityPneumoTube.java index cc7fd46ea..5336f61ab 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityPneumoTube.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityPneumoTube.java @@ -227,6 +227,9 @@ public class TileEntityPneumoTube extends TileEntityMachineBase implements IGUIP this.compair.readFromNBT(nbt, "tank"); this.pattern.readFromNBT(nbt); + this.sendOrder = nbt.getByte("sendOrder"); + this.receiveOrder = nbt.getByte("receiveOrder"); + this.whitelist = nbt.getBoolean("whitelist"); this.redstone = nbt.getBoolean("redstone"); } @@ -239,6 +242,9 @@ public class TileEntityPneumoTube extends TileEntityMachineBase implements IGUIP this.compair.writeToNBT(nbt, "tank"); this.pattern.writeToNBT(nbt); + nbt.setByte("sendOrder", sendOrder); + nbt.setByte("receiveOrder", receiveOrder); + nbt.setBoolean("whitelist", whitelist); nbt.setBoolean("redstone", redstone); }