mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 17:04:24 +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
@@ -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