/** * Create a new empty wrapper. */ public WrappedChunkCoordinate() { super(MinecraftReflection.getChunkCoordinatesClass()); try { setHandle(getHandleType().newInstance()); } catch (Exception e) { throw new RuntimeException("Cannot construct chunk coordinate."); } }
/** * Retrieve the y coordinate of the underlying coordinate. * @return The y coordinate. */ public int getY() { return getModifier().read(1); }
/** * Create a wrapper for a specific chunk coordinates. * @param handle - the NMS chunk coordinates. */ @SuppressWarnings("rawtypes") public WrappedChunkCoordinate(Comparable handle) { super(MinecraftReflection.getChunkCoordinatesClass()); setHandle(handle); }
return ChunkPosition.getConverter().getGeneric((ChunkPosition) wrapped); } else if (wrapped instanceof WrappedChunkCoordinate) { return ((WrappedChunkCoordinate) wrapped).getHandle();
return new WrappedChunkCoordinate((Comparable) value); } else if (is(MinecraftReflection.getChunkPositionClass(), value)) { return ChunkPosition.getConverter().getSpecific(value);
/** * Set the x coordinate of the underlying coordinate. * @param newX - the new x coordinate. */ public void setX(int newX) { getModifier().write(0, newX); }
/** * Retrieve the z coordinate of the underlying coordinate. * @return The z coordinate. */ public int getZ() { return getModifier().read(2); }
/** * Retrieve the x coordinate of the underlying coordinate. * @return The x coordinate. */ public int getX() { return getModifier().read(0); }
/** * Set the y coordinate of the underlying coordinate. * @param newY - the new y coordinate. */ public void setY(int newY) { getModifier().write(1, newY); }
/** * Set the z coordinate of the underlying coordiate. * @param newZ - the new z coordinate. */ public void setZ(int newZ) { getModifier().write(2, newZ); }