优化showRange更新判定
This commit is contained in:
parent
db95b322b4
commit
18772a3620
1 changed files with 2 additions and 6 deletions
|
@ -105,12 +105,8 @@ public class ChargingStationBlockEntity extends BlockEntity implements WorldlyCo
|
|||
}
|
||||
|
||||
public static void serverTick(Level pLevel, BlockPos pPos, BlockState pState, ChargingStationBlockEntity blockEntity) {
|
||||
if (blockEntity.showRange && !pState.getValue(ChargingStationBlock.SHOW_RANGE)) {
|
||||
pLevel.setBlockAndUpdate(pPos, pState.setValue(ChargingStationBlock.SHOW_RANGE, true));
|
||||
setChanged(pLevel, pPos, pState);
|
||||
}
|
||||
if (!blockEntity.showRange && pState.getValue(ChargingStationBlock.SHOW_RANGE)) {
|
||||
pLevel.setBlockAndUpdate(pPos, pState.setValue(ChargingStationBlock.SHOW_RANGE, false));
|
||||
if (blockEntity.showRange != pState.getValue(ChargingStationBlock.SHOW_RANGE)) {
|
||||
pLevel.setBlockAndUpdate(pPos, pState.setValue(ChargingStationBlock.SHOW_RANGE, blockEntity.showRange));
|
||||
setChanged(pLevel, pPos, pState);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue