Class Cuboid
java.lang.Object
net.pottercraft.ollivanders2.common.Cuboid
Represents a rectangular cuboid area in a Minecraft world.
Defines a 3D region using two opposite corner coordinates (x1, y1, z1) and (x2, y2, z2). Coordinates are inclusive and work regardless of which corner has higher or lower values.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a point with the given coordinates is inside this cuboid.booleanisInside(@NotNull org.bukkit.Location location) Checks if a location is inside this cuboid.static @org.jetbrains.annotations.Nullable int[]Parses a string representation of cuboid coordinates into an integer array.
-
Constructor Details
-
Cuboid
Constructor that creates a cuboid from coordinates.If the area array length is not exactly 6, all coordinates remain at their default value of 0.
- Parameters:
world- the name of the world this cuboid is inarea- an array of 6 integers in format: [x1, y1, z1, x2, y2, z2] representing two opposite corners
-
-
Method Details
-
isInside
public boolean isInside(@NotNull @NotNull org.bukkit.Location location) Checks if a location is inside this cuboid.- Parameters:
location- the location to check- Returns:
- true if the location is inside this cuboid, false otherwise
-
isInside
Checks if a point with the given coordinates is inside this cuboid.- Parameters:
world- the name of the world this point is inx- the x-coordinatey- the y-coordinatez- the z-coordinate- Returns:
- true if the point is inside this cuboid, false otherwise
-
parseArea
@Nullable public static @org.jetbrains.annotations.Nullable int[] parseArea(@NotNull @NotNull String areaString) Parses a string representation of cuboid coordinates into an integer array.Expected format: space-separated integers for two opposite corners in the order x1 y1 z1 x2 y2 z2. All six values must be valid integers.
- Parameters:
areaString- a space-separated string of six integer coordinates (e.g., "0 0 0 100 100 100")- Returns:
- an int array [x1, y1, z1, x2, y2, z2] or null if parsing failed
-