mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Make modifiers only applicable to their valid types. Fix some inconsistencies with that. Might possibly contain bugs still.
This commit is contained in:
1 parent
9d8e8128b0
commit
1cd4f214ff
7 files changed
+36
-4
No files matched your search
@@ -13,6 +13,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.init.*;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
@@ -29,6 +30,7 @@ import tconstruct.library.crafting.*;
|
||||
import tconstruct.modifiers.accessory.GloveSpeed;
|
||||
import tconstruct.modifiers.armor.*;
|
||||
import tconstruct.modifiers.tools.ModAttack;
|
||||
import tconstruct.modifiers.tools.ModInteger;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
@@ -226,6 +228,7 @@ public class TinkerArmor
|
||||
//MultiType
|
||||
ModifyBuilder.registerModifier(new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(Blocks.piston) }));
|
||||
ModifyBuilder.registerModifier(new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 1), new ItemStack(Blocks.piston) }));
|
||||
ModifyBuilder.registerModifier(new AModInteger(4, "Moss", EnumSet.of(ArmorPart.Legs, ArmorPart.Feet, ArmorPart.Chest, ArmorPart.Head), new ItemStack[] { new ItemStack(TinkerTools.materials, 1, 6) }, 3, "\u00a72", StatCollector.translateToLocal("modifier.tool.moss")));
|
||||
ModifyBuilder.registerModifier(new TravelModRepair());
|
||||
TConstructRegistry.registerActiveArmorMod(new ActiveTinkerArmor());
|
||||
|
||||
|
||||
@@ -47,4 +47,9 @@ public class TravelGlove extends AccessoryCore implements IAccessoryModel
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] { "accessory", "glove" };
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,6 @@ public abstract class ArmorMod extends ItemModifier
|
||||
@Override
|
||||
public boolean validType (IModifyable type)
|
||||
{
|
||||
return type.getModifyType().equals("Armor");
|
||||
return type.getModifyType().equals("Armor") || type.getModifyType().equals("Clothing");
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class ModifyBuilder
|
||||
boolean built = false;
|
||||
for (ItemModifier mod : itemModifiers)
|
||||
{
|
||||
if (mod.matches(modifiers, copy))
|
||||
if (mod.matches(modifiers, copy) && mod.validType(item))
|
||||
{
|
||||
built = true;
|
||||
mod.addMatchingEffect(copy); //Order matters here
|
||||
|
||||
@@ -2,9 +2,12 @@ package tconstruct.modifiers.accessory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.modifiers.tools.ItemModTypeFilter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class GloveSpeed extends ItemModTypeFilter
|
||||
{
|
||||
String tooltipName;
|
||||
@@ -19,9 +22,12 @@ public class GloveSpeed extends ItemModTypeFilter
|
||||
@Override
|
||||
protected boolean canModify (ItemStack input, ItemStack[] modifiers)
|
||||
{
|
||||
IModifyable imod = (IModifyable) input.getItem();
|
||||
if (imod.getModifyType().equals("Accessory"))
|
||||
if (input.getItem() instanceof AccessoryCore)
|
||||
{
|
||||
// is glove?
|
||||
if(!Arrays.asList(((AccessoryCore) input.getItem()).getTraits()).contains("glove"))
|
||||
return false;
|
||||
|
||||
NBTTagCompound tags = getModifierTag(input);
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(modifiers) <= max;//This line fails?
|
||||
@@ -91,4 +97,10 @@ public class GloveSpeed extends ItemModTypeFilter
|
||||
String modName = "\u00a74Redstone (" + keys[0] + "/" + keys[1] + ")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (IModifyable type)
|
||||
{
|
||||
return type.getModifyType().equals("Accessory");
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package tconstruct.modifiers.tools;
|
||||
import java.util.*;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ModRedstone extends ItemModTypeFilter
|
||||
@@ -127,6 +128,11 @@ public class ModRedstone extends ItemModTypeFilter
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
|
||||
public boolean validType (IModifyable input)
|
||||
{
|
||||
return input.getModifyType().equals("Tool");
|
||||
}
|
||||
|
||||
public boolean validType (ToolCore tool)
|
||||
{
|
||||
List list = Arrays.asList(tool.getTraits());
|
||||
|
||||
@@ -3,6 +3,7 @@ package tconstruct.modifiers.tools;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.*;
|
||||
|
||||
@@ -130,4 +131,9 @@ public class ModToolRepair extends ItemModifier
|
||||
public void addMatchingEffect (ItemStack tool)
|
||||
{
|
||||
}
|
||||
|
||||
public boolean validType (IModifyable input)
|
||||
{
|
||||
return input.getModifyType().equals("Tool") || input.getModifyType().equals("Armor");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user