Permalink
Browse files

Merge pull request #116 from Circlepuller/master

Added gate support for iron bars
  • Loading branch information...
2 parents 7a899d1 + 3c51235 commit b94931445bda78decfa53ef0e0cb312c26ddfef4 @sk89q committed Apr 22, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 mechanisms/src/main/java/com/sk89q/craftbook/mech/Gate.java
@@ -203,6 +203,7 @@ private boolean recurseColumn(WorldVector pt,
if (visitedColumns.size() > 14) { return false; }
if (visitedColumns.contains(pt.setY(0).toBlockVector())) { return false; }
if (world.getBlockTypeIdAt(BukkitUtil.toLocation(pt)) != BlockID.FENCE
+ && world.getBlockTypeIdAt(BukkitUtil.toLocation(pt)) != BlockID.IRON_BARS
&& world.getBlockTypeIdAt(BukkitUtil.toLocation(pt)) != BlockID.NETHER_BRICK_FENCE) {
return false;
}
@@ -216,6 +217,7 @@ private boolean recurseColumn(WorldVector pt,
// Find the top most fence
for (int y1 = y + 1; y1 <= y + 12; y1++) {
if (world.getBlockTypeIdAt(x, y1, z) == BlockID.FENCE
+ || world.getBlockTypeIdAt(x, y1, z) == BlockID.IRON_BARS
|| world.getBlockTypeIdAt(x, y1, z) == BlockID.NETHER_BRICK_FENCE) {
y = y1;
} else {
@@ -234,6 +236,7 @@ private boolean recurseColumn(WorldVector pt,
// block, otherwise open the gate
close = world.getBlockTypeIdAt(x, y - 1, z) != BlockID.FENCE
+ && world.getBlockTypeIdAt(x, y - 1, z) != BlockID.IRON_BARS
&& world.getBlockTypeIdAt(x, y - 1, z) != BlockID.NETHER_BRICK_FENCE;
}
@@ -277,6 +280,7 @@ private void toggleColumn(WorldVector topPoint, boolean close,
&& cur != BlockID.FENCE
&& cur != BlockID.NETHER_BRICK_FENCE
&& cur != BlockID.SNOW
+ && cur != BlockID.IRON_BARS
&& cur != 0) {
break;
}

0 comments on commit b949314

Please sign in to comment.