Finish armor porting

This commit is contained in:
mDiyo committed 2014-07-03 16:11:54 -08:00
1 parent c13c8f8050
commit 2bb35b18e0
10 files changed
+449 -229

No files matched your search

@@ -6,7 +6,9 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tconstruct.library.crafting.ModifyBuilder;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.modifier.IModifyable;
import tconstruct.tools.inventory.ToolForgeContainer;
/* Simple class for storing items in the block
@@ -37,6 +39,66 @@ public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory
@Override
public void buildTool (String name)
{
ItemStack output = null;
if (inventory[1] != null)
{
if (inventory[1].getItem() instanceof IModifyable) //Modify item
{
if (inventory[2] == null && inventory[3] == null && inventory[4] == null)
output = inventory[1].copy();
else
{
output = ModifyBuilder.instance.modifyItem(inventory[1], new ItemStack[] { inventory[2], inventory[3], inventory[4] });
}
}
else
//Build new item
{
toolName = name;
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name);
if (inventory[0] == null)
output = tool;
else if (tool != null)
{
//NBTTagCompound tags = tool.getTagCompound();
//if (!tags.getCompoundTag(((IModifyable) tool.getItem()).getBaseTagName()).hasKey("Built"))
//{
output = tool;
//}
}
}
if (!name.equals("")) //Name item
{
ItemStack temp = inventory[1].copy();
if (output != null)
temp = output;
if (temp != null)
{
NBTTagCompound tags = temp.getTagCompound();
if (tags == null)
{
tags = new NBTTagCompound();
temp.setTagCompound(tags);
}
if (!(tags.hasKey("display")))
{
NBTTagCompound display = new NBTTagCompound();
String dName = temp.getItem() instanceof IModifyable ? "\u00A7f" + name : name;
display.setString("Name", dName);
tags.setTag("display", display);
temp.setRepairCost(2);
output = temp;
}
}
}
}
inventory[0] = output;
}
/*public void buildTool (String name)
{
toolName = name;
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name);
@@ -50,5 +112,5 @@ public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory
inventory[0] = tool;
}
}
}
}*/
}