public static Location<World> getRelativeOffset(Location<World> block, int offsetX, int offsetY, int offsetZ) { return getRelativeOffset(SignUtil.getBackBlock(block), SignUtil.getFacing(block), offsetX, offsetY, offsetZ); }
public static Location<World> parseBlockLocation(Sign sign, String line, LocationCheckType relative) { Location<World> target = SignUtil.getBackBlock(sign.getLocation()); if (line.contains("!")) relative = LocationCheckType.getTypeFromChar('!'); else if (line.contains("^")) relative = LocationCheckType.getTypeFromChar('^'); else if (line.contains("&")) relative = LocationCheckType.getTypeFromChar('&'); Vector3d offsets = new Vector3d(0,0,0); try { offsets = parseUnsafeBlockLocation(line); } catch (NumberFormatException | ArrayIndexOutOfBoundsException ignored) { } if(offsets.getFloorX() == 0 && offsets.getFloorY() == 0 && offsets.getFloorZ() == 0) return target; switch (relative) { case RELATIVE: target = LocationUtil.getRelativeOffset(sign.getLocation(), offsets.getFloorX(), offsets.getFloorY(), offsets.getFloorZ()); break; case OFFSET: target = LocationUtil.getOffset(target, offsets.getFloorX(), offsets.getFloorY(), offsets.getFloorZ()); break; case ABSOLUTE: target = target.getExtent().getLocation(offsets.getX(), offsets.getY(), offsets.getZ()); break; } return target; }