This commit is contained in:
khj xiaogu 2021-12-07 13:35:25 +08:00
parent 1bad392760
commit b3427dec54
No known key found for this signature in database
GPG key ID: DEA172814EAFF426
2 changed files with 20 additions and 11 deletions

View file

@ -81,7 +81,7 @@ public abstract class BoilerBlock extends Block implements ILiquidContainer {
TileEntity te = p_180655_2_.getBlockEntity(p_180655_3_);
if (te instanceof BoilerTileEntity) {
BoilerTileEntity boiler = (BoilerTileEntity) te;
if (boiler.output.getFluidAmount()>=10000) {//steam leaking
if (boiler.output.getFluidAmount()>=10000&&boiler.lastheat!=0) {//steam leaking
double d0 = p_180655_3_.getX();
double d1 = p_180655_3_.getY() + 1;
double d2 = p_180655_3_.getZ();

View file

@ -149,17 +149,26 @@ public abstract class BoilerTileEntity extends TileEntity implements IHeatReceiv
@Override
public void tick() {
lastheat=heatreceived;
//debug
if (this.level != null && !this.level.isClientSide&&heatreceived!=0) {
int consume = Math.min(getHUPerTick(), heatreceived);
heatreceived = 0;
double waterconsume=(SPConfig.COMMON.steamPerWater.get()*10);
consume = Math.min((int)(this.input.drain((int) Math.ceil(consume / waterconsume), FluidAction.EXECUTE).getAmount() * waterconsume), consume);
this.output.fill(new FluidStack(FluidRegistry.steam.get().getFluid(), consume / 10), FluidAction.EXECUTE);
this.level.sendBlockUpdated(this.getBlockPos(),this.getBlockState(),this.getBlockState(), 3);
this.setChanged();
if (this.level != null && !this.level.isClientSide) {
boolean flag=false;
if(lastheat!=heatreceived)
flag=true;
lastheat=heatreceived;
if(heatreceived!=0) {
int consume = Math.min(getHUPerTick(), heatreceived);
heatreceived = 0;
double waterconsume=(SPConfig.COMMON.steamPerWater.get()*10);
consume = Math.min((int)(this.input.drain((int) Math.ceil(consume / waterconsume), FluidAction.EXECUTE).getAmount() * waterconsume), consume);
this.output.fill(new FluidStack(FluidRegistry.steam.get().getFluid(), consume / 10), FluidAction.EXECUTE);
flag=true;
}
if(flag) {
this.setChanged();
this.level.sendBlockUpdated(this.getBlockPos(),this.getBlockState(),this.getBlockState(), 3);
}
}
}