diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch new file mode 100644 index 0000000000..65c155795e --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch @@ -0,0 +1,87 @@ +--- a/net/minecraft/world/level/block/RedstoneLampBlock.java ++++ b/net/minecraft/world/level/block/RedstoneLampBlock.java +@@ -8,53 +8,68 @@ + import net.minecraft.world.item.context.BlockPlaceContext; + import net.minecraft.world.level.Level; + import net.minecraft.world.level.block.state.BlockBehaviour; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.block.state.StateDefinition; + import net.minecraft.world.level.block.state.properties.BooleanProperty; ++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit + + public class RedstoneLampBlock extends Block { ++ + public static final MapCodec<RedstoneLampBlock> CODEC = simpleCodec(RedstoneLampBlock::new); + public static final BooleanProperty LIT = RedstoneTorchBlock.LIT; + + @Override + public MapCodec<RedstoneLampBlock> codec() { +- return CODEC; ++ return RedstoneLampBlock.CODEC; + } + + public RedstoneLampBlock(BlockBehaviour.Properties properties) { + super(properties); +- this.registerDefaultState(this.defaultBlockState().setValue(LIT, Boolean.valueOf(false))); ++ this.registerDefaultState((IBlockData) this.defaultBlockState().setValue(RedstoneLampBlock.LIT, false)); + } + + @Nullable + @Override +- public BlockState getStateForPlacement(BlockPlaceContext context) { +- return this.defaultBlockState().setValue(LIT, Boolean.valueOf(context.getLevel().hasNeighborSignal(context.getClickedPos()))); ++ public IBlockData getStateForPlacement(BlockPlaceContext context) { ++ return (IBlockData) this.defaultBlockState().setValue(RedstoneLampBlock.LIT, context.getLevel().hasNeighborSignal(context.getClickedPos())); + } + + @Override +- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { ++ public void neighborChanged(IBlockData state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { + if (!level.isClientSide) { +- boolean flag = state.getValue(LIT); +- if (flag != level.hasNeighborSignal(pos)) { +- if (flag) { +- level.scheduleTick(pos, this, 4); ++ boolean flag1 = (Boolean) state.getValue(RedstoneLampBlock.LIT); ++ ++ if (flag1 != level.hasNeighborSignal(pos)) { ++ if (flag1) { ++ level.scheduleTick(pos, (Block) this, 4); + } else { +- level.setBlock(pos, state.cycle(LIT), 2); ++ // CraftBukkit start ++ if (CraftEventFactory.callRedstoneChange(level, pos, 0, 15).getNewCurrent() != 15) { ++ return; ++ } ++ // CraftBukkit end ++ level.setBlock(pos, (IBlockData) state.cycle(RedstoneLampBlock.LIT), 2); + } + } ++ + } + } + + @Override +- public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { +- if (state.getValue(LIT) && !level.hasNeighborSignal(pos)) { +- level.setBlock(pos, state.cycle(LIT), 2); ++ public void tick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) { ++ if ((Boolean) state.getValue(RedstoneLampBlock.LIT) && !level.hasNeighborSignal(pos)) { ++ // CraftBukkit start ++ if (CraftEventFactory.callRedstoneChange(level, pos, 15, 0).getNewCurrent() != 0) { ++ return; ++ } ++ // CraftBukkit end ++ level.setBlock(pos, (IBlockData) state.cycle(RedstoneLampBlock.LIT), 2); + } ++ + } + + @Override +- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { +- builder.add(LIT); ++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) { ++ builder.add(RedstoneLampBlock.LIT); + } + } |