mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 05:55:44 +01:00
SPIGOT-5606: call BlockRedstoneEvent for fence gates
This commit is contained in:
parent
fc24934098
commit
a6f809378c
20
nms-patches/BlockFenceGate.patch
Normal file
20
nms-patches/BlockFenceGate.patch
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
--- a/net/minecraft/server/BlockFenceGate.java
|
||||||
|
+++ b/net/minecraft/server/BlockFenceGate.java
|
||||||
|
@@ -103,6 +103,17 @@
|
||||||
|
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||||
|
if (!world.isClientSide) {
|
||||||
|
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ boolean oldPowered = iblockdata.get(BlockFenceGate.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(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;
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
|
||||||
|
if ((Boolean) iblockdata.get(BlockFenceGate.POWERED) != flag1) {
|
||||||
|
world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) iblockdata.set(BlockFenceGate.POWERED, flag1)).set(BlockFenceGate.OPEN, flag1), 2);
|
Loading…
Reference in New Issue
Block a user