3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00
Paper/nms-patches/BlockTrapdoor.patch
2016-11-17 12:41:03 +11:00

31 Zeilen
1.3 KiB
Diff

--- a/net/minecraft/server/BlockTrapdoor.java
+++ b/net/minecraft/server/BlockTrapdoor.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockTrapdoor extends Block {
@@ -91,6 +92,19 @@
boolean flag = world.isBlockIndirectlyPowered(blockposition);
if (flag || block.getBlockData().n()) {
+ // CraftBukkit start
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.block.Block bblock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+ int power = bblock.getBlockPower();
+ int oldPower = (Boolean) iblockdata.get(OPEN) ? 15 : 0;
+
+ if (oldPower == 0 ^ power == 0 || block.getBlockData().n()) {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ flag = eventRedstone.getNewCurrent() > 0;
+ }
+ // CraftBukkit end
boolean flag1 = ((Boolean) iblockdata.get(BlockTrapdoor.OPEN)).booleanValue();
if (flag1 != flag) {