aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch92
1 files changed, 92 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch
new file mode 100644
index 0000000000..16becdc751
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/RedstoneLampBlock.java.patch
@@ -0,0 +1,92 @@
+--- a/net/minecraft/world/level/block/RedstoneLampBlock.java
++++ b/net/minecraft/world/level/block/RedstoneLampBlock.java
+@@ -8,9 +8,10 @@
+ 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 {
+
+@@ -18,34 +19,36 @@
+ public static final BooleanProperty LIT = RedstoneTorchBlock.LIT;
+
+ @Override
+- @Override
+ public MapCodec<RedstoneLampBlock> codec() {
+ return RedstoneLampBlock.CODEC;
+ }
+
+- public RedstoneLampBlock(BlockBehaviour.Properties blockbehaviour_properties) {
+- super(blockbehaviour_properties);
+- this.registerDefaultState((BlockState) this.defaultBlockState().setValue(RedstoneLampBlock.LIT, false));
++ public RedstoneLampBlock(BlockBehaviour.Properties properties) {
++ super(properties);
++ this.registerDefaultState((IBlockData) this.defaultBlockState().setValue(RedstoneLampBlock.LIT, false));
+ }
+
+ @Nullable
+ @Override
+- @Override
+- public BlockState getStateForPlacement(BlockPlaceContext blockplacecontext) {
+- return (BlockState) this.defaultBlockState().setValue(RedstoneLampBlock.LIT, blockplacecontext.getLevel().hasNeighborSignal(blockplacecontext.getClickedPos()));
++ public IBlockData getStateForPlacement(BlockPlaceContext context) {
++ return (IBlockData) this.defaultBlockState().setValue(RedstoneLampBlock.LIT, context.getLevel().hasNeighborSignal(context.getClickedPos()));
+ }
+
+ @Override
+- @Override
+- public void neighborChanged(BlockState blockstate, Level level, BlockPos blockpos, Block block, BlockPos blockpos1, boolean flag) {
++ public void neighborChanged(IBlockData state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
+ if (!level.isClientSide) {
+- boolean flag1 = (Boolean) blockstate.getValue(RedstoneLampBlock.LIT);
++ boolean flag1 = (Boolean) state.getValue(RedstoneLampBlock.LIT);
+
+- if (flag1 != level.hasNeighborSignal(blockpos)) {
++ if (flag1 != level.hasNeighborSignal(pos)) {
+ if (flag1) {
+- level.scheduleTick(blockpos, (Block) this, 4);
++ level.scheduleTick(pos, (Block) this, 4);
+ } else {
+- level.setBlock(blockpos, (BlockState) blockstate.cycle(RedstoneLampBlock.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);
+ }
+ }
+
+@@ -53,17 +56,20 @@
+ }
+
+ @Override
+- @Override
+- public void tick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) {
+- if ((Boolean) blockstate.getValue(RedstoneLampBlock.LIT) && !serverlevel.hasNeighborSignal(blockpos)) {
+- serverlevel.setBlock(blockpos, (BlockState) blockstate.cycle(RedstoneLampBlock.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
+- @Override
+- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) {
+- statedefinition_builder.add(RedstoneLampBlock.LIT);
++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
++ builder.add(RedstoneLampBlock.LIT);
+ }
+ }