aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/TileEntityRTG.java
blob: cea09bdd5c150c7cc08eaf4cd49e5b3847a930d2 (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
package gtPlusPlus.xmod.ic2.block.RTGGenerator;

import gtPlusPlus.xmod.ic2.block.RTGGenerator.gui.CONTAINER_RTG;
import gtPlusPlus.xmod.ic2.block.RTGGenerator.gui.GUI_RTG;
import ic2.core.ContainerBase;
import ic2.core.Ic2Items;
import ic2.core.block.generator.tileentity.TileEntityRTGenerator;
import ic2.core.block.invslot.InvSlotConsumable;
import ic2.core.block.invslot.InvSlotConsumableId;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class TileEntityRTG
extends TileEntityRTGenerator
{
	public final InvSlotConsumable fuelSlot;

	public TileEntityRTG()
	{
		this.fuelSlot = new InvSlotConsumableId(this, "fuelSlot", 0, 12, new Item[] { Ic2Items.RTGPellets.getItem() });
	}

	@Override
	public int gaugeFuelScaled(int i)
	{
		return i;
	}

	@Override
	 public boolean gainEnergy()
	  {
	    int counter = 0;
	    for (int i = 0; i < this.fuelSlot.size(); i++) {
	      if (this.fuelSlot.get(i) != null) {
	        counter++;
	      }
	    }
	    if (counter == 0) {
	      return false;
	    }
	    this.storage += (int)Math.pow(2.0D, counter - 1);
	    return true;
	  }

	@Override
	public boolean gainFuel()
	{
		return false;
	}

	@Override
	public boolean needsFuel()
	{
		return true;
	}

	@Override
	public String getInventoryName()
	{
		return "RTG";
	}
	
	@Override
	public ContainerBase<TileEntityRTGenerator> getGuiContainer(EntityPlayer entityPlayer)
	{
		return new CONTAINER_RTG(entityPlayer, this);
	}

	@Override
	@SideOnly(Side.CLIENT)
	public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin)
	{
		return new GUI_RTG(new CONTAINER_RTG(entityPlayer, this));
	}

	@Override
	public boolean delayActiveUpdate()
	{
		return true;
	}

	
}