Some machines can use batteries now

This commit is contained in:
drcrazy 2017-09-16 00:50:43 +03:00
parent 4ccd3ff290
commit 01c04c27bb
23 changed files with 143 additions and 138 deletions

View file

@ -44,7 +44,7 @@ import techreborn.init.ModBlocks;
public class TileImplosionCompressor extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
public Inventory inventory = new Inventory(4, "TileImplosionCompressor", 64, this);
public Inventory inventory = new Inventory(5, "TileImplosionCompressor", 64, this);
public MultiblockChecker multiblockChecker;
public RecipeCrafter crafter;
@ -75,8 +75,10 @@ public class TileImplosionCompressor extends TilePowerAcceptor
@Override
public void update() {
if (this.world.isRemote) { return; }
if (this.getMutliBlock()) {
super.update();
this.charge(4);
}
}
@ -152,9 +154,9 @@ public class TileImplosionCompressor extends TilePowerAcceptor
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory().hotbar()
.addInventory().tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
}
}

View file

@ -64,7 +64,7 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
public TileIndustrialBlastFurnace() {
super();
// TODO configs
this.inventory = new Inventory(4, "TileIndustrialBlastFurnace", 64, this);
this.inventory = new Inventory(5, "TileIndustrialBlastFurnace", 64, this);
final int[] inputs = new int[2];
inputs[0] = 0;
inputs[1] = 1;
@ -97,6 +97,7 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
if (this.getMutliBlock()) {
super.update();
this.charge(4);
}
}
@ -250,9 +251,9 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory().hotbar()
.addInventory().tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
.syncEnergyValue().syncCrafterValue().syncIntegerValue(this::getHeat, this::setHeat).addInventory()
.create(this);
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue()
.syncIntegerValue(this::getHeat, this::setHeat).addInventory().create(this);
}
}

View file

@ -66,7 +66,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
// TODO configs
tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this);
inventory = new Inventory(7, "TileIndustrialGrinder", 64, this);
inventory = new Inventory(8, "TileIndustrialGrinder", 64, this);
ticksSinceLastChange = 0;
final int[] inputs = new int[2];
inputs[0] = 0;
@ -102,26 +102,25 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
@Override
public void update() {
ticksSinceLastChange++;
super.update();
if (this.multiblockChecker == null) {
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2).down();
this.multiblockChecker = new MultiblockChecker(this.world, pos);
}
if (this.getMutliBlock()) {
super.update();
}
//Check cells input slot 2 time per second
if (ticksSinceLastChange >= 10){
if (!this.inventory.getStackInSlot(1).isEmpty()){
this.ticksSinceLastChange++;
// Check cells input slot 2 time per second
if (this.ticksSinceLastChange >= 10) {
if (!this.inventory.getStackInSlot(1).isEmpty()) {
FluidUtils.drainContainers(this.tank, this.inventory, 1, 6);
FluidUtils.fillContainers(this.tank, this.inventory, 1, 6, this.tank.getFluidType());
}
ticksSinceLastChange = 0;
this.ticksSinceLastChange = 0;
}
if (!world.isRemote && this.getMutliBlock()) {
this.charge(7);
}
}
@Override
@ -273,10 +272,10 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar()
.addInventory().tile(this).slot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
.outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).syncEnergyValue().syncCrafterValue().addInventory()
.create(this);
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
.outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).energySlot(7, 8, 72)
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
}
}

View file

@ -62,8 +62,10 @@ public class TileVacuumFreezer extends TilePowerAcceptor
@Override
public void update() {
if (world.isRemote){ return; }
if (this.getMultiBlock()) {
super.update();
this.charge(2);
}
}
@ -149,8 +151,8 @@ public class TileVacuumFreezer extends TilePowerAcceptor
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory()
.create(this);
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.syncCrafterValue().addInventory().create(this);
}
}