more misc fluid work, gonna leave most of this untill we have an offical or new api
This commit is contained in:
parent
0742abb840
commit
6a93c3fd46
28 changed files with 147 additions and 404 deletions
|
@ -92,7 +92,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
|||
// Check cells input slot 2 time per second
|
||||
if (!world.isClient && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 2, tank.getFluidType());
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 2, tank.getFluid());
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
@ -101,7 +101,6 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
|||
super.tick();
|
||||
}
|
||||
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -144,7 +143,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
|||
public BuiltContainer createContainer(int syncID, PlayerEntity player) {
|
||||
return new ContainerBuilder("fluidreplicator").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.blockEntity(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isItemEqualIgnoreDamage(TRContent.Parts.UU_MATTER.getStack()))
|
||||
.outputSlot(2, 124, 55).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.outputSlot(2, 124, 55).energySlot(3, 8, 72).sync(tank).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this, syncID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl
|
|||
if (!world.isClient && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 6);
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 6, tank.getFluidType());
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 6, tank.getFluid());
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
@ -116,8 +116,6 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl
|
|||
if (!world.isClient && getMultiBlock()) {
|
||||
super.tick();
|
||||
}
|
||||
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -147,7 +145,7 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl
|
|||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.blockEntity(this).fluidSlot(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, syncID);
|
||||
.sync(tank).syncEnergyValue().syncCrafterValue().addInventory().create(this, syncID);
|
||||
}
|
||||
|
||||
}
|
|
@ -98,7 +98,7 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl
|
|||
if (!world.isClient && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getInvStack(1).isEmpty()) {
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 5);
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 5, tank.getFluidType());
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 5, tank.getFluidInstance().getFluid());
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
@ -107,7 +107,6 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl
|
|||
super.tick();
|
||||
}
|
||||
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
|
@ -147,7 +146,7 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl
|
|||
public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
|
||||
return new ContainerBuilder("industrialsawmill").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.blockEntity(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 25).outputSlot(3, 126, 43)
|
||||
.outputSlot(4, 126, 61).outputSlot(5, 34, 55).energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.outputSlot(4, 126, 61).outputSlot(5, 34, 55).energySlot(6, 8, 72).sync(tank).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this, syncID);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ import reborncore.common.util.Tank;
|
|||
import techreborn.TechReborn;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
@ -89,14 +90,12 @@ public class QuantumTankBlockEntity extends MachineBaseBlockEntity
|
|||
public void tick() {
|
||||
super.tick();
|
||||
if (!world.isClient) {
|
||||
// TODO: Fix in 1.13
|
||||
// if (FluidUtils.drainContainers(tank, inventory, 0, 1)
|
||||
// || FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluidType())) {
|
||||
// this.syncWithAll();
|
||||
// }
|
||||
if (FluidUtils.drainContainers(tank, inventory, 0, 1)
|
||||
|| FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluid())) {
|
||||
this.syncWithAll();
|
||||
}
|
||||
|
||||
}
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,8 +132,8 @@ public class QuantumTankBlockEntity extends MachineBaseBlockEntity
|
|||
@Override
|
||||
public void addInfo(final List<Text> info, final boolean isReal, boolean hasData) {
|
||||
if (isReal | hasData) {
|
||||
if (this.tank.getFluid() != null) {
|
||||
info.add(new LiteralText(this.tank.getFluidAmount() + " of " + this.tank.getFluidType()));
|
||||
if (!this.tank.getFluidInstance().isEmpty()) {
|
||||
info.add(new LiteralText(this.tank.getFluidAmount() + " of " + this.tank.getFluid()));
|
||||
} else {
|
||||
info.add(new LiteralText("Empty"));
|
||||
}
|
||||
|
@ -146,8 +145,8 @@ public class QuantumTankBlockEntity extends MachineBaseBlockEntity
|
|||
@Override
|
||||
public BuiltContainer createContainer(int syncID, final PlayerEntity player) {
|
||||
return new ContainerBuilder("quantumtank").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().blockEntity(this).fluidSlot(0, 80, 17).outputSlot(1, 80, 53).addInventory()
|
||||
.create(this, syncID);
|
||||
.addInventory().blockEntity(this).fluidSlot(0, 80, 17).outputSlot(1, 80, 53)
|
||||
.sync(tank).addInventory().create(this, syncID);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue