summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockRedstoneTorch.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2014-11-26 08:32:16 +1100
committermd_5 <git@md-5.net>2014-11-28 17:16:30 +1100
commit24557bc2b37deb6a0edf497d547471832457b1dd (patch)
treec560572889a3b0b34964a0cddb35dc87fda3c914 /nms-patches/BlockRedstoneTorch.patch
parenta4805dbd77da057cc1ea0bf344379bc6e53ca1f6 (diff)
downloadcraftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.gz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.lz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.xz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.zip
Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
Diffstat (limited to 'nms-patches/BlockRedstoneTorch.patch')
-rw-r--r--nms-patches/BlockRedstoneTorch.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/nms-patches/BlockRedstoneTorch.patch b/nms-patches/BlockRedstoneTorch.patch
new file mode 100644
index 00000000..60516593
--- /dev/null
+++ b/nms-patches/BlockRedstoneTorch.patch
@@ -0,0 +1,55 @@
+--- ../work/decompile-bb26c12b/net/minecraft/server/BlockRedstoneTorch.java 2014-11-27 08:59:46.565422446 +1100
++++ src/main/java/net/minecraft/server/BlockRedstoneTorch.java 2014-11-27 08:42:10.156850903 +1100
+@@ -6,6 +6,8 @@
+ import java.util.Map;
+ import java.util.Random;
+
++import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
++
+ public class BlockRedstoneTorch extends BlockTorch {
+
+ private static Map b = Maps.newHashMap();
+@@ -95,9 +97,26 @@
+ while (list != null && !list.isEmpty() && world.getTime() - ((RedstoneUpdateInfo) list.get(0)).b > 60L) {
+ list.remove(0);
+ }
++
++ // CraftBukkit start
++ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
++ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
++ int oldCurrent = this.isOn ? 15 : 0;
++
++ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
++ // CraftBukkit end
+
+ if (this.isOn) {
+ if (flag) {
++ // CraftBukkit start
++ if (oldCurrent != 0) {
++ event.setNewCurrent(0);
++ manager.callEvent(event);
++ if (event.getNewCurrent() != 0) {
++ return;
++ }
++ }
++ // CraftBukkit end
+ world.setTypeAndData(blockposition, Blocks.UNLIT_REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3);
+ if (this.a(world, blockposition, true)) {
+ world.makeSound((double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
+@@ -114,6 +133,16 @@
+ }
+ }
+ } else if (!flag && !this.a(world, blockposition, false)) {
++ // CraftBukkit start
++ if (oldCurrent != 15) {
++ event.setNewCurrent(15);
++ manager.callEvent(event);
++ if (event.getNewCurrent() != 15) {
++ return;
++ }
++ }
++ // CraftBukkit end
++
+ world.setTypeAndData(blockposition, Blocks.REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3);
+ }
+