mirror of
https://github.com/GTNewHorizons/IguanaTweaksTConstruct.git
synced 2026-11-28 07:35:57 +00:00
Bring back extra modifiers for paper and thaumium
However, the parts cannot be swapped once added to a tool
This commit is contained in:
1 parent
2c96c21842
commit
b8fc2ec0bd
4 files changed
+50
-16
No files matched your search
@@ -485,7 +485,7 @@ public class IguanaConfig {
|
||||
partTooltips = partTooltipsProperty.getBoolean(true);
|
||||
|
||||
Property partReplacementProperty = config.get("other", "partReplacement", true);
|
||||
partReplacementProperty.comment = "Can you replace parts of existing tools? (If true, paper/thaumium doesn't give extra modifiers)";
|
||||
partReplacementProperty.comment = "Can you replace parts of existing tools?";
|
||||
partReplacement = partReplacementProperty.getBoolean(true);
|
||||
|
||||
Property removeFlintDropProperty = config.get("other", "removeFlintDrop", true);
|
||||
|
||||
@@ -26,11 +26,16 @@ public class IguanaToolPart extends ToolPart {
|
||||
ToolMaterial material = TConstructRegistry.getMaterial(par1ItemStack.getItemDamage());
|
||||
if (!IguanaConfig.allowStoneTools && material.materialName.equals("Stone"))
|
||||
{
|
||||
par3List.add("Can only be used to make casts,");
|
||||
par3List.add("you cannot make a tool with this");
|
||||
par3List.add("\u00a74Can only be used to make casts,");
|
||||
par3List.add("\u00a74cannot be used to make a tool");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IguanaConfig.partReplacement && (material.ability.equals("Writable") || material.ability.equals("Thaumic")))
|
||||
{
|
||||
par3List.add("\u00a74Cannot be replaced once added to a tool");
|
||||
}
|
||||
|
||||
if (!material.ability.equals(""))
|
||||
{
|
||||
par3List.add("Ability: " + material.ability);
|
||||
|
||||
@@ -76,14 +76,50 @@ public class IguanaModUpgrade extends ToolMod {
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
// basic checks
|
||||
if (tool == null || tool.getItem() == null || !(tool.getItem() instanceof ToolCore)) return false;
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getInteger("Damage") > 0)
|
||||
return false;
|
||||
if (tags.getInteger("Damage") > 0) return false;
|
||||
|
||||
if (tool.getItem() instanceof ToolCore)
|
||||
return true;
|
||||
|
||||
// check which parts are changable
|
||||
String headAbility = TConstructRegistry.getMaterial(tags.getInteger("Head")).ability;
|
||||
boolean headChangable = headAbility.equals("Writable") || headAbility.equals("Thaumic") ? false : true;
|
||||
String handleAbility = TConstructRegistry.getMaterial(tags.getInteger("Handle")).ability;
|
||||
boolean handleChangable = handleAbility.equals("Writable") || headAbility.equals("Thaumic") ? false : true;
|
||||
|
||||
return false;
|
||||
boolean accessoryChangable = true;
|
||||
if (tags.hasKey("Accessory"))
|
||||
{
|
||||
String accessoryAbility = TConstructRegistry.getMaterial(tags.getInteger("Accessory")).ability;
|
||||
if (accessoryAbility.equals("Writable") || accessoryAbility.equals("Thaumic")) accessoryChangable = false;
|
||||
}
|
||||
|
||||
boolean extraChangable = true;
|
||||
if (tags.hasKey("Extra"))
|
||||
{
|
||||
String extraAbility = TConstructRegistry.getMaterial(tags.getInteger("Extra")).ability;
|
||||
if (extraAbility.equals("Writable") || extraAbility.equals("Thaumic")) extraChangable = false;
|
||||
}
|
||||
|
||||
ToolRecipe toolRecipe = GetRecipe((ToolCore)tool.getItem());
|
||||
if (toolRecipe == null) return false;
|
||||
|
||||
// check if trying to replace irreplacable parts
|
||||
for (ItemStack inputStack : input)
|
||||
{
|
||||
if (inputStack != null)
|
||||
{
|
||||
if (
|
||||
(toolRecipe.validHead(inputStack.getItem()) && headChangable == false)
|
||||
|| (toolRecipe.validHandle(inputStack.getItem()) && handleChangable == false)
|
||||
|| (toolRecipe.validAccessory(inputStack.getItem()) && accessoryChangable == false)
|
||||
|| (toolRecipe.validExtra(inputStack.getItem()) && extraChangable == false)
|
||||
) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -420,14 +420,7 @@ public class IguanaEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (IguanaConfig.partReplacement)
|
||||
{
|
||||
if (IguanaConfig.toolLeveling && IguanaConfig.toolLevelingExtraModifiers)
|
||||
toolTag.setInteger("Modifiers", 0);
|
||||
else
|
||||
toolTag.setInteger("Modifiers", 3);
|
||||
}
|
||||
else if (IguanaConfig.toolLeveling && IguanaConfig.toolLevelingExtraModifiers)
|
||||
if (IguanaConfig.toolLeveling && IguanaConfig.toolLevelingExtraModifiers)
|
||||
toolTag.setInteger("Modifiers", Math.max(toolTag.getInteger("Modifiers") - 3, 0));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user