2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockRedstoneTorch.java
|
|
|
|
+++ b/net/minecraft/server/BlockRedstoneTorch.java
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -6,6 +6,8 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
import java.util.Random;
|
2019-04-23 04:00:00 +02:00
|
|
|
import java.util.WeakHashMap;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockRedstoneTorch extends BlockTorch {
|
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
public static final BlockStateBoolean LIT = BlockProperties.r;
|
2020-06-25 02:00:00 +02:00
|
|
|
@@ -62,8 +64,24 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
list.remove(0);
|
|
|
|
}
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
2020-06-25 02:00:00 +02:00
|
|
|
+ org.bukkit.plugin.PluginManager manager = worldserver.getServer().getPluginManager();
|
|
|
|
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
2018-07-15 02:00:00 +02:00
|
|
|
+ int oldCurrent = ((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)).booleanValue() ? 15 : 0;
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
|
|
|
+ // CraftBukkit end
|
2018-12-06 00:00:00 +01:00
|
|
|
if ((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)) {
|
2014-11-25 22:32:16 +01:00
|
|
|
if (flag) {
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (oldCurrent != 0) {
|
|
|
|
+ event.setNewCurrent(0);
|
|
|
|
+ manager.callEvent(event);
|
|
|
|
+ if (event.getNewCurrent() != 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2020-06-25 02:00:00 +02:00
|
|
|
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, false), 3);
|
|
|
|
if (a(worldserver, blockposition, true)) {
|
|
|
|
worldserver.triggerEffect(1502, blockposition, 0);
|
|
|
|
@@ -71,6 +89,15 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
}
|
2020-06-25 02:00:00 +02:00
|
|
|
} else if (!flag && !a(worldserver, blockposition, false)) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (oldCurrent != 15) {
|
|
|
|
+ event.setNewCurrent(15);
|
|
|
|
+ manager.callEvent(event);
|
|
|
|
+ if (event.getNewCurrent() != 15) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2020-06-25 02:00:00 +02:00
|
|
|
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, true), 3);
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|