mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2025-02-16 18:05:58 +00:00
53 lines
2.3 KiB
Diff
53 lines
2.3 KiB
Diff
--- a/net/minecraft/world/level/block/BlockRedstoneTorch.java
|
|
+++ b/net/minecraft/world/level/block/BlockRedstoneTorch.java
|
|
@@ -22,6 +22,8 @@
|
|
import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils;
|
|
import net.minecraft.world.level.redstone.Orientation;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockRedstoneTorch extends BaseTorchBlock {
|
|
|
|
public static final MapCodec<BlockRedstoneTorch> CODEC = simpleCodec(BlockRedstoneTorch::new);
|
|
@@ -85,8 +87,24 @@
|
|
list.remove(0);
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.plugin.PluginManager manager = worldserver.getCraftServer().getPluginManager();
|
|
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
+ int oldCurrent = ((Boolean) iblockdata.getValue(BlockRedstoneTorch.LIT)).booleanValue() ? 15 : 0;
|
|
+
|
|
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
|
+ // CraftBukkit end
|
|
if ((Boolean) iblockdata.getValue(BlockRedstoneTorch.LIT)) {
|
|
if (flag) {
|
|
+ // CraftBukkit start
|
|
+ if (oldCurrent != 0) {
|
|
+ event.setNewCurrent(0);
|
|
+ manager.callEvent(event);
|
|
+ if (event.getNewCurrent() != 0) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneTorch.LIT, false), 3);
|
|
if (isToggledTooFrequently(worldserver, blockposition, true)) {
|
|
worldserver.levelEvent(1502, blockposition, 0);
|
|
@@ -94,6 +112,15 @@
|
|
}
|
|
}
|
|
} else if (!flag && !isToggledTooFrequently(worldserver, blockposition, false)) {
|
|
+ // CraftBukkit start
|
|
+ if (oldCurrent != 15) {
|
|
+ event.setNewCurrent(15);
|
|
+ manager.callEvent(event);
|
|
+ if (event.getNewCurrent() != 15) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneTorch.LIT, true), 3);
|
|
}
|
|
|