2020-03-15 21:03:36 +01:00
|
|
|
From 67d2b841f8deca1a3a786cdbedc4ba4ffdaee08c Mon Sep 17 00:00:00 2001
|
2020-03-14 14:39:54 +01:00
|
|
|
From: Jan Boerman <Janboerman95@gmail.com>
|
|
|
|
Date: Sat, 14 Mar 2020 14:17:35 +0100
|
|
|
|
Subject: [PATCH] Call BlockRedstoneEvent for fence gates
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockFenceGate.java b/src/main/java/net/minecraft/server/BlockFenceGate.java
|
2020-03-15 21:03:36 +01:00
|
|
|
index 432e47bb9..583eb6883 100644
|
2020-03-14 14:39:54 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockFenceGate.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockFenceGate.java
|
|
|
|
@@ -103,6 +103,17 @@ public class BlockFenceGate extends BlockFacingHorizontal {
|
|
|
|
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
|
|
|
|
+ // Paper start
|
|
|
|
+ boolean isOldPowered = iblockdata.get(BlockFenceGate.POWERED);
|
|
|
|
+ if (flag1 != isOldPowered) {
|
|
|
|
+ int newPower = flag1 ? 15 : 0;
|
|
|
|
+ int oldPower = isOldPowered ? 15 : 0;
|
|
|
|
+ org.bukkit.block.Block bukkitBlock = org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition);
|
|
|
|
+ org.bukkit.event.block.BlockRedstoneEvent eventRedstone = new org.bukkit.event.block.BlockRedstoneEvent(bukkitBlock, oldPower, newPower);
|
|
|
|
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
|
|
|
+ flag1 = eventRedstone.getNewCurrent() > 0;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
|
|
|
|
if ((Boolean) iblockdata.get(BlockFenceGate.POWERED) != flag1) {
|
|
|
|
world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) iblockdata.set(BlockFenceGate.POWERED, flag1)).set(BlockFenceGate.OPEN, flag1), 2);
|
|
|
|
--
|
2020-03-15 21:03:36 +01:00
|
|
|
2.25.1
|
2020-03-14 14:39:54 +01:00
|
|
|
|