Permalink
Browse files

Fixed lightswitch not re-applying data afterwards, which is now requi…

…red.
  • Loading branch information...
me4502 committed Nov 15, 2016
1 parent a125627 commit f00f4fbf2a7754129ff86240ebebf7558b0979da
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/main/java/com/sk89q/craftbook/mechanics/LightSwitch.java
@@ -150,16 +150,19 @@ private boolean toggleLights(Block block, LocalPlayer player) {
for (int x = -radius + wx; x <= radius + wx; x++) {
for (int y = -radius + wy; y <= radius + wy; y++) {
for (int z = -radius + wz; z <= radius + wz; z++) {
- Material id = block.getWorld().getBlockAt(x, y, z).getType();
+ Block relBlock = block.getWorld().getBlockAt(x, y, z);
+ Material id = relBlock.getType();
+ byte data = relBlock.getData();
if (id == Material.TORCH || id == Material.REDSTONE_TORCH_OFF || id == Material.REDSTONE_TORCH_ON) {
// Limit the maximum number of changed lights
if (changed >= maximum) return true;
if (on) {
- block.getWorld().getBlockAt(x, y, z).setType(Material.TORCH);
+ relBlock.setType(Material.TORCH);
} else {
- block.getWorld().getBlockAt(x, y, z).setType(Material.REDSTONE_TORCH_ON);
+ relBlock.setType(Material.REDSTONE_TORCH_ON);
}
+ relBlock.setData(data);
changed++;
}
}

0 comments on commit f00f4fb

Please sign in to comment.