-
Notifications
You must be signed in to change notification settings - Fork 755
/
ToolForgeLogic.java
53 lines (46 loc) · 1.4 KB
/
ToolForgeLogic.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package tconstruct.blocks.logic;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tconstruct.inventory.ToolForgeContainer;
import tconstruct.library.crafting.ToolBuilder;
/* Simple class for storing items in the block
*/
public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory
{
ItemStack previousTool;
String toolName;
public ToolForgeLogic()
{
super(6);
toolName = "";
}
@Override
public String getDefaultName ()
{
return "crafters.ToolForge";
}
@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;
}
}
}
}