Coordinate Classes
Package: thaumcraft.api
Author: Azanor
Thaumcraft provides two coordinate classes for different use cases: WorldCoordinates (dimension-aware) and BlockCoordinates (dimension-agnostic).
WorldCoordinates
File: WorldCoordinates.java
Implements: Comparable
Dimension-aware coordinate class that includes a dimension ID. Used when the specific dimension matters for the coordinate.
Fields
| Field | Type | Description |
|---|---|---|
x |
int |
X coordinate |
y |
int |
Y coordinate |
z |
int |
Z coordinate |
dim |
int |
Dimension ID |
Constructors
| Signature | Description |
|---|---|
WorldCoordinates() |
Empty constructor |
WorldCoordinates(int x, int y, int z, int dim) |
Direct construction |
WorldCoordinates(TileEntity tile) |
From tile entity (reads position and dimension) |
WorldCoordinates(WorldCoordinates other) |
Copy constructor |
Methods
| Method | Signature | Description |
|---|---|---|
equals |
Object par1Obj → boolean |
Compares coordinates and dimension |
hashCode |
→ int |
Hash based on x, y, z, and dim |
compareWorldCoordinate |
WorldCoordinates par1 → int |
Compares coordinates |
set |
int x, int y, int z, int dim → void |
Sets coordinate values |
getDistanceSquared |
int x, int y, int z → float |
Squared distance to point |
getDistanceSquaredToWorldCoordinates |
WorldCoordinates → float |
Squared distance to other coordinate |
compareTo |
Object par1Obj → int |
Comparable implementation |
readNBT |
NBTTagCompound nbt → void |
Reads from NBT |
writeNBT |
NBTTagCompound nbt → void |
Writes to NBT |
BlockCoordinates
File: BlockCoordinates.java
Implements: Comparable
Dimension-agnostic coordinate class used for architect tools and block highlighting. Does not store dimension information.
Fields
| Field | Type | Description |
|---|---|---|
x |
int |
X coordinate |
y |
int |
Y coordinate |
z |
int |
Z coordinate |
Constructors
| Signature | Description |
|---|---|
BlockCoordinates() |
Empty constructor |
BlockCoordinates(int x, int y, int z) |
Direct construction |
BlockCoordinates(TileEntity tile) |
From tile entity |
BlockCoordinates(BlockCoordinates other) |
Copy constructor |
Methods
| Method | Signature | Description |
|---|---|---|
equals |
Object par1Obj → boolean |
Compares coordinates |
hashCode |
→ int |
Hash based on x, y, and z |
compareWorldCoordinate |
BlockCoordinates par1 → int |
Compares coordinates (Y > Z > X priority) |
set |
int x, int y, int z → void |
Sets coordinate values |
getDistanceSquared |
int x, int y, int z → float |
Squared distance to point |
getDistanceSquaredToWorldCoordinates |
BlockCoordinates → float |
Squared distance to other coordinate |
compareTo |
Object par1Obj → int |
Comparable implementation |
readNBT |
NBTTagCompound nbt → void |
Reads from NBT |
writeNBT |
NBTTagCompound nbt → void |
Writes to NBT |
Comparison
| Feature | WorldCoordinates | BlockCoordinates |
|---|---|---|
| Dimension-aware | Yes | No |
| Use case | General world operations | Architect tool highlighting |
| NBT serialization | Supported | Supported |
Usage with IArchitect
The IArchitect interface uses BlockCoordinates for returning blocks to highlight:
public ArrayList<BlockCoordinates> getArchitectBlocks(ItemStack stack, World world,
int x, int y, int z, int side, EntityPlayer player);
Tags
#api #coordinates #world #blocks