private static Location getAdjacentTrack(final Block center, final BlockFace dir) { if (MinecartUtils.isTrack(center.getRelative(dir))) return center.getRelative(dir).getLocation(); if ((center.getRelative(dir).getTypeId() == Material.CHEST.getId()) && MinecartUtils.isTrack(center.getRelative(dir).getRelative(dir))) return center.getRelative(dir).getRelative(dir).getLocation(); return null; }
private static Location getAdjacentTrack(final Block center) { if (MinecartUtils.isTrack(center.getRelative(-1, 0, 0))) return center.getRelative(-1, 0, 0).getLocation(); else if (MinecartUtils.isTrack(center.getRelative(-1, -1, 0)) && MinecartUtils.isSlopedTrack(center.getRelative(-1, -1, 0))) return center.getRelative(-1, 0, 0).getLocation(); if (MinecartUtils.isTrack(center.getRelative(0, 0, -1))) return center.getRelative(0, 0, -1).getLocation(); else if (MinecartUtils.isTrack(center.getRelative(0, -1, -1)) && MinecartUtils.isSlopedTrack(center.getRelative(0, -1, -1))) return center.getRelative(0, 0, -1).getLocation(); if (MinecartUtils.isTrack(center.getRelative(1, 0, 0))) return center.getRelative(1, 0, 0).getLocation(); else if (MinecartUtils.isTrack(center.getRelative(1, -1, 0)) && MinecartUtils.isSlopedTrack(center.getRelative(1, -1, 0))) return center.getRelative(1, 0, 0).getLocation(); if (MinecartUtils.isTrack(center.getRelative(0, 0, 1))) return center.getRelative(0, 0, 1).getLocation(); else if (MinecartUtils.isTrack(center.getRelative(0, -1, 1)) && MinecartUtils.isSlopedTrack(center.getRelative(0, -1, 1))) return center.getRelative(0, 0, 1).getLocation(); return null; }