private boolean findFrame(Block origin, boolean withEnderEye) { for (BlockFace face : BlockFaces.NESW) { Block frame = origin.translate(face, 2); BlockFace facing = face.getOpposite(); if (!isEndFrame(frame, facing, withEnderEye)) { return false; } if (!isEndFrame(frame.translate(BlockFaces.NESW.previous(face)), facing, withEnderEye)) { return false; } if (!isEndFrame(frame.translate(BlockFaces.NESW.next(face)), facing, withEnderEye)) { return false; } } return true; }
@Override public void placeObject(World w, int x, int y, int z) { Block origin = w.getBlock(x, y, z); // Generate the frames for (BlockFace face : BlockFaces.NESW) { Block frame = origin.translate(face, 2); BlockFace facing = face.getOpposite(); // Place the three pieces placeFrame(frame, facing); placeFrame(frame.translate(BlockFaces.NESW.previous(face)), facing); placeFrame(frame.translate(BlockFaces.NESW.next(face)), facing); } // Set to a random state setRandomActive(origin, 0.1f); }