0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 10:06:16 +00:00
craftbukkit/nms-patches/net/minecraft/world/level/block/BlockMinecartDetector.patch
2024-10-23 02:15:00 +11:00

29 lines
1.2 KiB
Diff

--- a/net/minecraft/world/level/block/BlockMinecartDetector.java
+++ b/net/minecraft/world/level/block/BlockMinecartDetector.java
@@ -27,6 +27,8 @@
import net.minecraft.world.level.redstone.Orientation;
import net.minecraft.world.phys.AxisAlignedBB;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
public static final MapCodec<BlockMinecartDetector> CODEC = simpleCodec(BlockMinecartDetector::new);
@@ -88,6 +90,16 @@
}
IBlockData iblockdata1;
+ // CraftBukkit start
+ if (flag != flag1) {
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 15 : 0, flag1 ? 15 : 0);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ }
+ // CraftBukkit end
if (flag1 && !flag) {
iblockdata1 = (IBlockData) iblockdata.setValue(BlockMinecartDetector.POWERED, true);