2015-02-27 06:41:06 +08:00
|
|
|
--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneTorch.java 2015-02-26 22:40:22.231608143 +0000
|
|
|
|
+++ src/main/java/net/minecraft/server/BlockRedstoneTorch.java 2015-02-26 22:40:22.235608143 +0000
|
2014-11-26 05:32:16 +08:00
|
|
|
@@ -6,6 +6,8 @@
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockRedstoneTorch extends BlockTorch {
|
|
|
|
|
2015-02-27 06:41:06 +08:00
|
|
|
private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = Maps.newHashMap();
|
|
|
|
@@ -13,7 +15,7 @@
|
|
|
|
|
|
|
|
private boolean a(World world, BlockPosition blockposition, boolean flag) {
|
|
|
|
if (!BlockRedstoneTorch.b.containsKey(world)) {
|
|
|
|
- BlockRedstoneTorch.b.put(world, Lists.newArrayList());
|
|
|
|
+ BlockRedstoneTorch.b.put(world, Lists.<BlockRedstoneTorch.RedstoneUpdateInfo>newArrayList()); // CraftBukkit - fix decompile error
|
|
|
|
}
|
|
|
|
|
|
|
|
List list = (List) BlockRedstoneTorch.b.get(world);
|
|
|
|
@@ -96,8 +98,25 @@
|
2014-11-26 05:32:16 +08:00
|
|
|
list.remove(0);
|
|
|
|
}
|
2015-02-27 06:41:06 +08:00
|
|
|
|
2014-11-26 05:32:16 +08:00
|
|
|
+ // 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
|
2015-02-27 06:41:06 +08:00
|
|
|
+
|
2014-11-26 05:32:16 +08:00
|
|
|
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);
|
2015-02-27 06:41:06 +08:00
|
|
|
@@ -114,6 +133,15 @@
|
2014-11-26 05:32:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} 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);
|
|
|
|
}
|
|
|
|
|