Finished the Thermal Generator
This commit is contained in:
parent
07fe6ab3db
commit
25272228e2
1 changed files with 11 additions and 3 deletions
|
@ -19,9 +19,10 @@ import techreborn.util.Tank;
|
|||
|
||||
public class TileThermalGenerator extends TileEntity implements IWrenchable, IFluidHandler, IInventory {
|
||||
|
||||
public Tank tank = new Tank("TileThermalGenerator", FluidContainerRegistry.BUCKET_VOLUME * 16, this);
|
||||
public Tank tank = new Tank("TileThermalGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||
public Inventory inventory = new Inventory(3, "TileThermalGenerator", 64);
|
||||
public BasicSource energySource;
|
||||
public static final int euTick = 30;
|
||||
|
||||
public TileThermalGenerator() {
|
||||
this.energySource = new BasicSource(this, 1000000, 1);
|
||||
|
@ -125,9 +126,16 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
|
|||
super.updateEntity();
|
||||
drainContainers(this, inventory, 0, 1);
|
||||
energySource.updateEntity();
|
||||
if(tank.getFluidAmount() > 0 && energySource.getEnergyStored() < energySource.getCapacity()){
|
||||
//TODO make power
|
||||
if(tank.getFluidAmount() > 0 && energySource.getCapacity() - energySource.getEnergyStored() >= euTick){
|
||||
tank.drain(1, true);
|
||||
energySource.addEnergy(euTick);
|
||||
}
|
||||
if(tank.getFluidType() != null && getStackInSlot(2) == null){
|
||||
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||
} else if(tank.getFluidType() == null && getStackInSlot(2) != null){
|
||||
setInventorySlotContents(2, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean drainContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot) {
|
||||
|
|
Loading…
Reference in a new issue