From 3911706db8f98801993318c04338f5afafaae9da Mon Sep 17 00:00:00 2001 From: D-Cysteine <54219287+D-Cysteine@users.noreply.github.com> Date: Thu, 9 Sep 2021 03:33:04 -0600 Subject: [PATCH] Fix projectile damage calculation, and check bolt head material --- build.properties | 2 +- .../replacing/ModPartReplacement.java | 16 ++++++++++++++-- .../replacing/ReplacementLogic.java | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/build.properties b/build.properties index 64f4336..69b0229 100644 --- a/build.properties +++ b/build.properties @@ -1,4 +1,4 @@ -mod_version=2.1.7 +mod_version=2.1.8 minecraft_version=1.7.10 forge_version=10.13.4.1614-1.7.10 tconstruct_version=1.8.4.build951 diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ModPartReplacement.java b/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ModPartReplacement.java index 94a15b3..70521dc 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ModPartReplacement.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ModPartReplacement.java @@ -10,6 +10,7 @@ import tconstruct.library.TConstructRegistry; import tconstruct.library.crafting.ToolBuilder; import tconstruct.library.crafting.ToolRecipe; import tconstruct.library.modifier.ItemModifier; +import tconstruct.library.tools.DualMaterialToolPart; import tconstruct.library.tools.ToolCore; import tconstruct.library.util.IToolPart; import tconstruct.tools.TinkerTools; @@ -45,7 +46,7 @@ public class ModPartReplacement extends ItemModifier { return false; // check if any of the tools parts contain stone. we have to prevent exchanging that with disabled stone tools - // because otherwise the replacement-logic would not be able to obtain neccessary information and crash. + // because otherwise the replacement-logic would not be able to obtain necessary information and crash. if(Config.disableStoneTools) { if(tool.getHeadItem() != null && getToolPartMaterial(tags, HEAD) == 1) @@ -134,6 +135,7 @@ public class ModPartReplacement extends ItemModifier { return false; // do we have enough modifiers left if we exchange this part? + // This probably doesn't work right for bolts (which replace two parts at a time). if(hasExtraModifier(oldMatId)) // paper or thaumium. sadly hardcoded. modifiers--; if(hasExtraModifier(newMatId)) @@ -142,8 +144,18 @@ public class ModPartReplacement extends ItemModifier { return false; // is it the same material as the one we want to replace? - if(newMatId == oldMatId) + if (newMatId == oldMatId) { + // Special case for bolts, which have two materials. + if (tool == TinkerWeaponry.boltAmmo && replacementPartItem instanceof DualMaterialToolPart) { + int newHeadMatId = + ((DualMaterialToolPart) replacementPartItem).getMaterialID2(parts[partIndex]); + int oldHeadMatId = getToolPartMaterial(tags, HEAD); + + return newHeadMatId != oldHeadMatId; + } + return false; + } return true; } diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ReplacementLogic.java b/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ReplacementLogic.java index e23ec07..384bb65 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ReplacementLogic.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/replacing/ReplacementLogic.java @@ -123,6 +123,7 @@ public final class ReplacementLogic { // update damage updateTag(newTags, tags, "Attack"); + updateTag(newTags, tags, "BaseAttack"); // update mining speed updateTag(newTags, tags, "MiningSpeed");