/** * Sets the {@link UUID} of the user who created the {@link BlockSnapshot} * located at passed block position. * * @param pos The block position where the user data should be applied * @param uuid The {@link UUID} to set as creator */ default void setCreator(Vector3i pos, @Nullable UUID uuid) { setCreator(pos.getX(), pos.getY(), pos.getZ(), uuid); }
/** * Sets the {@link UUID} of the user who last notified the * {@link BlockSnapshot} located at passed block position. * * @param pos The block position where the user data should be applied * @param uuid The {@link UUID} to set as notifier */ default void setNotifier(Vector3i pos, @Nullable UUID uuid) { setNotifier(pos.getX(), pos.getY(), pos.getZ(), uuid); }
/** * Offsets this bounding box by a given amount and returns a new box. * * @param offset The offset to apply * @return The new offset box */ public AABB offset(Vector3i offset) { checkNotNull(offset, "offset"); return offset(offset.getX(), offset.getY(), offset.getZ()); }
/** * Expands this bounding box by a given amount in both directions and * returns a new box. The expansion is applied half and half to the * minimum and maximum corners. * * @param amount The amount of expansion to apply * @return The new expanded box */ public AABB expand(Vector3i amount) { checkNotNull(amount, "amount"); return expand(amount.getX(), amount.getY(), amount.getZ()); }
/** * Gets a representation of the block at the given position. * * @param position The position * @return The block * @throws PositionOutOfBoundsException If the position is outside of the * bounds of the volume */ default BlockState getBlock(Vector3i position) { return getBlock(position.getX(), position.getY(), position.getZ()); }
/** * Gets the {@link UUID}, if available, of the user who created the * {@link BlockSnapshot} at passed block position. * * @param pos The position to be checked * @return The {@link UUID} if one exists */ default Optional<UUID> getCreator(Vector3i pos) { return getCreator(pos.getX(), pos.getY(), pos.getZ()); }
/** * Gets the chunk at the given chunk coordinate position if it exists or if * {@code shouldGenerate} is true and the chunk is generated. * * @param chunkPosition The position * @param shouldGenerate True to generate a new chunk * @return The loaded or generated chunk, if already generated */ default Optional<Chunk> loadChunk(Vector3i chunkPosition, boolean shouldGenerate) { return this.loadChunk(chunkPosition.getX(), chunkPosition.getY(), chunkPosition.getZ(), shouldGenerate); }
/** * Gets an object representing the biome at the given position. * * @param position The position * @return The biome * @throws PositionOutOfBoundsException If the position is outside of the * bounds of the volume */ default BiomeType getBiome(Vector3i position) { return getBiome(position.getX(), position.getY(), position.getZ()); }
/** * Gets all the faces of this block that have the given property. * * @param coords The coordinates * @param propertyClass The property class * @return All faces with the property */ default Collection<Direction> getFacesWithProperty(Vector3i coords, Class<? extends Property<?, ?>> propertyClass) { return getFacesWithProperty(coords.getX(), coords.getY(), coords.getZ(), propertyClass); }
/** * Transforms the x coordinate of a vector * using this transform. Only creates a new * object on the first call. * * @param vector The original vector * @return The transformed x coordinate */ public int transformX(Vector3i vector) { return transformX(vector.getX(), vector.getY(), vector.getZ()); }
/** * Adds a translation to this transform and returns * it as a new transform. * * @param vector The translation vector * @return The translated transform as a copy */ public DiscreteTransform3 withTranslation(Vector3i vector) { return withTranslation(vector.getX(), vector.getY(), vector.getZ()); }
/** * Attempts to remove the data associated with the provided {@link Key} from * the block at the provided location. * * @param coordinates The position of the block * @param key The key to the data to remove * @return The transaction result */ default DataTransactionResult remove(Vector3i coordinates, Key<?> key) { return remove(coordinates.getX(), coordinates.getY(), coordinates.getZ(), key); }
/** * Attempts to undo a {@link DataTransactionResult}. Specifically, all * {@link ImmutableValue}s that were successfully added are removed, and all * replaced {@link ImmutableValue}s are offered. * * @param coordinates The position of the block * @param result The transaction result to undo * @return The transaction result */ default DataTransactionResult undo(Vector3i coordinates, DataTransactionResult result) { return undo(coordinates.getX(), coordinates.getY(), coordinates.getZ(), result); }
/** * Gets the underlying biome position. * * @return The underlying biome position */ public Vector3i getBiomePosition() { if (this.biomePosition == null) { final Vector3i blockPosition = getBlockPosition(); this.biomePosition = new Vector3i(blockPosition.getX(), 0, blockPosition.getZ()); } return this.biomePosition; }
/** * Subtract another Vector3i to the position on this instance, returning * a new Location instance. * * @param v The vector to subtract * @return A new instance */ public Location<E> sub(Vector3i v) { return sub(v.getX(), v.getY(), v.getZ()); }
/** * Returns true if the block volume contains a block at the specified * position. This is defined as <code>{{@link #getBlockMin()} <= position <= * {@link #getBlockMax()}</code> * * @param position The position to check * @return Whether or not the position has a block in this volume */ default boolean containsBlock(Vector3i position) { return containsBlock(position.getX(), position.getY(), position.getZ()); }
/** * Gets the {@link UUID}, if available, of the user who last notified the * {@link BlockSnapshot} located at passed block position. * * @param pos The position to be checked * @return The {@link UUID} if one exists */ default Optional<UUID> getNotifier(Vector3i pos) { return getNotifier(pos.getX(), pos.getY(), pos.getZ()); }
/** * Returns true if the biome volume contains a biome at the specified * position. This is defined as <code>{{@link #getBiomeMin()} <= position * <= {@link #getBiomeMax()}</code> * * @param position The position to check * @return Whether or not the position has a biome in this volume */ default boolean containsBiome(Vector3i position) { return containsBiome(position.getX(), position.getY(), position.getZ()); }
/** * Transforms the z coordinate of a vector * using this transform. Only creates a new * object on the first call. * * @param vector The original vector * @return The transformed z coordinate */ public int transformZ(Vector3i vector) { return transformZ(vector.getX(), vector.getY(), vector.getZ()); }
/** * Returns a new transform representing a scaling on each axis. * The scale factors must be non-zero. * * @param vector The scale vector * @return The new scale transform */ public static DiscreteTransform3 fromScale(Vector3i vector) { return fromScale(vector.getX(), vector.getY(), vector.getZ()); }