Updated fluid generators GUI. Closes #1097
This commit is contained in:
parent
37d8b8641f
commit
dfaef8a6c2
12 changed files with 92 additions and 184 deletions
|
@ -24,7 +24,6 @@
|
|||
|
||||
package techreborn.tiles.generator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
|
@ -71,9 +70,9 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
this.ticksSinceLastChange++;
|
||||
public void update() {
|
||||
super.update();
|
||||
this.ticksSinceLastChange++;
|
||||
|
||||
// Check cells input slot 2 time per second
|
||||
if (this.ticksSinceLastChange >= 10) {
|
||||
|
@ -83,7 +82,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
}
|
||||
this.ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
|
||||
if (this.tank.getFluidAmount() > 0) {
|
||||
if (this.currentRecipe == null || !this.currentRecipe.getFluid().equals(this.tank.getFluidType()))
|
||||
this.currentRecipe = this.getRecipes().getRecipeForFluid(this.tank.getFluidType()).orElse(null);
|
||||
|
@ -101,7 +100,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!this.world.isRemote) {
|
||||
if (this.world.getTotalWorldTime() - this.lastOutput < 30 && !this.isActive())
|
||||
this.world.setBlockState(this.getPos(), this.world.getBlockState(this.getPos()).withProperty(BlockMachineBase.ACTIVE, true));
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TileDieselGenerator extends TileBaseFluidGenerator implements ICont
|
|||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("dieselgenerator").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 10, 35).outputSlot(1, 10, 55).syncEnergyValue()
|
||||
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ public class TileGasTurbine extends TileBaseFluidGenerator implements IContainer
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("gasturbine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
||||
return new ContainerBuilder("gasturbine").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,11 +60,16 @@ public class TileSemiFluidGenerator extends TileBaseFluidGenerator implements IC
|
|||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return maxOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("semifluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
||||
return new ContainerBuilder("semifluidgenerator").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,36 +61,6 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
|
|||
return new ItemStack(ModBlocks.THERMAL_GENERATOR, 1);
|
||||
}
|
||||
|
||||
public boolean isOn = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (!this.world.isRemote) {
|
||||
boolean didRun = false;
|
||||
if (this.acceptFluid() && FluidUtils.drainContainers(this.tank, this.inventory, 0, 1))
|
||||
this.syncWithAll();
|
||||
for (final EnumFacing direction : EnumFacing.values()) {
|
||||
if (this.world
|
||||
.getBlockState(new BlockPos(this.getPos().getX() + direction.getFrontOffsetX(),
|
||||
this.getPos().getY() + direction.getFrontOffsetY(),
|
||||
this.getPos().getZ() + direction.getFrontOffsetZ()))
|
||||
.getBlock() == Blocks.LAVA) {
|
||||
if (this.tryAddingEnergy(1)) {
|
||||
this.lastOutput = this.world.getTotalWorldTime();
|
||||
didRun = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (didRun != isOn) {
|
||||
isOn = didRun;
|
||||
world.setBlockState(pos, world.getBlockState(pos).withProperty(BlockThermalGenerator.ACTIVE, isOn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -103,8 +73,8 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("thermalgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
||||
return new ContainerBuilder("thermalgenerator").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue