chore: address deprecations in vector classes

This commit is contained in:
dordsor21
2024-05-27 18:48:46 +01:00
committed by Jordan
parent 7318685613
commit 36d2c85fdb
244 changed files with 1493 additions and 1515 deletions

View File

@ -99,7 +99,7 @@ public interface IBukkitAdapter {
checkNotNull(position);
return new org.bukkit.Location(
world,
position.getX(), position.getY(), position.getZ()
position.x(), position.y(), position.z()
);
}
@ -119,7 +119,7 @@ public interface IBukkitAdapter {
checkNotNull(location);
return new org.bukkit.Location(
world,
location.getX(), location.getY(), location.getZ(),
location.x(), location.y(), location.z(),
location.getYaw(),
location.getPitch()
);

View File

@ -354,7 +354,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
@Override
public boolean apply(final Extent extent, final BlockVector3 get, final BlockVector3 set) throws WorldEditException {
return extent.setBlock(set.getX(), set.getY(), set.getZ(), source.getFullBlock(get.getX(), get.getY(), get.getZ()));
return extent.setBlock(set.x(), set.y(), set.z(), source.getFullBlock(get.x(), get.y(), get.z()));
}
}
@ -374,8 +374,8 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
@Override
public boolean apply(final Extent extent, final BlockVector3 get, final BlockVector3 set) throws WorldEditException {
return extent.setBlock(set.getX(), set.getY(), set.getZ(), source.getFullBlock(get.getX(), get.getY(), get.getZ()))
&& extent.setBiome(set.getX(), set.getY(), set.getZ(), biomeGetter.apply(get));
return extent.setBlock(set.x(), set.y(), set.z(), source.getFullBlock(get.x(), get.y(), get.z()))
&& extent.setBiome(set.x(), set.y(), set.z(), biomeGetter.apply(get));
}
}
@ -468,22 +468,22 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
private long[] getChunkCoordsRegen(Region region, int border) { //needs to be square num of chunks
BlockVector3 oldMin = region.getMinimumPoint();
BlockVector3 newMin = BlockVector3.at(
(oldMin.getX() >> 4 << 4) - border * 16,
oldMin.getY(),
(oldMin.getZ() >> 4 << 4) - border * 16
(oldMin.x() >> 4 << 4) - border * 16,
oldMin.y(),
(oldMin.z() >> 4 << 4) - border * 16
);
BlockVector3 oldMax = region.getMaximumPoint();
BlockVector3 newMax = BlockVector3.at(
(oldMax.getX() >> 4 << 4) + (border + 1) * 16 - 1,
oldMax.getY(),
(oldMax.getZ() >> 4 << 4) + (border + 1) * 16 - 1
(oldMax.x() >> 4 << 4) + (border + 1) * 16 - 1,
oldMax.y(),
(oldMax.z() >> 4 << 4) + (border + 1) * 16 - 1
);
Region adjustedRegion = new CuboidRegion(newMin, newMax);
return adjustedRegion.getChunks().stream()
.sorted(Comparator
.comparingInt(BlockVector2::getZ)
.thenComparingInt(BlockVector2::getX)) //needed for RegionLimitedWorldAccess
.mapToLong(c -> MathMan.pairInt(c.getX(), c.getZ()))
.comparingInt(BlockVector2::z)
.thenComparingInt(BlockVector2::x)) //needed for RegionLimitedWorldAccess
.mapToLong(c -> MathMan.pairInt(c.x(), c.z()))
.toArray();
}

View File

@ -56,7 +56,7 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
if (region instanceof ProtectedPolygonalRegion casted) {
BlockVector3 max = region.getMaximumPoint();
BlockVector3 min = region.getMinimumPoint();
return new Polygonal2DRegion(null, casted.getPoints(), min.getBlockY(), max.getBlockY());
return new Polygonal2DRegion(null, casted.getPoints(), min.y(), max.y());
}
return new AdaptedRegion(region);
}

View File

@ -94,15 +94,15 @@ public class FaweDelegateSchematicHandler {
return;
}
BlockVector3 dimension = schematic.getClipboard().getDimensions();
final int WIDTH = dimension.getX();
final int LENGTH = dimension.getZ();
final int HEIGHT = dimension.getY();
final int WIDTH = dimension.x();
final int LENGTH = dimension.z();
final int HEIGHT = dimension.y();
final int worldHeight = plot.getArea().getMaxGenHeight() - plot.getArea().getMinGenHeight() + 1;
// Validate dimensions
CuboidRegion region = plot.getLargestRegion();
boolean sizeMismatch =
((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
((region.getMaximumPoint().x() - region.getMinimumPoint().x() + xOffset + 1) < WIDTH) || (
(region.getMaximumPoint().z() - region.getMinimumPoint().z() + zOffset + 1) < LENGTH) || (HEIGHT
> worldHeight);
if (!Settings.Schematics.PASTE_MISMATCHES && sizeMismatch) {
if (actor != null) {
@ -111,8 +111,8 @@ public class FaweDelegateSchematicHandler {
TaskManager.runTask(whenDone);
return;
}
if (((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
if (((region.getMaximumPoint().x() - region.getMinimumPoint().x() + xOffset + 1) < WIDTH) || (
(region.getMaximumPoint().z() - region.getMinimumPoint().z() + zOffset + 1) < LENGTH) || (HEIGHT
> worldHeight)) {
if (whenDone != null) {
TaskManager.runTask(whenDone);
@ -141,7 +141,7 @@ public class FaweDelegateSchematicHandler {
} else {
y_offset_actual = yOffset + pw.getMinBuildHeight() + editSession.getHighestTerrainBlock(region
.getMinimumPoint()
.getX() + 1, region.getMinimumPoint().getZ() + 1, pw.getMinGenHeight(), pw.getMaxGenHeight()
.x() + 1, region.getMinimumPoint().z() + 1, pw.getMinGenHeight(), pw.getMaxGenHeight()
);
}
}
@ -150,7 +150,7 @@ public class FaweDelegateSchematicHandler {
}
final BlockVector3 to = BlockVector3
.at(region.getMinimumPoint().getX() + xOffset, y_offset_actual, region.getMinimumPoint().getZ() + zOffset);
.at(region.getMinimumPoint().x() + xOffset, y_offset_actual, region.getMinimumPoint().z() + zOffset);
final Clipboard clipboard = schematic.getClipboard();
clipboard.setOrigin(clipboard.getRegion().getMinimumPoint());
clipboard.paste(editSession, to, true, false, true);

View File

@ -159,8 +159,8 @@ public class PlotSquaredFeature extends FaweMaskManager {
regions = WEManager.getMask(pp);
if (regions.size() == 1) {
CuboidRegion region = regions.iterator().next();
if (region.getMinimumPoint().getX() == Integer.MIN_VALUE
&& region.getMaximumPoint().getX() == Integer.MAX_VALUE) {
if (region.getMinimumPoint().x() == Integer.MIN_VALUE
&& region.getMaximumPoint().x() == Integer.MAX_VALUE) {
regions.clear();
}
}

View File

@ -240,7 +240,7 @@ public enum BukkitAdapter {
Vector3 position = location;
return new org.bukkit.Location(
adapt((World) location.getExtent()),
position.getX(), position.getY(), position.getZ(),
position.x(), position.y(), position.z(),
location.getYaw(),
location.getPitch()
);
@ -258,7 +258,7 @@ public enum BukkitAdapter {
checkNotNull(position);
return new org.bukkit.Location(
world,
position.getX(), position.getY(), position.getZ()
position.x(), position.y(), position.z()
);
}
@ -274,7 +274,7 @@ public enum BukkitAdapter {
checkNotNull(position);
return new org.bukkit.Location(
world,
position.getX(), position.getY(), position.getZ()
position.x(), position.y(), position.z()
);
}
@ -290,7 +290,7 @@ public enum BukkitAdapter {
checkNotNull(location);
return new org.bukkit.Location(
world,
location.getX(), location.getY(), location.getZ(),
location.x(), location.y(), location.z(),
location.getYaw(),
location.getPitch()
);

View File

@ -242,9 +242,9 @@ public class BukkitPlayer extends AbstractPlayerActor {
//FAWE end
return TaskManager.taskManager().sync(() -> player.teleport(new Location(
finalWorld,
pos.getX(),
pos.getY(),
pos.getZ(),
pos.x(),
pos.y(),
pos.z(),
yaw,
pitch
)));
@ -422,7 +422,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override
public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) {
Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ());
Location loc = new Location(player.getWorld(), pos.x(), pos.y(), pos.z());
if (block == null) {
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
} else {

View File

@ -247,7 +247,7 @@ public class BukkitWorld extends AbstractWorld {
//FAWE start - safe edit region
testCoords(pt);
//FAWE end
return getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel();
return getWorld().getBlockAt(pt.x(), pt.y(), pt.z()).getLightLevel();
}
@Override
@ -284,7 +284,7 @@ public class BukkitWorld extends AbstractWorld {
return false;
}
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
Block block = getWorld().getBlockAt(pt.x(), pt.y(), pt.z());
BlockState state = PaperLib.getBlockState(block, false).getState();
if (!(state instanceof InventoryHolder)) {
return false;
@ -363,8 +363,8 @@ public class BukkitWorld extends AbstractWorld {
//FAWE end
World world = getWorld();
//FAWE start
int X = pt.getBlockX() >> 4;
int Z = pt.getBlockZ() >> 4;
int X = pt.x() >> 4;
int Z = pt.z() >> 4;
if (Fawe.isMainThread()) {
world.getChunkAt(X, Z);
} else if (PaperLib.isPaper()) {
@ -413,7 +413,7 @@ public class BukkitWorld extends AbstractWorld {
public void fixAfterFastMode(Iterable<BlockVector2> chunks) {
World world = getWorld();
for (BlockVector2 chunkPos : chunks) {
world.refreshChunk(chunkPos.getBlockX(), chunkPos.getBlockZ());
world.refreshChunk(chunkPos.x(), chunkPos.z());
}
}
@ -495,13 +495,13 @@ public class BukkitWorld extends AbstractWorld {
//FAWE start - safe edit region
testCoords(pt);
//FAWE end
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
getWorld().getBlockAt(pt.x(), pt.y(), pt.z()).breakNaturally();
}
//FAWE start
@Override
public Collection<BaseItemStack> getBlockDrops(BlockVector3 position) {
return getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()).getDrops().stream()
return getWorld().getBlockAt(position.x(), position.y(), position.z()).getDrops().stream()
.map(BukkitAdapter::adapt).collect(Collectors.toList());
}
//FAWE end
@ -538,7 +538,7 @@ public class BukkitWorld extends AbstractWorld {
}
}
if (WorldEditPlugin.getInstance().getLocalConfiguration().unsupportedVersionEditing) {
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
Block bukkitBlock = getWorld().getBlockAt(position.x(), position.y(), position.z());
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
} else {
throw new RuntimeException(new UnsupportedVersionEditException());
@ -562,7 +562,7 @@ public class BukkitWorld extends AbstractWorld {
}
}
}
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
Block bukkitBlock = getWorld().getBlockAt(position.x(), position.y(), position.z());
bukkitBlock.setBlockData(BukkitAdapter.adapt(block), sideEffects.doesApplyAny());
return true;
}
@ -584,8 +584,8 @@ public class BukkitWorld extends AbstractWorld {
if (!Settings.settings().REGION_RESTRICTIONS_OPTIONS.RESTRICT_TO_SAFE_RANGE) {
return;
}
int x = position.getX();
int z = position.getZ();
int x = position.x();
int z = position.z();
if (x > 30000000 || z > 30000000 || x < -30000000 || z < -30000000) {
throw FaweCache.OUTSIDE_SAFE_REGION;
}
@ -636,9 +636,9 @@ public class BukkitWorld extends AbstractWorld {
testCoords(position);
//FAWE end
if (HAS_3D_BIOMES) {
return BukkitAdapter.adapt(getWorld().getBiome(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
return BukkitAdapter.adapt(getWorld().getBiome(position.x(), position.y(), position.z()));
} else {
return BukkitAdapter.adapt(getWorld().getBiome(position.getBlockX(), position.getBlockZ()));
return BukkitAdapter.adapt(getWorld().getBiome(position.x(), position.z()));
}
}
@ -649,9 +649,9 @@ public class BukkitWorld extends AbstractWorld {
testCoords(position);
//FAWE end
if (HAS_3D_BIOMES) {
getWorld().setBiome(position.getBlockX(), position.getBlockY(), position.getBlockZ(), BukkitAdapter.adapt(biome));
getWorld().setBiome(position.x(), position.y(), position.z(), BukkitAdapter.adapt(biome));
} else {
getWorld().setBiome(position.getBlockX(), position.getBlockZ(), BukkitAdapter.adapt(biome));
getWorld().setBiome(position.x(), position.z(), BukkitAdapter.adapt(biome));
}
return true;
}