mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
65bc2541a3
By: md_5 <git@md-5.net>
20 lines
1.3 KiB
Diff
20 lines
1.3 KiB
Diff
--- a/net/minecraft/world/level/block/BlockFenceGate.java
|
|
+++ b/net/minecraft/world/level/block/BlockFenceGate.java
|
|
@@ -168,6 +168,17 @@
|
|
protected void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
|
if (!world.isClientSide) {
|
|
boolean flag1 = world.hasNeighborSignal(blockposition);
|
|
+ // CraftBukkit start
|
|
+ boolean oldPowered = iblockdata.getValue(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.getCraftServer().getPluginManager().callEvent(eventRedstone);
|
|
+ flag1 = eventRedstone.getNewCurrent() > 0;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
|
|
if ((Boolean) iblockdata.getValue(BlockFenceGate.POWERED) != flag1) {
|
|
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(BlockFenceGate.POWERED, flag1)).setValue(BlockFenceGate.OPEN, flag1), 2);
|