more glitch fix

This commit is contained in:
khj xiaogu 2021-12-03 15:25:21 +08:00
parent 198126052f
commit 58a3c6b846
No known key found for this signature in database
GPG key ID: DEA172814EAFF426

View file

@ -68,23 +68,21 @@ public abstract class SteamEngineTileEntity extends EngineTileEntity implements
super.tick();
if (level != null && !level.isClientSide) {
BlockState state = this.level.getBlockState(this.worldPosition);
if (!tank.isEmpty()) {
if (tank.drain(this.getSteamConsumptionPerTick(), IFluidHandler.FluidAction.EXECUTE).getAmount() >= this.getSteamConsumptionPerTick()) {
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, true));
if(heatup>=20) {
this.appliedCapacity = this.getGeneratingCapacity();
this.appliedSpeed = this.getGeneratingSpeed();
this.refreshWheelSpeed();
}else
heatup++;
}
} else {
if(heatup>0)
heatup--;
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, false));
this.appliedCapacity = 0;
this.appliedSpeed = 0;
this.refreshWheelSpeed();
if (!tank.isEmpty()&&tank.drain(this.getSteamConsumptionPerTick(), IFluidHandler.FluidAction.EXECUTE).getAmount() >= this.getSteamConsumptionPerTick()) {
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, true));
if(heatup>=20) {
this.appliedCapacity = this.getGeneratingCapacity();
this.appliedSpeed = this.getGeneratingSpeed();
this.refreshWheelSpeed();
}else
heatup++;
}else {
if(heatup>0)
heatup--;
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, false));
this.appliedCapacity = 0;
this.appliedSpeed = 0;
this.refreshWheelSpeed();
}
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
}