2013-07-26 21:18:53 -07:00
|
|
|
package tconstruct.blocks.logic;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
|
import net.minecraft.inventory.Container;
|
2014-02-14 23:05:41 -05:00
|
|
|
import net.minecraft.inventory.ISidedInventory;
|
2013-07-26 21:18:53 -07:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
import net.minecraft.world.World;
|
2014-02-05 10:28:54 -05:00
|
|
|
import tconstruct.inventory.ToolForgeContainer;
|
|
|
|
|
import tconstruct.library.crafting.ToolBuilder;
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
/* Simple class for storing items in the block
|
|
|
|
|
*/
|
|
|
|
|
|
2014-02-14 23:05:41 -05:00
|
|
|
public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
|
|
|
|
ItemStack previousTool;
|
|
|
|
|
String toolName;
|
|
|
|
|
|
|
|
|
|
public ToolForgeLogic()
|
|
|
|
|
{
|
|
|
|
|
super(6);
|
|
|
|
|
toolName = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getDefaultName ()
|
|
|
|
|
{
|
2013-08-16 09:30:56 -07:00
|
|
|
return "crafters.ToolForge";
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
|
|
|
|
|
{
|
|
|
|
|
return new ToolForgeContainer(inventoryplayer, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void buildTool (String name)
|
|
|
|
|
{
|
|
|
|
|
toolName = name;
|
|
|
|
|
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name);
|
|
|
|
|
if (inventory[0] == null)
|
|
|
|
|
inventory[0] = tool;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NBTTagCompound tags = inventory[0].getTagCompound();
|
|
|
|
|
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
|
|
|
|
|
{
|
|
|
|
|
inventory[0] = tool;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-02-14 23:05:41 -05:00
|
|
|
}
|