From 6c007684f044ff12714ace95acd927ac2416a8fe Mon Sep 17 00:00:00 2001 From: SnakeFang Date: Wed, 27 Jan 2016 13:07:14 -0500 Subject: [PATCH 1/2] Make BlockID default, rather than ModulusBlockID. And update Thaumcraft config Using ModulusBlockID with a modulus of 4 can mess up non-standard log blocks (like Thaumcraft 5 logs - Greatwood is log:0 through log:2, and Silverwood is log:3 through log:5) And I updated the Thaumcraft default config so it works with Thaumcraft 5 --- .../bspkrs/treecapitator/forge/ForgeEventHandler.java | 6 +++--- .../bspkrs/treecapitator/registry/ModConfigRegistry.java | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/bspkrs/treecapitator/forge/ForgeEventHandler.java b/src/main/java/bspkrs/treecapitator/forge/ForgeEventHandler.java index a31bddf..d794139 100644 --- a/src/main/java/bspkrs/treecapitator/forge/ForgeEventHandler.java +++ b/src/main/java/bspkrs/treecapitator/forge/ForgeEventHandler.java @@ -21,7 +21,7 @@ import bspkrs.treecapitator.registry.TreeDefinition; import bspkrs.treecapitator.registry.TreeRegistry; import bspkrs.treecapitator.util.TCLog; -import bspkrs.util.ModulusBlockID; +import bspkrs.util.BlockID; import com.google.common.base.Charsets; import com.google.common.hash.HashFunction; @@ -46,7 +46,7 @@ public void onBlockClicked(PlayerInteractEvent event) @SubscribeEvent public void getPlayerBreakSpeed(BreakSpeed event) { - ModulusBlockID blockID = new ModulusBlockID(event.state, 4); + BlockID blockID = new BlockID(event.state); BlockPos pos = event.pos; if (TreecapitatorMod.proxy.isEnabled() && (TreeRegistry.instance().isRegistered(blockID) @@ -101,7 +101,7 @@ public void onBlockHarvested(BreakEvent event) { if (TreecapitatorMod.proxy.isEnabled() && !event.world.isRemote) { - ModulusBlockID blockID = new ModulusBlockID(event.state, 4); + BlockID blockID = new BlockID(event.state); if ((TreeRegistry.instance().isRegistered(blockID) || (TCSettings.allowAutoTreeDetection && TreeRegistry.canAutoDetect(event.world, event.state.getBlock(), event.pos))) diff --git a/src/main/java/bspkrs/treecapitator/registry/ModConfigRegistry.java b/src/main/java/bspkrs/treecapitator/registry/ModConfigRegistry.java index 78590df..e862b96 100644 --- a/src/main/java/bspkrs/treecapitator/registry/ModConfigRegistry.java +++ b/src/main/java/bspkrs/treecapitator/registry/ModConfigRegistry.java @@ -407,12 +407,13 @@ protected void initDefaultModConfigs() // "", true).setOverrideIMC(false)); defaultModCfgs.put("Thaumcraft", new ThirdPartyModConfig("Thaumcraft") - .addAxe(new ItemID("Thaumcraft:ItemAxeThaumium")) - .addAxe(new ItemID("Thaumcraft:ItemAxeElemental")) + .addAxe(new ItemID("thaumcraft:thaumium_axe")) + .addAxe(new ItemID("thaumcraft:void_axe")) + .addAxe(new ItemID("thaumcraft:elemental_axe")) .setOverrideIMC(false) - .addTreeDef("greatwood", new TreeDefinition().addLogID(new ModulusBlockID("Thaumcraft:blockMagicalLog", 0, 4)).addLeafID(new ModulusBlockID("Thaumcraft:blockMagicalLeaves", 0, 8)) + .addTreeDef("greatwood", new TreeDefinition().addLogID(new BlockID("thaumcraft:log", 0)).addLogID(new BlockID("thaumcraft:log", 1)).addLogID(new BlockID("thaumcraft:log", 2)).addLeafID(new BlockID("thaumcraft:leaf", 0)) .setMaxHorLeafBreakDist(7).setRequireLeafDecayCheck(false)) - .addTreeDef("silverwood", new TreeDefinition().addLogID(new ModulusBlockID("Thaumcraft:blockMagicalLog", 1, 4)).addLeafID(new ModulusBlockID("Thaumcraft:blockMagicalLeaves", 1, 8)))); + .addTreeDef("silverwood", new TreeDefinition().addLogID(new BlockID("thaumcraft:log", 3)).addLogID(new BlockID("thaumcraft:log", 4)).addLogID(new BlockID("thaumcraft:log", 5)).addLeafID(new BlockID("thaumcraft:leaf", 1)))); defaultModCfgs.put("TConstruct", new ThirdPartyModConfig("TConstruct") .addAxe(new ItemID("TConstruct:hatchet")) From 62b190dfca7e4759f08c0d27a9839d0dfa9f76f2 Mon Sep 17 00:00:00 2001 From: SnakeFang Date: Wed, 27 Jan 2016 15:37:28 -0500 Subject: [PATCH 2/2] Fix TC config, and fix autodetect making some trees with multiple logs fail. The auto detection uses only the first log that was broken as the list of BlockIDs, so if the TreeDef has other BlockIDs then the autodetect doesn't realize this, and it would force the TreeDef to be null and make everything else fail afterward. --- .../bspkrs/treecapitator/registry/ModConfigRegistry.java | 4 ++-- .../java/bspkrs/treecapitator/registry/TreeRegistry.java | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/bspkrs/treecapitator/registry/ModConfigRegistry.java b/src/main/java/bspkrs/treecapitator/registry/ModConfigRegistry.java index e862b96..9ecf966 100644 --- a/src/main/java/bspkrs/treecapitator/registry/ModConfigRegistry.java +++ b/src/main/java/bspkrs/treecapitator/registry/ModConfigRegistry.java @@ -411,9 +411,9 @@ protected void initDefaultModConfigs() .addAxe(new ItemID("thaumcraft:void_axe")) .addAxe(new ItemID("thaumcraft:elemental_axe")) .setOverrideIMC(false) - .addTreeDef("greatwood", new TreeDefinition().addLogID(new BlockID("thaumcraft:log", 0)).addLogID(new BlockID("thaumcraft:log", 1)).addLogID(new BlockID("thaumcraft:log", 2)).addLeafID(new BlockID("thaumcraft:leaf", 0)) + .addTreeDef("greatwood", new TreeDefinition().addLogID(new BlockID("thaumcraft:log", 0)).addLogID(new BlockID("thaumcraft:log", 1)).addLogID(new BlockID("thaumcraft:log", 2)).addLeafID(new ModulusBlockID("thaumcraft:leaf", 0, 2)) .setMaxHorLeafBreakDist(7).setRequireLeafDecayCheck(false)) - .addTreeDef("silverwood", new TreeDefinition().addLogID(new BlockID("thaumcraft:log", 3)).addLogID(new BlockID("thaumcraft:log", 4)).addLogID(new BlockID("thaumcraft:log", 5)).addLeafID(new BlockID("thaumcraft:leaf", 1)))); + .addTreeDef("silverwood", new TreeDefinition().addLogID(new BlockID("thaumcraft:log", 3)).addLogID(new BlockID("thaumcraft:log", 4)).addLogID(new BlockID("thaumcraft:log", 5)).addLeafID(new ModulusBlockID("thaumcraft:leaf", 1, 2)))); defaultModCfgs.put("TConstruct", new ThirdPartyModConfig("TConstruct") .addAxe(new ItemID("TConstruct:hatchet")) diff --git a/src/main/java/bspkrs/treecapitator/registry/TreeRegistry.java b/src/main/java/bspkrs/treecapitator/registry/TreeRegistry.java index 1108a87..52c617d 100644 --- a/src/main/java/bspkrs/treecapitator/registry/TreeRegistry.java +++ b/src/main/java/bspkrs/treecapitator/registry/TreeRegistry.java @@ -256,6 +256,8 @@ public TreeDefinition get(BlockID blockID) { String treeKey = logToStringMap.get(blockID); TreeDefinition treeDef = get(logToStringMap.get(blockID)); + if(!treeKey.equals("vanilla_oak")) + TCLog.debug(treeDef.toString()); if (treeDef != null) { @@ -313,7 +315,8 @@ else if ((treeDef != null) && (leaves.size() >= TCSettings.minLeavesToID)) // if (shouldLog) // TCLog.debug("Auto Tree Detection: Block ID %s is a log, but not enough leaves were " + // "found to identify this structure as a tree. Found %d leaves.", blockID, leaves.size()); - treeDef = null; + // Shhh... No need to be so aggressive... + // treeDef = null; } return treeDef;