3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 15:20:11 +01:00
Paper/nms-patches/BlockTrapdoor.patch

31 Zeilen
1.5 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockTrapdoor.java
+++ b/net/minecraft/server/BlockTrapdoor.java
2016-05-10 13:47:39 +02:00
@@ -1,6 +1,7 @@
2016-02-29 22:32:46 +01:00
package net.minecraft.server;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
2016-05-10 13:47:39 +02:00
2019-04-23 04:00:00 +02:00
public class BlockTrapdoor extends BlockFacingHorizontal implements IBlockWaterlogged {
2018-12-06 00:00:00 +01:00
@@ -88,6 +89,19 @@
2019-04-23 04:00:00 +02:00
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
2019-04-23 04:00:00 +02:00
if (flag1 != (Boolean) iblockdata.get(BlockTrapdoor.c)) {
2016-02-29 22:32:46 +01:00
+ // CraftBukkit start
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.block.Block bblock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
2016-02-29 22:32:46 +01:00
+ int power = bblock.getBlockPower();
+ int oldPower = (Boolean) iblockdata.get(OPEN) ? 15 : 0;
+
2018-07-15 02:00:00 +02:00
+ if (oldPower == 0 ^ power == 0 || block.getBlockData().isPowerSource()) {
2016-02-29 22:32:46 +01:00
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
2019-04-23 04:00:00 +02:00
+ flag1 = eventRedstone.getNewCurrent() > 0;
2016-02-29 22:32:46 +01:00
+ }
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
if ((Boolean) iblockdata.get(BlockTrapdoor.OPEN) != flag1) {
iblockdata = (IBlockData) iblockdata.set(BlockTrapdoor.OPEN, flag1);
this.a((EntityHuman) null, world, blockposition, flag1);