Class BlockEntityTickerDelayed<T extends net.minecraft.world.level.block.entity.BlockEntity & IBlockEntityDelayedTickable>
java.lang.Object
org.cyclops.cyclopscore.blockentity.BlockEntityTickerDelayed<T>
- All Implemented Interfaces:
net.minecraft.world.level.block.entity.BlockEntityTicker<T>
public class BlockEntityTickerDelayed<T extends net.minecraft.world.level.block.entity.BlockEntity & IBlockEntityDelayedTickable>
extends Object
implements net.minecraft.world.level.block.entity.BlockEntityTicker<T>
This ticker has an anti-lag mechanism to send updates.
Block entities using this ticker must implement
IBlockEntityDelayedTickable
.
Override update(Level, BlockPos, BlockState, BlockEntity)
with the actual update logic.
Every instance has a continuously looping counter that counts from getUpdateBackoffTicks() to zero.
and every time the counter reaches zero, the backoff will be reset and an update packet will be sent
if one has been queued.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Called when after update is sent.protected void
Called when before update is sent.protected void
onSendUpdate
(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Called when an update will is sent.final void
tick
(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState, T blockEntity) Do not override this method (you won't even be able to do so).protected void
update
(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState, T blockEntity) Override this method instead oftick(Level, BlockPos, BlockState, BlockEntity)
.
-
Constructor Details
-
BlockEntityTickerDelayed
public BlockEntityTickerDelayed()
-
-
Method Details
-
tick
public final void tick(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState, T blockEntity) Do not override this method (you won't even be able to do so). Use update() instead.- Specified by:
tick
in interfacenet.minecraft.world.level.block.entity.BlockEntityTicker<T extends net.minecraft.world.level.block.entity.BlockEntity & IBlockEntityDelayedTickable>
- Parameters:
level
- The level.pos
- The position.blockState
- The block state.blockEntity
- The block entity.
-
update
protected void update(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState, T blockEntity) Override this method instead oftick(Level, BlockPos, BlockState, BlockEntity)
. This method is called each tick. -
onSendUpdate
protected void onSendUpdate(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Called when an update will is sent. This contains the logic to send the update, so make sure to call the super!- Parameters:
level
- The level.pos
- The position.
-
beforeSendUpdate
protected void beforeSendUpdate()Called when before update is sent. -
afterSendUpdate
protected void afterSendUpdate()Called when after update is sent. (Not necessarily received yet!)
-