mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-25 15:06:14 +00:00
32 lines
1.7 KiB
Diff
32 lines
1.7 KiB
Diff
--- a/net/minecraft/world/level/block/BlockTrapdoor.java
|
|
+++ b/net/minecraft/world/level/block/BlockTrapdoor.java
|
|
@@ -38,6 +38,8 @@
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockTrapdoor extends BlockFacingHorizontal implements IBlockWaterlogged {
|
|
|
|
public static final MapCodec<BlockTrapdoor> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
|
@@ -143,6 +145,19 @@
|
|
boolean flag1 = world.hasNeighborSignal(blockposition);
|
|
|
|
if (flag1 != (Boolean) iblockdata.getValue(BlockTrapdoor.POWERED)) {
|
|
+ // 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.getValue(OPEN) ? 15 : 0;
|
|
+
|
|
+ if (oldPower == 0 ^ power == 0 || block.defaultBlockState().isSignalSource()) {
|
|
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
|
|
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
|
|
+ flag1 = eventRedstone.getNewCurrent() > 0;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
if ((Boolean) iblockdata.getValue(BlockTrapdoor.OPEN) != flag1) {
|
|
iblockdata = (IBlockData) iblockdata.setValue(BlockTrapdoor.OPEN, flag1);
|
|
this.playSound((EntityHuman) null, world, blockposition, flag1);
|