mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-22 11:53:29 +01:00
parent
1c5a3a118d
commit
27aa6809ae
2 changed files with 15 additions and 1 deletions
|
@ -65,4 +65,17 @@ public class PressurizerBlock extends BaseEntityBlock {
|
|||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
|
||||
return level.isClientSide ? null : createTickerHelper(type, Registry.pressurizerBlockEntity, PressurizerBlockEntity::tick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAnalogOutputSignal(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
|
||||
var pipe = Utility.getBlockEntity(PressurizerBlockEntity.class, world, pos);
|
||||
if (pipe == null)
|
||||
return 0;
|
||||
return (int) (pipe.getEnergy() / (float) pipe.getMaxEnergy() * 15);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,9 +134,10 @@ public class PressurizerBlockEntity extends BlockEntity implements MenuProvider,
|
|||
}
|
||||
}
|
||||
|
||||
// send energy update
|
||||
// send energy update and comparator output
|
||||
if (pressurizer.lastEnergy != pressurizer.storage.getEnergyStored() && pressurizer.level.getGameTime() % 10 == 0) {
|
||||
pressurizer.lastEnergy = pressurizer.storage.getEnergyStored();
|
||||
level.updateNeighbourForOutputSignal(pos, state.getBlock());
|
||||
Utility.sendBlockEntityToClients(pressurizer);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue