mirror of
https://github.com/GTNewHorizons/IguanaTweaksTConstruct.git
synced 2026-11-25 14:24:44 +00:00
Fix part replacing giving non-ammo tools the ammo-attack-modifier therefore breaking the ammo modifier on them.
This commit is contained in:
1 parent
da05afc94c
commit
b9c7212e81
1 file changed
+20
-18
@@ -12,6 +12,9 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ModifyBuilder;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
@@ -352,27 +355,26 @@ public final class ReplacementLogic {
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers"); // backup modifiers
|
||||
|
||||
// find the correct(!!, not glove attack) modifier
|
||||
for(ItemModifier mod : ModifyBuilder.instance.itemModifiers)
|
||||
if(mod.key.equals("ModAttack"))
|
||||
{
|
||||
ModAttack modAttack = (ModAttack)mod;
|
||||
int[] keyPair = tags.getIntArray("ModAttack");
|
||||
// get amount of redstone applied
|
||||
int qLvl = keyPair[0];
|
||||
// reset redstone modifier
|
||||
tags.removeTag("ModAttack");
|
||||
ModAttack modAttack = TinkerTools.modAttack;
|
||||
// ammo weapons have their own modifier
|
||||
if(itemStack.getItem() instanceof ToolCore && TinkerWeaponry.modAttack != null && Arrays.asList(((ToolCore) itemStack.getItem()).getTraits()).contains("ammo"))
|
||||
modAttack = TinkerWeaponry.modAttack;
|
||||
|
||||
// remove the old tooltip
|
||||
int tipIndex = keyPair[2];
|
||||
tags.removeTag("Tooltip" + tipIndex);
|
||||
tags.removeTag("ModifierTip" + tipIndex);
|
||||
int[] keyPair = tags.getIntArray("ModAttack");
|
||||
// get amount of redstone applied
|
||||
int qLvl = keyPair[0];
|
||||
// reset redstone modifier
|
||||
tags.removeTag("ModAttack");
|
||||
|
||||
// remove the old tooltip
|
||||
int tipIndex = keyPair[2];
|
||||
tags.removeTag("Tooltip" + tipIndex);
|
||||
tags.removeTag("ModifierTip" + tipIndex);
|
||||
|
||||
|
||||
// reapply redstone
|
||||
while(qLvl-- > 0)
|
||||
modAttack.modify(new ItemStack[]{new ItemStack(Items.quartz)}, itemStack); // tags belong to oldTool
|
||||
}
|
||||
// reapply redstone
|
||||
while(qLvl-- > 0)
|
||||
modAttack.modify(new ItemStack[]{new ItemStack(Items.quartz)}, itemStack); // tags belong to oldTool
|
||||
|
||||
// restore modifiers
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
|
||||
Reference in new issue
Block a user