mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-28 07:56:01 +00:00
Finish updating slot logic for Tool Stations, fix dupe bugs
This commit is contained in:
1 parent
c16c376868
commit
2629e241cd
26 files changed
+202
-154
No files matched your search
@@ -7,7 +7,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.ToolStationContainer;
|
||||
|
||||
/* Simple class for storing items in the block
|
||||
@@ -69,18 +71,63 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory
|
||||
|
||||
public void buildTool (String name)
|
||||
{
|
||||
toolName = name;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], name);
|
||||
if (inventory[0] == null)
|
||||
inventory[0] = tool;
|
||||
else
|
||||
ItemStack output = null;
|
||||
if (inventory[1] != null)
|
||||
{
|
||||
NBTTagCompound tags = inventory[0].getTagCompound();
|
||||
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
|
||||
if (inventory[1].getItem() instanceof IModifyable) //Modify item
|
||||
{
|
||||
inventory[0] = tool;
|
||||
if (inventory[2] == null && inventory[3] == null)
|
||||
output = inventory[1].copy();
|
||||
else
|
||||
{
|
||||
output = ModifyBuilder.instance.modifyItem(inventory[1], new ItemStack[] { inventory[2], inventory[3] });
|
||||
}
|
||||
}
|
||||
else
|
||||
//Build new item
|
||||
{
|
||||
toolName = name;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], 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 setToolname (String name)
|
||||
|
||||
Reference in new issue
Block a user