make Vector3 immutable by default

This commit is contained in:
dfsek
2021-12-20 00:37:54 -07:00
parent 961a42d1cb
commit b9965bdbc5
14 changed files with 343 additions and 235 deletions

View File

@@ -13,10 +13,18 @@ public interface ReadableWorld extends World {
return getBlockState(position.getBlockX(), position.getBlockY(), position.getBlockZ());
}
default BlockState getBlockState(Vector3.Mutable position) {
return getBlockState(position.getBlockX(), position.getBlockY(), position.getBlockZ());
}
default BlockState getBlockState(Vector3Int position) {
return getBlockState(position.getX(), position.getY(), position.getZ());
}
default BlockState getBlockState(Vector3Int.Mutable position) {
return getBlockState(position.getX(), position.getY(), position.getZ());
}
BlockEntity getBlockEntity(int x, int y, int z);
default BlockEntity getBlockEntity(Vector3 position) {

View File

@@ -12,18 +12,34 @@ public interface WritableWorld extends ReadableWorld {
setBlockState(position.getBlockX(), position.getBlockY(), position.getBlockZ(), data, physics);
}
default void setBlockState(Vector3.Mutable position, BlockState data, boolean physics) {
setBlockState(position.getBlockX(), position.getBlockY(), position.getBlockZ(), data, physics);
}
default void setBlockState(Vector3Int position, BlockState data, boolean physics) {
setBlockState(position.getX(), position.getY(), position.getZ(), data, physics);
}
default void setBlockState(Vector3Int.Mutable position, BlockState data, boolean physics) {
setBlockState(position.getX(), position.getY(), position.getZ(), data, physics);
}
default void setBlockState(Vector3 position, BlockState data) {
setBlockState(position, data, false);
}
default void setBlockState(Vector3.Mutable position, BlockState data) {
setBlockState(position, data, false);
}
default void setBlockState(Vector3Int position, BlockState data) {
setBlockState(position, data, false);
}
default void setBlockState(Vector3Int.Mutable position, BlockState data) {
setBlockState(position, data, false);
}
default void setBlockState(int x, int y, int z, BlockState data) {
setBlockState(x, y, z, data, false);
}