summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorgjmcferrin@gmail.com <gjmcferrin@gmail.com>2013-03-29 17:04:29 -0400
committerTravis Watkins <amaranth@ubuntu.com>2013-04-03 02:48:58 -0500
commit5ede9ce5f749c16816b74d7286c0a62cb111e937 (patch)
tree58f74307b5e9335f1e7a1127200fad9bdaf45258 /src/main
parent1d6ff3461d8cb1d90928cba52d973f9e4025ace8 (diff)
downloadcraftbukkit-5ede9ce5f749c16816b74d7286c0a62cb111e937.tar
craftbukkit-5ede9ce5f749c16816b74d7286c0a62cb111e937.tar.gz
craftbukkit-5ede9ce5f749c16816b74d7286c0a62cb111e937.tar.lz
craftbukkit-5ede9ce5f749c16816b74d7286c0a62cb111e937.tar.xz
craftbukkit-5ede9ce5f749c16816b74d7286c0a62cb111e937.zip
Add missing calls to BlockRedstoneEvent. Adds BUKKIT-3926
This adds calls to BlockRedstoneEvent for the new daylight sensor and trapped chest blocks. Note that the redstone level for trapped chests cannot be modified, as it is based on the number of players currently viewing the chest's inventory.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/minecraft/server/BlockDaylightDetector.java1
-rw-r--r--src/main/java/net/minecraft/server/TileEntityChest.java26
2 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockDaylightDetector.java b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
index 84e93f41..fc31262e 100644
--- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java
+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
@@ -48,6 +48,7 @@ public class BlockDaylightDetector extends BlockContainer {
}
if (l != i1) {
+ i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, i, j, k, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
world.setData(i, j, k, i1, 3);
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index b179ddf2..e529bf47 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -339,18 +339,44 @@ public class TileEntityChest extends TileEntity implements IInventory {
this.h = 0;
}
+ int oldPower = Math.max(0, Math.min(15, this.h)); // CraftBukkit - Get power before new viewer is added
+
++this.h;
if (this.world == null) return; // CraftBukkit
this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
+
+ // CraftBukkit start - Call redstone event
+ if (this.q().id == Block.TRAPPED_CHEST.id) {
+ int newPower = Math.max(0, Math.min(15, this.h));
+
+ if (oldPower != newPower) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, this.x, this.y, this.z, oldPower, newPower);
+ }
+ }
+ // CraftBukkit end
+
this.world.applyPhysics(this.x, this.y, this.z, this.q().id);
this.world.applyPhysics(this.x, this.y - 1, this.z, this.q().id);
}
public void g() {
if (this.q() != null && this.q() instanceof BlockChest) {
+ int oldPower = Math.max(0, Math.min(15, this.h)); // CraftBukkit - Get power before new viewer is added
+
--this.h;
if (this.world == null) return; // CraftBukkit
this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
+
+ // CraftBukkit start - Call redstone event
+ if (this.q().id == Block.TRAPPED_CHEST.id) {
+ int newPower = Math.max(0, Math.min(15, this.h));
+
+ if (oldPower != newPower) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, this.x, this.y, this.z, oldPower, newPower);
+ }
+ }
+ // CraftBukkit end
+
this.world.applyPhysics(this.x, this.y, this.z, this.q().id);
this.world.applyPhysics(this.x, this.y - 1, this.z, this.q().id);
}