fix display issues

This commit is contained in:
khj xiaogu 2022-02-27 22:32:16 +08:00
parent 432430bf23
commit e842df2384
No known key found for this signature in database
GPG key ID: DEA172814EAFF426
2 changed files with 11 additions and 5 deletions

View file

@ -75,27 +75,32 @@ public abstract class SteamEngineTileEntity extends EngineTileEntity implements
if (level != null && !level.isClientSide) {
BlockState state = this.level.getBlockState(this.worldPosition);
if (this.poweredWheel == null || this.poweredWheel.isRemoved()) {
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, false));
this.appliedCapacity = 0;
this.appliedSpeed = 0;
this.refreshWheelSpeed();
heatup = 0;
tank.drain(this.getSteamConsumptionPerTick(), IFluidHandler.FluidAction.EXECUTE);
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, false));
} else {
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 >= 60) {
this.appliedCapacity = this.getGeneratingCapacity();
this.appliedSpeed = this.getGeneratingSpeed();
this.refreshWheelSpeed();
} else
heatup++;
this.level.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, true));
} 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.setBlockAndUpdate(this.worldPosition, state.setValue(SteamEngineBlock.LIT, false));
}
}
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
@ -153,11 +158,11 @@ public abstract class SteamEngineTileEntity extends EngineTileEntity implements
}
public void attachWheel() {
Direction engineFacing = (Direction) this.getBlockState().getValue(EngineBlock.FACING);
Direction engineFacing = this.getBlockState().getValue(EngineBlock.FACING);
BlockPos wheelPos = this.worldPosition.relative(engineFacing, 2);
BlockState wheelState = this.level.getBlockState(wheelPos);
if (this.getFlywheel() == wheelState.getBlock()) {
Direction wheelFacing = (Direction) wheelState.getValue(FlywheelBlock.HORIZONTAL_FACING);
Direction wheelFacing = wheelState.getValue(FlywheelBlock.HORIZONTAL_FACING);
if (wheelFacing.getAxis() == engineFacing.getClockWise().getAxis()) {
if (!FlywheelBlock.isConnected(wheelState)
|| FlywheelBlock.getConnection(wheelState) == engineFacing.getOpposite()) {

View file

@ -56,6 +56,7 @@ public class SteelSteamEngineBlock extends SteamEngineBlock implements ITE<Steel
}else {
t.add(TooltipHelper.holdShift(Palette.Gray,false));
}
super.appendHoverText(i,w,t,f);
}
@Override