Search in sources :

Example 1 with TickPriority

use of net.minecraft.world.ticks.TickPriority in project createaddition by mrh0.

the class RedstoneRelay method updateState.

protected void updateState(Level worldIn, BlockPos pos, BlockState state) {
    boolean flag = state.getValue(POWERED);
    boolean flag1 = this.shouldBePowered(worldIn, pos, state);
    if (flag != flag1 && !worldIn.getBlockTicks().willTickThisTick(pos, this)) {
        TickPriority tickpriority = TickPriority.VERY_HIGH;
        worldIn.scheduleTick(pos, this, this.getDelay(state), tickpriority);
    }
}
Also used : TickPriority(net.minecraft.world.ticks.TickPriority)

Example 2 with TickPriority

use of net.minecraft.world.ticks.TickPriority in project Create by Creators-of-Create.

the class PoweredLatchBlock method checkTickOnNeighbor.

@Override
protected void checkTickOnNeighbor(Level worldIn, BlockPos pos, BlockState state) {
    boolean back = state.getValue(POWERED);
    boolean shouldBack = shouldTurnOn(worldIn, pos, state);
    boolean side = state.getValue(POWERED_SIDE);
    boolean shouldSide = isPoweredOnSides(worldIn, pos, state);
    TickPriority tickpriority = TickPriority.HIGH;
    if (this.shouldPrioritize(worldIn, pos, state))
        tickpriority = TickPriority.EXTREMELY_HIGH;
    else if (side || back)
        tickpriority = TickPriority.VERY_HIGH;
    if (worldIn.getBlockTicks().willTickThisTick(pos, this))
        return;
    if (back != shouldBack || side != shouldSide)
        worldIn.scheduleTick(pos, this, this.getDelay(state), tickpriority);
}
Also used : TickPriority(net.minecraft.world.ticks.TickPriority)

Example 3 with TickPriority

use of net.minecraft.world.ticks.TickPriority in project UtilitiX by MelanX.

the class BlockLinkedRepeater method updateState.

private void updateState(Level level, BlockPos pos, BlockState state) {
    if (!level.getBlockTicks().willTickThisTick(pos, this)) {
        TickPriority priority = TickPriority.HIGH;
        Block targetBlock = level.getBlockState(pos.relative(state.getValue(BlockStateProperties.HORIZONTAL_FACING))).getBlock();
        if (targetBlock instanceof DiodeBlock || targetBlock instanceof BlockLinkedRepeater) {
            priority = TickPriority.EXTREMELY_HIGH;
        }
        level.scheduleTick(pos, this, 1, priority);
    }
}
Also used : DiodeBlock(net.minecraft.world.level.block.DiodeBlock) DiodeBlock(net.minecraft.world.level.block.DiodeBlock) Block(net.minecraft.world.level.block.Block) TickPriority(net.minecraft.world.ticks.TickPriority)

Aggregations

TickPriority (net.minecraft.world.ticks.TickPriority)3 Block (net.minecraft.world.level.block.Block)1 DiodeBlock (net.minecraft.world.level.block.DiodeBlock)1