From 0cf41b146242a88247f9f49c980a0dcc5a5c6c7e Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 31 May 2024 18:21:21 +0100 Subject: [PATCH] Address deprecations in vector classes --- .../core/extent/OncePerChunkExtent.java | 8 +++---- .../extent/clipboard/WorldCopyClipboard.java | 22 +++++++++---------- .../core/math/LocalBlockVector2Set.java | 8 +++---- .../sk89q/worldedit/regions/CuboidRegion.java | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OncePerChunkExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OncePerChunkExtent.java index 532bc6af9..fbbd92ad2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OncePerChunkExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OncePerChunkExtent.java @@ -111,7 +111,7 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch @Override public BlockState getBlock(final BlockVector3 position) { - checkAndRun(position.getBlockX() >> 4, position.getBlockZ() >> 4); + checkAndRun(position.x() >> 4, position.z() >> 4); return super.getBlock(position); } @@ -123,7 +123,7 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch @Override public BaseBlock getFullBlock(final BlockVector3 position) { - checkAndRun(position.getBlockX() >> 4, position.getBlockZ() >> 4); + checkAndRun(position.x() >> 4, position.z() >> 4); return super.getFullBlock(position); } @@ -141,7 +141,7 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch @Override public BiomeType getBiome(final BlockVector3 position) { - checkAndRun(position.getBlockX() >> 4, position.getBlockZ() >> 4); + checkAndRun(position.x() >> 4, position.z() >> 4); return super.getBiome(position); } @@ -171,7 +171,7 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch @Override public boolean setBiome(final BlockVector3 position, final BiomeType biome) { - checkAndRun(position.getBlockX() >> 4, position.getBlockZ() >> 4); + checkAndRun(position.x() >> 4, position.z() >> 4); return super.setBiome(position, biome); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/WorldCopyClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/WorldCopyClipboard.java index 55a017604..5359b4240 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/WorldCopyClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/WorldCopyClipboard.java @@ -125,17 +125,17 @@ public class WorldCopyClipboard extends ReadOnlyClipboard { final BlockVector3 origin = this.getOrigin(); // To must be relative to the clipboard origin ( player location - clipboard origin ) (as the locations supplied are relative to the world origin) - final int relx = to.getBlockX() - origin.getBlockX(); - final int rely = to.getBlockY() - origin.getBlockY(); - final int relz = to.getBlockZ() - origin.getBlockZ(); + final int relx = to.x() - origin.x(); + final int rely = to.y() - origin.y(); + final int relz = to.z() - origin.z(); pasteBiomes &= this.hasBiomes(); for (BlockVector3 pos : this) { BaseBlock block = pos.getFullBlock(this); - int xx = pos.getX() + relx; - int yy = pos.getY() + rely; - int zz = pos.getZ() + relz; + int xx = pos.x() + relx; + int yy = pos.y() + rely; + int zz = pos.z() + relz; if (pasteBiomes) { toExtent.setBiome(xx, yy, zz, pos.getBiome(this)); } @@ -145,9 +145,9 @@ public class WorldCopyClipboard extends ReadOnlyClipboard { toExtent.setBlock(xx, yy, zz, block); } // Entity offset is the paste location subtract the clipboard origin (entity's location is already relative to the world origin) - final int entityOffsetX = to.getBlockX() - origin.getBlockX(); - final int entityOffsetY = to.getBlockY() - origin.getBlockY(); - final int entityOffsetZ = to.getBlockZ() - origin.getBlockZ(); + final int entityOffsetX = to.x() - origin.x(); + final int entityOffsetY = to.y() - origin.y(); + final int entityOffsetZ = to.z() - origin.z(); // entities for (Entity entity : entities) { // skip players on pasting schematic @@ -156,8 +156,8 @@ public class WorldCopyClipboard extends ReadOnlyClipboard { continue; } Location pos = entity.getLocation(); - Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX, - pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(), + Location newPos = new Location(pos.getExtent(), pos.x() + entityOffsetX, + pos.y() + entityOffsetY, pos.z() + entityOffsetZ, pos.getYaw(), pos.getPitch() ); toExtent.createEntity(newPos, entity.getState()); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVector2Set.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVector2Set.java index 9ad9cf251..5d50114c2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVector2Set.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVector2Set.java @@ -88,7 +88,7 @@ public class LocalBlockVector2Set implements Set { @Override public boolean contains(Object o) { if (o instanceof BlockVector2 v) { - return contains(v.getBlockX(), v.getBlockZ()); + return contains(v.x(), v.z()); } return false; } @@ -271,11 +271,11 @@ public class LocalBlockVector2Set implements Set { */ @Override public boolean add(BlockVector2 vector) { - return add(vector.getBlockX(), vector.getBlockZ()); + return add(vector.x(), vector.z()); } private int getIndex(BlockVector2 vector) { - return getIndex(vector.getX(), vector.getZ()); + return getIndex(vector.x(), vector.z()); } private int getIndex(int x, int z) { @@ -304,7 +304,7 @@ public class LocalBlockVector2Set implements Set { @Override public boolean remove(Object o) { if (o instanceof BlockVector2 v) { - return remove(v.getBlockX(), v.getBlockZ()); + return remove(v.x(), v.z()); } return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 3c0879a80..7d39bf129 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -761,7 +761,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { int tz = bz + 15; BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - return min.getY() <= chunkMinY && max.getY() >= chunkMaxY && min.getX() <= bx && max.getX() >= tx && min.getZ() <= bz && max.getZ() >= tz; + return min.y() <= chunkMinY && max.y() >= chunkMaxY && min.x() <= bx && max.x() >= tx && min.z() <= bz && max.z() >= tz; } @Override