summaryrefslogtreecommitdiff
path: root/ihl/processing/metallurgy/LathePart1TileEntity.java
blob: ddf834bc58be6a603b349c5ef7218796f140ae1e (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package ihl.processing.metallurgy;

import java.util.List;
import ic2.core.ContainerBase;
import ihl.interfaces.IWorkspaceElement;
import ihl.utils.IHLUtils;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class LathePart1TileEntity extends BasicElectricMotorTileEntity implements IWorkspaceElement{

	public boolean ready=false;
	
	public LathePart1TileEntity()
	{
		super();
	}
	

	@Override
	public String getInventoryName() {
		return "Lathe";
	}
    
	@Override
	public void operate() 
	{
		ready=true;
	}
	
	@Override
	public ItemStack getWrenchDrop(EntityPlayer player)
	{
		return IHLUtils.getThisModItemStack("lathePart1");
	}
	
	@Override
	@SideOnly(Side.CLIENT)
	public GuiScreen getGui(EntityPlayer player, boolean arg1) {
		return new LatheGui(new LatheContainer(player, this));
	}
	
	@Override
	public ContainerBase<?> getGuiContainer(EntityPlayer player) {
		return new LatheContainer(player, this);
	}
	

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public List[] getInput() 
	{
		return null;
	}

	@Override
	public boolean canOperate()
	{
		TileEntity te = worldObj.getTileEntity(xCoord+ForgeDirection.getOrientation(getFacing()).offsetX,yCoord,zCoord+ForgeDirection.getOrientation(getFacing()).offsetZ);
		if(te!=null && te instanceof LathePart2TileEntity)
		{
	        return !ready;
		}
		return false;
	}

	@Override
	public void onGuiClosed(EntityPlayer arg0) {}
	
	@Override
	public boolean canBeUsed() 
	{
        return ready;
	}

	@Override
	public void use() 
	{
		ready=false;
	}

	@Override
	public boolean getIsInvalid() 
	{
		return this.isInvalid();
	}
	
	@Override
    public boolean shouldRenderInPass(int pass)
    {
        return pass==0;
    }
}