aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/FenceGateBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/FenceGateBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/FenceGateBlock.java.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/FenceGateBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/FenceGateBlock.java.patch
new file mode 100644
index 0000000000..1e6032f92b
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/FenceGateBlock.java.patch
@@ -0,0 +1,40 @@
+--- a/net/minecraft/world/level/block/FenceGateBlock.java
++++ b/net/minecraft/world/level/block/FenceGateBlock.java
+@@ -195,19 +167,24 @@
+ @Override
+ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
+ if (!level.isClientSide) {
+- boolean hasNeighborSignal = level.hasNeighborSignal(pos);
+- if (state.getValue(POWERED) != hasNeighborSignal) {
+- level.setBlock(pos, state.setValue(POWERED, Boolean.valueOf(hasNeighborSignal)).setValue(OPEN, Boolean.valueOf(hasNeighborSignal)), 2);
+- if (state.getValue(OPEN) != hasNeighborSignal) {
+- level.playSound(
+- null,
+- pos,
+- hasNeighborSignal ? this.type.fenceGateOpen() : this.type.fenceGateClose(),
+- SoundSource.BLOCKS,
+- 1.0F,
+- level.getRandom().nextFloat() * 0.1F + 0.9F
+- );
+- level.gameEvent(null, hasNeighborSignal ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos);
++ boolean flag1 = level.hasNeighborSignal(pos);
++ // CraftBukkit start
++ boolean oldPowered = state.getValue(FenceGateBlock.POWERED);
++ if (oldPowered != flag1) {
++ int newPower = flag1 ? 15 : 0;
++ int oldPower = oldPowered ? 15 : 0;
++ org.bukkit.block.Block bukkitBlock = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos);
++ org.bukkit.event.block.BlockRedstoneEvent eventRedstone = new org.bukkit.event.block.BlockRedstoneEvent(bukkitBlock, oldPower, newPower);
++ level.getCraftServer().getPluginManager().callEvent(eventRedstone);
++ flag1 = eventRedstone.getNewCurrent() > 0;
++ }
++ // CraftBukkit end
++
++ if ((Boolean) state.getValue(FenceGateBlock.POWERED) != flag1) {
++ level.setBlock(pos, (IBlockData) ((IBlockData) state.setValue(FenceGateBlock.POWERED, flag1)).setValue(FenceGateBlock.OPEN, flag1), 2);
++ if ((Boolean) state.getValue(FenceGateBlock.OPEN) != flag1) {
++ level.playSound((Player) null, pos, flag1 ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F);
++ level.gameEvent((Entity) null, flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos);
+ }
+ }
+ }