diff --git a/.github/workflows/label-merge-conflicts.yaml b/.github/workflows/label-merge-conflicts.yaml index fa6f3d72d..551b39417 100644 --- a/.github/workflows/label-merge-conflicts.yaml +++ b/.github/workflows/label-merge-conflicts.yaml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Label conflicting PRs - uses: eps1lon/actions-label-merge-conflict@v3.0.0 + uses: eps1lon/actions-label-merge-conflict@v3.0.1 with: dirtyLabel: "unresolved-merge-conflict" repoToken: "${{ secrets.GITHUB_TOKEN }}" diff --git a/build.gradle.kts b/build.gradle.kts index aed748cdb..8fdea3200 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ import xyz.jpenilla.runpaper.task.RunServer plugins { id("io.github.gradle-nexus.publish-plugin") version "2.0.0" - id("xyz.jpenilla.run-paper") version "2.2.4" + id("xyz.jpenilla.run-paper") version "2.3.0" } if (!File("$rootDir/.git").exists()) { @@ -34,7 +34,7 @@ logger.lifecycle(""" ******************************************* """) -var rootVersion by extra("2.9.3") +var rootVersion by extra("2.10.1") var snapshot by extra("SNAPSHOT") var revision: String by extra("") var buildNumber by extra("") diff --git a/buildSrc/src/main/kotlin/CommonJavaConfig.kt b/buildSrc/src/main/kotlin/CommonJavaConfig.kt index f915c2e0c..fec02d1a0 100644 --- a/buildSrc/src/main/kotlin/CommonJavaConfig.kt +++ b/buildSrc/src/main/kotlin/CommonJavaConfig.kt @@ -61,7 +61,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean "https://jd.advntr.dev/api/latest/", "https://logging.apache.org/log4j/2.x/javadoc/log4j-api/", "https://www.antlr.org/api/Java/", - "https://jd.papermc.io/paper/1.20/", + "https://jd.papermc.io/paper/1.20.6/", "https://intellectualsites.github.io/fastasyncworldedit-javadocs/worldedit-core/" ) docTitle = "${rootProject.name}-${project.description}" + " " + "${rootProject.version}" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c793b1a49..38f8f3f32 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,14 +14,14 @@ mapmanager = "1.8.0-SNAPSHOT" griefprevention = "17.0.0" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" -towny = "0.100.2.9" +towny = "0.100.2.11" plotsquared = "7.3.8" # Third party bstats = "3.0.2" sparsebitset = "1.3" parallelgzip = "1.0.5" -adventure = "4.16.0" +adventure = "4.17.0" adventure-bukkit = "4.3.2" checkerqual = "3.43.0" truezip = "6.8.4" @@ -35,7 +35,7 @@ jlibnoise = "1.0.0" jchronic = "0.2.4a" lz4-java = "1.8.0" lz4-stream = "1.0.0" -commons-cli = "1.7.0" +commons-cli = "1.8.0" paperlib = "1.0.8" paster = "1.1.6" vault = "1.7.1" @@ -46,7 +46,7 @@ text = "3.0.4" piston = "0.5.10" # Tests -mockito = "5.11.0" +mockito = "5.12.0" # Gradle plugins pluginyml = "0.6.0" diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R3/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R3/PaperweightAdapter.java index 22c5a07b2..6d1038677 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R3/PaperweightAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R3/PaperweightAdapter.java @@ -27,7 +27,6 @@ import com.google.common.collect.Sets; import com.google.common.util.concurrent.Futures; import com.mojang.datafixers.util.Either; import com.mojang.serialization.Lifecycle; -import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.NBTConstants; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItem; @@ -531,7 +530,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData) @@ -581,10 +580,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter>) - getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true)) + getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true)) .thenApply(either -> either.left().orElse(null)) ); } catch (IllegalAccessException | InvocationTargetException e) { @@ -797,7 +796,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter entry : tiles.entrySet()) { final CompoundTag nativeTag = entry.getValue(); final BlockVector3 blockHash = entry.getKey(); - final int x = blockHash.getX() + bx; - final int y = blockHash.getY(); - final int z = blockHash.getZ() + bz; + final int x = blockHash.x() + bx; + final int y = blockHash.y(); + final int z = blockHash.z() + bz; final BlockPos pos = new BlockPos(x, y, z); synchronized (nmsWorld) { diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java index b40c12b1a..6d7e28504 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java @@ -570,7 +570,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData) @@ -631,10 +631,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter>) - getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true)) + getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true)) .thenApply(either -> either.left().orElse(null)) ); } catch (IllegalAccessException | InvocationTargetException e) { @@ -848,7 +848,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter entry : tiles.entrySet()) { final CompoundTag nativeTag = entry.getValue(); final BlockVector3 blockHash = entry.getKey(); - final int x = blockHash.getX() + bx; - final int y = blockHash.getY(); - final int z = blockHash.getZ() + bz; + final int x = blockHash.x() + bx; + final int y = blockHash.y(); + final int z = blockHash.z() + bz; final BlockPos pos = new BlockPos(x, y, z); synchronized (nmsWorld) { diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R2/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R2/PaperweightAdapter.java index b73e6d06e..d8dafb8e5 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R2/PaperweightAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R2/PaperweightAdapter.java @@ -530,7 +530,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData) @@ -580,10 +580,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter>) - getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true)) + getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true)) .thenApply(either -> either.left().orElse(null)) ); } catch (IllegalAccessException | InvocationTargetException e) { @@ -797,7 +797,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter entry : tiles.entrySet()) { final CompoundTag nativeTag = entry.getValue(); final BlockVector3 blockHash = entry.getKey(); - final int x = blockHash.getX() + bx; - final int y = blockHash.getY(); - final int z = blockHash.getZ() + bz; + final int x = blockHash.x() + bx; + final int y = blockHash.y(); + final int z = blockHash.z() + bz; final BlockPos pos = new BlockPos(x, y, z); synchronized (nmsWorld) { diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R3/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R3/PaperweightAdapter.java index 899c6e0c4..51b97b081 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R3/PaperweightAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R3/PaperweightAdapter.java @@ -530,7 +530,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData) @@ -580,10 +580,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter>) - getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true)) + getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true)) .thenApply(either -> either.left().orElse(null)) ); } catch (IllegalAccessException | InvocationTargetException e) { @@ -797,7 +797,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter entry : tiles.entrySet()) { final CompoundTag nativeTag = entry.getValue(); final BlockVector3 blockHash = entry.getKey(); - final int x = blockHash.getX() + bx; - final int y = blockHash.getY(); - final int z = blockHash.getZ() + bz; + final int x = blockHash.x() + bx; + final int y = blockHash.y(); + final int z = blockHash.z() + bz; final BlockPos pos = new BlockPos(x, y, z); synchronized (nmsWorld) { diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_20_5/build.gradle.kts index e1a518cbb..8f97a8454 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_20_5/build.gradle.kts @@ -12,6 +12,6 @@ repositories { dependencies { // url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.20.6-R0.1-SNAPSHOT/ - the().paperDevBundle("1.20.6-R0.1-20240516.001739-55") + the().paperDevBundle("1.20.6-R0.1-20240526.222003-87") compileOnly(libs.paperlib) } diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R4/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R4/PaperweightAdapter.java index e629c4611..8218ec892 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R4/PaperweightAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R4/PaperweightAdapter.java @@ -577,7 +577,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter>) - getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true)) + getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true)) .thenApply(either -> either.orElse(null)) ); } catch (IllegalAccessException | InvocationTargetException e) { @@ -874,7 +874,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter entry : tiles.entrySet()) { final CompoundTag nativeTag = entry.getValue(); final BlockVector3 blockHash = entry.getKey(); - final int x = blockHash.getX() + bx; - final int y = blockHash.getY(); - final int z = blockHash.getZ() + bz; + final int x = blockHash.x() + bx; + final int y = blockHash.y(); + final int z = blockHash.z() + bz; final BlockPos pos = new BlockPos(x, y, z); synchronized (nmsWorld) { diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlatformAdapter.java index 128897111..4f934129e 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlatformAdapter.java @@ -345,10 +345,8 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { .getChunkSource() .getChunkAtIfLoadedImmediately(chunkX, chunkZ); } else { - levelChunk = ((Optional) ((Either) chunkHolder - .getTickingChunkFuture() // method is not present with new paper chunk system - .getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left()) - .orElse(null); + levelChunk = chunkHolder.getTickingChunkFuture() + .getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK).orElse(null); } if (levelChunk == null) { return; diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 3af5fa04e..ce6c9d1b1 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -179,7 +179,7 @@ tasks.named("shadowJar") { include(dependency("org.lz4:lz4-java:1.8.0")) } relocate("net.kyori", "com.fastasyncworldedit.core.adventure") { - include(dependency("net.kyori:adventure-nbt:4.16.0")) + include(dependency("net.kyori:adventure-nbt:4.17.0")) } relocate("com.zaxxer", "com.fastasyncworldedit.core.math") { include(dependency("com.zaxxer:SparseBitSet:1.3")) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/IBukkitAdapter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/IBukkitAdapter.java index 9792f9344..6ea8cad89 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/IBukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/IBukkitAdapter.java @@ -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() ); diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java index 2a006d141..4afbe03a2 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java @@ -354,7 +354,7 @@ public abstract class Regenerator> 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(); } diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java index 1043d9a3e..c847a8688 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java @@ -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); } diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java index 6cf09da28..792f3937e 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java @@ -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); diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java index e1ac20617..9f0916a4b 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java @@ -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(); } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java index 41e7e7294..e0a643015 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java @@ -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() ); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 9c5196e91..8a0081484 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -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 > 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 { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 1598cb547..b2fdeead9 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -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 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 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; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index e881416c5..b4556409c 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -120,7 +120,6 @@ public class WorldEditPlugin extends JavaPlugin { public void onLoad() { //FAWE start - this.bukkitConsoleCommandSender = new BukkitCommandSender(this, Bukkit.getConsoleSender()); // This is already covered by Spigot, however, a more pesky warning with a proper explanation over "Ambiguous plugin name..." can't hurt. Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins(); for (Plugin p : plugins) { @@ -138,6 +137,14 @@ public class WorldEditPlugin extends JavaPlugin { //noinspection ResultOfMethodCallIgnored getDataFolder().mkdirs(); + //FAWE start - Modify WorldEdit config name + config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "worldedit-config.yml"), true), this); + // Load config before we say we've loaded platforms as it is used in listeners of the event + // Load config in onLoad to ensure it is loaded before FAWE settings to allow (inelegant) copying of values across + // where needed + config.load(); + //FAWE end + WorldEdit worldEdit = WorldEdit.getInstance(); // Setup platform @@ -148,14 +155,14 @@ public class WorldEditPlugin extends JavaPlugin { migrateLegacyConfig(); //FAWE end - //FAWE start - Modify WorldEdit config name - config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "worldedit-config.yml"), true), this); - //FAWE end - //FAWE start - Setup permission attachments permissionAttachmentManager = new BukkitPermissionAttachmentManager(this); //FAWE end + //FAWE start - initialise bukkitConsoleCommandSender later + this.bukkitConsoleCommandSender = new BukkitCommandSender(this, Bukkit.getConsoleSender()); + //FAWE end + Path delChunks = Paths.get(getDataFolder().getPath(), DELCHUNKS_FILE_NAME); if (Files.exists(delChunks)) { ChunkDeleter.runFromFile(delChunks, true); @@ -189,8 +196,6 @@ public class WorldEditPlugin extends JavaPlugin { new FaweBukkit(this); //FAWE end - config.load(); // Load config before we say we've loaded platforms as it is used in listeners of the event - WorldEdit.getInstance().getEventBus().post(new PlatformsRegisteredEvent()); PermissionsResolverManager.initialize(this); // Setup permission resolver diff --git a/worldedit-bukkit/src/main/resources/defaults/worldedit-config.yml b/worldedit-bukkit/src/main/resources/defaults/worldedit-config.yml index 8140cade6..b74eaa091 100644 --- a/worldedit-bukkit/src/main/resources/defaults/worldedit-config.yml +++ b/worldedit-bukkit/src/main/resources/defaults/worldedit-config.yml @@ -24,11 +24,13 @@ limits: max-polygonal-points: default: -1 maximum: 20 + # radius, superpickaxe, brush radius are ignored, use FAWE config limits max-radius: -1 max-super-pickaxe-size: 5 max-brush-radius: 100 butcher-radius: default: -1 + # Ignored, use FAWE config limits maximum: -1 disallowed-blocks: - "minecraft:wheat" diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweAPI.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweAPI.java index 4c5339017..acc0d8bf3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweAPI.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweAPI.java @@ -339,11 +339,11 @@ public class FaweAPI { final BlockVector3 bot = selection.getMinimumPoint(); final BlockVector3 top = selection.getMaximumPoint(); - final int minX = bot.getBlockX() >> 4; - final int minZ = bot.getBlockZ() >> 4; + final int minX = bot.x() >> 4; + final int minZ = bot.z() >> 4; - final int maxX = top.getBlockX() >> 4; - final int maxZ = top.getBlockZ() >> 4; + final int maxX = top.x() >> 4; + final int maxZ = top.z() >> 4; int count = 0; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlendBall.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlendBall.java index 902e48a9b..ec3e0766e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlendBall.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlendBall.java @@ -50,9 +50,9 @@ public class BlendBall implements Brush { final int outsetSize = (int) (size + 1); double brushSizeSquared = size * size; - int tx = position.getBlockX(); - int ty = position.getBlockY(); - int tz = position.getBlockZ(); + int tx = position.x(); + int ty = position.y(); + int tz = position.z(); int[] frequency = new int[BlockTypes.size()]; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CatenaryBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CatenaryBrush.java index e380e74b0..7ad15cef4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CatenaryBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CatenaryBrush.java @@ -81,9 +81,9 @@ public class CatenaryBrush implements Brush, ResettableTool { return pos1.add(pos2).divide(2).toBlockPoint(); } double curveLen = pos1.distance(pos2) * lenPercent; - double dy = pos2.getY() - pos1.getY(); - double dx = pos2.getX() - pos1.getX(); - double dz = pos2.getZ() - pos1.getZ(); + double dy = pos2.y() - pos1.y(); + double dx = pos2.x() - pos1.x(); + double dz = pos2.z() - pos1.z(); double dh = Math.sqrt(dx * dx + dz * dz); double g = Math.sqrt(curveLen * curveLen - dy * dy) / 2; double a = 0.00001; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java index 227960c1d..b71578b55 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java @@ -54,9 +54,9 @@ public class CommandBrush implements Brush { position.subtract(radius, radius, radius), position.add(radius, radius, radius) ); - String replaced = command.replace("{x}", Integer.toString(position.getBlockX())) - .replace("{y}", Integer.toString(position.getBlockY())) - .replace("{z}", Integer.toString(position.getBlockZ())) + String replaced = command.replace("{x}", Integer.toString(position.x())) + .replace("{y}", Integer.toString(position.y())) + .replace("{z}", Integer.toString(position.z())) .replace("{world}", editSession.getWorld().getName()) .replace("{size}", Integer.toString(radius)); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CopyPastaBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CopyPastaBrush.java index 4aeb2daeb..b635c1e7d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CopyPastaBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CopyPastaBrush.java @@ -65,11 +65,11 @@ public class CopyPastaBrush implements Brush, ResettableTool { mask = Masks.alwaysTrue(); } final ResizableClipboardBuilder builder = new ResizableClipboardBuilder(editSession.getWorld()); - final int minY = position.getBlockY(); + final int minY = position.y(); mask = new AbstractDelegateMask(mask) { @Override public boolean test(BlockVector3 vector) { - if (super.test(vector) && vector.getBlockY() >= minY) { + if (super.test(vector) && vector.y() >= minY) { BaseBlock block = editSession.getFullBlock(vector); if (!block.getBlockType().getMaterial().isAir()) { builder.add(vector, BlockTypes.AIR.getDefaultState().toBaseBlock(), block); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ErodeBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ErodeBrush.java index 21879751c..da52bf504 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ErodeBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ErodeBrush.java @@ -63,9 +63,9 @@ public class ErodeBrush implements Brush { Clipboard buffer1 = new CPUOptimizedClipboard(region); Clipboard buffer2 = new CPUOptimizedClipboard(region); - final int bx = target.getBlockX(); - final int by = target.getBlockY(); - final int bz = target.getBlockZ(); + final int bx = target.x(); + final int by = target.y(); + final int bz = target.z(); for (int x = -brushSize, relx = 0; x <= brushSize && relx < buffer1.getWidth(); x++, relx++) { int x0 = x + bx; @@ -106,7 +106,7 @@ public class ErodeBrush implements Brush { for (BlockVector3 pos : finalBuffer) { BlockState block = pos.getBlock(finalBuffer); - es.setBlock(pos.getX() + bx - brushSize, pos.getY() + by - brushSize, pos.getZ() + bz - brushSize, block); + es.setBlock(pos.x() + bx - brushSize, pos.y() + by - brushSize, pos.z() + bz - brushSize, block); } } @@ -139,9 +139,9 @@ public class ErodeBrush implements Brush { int highest = 1; for (BlockVector3 offs : FACES_TO_CHECK) { BaseBlock next = current.getFullBlock( - relx + offs.getBlockX(), - rely + offs.getBlockY(), - relz + offs.getBlockZ() + relx + offs.x(), + rely + offs.y(), + relz + offs.z() ); if (!next.getBlockType().getMaterial().isMovementBlocker()) { continue; @@ -190,9 +190,9 @@ public class ErodeBrush implements Brush { int total = 0; for (BlockVector3 offs : FACES_TO_CHECK) { BaseBlock next = current.getFullBlock( - relx + offs.getBlockX(), - rely + offs.getBlockY(), - relz + offs.getBlockZ() + relx + offs.x(), + rely + offs.y(), + relz + offs.z() ); if (next.getMaterial().isMovementBlocker()) { continue; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FallingSphere.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FallingSphere.java index fd720c54e..d54bbebb6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FallingSphere.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FallingSphere.java @@ -12,9 +12,9 @@ public class FallingSphere implements Brush { @Override public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { - int px = position.getBlockX(); - int py = position.getBlockY(); - int pz = position.getBlockZ(); + int px = position.x(); + int py = position.y(); + int pz = position.z(); int maxY = editSession.getMaxY(); int minY = editSession.getMinY(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/InspectBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/InspectBrush.java index 5ad9b818a..1ef2a27fa 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/InspectBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/InspectBrush.java @@ -14,7 +14,6 @@ import com.sk89q.worldedit.command.tool.BrushTool; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Location; @@ -25,7 +24,6 @@ import com.sk89q.worldedit.util.formatting.text.event.HoverEvent; import com.sk89q.worldedit.util.formatting.text.format.TextColor; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockState; -import org.apache.logging.log4j.Logger; import java.io.IOException; import java.util.Iterator; @@ -80,9 +78,9 @@ public class InspectBrush extends BrushTool { return true; } BlockVector3 target = targetVector.toBlockPoint(); - final int x = target.getBlockX(); - final int y = target.getBlockY(); - final int z = target.getBlockZ(); + final int x = target.x(); + final int y = target.y(); + final int z = target.z(); World world = player.getWorld(); RollbackDatabase db = DBHandler.dbHandler().getDatabase(world); int count = 0; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RecurseBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RecurseBrush.java index 869d45150..f87fee30e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RecurseBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RecurseBrush.java @@ -35,7 +35,7 @@ public record RecurseBrush(boolean dfs) implements Brush { DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, replace, Integer.MAX_VALUE, Integer.MAX_VALUE) { @Override public boolean isVisitable(BlockVector3 from, BlockVector3 to) { - int y = to.getBlockY(); + int y = to.y(); return y < maxY && radMask.test(to) && super.isVisitable(from, to); } }; @@ -45,7 +45,7 @@ public record RecurseBrush(boolean dfs) implements Brush { RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, radius, editSession.getMinY(), editSession.getMaxY()) { @Override public boolean isVisitable(BlockVector3 from, BlockVector3 to) { - int y = to.getBlockY(); + int y = to.y(); return y < maxY && super.isVisitable(from, to); } }; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RockBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RockBrush.java index 4196a7e11..27937b836 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RockBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RockBrush.java @@ -19,15 +19,15 @@ public record RockBrush(double amplitude, double frequency, Vector3 radius) impl double seedY = ThreadLocalRandom.current().nextDouble(); double seedZ = ThreadLocalRandom.current().nextDouble(); - int px = position.getBlockX(); - int py = position.getBlockY(); - int pz = position.getBlockZ(); + int px = position.x(); + int py = position.y(); + int pz = position.z(); double distort = this.frequency / size; - double modX = 1D / radius.getX(); - double modY = 1D / radius.getY(); - double modZ = 1D / radius.getZ(); + double modX = 1D / radius.x(); + double modY = 1D / radius.y(); + double modZ = 1D / radius.z(); int radiusSqr = (int) (size * size); int sizeInt = (int) size * 2; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterBrush.java index e14d0c599..26cf07558 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterBrush.java @@ -67,15 +67,15 @@ public class ScatterBrush implements Brush { } BlockVector3 patternSize = pattern.size(); BlockVector3Set placed = BlockVector3Set.getAppropriateVectorSet(patternSize.add(distance, distance, distance)); - placed.setOffset(position.getX(), position.getY(), position.getZ()); + placed.setOffset(position.x(), position.y(), position.z()); int maxFails = 1000; for (int i = 0; i < count; i++) { int index = ThreadLocalRandom.current().nextInt(length); BlockVector3 pos = visited.get(index); if (pos != null && canApply(pos)) { - int x = pos.getBlockX(); - int y = pos.getBlockY(); - int z = pos.getBlockZ(); + int x = pos.x(); + int y = pos.y(); + int z = pos.z(); if (placed.containsRadius(x, y, z, distance)) { if (maxFails-- <= 0) { break; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java index 1d7841355..9e2c16555 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java @@ -45,9 +45,9 @@ public class ScatterCommand extends ScatterBrush { position.subtract(radius, radius, radius), position.add(radius, radius, radius) ); - String replaced = command.replace("{x}", Integer.toString(position.getBlockX())) - .replace("{y}", Integer.toString(position.getBlockY())) - .replace("{z}", Integer.toString(position.getBlockZ())) + String replaced = command.replace("{x}", Integer.toString(position.x())) + .replace("{y}", Integer.toString(position.y())) + .replace("{z}", Integer.toString(position.z())) .replace("{world}", editSession.getWorld().getName()) .replace("{size}", Integer.toString(radius)); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterOverlayBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterOverlayBrush.java index cd7ce9aaa..d6a991234 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterOverlayBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterOverlayBrush.java @@ -16,9 +16,9 @@ public class ScatterOverlayBrush extends ScatterBrush { @Override public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pt, Pattern p, double size) throws MaxChangedBlocksException { - final int x = pt.getBlockX(); - final int y = pt.getBlockY(); - final int z = pt.getBlockZ(); + final int x = pt.x(); + final int y = pt.y(); + final int z = pt.z(); BlockVector3 dir = getDirection(pt); if (dir == null) { getDir: @@ -37,7 +37,7 @@ public class ScatterOverlayBrush extends ScatterBrush { return; } } - editSession.setBlock(x + dir.getBlockX(), y + dir.getBlockY(), z + dir.getBlockZ(), p); + editSession.setBlock(x + dir.x(), y + dir.y(), z + dir.z(), p); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ShatterBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ShatterBrush.java index 41b36e12c..196b71f50 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ShatterBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ShatterBrush.java @@ -80,13 +80,13 @@ public class ShatterBrush extends ScatterBrush { } for (int i1 = 0; i1 < BreadthFirstSearch.DIAGONAL_DIRECTIONS.length; i1++) { BlockVector3 direction = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i1]; - int x2 = x + direction.getBlockX(); - int y2 = y + direction.getBlockY(); - int z2 = z + direction.getBlockZ(); + int x2 = x + direction.x(); + int y2 = y + direction.y(); + int z2 = z + direction.z(); // Check boundary - int dx = position.getBlockX() - x2; - int dy = position.getBlockY() - y2; - int dz = position.getBlockZ() - z2; + int dx = position.x() - x2; + int dy = position.y() - y2; + int dz = position.z() - z2; int dSqr = (dx * dx) + (dy * dy) + (dz * dz); if (dSqr <= radius2) { BlockVector3 bv = mutable.setComponents(x2, y2, z2); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplineBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplineBrush.java index 55d8fd96a..e1fa38708 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplineBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplineBrush.java @@ -130,9 +130,9 @@ public class SplineBrush implements Brush, ResettableTool { private Vector3 getCentroid(Collection points) { MutableVector3 sum = new MutableVector3(); for (BlockVector3 p : points) { - sum.mutX(sum.getX() + p.getX()); - sum.mutY(sum.getY() + p.getY()); - sum.mutZ(sum.getZ() + p.getZ()); + sum.mutX(sum.x() + p.x()); + sum.mutY(sum.y() + p.y()); + sum.mutZ(sum.z() + p.z()); } return sum.multiply(1.0 / points.size()); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSpline.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSpline.java index f652c4f94..8c94e76ad 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSpline.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSpline.java @@ -38,16 +38,16 @@ public class SurfaceSpline implements Brush { int minY = editSession.getMinY(); if (path.isEmpty() || !pos.equals(path.get(path.size() - 1))) { int max = editSession.getNearestSurfaceTerrainBlock( - pos.getBlockX(), - pos.getBlockZ(), - pos.getBlockY(), + pos.x(), + pos.z(), + pos.y(), minY, maxY ); if (max == -1) { return; } - path.add(BlockVector3.at(pos.getBlockX(), max, pos.getBlockZ())); + path.add(BlockVector3.at(pos.x(), max, pos.z())); if (editSession.getActor() != null) { editSession.getActor().print(Caption.of("fawe.worldedit.brush.spline.primary.2")); } @@ -69,9 +69,9 @@ public class SurfaceSpline implements Brush { LocalBlockVectorSet vset = new LocalBlockVectorSet(); for (double loop = 0; loop <= 1; loop += 1D / splinelength / quality) { final Vector3 tipv = interpol.getPosition(loop); - final int tipx = MathMan.roundInt(tipv.getX()); - final int tipz = (int) tipv.getZ(); - int tipy = MathMan.roundInt(tipv.getY()); + final int tipx = MathMan.roundInt(tipv.x()); + final int tipz = (int) tipv.z(); + int tipy = MathMan.roundInt(tipv.y()); tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, minY, maxY, Integer.MIN_VALUE, Integer.MAX_VALUE); if (tipy == Integer.MIN_VALUE || tipy == Integer.MAX_VALUE) { continue; @@ -88,15 +88,15 @@ public class SurfaceSpline implements Brush { LocalBlockVectorSet newSet = new LocalBlockVectorSet(); final int ceilrad = (int) Math.ceil(radius); for (BlockVector3 v : vset) { - final int tipx = v.getBlockX(); - final int tipz = v.getBlockZ(); + final int tipx = v.x(); + final int tipz = v.z(); for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) { for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) { if (MathMan.hypot2(loopx - tipx, 0, loopz - tipz) <= radius2) { int y = editSession.getNearestSurfaceTerrainBlock( loopx, loopz, - v.getBlockY(), + v.y(), minY, maxY, Integer.MIN_VALUE, diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollRange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollRange.java index 405b62b81..db33a526f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollRange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollRange.java @@ -13,7 +13,7 @@ public class ScrollRange extends Scroll { @Override public boolean increment(Player player, int amount) { - int max = WorldEdit.getInstance().getConfiguration().maxBrushRadius; + int max = player.getLimit().MAX_BRUSH_RADIUS; int newSize = MathMan.wrap(getTool().getRange() + amount, (int) (getTool().getSize() + 1), max); getTool().setRange(newSize); return true; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollSize.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollSize.java index cf60639f5..ac34226f2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollSize.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollSize.java @@ -12,7 +12,7 @@ public class ScrollSize extends Scroll { @Override public boolean increment(Player player, int amount) { - int max = WorldEdit.getInstance().getConfiguration().maxRadius; + int max = player.getLimit().MAX_RADIUS; double newSize = Math.max(0, Math.min(max == -1 ? 4095 : max, getTool().getSize() + amount)); getTool().setSize(newSize); return true; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/ClipboardSpline.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/ClipboardSpline.java index 87f1495f5..281c78c74 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/ClipboardSpline.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/ClipboardSpline.java @@ -83,7 +83,7 @@ public class ClipboardSpline extends Spline { Region region = clipboard.getRegion(); BlockVector3 origin = clipboard.getOrigin(); // center = region.getCenter().setY(origin.getY() - 1); - center = region.getCenter().withY(origin.getY() - 1).toBlockPoint(); + center = region.getCenter().withY(origin.y() - 1).toBlockPoint(); this.centerOffset = center.subtract(center.round()); this.center = center.subtract(centerOffset); this.transform = transform; @@ -108,15 +108,15 @@ public class ClipboardSpline extends Spline { clipboardHolder.setTransform(transform); BlockVector3 functionOffset = target.subtract(clipboard.getOrigin()); - final int offX = functionOffset.getBlockX(); - final int offY = functionOffset.getBlockY(); - final int offZ = functionOffset.getBlockZ(); + final int offX = functionOffset.x(); + final int offY = functionOffset.y(); + final int offZ = functionOffset.z(); Operation operation = clipboardHolder .createPaste(editSession) .to(target) .ignoreAirBlocks(true) - .filter(v -> buffer.add(v.getBlockX() + offX, v.getBlockY() + offY, v.getBlockZ() + offZ)) + .filter(v -> buffer.add(v.x() + offX, v.y() + offY, v.z() + offZ)) .build(); Operations.completeLegacy(operation); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/Spline.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/Spline.java index 945c10f5a..872ec495e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/Spline.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/Spline.java @@ -121,7 +121,7 @@ public abstract class Spline { * 2 dimensional "cross" product. cross2D(v1, v2) = |v1|*|v2|*sin(theta) or v1 X v2 taking Y to be 0 */ private double cross2D(Vector2 v1, Vector2 v2) { - return v1.getX() * v2.getZ() - v2.getX() * v1.getZ(); + return v1.x() * v2.z() - v2.x() * v1.z(); } /** @@ -144,7 +144,7 @@ public abstract class Spline { // Calculate rotation from spline Vector3 deriv = interpolation.get1stDerivative(position); - Vector2 deriv2D = Vector2.at(deriv.getX(), deriv.getZ()).normalize(); + Vector2 deriv2D = Vector2.at(deriv.x(), deriv.z()).normalize(); double angle = Math.toDegrees( -Math.atan2(cross2D(direction, deriv2D), direction.dot(deriv2D)) ); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/SweepBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/SweepBrush.java index fa4bb971c..603fb4302 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/SweepBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/SweepBrush.java @@ -79,13 +79,13 @@ public class SweepBrush implements Brush, ResettableTool { Clipboard clipboard = holder.getClipboard(); BlockVector3 dimensions = clipboard.getDimensions(); - double quality = Math.max(dimensions.getBlockX(), dimensions.getBlockZ()); + double quality = Math.max(dimensions.x(), dimensions.z()); AffineTransform transform = new AffineTransform(); ClipboardSpline spline = new ClipboardSpline(editSession, holder, interpol, transform, nodes.size()); - if (dimensions.getBlockX() > dimensions.getBlockZ()) { + if (dimensions.x() > dimensions.z()) { spline.setDirection(Vector2.at(0, 1)); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Config.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Config.java index c3f223dc2..e5185e6d8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Config.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Config.java @@ -189,7 +189,7 @@ public class Config { /** * Indicates that a field should be instantiated / created. * - * @since TODO + * @since 2.10.0 */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index f6aaf9200..3535e82ca 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -2,6 +2,7 @@ package com.fastasyncworldedit.core.configuration; import com.fastasyncworldedit.core.limit.FaweLimit; import com.fastasyncworldedit.core.limit.PropertyRemap; +import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockTypesCache; @@ -140,8 +141,22 @@ public class Settings extends Config { ); limit.MAX_FAILS = Math.max(limit.MAX_FAILS, newLimit.MAX_FAILS != -1 ? newLimit.MAX_FAILS : Integer.MAX_VALUE); limit.MAX_ITERATIONS = Math.max( - limit.MAX_ITERATIONS, - newLimit.MAX_ITERATIONS != -1 ? newLimit.MAX_ITERATIONS : Integer.MAX_VALUE + limit.MAX_ITERATIONS, newLimit.MAX_ITERATIONS != -1 ? newLimit.MAX_ITERATIONS : Integer.MAX_VALUE); + limit.MAX_RADIUS = Math.max( + limit.MAX_RADIUS, + newLimit.MAX_RADIUS != -1 ? newLimit.MAX_RADIUS : Integer.MAX_VALUE + ); + limit.MAX_SUPER_PICKAXE_SIZE = Math.max( + limit.MAX_SUPER_PICKAXE_SIZE, + newLimit.MAX_SUPER_PICKAXE_SIZE != -1 ? newLimit.MAX_SUPER_PICKAXE_SIZE : Integer.MAX_VALUE + ); + limit.MAX_BRUSH_RADIUS = Math.max( + limit.MAX_BRUSH_RADIUS, + newLimit.MAX_BRUSH_RADIUS != -1 ? newLimit.MAX_BRUSH_RADIUS : Integer.MAX_VALUE + ); + limit.MAX_BUTCHER_RADIUS = Math.max( + limit.MAX_BUTCHER_RADIUS, + newLimit.MAX_BUTCHER_RADIUS != -1 ? newLimit.MAX_BUTCHER_RADIUS : Integer.MAX_VALUE ); limit.MAX_HISTORY = Math.max( limit.MAX_HISTORY, @@ -352,6 +367,14 @@ public class Settings extends Config { public int MAX_ITERATIONS = 1000; @Comment("Max allowed entities (e.g. cows)") public int MAX_ENTITIES = 1337; + @Comment("Max allowed radius (e.g. for //sphere)") + public int MAX_RADIUS = LocalConfiguration.MAX_RADIUS; + @Comment("Max allowed superpickaxe size") + public int MAX_SUPER_PICKAXE_SIZE = LocalConfiguration.MAX_SUPER_RADIUS; + @Comment("Max allowed brush radius") + public int MAX_BRUSH_RADIUS = LocalConfiguration.MAX_BRUSH_RADIUS; + @Comment("Max allowed butcher radius") + public int MAX_BUTCHER_RADIUS = LocalConfiguration.MAX_BUTCHER_RADIUS; @Comment({ "Blockstates include Banner, Beacon, BrewingStand, Chest, CommandBlock, ", "CreatureSpawner, Dispenser, Dropper, EndGateway, Furnace, Hopper, Jukebox, ", diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/RollbackDatabase.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/RollbackDatabase.java index 1677521fe..f8207f2dc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/RollbackDatabase.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/RollbackDatabase.java @@ -179,13 +179,13 @@ public class RollbackDatabase extends AsyncNotifyQueue { } try (PreparedStatement stmt = connection.prepareStatement(stmtStr.formatted(this.prefix))) { stmt.setInt(1, (int) (minTime / 1000)); - stmt.setInt(2, pos1.getBlockX()); - stmt.setInt(3, pos2.getBlockX()); - stmt.setInt(4, pos1.getBlockZ()); - stmt.setInt(5, pos2.getBlockZ()); + stmt.setInt(2, pos1.x()); + stmt.setInt(3, pos2.x()); + stmt.setInt(4, pos1.z()); + stmt.setInt(5, pos2.z()); // Keep 128 offset for backwards-compatibility - stmt.setInt(6, pos1.getBlockY() - 128); - stmt.setInt(7, pos2.getBlockY() - 128); + stmt.setInt(6, pos1.y() - 128); + stmt.setInt(7, pos2.y() - 128); if (uuid != null) { byte[] uuidBytes = toBytes(uuid); stmt.setBytes(8, uuidBytes); @@ -210,13 +210,13 @@ public class RollbackDatabase extends AsyncNotifyQueue { .array(); stmt.setBytes(1, uuidBytes); stmt.setInt(2, (int) (minTime / 1000)); - stmt.setInt(3, pos1.getBlockX()); - stmt.setInt(4, pos2.getBlockX()); - stmt.setInt(5, pos1.getBlockZ()); - stmt.setInt(6, pos2.getBlockZ()); + stmt.setInt(3, pos1.x()); + stmt.setInt(4, pos2.x()); + stmt.setInt(5, pos1.z()); + stmt.setInt(6, pos2.z()); // Keep 128 offset for backwards-compatibility - stmt.setInt(7, pos1.getBlockY() - 128); - stmt.setInt(8, pos2.getBlockY() - 128); + stmt.setInt(7, pos1.y() - 128); + stmt.setInt(8, pos2.y() - 128); } } return count; @@ -262,13 +262,13 @@ public class RollbackDatabase extends AsyncNotifyQueue { BlockVector3 pos1 = change.getMinimumPoint(); BlockVector3 pos2 = change.getMaximumPoint(); - stmt.setInt(4, pos1.getX()); - stmt.setInt(5, pos2.getX()); - stmt.setInt(6, pos1.getZ()); - stmt.setInt(7, pos2.getZ()); + stmt.setInt(4, pos1.x()); + stmt.setInt(5, pos2.x()); + stmt.setInt(6, pos1.z()); + stmt.setInt(7, pos2.z()); // Keep 128 offset for backwards-compatibility - stmt.setInt(8, pos1.getY() - 128); - stmt.setInt(9, pos2.getY() - 128); + stmt.setInt(8, pos1.y() - 128); + stmt.setInt(9, pos2.y() - 128); stmt.setString(10, change.getCommand()); stmt.setInt(11, change.size()); stmt.executeUpdate(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/exception/BrushRadiusLimitException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/exception/BrushRadiusLimitException.java new file mode 100644 index 000000000..838845bd0 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/exception/BrushRadiusLimitException.java @@ -0,0 +1,30 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.fastasyncworldedit.core.exception; + +/** + * Thrown when a maximum radius for a brush is reached. + */ +public class BrushRadiusLimitException extends RadiusLimitException { + + public BrushRadiusLimitException(int maxBrushRadius) { + super(maxBrushRadius); + } +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/exception/RadiusLimitException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/exception/RadiusLimitException.java new file mode 100644 index 000000000..c7f72af3a --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/exception/RadiusLimitException.java @@ -0,0 +1,41 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.fastasyncworldedit.core.exception; + +import com.sk89q.worldedit.WorldEditException; + +/** + * Thrown when a maximum radius is reached, such as, for example, + * in the case of a sphere command. + */ +public class RadiusLimitException extends WorldEditException { + + private final int maxRadius; + + public RadiusLimitException(int maxRadius) { + this.maxRadius = maxRadius; + } + + public int getMaxRadius() { + return maxRadius; + } + //FAWE end + +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/BlockTranslateExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/BlockTranslateExtent.java index d7b8a986e..7f84be430 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/BlockTranslateExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/BlockTranslateExtent.java @@ -24,7 +24,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent { @Override public > boolean setBlock(BlockVector3 location, T block) throws WorldEditException { - return getExtent().setBlock(location.getX() + dx, location.getY() + dy, location.getZ() + dz, block); + return getExtent().setBlock(location.x() + dx, location.y() + dy, location.z() + dz, block); } @Override @@ -49,7 +49,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent { @Override public BlockState getBlock(BlockVector3 location) { - return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + return getBlock(location.x(), location.y(), location.z()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java index 84044f9b2..103dd8824 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java @@ -64,11 +64,11 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc @Override public final boolean contains(BlockVector3 p) { - return contains(p.getBlockX(), p.getBlockY(), p.getBlockZ()); + return contains(p.x(), p.y(), p.z()); } public final boolean contains(BlockVector2 p) { - return contains(p.getBlockX(), p.getBlockZ()); + return contains(p.x(), p.z()); } @Override @@ -96,7 +96,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc @Override public BiomeType getBiome(BlockVector3 position) { - return getBiomeType(position.getX(), position.getY(), position.getZ()); + return getBiomeType(position.x(), position.y(), position.z()); } @Override @@ -112,7 +112,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc @Override public BaseBlock getFullBlock(BlockVector3 position) { - return getFullBlock(position.getX(), position.getY(), position.getZ()); + return getFullBlock(position.x(), position.y(), position.z()); } @Override @@ -128,7 +128,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc @Override public BlockState getBlock(BlockVector3 position) { - return getBlock(position.getX(), position.getY(), position.getZ()); + return getBlock(position.x(), position.y(), position.z()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HistoryExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HistoryExtent.java index 2fc5133c6..d85594215 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HistoryExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HistoryExtent.java @@ -66,7 +66,7 @@ public class HistoryExtent extends AbstractDelegateExtent { @Override public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { - return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block); + return setBlock(location.x(), location.y(), location.z(), block); } @Nullable @@ -111,7 +111,7 @@ public class HistoryExtent extends AbstractDelegateExtent { public boolean setBiome(BlockVector3 position, BiomeType newBiome) { BiomeType oldBiome = this.getBiome(position); if (!oldBiome.getId().equals(newBiome.getId())) { - this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockY(), position.getBlockZ(), oldBiome, newBiome); + this.changeSet.addBiomeChange(position.x(), position.y(), position.z(), oldBiome, newBiome); return getExtent().setBiome(position, newBiome); } else { return false; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/LimitExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/LimitExtent.java index 24d440c57..d02ff9320 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/LimitExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/LimitExtent.java @@ -373,12 +373,12 @@ public class LimitExtent extends AbstractDelegateExtent { size = ((Collection) positions).size(); } else if (positions instanceof Region) { BlockVector3 dim = ((Region) positions).getDimensions(); - size = dim.getX() * dim.getY() * dim.getZ(); + size = dim.x() * dim.y() * dim.z(); } else if (positions instanceof Extent) { BlockVector3 min = ((Extent) positions).getMinimumPoint(); BlockVector3 max = ((Extent) positions).getMinimumPoint(); BlockVector3 dim = max.subtract(min).add(BlockVector3.ONE); - size = dim.getX() * dim.getY() * dim.getZ(); + size = dim.x() * dim.y() * dim.z(); } else { ExtentFilterBlock block = new ExtentFilterBlock(this); for (BlockVector3 pos : positions) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PositionTransformExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PositionTransformExtent.java index 6d74acc16..d5e8e57e8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PositionTransformExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PositionTransformExtent.java @@ -38,9 +38,9 @@ public class PositionTransformExtent extends ResettableExtent { if (min == null) { min = pos; } - mutable.mutX(pos.getX() - min.getX()); - mutable.mutY(pos.getY() - min.getY()); - mutable.mutZ(pos.getZ() - min.getZ()); + mutable.mutX(pos.x() - min.x()); + mutable.mutY(pos.y() - min.y()); + mutable.mutZ(pos.z() - min.z()); MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3())); return min.add(tmp.roundHalfUp().toBlockPoint()); } @@ -49,9 +49,9 @@ public class PositionTransformExtent extends ResettableExtent { if (min == null) { min = BlockVector3.at(x, y, z); } - mutable.mutX(x - min.getX()); - mutable.mutY(y - min.getY()); - mutable.mutZ(z - min.getZ()); + mutable.mutX(x - min.x()); + mutable.mutY(y - min.y()); + mutable.mutZ(z - min.z()); MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3())); return min.add(tmp.roundHalfUp().toBlockPoint()); } @@ -73,10 +73,10 @@ public class PositionTransformExtent extends ResettableExtent { @Override public BiomeType getBiome(BlockVector3 position) { - mutable.mutX(position.getBlockX()); - mutable.mutZ(position.getBlockZ()); - mutable.mutY(position.getBlockY()); - return super.getBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ())); + mutable.mutX(position.x()); + mutable.mutZ(position.z()); + mutable.mutY(position.y()); + return super.getBiome(getPos(mutable.x(), mutable.y(), mutable.z())); } @Override @@ -92,10 +92,10 @@ public class PositionTransformExtent extends ResettableExtent { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - mutable.mutX(position.getBlockX()); - mutable.mutZ(position.getBlockZ()); - mutable.mutY(position.getBlockY()); - return super.setBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ()), biome); + mutable.mutX(position.x()); + mutable.mutZ(position.z()); + mutable.mutY(position.y()); + return super.setBiome(getPos(mutable.x(), mutable.y(), mutable.z()), biome); } public void setTransform(Transform transform) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ProcessedWEExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ProcessedWEExtent.java index 5abe90348..e08e1535f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ProcessedWEExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ProcessedWEExtent.java @@ -80,12 +80,12 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { @Override public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { - return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block); + return setBlock(location.x(), location.y(), location.z(), block); } @Override public BlockState getBlock(BlockVector3 location) { - return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + return getBlock(location.x(), location.y(), location.z()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SourceMaskExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SourceMaskExtent.java index 6c2230372..6da0a2ac6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SourceMaskExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SourceMaskExtent.java @@ -41,8 +41,8 @@ public class SourceMaskExtent extends TemporalExtent { @Override public > boolean setBlock(BlockVector3 location, T block) throws WorldEditException { - set(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block); - return mask.test(location) && super.setBlock(location.getX(), location.getY(), location.getZ(), block); + set(location.x(), location.y(), location.z(), block); + return mask.test(location) && super.setBlock(location.x(), location.y(), location.z(), block); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TemporalExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TemporalExtent.java index ac36bef5a..ff0fa5106 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TemporalExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TemporalExtent.java @@ -44,7 +44,7 @@ public class TemporalExtent extends PassthroughExtent { @Override public BlockState getBlock(BlockVector3 position) { - if (position.getX() == x && position.getY() == y && position.getZ() == z) { + if (position.x() == x && position.y() == y && position.z() == z) { return block.toImmutableState(); } return super.getBlock(position); @@ -60,7 +60,7 @@ public class TemporalExtent extends PassthroughExtent { @Override public BaseBlock getFullBlock(BlockVector3 position) { - if (position.getX() == x && position.getY() == y && position.getZ() == z) { + if (position.x() == x && position.y() == y && position.z() == z) { if (block instanceof BaseBlock) { return (BaseBlock) block; } else { @@ -72,7 +72,7 @@ public class TemporalExtent extends PassthroughExtent { @Override public BiomeType getBiome(BlockVector3 position) { - if (position.getX() == bx && position.getZ() == bz) { + if (position.x() == bx && position.z() == bz) { return biome; } return super.getBiome(position); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TransformExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TransformExtent.java index 250227439..c424c0f8c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TransformExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TransformExtent.java @@ -55,13 +55,13 @@ public class TransformExtent extends BlockTransformExtent { if (min == null) { min = pos; } - mutable1.mutX(pos.getX() - min.getX()); - mutable1.mutY(pos.getY() - min.getY()); - mutable1.mutZ(pos.getZ() - min.getZ()); + mutable1.mutX(pos.x() - min.x()); + mutable1.mutY(pos.y() - min.y()); + mutable1.mutZ(pos.z() - min.z()); Vector3 tmp = getTransform().apply(mutable1); - mutable2.mutX(tmp.getX() + min.getX()); - mutable2.mutY(tmp.getY() + min.getY()); - mutable2.mutZ(tmp.getZ() + min.getZ()); + mutable2.mutX(tmp.x() + min.x()); + mutable2.mutY(tmp.y() + min.y()); + mutable2.mutZ(tmp.z() + min.z()); return mutable2; } @@ -69,20 +69,20 @@ public class TransformExtent extends BlockTransformExtent { if (min == null) { min = BlockVector3.at(x, y, z); } - mutable1.mutX(x - min.getX()); - mutable1.mutY(y - min.getY()); - mutable1.mutZ(z - min.getZ()); + mutable1.mutX(x - min.x()); + mutable1.mutY(y - min.y()); + mutable1.mutZ(z - min.z()); Vector3 tmp = getTransform().apply(mutable1); - mutable2.mutX(tmp.getX() + min.getX()); - mutable2.mutY(tmp.getY() + min.getY()); - mutable2.mutZ(tmp.getZ() + min.getZ()); + mutable2.mutX(tmp.x() + min.x()); + mutable2.mutY(tmp.y() + min.y()); + mutable2.mutZ(tmp.z() + min.z()); return tmp.toBlockPoint(); } @Override public BlockState getBlock(int x, int y, int z) { BlockVector3 p = getPos(x, y, z); - return transform(super.getBlock(p.getX(), p.getY(), p.getZ())); + return transform(super.getBlock(p.x(), p.y(), p.z())); } @Override @@ -93,7 +93,7 @@ public class TransformExtent extends BlockTransformExtent { @Override public BiomeType getBiomeType(int x, int y, int z) { BlockVector3 p = getPos(x, y, z); - return super.getBiomeType(p.getX(), y, p.getZ()); + return super.getBiomeType(p.x(), y, p.z()); } @Override @@ -114,7 +114,7 @@ public class TransformExtent extends BlockTransformExtent { @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { BlockVector3 p = getPos(x, y, z); - return super.setBiome(p.getX(), p.getY(), p.getZ(), biome); + return super.setBiome(p.x(), p.y(), p.z(), biome); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java index 1a30a0df8..6a306fc44 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java @@ -41,7 +41,7 @@ public class CPUOptimizedClipboard extends LinearClipboard { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - return setBiome(position.getX(), position.getY(), position.getZ(), biome); + return setBiome(position.x(), position.y(), position.z(), biome); } @Override @@ -92,7 +92,7 @@ public class CPUOptimizedClipboard extends LinearClipboard { @Override public BiomeType getBiome(BlockVector3 position) { - return getBiome(getBiomeIndex(position.getX(), position.getY(), position.getZ())); + return getBiome(getBiomeIndex(position.x(), position.y(), position.z())); } public void convertTilesToIndex() { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java index 76f22a194..f42cdbbff 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java @@ -359,7 +359,7 @@ public class DiskOptimizedClipboard extends LinearClipboard { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - return setBiome(position.getX(), position.getY(), position.getZ(), biome); + return setBiome(position.x(), position.y(), position.z(), biome); } @Override @@ -417,7 +417,7 @@ public class DiskOptimizedClipboard extends LinearClipboard { @Override public BiomeType getBiome(BlockVector3 position) { - return getBiome(getBiomeIndex(position.getX(), position.getY(), position.getZ())); + return getBiome(getBiomeIndex(position.x(), position.y(), position.z())); } public BlockArrayClipboard toClipboard() { @@ -438,9 +438,9 @@ public class DiskOptimizedClipboard extends LinearClipboard { super.setOrigin(origin); origin = origin.subtract(offset); try { - byteBuffer.putShort(10, (short) origin.getBlockX()); - byteBuffer.putShort(12, (short) origin.getBlockY()); - byteBuffer.putShort(14, (short) origin.getBlockZ()); + byteBuffer.putShort(10, (short) origin.x()); + byteBuffer.putShort(12, (short) origin.y()); + byteBuffer.putShort(14, (short) origin.z()); } catch (Throwable e) { e.printStackTrace(); } @@ -450,9 +450,9 @@ public class DiskOptimizedClipboard extends LinearClipboard { protected void setOffset(BlockVector3 offset) { super.setOffset(offset); try { - byteBuffer.putShort(16, (short) offset.getBlockX()); - byteBuffer.putShort(18, (short) offset.getBlockY()); - byteBuffer.putShort(20, (short) offset.getBlockZ()); + byteBuffer.putShort(16, (short) offset.x()); + byteBuffer.putShort(18, (short) offset.y()); + byteBuffer.putShort(20, (short) offset.z()); } catch (Throwable e) { e.printStackTrace(); } @@ -588,9 +588,9 @@ public class DiskOptimizedClipboard extends LinearClipboard { CompoundTag data = entity.getState().getNbtData(); HashMap value = new HashMap<>(data.getValue()); List pos = new ArrayList<>(3); - pos.add(new DoubleTag(entity.getLocation().getX())); - pos.add(new DoubleTag(entity.getLocation().getX())); - pos.add(new DoubleTag(entity.getLocation().getX())); + pos.add(new DoubleTag(entity.getLocation().x())); + pos.add(new DoubleTag(entity.getLocation().x())); + pos.add(new DoubleTag(entity.getLocation().x())); value.put("Pos", new ListTag(DoubleTag.class, pos)); nbtOS.writeTag(new CompoundTag(value)); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java index 449795e5d..6c7a910f2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java @@ -64,7 +64,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - return setBiome(position.getX(), position.getY(), position.getZ(), biome); + return setBiome(position.x(), position.y(), position.z(), biome); } @Override @@ -115,7 +115,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard { @Override public BiomeType getBiome(BlockVector3 position) { - return getBiome(getBiomeIndex(position.getX(), position.getY(), position.getZ())); + return getBiome(getBiomeIndex(position.x(), position.y(), position.z())); } private int getOrdinal(int index) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/SimpleClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/SimpleClipboard.java index c01abd787..f902f6007 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/SimpleClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/SimpleClipboard.java @@ -70,17 +70,17 @@ public abstract class SimpleClipboard implements Clipboard { @Override public final int getWidth() { - return size.getBlockX(); + return size.x(); } @Override public final int getHeight() { - return size.getBlockY(); + return size.y(); } @Override public final int getLength() { - return size.getBlockZ(); + return size.z(); } @Override 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 1f5404545..55a017604 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 @@ -85,7 +85,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard { @Override public BiomeType getBiome(BlockVector3 position) { - return getExtent().getBiomeType(position.getX(), position.getY(), position.getZ()); + return getExtent().getBiomeType(position.x(), position.y(), position.z()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicReader.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicReader.java index d884e0151..156e38544 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicReader.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicReader.java @@ -396,8 +396,8 @@ public class FastSchematicReader extends NBTSchematicReader { int locY = loc.getBlockY(); int locZ = loc.getBlockZ(); BlockVector3 max = min.add(dimensions).subtract(BlockVector3.ONE); - if (locX < min.getX() || locY < min.getY() || locZ < min.getZ() - || locX > max.getX() || locY > max.getY() || locZ > max.getZ()) { + if (locX < min.x() || locY < min.y() || locZ < min.z() + || locX > max.x() || locY > max.y() || locZ > max.z()) { for (Entity e : clipboard.getEntities()) { clipboard.removeEntity(e); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java index db3452d29..5218b1c1e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java @@ -114,15 +114,15 @@ public class FastSchematicWriter implements ClipboardWriter { // The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin' out.writeNamedTag("Offset", new int[]{ - min.getBlockX(), - min.getBlockY(), - min.getBlockZ(), + min.x(), + min.y(), + min.z(), }); out.writeLazyCompoundTag("Metadata", out1 -> { - out1.writeNamedTag("WEOffsetX", offset.getBlockX()); - out1.writeNamedTag("WEOffsetY", offset.getBlockY()); - out1.writeNamedTag("WEOffsetZ", offset.getBlockZ()); + out1.writeNamedTag("WEOffsetX", offset.x()); + out1.writeNamedTag("WEOffsetY", offset.y()); + out1.writeNamedTag("WEOffsetZ", offset.z()); out1.writeNamedTag("FAWEVersion", Fawe.instance().getVersion().build); }); @@ -162,9 +162,9 @@ public class FastSchematicWriter implements ClipboardWriter { // Dum. values.remove("id"); values.put("Pos", new IntArrayTag(new int[]{ - pos.getX(), - pos.getY(), - pos.getZ() + pos.x(), + pos.y(), + pos.z() })); numTiles++; @@ -282,10 +282,10 @@ public class FastSchematicWriter implements ClipboardWriter { int length = clipboard.getRegion().getLength(); MutableBlockVector3 mutable = new MutableBlockVector3(); for (int z = 0, i = 0; z < length; z++) { - int z0 = min.getBlockZ() + z; + int z0 = min.z() + z; for (int x = 0; x < width; x++, i++) { - int x0 = min.getBlockX() + x; - BiomeType biome = clipboard.getBiome(mutable.setComponents(x0, min.getY(), z0)); + int x0 = min.x() + x; + BiomeType biome = clipboard.getBiome(mutable.setComponents(x0, min.y(), z0)); task.applyInt(i, biome.getInternalId()); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java index 66deefeb7..d52d74b5a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java @@ -213,8 +213,8 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter { if (block.getBlockType() != BlockTypes.STRUCTURE_VOID) { int combined = block.getInternalId(); int index = indexes.get(combined); - List pos = Arrays.asList(point.getX() - min.getX(), - point.getY() - min.getY(), point.getZ() - min.getZ() + List pos = Arrays.asList(point.x() - min.x(), + point.y() - min.y(), point.z() - min.z() ); if (!block.hasNbtData()) { blocks.add(FaweCache.INSTANCE.asMap("state", index, "pos", pos)); @@ -231,7 +231,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter { ArrayList> entities = new ArrayList<>(); for (Entity entity : clipboard.getEntities()) { Location loc = entity.getLocation(); - List pos = Arrays.asList(loc.getX(), loc.getY(), loc.getZ()); + List pos = Arrays.asList(loc.x(), loc.y(), loc.z()); List blockPos = Arrays.asList(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); BaseEntity state = entity.getState(); if (state != null) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/PNGWriter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/PNGWriter.java index b5cbc7fb2..48a3315d5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/PNGWriter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/PNGWriter.java @@ -75,9 +75,9 @@ public class PNGWriter implements ClipboardWriter { MutableBlockVector3 mutableLeft = new MutableBlockVector3(0, 0, 0); BlockVector3 min = clipboard.getMinimumPoint(); - int y0 = min.getBlockY(); - int z0 = min.getBlockZ(); - int x0 = min.getBlockX(); + int y0 = min.y(); + int z0 = min.z(); + int x0 = min.x(); for (int x = x0; x < x0 + width; x++) { mutable.mutX(x); mutableTop.mutX(x); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ArrayImageMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ArrayImageMask.java index 4976af5f7..07c9acac1 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ArrayImageMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ArrayImageMask.java @@ -20,7 +20,7 @@ public class ArrayImageMask implements FilterBlockMask { @Override public boolean applyBlock(FilterBlock block) { - int height = image.getRGB(block.getX(), block.getZ()) & 0xFF; + int height = image.getRGB(block.x(), block.z()) & 0xFF; return height == 255 || height > 0 && !white && random.nextInt(256) <= height; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractFilterBlock.java index b91ef08b0..4f3db3994 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractFilterBlock.java @@ -31,18 +31,18 @@ public abstract class AbstractFilterBlock extends FilterBlock { public abstract Extent getExtent(); @Override - public int getX() { - return getPosition().getX(); + public int x() { + return getPosition().x(); } @Override - public int getY() { - return getPosition().getY(); + public int y() { + return getPosition().y(); } @Override - public int getZ() { - return getPosition().getZ(); + public int z() { + return getPosition().z(); } @Override @@ -72,12 +72,12 @@ public abstract class AbstractFilterBlock extends FilterBlock { @Override public BlockVector3 getMinimumPoint() { - return at(getX(), getY(), getZ()); + return at(x(), y(), z()); } @Override public BlockVector3 getMaximumPoint() { - return at(getX(), getY(), getZ()); + return at(x(), y(), z()); } @Override @@ -88,7 +88,7 @@ public abstract class AbstractFilterBlock extends FilterBlock { @Override public > boolean setBlock(int x, int y, int z, T block) throws WorldEditException { - if (x == this.getX() && y == this.getY() && z == this.getZ()) { + if (x == this.x() && y == this.y() && z == this.z()) { setFullBlock(block.toBaseBlock()); return true; } @@ -97,7 +97,7 @@ public abstract class AbstractFilterBlock extends FilterBlock { @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { - if (x == this.getX() && y == this.getY() && z == this.getZ()) { + if (x == this.x() && y == this.y() && z == this.z()) { setBiome(biome); return true; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractSingleFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractSingleFilterBlock.java index 95e50dc76..5d64ead7c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractSingleFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractSingleFilterBlock.java @@ -83,18 +83,18 @@ public abstract class AbstractSingleFilterBlock extends FilterBlock { @Override public BlockVector3 getMinimumPoint() { - return at(getX(), getY(), getZ()); + return at(x(), y(), z()); } @Override public BlockVector3 getMaximumPoint() { - return at(getX(), getY(), getZ()); + return at(x(), y(), z()); } @Override public > boolean setBlock(int x, int y, int z, T block) throws WorldEditException { - if (x == this.getX() && y == this.getY() && z == this.getZ()) { + if (x == this.x() && y == this.y() && z == this.z()) { setFullBlock(block.toBaseBlock()); return true; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ArrayFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ArrayFilterBlock.java index 4f73d5fa3..362f869ac 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ArrayFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ArrayFilterBlock.java @@ -80,17 +80,17 @@ public class ArrayFilterBlock extends AbstractExtentFilterBlock { } @Override - public int getX() { + public int x() { return x; } @Override - public int getY() { + public int y() { return (heights[index] & 0xFF) + yOffset; } @Override - public int getZ() { + public int z() { return z; } @@ -112,12 +112,12 @@ public class ArrayFilterBlock extends AbstractExtentFilterBlock { @Override public void setBiome(final BiomeType biome) { - getExtent().setBiome(getX(), getY(), getZ(), biome); + getExtent().setBiome(x(), y(), z(), biome); } @Override public BiomeType getBiome() { - return getExtent().getBiomeType(getX(), getY(), getZ()); + return getExtent().getBiomeType(x(), y(), z()); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java index 9a339826a..579f04a9a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java @@ -190,17 +190,17 @@ public class CharFilterBlock extends ChunkFilterBlock { } @Override - public final int getX() { + public final int x() { return xx + x; } @Override - public final int getY() { + public final int y() { return yy + y; } @Override - public final int getZ() { + public final int z() { return zz + z; } @@ -304,7 +304,7 @@ public class CharFilterBlock extends ChunkFilterBlock { if (z > 0) { return states[getArr[index - 16]]; } - return getExtent().getBlock(getX(), getY(), getZ() - 1); + return getExtent().getBlock(x(), y(), z() - 1); } @Override @@ -312,7 +312,7 @@ public class CharFilterBlock extends ChunkFilterBlock { if (x < 15) { return states[getArr[index + 1]]; } - return getExtent().getBlock(getX() + 1, getY(), getZ()); + return getExtent().getBlock(x() + 1, y(), z()); } @Override @@ -320,7 +320,7 @@ public class CharFilterBlock extends ChunkFilterBlock { if (z < 15) { return states[getArr[index + 16]]; } - return getExtent().getBlock(getX(), getY(), getZ() + 1); + return getExtent().getBlock(x(), y(), z() + 1); } @Override @@ -328,7 +328,7 @@ public class CharFilterBlock extends ChunkFilterBlock { if (x > 0) { return states[getArr[index - 1]]; } - return getExtent().getBlock(getX() - 1, getY(), getZ()); + return getExtent().getBlock(x() - 1, y(), z()); } @Override @@ -401,7 +401,7 @@ public class CharFilterBlock extends ChunkFilterBlock { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - return setBiome(position.getX(), position.getY(), position.getBlockZ(), biome); + return setBiome(position.x(), position.y(), position.z(), biome); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/FilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/FilterBlock.java index c27d3770a..3565c696f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/FilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/FilterBlock.java @@ -73,60 +73,60 @@ public abstract class FilterBlock extends BlockVector3 implements Extent, TileEn } public BlockState getBlockBelow() { - return getBlock(getX(), getY() - 1, getZ()); + return getBlock(x(), y() - 1, z()); } public BlockState getBlockAbove() { - return getBlock(getX(), getY() + 1, getZ()); + return getBlock(x(), y() + 1, z()); } public BlockState getBlockNorth() { - return getBlock(getX(), getY(), getZ() - 1); + return getBlock(x(), y(), z() - 1); } public BlockState getBlockEast() { - return getBlock(getX() + 1, getY(), getZ()); + return getBlock(x() + 1, y(), z()); } public BlockState getBlockSouth() { - return getBlock(getX(), getY(), getZ() + 1); + return getBlock(x(), y(), z() + 1); } public BlockState getBlockWest() { - return getBlock(getX() - 1, getY(), getZ()); + return getBlock(x() - 1, y(), z()); } public BlockState getBlockRelativeY(int y) { - return getBlock(getX(), getY() + y, getZ()); + return getBlock(x(), y() + y, z()); } @Override - public abstract int getX(); + public abstract int x(); @Override - public abstract int getY(); + public abstract int y(); @Override - public abstract int getZ(); + public abstract int z(); public int getLocalX() { - return getX() & 15; + return x() & 15; } public int getLocalY() { - return getY() & 15; + return y() & 15; } public int getLocalZ() { - return getZ() & 15; + return z() & 15; } public int getChunkX() { - return getX() >> 4; + return x() >> 4; } public int getChunkZ() { - return getZ() >> 4; + return z() >> 4; } /* @@ -204,7 +204,7 @@ public abstract class FilterBlock extends BlockVector3 implements Extent, TileEn @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - return setBiome(position.getX(), position.getY(), position.getZ(), biome); + return setBiome(position.x(), position.y(), position.z(), biome); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/SingleFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/SingleFilterBlock.java index 5516ae3bb..83301c4ea 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/SingleFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/SingleFilterBlock.java @@ -17,17 +17,17 @@ public class SingleFilterBlock extends AbstractSingleFilterBlock { } @Override - public int getX() { + public int x() { return x; } @Override - public int getY() { + public int y() { return y; } @Override - public int getZ() { + public int z() { return z; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java index 58baf8633..693356a7a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java @@ -30,9 +30,9 @@ public class EntityInBlockRemovingProcessor implements IBatchProcessor { continue; } BlockVector3 pos = tag.getEntityPosition().toBlockPoint(); - int x = pos.getX() & 15; - int y = pos.getY(); - int z = pos.getZ() & 15; + int x = pos.x() & 15; + int y = pos.y(); + int z = pos.z() & 15; if (!set.hasSection(y >> 4)) { continue; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NMSRelighter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NMSRelighter.java index e38df12f5..dbe717e49 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NMSRelighter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NMSRelighter.java @@ -273,9 +273,9 @@ public class NMSRelighter implements Relighter { int lightLevel = (int) val[1]; this.computeRemoveBlockLight( - node.getX() - 1, - node.getY(), - node.getZ(), + node.x() - 1, + node.y(), + node.z(), lightLevel, lightRemovalQueue, lightPropagationQueue, @@ -283,20 +283,20 @@ public class NMSRelighter implements Relighter { visited ); this.computeRemoveBlockLight( - node.getX() + 1, - node.getY(), - node.getZ(), + node.x() + 1, + node.y(), + node.z(), lightLevel, lightRemovalQueue, lightPropagationQueue, removalVisited, visited ); - if (node.getY() > minY) { + if (node.y() > minY) { this.computeRemoveBlockLight( - node.getX(), - node.getY() - 1, - node.getZ(), + node.x(), + node.y() - 1, + node.z(), lightLevel, lightRemovalQueue, lightPropagationQueue, @@ -304,11 +304,11 @@ public class NMSRelighter implements Relighter { visited ); } - if (node.getY() < maxY) { + if (node.y() < maxY) { this.computeRemoveBlockLight( - node.getX(), - node.getY() + 1, - node.getZ(), + node.x(), + node.y() + 1, + node.z(), lightLevel, lightRemovalQueue, lightPropagationQueue, @@ -317,9 +317,9 @@ public class NMSRelighter implements Relighter { ); } this.computeRemoveBlockLight( - node.getX(), - node.getY(), - node.getZ() - 1, + node.x(), + node.y(), + node.z() - 1, lightLevel, lightRemovalQueue, lightPropagationQueue, @@ -327,9 +327,9 @@ public class NMSRelighter implements Relighter { visited ); this.computeRemoveBlockLight( - node.getX(), - node.getY(), - node.getZ() + 1, + node.x(), + node.y(), + node.z() + 1, lightLevel, lightRemovalQueue, lightPropagationQueue, @@ -340,27 +340,27 @@ public class NMSRelighter implements Relighter { while (!lightPropagationQueue.isEmpty()) { MutableBlockVector3 node = lightPropagationQueue.poll(); - ChunkHolder iChunk = (ChunkHolder) queue.getOrCreateChunk(node.getX() >> 4, node.getZ() >> 4); + ChunkHolder iChunk = (ChunkHolder) queue.getOrCreateChunk(node.x() >> 4, node.z() >> 4); if (!iChunk.isInit()) { - iChunk.init(queue, node.getX() >> 4, node.getZ() >> 4); + iChunk.init(queue, node.x() >> 4, node.z() >> 4); } - int lightLevel = iChunk.getEmittedLight(node.getX() & 15, node.getY(), node.getZ() & 15); - BlockState state = this.queue.getBlock(node.getX(), node.getY(), node.getZ()); + int lightLevel = iChunk.getEmittedLight(node.x() & 15, node.y(), node.z() & 15); + BlockState state = this.queue.getBlock(node.x(), node.y(), node.z()); String id = state.getBlockType().getId().toLowerCase(Locale.ROOT); if (lightLevel <= 1) { continue; } if (id.contains("slab")) { boolean top = state.getState(slabHalf).equalsIgnoreCase("top"); - computeSlab(node.getX(), node.getY(), node.getZ(), lightLevel, lightPropagationQueue, visited, top); + computeSlab(node.x(), node.y(), node.z(), lightLevel, lightPropagationQueue, visited, top); } else if (id.contains("stair")) { boolean top = state.getState(stairHalf).equalsIgnoreCase("top"); Direction direction = getStairDir(state); String shape = getStairShape(state); computeStair( - node.getX(), - node.getY(), - node.getZ(), + node.x(), + node.y(), + node.z(), lightLevel, lightPropagationQueue, visited, @@ -369,7 +369,7 @@ public class NMSRelighter implements Relighter { shape ); } else { - computeNormal(node.getX(), node.getY(), node.getZ(), lightLevel, lightPropagationQueue, visited); + computeNormal(node.x(), node.y(), node.z(), lightLevel, lightPropagationQueue, visited); } } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/OffsetTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/OffsetTransform.java index a8ade6df1..c2536deca 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/OffsetTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/OffsetTransform.java @@ -30,9 +30,9 @@ public class OffsetTransform extends ResettableExtent { @Override public boolean setBiome(BlockVector3 location, BiomeType biome) { - int x = location.getX() + dx; - int y = location.getX() + dy; - int z = location.getX() + dz; + int x = location.x() + dx; + int y = location.x() + dy; + int z = location.x() + dz; if (!getExtent().contains(x, y, z)) { return false; } @@ -53,9 +53,9 @@ public class OffsetTransform extends ResettableExtent { @Override public > boolean setBlock(BlockVector3 location, T block) throws WorldEditException { - int x = location.getX() + dx; - int y = location.getX() + dy; - int z = location.getX() + dz; + int x = location.x() + dx; + int y = location.x() + dy; + int z = location.x() + dz; if (!getExtent().contains(x, y, z)) { return false; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/RandomOffsetTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/RandomOffsetTransform.java index 268255bf2..4ad3189c7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/RandomOffsetTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/RandomOffsetTransform.java @@ -34,9 +34,9 @@ public class RandomOffsetTransform extends ResettableExtent { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - int x = position.getBlockX() + random.nextInt(1 + (dx << 1)) - dx; - int y = position.getBlockY() + random.nextInt(1 + (dy << 1)) - dy; - int z = position.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz; + int x = position.x() + random.nextInt(1 + (dx << 1)) - dx; + int y = position.y() + random.nextInt(1 + (dy << 1)) - dy; + int z = position.z() + random.nextInt(1 + (dz << 1)) - dz; if (!getExtent().contains(x, y, z)) { return false; } @@ -57,9 +57,9 @@ public class RandomOffsetTransform extends ResettableExtent { @Override public > boolean setBlock(BlockVector3 pos, T block) throws WorldEditException { - int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx; - int y = pos.getBlockY() + random.nextInt(1 + (dy << 1)) - dy; - int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz; + int x = pos.x() + random.nextInt(1 + (dx << 1)) - dx; + int y = pos.y() + random.nextInt(1 + (dy << 1)) - dy; + int z = pos.z() + random.nextInt(1 + (dz << 1)) - dz; if (!getExtent().contains(x, y, z)) { return false; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/ScaleTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/ScaleTransform.java index 29af87055..c81d123df 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/ScaleTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/ScaleTransform.java @@ -55,9 +55,9 @@ public class ScaleTransform extends ResettableExtent { if (min == null) { min = pos; } - mutable.mutX(min.getX() + (pos.getX() - min.getX()) * dx); - mutable.mutY(min.getY() + (pos.getY() - min.getY()) * dy); - mutable.mutZ(min.getZ() + (pos.getZ() - min.getZ()) * dz); + mutable.mutX(min.x() + (pos.x() - min.x()) * dx); + mutable.mutY(min.y() + (pos.y() - min.y()) * dy); + mutable.mutZ(min.z() + (pos.z() - min.z()) * dz); return new MutableVector3(mutable); } @@ -65,9 +65,9 @@ public class ScaleTransform extends ResettableExtent { if (min == null) { min = BlockVector3.at(x, y, z); } - mutable.mutX(min.getX() + (x - min.getX()) * dx); - mutable.mutY(min.getY() + (y - min.getY()) * dy); - mutable.mutZ(min.getZ() + (z - min.getZ()) * dz); + mutable.mutX(min.x() + (x - min.x()) * dx); + mutable.mutY(min.y() + (y - min.y()) * dy); + mutable.mutZ(min.z() + (z - min.z()) * dz); return new MutableVector3(mutable); } @@ -77,15 +77,15 @@ public class ScaleTransform extends ResettableExtent { boolean result = false; MutableVector3 vector3 = getPos(location); MutableBlockVector3 pos = new MutableBlockVector3(); - double sx = vector3.getX(); - double sy = vector3.getY(); - double sz = vector3.getZ(); + double sx = vector3.x(); + double sy = vector3.y(); + double sz = vector3.z(); double ex = sx + dx; double ey = Math.max(minY, Math.min(maxy, sy + dy)); double ez = sz + dz; - for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) { - for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) { - for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) { + for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) { + for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) { + for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) { if (!getExtent().contains(pos)) { continue; } @@ -101,15 +101,15 @@ public class ScaleTransform extends ResettableExtent { boolean result = false; MutableVector3 vector3 = getPos(position); MutableBlockVector3 pos = new MutableBlockVector3(); - double sx = vector3.getX(); - double sy = vector3.getY(); - double sz = vector3.getZ(); + double sx = vector3.x(); + double sy = vector3.y(); + double sz = vector3.z(); double ex = sx + dx; double ey = Math.max(minY, Math.min(maxy, sy + dy)); double ez = sz + dz; - for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) { - for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) { - for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) { + for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) { + for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) { + for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) { if (!getExtent().contains(pos)) { continue; } @@ -126,15 +126,15 @@ public class ScaleTransform extends ResettableExtent { boolean result = false; MutableVector3 vector3 = getPos(x1, y1, z1); MutableBlockVector3 pos = new MutableBlockVector3(); - double sx = vector3.getX(); - double sy = vector3.getY(); - double sz = vector3.getZ(); - double ex = vector3.getX() + dx; + double sx = vector3.x(); + double sy = vector3.y(); + double sz = vector3.z(); + double ex = vector3.x() + dx; double ey = Math.min(maxy, sy + dy); - double ez = vector3.getZ() + dz; - for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) { - for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) { - for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) { + double ez = vector3.z() + dz; + for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) { + for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) { + for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) { if (!getExtent().contains(pos)) { continue; } @@ -150,15 +150,15 @@ public class ScaleTransform extends ResettableExtent { boolean result = false; MutableVector3 vector3 = getPos(x1, y1, z1); MutableBlockVector3 pos = new MutableBlockVector3(); - double sx = vector3.getX(); - double sy = vector3.getY(); - double sz = vector3.getZ(); + double sx = vector3.x(); + double sy = vector3.y(); + double sz = vector3.z(); double ex = sx + dx; double ey = Math.max(minY, Math.min(maxy, sy + dy)); double ez = sz + dz; - for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) { - for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) { - for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) { + for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) { + for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) { + for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) { if (!getExtent().contains(pos)) { continue; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/SelectTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/SelectTransform.java index 57f77b2fe..b3be0a43a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/SelectTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/SelectTransform.java @@ -27,11 +27,11 @@ public abstract class SelectTransform extends ResettableExtent { public abstract AbstractDelegateExtent getExtent(int x, int z); public Extent getExtent(BlockVector3 pos) { - return getExtent(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()); + return getExtent(pos.x(), pos.y(), pos.z()); } public Extent getExtent(BlockVector2 pos) { - return getExtent(pos.getBlockX(), pos.getBlockZ()); + return getExtent(pos.x(), pos.z()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/SurfaceRegionFunction.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/SurfaceRegionFunction.java index 5f946c933..a6b9ace56 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/SurfaceRegionFunction.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/SurfaceRegionFunction.java @@ -26,8 +26,8 @@ public class SurfaceRegionFunction implements FlatRegionFunction { @Override public boolean apply(BlockVector2 position) throws WorldEditException { - int x = position.getBlockX(); - int z = position.getBlockZ(); + int x = position.x(); + int z = position.z(); int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false); if (layer != -1) { lastY = layer; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/BiomeCopy.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/BiomeCopy.java index 3926c19a6..457fff477 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/BiomeCopy.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/BiomeCopy.java @@ -21,11 +21,11 @@ public class BiomeCopy implements RegionFunction { @Override public boolean apply(BlockVector3 position) throws WorldEditException { - int x = position.getBlockX(); - int y = position.getBlockY(); - int z = position.getBlockZ(); - if (x != mutableVector.getBlockX() || z != mutableVector.getBlockZ() || y != mutableVector - .getBlockY()) { + int x = position.x(); + int y = position.y(); + int z = position.z(); + if (x != mutableVector.x() || z != mutableVector.z() || y != mutableVector + .y()) { mutableVector.setComponents(x, y, z); return destination.setBiome(mutableVector, source.getBiome(mutableVector)); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/CavesGen.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/CavesGen.java index 28bfa0a4c..b9a403f27 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/CavesGen.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/CavesGen.java @@ -72,8 +72,8 @@ public class CavesGen extends GenBase { int maxAngle, double paramDouble4 ) throws WorldEditException { - int bx = chunkPos.getBlockX() << 4; - int bz = chunkPos.getBlockZ() << 4; + int bx = chunkPos.x() << 4; + int bz = chunkPos.z() << 4; double real_x = bx + 7; double real_z = bz + 7; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/GenBase.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/GenBase.java index af1a4e66e..f0637d127 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/GenBase.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/GenBase.java @@ -26,8 +26,8 @@ public abstract class GenBase { public void generate(BlockVector2 chunkPos, Extent chunk) throws WorldEditException { int i = this.checkAreaSize; - int chunkX = chunkPos.getBlockX(); - int chunkZ = chunkPos.getBlockZ(); + int chunkX = chunkPos.x(); + int chunkZ = chunkPos.z(); for (int x = chunkX - i; x <= chunkX + i; x++) { for (int z = chunkZ - i; z <= chunkZ + i; z++) { generateChunk(x, z, chunkPos, chunk); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/SchemGen.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/SchemGen.java index 1ced63f19..250914c05 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/SchemGen.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/SchemGen.java @@ -36,7 +36,7 @@ public class SchemGen implements Resource { int y = extent.getNearestSurfaceTerrainBlock( x, z, - mutable.getBlockY(), + mutable.y(), this.extent.getMinY(), this.extent.getMaxY(), Integer.MIN_VALUE, diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAnyMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAnyMask.java index 39bb0c41d..956daf67d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAnyMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAnyMask.java @@ -44,9 +44,9 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask { } public BlockVector3 direction(BlockVector3 v) { - int x = v.getBlockX(); - int y = v.getBlockY(); - int z = v.getBlockZ(); + int x = v.x(); + int y = v.y(); + int z = v.z(); if (mask.test(mutable.setComponents(x + 1, y, z))) { return mutable.setComponents(1, 0, 0); } else if (mask.test(mutable.setComponents(x - 1, y, z))) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentMask.java index 23065ea7b..981492e0e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentMask.java @@ -22,9 +22,9 @@ public class AdjacentMask extends AbstractMask { @Override public boolean test(BlockVector3 bv) { vector.setComponents(bv); - double x = bv.getX(); - double y = bv.getY(); - double z = bv.getZ(); + double x = bv.x(); + double y = bv.y(); + double z = bv.z(); vector.mutX(x + 1); int count = 0; if (mask.test(vector) && ++count == min && max >= 8) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java index 52de762ae..01cf15708 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java @@ -127,9 +127,9 @@ public class AngleMask extends AbstractExtentMask implements ResettableMask { } private boolean adjacentAir(Extent extent, MutableBlockVector3 mutable) { - int x = mutable.getBlockX(); - int y = mutable.getBlockY(); - int z = mutable.getBlockZ(); + int x = mutable.x(); + int y = mutable.y(); + int z = mutable.z(); if (!mask.test(extent, mutable.setComponents(x + 1, y, z))) { return true; } @@ -154,23 +154,23 @@ public class AngleMask extends AbstractExtentMask implements ResettableMask { if (!mask.test(vector)) { return false; } - int y = vector.getBlockY(); + int y = vector.y(); if (overlay) { MutableBlockVector3 mutable = new MutableBlockVector3(vector); if (y < maxY && !adjacentAir(null, mutable)) { return false; } } - int x = vector.getBlockX(); - int z = vector.getBlockZ(); + int x = vector.x(); + int z = vector.z(); return testSlope(getExtent(), x, y, z); } @Override public boolean test(final Extent extent, final BlockVector3 vector) { - int x = vector.getBlockX(); - int y = vector.getBlockY(); - int z = vector.getBlockZ(); + int x = vector.x(); + int y = vector.y(); + int z = vector.z(); if ((lastX == (lastX = x) & lastZ == (lastZ = z))) { int height = getHeight(extent, x, y, z); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/CachedMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/CachedMask.java index 27e4b9961..5bb757eb2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/CachedMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/CachedMask.java @@ -60,9 +60,9 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask { @Override public boolean test(BlockVector3 vector) { - int x = vector.getX(); - int y = vector.getY(); - int z = vector.getZ(); + int x = vector.x(); + int y = vector.y(); + int z = vector.z(); try { boolean check = cache_checked.add(x, y, z); if (!check) { @@ -88,9 +88,9 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask { if (!hasExtent || !(extent instanceof AbstractExtentMask)) { return test(vector); } - int x = vector.getX(); - int y = vector.getY(); - int z = vector.getZ(); + int x = vector.x(); + int y = vector.y(); + int z = vector.z(); AbstractExtentMask mask = (AbstractExtentMask) getMask(); try { boolean check = cache_checked.add(x, y, z); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ImageBrushMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ImageBrushMask.java index ec31337de..d8ff64a76 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ImageBrushMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ImageBrushMask.java @@ -62,17 +62,17 @@ public class ImageBrushMask extends AbstractExtentMask { @Override public boolean test(BlockVector3 vector) { if (solid.test(vector)) { - int dx = vector.getBlockX() - center.getBlockX(); - int dy = vector.getBlockY() - center.getBlockY(); - int dz = vector.getBlockZ() - center.getBlockZ(); + int dx = vector.x() - center.x(); + int dy = vector.y() - center.y(); + int dz = vector.z() - center.z(); Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5)); - int x1 = (int) (pos1.getX() * scale + centerImageX); - int z1 = (int) (pos1.getZ() * scale + centerImageZ); + int x1 = (int) (pos1.x() * scale + centerImageX); + int z1 = (int) (pos1.z() * scale + centerImageZ); Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5)); - int x2 = (int) (pos2.getX() * scale + centerImageX); - int z2 = (int) (pos2.getZ() * scale + centerImageZ); + int x2 = (int) (pos2.x() * scale + centerImageX); + int z2 = (int) (pos2.z() * scale + centerImageZ); if (x2 < x1) { int tmp = x1; x1 = x2; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LayerBrushMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LayerBrushMask.java index 825039ed0..7f30ab64a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LayerBrushMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LayerBrushMask.java @@ -40,20 +40,20 @@ public class LayerBrushMask extends AbstractExtentMask { BlockState previous2 = layers[depth - 2]; for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) { mutable.setComponents( - pos.getBlockX() + dir.getBlockX(), - pos.getBlockY() + dir.getBlockY(), - pos.getBlockZ() + dir.getBlockZ() + pos.x() + dir.x(), + pos.y() + dir.y(), + pos.z() + dir.z() ); if (visitor.isVisited(mutable) && editSession.getBlock( - mutable.getBlockX(), - mutable.getBlockY(), - mutable.getBlockZ() + mutable.x(), + mutable.y(), + mutable.z() ) == previous) { - mutable.setComponents(pos.getBlockX() + dir.getBlockX() * 2, pos.getBlockY() + dir.getBlockY() * 2, - pos.getBlockZ() + dir.getBlockZ() * 2 + mutable.setComponents(pos.x() + dir.x() * 2, pos.y() + dir.y() * 2, + pos.z() + dir.z() * 2 ); if (visitor.isVisited(mutable) - && editSession.getBlock(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) { + && editSession.getBlock(mutable.x(), mutable.y(), mutable.z()) == previous2) { found = true; break; } else { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/PlaneMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/PlaneMask.java index 6b8b1e4a1..5de393940 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/PlaneMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/PlaneMask.java @@ -15,9 +15,9 @@ public class PlaneMask extends AbstractMask implements ResettableMask { public boolean test(BlockVector3 vector) { switch (mode) { case -1: - originX = vector.getBlockX(); - originY = vector.getBlockY(); - originZ = vector.getBlockZ(); + originX = vector.x(); + originY = vector.y(); + originZ = vector.z(); mode = 0; return true; case 0: @@ -25,13 +25,13 @@ public class PlaneMask extends AbstractMask implements ResettableMask { case 2: case 4: int original = mode; - if (originX != vector.getBlockX()) { + if (originX != vector.x()) { mode &= 1; } - if (originY != vector.getBlockY()) { + if (originY != vector.y()) { mode &= 2; } - if (originZ != vector.getBlockZ()) { + if (originZ != vector.z()) { mode &= 4; } if (Integer.bitCount(mode) >= 3) { @@ -39,13 +39,13 @@ public class PlaneMask extends AbstractMask implements ResettableMask { return false; } default: - if (originX != vector.getBlockX() && (mode & 1) == 0) { + if (originX != vector.x() && (mode & 1) == 0) { return false; } - if (originZ != vector.getBlockZ() && (mode & 4) == 0) { + if (originZ != vector.z() && (mode & 4) == 0) { return false; } - return originY == vector.getBlockY() || (mode & 2) != 0; + return originY == vector.y() || (mode & 2) != 0; } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RadiusMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RadiusMask.java index b99e56ddc..c8893ae79 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RadiusMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RadiusMask.java @@ -30,17 +30,17 @@ public class RadiusMask extends AbstractMask implements ResettableMask { if (pos == null) { pos = to.toImmutable(); } - int dx = pos.getBlockX() - to.getBlockX(); + int dx = pos.x() - to.x(); int d = dx * dx; if (d > maxSqr) { return false; } - int dz = pos.getBlockZ() - to.getBlockZ(); + int dz = pos.z() - to.z(); d += dz * dz; if (d > maxSqr) { return false; } - int dy = pos.getBlockY() - to.getBlockY(); + int dy = pos.y() - to.y(); d += dy * dy; return d >= minSqr && d <= maxSqr; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SimplexMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SimplexMask.java index d337cd61a..a56238918 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SimplexMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SimplexMask.java @@ -19,7 +19,7 @@ public class SimplexMask extends AbstractMask { @Override public boolean test(BlockVector3 vector) { - double value = SimplexNoise.noise(vector.getBlockX() * scale, vector.getBlockY() * scale, vector.getBlockZ() * scale); + double value = SimplexNoise.noise(vector.x() * scale, vector.y() * scale, vector.z() * scale); return value >= min && value <= max; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/StencilBrushMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/StencilBrushMask.java index 3100f6a9e..25ee249d8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/StencilBrushMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/StencilBrushMask.java @@ -64,13 +64,13 @@ public class StencilBrushMask extends AbstractExtentMask { @Override public boolean test(BlockVector3 vector) { if (solid.test(vector)) { - int dx = vector.getBlockX() - center.getBlockX(); - int dy = vector.getBlockY() - center.getBlockY(); - int dz = vector.getBlockZ() - center.getBlockZ(); + int dx = vector.x() - center.x(); + int dy = vector.y() - center.y(); + int dz = vector.z() - center.z(); Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz)); - dx = MathMan.roundInt(srcPos.getX()); - dz = MathMan.roundInt(srcPos.getZ()); + dx = MathMan.roundInt(srcPos.x()); + dz = MathMan.roundInt(srcPos.z()); int distance = dx * dx + dz * dz; if (distance > size2 || Math.abs(dx) > 256 || Math.abs(dz) > 256) { @@ -83,7 +83,7 @@ public class StencilBrushMask extends AbstractExtentMask { return true; } if (val >= 255 || ThreadLocalRandom.current().nextInt(maxY) < val) { - editSession.setBlock(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), pattern); + editSession.setBlock(vector.x(), vector.y(), vector.z(), pattern); } return true; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SurfaceAngleMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SurfaceAngleMask.java index ce42a2d7e..15b347dbc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SurfaceAngleMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SurfaceAngleMask.java @@ -24,7 +24,7 @@ public class SurfaceAngleMask extends AbstractExtentMask { @Override public boolean test(BlockVector3 vector) { if (!vector.getBlock(getExtent()).isAir() && nextToAir(vector)) { - double angle = 1 - getAverageAirDirection(vector.toVector3(), size).getY(); + double angle = 1 - getAverageAirDirection(vector.toVector3(), size).y(); return (angle >= (min / 90.0) && angle <= (max / 90.0)); } return false; @@ -33,7 +33,7 @@ public class SurfaceAngleMask extends AbstractExtentMask { @Override public boolean test(Extent extent, BlockVector3 vector) { if (!vector.getBlock(getExtent()).isAir() && nextToAir(vector)) { - double angle = 1 - getAverageAirDirection(vector.toVector3(), size).getY(); + double angle = 1 - getAverageAirDirection(vector.toVector3(), size).y(); return (angle >= (min / 90.0) && angle <= (max / 90.0)); } return false; @@ -44,7 +44,7 @@ public class SurfaceAngleMask extends AbstractExtentMask { for (int i = -size; i <= size; i++) { for (int j = -size; j <= size; j++) { for (int k = -size; k <= size; k++) { - Vector3 block = Vector3.at(currentLocation.getX(), currentLocation.getY(), currentLocation.getZ()).add( + Vector3 block = Vector3.at(currentLocation.x(), currentLocation.y(), currentLocation.z()).add( 0.5, 0.5, 0.5 @@ -65,13 +65,13 @@ public class SurfaceAngleMask extends AbstractExtentMask { double y = 0.0; double z = 0.0; for (Vector3 vector3 : airDirections) { - x += vector3.getX(); - y += vector3.getY(); - z += vector3.getZ(); + x += vector3.x(); + y += vector3.y(); + z += vector3.z(); } Vector3 averageAirDirection = Vector3.at(x / airDirections.size(), y / airDirections.size(), z / airDirections.size()); - return (Double.isNaN(averageAirDirection.getY()) ? Vector3.ZERO : averageAirDirection.normalize()); + return (Double.isNaN(averageAirDirection.y()) ? Vector3.ZERO : averageAirDirection.normalize()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMakeMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMakeMask.java index 4246f8a82..9d7b7a729 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMakeMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMakeMask.java @@ -14,8 +14,8 @@ public class WallMakeMask implements Mask { @Override public boolean test(BlockVector3 position) { - int x = position.getBlockX(); - int z = position.getBlockZ(); + int x = position.x(); + int z = position.z(); return !region.contains(x, z + 1) || !region.contains(x, z - 1) || !region.contains(x + 1, z) || !region.contains( x - 1, z diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMask.java index 40a323e51..eee5ab286 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMask.java @@ -23,9 +23,9 @@ public class WallMask extends AbstractMask { public boolean test(BlockVector3 bv) { vector.setComponents(bv); int count = 0; - double x = vector.getX(); - double y = vector.getY(); - double z = vector.getZ(); + double x = vector.x(); + double y = vector.y(); + double z = vector.z(); vector.mutX(x + 1); if (mask.test(vector) && ++count == min && max >= 8) { vector.mutX(x); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/XAxisMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/XAxisMask.java index 7531d1465..82c0eca02 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/XAxisMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/XAxisMask.java @@ -16,9 +16,9 @@ public class XAxisMask extends AbstractMask implements ResettableMask { @Override public boolean test(BlockVector3 vector) { if (layer == -1) { - layer = vector.getBlockX(); + layer = vector.x(); } - return vector.getBlockX() == layer; + return vector.x() == layer; } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/YAxisMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/YAxisMask.java index ee852e70e..15ee08192 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/YAxisMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/YAxisMask.java @@ -14,9 +14,9 @@ public class YAxisMask extends AbstractMask implements ResettableMask { @Override public boolean test(BlockVector3 vector) { if (layer == -1) { - layer = vector.getBlockY(); + layer = vector.y(); } - return vector.getBlockY() == layer; + return vector.y() == layer; } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ZAxisMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ZAxisMask.java index 269fc5dd8..648b712d2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ZAxisMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ZAxisMask.java @@ -14,9 +14,9 @@ public class ZAxisMask extends AbstractMask implements ResettableMask { @Override public boolean test(BlockVector3 vector) { if (layer == -1) { - layer = vector.getBlockZ(); + layer = vector.z(); } - return vector.getBlockZ() == layer; + return vector.z() == layer; } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AngleColorPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AngleColorPattern.java index a13061951..9f2becf76 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AngleColorPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AngleColorPattern.java @@ -42,9 +42,9 @@ public class AngleColorPattern extends AnglePattern { public > int getSlope(T block, BlockVector3 vector, Extent extent) { int slope = super.getSlope(block, vector, extent); if (slope != -1) { - int x = vector.getBlockX(); - int y = vector.getBlockY(); - int z = vector.getBlockZ(); + int x = vector.x(); + int y = vector.y(); + int z = vector.z(); int height = extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY); if (height > minY) { BlockState below = extent.getBlock(x, height - 1, z); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AnglePattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AnglePattern.java index 224d64434..caebfd6ff 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AnglePattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AnglePattern.java @@ -31,9 +31,9 @@ public abstract class AnglePattern extends AbstractPattern { } public > int getSlope(T block, BlockVector3 vector, Extent extent) { - int x = vector.getBlockX(); - int y = vector.getBlockY(); - int z = vector.getBlockZ(); + int x = vector.x(); + int y = vector.y(); + int z = vector.z(); if (!block.getBlockType().getMaterial().isMovementBlocker()) { return -1; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern2D.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern2D.java index 99414ca25..7748c8633 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern2D.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern2D.java @@ -33,7 +33,7 @@ public class BufferedPattern2D extends BufferedPattern { @Override public boolean set(BlockVector3 pos) { - return set.add(pos.getBlockX(), 0, pos.getBlockY()); + return set.add(pos.x(), 0, pos.z()); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExpressionPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExpressionPattern.java index 638872ea8..9276acb40 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExpressionPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExpressionPattern.java @@ -50,7 +50,7 @@ public class ExpressionPattern extends AbstractPattern { if (expression.getEnvironment() instanceof WorldEditExpressionEnvironment) { ((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector.toVector3()); } - double combined = expression.evaluate(vector.getX(), vector.getY(), vector.getZ()); + double combined = expression.evaluate(vector.x(), vector.y(), vector.z()); return BlockState.getFromOrdinal((int) combined).toBaseBlock(); } catch (EvaluationException e) { e.printStackTrace(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear2DBlockPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear2DBlockPattern.java index 13df9ca6f..d30206534 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear2DBlockPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear2DBlockPattern.java @@ -37,7 +37,7 @@ public class Linear2DBlockPattern extends AbstractPattern { @Override public BaseBlock applyBlock(BlockVector3 position) { - int index = (position.getBlockX() / this.xScale + position.getBlockZ() / this.zScale) % patternsArray.length; + int index = (position.x() / this.xScale + position.z() / this.zScale) % patternsArray.length; if (index < 0) { index += patternsArray.length; } @@ -46,8 +46,8 @@ public class Linear2DBlockPattern extends AbstractPattern { @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { - int index = (floorDiv(get.getBlockX(), this.xScale) - + floorDiv(get.getBlockZ(), this.zScale)) % patternsArray.length; + int index = (floorDiv(get.x(), this.xScale) + + floorDiv(get.z(), this.zScale)) % patternsArray.length; if (index < 0) { index += patternsArray.length; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear3DBlockPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear3DBlockPattern.java index 6c9d039d0..de6e3257b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear3DBlockPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear3DBlockPattern.java @@ -40,8 +40,8 @@ public class Linear3DBlockPattern extends AbstractPattern { @Override public BaseBlock applyBlock(BlockVector3 position) { - int index = (position.getBlockX() / this.xScale - + position.getBlockY() / this.yScale + position.getBlockZ() / this.zScale) % patternsArray.length; + int index = (position.x() / this.xScale + + position.y() / this.yScale + position.z() / this.zScale) % patternsArray.length; if (index < 0) { index += patternsArray.length; } @@ -50,8 +50,8 @@ public class Linear3DBlockPattern extends AbstractPattern { @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { - int index = (floorDiv(get.getBlockX(), this.xScale) - + floorDiv(get.getBlockY(), this.yScale) + floorDiv(get.getBlockZ(), this.zScale)) % patternsArray.length; + int index = (floorDiv(get.x(), this.xScale) + + floorDiv(get.y(), this.yScale) + floorDiv(get.z(), this.zScale)) % patternsArray.length; if (index < 0) { index += patternsArray.length; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoXPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoXPattern.java index b4e9aac37..2d4da9528 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoXPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoXPattern.java @@ -24,15 +24,15 @@ public class NoXPattern extends AbstractPattern { @Override public BaseBlock applyBlock(BlockVector3 pos) { - mutable.mutY(pos.getY()); - mutable.mutZ(pos.getZ()); + mutable.mutY(pos.y()); + mutable.mutZ(pos.z()); return pattern.applyBlock(mutable); } @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { - mutable.mutY(get.getY()); - mutable.mutZ(get.getZ()); + mutable.mutY(get.y()); + mutable.mutZ(get.z()); return pattern.apply(extent, mutable, set); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoYPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoYPattern.java index 2fefaedfc..12ef8174d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoYPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoYPattern.java @@ -24,15 +24,15 @@ public class NoYPattern extends AbstractPattern { @Override public BaseBlock applyBlock(BlockVector3 pos) { - mutable.mutX(pos.getX()); - mutable.mutZ(pos.getZ()); + mutable.mutX(pos.x()); + mutable.mutZ(pos.z()); return pattern.applyBlock(mutable); } @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { - mutable.mutX(get.getX()); - mutable.mutZ(get.getZ()); + mutable.mutX(get.x()); + mutable.mutZ(get.z()); return pattern.apply(extent, mutable, set); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoZPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoZPattern.java index 8c100c5e3..f4d2a47ed 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoZPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoZPattern.java @@ -1,7 +1,6 @@ package com.fastasyncworldedit.core.function.pattern; import com.fastasyncworldedit.core.math.MutableBlockVector3; -import com.fastasyncworldedit.core.queue.Filter; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; @@ -25,15 +24,15 @@ public class NoZPattern extends AbstractPattern { @Override public BaseBlock applyBlock(BlockVector3 pos) { - mutable.mutX(pos.getX()); - mutable.mutY(pos.getY()); + mutable.mutX(pos.x()); + mutable.mutY(pos.y()); return pattern.applyBlock(mutable); } @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { - mutable.mutX(get.getX()); - mutable.mutY(get.getY()); + mutable.mutX(get.x()); + mutable.mutY(get.y()); return pattern.apply(extent, mutable, set); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/OffsetPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/OffsetPattern.java index 9a5ca2ceb..5866766ef 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/OffsetPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/OffsetPattern.java @@ -40,10 +40,10 @@ public class OffsetPattern extends AbstractPattern { @Override public BaseBlock applyBlock(BlockVector3 position) { - mutable.mutX(position.getX() + dx); - mutable.mutY(position.getY() + dy); - mutable.mutZ(position.getZ() + dz); - if (mutable.getY() < minY || mutable.getY() > maxY) { + mutable.mutX(position.x() + dx); + mutable.mutY(position.y() + dy); + mutable.mutZ(position.z() + dz); + if (mutable.y() < minY || mutable.y() > maxY) { return BlockTypes.AIR.getDefaultState().toBaseBlock(); } return pattern.applyBlock(mutable); @@ -51,10 +51,10 @@ public class OffsetPattern extends AbstractPattern { @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { - mutable.mutX(get.getX() + dx); - mutable.mutY(get.getY() + dy); - mutable.mutZ(get.getZ() + dz); - if (mutable.getY() < extent.getMinY() || mutable.getY() > extent.getMaxY()) { + mutable.mutX(get.x() + dx); + mutable.mutY(get.y() + dy); + mutable.mutZ(get.z() + dz); + if (mutable.y() < extent.getMinY() || mutable.y() > extent.getMaxY()) { return false; } return pattern.apply(extent, get, mutable); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomOffsetPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomOffsetPattern.java index c68bb24b1..5dc012f66 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomOffsetPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomOffsetPattern.java @@ -52,10 +52,10 @@ public class RandomOffsetPattern extends AbstractPattern { @Override public BaseBlock applyBlock(BlockVector3 position) { - mutable.mutX((position.getX() + r.nextInt(dx2) - dx)); - mutable.mutY((position.getY() + r.nextInt(dy2) - dy)); - mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz)); - if (mutable.getY() < minY || mutable.getY() > maxY) { + mutable.mutX((position.x() + r.nextInt(dx2) - dx)); + mutable.mutY((position.y() + r.nextInt(dy2) - dy)); + mutable.mutZ((position.z() + r.nextInt(dz2) - dz)); + if (mutable.y() < minY || mutable.y() > maxY) { return BlockTypes.AIR.getDefaultState().toBaseBlock(); } return pattern.applyBlock(mutable); @@ -63,10 +63,10 @@ public class RandomOffsetPattern extends AbstractPattern { @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { - mutable.mutX((set.getX() + r.nextInt(dx2) - dx)); - mutable.mutY((set.getY() + r.nextInt(dy2) - dy)); - mutable.mutZ((set.getZ() + r.nextInt(dz2) - dz)); - if (mutable.getY() < extent.getMinY() || mutable.getY() > extent.getMaxY()) { + mutable.mutX((set.x() + r.nextInt(dx2) - dx)); + mutable.mutY((set.y() + r.nextInt(dy2) - dy)); + mutable.mutZ((set.z() + r.nextInt(dz2) - dz)); + if (mutable.y() < extent.getMinY() || mutable.y() > extent.getMaxY()) { return false; } return pattern.apply(extent, get, mutable); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RelativePattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RelativePattern.java index 541aaa494..22e3a8d0b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RelativePattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RelativePattern.java @@ -35,10 +35,10 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter if (origin == null) { origin = pos; } - mutable.mutX(pos.getX() - origin.getX()); - mutable.mutY(pos.getY() - origin.getY()); - mutable.mutZ(pos.getZ() - origin.getZ()); - if (mutable.getY() < minY || mutable.getY() > maxY) { + mutable.mutX(pos.x() - origin.x()); + mutable.mutY(pos.y() - origin.y()); + mutable.mutZ(pos.z() - origin.z()); + if (mutable.y() < minY || mutable.y() > maxY) { return BlockTypes.AIR.getDefaultState().toBaseBlock(); } return pattern.applyBlock(mutable); @@ -49,10 +49,10 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter if (origin == null) { origin = set; } - mutable.mutX(set.getX() - origin.getX()); - mutable.mutY(set.getY() - origin.getY()); - mutable.mutZ(set.getZ() - origin.getZ()); - if (mutable.getY() < extent.getMinY() || mutable.getY() > extent.getMaxY()) { + mutable.mutX(set.x() - origin.x()); + mutable.mutY(set.y() - origin.y()); + mutable.mutZ(set.z() - origin.z()); + if (mutable.y() < extent.getMinY() || mutable.y() > extent.getMaxY()) { return false; } return pattern.apply(extent, get, mutable); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SolidRandomOffsetPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SolidRandomOffsetPattern.java index 54ecf6676..698c0f199 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SolidRandomOffsetPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SolidRandomOffsetPattern.java @@ -63,13 +63,13 @@ public class SolidRandomOffsetPattern extends AbstractPattern { @Override public BaseBlock applyBlock(BlockVector3 position) { - mutable.mutX(position.getX() + r.nextInt(dx2) - dx); - mutable.mutY(position.getY() + r.nextInt(dy2) - dy); - mutable.mutZ(position.getZ() + r.nextInt(dz2) - dz); - if (mutable.getY() < minY || mutable.getY() > maxY) { + mutable.mutX(position.x() + r.nextInt(dx2) - dx); + mutable.mutY(position.y() + r.nextInt(dy2) - dy); + mutable.mutZ(position.z() + r.nextInt(dz2) - dz); + if (mutable.y() < minY || mutable.y() > maxY) { return BlockTypes.AIR.getDefaultState().toBaseBlock(); } - if (mutable.getY() < minY || mutable.getY() > maxY) { + if (mutable.y() < minY || mutable.y() > maxY) { return BlockTypes.AIR.getDefaultState().toBaseBlock(); } BaseBlock block = pattern.applyBlock(mutable); @@ -81,10 +81,10 @@ public class SolidRandomOffsetPattern extends AbstractPattern { @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { - mutable.mutX(set.getX() + r.nextInt(dx2) - dx); - mutable.mutY(set.getY() + r.nextInt(dy2) - dy); - mutable.mutZ(set.getZ() + r.nextInt(dz2) - dz); - if (mutable.getY() < extent.getMinY() || mutable.getY() > extent.getMaxY()) { + mutable.mutX(set.x() + r.nextInt(dx2) - dx); + mutable.mutY(set.y() + r.nextInt(dy2) - dy); + mutable.mutZ(set.z() + r.nextInt(dz2) - dz); + if (mutable.y() < extent.getMinY() || mutable.y() > extent.getMaxY()) { return false; } BaseBlock block = pattern.applyBlock(mutable); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SurfaceRandomOffsetPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SurfaceRandomOffsetPattern.java index 03e3126be..a7a1a3e2e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SurfaceRandomOffsetPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SurfaceRandomOffsetPattern.java @@ -62,9 +62,9 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern { next = buffer[i]; BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i]; next.setComponents( - cur.getBlockX() + dir.getBlockX(), - cur.getBlockY() + dir.getBlockY(), - cur.getBlockZ() + dir.getBlockZ() + cur.x() + dir.x(), + cur.y() + dir.y(), + cur.z() + dir.z() ); if (allowed(next)) { allowed[index++] = next; @@ -74,7 +74,7 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern { return cur; } next = allowed[ThreadLocalRandom.current().nextInt(index)]; - cur.setComponents(next.getBlockX(), next.getBlockY(), next.getBlockZ()); + cur.setComponents(next.x(), next.y(), next.z()); } return cur; } @@ -85,9 +85,9 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern { if (!block.getBlockType().getMaterial().isMovementBlocker()) { return false; } - int x = v.getBlockX(); - int y = v.getBlockY(); - int z = v.getBlockZ(); + int x = v.x(); + int y = v.y(); + int z = v.z(); v.mutY(y + 1); if (y < maxY && canPassthrough(v)) { v.mutY(y); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/AboveVisitor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/AboveVisitor.java index d2503447b..67a48e2f7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/AboveVisitor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/AboveVisitor.java @@ -40,7 +40,7 @@ public class AboveVisitor extends RecursiveVisitor { @Override public boolean isVisitable(BlockVector3 from, BlockVector3 to) { - return (from.getBlockY() >= baseY) && super.isVisitable(from, to); + return (from.y() >= baseY) && super.isVisitable(from, to); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSVisitor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSVisitor.java index 58b6f0e41..6a84af071 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSVisitor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSVisitor.java @@ -64,13 +64,13 @@ public abstract class DFSVisitor implements Operation { IntTriple[] array = new IntTriple[directions.size()]; for (int i = 0; i < array.length; i++) { BlockVector3 dir = directions.get(i); - array[i] = new IntTriple(dir.getBlockX(), dir.getBlockY(), dir.getBlockZ()); + array[i] = new IntTriple(dir.x(), dir.y(), dir.z()); } return array; } public void visit(final BlockVector3 pos) { - Node node = new Node(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()); + Node node = new Node(pos.x(), pos.y(), pos.z()); if (!this.hashQueue.contains(node)) { isVisitable(pos, pos); // Ignore this, just to initialize mask on this point queue.addFirst(new NodePair(null, node, 0)); @@ -102,7 +102,7 @@ public abstract class DFSVisitor implements Operation { mutable2.mutY(from.getY() + direction.y()); mutable2.mutZ(from.getZ() + direction.z()); if (isVisitable(mutable, mutable2)) { - Node adjacent = new Node(mutable2.getBlockX(), mutable2.getBlockY(), mutable2.getBlockZ()); + Node adjacent = new Node(mutable2.x(), mutable2.y(), mutable2.z()); if (!adjacent.equals(current.from)) { AtomicInteger adjacentCount = visited.get(adjacent); if (adjacentCount == null) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DirectionalVisitor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DirectionalVisitor.java index b7b14059b..f77b0b66b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DirectionalVisitor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DirectionalVisitor.java @@ -52,22 +52,22 @@ public class DirectionalVisitor extends RecursiveVisitor { @Override public boolean isVisitable(final BlockVector3 from, final BlockVector3 to) { - int dx = to.getBlockX() - from.getBlockX(); - int dz = to.getBlockZ() - from.getBlockZ(); - int dy = to.getBlockY() - from.getBlockY(); + int dx = to.x() - from.x(); + int dz = to.z() - from.z(); + int dy = to.y() - from.y(); if (dx != 0) { - if (dirVec.getBlockX() != 0 && dirVec.getBlockX() != dx) { + if (dirVec.x() != 0 && dirVec.x() != dx) { return false; } } if (dy != 0) { - if (dirVec.getBlockY() != 0 && dirVec.getBlockY() != dy) { + if (dirVec.y() != 0 && dirVec.y() != dy) { return false; } } if (dz != 0) { - if (dirVec.getBlockZ() != 0 && dirVec.getBlockZ() != dz) { + if (dirVec.z() != 0 && dirVec.z() != dz) { return false; } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/RollbackOptimizedHistory.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/RollbackOptimizedHistory.java index 1f01f99de..e11fda2b1 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/RollbackOptimizedHistory.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/RollbackOptimizedHistory.java @@ -84,12 +84,12 @@ public class RollbackOptimizedHistory extends DiskStorageHistory { } public void setDimensions(BlockVector3 pos1, BlockVector3 pos2) { - this.minX = pos1.getBlockX(); - this.minY = pos1.getBlockY(); - this.minZ = pos1.getBlockZ(); - this.maxX = pos2.getBlockX(); - this.maxY = pos2.getBlockY(); - this.maxZ = pos2.getBlockZ(); + this.minX = pos1.x(); + this.minY = pos1.y(); + this.minZ = pos1.z(); + this.maxX = pos2.x(); + this.maxY = pos2.y(); + this.maxZ = pos2.z(); } public void setTime(long time) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java index 45e4d06cb..af793aa40 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java @@ -127,18 +127,18 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { if (!tilesFrom.isEmpty()) { for (Map.Entry entry : tilesFrom.entrySet()) { BlockVector3 pos = entry.getKey(); - BlockState fromBlock = get.getBlock(pos.getX() & 15, pos.getY(), pos.getZ() & 15); - BlockState toBlock = set.getBlock(pos.getX() & 15, pos.getY(), pos.getZ() & 15); + BlockState fromBlock = get.getBlock(pos.x() & 15, pos.y(), pos.z() & 15); + BlockState toBlock = set.getBlock(pos.x() & 15, pos.y(), pos.z() & 15); if (fromBlock != toBlock || tilesTo.containsKey(pos)) { - addTileRemove(MainUtil.setPosition(entry.getValue(), entry.getKey().getX(), entry.getKey().getY(), - entry.getKey().getZ())); + addTileRemove(MainUtil.setPosition(entry.getValue(), entry.getKey().x(), entry.getKey().y(), + entry.getKey().z())); } } } if (!tilesTo.isEmpty()) { for (Map.Entry entry : tilesTo.entrySet()) { BlockVector3 pos = entry.getKey(); - addTileCreate(MainUtil.setPosition(entry.getValue(), pos.getX() + bx, pos.getY(), pos.getZ() + bz)); + addTileCreate(MainUtil.setPosition(entry.getValue(), pos.x() + bx, pos.y(), pos.z() + bz)); } } Set entRemoves = set.getEntityRemoves(); @@ -310,9 +310,9 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { } public void add(BlockVector3 loc, BaseBlock from, BaseBlock to) { - int x = loc.getBlockX(); - int y = loc.getBlockY(); - int z = loc.getBlockZ(); + int x = loc.x(); + int y = loc.y(); + int z = loc.z(); add(x, y, z, from, to); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/BlockBagChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/BlockBagChangeSet.java index 22833d3b5..c0dc9756c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/BlockBagChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/BlockBagChangeSet.java @@ -68,9 +68,9 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet { @Override public void add(BlockVector3 loc, BaseBlock from, BaseBlock to) { - int x = loc.getBlockX(); - int y = loc.getBlockY(); - int z = loc.getBlockZ(); + int x = loc.x(); + int y = loc.y(); + int z = loc.z(); add(x, y, z, from, to); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java index e02e3abc9..5ecc89d44 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java @@ -18,6 +18,10 @@ public class FaweLimit { public int SCHEM_FILE_SIZE_LIMIT = 0; public int SCHEM_FILE_NUM_LIMIT = 0; public int MAX_EXPRESSION_MS = 0; + public int MAX_RADIUS = 0; + public int MAX_SUPER_PICKAXE_SIZE = 0; + public int MAX_BRUSH_RADIUS = 0; + public int MAX_BUTCHER_RADIUS = 0; public int INVENTORY_MODE = Integer.MAX_VALUE; public int SPEED_REDUCTION = Integer.MAX_VALUE; public boolean FAST_PLACEMENT = false; @@ -123,6 +127,10 @@ public class FaweLimit { MAX.UNIVERSAL_DISALLOWED_BLOCKS = false; MAX.DISALLOWED_BLOCKS = Collections.emptySet(); MAX.REMAP_PROPERTIES = Collections.emptySet(); + MAX.MAX_RADIUS = Integer.MAX_VALUE; + MAX.MAX_SUPER_PICKAXE_SIZE = Integer.MAX_VALUE; + MAX.MAX_BRUSH_RADIUS = Integer.MAX_VALUE; + MAX.MAX_BUTCHER_RADIUS = Integer.MAX_VALUE; } public boolean MAX_CHANGES() { @@ -250,7 +258,12 @@ public class FaweLimit { && (STRIP_NBT == null || STRIP_NBT.isEmpty()) // && !UNIVERSAL_DISALLOWED_BLOCKS --> do not include this, it effectively has no relevance && (DISALLOWED_BLOCKS == null || DISALLOWED_BLOCKS.isEmpty()) - && (REMAP_PROPERTIES == null || REMAP_PROPERTIES.isEmpty()); + && (REMAP_PROPERTIES == null || REMAP_PROPERTIES.isEmpty()) + && MAX_RADIUS == Integer.MAX_VALUE + && MAX_SUPER_PICKAXE_SIZE == Integer.MAX_VALUE + && MAX_BRUSH_RADIUS == Integer.MAX_VALUE + && MAX_BUTCHER_RADIUS == Integer.MAX_VALUE; + } public void set(FaweLimit limit) { @@ -273,6 +286,10 @@ public class FaweLimit { UNIVERSAL_DISALLOWED_BLOCKS = limit.UNIVERSAL_DISALLOWED_BLOCKS; DISALLOWED_BLOCKS = limit.DISALLOWED_BLOCKS; REMAP_PROPERTIES = limit.REMAP_PROPERTIES; + MAX_RADIUS = limit.MAX_RADIUS; + MAX_SUPER_PICKAXE_SIZE = limit.MAX_SUPER_PICKAXE_SIZE; + MAX_BRUSH_RADIUS = limit.MAX_BRUSH_RADIUS; + MAX_BUTCHER_RADIUS = limit.MAX_BUTCHER_RADIUS; } public FaweLimit copy() { @@ -296,6 +313,10 @@ public class FaweLimit { limit.UNIVERSAL_DISALLOWED_BLOCKS = UNIVERSAL_DISALLOWED_BLOCKS; limit.DISALLOWED_BLOCKS = DISALLOWED_BLOCKS; limit.REMAP_PROPERTIES = REMAP_PROPERTIES; + limit.MAX_RADIUS = MAX_RADIUS; + limit.MAX_SUPER_PICKAXE_SIZE = MAX_SUPER_PICKAXE_SIZE; + limit.MAX_BRUSH_RADIUS = MAX_BRUSH_RADIUS; + limit.MAX_BUTCHER_RADIUS = MAX_BUTCHER_RADIUS; return limit; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java index a9f8a0210..919556847 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java @@ -31,7 +31,7 @@ public class BlockVector3ChunkMap implements IAdaptedMap implements int cx = (int) MathMan.untripleWorldCoordX(triple); int cy = (int) MathMan.untripleWorldCoordY(triple); int cz = (int) MathMan.untripleWorldCoordZ(triple); - pos.mutX((cx << 11) + pos.getBlockX()); - pos.mutY((cy << 9) + pos.getBlockY()); - pos.mutZ((cz << 11) + pos.getBlockZ()); + pos.mutX((cx << 11) + pos.x()); + pos.mutY((cy << 9) + pos.y()); + pos.mutZ((cz << 11) + pos.z()); return pos.toImmutable(); } } @@ -124,7 +124,7 @@ public class BlockVectorSet extends AbstractCollection implements @Override public boolean contains(Object o) { if (o instanceof BlockVector3 v) { - return contains(v.getBlockX(), v.getBlockY(), v.getBlockZ()); + return contains(v.x(), v.y(), v.z()); } return false; } @@ -166,9 +166,9 @@ public class BlockVectorSet extends AbstractCollection implements int cy = (int) MathMan.untripleWorldCoordY(triple); int cz = (int) MathMan.untripleWorldCoordZ(triple); return mutable.setComponents( - (cx << 11) + localPos.getBlockX(), - (cy << 9) + localPos.getBlockY(), - (cz << 11) + localPos.getBlockZ() + (cx << 11) + localPos.x(), + (cy << 9) + localPos.y(), + (cz << 11) + localPos.z() ); } }; @@ -176,7 +176,7 @@ public class BlockVectorSet extends AbstractCollection implements @Override public boolean add(BlockVector3 vector) { - return add(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); + return add(vector.x(), vector.y(), vector.z()); } public boolean add(int x, int y, int z) { @@ -209,7 +209,7 @@ public class BlockVectorSet extends AbstractCollection implements @Override public boolean remove(Object o) { if (o instanceof BlockVector3 v) { - return remove(v.getBlockX(), v.getBlockY(), v.getBlockZ()); + return remove(v.x(), v.y(), v.z()); } return false; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/DelegateBlockVector3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/DelegateBlockVector3.java index b75e157b2..b13aece41 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/DelegateBlockVector3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/DelegateBlockVector3.java @@ -95,13 +95,8 @@ public class DelegateBlockVector3 extends BlockVector3 { } @Override - public int getX() { - return parent.getX(); - } - - @Override - public int getBlockX() { - return parent.getBlockX(); + public int x() { + return parent.x(); } @Override @@ -110,13 +105,8 @@ public class DelegateBlockVector3 extends BlockVector3 { } @Override - public int getY() { - return parent.getY(); - } - - @Override - public int getBlockY() { - return parent.getBlockY(); + public int y() { + return parent.y(); } @Override @@ -125,13 +115,8 @@ public class DelegateBlockVector3 extends BlockVector3 { } @Override - public int getZ() { - return parent.getZ(); - } - - @Override - public int getBlockZ() { - return parent.getBlockZ(); + public int z() { + return parent.z(); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVectorSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVectorSet.java index 5e84a5243..e0c9b541a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVectorSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVectorSet.java @@ -90,7 +90,7 @@ public class LocalBlockVectorSet implements BlockVector3Set { @Override public boolean contains(Object o) { if (o instanceof BlockVector3 v) { - return contains(v.getBlockX(), v.getBlockY(), v.getBlockZ()); + return contains(v.x(), v.y(), v.z()); } return false; } @@ -302,14 +302,14 @@ public class LocalBlockVectorSet implements BlockVector3Set { */ @Override public boolean add(BlockVector3 vector) { - return add(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); + return add(vector.x(), vector.y(), vector.z()); } private int getIndex(BlockVector3 vector) { return MathMan.tripleSearchCoords( - vector.getBlockX() - offsetX, - vector.getBlockY() - offsetY, - vector.getBlockZ() - offsetZ + vector.x() - offsetX, + vector.y() - offsetY, + vector.z() - offsetZ ); } @@ -342,7 +342,7 @@ public class LocalBlockVectorSet implements BlockVector3Set { public boolean remove(Object o) { if (o instanceof BlockVector3) { BlockVector3 v = (BlockVector3) o; - return remove(v.getBlockX(), v.getBlockY(), v.getBlockZ()); + return remove(v.x(), v.y(), v.z()); } return false; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector3.java index 6ebabae1d..e4cfda85a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector3.java @@ -21,11 +21,11 @@ public class MutableBlockVector3 extends BlockVector3 { } public MutableBlockVector3(BlockVector3 other) { - this(other.getX(), other.getY(), other.getZ()); + this(other.x(), other.y(), other.z()); } public MutableBlockVector3 setComponents(BlockVector3 other) { - return setComponents(other.getBlockX(), other.getBlockY(), other.getBlockZ()); + return setComponents(other.x(), other.y(), other.z()); } private int x; @@ -47,33 +47,33 @@ public class MutableBlockVector3 extends BlockVector3 { } @Override - public final int getX() { + public final int x() { return x; } @Override - public final int getY() { + public final int y() { return y; } @Override - public final int getZ() { + public final int z() { return z; } @Override public BlockVector3 getMinimum(BlockVector3 v2) { - this.x = Math.min(v2.getX(), x); - this.y = Math.min(v2.getY(), y); - this.z = Math.min(v2.getZ(), z); + this.x = Math.min(v2.x(), x); + this.y = Math.min(v2.y(), y); + this.z = Math.min(v2.z(), z); return this; } @Override public BlockVector3 getMaximum(BlockVector3 v2) { - this.x = Math.max(v2.getX(), x); - this.y = Math.max(v2.getY(), y); - this.z = Math.max(v2.getZ(), z); + this.x = Math.max(v2.x(), x); + this.y = Math.max(v2.y(), y); + this.z = Math.max(v2.z(), z); return this; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableVector3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableVector3.java index 22d85d38a..3c6ad1334 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableVector3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableVector3.java @@ -23,7 +23,7 @@ public class MutableVector3 extends Vector3 { } public MutableVector3(Vector3 other) { - this(other.getX(), other.getY(), other.getZ()); + this(other.x(), other.y(), other.z()); } public static MutableVector3 get(int x, int y, int z) { @@ -36,9 +36,9 @@ public class MutableVector3 extends Vector3 { @Override public MutableVector3 setComponents(Vector3 other) { - this.x = other.getX(); - this.y = other.getY(); - this.z = other.getZ(); + this.x = other.x(); + this.y = other.y(); + this.z = other.z(); return this; } @@ -95,17 +95,17 @@ public class MutableVector3 extends Vector3 { } @Override - public double getX() { + public double x() { return x; } @Override - public double getY() { + public double y() { return y; } @Override - public double getZ() { + public double z() { return z; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/OffsetBlockVector3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/OffsetBlockVector3.java index 044a623de..5e0d0ebe0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/OffsetBlockVector3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/OffsetBlockVector3.java @@ -11,18 +11,18 @@ public class OffsetBlockVector3 extends DelegateBlockVector3 { } @Override - public int getX() { - return super.getX() + offset.getX(); + public int x() { + return super.x() + offset.x(); } @Override - public int getY() { - return super.getY() + offset.getY(); + public int y() { + return super.y() + offset.y(); } @Override - public int getZ() { - return super.getZ() + offset.getZ(); + public int z() { + return super.z() + offset.z(); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/Vector3Impl.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/Vector3Impl.java index c1092a881..33706aee5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/Vector3Impl.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/Vector3Impl.java @@ -15,21 +15,21 @@ public class Vector3Impl extends Vector3 { } public Vector3Impl(Vector3 other) { - this(other.getX(), other.getY(), other.getZ()); + this(other.x(), other.y(), other.z()); } @Override - public final double getX() { + public final double x() { return x; } @Override - public final double getY() { + public final double y() { return y; } @Override - public final double getZ() { + public final double z() { return z; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/HeightMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/HeightMap.java index f9b2ce914..eeafc8646 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/HeightMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/HeightMap.java @@ -10,7 +10,6 @@ import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; -import java.lang.reflect.InvocationTargetException; import java.util.concurrent.ThreadLocalRandom; public interface HeightMap { @@ -45,7 +44,7 @@ public interface HeightMap { boolean layers ) throws MaxChangedBlocksException { BlockVector3 top = session.getMaximumPoint(); - int maxY = top.getBlockY(); + int maxY = top.y(); Location min = new Location(session.getWorld(), pos.subtract(size, size, size).toVector3()); BlockVector3 max = pos.add(size, maxY, size); Region region = new CuboidRegion(session.getWorld(), min.toBlockPoint(), max); @@ -81,9 +80,9 @@ public interface HeightMap { int maxY = session.getMaxY(); int minY = session.getMinY(); int diameter = 2 * size + 1; - int centerX = pos.getBlockX(); - int centerZ = pos.getBlockZ(); - int centerY = pos.getBlockY(); + int centerX = pos.x(); + int centerZ = pos.z(); + int centerY = pos.y(); int[] oldData = new int[diameter * diameter]; int[] newData = new int[oldData.length]; if (layers) { // Pixel accuracy @@ -92,7 +91,7 @@ public interface HeightMap { } if (towards) { double sizePowInv = 1d / Math.pow(size, yscale); - int targetY = pos.getBlockY(); + int targetY = pos.y(); int tmpY = targetY; for (int x = -size; x <= size; x++) { int xx = centerX + x; @@ -133,7 +132,7 @@ public interface HeightMap { } } } else { - int height = pos.getBlockY(); + int height = pos.y(); for (int x = -size; x <= size; x++) { int xx = centerX + x; for (int z = -size; z <= size; z++) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/RotatableHeightMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/RotatableHeightMap.java index 291f8e754..a452a80f4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/RotatableHeightMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/RotatableHeightMap.java @@ -24,7 +24,7 @@ public class RotatableHeightMap extends AbstractDelegateHeightMap { mutable.mutX(x); mutable.mutZ(z); BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z)).toBlockPoint(); - return super.getHeight(pos.getBlockX(), pos.getBlockZ()); + return super.getHeight(pos.x(), pos.z()); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/ScalableHeightMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/ScalableHeightMap.java index c4481da46..bc845127d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/ScalableHeightMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/heightmap/ScalableHeightMap.java @@ -56,22 +56,22 @@ public class ScalableHeightMap implements HeightMap { public static ScalableHeightMap fromClipboard(Clipboard clipboard, int minY, int maxY) { BlockVector3 dim = clipboard.getDimensions(); - char[][] heightArray = new char[dim.getBlockX()][dim.getBlockZ()]; - int clipMinX = clipboard.getMinimumPoint().getBlockX(); - int clipMinZ = clipboard.getMinimumPoint().getBlockZ(); - int clipMinY = clipboard.getMinimumPoint().getBlockY(); - int clipMaxY = clipboard.getMaximumPoint().getBlockY(); + char[][] heightArray = new char[dim.x()][dim.z()]; + int clipMinX = clipboard.getMinimumPoint().x(); + int clipMinZ = clipboard.getMinimumPoint().z(); + int clipMinY = clipboard.getMinimumPoint().y(); + int clipMaxY = clipboard.getMaximumPoint().y(); int clipHeight = clipMaxY - clipMinY + 1; HashSet visited = new HashSet<>(); MutableBlockVector3 bv = new MutableBlockVector3(); for (BlockVector3 pos : clipboard.getRegion()) { - IntPair pair = new IntPair(pos.getBlockX(), pos.getBlockZ()); + IntPair pair = new IntPair(pos.x(), pos.z()); if (visited.contains(pair)) { continue; } visited.add(pair); - int xx = pos.getBlockX(); - int zz = pos.getBlockZ(); + int xx = pos.x(); + int zz = pos.z(); int highestY = clipMinY; bv.setComponents(pos); for (int y = clipMinY; y <= clipMaxY; y++) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoiseGenerator.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoiseGenerator.java index 8d8aeedf5..d690509dc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoiseGenerator.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoiseGenerator.java @@ -8,12 +8,12 @@ public class SimplexNoiseGenerator implements NoiseGenerator { @Override public float noise(Vector2 position) { - return convert(SimplexNoise.noise(position.getX(), position.getZ())); + return convert(SimplexNoise.noise(position.x(), position.z())); } @Override public float noise(Vector3 position) { - return convert(SimplexNoise.noise(position.getX(), position.getY(), position.getZ())); + return convert(SimplexNoise.noise(position.x(), position.y(), position.z())); } private float convert(double d) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java index ec6162798..a56fe27d5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java @@ -52,8 +52,8 @@ public interface IChunkExtent extends Extent { @Override default boolean setBiome(BlockVector3 position, BiomeType biome) { - final IChunk chunk = getOrCreateChunk(position.getX() >> 4, position.getZ() >> 4); - return chunk.setBiome(position.getX() & 15, position.getY(), position.getZ() & 15, biome); + final IChunk chunk = getOrCreateChunk(position.x() >> 4, position.z() >> 4); + return chunk.setBiome(position.x() & 15, position.y(), position.z() & 15, biome); } @Override @@ -76,8 +76,8 @@ public interface IChunkExtent extends Extent { @Override default BiomeType getBiome(BlockVector3 position) { - final IChunk chunk = getOrCreateChunk(position.getX() >> 4, position.getZ() >> 4); - return chunk.getBiomeType(position.getX() & 15, position.getY(), position.getZ() & 15); + final IChunk chunk = getOrCreateChunk(position.x() >> 4, position.z() >> 4); + return chunk.getBiomeType(position.x() & 15, position.y(), position.z() & 15); } @Override @@ -129,9 +129,9 @@ public interface IChunkExtent extends Extent { //Set pos List posList = new ArrayList<>(); - posList.add(new DoubleTag(location.getX())); - posList.add(new DoubleTag(location.getY())); - posList.add(new DoubleTag(location.getZ())); + posList.add(new DoubleTag(location.x())); + posList.add(new DoubleTag(location.y())); + posList.add(new DoubleTag(location.z())); map.put("Pos", new ListTag(DoubleTag.class, posList)); NBTUtils.addUUIDToMap(map, uuid); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkGet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkGet.java index ff964e7a3..c740b4dd4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkGet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkGet.java @@ -27,7 +27,7 @@ public interface IChunkGet extends IBlocks, Trimable, InputExtent, ITileInput { @Override default BiomeType getBiome(BlockVector3 position) { - return getBiomeType(position.getX(), position.getY(), position.getZ()); + return getBiomeType(position.x(), position.y(), position.z()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java index 1af60b3a2..bc621e66a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java @@ -25,7 +25,7 @@ public interface IChunkSet extends IBlocks, OutputExtent { @Override default boolean setBiome(BlockVector3 position, BiomeType biome) { - return setBiome(position.getX(), position.getY(), position.getZ(), biome); + return setBiome(position.x(), position.y(), position.z(), biome); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java index 104167d30..c13373d9a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java @@ -152,7 +152,7 @@ public interface IQueueExtent extends Flushable, Trimable, ICh final Set chunks = region.getChunks(); ChunkFilterBlock block = null; for (BlockVector2 chunk : chunks) { - block = apply(block, filter, region, chunk.getX(), chunk.getZ(), full); + block = apply(block, filter, region, chunk.x(), chunk.z(), full); } flush(); return filter; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java index b2c520ce1..7959187b2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java @@ -135,7 +135,7 @@ public class ParallelQueueExtent extends PassthroughExtent { // if PQE is ever used with PARALLEL_THREADS = 1, or only one chunk is edited, just run sequentially while (chunksIter.hasNext()) { BlockVector2 pos = chunksIter.next(); - getExtent().apply(null, filter, region, pos.getX(), pos.getZ(), full); + getExtent().apply(null, filter, region, pos.x(), pos.z(), full); } } else { final ForkJoinTask[] tasks = IntStream.range(0, size).mapToObj(i -> handler.submit(() -> { @@ -159,8 +159,8 @@ public class ParallelQueueExtent extends PassthroughExtent { break; } final BlockVector2 pos = chunksIter.next(); - chunkX = pos.getX(); - chunkZ = pos.getZ(); + chunkX = pos.x(); + chunkZ = pos.z(); } block = queue.apply(block, newFilter, region, chunkX, chunkZ, full); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java index 9e2014d25..595590766 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java @@ -356,7 +356,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen break; } loadCount++; - addChunkLoad(from.getBlockX(), from.getBlockZ()); + addChunkLoad(from.x(), from.z()); } } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java index d392d280c..f0ef4910c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java @@ -144,7 +144,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet { @Override public > boolean setBlock(BlockVector3 position, T block) throws WorldEditException { - return setBlock(position.getX(), position.getY(), position.getZ(), block); + return setBlock(position.x(), position.y(), position.z(), block); } @Override @@ -271,7 +271,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - return setBiome(position.getX(), position.getY(), position.getZ(), biome); + return setBiome(position.x(), position.y(), position.z(), biome); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java index 8f6ab06b8..c52293688 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java @@ -234,7 +234,7 @@ public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - return setBiome(position.getX(), position.getY(), position.getZ(), biome); + return setBiome(position.x(), position.y(), position.z(), biome); } public void set(int x, int y, int z, char value) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java index 7a74ed8ac..672ecfc93 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java @@ -111,8 +111,8 @@ public class AsyncPreloader implements Preloader, Runnable { while (chunksIter.hasNext() && pair.getValue() == chunks) { // Ensure the queued load is still valid BlockVector2 chunk = chunksIter.next(); if (Settings.settings().REGION_RESTRICTIONS_OPTIONS.RESTRICT_TO_SAFE_RANGE) { - int x = chunk.getX(); - int z = chunk.getZ(); + int x = chunk.x(); + int z = chunk.z(); // if any chunk coord is outside 30 million blocks if (x > 1875000 || z > 1875000 || x < -1875000 || z < -1875000) { continue; @@ -130,7 +130,7 @@ public class AsyncPreloader implements Preloader, Runnable { } private void queueLoad(World world, BlockVector2 chunk) { - world.checkLoadedChunk(BlockVector3.at(chunk.getX() << 4, 0, chunk.getZ() << 4)); + world.checkLoadedChunk(BlockVector3.at(chunk.x() << 4, 0, chunk.z() << 4)); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FuzzyRegion.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FuzzyRegion.java index 58061bfa0..e080baeaf 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FuzzyRegion.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FuzzyRegion.java @@ -52,7 +52,7 @@ public class FuzzyRegion extends AbstractRegion { */ public void select(BlockVector3 position) { RecursiveVisitor search = new RecursiveVisitor(mask, p -> { - setMinMax(p.getBlockX(), p.getBlockY(), p.getBlockZ()); + setMinMax(p.x(), p.y(), p.z()); return true; }, 256, extent.getMinY(), extent.getMaxY(), extent); search.setVisited(set); @@ -120,7 +120,7 @@ public class FuzzyRegion extends AbstractRegion { @Override public boolean contains(BlockVector3 position) { - return contains(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + return contains(position.x(), position.y(), position.z()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/PolyhedralRegion.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/PolyhedralRegion.java index 03dd750a5..dbfe840c8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/PolyhedralRegion.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/PolyhedralRegion.java @@ -261,27 +261,27 @@ public class PolyhedralRegion extends AbstractRegion { if (!isDefined()) { return false; } - final int x = position.getBlockX(); - final int y = position.getBlockY(); - final int z = position.getBlockZ(); + final int x = position.x(); + final int y = position.y(); + final int z = position.z(); final BlockVector3 min = getMinimumPoint(); final BlockVector3 max = getMaximumPoint(); - if (x < min.getBlockX()) { + if (x < min.x()) { return false; } - if (x > max.getBlockX()) { + if (x > max.x()) { return false; } - if (z < min.getBlockZ()) { + if (z < min.z()) { return false; } - if (z > max.getBlockZ()) { + if (z > max.z()) { return false; } - if (y < min.getBlockY()) { + if (y < min.y()) { return false; } - if (y > max.getBlockY()) { + if (y > max.y()) { return false; } return containsRaw(position); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/RegionWrapper.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/RegionWrapper.java index e382583aa..40d0075e5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/RegionWrapper.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/RegionWrapper.java @@ -44,12 +44,12 @@ public class RegionWrapper extends CuboidRegion { public RegionWrapper(final BlockVector3 pos1, final BlockVector3 pos2) { super(pos1, pos2); - this.minX = Math.min(pos1.getBlockX(), pos2.getBlockX()); - this.minZ = Math.min(pos1.getBlockZ(), pos2.getBlockZ()); - this.maxX = Math.max(pos1.getBlockX(), pos2.getBlockX()); - this.maxZ = Math.max(pos1.getBlockZ(), pos2.getBlockZ()); - this.minY = Math.min(pos1.getBlockY(), pos2.getBlockY()); - this.maxY = Math.max(pos1.getBlockY(), pos2.getBlockY()); + this.minX = Math.min(pos1.x(), pos2.x()); + this.minZ = Math.min(pos1.z(), pos2.z()); + this.maxX = Math.max(pos1.x(), pos2.x()); + this.maxZ = Math.max(pos1.z(), pos2.z()); + this.minY = Math.min(pos1.y(), pos2.y()); + this.maxY = Math.max(pos1.y(), pos2.y()); } public static RegionWrapper GLOBAL() { @@ -61,12 +61,12 @@ public class RegionWrapper extends CuboidRegion { super.recalculate(); BlockVector3 pos1 = getMinimumPoint(); BlockVector3 pos2 = getMaximumPoint(); - this.minX = Math.min(pos1.getBlockX(), pos2.getBlockX()); - this.minZ = Math.min(pos1.getBlockZ(), pos2.getBlockZ()); - this.maxX = Math.max(pos1.getBlockX(), pos2.getBlockX()); - this.maxZ = Math.max(pos1.getBlockZ(), pos2.getBlockZ()); - this.minY = Math.min(pos1.getBlockY(), pos2.getBlockY()); - this.maxY = Math.max(pos1.getBlockY(), pos2.getBlockY()); + this.minX = Math.min(pos1.x(), pos2.x()); + this.minZ = Math.min(pos1.z(), pos2.z()); + this.maxX = Math.max(pos1.x(), pos2.x()); + this.maxZ = Math.max(pos1.z(), pos2.z()); + this.minY = Math.min(pos1.y(), pos2.y()); + this.maxY = Math.max(pos1.y(), pos2.y()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/Triangle.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/Triangle.java index 46e934bee..2bb9fc5ac 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/Triangle.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/Triangle.java @@ -28,9 +28,9 @@ public class Triangle { private final double b; public Triangle(BlockVector3 pos1, BlockVector3 pos2, BlockVector3 pos3) { - verts[0] = new double[]{pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()}; - verts[1] = new double[]{pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()}; - verts[2] = new double[]{pos3.getBlockX(), pos3.getBlockY(), pos3.getBlockZ()}; + verts[0] = new double[]{pos1.x(), pos1.y(), pos1.z()}; + verts[1] = new double[]{pos2.x(), pos2.y(), pos2.z()}; + verts[2] = new double[]{pos3.x(), pos3.y(), pos3.z()}; radius[0] = RADIUS; radius[1] = RADIUS; radius[2] = RADIUS; @@ -72,9 +72,9 @@ public class Triangle { } public boolean contains(BlockVector3 pos) { - center[0] = pos.getBlockX() + RADIUS; - center[1] = pos.getBlockY() + RADIUS; - center[2] = pos.getBlockZ() + RADIUS; + center[0] = pos.x() + RADIUS; + center[1] = pos.y() + RADIUS; + center[2] = pos.z() + RADIUS; return overlaps(center, radius, verts); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/CuboidRegionFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/CuboidRegionFilter.java index d354eae3b..72413e115 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/CuboidRegionFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/CuboidRegionFilter.java @@ -19,10 +19,10 @@ public abstract class CuboidRegionFilter implements RegionFilter { public abstract void calculateRegions(); public void add(BlockVector2 pos1, BlockVector2 pos2) { - int ccx1 = pos1.getBlockX() >> 9; - int ccz1 = pos1.getBlockZ() >> 9; - int ccx2 = pos2.getBlockX() >> 9; - int ccz2 = pos2.getBlockZ() >> 9; + int ccx1 = pos1.x() >> 9; + int ccz1 = pos1.z() >> 9; + int ccx2 = pos2.x() >> 9; + int ccz2 = pos2.z() >> 9; for (int x = ccx1; x <= ccx2; x++) { for (int z = ccz1; z <= ccz2; z++) { if (!occupiedRegions.containsKey(x, z)) { @@ -39,10 +39,10 @@ public abstract class CuboidRegionFilter implements RegionFilter { } } } - int cx1 = pos1.getBlockX() >> 4; - int cz1 = pos1.getBlockZ() >> 4; - int cx2 = pos2.getBlockX() >> 4; - int cz2 = pos2.getBlockZ() >> 4; + int cx1 = pos1.x() >> 4; + int cz1 = pos1.z() >> 4; + int cx2 = pos2.x() >> 4; + int cz2 = pos2.z() >> 4; for (int chunkZ = cz1; chunkZ <= cz2; chunkZ++) { for (int chunkX = cx1; chunkX <= cx2; chunkX++) { unoccupiedChunks.remove(chunkX, chunkZ); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java index 1c5fe044a..117ab8fab 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java @@ -450,9 +450,9 @@ public class MainUtil { Location loc = entity.getLocation(); // Create a copy, because the list is immutable... List posList = new ArrayList<>(pos.getValue()); - posList.set(0, new DoubleTag(loc.getX())); - posList.set(1, new DoubleTag(loc.getY())); - posList.set(2, new DoubleTag(loc.getZ())); + posList.set(0, new DoubleTag(loc.x())); + posList.set(1, new DoubleTag(loc.y())); + posList.set(2, new DoubleTag(loc.z())); map.put("Pos", new ListTag(pos.getType(), posList)); } return new CompoundTag(map); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java index b31853dd0..00ededf1a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java @@ -183,8 +183,8 @@ public class WEManager { BlockVector3 rg2P1 = region2.getMinimumPoint(); BlockVector3 rg2P2 = region2.getMaximumPoint(); - return rg1P1.getBlockX() <= rg2P2.getBlockX() && rg1P2.getBlockX() >= rg2P1.getBlockX() - && rg1P1.getBlockZ() <= rg2P2.getBlockZ() && rg1P2.getBlockZ() >= rg2P1.getBlockZ(); + return rg1P1.x() <= rg2P2.x() && rg1P2.x() >= rg2P1.x() + && rg1P1.z() <= rg2P2.z() && rg1P2.z() >= rg2P1.z(); } public boolean regionContains(Region selection, HashSet mask) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockSet.java index 0706a39d2..06e7d7cff 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockSet.java @@ -35,7 +35,7 @@ public abstract class BlockSet extends AbstractRegion { @Override public boolean contains(BlockVector3 obj) { - return contains(obj.getX(), obj.getY(), obj.getZ()); + return contains(obj.x(), obj.y(), obj.z()); } protected final int lowestBit(long bitBuffer) { @@ -71,11 +71,11 @@ public abstract class BlockSet extends AbstractRegion { @Override public boolean add(BlockVector3 p) { - return add(p.getX(), p.getY(), p.getZ()); + return add(p.x(), p.y(), p.z()); } public boolean remove(BlockVector3 p) { - return remove(p.getX(), p.getY(), p.getZ()); + return remove(p.x(), p.y(), p.z()); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockVector3Set.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockVector3Set.java index cadc35fc8..8bf9463f9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockVector3Set.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockVector3Set.java @@ -23,11 +23,11 @@ public interface BlockVector3Set extends Set { // Set default offset as many operations utilising a region are likely to start in a corner, this initialising the // LocalBlockVectorSet poorly // This needs to be ceiling as LocalBlockVector extends 1 block further "negative" - int offsetX = (int) Math.ceil((min.getX() + max.getX()) / 2d); - int offsetZ = (int) Math.ceil((min.getZ() + max.getZ()) / 2d); + int offsetX = (int) Math.ceil((min.x() + max.x()) / 2d); + int offsetZ = (int) Math.ceil((min.z() + max.z()) / 2d); int offsetY; if (region.getMinimumY() < -128 || region.getMaximumY() > 320) { - offsetY = (min.getY() + max.getY()) / 2; + offsetY = (min.y() + max.y()) / 2; } else { offsetY = 128; } @@ -43,7 +43,7 @@ public interface BlockVector3Set extends Set { * @return Appropriate {@link BlockVector3Set} implementation */ static BlockVector3Set getAppropriateVectorSet(BlockVector3 size) { - if (size.getBlockX() > 2048 || size.getBlockZ() > 2048 || size.getBlockY() > 512) { + if (size.x() > 2048 || size.z() > 2048 || size.y() > 512) { return new BlockVectorSet(); } else { return new LocalBlockVectorSet(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MemBlockSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MemBlockSet.java index 33fc963c3..68990cad1 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MemBlockSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MemBlockSet.java @@ -1,7 +1,6 @@ package com.fastasyncworldedit.core.util.collection; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.math.MutableBlockVector2; import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; @@ -167,9 +166,9 @@ public final class MemBlockSet extends BlockSet { @Override public boolean contains(Object o) { if (o instanceof BlockVector2 other) { - IRow rowx = rows[other.getX() - getChunkOffsetX()]; + IRow rowx = rows[other.x() - getChunkOffsetX()]; if (rowx instanceof RowX) { - return ((RowX) rowx).rows[other.getZ() - getChunkOffsetZ()] instanceof RowZ; + return ((RowX) rowx).rows[other.z() - getChunkOffsetZ()] instanceof RowZ; } } return false; @@ -269,11 +268,11 @@ public final class MemBlockSet extends BlockSet { @Override public boolean contains(Object o) { if (o instanceof BlockVector3 other) { - IRow rowx = rows[other.getX() - getChunkOffsetX()]; + IRow rowx = rows[other.x() - getChunkOffsetX()]; if (rowx instanceof RowX) { - IRow rowz = ((RowX) rowx).rows[other.getZ()]; + IRow rowz = ((RowX) rowx).rows[other.z()]; if (rowz instanceof RowZ) { - return ((RowZ) rowz).rows[other.getY() - (minSectionPosition << 4) - getChunkOffsetZ()] instanceof RowY; + return ((RowZ) rowz).rows[other.y() - (minSectionPosition << 4) - getChunkOffsetZ()] instanceof RowY; } } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/SimpleWorld.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/SimpleWorld.java index dcc65ae21..1619f114f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/SimpleWorld.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/SimpleWorld.java @@ -58,12 +58,12 @@ public interface SimpleWorld extends World { @Override default int getMaxY() { - return getMaximumPoint().getBlockY(); + return getMaximumPoint().y(); } @Override default int getMinY() { - return getMinimumPoint().getBlockY(); + return getMinimumPoint().y(); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/AsyncPlayer.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/AsyncPlayer.java index 700070611..077e87e8c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/AsyncPlayer.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/AsyncPlayer.java @@ -97,7 +97,7 @@ public class AsyncPlayer extends PlayerProxy { return false; } - while (y <= world.getMaximumPoint().getY()) { + while (y <= world.getMaximumPoint().y()) { // Found a ceiling! if (world.getBlock(mutable.mutY(y)).getBlockType().getMaterial() .isMovementBlocker()) { diff --git a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java index d4cc816e7..a894cbe14 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java +++ b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java @@ -161,28 +161,28 @@ public class YAMLNode { if (value instanceof Vector3) { Map out = new LinkedHashMap<>(); Vector3 vec = (Vector3) value; - out.put("x", vec.getX()); - out.put("y", vec.getY()); - out.put("z", vec.getZ()); + out.put("x", vec.x()); + out.put("y", vec.y()); + out.put("z", vec.z()); return out; } else if (value instanceof BlockVector3) { Map out = new LinkedHashMap<>(); BlockVector3 vec = (BlockVector3) value; - out.put("x", vec.getBlockX()); - out.put("y", vec.getBlockY()); - out.put("z", vec.getBlockZ()); + out.put("x", vec.x()); + out.put("y", vec.y()); + out.put("z", vec.z()); return out; } else if (value instanceof Vector2) { Map out = new LinkedHashMap<>(); Vector2 vec = (Vector2) value; - out.put("x", vec.getX()); - out.put("z", vec.getZ()); + out.put("x", vec.x()); + out.put("z", vec.z()); return out; } else if (value instanceof BlockVector2) { Map out = new LinkedHashMap<>(); BlockVector2 vec = (BlockVector2) value; - out.put("x", vec.getBlockX()); - out.put("z", vec.getBlockZ()); + out.put("x", vec.x()); + out.put("z", vec.z()); return out; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 15532524c..866954294 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -903,7 +903,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { //FAWE start - use extent - if (position.getY() < this.minY || position.getY() > this.maxY) { + if (position.y() < this.minY || position.y() > this.maxY) { return false; } this.changes++; @@ -984,7 +984,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { public > boolean setBlock(BlockVector3 position, B block, Stage stage) throws WorldEditException { //FAWE start - accumulate changes - if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) { + if (position.y() < this.minY || position.y() > this.maxY) { return false; } @@ -1014,7 +1014,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { */ @Deprecated public > boolean rawSetBlock(BlockVector3 position, B block) { - if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) { + if (position.y() < this.minY || position.y() > this.maxY) { return false; } @@ -1037,7 +1037,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @return whether the block changed */ public > boolean smartSetBlock(BlockVector3 position, B block) { - if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) { + if (position.y() < this.minY || position.y() > this.maxY) { return false; } @@ -1052,7 +1052,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { @Override @Deprecated public > boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException { - if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) { + if (position.y() < this.minY || position.y() > this.maxY) { return false; } @@ -1114,7 +1114,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @throws MaxChangedBlocksException thrown if too many blocks are changed */ public boolean setBlock(BlockVector3 position, Pattern pattern) throws MaxChangedBlocksException { - if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) { + if (position.y() < this.minY || position.y() > this.maxY) { return false; } @@ -1349,12 +1349,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { public > int fall(final Region region, boolean fullHeight, final B replace) { FlatRegion flat = asFlatRegion(region); - final int startPerformY = region.getMinimumPoint().getBlockY(); + final int startPerformY = region.getMinimumPoint().y(); final int startCheckY = fullHeight ? getMinY() : startPerformY; - final int endY = region.getMaximumPoint().getBlockY(); + final int endY = region.getMaximumPoint().y(); RegionVisitor visitor = new RegionVisitor(flat, pos -> { - int x = pos.getX(); - int z = pos.getZ(); + int x = pos.x(); + int z = pos.z(); int freeSpot = startCheckY; for (int y = startCheckY; y <= endY; y++) { if (y < startPerformY) { @@ -1479,8 +1479,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { // Avoid int overflow (negative coordinate space allows for overflow back round to positive if the depth is large enough). // Depth is always 1 or greater, thus the lower bound should always be <= origin y. - int lowerBound = origin.getBlockY() - depth + 1; - if (lowerBound > origin.getBlockY()) { + int lowerBound = origin.y() - depth + 1; + if (lowerBound > origin.y()) { lowerBound = Integer.MIN_VALUE; } @@ -1488,7 +1488,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), new BoundedHeightMask( Math.max(lowerBound, minY), - Math.min(maxY, origin.getBlockY()) + Math.min(maxY, origin.y()) ), Masks.negate(new ExistingBlockMask(this)) ); @@ -1502,7 +1502,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { if (recursive) { visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), minY, maxY, this); } else { - visitor = new DownwardVisitor(mask, replace, origin.getBlockY(), (int) (radius * 2 + 1), minY, maxY, this); + visitor = new DownwardVisitor(mask, replace, origin.y(), (int) (radius * 2 + 1), minY, maxY, this); } //FAWE end @@ -1600,11 +1600,11 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { Vector3 center = region.getCenter(); Region centerRegion = new CuboidRegion( getWorld(), // Causes clamping of Y range - BlockVector3.at(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())), + BlockVector3.at(((int) center.x()), ((int) center.y()), ((int) center.z())), BlockVector3.at( - MathUtils.roundHalfUp(center.getX()), - MathUtils.roundHalfUp(center.getY()), - MathUtils.roundHalfUp(center.getZ()) + MathUtils.roundHalfUp(center.x()), + MathUtils.roundHalfUp(center.y()), + MathUtils.roundHalfUp(center.z()) ) ); return setBlocks(centerRegion, pattern); @@ -1754,8 +1754,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { BlockReplace replace = new BlockReplace(this, pattern); RegionOffset offset = new RegionOffset(BlockVector3.UNIT_Y, replace); //FAWE start - int minY = region.getMinimumPoint().getBlockY(); - int maxY = Math.min(getMaximumPoint().getBlockY(), region.getMaximumPoint().getBlockY() + 1); + int minY = region.getMinimumPoint().y(); + int maxY = Math.min(getMaximumPoint().y(), region.getMaximumPoint().y() + 1); SurfaceRegionFunction surface = new SurfaceRegionFunction(this, offset, minY, maxY); FlatRegionVisitor visitor = new FlatRegionVisitor(asFlatRegion(region), surface, this); //FAWE end @@ -1905,7 +1905,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { BlockVector3 disAbs = displace.abs(); - if (disAbs.getBlockX() < size.getBlockX() && disAbs.getBlockY() < size.getBlockY() && disAbs.getBlockZ() < size.getBlockZ()) { + if (disAbs.x() < size.x() && disAbs.y() < size.y() && disAbs.z() < size.z()) { // Buffer if overlapping enableQueue(); } @@ -2068,7 +2068,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { // There are boundaries that the routine needs to stay in Mask mask = new MaskIntersection( - new BoundedHeightMask(minY, Math.min(origin.getBlockY(), maxY)), + new BoundedHeightMask(minY, Math.min(origin.y(), maxY)), new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), blockMask ); @@ -2156,15 +2156,15 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } else if (height < 0) { height = -height; //FAWE start - mutableBlockVector3.mutY(mutableBlockVector3.getY() - height); + mutableBlockVector3.mutY(mutableBlockVector3.y() - height); //FAWE end } //FAWE start - if (mutableBlockVector3.getBlockY() < getWorld().getMinY()) { + if (mutableBlockVector3.y() < getWorld().getMinY()) { mutableBlockVector3.mutY(world.getMinY()); - } else if (mutableBlockVector3.getBlockY() + height - 1 > maxY) { - height = maxY - mutableBlockVector3.getBlockY() + 1; + } else if (mutableBlockVector3.y() + height - 1 > maxY) { + height = maxY - mutableBlockVector3.y() + 1; } //FAWE end @@ -2172,9 +2172,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final double invRadiusZ = 1 / radiusZ; //FAWE start - int px = mutableBlockVector3.getBlockX(); - int py = mutableBlockVector3.getBlockY(); - int pz = mutableBlockVector3.getBlockZ(); + int px = mutableBlockVector3.x(); + int py = mutableBlockVector3.y(); + int pz = mutableBlockVector3.z(); final int ceilRadiusX = (int) Math.ceil(radiusX); final int ceilRadiusZ = (int) Math.ceil(radiusZ); @@ -2319,9 +2319,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { double ry2 = Math.pow(height, 2); double rz2 = Math.pow(radiusZ, 2); - int cx = pos.getX(); - int cy = pos.getY(); - int cz = pos.getZ(); + int cx = pos.x(); + int cy = pos.y(); + int cz = pos.z(); for (int y = 0; y < height; ++y) { double ySquaredMinusHeightOverHeightSquared = Math.pow(y - height, 2) / ry2; @@ -2403,18 +2403,18 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { radiusZ += 0.5; normal = normal.normalize(); - double nx = normal.getX(); - double ny = normal.getY(); - double nz = normal.getZ(); + double nx = normal.x(); + double ny = normal.y(); + double nz = normal.z(); final double invRadiusX = 1 / radiusX; final double invRadiusY = 1 / radiusY; final double invRadiusZ = 1 / radiusZ; - int px = pos.getBlockX(); - int py = pos.getBlockY(); - int pz = pos.getBlockZ(); + int px = pos.x(); + int py = pos.y(); + int pz = pos.z(); final int ceilRadiusX = (int) Math.ceil(radiusX); final int ceilRadiusY = (int) Math.ceil(radiusY); @@ -2545,9 +2545,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final double invRadiusY = 1 / radiusY; final double invRadiusZ = 1 / radiusZ; - int px = pos.getBlockX(); - int py = pos.getBlockY(); - int pz = pos.getBlockZ(); + int px = pos.x(); + int py = pos.y(); + int pz = pos.z(); final int ceilRadiusX = (int) Math.ceil(radiusX); final int ceilRadiusY = (int) Math.ceil(radiusY); @@ -2654,9 +2654,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { */ public int makePyramid(BlockVector3 position, Pattern block, int size, boolean filled) throws MaxChangedBlocksException { //FAWE start - abbreviated logic - int bx = position.getX(); - int by = position.getY(); - int bz = position.getZ(); + int bx = position.x(); + int by = position.y(); + int bz = position.z(); int height = size; int yy, xx, x_x, zz, z_z; @@ -2715,9 +2715,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { int affected = 0; double radiusSq = radius * radius; - int ox = position.getBlockX(); - int oy = position.getBlockY(); - int oz = position.getBlockZ(); + int ox = position.x(); + int oy = position.y(); + int oz = position.z(); BlockState air = BlockTypes.AIR.getDefaultState(); BlockState water = BlockTypes.WATER.getDefaultState(); @@ -2804,7 +2804,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { public int simulateSnow(BlockVector3 position, double radius, int height) throws MaxChangedBlocksException { - return simulateSnow(new CylinderRegion(position, Vector2.at(radius, radius), position.getBlockY(), height), false); + return simulateSnow(new CylinderRegion(position, Vector2.at(radius, radius), position.y(), height), false); } /** @@ -2860,9 +2860,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { int affected = 0; final double radiusSq = radius * radius; - final int ox = position.getBlockX(); - final int oy = position.getBlockY(); - final int oz = position.getBlockZ(); + final int ox = position.x(); + final int oy = position.y(); + final int oz = position.z(); final BlockState grass = BlockTypes.GRASS_BLOCK.getDefaultState(); @@ -3077,7 +3077,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } } if (expression.evaluate( - new double[]{scaled.getX(), scaled.getY(), scaled.getZ(), typeVar, dataVar}, + new double[]{scaled.x(), scaled.y(), scaled.z(), typeVar, dataVar}, timeout ) <= 0) { return null; @@ -3180,10 +3180,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final Vector3 scaled = position.toVector3().subtract(zero).divide(unit); // transform - expression.evaluate(new double[]{scaled.getX(), scaled.getY(), scaled.getZ()}, timeout); - int xv = (int) Math.floor(x.getValue() * unit.getX() + zero2.getX()); - int yv = (int) Math.floor(y.getValue() * unit.getY() + zero2.getY()); - int zv = (int) Math.floor(z.getValue() * unit.getZ() + zero2.getZ()); + expression.evaluate(new double[]{scaled.x(), scaled.y(), scaled.z()}, timeout); + int xv = (int) Math.floor(x.getValue() * unit.x() + zero2.x()); + int yv = (int) Math.floor(y.getValue() * unit.y() + zero2.y()); + int zv = (int) Math.floor(z.getValue() * unit.z() + zero2.z()); BlockState get; if (yv >= minY && yv <= maxY) { @@ -3222,12 +3222,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final BlockVector3 min = region.getMinimumPoint(); final BlockVector3 max = region.getMaximumPoint(); - final int minX = min.getBlockX(); - final int minY = min.getBlockY(); - final int minZ = min.getBlockZ(); - final int maxX = max.getBlockX(); - final int maxY = max.getBlockY(); - final int maxZ = max.getBlockZ(); + final int minX = min.x(); + final int minY = min.y(); + final int minZ = min.z(); + final int maxX = max.x(); + final int maxY = max.y(); + final int maxZ = max.z(); //FAWE start - mutable MutableBlockVector3 mutable = new MutableBlockVector3(); @@ -3316,12 +3316,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { public int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled, boolean flat) throws MaxChangedBlocksException { - int x1 = pos1.getBlockX(); - int y1 = pos1.getBlockY(); - int z1 = pos1.getBlockZ(); - int x2 = pos2.getBlockX(); - int y2 = pos2.getBlockY(); - int z2 = pos2.getBlockZ(); + int x1 = pos1.x(); + int y1 = pos1.y(); + int z1 = pos1.z(); + int x2 = pos2.x(); + int y2 = pos2.y(); + int z2 = pos2.z(); int tipx = x1; int tipy = y1; int tipz = z1; @@ -3416,12 +3416,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { BlockVector3 pos1 = vectors.get(i); BlockVector3 pos2 = vectors.get(i + 1); - int x1 = pos1.getBlockX(); - int y1 = pos1.getBlockY(); - int z1 = pos1.getBlockZ(); - int x2 = pos2.getBlockX(); - int y2 = pos2.getBlockY(); - int z2 = pos2.getBlockZ(); + int x1 = pos1.x(); + int y1 = pos1.y(); + int z1 = pos1.z(); + int x2 = pos2.x(); + int y2 = pos2.y(); + int z2 = pos2.z(); int tipx = x1; int tipy = y1; int tipz = z1; @@ -3532,9 +3532,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { int ceilrad = (int) Math.ceil(radius); for (BlockVector3 v : vset) { - int tipx = v.getBlockX(); - int tipy = v.getBlockY(); - int tipz = v.getBlockZ(); + int tipx = v.x(); + int tipy = v.y(); + int tipz = v.z(); for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) { for (int loopy = tipy - ceilrad; loopy <= tipy + ceilrad; loopy++) { @@ -3557,13 +3557,13 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final LocalBlockVectorSet returnset = new LocalBlockVectorSet(); final int ceilrad = (int) Math.ceil(radius); for (BlockVector3 v : vset) { - final int tipx = v.getBlockX(); - final int tipy = v.getBlockY(); - final int tipz = v.getBlockZ(); + final int tipx = v.x(); + final int tipy = v.y(); + final int tipz = v.z(); for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) { for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) { if (MathMan.hypot(loopx - tipx, 0, loopz - tipz) <= radius) { - returnset.add(loopx, v.getBlockY(), loopz); + returnset.add(loopx, v.y(), loopz); } } } @@ -3576,9 +3576,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final LocalBlockVectorSet newset = new LocalBlockVectorSet(); newset.addAll(vset); for (BlockVector3 v : newset) { - final int x = v.getX(); - final int y = v.getY(); - final int z = v.getZ(); + final int x = v.x(); + final int y = v.y(); + final int z = v.z(); if (!(newset.contains(x + 1, y, z) && newset.contains(x - 1, y, z) && newset.contains(x, y, z + 1) @@ -3595,9 +3595,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final LocalBlockVectorSet newset = new LocalBlockVectorSet(); newset.addAll(vset); for (BlockVector3 v : newset) { - final int x = v.getX(); - final int y = v.getY(); - final int z = v.getZ(); + final int x = v.x(); + final int y = v.y(); + final int z = v.z(); if (!(newset.contains(x + 1, y, z) && newset.contains(x - 1, y, z) && newset.contains(x, y + 1, z) @@ -3668,9 +3668,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { @Override protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) { environment.setCurrentBlock(x, y, z); - double scaledX = (x - zero.getX()) / unit.getX(); - double scaledY = (y - zero.getY()) / unit.getY(); - double scaledZ = (z - zero.getZ()) / unit.getZ(); + double scaledX = (x - zero.x()) / unit.x(); + double scaledY = (y - zero.y()) / unit.y(); + double scaledZ = (z - zero.z()) / unit.z(); try { if (expression.evaluate(new double[]{scaledX, scaledY, scaledZ}, timeout) <= 0) { @@ -3717,9 +3717,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } private void setExistingBlocks(BlockVector3 pos1, BlockVector3 pos2) { - for (int x = pos1.getX(); x <= pos2.getX(); x++) { - for (int z = pos1.getBlockZ(); z <= pos2.getBlockZ(); z++) { - for (int y = pos1.getY(); y <= pos2.getY(); y++) { + for (int x = pos1.x(); x <= pos2.x(); x++) { + for (int z = pos1.z(); z <= pos2.z(); z++) { + for (int y = pos1.y(); y <= pos2.y(); y++) { setBlock(x, y, z, getFullBlock(x, y, z)); } } @@ -3735,10 +3735,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { if (fe != null && cuboid) { BlockVector3 max = region.getMaximumPoint(); BlockVector3 min = region.getMinimumPoint(); - if (!fe.contains(max.getBlockX(), max.getBlockY(), max.getBlockZ()) && !fe.contains( - min.getBlockX(), - min.getBlockY(), - min.getBlockZ() + if (!fe.contains(max.x(), max.y(), max.z()) && !fe.contains( + min.x(), + min.y(), + min.z() )) { throw FaweCache.OUTSIDE_REGION; } @@ -3748,17 +3748,17 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { MutableBlockVector3 mutable2 = new MutableBlockVector3(); MutableBlockVector2 mutable2D = new MutableBlockVector2(); for (BlockVector2 chunk : chunks) { - final int cx = chunk.getBlockX(); - final int cz = chunk.getBlockZ(); + final int cx = chunk.x(); + final int cz = chunk.z(); final int bx = cx << 4; final int bz = cz << 4; final BlockVector3 cmin = BlockVector3.at(bx, 0, bz); final BlockVector3 cmax = cmin.add(15, maxY, 15); final boolean containsBot1 = - fe == null || fe.contains(cmin.getBlockX(), cmin.getBlockY(), cmin.getBlockZ()); + fe == null || fe.contains(cmin.x(), cmin.y(), cmin.z()); final boolean containsBot2 = region.contains(cmin); final boolean containsTop1 = - fe == null || fe.contains(cmax.getBlockX(), cmax.getBlockY(), cmax.getBlockZ()); + fe == null || fe.contains(cmax.x(), cmax.y(), cmax.z()); final boolean containsTop2 = region.contains(cmax); if (containsBot2 && containsTop2 && !containsBot1 && !containsTop1) { continue; @@ -3917,15 +3917,15 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { double seedY = ThreadLocalRandom.current().nextDouble(); double seedZ = ThreadLocalRandom.current().nextDouble(); - int px = position.getBlockX(); - int py = position.getBlockY(); - int pz = position.getBlockZ(); + int px = position.x(); + int py = position.y(); + int pz = position.z(); double distort = frequency / size; - double modX = 1d / radius.getX(); - double modY = 1d / radius.getY(); - double modZ = 1d / radius.getZ(); + double modX = 1d / radius.x(); + double modY = 1d / radius.y(); + double modZ = 1d / radius.z(); int r = (int) size; int radiusSqr = (int) (size * size); int sizeInt = (int) size * 2; @@ -3986,9 +3986,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { // so it must be set each time mutable.setComponents(xr, yr, zr); Vector3 pt = transform.apply(mutable); - x = MathMan.roundInt(pt.getX()); - y = MathMan.roundInt(pt.getY()); - z = MathMan.roundInt(pt.getZ()); + x = MathMan.roundInt(pt.x()); + y = MathMan.roundInt(pt.y()); + z = MathMan.roundInt(pt.z()); xScaled = Math.abs(x) * modX; yScaled = Math.abs(y) * modY; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java index 57ec6f186..7e2ba4549 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -52,12 +52,26 @@ import java.util.Set; public abstract class LocalConfiguration { private static final Logger LOGGER = LogManagerCompat.getLogger(); + //FAWE start - inelegant but required to transfer to FAWE limits as defaults + public static int MAX_RADIUS; + public static int MAX_SUPER_RADIUS; + public static int MAX_BRUSH_RADIUS; + public static int MAX_BUTCHER_RADIUS; + //FAWE end public boolean profile = false; public boolean traceUnflushedSessions = true; public Set disallowedBlocks = new HashSet<>(); protected BlockMask disallowedBlocksMask; + /** + * @deprecated Use actor's limit {@link com.fastasyncworldedit.core.limit.FaweLimit#MAX_CHANGES} + */ + @Deprecated public int defaultChangeLimit = -1; + /** + * @deprecated Use actor's limit {@link com.fastasyncworldedit.core.limit.FaweLimit#MAX_CHANGES} + */ + @Deprecated public int maxChangeLimit = -1; public int defaultVerticalHeight = 256; public int defaultMaxPolygonalPoints = -1; @@ -68,8 +82,20 @@ public abstract class LocalConfiguration { public boolean snapshotsConfigured = false; public SnapshotRepository snapshotRepo = null; public SnapshotDatabase snapshotDatabase = null; + /** + * @deprecated Use actor's limit {@link com.fastasyncworldedit.core.limit.FaweLimit#MAX_RADIUS} + */ + @Deprecated public int maxRadius = -1; + /** + * @deprecated Use actor's limit {@link com.fastasyncworldedit.core.limit.FaweLimit#MAX_SUPER_PICKAXE_SIZE} + */ + @Deprecated public int maxSuperPickaxeSize = 5; + /** + * @deprecated Use actor's limit {@link com.fastasyncworldedit.core.limit.FaweLimit#MAX_BRUSH_RADIUS} + */ + @Deprecated public int maxBrushRadius = 6; public boolean logCommands = false; public String logFile = ""; @@ -92,6 +118,10 @@ public abstract class LocalConfiguration { public String scriptsDir = "craftscripts"; public boolean showHelpInfo = true; // unused public int butcherDefaultRadius = -1; + /** + * @deprecated Use actor's limit {@link com.fastasyncworldedit.core.limit.FaweLimit#MAX_BUTCHER_RADIUS} + */ + @Deprecated public int butcherMaxRadius = -1; public boolean allowSymlinks = false; public boolean serverSideCUI = true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/MaxBrushRadiusException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/MaxBrushRadiusException.java index 76a640c66..cb1371451 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/MaxBrushRadiusException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/MaxBrushRadiusException.java @@ -19,9 +19,24 @@ package com.sk89q.worldedit; +import com.fastasyncworldedit.core.exception.BrushRadiusLimitException; +import com.fastasyncworldedit.core.exception.RadiusLimitException; + /** * Thrown when a maximum radius for a brush is reached. + * + * @deprecated Use {@link RadiusLimitException} */ +@Deprecated public class MaxBrushRadiusException extends MaxRadiusException { + //FAWE start + + /** + * @deprecated Use {@link BrushRadiusLimitException} + */ + @Deprecated + public MaxBrushRadiusException() { + } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/MaxRadiusException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/MaxRadiusException.java index 6641c063c..1e5da912f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/MaxRadiusException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/MaxRadiusException.java @@ -19,10 +19,24 @@ package com.sk89q.worldedit; +import com.fastasyncworldedit.core.exception.RadiusLimitException; + /** * Thrown when a maximum radius is reached, such as, for example, * in the case of a sphere command. + * + * @deprecated Use {@link RadiusLimitException} */ +@Deprecated public class MaxRadiusException extends WorldEditException { + //FAWE start + /** + * @deprecated Use {@link RadiusLimitException} + */ + @Deprecated + public MaxRadiusException() { + } + //FAWE end + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index 2c62e08ec..be4c9af8c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -20,6 +20,8 @@ package com.sk89q.worldedit; import com.fastasyncworldedit.core.configuration.Caption; +import com.fastasyncworldedit.core.exception.BrushRadiusLimitException; +import com.fastasyncworldedit.core.exception.RadiusLimitException; import com.fastasyncworldedit.core.extension.factory.TransformFactory; import com.fastasyncworldedit.core.extent.ResettableExtent; import com.google.common.base.Throwables; @@ -437,7 +439,9 @@ public final class WorldEdit { * * @param radius the radius * @throws MaxRadiusException if the radius is bigger than the configured radius + * @deprecated Use {@link WorldEdit#checkMaxRadius(double, Actor)} */ + @Deprecated public void checkMaxRadius(double radius) throws MaxRadiusException { if (getConfiguration().maxRadius > 0 && radius > getConfiguration().maxRadius) { throw new MaxRadiusException(); @@ -449,7 +453,9 @@ public final class WorldEdit { * * @param radius the radius * @throws MaxBrushRadiusException if the radius is bigger than the configured radius + * @deprecated Use {@link WorldEdit#checkMaxBrushRadius(double, Actor)} */ + @Deprecated public void checkMaxBrushRadius(double radius) throws MaxBrushRadiusException { if (getConfiguration().maxBrushRadius > 0 && radius > getConfiguration().maxBrushRadius) { throw new MaxBrushRadiusException(); @@ -457,6 +463,10 @@ public final class WorldEdit { } //FAWE start + /** + * @deprecated Use {@link WorldEdit#checkMaxBrushRadius(Expression, Actor)} + */ + @Deprecated(forRemoval = true, since = "TODO") public void checkMaxBrushRadius(Expression radius) throws MaxBrushRadiusException { double val = radius.evaluate(); checkArgument(val >= 0, "Radius must be a positive number."); @@ -466,6 +476,53 @@ public final class WorldEdit { } } } + + /** + * Check the given radius against the give actor's limit. + * + * @param radius Radius to check + * @param actor Actor to check for + * @throws MaxRadiusException If given radius larger than allowed + * @since TODO + */ + public void checkMaxRadius(double radius, Actor actor) { + int max = actor.getLimit().MAX_RADIUS; + if (max > 0 && radius > max) { + throw new RadiusLimitException(max); + } + } + + /** + * Check the given radius against the give actor's limit. + * + * @param radius Radius to check + * @param actor Actor to check for + * @throws MaxRadiusException If given radius larger than allowed + * @since TODO + */ + public void checkMaxBrushRadius(double radius, Actor actor) { + int max = actor.getLimit().MAX_BRUSH_RADIUS; + if (max > 0 && radius > max) { + throw new RadiusLimitException(max); + } + } + + /** + * Check the given radius against the give actor's limit. + * + * @param expression Radius to check + * @param actor Actor to check for + * @throws BrushRadiusLimitException If given radius larger than allowed + * @since TODO + */ + public void checkMaxBrushRadius(Expression expression, Actor actor) { + double radius = expression.evaluate(); + checkArgument(radius >= 0, "Radius must be a positive number."); + int max = actor.getLimit().MAX_BRUSH_RADIUS; + if (max > 0 && radius > max) { + throw new BrushRadiusLimitException(max); + } + } //FAWE end /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 76cb60c64..7160be750 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -186,7 +186,10 @@ public class BrushCommands { @ArgFlag(name = 'm', desc = "Mask to limit blocks being considered", def = "") Mask mask ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); checkCommandArgument(minFreqDiff >= 0 && minFreqDiff <= 26, "minFreqDiff not in range 0 <= value <= 26"); if (mask != null && !(mask instanceof CachedMask)) { mask = new CachedMask(mask, false); @@ -212,7 +215,10 @@ public class BrushCommands { @Arg(desc = "fillRec", def = "1") int fillRec ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new ErodeBrush(erodefaces, erodeRec, fillFaces, fillRec), "worldedit.brush.erode").setSize(radius); } @@ -234,7 +240,10 @@ public class BrushCommands { @Arg(desc = "fillRec", def = "1") int fillRec ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new RaiseBrush(erodefaces, erodeRec, fillFaces, fillRec), "worldedit.brush.pull").setSize(radius); } @@ -252,7 +261,10 @@ public class BrushCommands { @Arg(name = "filled", desc = "Whether the circle should be filled", def = "false") boolean filled ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new CircleBrush(filled), "worldedit.brush.sphere").setSize(radius).setFill(fill); } @@ -276,7 +288,10 @@ public class BrushCommands { @Switch(name = 'd', desc = "Apply in depth first order") boolean depthFirst ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new RecurseBrush(depthFirst), "worldedit.brush.recursive").setSize(radius).setFill(fill) .setMask(new IdMask(editSession)); } @@ -299,7 +314,10 @@ public class BrushCommands { @Switch(name = 'f', desc = "Create a flat line") boolean flat ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new LineBrush(shell, select, flat), "worldedit.brush.line").setSize(radius).setFill(fill); } @@ -326,7 +344,10 @@ public class BrushCommands { Expression radius ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius))); set(context, new SplineBrush(player), "worldedit.brush.spline").setSize(radius).setFill(fill); } @@ -379,7 +400,10 @@ public class BrushCommands { @Switch(name = 'd', desc = "sags the catenary toward the facing direction") boolean facingDirection ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new CatenaryBrush(shell, select, facingDirection, lengthFactor), "worldedit.brush.spline") .setSize(radius).setFill(fill); } @@ -411,7 +435,10 @@ public class BrushCommands { double quality ) throws WorldEditException { player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius))); - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new SurfaceSpline(tension, bias, continuity, quality), "surfacespline").setSize(radius) .setFill(fill); } @@ -435,10 +462,12 @@ public class BrushCommands { @Arg(desc = "double", def = "50") double amplitude ) throws WorldEditException { - double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ()); - worldEdit.checkMaxBrushRadius(max); - Brush brush = - new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100); + double max = MathMan.max(radius.x(), radius.y(), radius.z()); + worldEdit.checkMaxBrushRadius( + max, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); + Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100); set(context, brush, "worldedit.brush.rock").setSize(max).setFill(fill); } @@ -459,7 +488,10 @@ public class BrushCommands { @Arg(desc = "Lines", def = "10") int count ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new ShatterBrush(count), "worldedit.brush.shatter").setSize(radius).setFill(fill) .setMask(new ExistingBlockMask(editSession)); } @@ -490,7 +522,10 @@ public class BrushCommands { boolean randomRotate ) throws WorldEditException, FileNotFoundException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); InputStream stream = getHeightmapStream(image); HeightBrush brush; int minY = player.getWorld().getMinY(); @@ -526,7 +561,10 @@ public class BrushCommands { URL url = new URL(imageURL); MainUtil.checkImageHost(url.toURI()); BufferedImage image = MainUtil.readImage(url); - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); if (yscale != 1) { ImageUtil.scaleAlpha(image, yscale); alpha = true; @@ -553,7 +591,10 @@ public class BrushCommands { @Arg(desc = "Expression", def = "5") Expression radius ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new SurfaceSphereBrush(), "worldedit.brush.surface").setFill(fill).setSize(radius); } @@ -578,7 +619,10 @@ public class BrushCommands { @Switch(name = 'o', desc = "Overlay the block") boolean overlay ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); Brush brush; if (overlay) { brush = new ScatterOverlayBrush((int) points, (int) distance); @@ -612,7 +656,10 @@ public class BrushCommands { @Switch(name = 'r', desc = "Apply random rotation") boolean rotate ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); try { MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true); @@ -651,7 +698,10 @@ public class BrushCommands { List patternLayers ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new LayerBrush(patternLayers.toArray(new Pattern[0])), "worldedit.brush.layer").setSize(radius); } @@ -678,7 +728,10 @@ public class BrushCommands { @Arg(desc = "boolean", def = "true") boolean solid ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new SplatterBrush((int) points, (int) recursion, solid), "worldedit.brush.splatter").setSize(radius) .setFill(fill); } @@ -711,7 +764,10 @@ public class BrushCommands { boolean print ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set( context, new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " "), print), @@ -838,7 +894,10 @@ public class BrushCommands { InjectedValueAccess context ) throws WorldEditException, FileNotFoundException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); InputStream stream = getHeightmapStream(image); HeightBrush brush; int minY = player.getWorld().getMinY(); @@ -908,7 +967,10 @@ public class BrushCommands { @Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); player.print(Caption.of("fawe.worldedit.brush.brush.copy", (radius))); set(context, new CopyPastaBrush(player, session, randomRotate, autoRotate), "worldedit.brush.copy").setSize(radius); @@ -933,7 +995,10 @@ public class BrushCommands { @Switch(name = 'p', desc = "Show any printed output") boolean print ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); String cmd = StringMan.join(input, " "); set(context, new CommandBrush(cmd, print), "worldedit.brush.command").setSize(radius); } @@ -1042,7 +1107,7 @@ public class BrushCommands { String permission ) throws WorldEditException { - WorldEdit.getInstance().checkMaxBrushRadius(radius); + WorldEdit.getInstance().checkMaxBrushRadius(radius, player); BrushTool tool = session.getBrushTool(player); tool.setSize(radius); tool.setFill(null); @@ -1197,7 +1262,10 @@ public class BrushCommands { @Switch(name = 'f', desc = "Create falling spheres instead") boolean falling ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); Brush brush; if (hollow) { brush = new HollowSphereBrush(); @@ -1244,8 +1312,14 @@ public class BrushCommands { @Switch(name = 'h', desc = "Create hollow cylinders instead") boolean hollow ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - worldEdit.checkMaxBrushRadius(height); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); + worldEdit.checkMaxBrushRadius( + height, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); BrushSettings settings; if (hollow) { @@ -1293,9 +1367,18 @@ public class BrushCommands { BlockVector3 size = clipboard.getDimensions(); - worldEdit.checkMaxBrushRadius(size.getBlockX() / 2D - 1); - worldEdit.checkMaxBrushRadius(size.getBlockY() / 2D - 1); - worldEdit.checkMaxBrushRadius(size.getBlockZ() / 2D - 1); + worldEdit.checkMaxBrushRadius( + size.x() / 2D - 1, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); + worldEdit.checkMaxBrushRadius( + size.y() / 2D - 1, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); + worldEdit.checkMaxBrushRadius( + size.z() / 2D - 1, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set( context, @@ -1324,7 +1407,10 @@ public class BrushCommands { Mask mask, InjectedValueAccess context ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); //FAWE start FaweLimit limit = Settings.settings().getLimit(player); @@ -1359,7 +1445,10 @@ public class BrushCommands { @ArgFlag(name = 'm', desc = "The mask of blocks to use for the heightmap") Mask mask, InjectedValueAccess context ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); //FAWE start FaweLimit limit = Settings.settings().getLimit(player); @@ -1386,7 +1475,10 @@ public class BrushCommands { @Arg(desc = "The radius to extinguish", def = "5") Expression radius ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new SphereBrush(), "worldedit.brush.ex").setSize(radius).setFill(BlockTypes.AIR.getDefaultState()) .setMask(new SingleBlockTypeMask(editSession, BlockTypes.FIRE)); @@ -1405,7 +1497,10 @@ public class BrushCommands { @Switch(name = 'h', desc = "Affect blocks starting at max Y, rather than the target location Y + radius") boolean fromMaxY ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); set(context, new GravityBrush(fromMaxY), "worldedit.brush.gravity").setSize(radius); } @@ -1439,7 +1534,10 @@ public class BrushCommands { @Switch(name = 'w', desc = "Also kill water mobs") boolean killWater, InjectedValueAccess context ) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); + worldEdit.checkMaxBrushRadius( + radius, + context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player")) + ); CreatureButcher flags = new CreatureButcher(player); flags.or( @@ -1508,7 +1606,7 @@ public class BrushCommands { RegionFactory shape, String permission ) throws WorldEditException { - WorldEdit.getInstance().checkMaxBrushRadius(radius); + WorldEdit.getInstance().checkMaxBrushRadius(radius, player); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setFill(null); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index ddb3fabba..c6e82a6a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -151,8 +151,8 @@ public class ClipboardCommands { BlockVector3 max = region.getMaximumPoint(); long volume = - ((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min - .getZ() + 1); + ((long) max.x() - (long) min.x() + 1) * ((long) max.y() - (long) min.y() + 1) * ((long) max.z() - (long) min + .z() + 1); FaweLimit limit = actor.getLimit(); if (volume >= limit.MAX_CHECKS) { throw FaweCache.MAX_CHECKS; @@ -185,8 +185,8 @@ public class ClipboardCommands { ) throws WorldEditException { BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); - long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min - .getZ() + 1)); + long volume = (((long) max.x() - (long) min.x() + 1) * ((long) max.y() - (long) min.y() + 1) * ((long) max.z() - (long) min + .z() + 1)); FaweLimit limit = actor.getLimit(); if (volume >= limit.MAX_CHECKS) { throw FaweCache.MAX_CHECKS; @@ -258,8 +258,8 @@ public class ClipboardCommands { BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); - long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min - .getZ() + 1)); + long volume = (((long) max.x() - (long) min.x() + 1) * ((long) max.y() - (long) min.y() + 1) * ((long) max.z() - (long) min + .z() + 1)); FaweLimit limit = actor.getLimit(); if (volume >= limit.MAX_CHECKS) { throw FaweCache.MAX_CHECKS; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java index 14e3d3307..d32504ad4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java @@ -79,12 +79,12 @@ public class FlattenedClipboardTransform { Vector3[] corners = new Vector3[]{ minimum, maximum, - minimum.withX(maximum.getX()), - minimum.withY(maximum.getY()), - minimum.withZ(maximum.getZ()), - maximum.withX(minimum.getX()), - maximum.withY(minimum.getY()), - maximum.withZ(minimum.getZ()) + minimum.withX(maximum.x()), + minimum.withY(maximum.y()), + minimum.withZ(maximum.z()), + maximum.withX(minimum.x()), + maximum.withY(minimum.y()), + maximum.withZ(minimum.z()) }; for (int i = 0; i < corners.length; i++) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index d3d456965..4b2f98e0c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -130,9 +130,9 @@ public class GenerationCommands { return 0; } } - worldEdit.checkMaxRadius(radiusX); - worldEdit.checkMaxRadius(radiusZ); - worldEdit.checkMaxRadius(height); + worldEdit.checkMaxRadius(radiusX, actor); + worldEdit.checkMaxRadius(radiusZ, actor); + worldEdit.checkMaxRadius(height, actor); if (thickness > radiusX || thickness > radiusZ) { actor.print(Caption.of("worldedit.hcyl.thickness-too-large")); @@ -178,9 +178,9 @@ public class GenerationCommands { } } - worldEdit.checkMaxRadius(radiusX); - worldEdit.checkMaxRadius(radiusZ); - worldEdit.checkMaxRadius(height); + worldEdit.checkMaxRadius(radiusX, actor); + worldEdit.checkMaxRadius(radiusZ, actor); + worldEdit.checkMaxRadius(height, actor); BlockVector3 pos = session.getPlacementPosition(actor); int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow); @@ -224,9 +224,9 @@ public class GenerationCommands { } } - worldEdit.checkMaxRadius(radiusX); - worldEdit.checkMaxRadius(radiusZ); - worldEdit.checkMaxRadius(height); + worldEdit.checkMaxRadius(radiusX, actor); + worldEdit.checkMaxRadius(radiusZ, actor); + worldEdit.checkMaxRadius(height, actor); BlockVector3 pos = session.getPlacementPosition(actor); int affected = editSession.makeCone(pos, pattern, radiusX, radiusZ, height, !hollow, thickness); @@ -290,9 +290,9 @@ public class GenerationCommands { } } - worldEdit.checkMaxRadius(radiusX); - worldEdit.checkMaxRadius(radiusY); - worldEdit.checkMaxRadius(radiusZ); + worldEdit.checkMaxRadius(radiusX, actor); + worldEdit.checkMaxRadius(radiusY, actor); + worldEdit.checkMaxRadius(radiusZ, actor); BlockVector3 pos = session.getPlacementPosition(actor); if (raised) { pos = pos.add(0, (int) radiusY, 0); @@ -323,7 +323,7 @@ public class GenerationCommands { double density ) throws WorldEditException { checkCommandArgument(0 <= density && density <= 100, "Density must be between 0 and 100"); - worldEdit.checkMaxRadius(size); + worldEdit.checkMaxRadius(size, actor); density /= 100; int affected = editSession.makeForest(session.getPlacementPosition(actor), size, density, type); actor.print(Caption.of("worldedit.forestgen.created", TextComponent.of(affected))); @@ -345,7 +345,7 @@ public class GenerationCommands { double density ) throws WorldEditException { checkCommandArgument(0 <= density && density <= 100, "Density must be between 0 and 100"); - worldEdit.checkMaxRadius(size); + worldEdit.checkMaxRadius(size, actor); int affected = editSession.makePumpkinPatches(session.getPlacementPosition(actor), size, density); actor.print(Caption.of("worldedit.pumpkins.created", TextComponent.of(affected))); return affected; @@ -382,7 +382,7 @@ public class GenerationCommands { @Switch(name = 'h', desc = "Make a hollow pyramid") boolean hollow ) throws WorldEditException { - worldEdit.checkMaxRadius(size); + worldEdit.checkMaxRadius(size, actor); BlockVector3 pos = session.getPlacementPosition(actor); int affected = editSession.makePyramid(pos, pattern, size, !hollow); if (actor instanceof Player && Settings.settings().GENERAL.UNSTUCK_ON_GENERATE) { @@ -440,13 +440,13 @@ public class GenerationCommands { zero = max.add(min).multiply(0.5); unit = max.subtract(zero); - if (unit.getX() == 0) { + if (unit.x() == 0) { unit = unit.withX(1.0); } - if (unit.getY() == 0) { + if (unit.y() == 0) { unit = unit.withY(1.0); } - if (unit.getZ() == 0) { + if (unit.z() == 0) { unit = unit.withZ(1.0); } } @@ -526,13 +526,13 @@ public class GenerationCommands { zero = max.add(min).multiply(0.5); unit = max.subtract(zero); - if (unit.getX() == 0) { + if (unit.x() == 0) { unit = unit.withX(1.0); } - if (unit.getY() == 0) { + if (unit.y() == 0) { unit = unit.withY(1.0); } - if (unit.getZ() == 0) { + if (unit.z() == 0) { unit = unit.withZ(1.0); } } @@ -636,7 +636,7 @@ public class GenerationCommands { MainUtil.checkImageHost(url.toURI()); if (dimensions != null) { checkCommandArgument( - (long) dimensions.getX() * dimensions.getZ() <= Settings.settings().WEB.MAX_IMAGE_SIZE, + (long) dimensions.x() * dimensions.z() <= Settings.settings().WEB.MAX_IMAGE_SIZE, Caption.of("fawe.error.image-dimensions", Settings.settings().WEB.MAX_IMAGE_SIZE) ); } @@ -644,7 +644,7 @@ public class GenerationCommands { Future future = executor.submit(() -> { BufferedImage image = MainUtil.readImage(url); if (dimensions != null) { - image = ImageUtil.getScaledInstance(image, dimensions.getBlockX(), dimensions.getBlockZ(), + image = ImageUtil.getScaledInstance(image, dimensions.x(), dimensions.z(), RenderingHints.VALUE_INTERPOLATION_BILINEAR, false ); } @@ -668,8 +668,8 @@ public class GenerationCommands { CuboidRegion region = new CuboidRegion(pos1, pos2); final BufferedImage finalImage = image; RegionVisitor visitor = new RegionVisitor(region, pos -> { - int x = pos.getBlockX() - pos1.getBlockX(); - int z = pos.getBlockZ() - pos1.getBlockZ(); + int x = pos.x() - pos1.x(); + int z = pos.z() - pos1.z(); int color = finalImage.getRGB(x, z); BlockType block = tu.getNearestBlock(color); if (block != null) { @@ -735,8 +735,8 @@ public class GenerationCommands { @Arg(desc = "double", def = "50") double amplitude ) throws WorldEditException { - double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ()); - worldEdit.checkMaxRadius(max); + double max = MathMan.max(radius.x(), radius.y(), radius.z()); + worldEdit.checkMaxRadius(max, actor); BlockVector3 pos = session.getPlacementPosition(actor); int affected = editSession.makeBlob( pos, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java index 08f48b265..8d28ad1eb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java @@ -13,10 +13,7 @@ import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.StringMan; import com.google.common.base.Function; import com.google.common.collect.Lists; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.EditSessionBuilder; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.argument.Arguments; import com.sk89q.worldedit.command.util.CommandPermissions; @@ -25,7 +22,6 @@ import com.sk89q.worldedit.command.util.annotation.Confirm; import com.sk89q.worldedit.command.util.annotation.Time; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.function.operation.ChangeSetExecutor; import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; @@ -245,11 +241,11 @@ public class HistorySubCommands { BlockVector3 pos1 = edit.getMinimumPoint(); BlockVector3 pos2 = edit.getMaximumPoint(); - double distanceX = Math.min(Math.abs(pos1.getX() - origin.getX()), Math.abs(pos2.getX() - origin.getX())); - double distanceZ = Math.min(Math.abs(pos1.getZ() - origin.getZ()), Math.abs(pos2.getZ() - origin.getZ())); + double distanceX = Math.min(Math.abs(pos1.x() - origin.x()), Math.abs(pos2.x() - origin.x())); + double distanceZ = Math.min(Math.abs(pos1.z() - origin.z()), Math.abs(pos2.z() - origin.z())); int distance = (int) Math.sqrt(distanceX * distanceX + distanceZ * distanceZ); - BlockVector2 dirVec = BlockVector2.at(edit.getOriginX() - origin.getX(), edit.getOriginZ() - origin.getZ()); + BlockVector2 dirVec = BlockVector2.at(edit.getOriginX() - origin.x(), edit.getOriginZ() - origin.z()); Direction direction = Direction.findClosest(dirVec.toVector3(), Direction.Flag.ALL); long seconds = (System.currentTimeMillis() - edit.getBDFile().lastModified()) / 1000; @@ -326,13 +322,13 @@ public class HistorySubCommands { BlockVector3 pos1 = rollback.getMinimumPoint(); BlockVector3 pos2 = rollback.getMaximumPoint(); - double distanceX = Math.min(Math.abs(pos1.getX() - origin.getX()), Math.abs(pos2.getX() - origin.getX())); - double distanceZ = Math.min(Math.abs(pos1.getZ() - origin.getZ()), Math.abs(pos2.getZ() - origin.getZ())); + double distanceX = Math.min(Math.abs(pos1.x() - origin.x()), Math.abs(pos2.x() - origin.x())); + double distanceZ = Math.min(Math.abs(pos1.z() - origin.z()), Math.abs(pos2.z() - origin.z())); int distance = (int) Math.sqrt(distanceX * distanceX + distanceZ * distanceZ); BlockVector2 dirVec = BlockVector2.at( - rollback.getOriginX() - origin.getX(), - rollback.getOriginZ() - origin.getZ() + rollback.getOriginX() - origin.x(), + rollback.getOriginZ() - origin.z() ); Direction direction = Direction.findClosest(dirVec.toVector3(), Direction.Flag.ALL); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index 73cb34274..6a121aa02 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -351,8 +351,8 @@ public class RegionCommands { int affected = 0; while (iter.hasNext()) { BlockVector2 pos = iter.next(); - int x = pos.getBlockX(); - int z = pos.getBlockZ(); + int x = pos.x(); + int z = pos.z(); //FAWE start - world min/maxY y = editSession.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY); //FAWE end @@ -449,8 +449,8 @@ public class RegionCommands { //FAWE end BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); - long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min - .getZ() + 1)); + long volume = (((long) max.x() - (long) min.x() + 1) * ((long) max.y() - (long) min.y() + 1) * ((long) max.z() - (long) min + .z() + 1)); FaweLimit limit = actor.getLimit(); if (volume >= limit.MAX_CHECKS) { throw FaweCache.MAX_CHECKS; @@ -772,13 +772,13 @@ public class RegionCommands { zero = max.add(min).divide(2); unit = max.subtract(zero); - if (unit.getX() == 0) { + if (unit.x() == 0) { unit = unit.withX(1.0); } - if (unit.getY() == 0) { + if (unit.y() == 0) { unit = unit.withY(1.0); } - if (unit.getZ() == 0) { + if (unit.z() == 0) { unit = unit.withZ(1.0); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java index a643742d2..d8e0943dc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java @@ -262,12 +262,12 @@ public class SelectionCommands { actor.print(Caption.of( "worldedit.chunk.selected-multiple", - TextComponent.of(minChunk.getBlockX()), - TextComponent.of(minChunk.getBlockY()), - TextComponent.of(minChunk.getBlockZ()), - TextComponent.of(maxChunk.getBlockX()), - TextComponent.of(maxChunk.getBlockY()), - TextComponent.of(maxChunk.getBlockZ()) + TextComponent.of(minChunk.x()), + TextComponent.of(minChunk.y()), + TextComponent.of(minChunk.z()), + TextComponent.of(maxChunk.x()), + TextComponent.of(maxChunk.y()), + TextComponent.of(maxChunk.z()) )); } else { BlockVector3 minChunk; @@ -290,9 +290,9 @@ public class SelectionCommands { actor.print(Caption.of( "worldedit.chunk.selected", - TextComponent.of(minChunk.getBlockX()), - TextComponent.of(minChunk.getBlockY()), - TextComponent.of(minChunk.getBlockZ()) + TextComponent.of(minChunk.x()), + TextComponent.of(minChunk.y()), + TextComponent.of(minChunk.z()) )); } @@ -538,10 +538,10 @@ public class SelectionCommands { .subtract(region.getMinimumPoint()).add(1, 1, 1); BlockVector3 origin = clipboard.getOrigin(); - String sizeStr = size.getBlockX() + "*" + size.getBlockY() + "*" + size.getBlockZ(); - String originStr = origin.getBlockX() + "," + origin.getBlockY() + "," + origin.getBlockZ(); + String sizeStr = size.x() + "*" + size.y() + "*" + size.z(); + String originStr = origin.x() + "," + origin.y() + "," + origin.z(); - long numBlocks = ((long) size.getBlockX() * size.getBlockY() * size.getBlockZ()); + long numBlocks = ((long) size.x() * size.y() * size.z()); actor.print(Caption.of( "worldedit.size.offset", TextComponent.of(name), diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java index cb24daec5..fdd86498f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java @@ -66,10 +66,11 @@ public class SuperPickaxeCommands { int range ) throws WorldEditException { - LocalConfiguration config = we.getConfiguration(); - - if (range > config.maxSuperPickaxeSize) { - player.print(Caption.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize))); + if (range > player.getLimit().MAX_SUPER_PICKAXE_SIZE) { + player.print(Caption.of( + "worldedit.tool.superpickaxe.max-range", + TextComponent.of(player.getLimit().MAX_SUPER_PICKAXE_SIZE) + )); return; } session.setSuperPickaxe(new AreaPickaxe(range)); @@ -89,10 +90,11 @@ public class SuperPickaxeCommands { double range ) throws WorldEditException { - LocalConfiguration config = we.getConfiguration(); - - if (range > config.maxSuperPickaxeSize) { - player.print(Caption.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize))); + if (range > player.getLimit().MAX_SUPER_PICKAXE_SIZE) { + player.print(Caption.of( + "worldedit.tool.superpickaxe.max-range", + TextComponent.of(player.getLimit().MAX_SUPER_PICKAXE_SIZE) + )); return; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java index 8395b2e2d..95499372c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java @@ -297,10 +297,11 @@ public class ToolCommands { int range ) throws WorldEditException { - LocalConfiguration config = we.getConfiguration(); - - if (range > config.maxSuperPickaxeSize) { - player.print(Caption.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize))); + if (range > player.getLimit().MAX_SUPER_PICKAXE_SIZE) { + player.print(Caption.of( + "worldedit.tool.superpickaxe.max-range", + TextComponent.of(player.getLimit().MAX_SUPER_PICKAXE_SIZE) + )); return; } setTool(player, session, new FloodFillTool(range, pattern), "worldedit.tool.floodfill.equip"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java index 0694b2af3..48fb76318 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java @@ -154,7 +154,7 @@ public class ToolUtilCommands { @Arg(desc = "The size of the brush") int size ) throws WorldEditException { - we.checkMaxBrushRadius(size); + we.checkMaxBrushRadius(size, player); session.getBrushTool(player).setSize(size); player.print(Caption.of("worldedit.tool.size.set")); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index aca13bc46..a289f7cff 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -50,19 +50,12 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.function.EntityFunction; -import com.sk89q.worldedit.function.block.BlockReplace; import com.sk89q.worldedit.function.mask.BlockTypeMask; -import com.sk89q.worldedit.function.mask.BoundedHeightMask; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.mask.MaskIntersection; -import com.sk89q.worldedit.function.mask.Masks; -import com.sk89q.worldedit.function.mask.RegionMask; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.visitor.DownwardVisitor; import com.sk89q.worldedit.function.visitor.EntityVisitor; -import com.sk89q.worldedit.function.visitor.RecursiveVisitor; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.VertHeight; import com.sk89q.worldedit.internal.expression.EvaluationException; @@ -70,10 +63,8 @@ import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector2; -import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CylinderRegion; -import com.sk89q.worldedit.regions.EllipsoidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.formatting.component.SubtleFormat; import com.sk89q.worldedit.util.formatting.text.Component; @@ -246,8 +237,9 @@ public class UtilityCommands { double radius = radiusExp.evaluate(); //FAWE end radius = Math.max(1, radius); - we.checkMaxRadius(radius); + we.checkMaxRadius(radius, actor); depth = Math.max(1, depth); + we.checkMaxRadius(depth, actor); BlockVector3 pos = session.getPlacementPosition(actor); int affected = editSession.fillDirection(pos, pattern, radius, depth, direction); @@ -333,9 +325,9 @@ public class UtilityCommands { double radius = radiusExp.evaluate(); //FAWE end radius = Math.max(1, radius); - we.checkMaxRadius(radius); + we.checkMaxRadius(radius, actor); depth = depth == null ? Integer.MAX_VALUE : Math.max(1, depth); - we.checkMaxRadius(radius); + we.checkMaxRadius(radius, actor); BlockVector3 pos = session.getPlacementPosition(actor); int affected = editSession.fillXZ(pos, pattern, radius, depth, true); @@ -364,7 +356,7 @@ public class UtilityCommands { //FAWE end double radius = radiusExp.evaluate(); radius = Math.max(0, radius); - we.checkMaxRadius(radius); + we.checkMaxRadius(radius, actor); int affected = editSession.drainArea(session.getPlacementPosition(actor), radius, waterlogged, plants); actor.print(Caption.of("worldedit.drain.drained", TextComponent.of(affected))); return affected; @@ -383,7 +375,7 @@ public class UtilityCommands { double radius ) throws WorldEditException { radius = Math.max(0, radius); - we.checkMaxRadius(radius); + we.checkMaxRadius(radius, actor); int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.LAVA); actor.print(Caption.of("worldedit.fixlava.fixed", TextComponent.of(affected))); return affected; @@ -402,7 +394,7 @@ public class UtilityCommands { double radius ) throws WorldEditException { radius = Math.max(0, radius); - we.checkMaxRadius(radius); + we.checkMaxRadius(radius, actor); int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.WATER); actor.print(Caption.of("worldedit.fixwater.fixed", TextComponent.of(affected))); return affected; @@ -423,7 +415,7 @@ public class UtilityCommands { Integer height ) throws WorldEditException { size = Math.max(1, size); - we.checkMaxRadius(size); + we.checkMaxRadius(size, actor); height = height != null ? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1) @@ -448,7 +440,7 @@ public class UtilityCommands { Integer height ) throws WorldEditException { size = Math.max(1, size); - we.checkMaxRadius(size); + we.checkMaxRadius(size, actor); height = height != null ? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1) @@ -476,7 +468,7 @@ public class UtilityCommands { new MaskTraverser(mask).setNewExtent(editSession); //FAWE end radius = Math.max(1, radius); - we.checkMaxRadius(radius); + we.checkMaxRadius(radius, actor); int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, radius); actor.print(Caption.of("worldedit.removenear.removed", TextComponent.of(affected))); @@ -503,7 +495,7 @@ public class UtilityCommands { new MaskTraverser(from).setNewExtent(editSession); //FAWE end radius = Math.max(1, radius); - we.checkMaxRadius(radius); + we.checkMaxRadius(radius, actor); BlockVector3 base = session.getPlacementPosition(actor); BlockVector3 min = base.subtract(radius, radius, radius); @@ -542,15 +534,15 @@ public class UtilityCommands { ) throws WorldEditException { size = Math.max(1, size); height = Math.max(1, height); - we.checkMaxRadius(size); + we.checkMaxRadius(size, actor); BlockVector3 position = session.getPlacementPosition(actor); CylinderRegion region = new CylinderRegion( position, Vector2.at(size, size), - position.getBlockY() - height, - position.getBlockY() + height + position.y() - height, + position.y() + height ); int affected = editSession.simulateSnow(region, stack); actor.print(Caption.of( @@ -579,7 +571,7 @@ public class UtilityCommands { ) throws WorldEditException { size = Math.max(1, size); height = Math.max(1, height); - we.checkMaxRadius(size); + we.checkMaxRadius(size, actor); int affected = editSession.thaw(session.getPlacementPosition(actor), size, height); actor.print(Caption.of( @@ -610,7 +602,7 @@ public class UtilityCommands { ) throws WorldEditException { size = Math.max(1, size); height = Math.max(1, height); - we.checkMaxRadius(size); + we.checkMaxRadius(size, actor); final boolean onlyNormalDirt = !convertCoarse; final int affected = editSession.green( @@ -635,11 +627,9 @@ public class UtilityCommands { Integer radius ) throws WorldEditException { - LocalConfiguration config = we.getConfiguration(); - - int defaultRadius = config.maxRadius != -1 ? Math.min(40, config.maxRadius) : 40; + int defaultRadius = actor.getLimit().MAX_RADIUS != -1 ? Math.min(40, actor.getLimit().MAX_RADIUS) : 40; int size = radius != null ? Math.max(1, radius) : defaultRadius; - we.checkMaxRadius(size); + we.checkMaxRadius(size, actor); Mask mask = new BlockTypeMask(editSession, BlockTypes.FIRE); int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, size); @@ -685,12 +675,12 @@ public class UtilityCommands { actor.print(Caption.of("worldedit.butcher.explain-all")); return 0; } else if (radius == -1) { - if (config.butcherMaxRadius != -1) { - radius = config.butcherMaxRadius; + if (actor.getLimit().MAX_BUTCHER_RADIUS != -1) { + radius = actor.getLimit().MAX_BUTCHER_RADIUS; } } - if (config.butcherMaxRadius != -1) { - radius = Math.min(radius, config.butcherMaxRadius); + if (actor.getLimit().MAX_BUTCHER_RADIUS != -1) { + radius = Math.min(radius, actor.getLimit().MAX_BUTCHER_RADIUS); } CreatureButcher flags = new CreatureButcher(actor); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/OffsetConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/OffsetConverter.java index 88b74a05f..22c755cb5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/OffsetConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/OffsetConverter.java @@ -98,9 +98,9 @@ public class OffsetConverter implements ArgumentConverter { // Create an affine transform of the columns (col4 is empty due to no translation) AffineTransform transform = new AffineTransform( - m1.getX(), m2.getX(), m3.getX(), 0, - m1.getY(), m2.getY(), m3.getY(), 0, - m1.getZ(), m2.getZ(), m3.getZ(), 0 + m1.x(), m2.x(), m3.x(), 0, + m1.y(), m2.y(), m3.y(), 0, + m1.z(), m2.z(), m3.z(), 0 ); return transform diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java index d6c44fa66..6021102a2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java @@ -380,7 +380,7 @@ public class BrushTool pitch = 23 - (pitch / 4); d += (int) (Math.sin(Math.toRadians(pitch)) * 50); final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d) - .add(loc.getX(), loc.getY(), loc.getZ()); + .add(loc.x(), loc.y(), loc.z()); return offset(vector, loc).toBlockPoint(); } case TARGET_POINT_HEIGHT: { @@ -477,7 +477,7 @@ public class BrushTool try { new PatternTraverser(current).reset(editSession); double size = current.getSize(); - WorldEdit.getInstance().checkMaxBrushRadius(size); + WorldEdit.getInstance().checkMaxBrushRadius(size, player); brush.build(editSession, target.toBlockPoint(), current.getMaterial(), size); } catch (MaxChangedBlocksException e) { player.print(Caption.of("worldedit.tool.max-block-changes")); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java index b82601288..bfa19b7e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java @@ -38,11 +38,11 @@ public class GravityBrush implements Brush { public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { //FAWE start - Ours operates differently to upstream, but does the same - double endY = position.getY() + size; - double startPerformY = Math.max(editSession.getMinY(), position.getY() - size); + double endY = position.y() + size; + double startPerformY = Math.max(editSession.getMinY(), position.y() - size); double startCheckY = fullHeight ? editSession.getMinY() : startPerformY; - for (double x = position.getX() + size; x > position.getX() - size; --x) { - for (double z = position.getZ() + size; z > position.getZ() - size; --z) { + for (double x = position.x() + size; x > position.x() - size; --x) { + for (double z = position.z() + size; z > position.z() - size; --z) { double freeSpot = startCheckY; for (double y = startCheckY; y <= endY; y++) { BlockState block = editSession.getBlock((int) x, (int) y, (int) z); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java index a2854a8c7..b8980afc8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Confirm.java @@ -3,7 +3,6 @@ package com.sk89q.worldedit.command.util.annotation; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.util.task.InterruptableCondition; import com.sk89q.worldedit.IncompleteRegionException; -import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.argument.Arguments; import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.event.platform.CommandEvent; @@ -57,7 +56,7 @@ public @interface Confirm { .orElseThrow(IncompleteRegionException::new); BlockVector3 pos1 = region.getMinimumPoint(); BlockVector3 pos2 = region.getMaximumPoint(); - long area = (pos2.getX() - pos1.getX()) * (pos2.getZ() - pos1.getZ() + 1) + long area = (pos2.x() - pos1.x()) * (pos2.z() - pos1.z() + 1) * (long) value; long max = 2 << 18; if (max != -1 && area > max) { @@ -75,7 +74,7 @@ public @interface Confirm { if (checkExisting(context)) { return true; } - int max = WorldEdit.getInstance().getConfiguration().maxRadius; + int max = actor.getLimit().MAX_RADIUS; if (max != -1 && value > max) { actor.print(Caption.of("fawe.cancel.reason.confirm.radius", value, max, getArgs(context) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index ae4eb2144..5337fe720 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -162,8 +162,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { public void findFreePosition(Location searchPos) { Extent world = searchPos.getExtent(); - int worldMinY = world.getMinimumPoint().getY(); - int worldMaxY = world.getMaximumPoint().getY(); + int worldMinY = world.getMinimumPoint().y(); + int worldMaxY = world.getMaximumPoint().y(); int x = searchPos.getBlockX(); int y = Math.max(worldMinY, searchPos.getBlockY()); @@ -202,7 +202,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { public void setOnGround(Location searchPos) { Extent world = searchPos.getExtent(); - int worldMinY = world.getMinimumPoint().getY(); + int worldMinY = world.getMinimumPoint().y(); int x = searchPos.getBlockX(); int y = Math.max(worldMinY, searchPos.getBlockY()); @@ -436,7 +436,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public Location getBlockOn() { final Location location = getLocation(); - return location.setPosition(location.setY(location.getY() - 1).toVector().floor()); + return location.setPosition(location.setY(location.y() - 1).toVector().floor()); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java index f8d77b509..ce71d9c95 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java @@ -504,8 +504,8 @@ public interface Extent extends InputExtent, OutputExtent { if (random.nextInt(100) > rarity) { continue; } - int x = (chunkPos.getBlockX() << 4) + random.nextInt(16); - int z = (chunkPos.getBlockZ() << 4) + random.nextInt(16); + int x = (chunkPos.x() << 4) + random.nextInt(16); + int z = (chunkPos.z() << 4) + random.nextInt(16); gen.spawn(random, x, z); } } @@ -534,9 +534,9 @@ public interface Extent extends InputExtent, OutputExtent { default boolean contains(int x, int y, int z) { BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - return min.getX() <= x && max.getX() >= x - && min.getY() <= y && max.getY() >= y - && min.getZ() <= z && max.getZ() >= z; + return min.x() <= x && max.x() >= x + && min.y() <= y && max.y() >= y + && min.z() <= z && max.z() >= z; } default void addOre( @@ -665,11 +665,11 @@ public interface Extent extends InputExtent, OutputExtent { } default int getMinY() { - return getMinimumPoint().getY(); + return getMinimumPoint().y(); } default int getMaxY() { - return getMaximumPoint().getY(); + return getMaximumPoint().y(); } /** @@ -832,9 +832,9 @@ public interface Extent extends InputExtent, OutputExtent { Vector3 center = region.getCenter(); Region centerRegion = new CuboidRegion( this instanceof World ? (World) this : null, // Causes clamping of Y range - BlockVector3.at(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())), - BlockVector3.at(MathUtils.roundHalfUp(center.getX()), - center.getY(), MathUtils.roundHalfUp(center.getZ()) + BlockVector3.at(((int) center.x()), ((int) center.y()), ((int) center.z())), + BlockVector3.at(MathUtils.roundHalfUp(center.x()), + center.y(), MathUtils.roundHalfUp(center.z()) ) ); return setBlocks(centerRegion, pattern); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java index 58863920c..7393c7722 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java @@ -50,7 +50,7 @@ public interface InputExtent { * @return the block */ default BlockState getBlock(BlockVector3 position) { - return getBlock(position.getX(), position.getY(), position.getZ()); + return getBlock(position.x(), position.y(), position.z()); } //FAWE start @@ -65,7 +65,7 @@ public interface InputExtent { * @return the block */ default BaseBlock getFullBlock(BlockVector3 position) { - return getFullBlock(position.getX(), position.getY(), position.getZ()); + return getFullBlock(position.x(), position.y(), position.z()); } default BaseBlock getFullBlock(int x, int y, int z) { @@ -85,7 +85,7 @@ public interface InputExtent { */ @Deprecated default BiomeType getBiome(BlockVector2 position) { - return getBiomeType(position.getX(), 0, position.getZ()); + return getBiomeType(position.x(), 0, position.z()); } default BiomeType getBiomeType(int x, int y, int z) { @@ -126,7 +126,7 @@ public interface InputExtent { * @return the light level at the location */ default int getEmittedLight(BlockVector3 position) { - return getEmittedLight(position.getX(), position.getY(), position.getZ()); + return getEmittedLight(position.x(), position.y(), position.z()); } default int getEmittedLight(int x, int y, int z) { @@ -140,7 +140,7 @@ public interface InputExtent { * @return the sky light level at the location */ default int getSkyLight(MutableBlockVector3 position) { - return getSkyLight(position.getX(), position.getY(), position.getZ()); + return getSkyLight(position.x(), position.y(), position.z()); } default int getSkyLight(int x, int y, int z) { @@ -148,7 +148,7 @@ public interface InputExtent { } default int getBrightness(MutableBlockVector3 position) { - return getBrightness(position.getX(), position.getY(), position.getZ()); + return getBrightness(position.x(), position.y(), position.z()); } default int getBrightness(int x, int y, int z) { @@ -156,7 +156,7 @@ public interface InputExtent { } default int getOpacity(MutableBlockVector3 position) { - return getOpacity(position.getX(), position.getY(), position.getZ()); + return getOpacity(position.x(), position.y(), position.z()); } default int getOpacity(int x, int y, int z) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java index d90bce937..9346bf380 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java @@ -60,7 +60,7 @@ public interface OutputExtent { */ @Deprecated default > boolean setBlock(BlockVector3 position, T block) throws WorldEditException { - return setBlock(position.getX(), position.getY(), position.getZ(), block); + return setBlock(position.x(), position.y(), position.z(), block); } // The defaults need to remain for compatibility (the actual implementation still needs to override one of these) @@ -148,7 +148,7 @@ public interface OutputExtent { * @param value light level to set */ default void setBlockLight(BlockVector3 position, int value) { - setBlockLight(position.getX(), position.getY(), position.getZ(), value); + setBlockLight(position.x(), position.y(), position.z(), value); } default void setBlockLight(int x, int y, int z, int value) { @@ -161,7 +161,7 @@ public interface OutputExtent { * @param value light level to set */ default void setSkyLight(BlockVector3 position, int value) { - setSkyLight(position.getX(), position.getY(), position.getZ(), value); + setSkyLight(position.x(), position.y(), position.z(), value); } //FAWE end diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java index 7b6be41d2..b861dbd6b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java @@ -165,9 +165,9 @@ public class BlockArrayClipboard implements Clipboard { @Override public BlockState getBlock(BlockVector3 position) { if (region.contains(position)) { - int x = position.getBlockX() - offset.getX(); - int y = position.getBlockY() - offset.getY(); - int z = position.getBlockZ() - offset.getZ(); + int x = position.x() - offset.x(); + int y = position.y() - offset.y(); + int z = position.z() - offset.z(); return getParent().getBlock(x, y, z); } @@ -177,9 +177,9 @@ public class BlockArrayClipboard implements Clipboard { @Override public BaseBlock getFullBlock(BlockVector3 position) { if (region.contains(position)) { - int x = position.getBlockX() - offset.getX(); - int y = position.getBlockY() - offset.getY(); - int z = position.getBlockZ() - offset.getZ(); + int x = position.x() - offset.x(); + int y = position.y() - offset.y(); + int z = position.z() - offset.z(); return getParent().getFullBlock(x, y, z); } return BlockTypes.AIR.getDefaultState().toBaseBlock(); @@ -189,9 +189,9 @@ public class BlockArrayClipboard implements Clipboard { public > boolean setBlock(BlockVector3 position, B block) throws WorldEditException { if (region.contains(position)) { //FAWE - get points - final int x = position.getBlockX(); - final int y = position.getBlockY(); - final int z = position.getBlockZ(); + final int x = position.x(); + final int y = position.y(); + final int z = position.z(); return setBlock(x, y, z, block); //FAWE end } @@ -201,22 +201,22 @@ public class BlockArrayClipboard implements Clipboard { //FAWE start @Override public boolean setTile(int x, int y, int z, CompoundTag tag) { - x -= offset.getX(); - y -= offset.getY(); - z -= offset.getZ(); + x -= offset.x(); + y -= offset.y(); + z -= offset.z(); return getParent().setTile(x, y, z, tag); } public boolean setTile(BlockVector3 position, CompoundTag tag) { - return setTile(position.getX(), position.getY(), position.getZ(), tag); + return setTile(position.x(), position.y(), position.z(), tag); } @Override public > boolean setBlock(int x, int y, int z, B block) throws WorldEditException { - x -= offset.getX(); - y -= offset.getY(); - z -= offset.getZ(); + x -= offset.x(); + y -= offset.y(); + z -= offset.z(); return parent.setBlock(x, y, z, block); } @@ -230,25 +230,25 @@ public class BlockArrayClipboard implements Clipboard { if (!region.contains(position)) { return null; } - int x = position.getBlockX() - offset.getX(); - int y = position.getBlockY() - offset.getY(); - int z = position.getBlockZ() - offset.getZ(); + int x = position.x() - offset.x(); + int y = position.y() - offset.y(); + int z = position.z() - offset.z(); return getParent().getBiomeType(x, y, z); } @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { - int x = position.getBlockX() - offset.getX(); - int y = position.getBlockY() - offset.getY(); - int z = position.getBlockZ() - offset.getZ(); + int x = position.x() - offset.x(); + int y = position.y() - offset.y(); + int z = position.z() - offset.z(); return getParent().setBiome(x, y, z, biome); } @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { - x -= offset.getX(); - y -= offset.getY(); - z -= offset.getZ(); + x -= offset.x(); + y -= offset.y(); + z -= offset.z(); return getParent().setBiome(x, y, z, biome); } @@ -262,9 +262,9 @@ public class BlockArrayClipboard implements Clipboard { ClipboardEntity ce = (ClipboardEntity) e; Location oldloc = ce.getLocation(); Location loc = new Location(oldloc.getExtent(), - oldloc.getX() + offset.getBlockX(), - oldloc.getY() + offset.getBlockY(), - oldloc.getZ() + offset.getBlockZ(), + oldloc.x() + offset.x(), + oldloc.y() + offset.y(), + oldloc.z() + offset.z(), oldloc.getYaw(), oldloc.getPitch() ); return new ClipboardEntity(loc, ce.entity); @@ -281,9 +281,9 @@ public class BlockArrayClipboard implements Clipboard { ClipboardEntity ce = (ClipboardEntity) e; Location oldloc = ce.getLocation(); Location loc = new Location(oldloc.getExtent(), - oldloc.getX() + offset.getBlockX(), - oldloc.getY() + offset.getBlockY(), - oldloc.getZ() + offset.getBlockZ(), + oldloc.x() + offset.x(), + oldloc.y() + offset.y(), + oldloc.z() + offset.z(), oldloc.getYaw(), oldloc.getPitch() ); return new ClipboardEntity(loc, ce.entity); @@ -296,9 +296,9 @@ public class BlockArrayClipboard implements Clipboard { @Nullable public Entity createEntity(Location location, BaseEntity entity) { Location l = new Location(location.getExtent(), - location.getX() - offset.getBlockX(), - location.getY() - offset.getBlockY(), - location.getZ() - offset.getBlockZ(), + location.x() - offset.x(), + location.y() - offset.y(), + location.z() - offset.z(), location.getYaw(), location.getPitch() ); return getParent().createEntity(l, entity); @@ -308,9 +308,9 @@ public class BlockArrayClipboard implements Clipboard { @Nullable public Entity createEntity(Location location, BaseEntity entity, UUID uuid) { Location l = new Location(location.getExtent(), - location.getX() - offset.getBlockX(), - location.getY() - offset.getBlockY(), - location.getZ() - offset.getBlockZ(), + location.x() - offset.x(), + location.y() - offset.y(), + location.z() - offset.z(), location.getYaw(), location.getPitch() ); return getParent().createEntity(l, entity, uuid); @@ -318,33 +318,33 @@ public class BlockArrayClipboard implements Clipboard { @Override public void removeEntity(int x, int y, int z, UUID uuid) { - x -= offset.getX(); - y -= offset.getY(); - z -= offset.getZ(); + x -= offset.x(); + y -= offset.y(); + z -= offset.z(); getParent().removeEntity(x, y, z, uuid); } @Override public BlockState getBlock(int x, int y, int z) { - x -= offset.getX(); - y -= offset.getY(); - z -= offset.getZ(); + x -= offset.x(); + y -= offset.y(); + z -= offset.z(); return getParent().getBlock(x, y, z); } @Override public BaseBlock getFullBlock(int x, int y, int z) { - x -= offset.getX(); - y -= offset.getY(); - z -= offset.getZ(); + x -= offset.x(); + y -= offset.y(); + z -= offset.z(); return getParent().getFullBlock(x, y, z); } @Override public BiomeType getBiomeType(int x, int y, int z) { - x -= offset.getX(); - y -= offset.getY(); - z -= offset.getZ(); + x -= offset.x(); + y -= offset.y(); + z -= offset.z(); return getParent().getBiomeType(x, y, z); } @@ -359,7 +359,7 @@ public class BlockArrayClipboard implements Clipboard { public Iterator iterator2d() { MutableBlockVector2 mutable = new MutableBlockVector2(); return Iterators.transform(getParent().iterator2d(), input -> - mutable.setComponents(input.getX() + offset.getX(), input.getZ() + offset.getZ())); + mutable.setComponents(input.x() + offset.x(), input.z() + offset.z())); } @Override @@ -409,7 +409,7 @@ public class BlockArrayClipboard implements Clipboard { private final float pitch; public ClipboardEntity(Location loc, BaseEntity entity) { - this((Clipboard) loc.getExtent(), loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), entity); + this((Clipboard) loc.getExtent(), loc.x(), loc.y(), loc.z(), loc.getYaw(), loc.getPitch(), entity); } public ClipboardEntity(Clipboard clipboard, double x, double y, double z, float yaw, float pitch, BaseEntity entity) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java index 8ad7e7606..dfa560a5c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java @@ -163,15 +163,15 @@ public interface Clipboard extends Extent, Iterable, Closeable, Fl void removeEntity(Entity entity); default int getWidth() { - return getDimensions().getBlockX(); + return getDimensions().x(); } default int getHeight() { - return getDimensions().getBlockY(); + return getDimensions().y(); } default int getLength() { - return getDimensions().getBlockZ(); + return getDimensions().z(); } default int getArea() { @@ -382,17 +382,17 @@ public interface Clipboard extends Extent, Iterable, Closeable, Fl 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 &= Clipboard.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) { extent.setBiome(xx, yy, zz, pos.getBiome(this)); } @@ -402,9 +402,9 @@ public interface Clipboard extends Extent, Iterable, Closeable, Fl extent.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 if (pasteEntities) { for (Entity entity : this.getEntities()) { @@ -414,8 +414,8 @@ public interface Clipboard extends Extent, Iterable, Closeable, Fl 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() ); extent.createEntity(newPos, entity.getState()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java index b7cf7a050..d3420f658 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java @@ -50,9 +50,9 @@ public interface ClipboardWriter extends Closeable { //FAWE start default Tag writeVector(Vector3 vector) { List list = new ArrayList<>(); - list.add(new DoubleTag(vector.getX())); - list.add(new DoubleTag(vector.getY())); - list.add(new DoubleTag(vector.getZ())); + list.add(new DoubleTag(vector.x())); + list.add(new DoubleTag(vector.y())); + list.add(new DoubleTag(vector.z())); return new ListTag(DoubleTag.class, list); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java index 83d8c3007..a140b666a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java @@ -263,9 +263,9 @@ public class SpongeSchematicReader extends NBTSchematicReader { int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); final BlockVector3 pt = BlockVector3.at(pos[0], pos[1], pos[2]); Map values = Maps.newHashMap(tileEntity); - values.put("x", new IntTag(pt.getBlockX())); - values.put("y", new IntTag(pt.getBlockY())); - values.put("z", new IntTag(pt.getBlockZ())); + values.put("x", new IntTag(pt.x())); + values.put("y", new IntTag(pt.y())); + values.put("z", new IntTag(pt.z())); //FAWE start - support old, corrupt schematics Tag id = values.get("Id"); if (id == null) { @@ -378,7 +378,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { palette.put(((IntTag) idTag).getValue(), biome); } - int width = clipboard.getDimensions().getX(); + int width = clipboard.getDimensions().x(); byte[] biomes = dataTag.getValue(); int biomeIndex = 0; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java index 2a10e9f4b..24860dd3c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java @@ -117,9 +117,9 @@ public class SpongeSchematicWriter implements ClipboardWriter { WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataVersion())); Map metadata = new HashMap<>(); - metadata.put("WEOffsetX", new IntTag(offset.getBlockX())); - metadata.put("WEOffsetY", new IntTag(offset.getBlockY())); - metadata.put("WEOffsetZ", new IntTag(offset.getBlockZ())); + metadata.put("WEOffsetX", new IntTag(offset.x())); + metadata.put("WEOffsetY", new IntTag(offset.y())); + metadata.put("WEOffsetZ", new IntTag(offset.z())); metadata.put("FAWEVersion", new IntTag(Fawe.instance().getVersion().build)); schematic.put("Metadata", new CompoundTag(metadata)); @@ -130,9 +130,9 @@ public class SpongeSchematicWriter implements ClipboardWriter { // The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin' schematic.put("Offset", new IntArrayTag(new int[]{ - min.getBlockX(), - min.getBlockY(), - min.getBlockZ(), + min.x(), + min.y(), + min.z(), })); int paletteMax = 0; @@ -143,11 +143,11 @@ public class SpongeSchematicWriter implements ClipboardWriter { ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length); for (int y = 0; y < height; y++) { - int y0 = min.getBlockY() + y; + int y0 = min.y() + y; for (int z = 0; z < length; z++) { - int z0 = min.getBlockZ() + z; + int z0 = min.z() + z; for (int x = 0; x < width; x++) { - int x0 = min.getBlockX() + x; + int x0 = min.x() + x; BlockVector3 point = BlockVector3.at(x0, y0, z0); BaseBlock block = clipboard.getFullBlock(point); if (block.getNbtData() != null) { @@ -217,10 +217,10 @@ public class SpongeSchematicWriter implements ClipboardWriter { Map palette = new HashMap<>(); for (int z = 0; z < length; z++) { - int z0 = min.getBlockZ() + z; + int z0 = min.z() + z; for (int x = 0; x < width; x++) { - int x0 = min.getBlockX() + x; - BlockVector3 pt = BlockVector3.at(x0, min.getBlockY(), z0); + int x0 = min.x() + x; + BlockVector3 pt = BlockVector3.at(x0, min.y(), z0); BiomeType biome = clipboard.getBiome(pt); String biomeKey = biome.getId(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java index ff516e4c9..18e69c7a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java @@ -104,7 +104,7 @@ public class BlockBagExtent extends AbstractDelegateExtent { @Override public > boolean setBlock(BlockVector3 position, B block) throws WorldEditException { - return setBlock(position.getX(), position.getY(), position.getZ(), block); + return setBlock(position.x(), position.y(), position.z(), block); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java index f22d7036d..d9effa512 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java @@ -391,9 +391,9 @@ public class BlockTransformExtent extends ResettableExtent { if (direction != null) { Vector3 applyAbsolute = transform.apply(direction.toVector()); Vector3 applyOrigin = transform.apply(Vector3.ZERO); - applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX()); - applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY()); - applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ()); + applyAbsolute.mutX(applyAbsolute.x() - applyOrigin.x()); + applyAbsolute.mutY(applyAbsolute.y() - applyOrigin.y()); + applyAbsolute.mutZ(applyAbsolute.z() - applyOrigin.z()); Direction newDirection = Direction.findClosest( applyAbsolute, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java index bc498711b..1161779d9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java @@ -63,7 +63,7 @@ public class DataValidatorExtent extends AbstractDelegateExtent { @Override public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { - final int y = location.getBlockY(); + final int y = location.y(); final BlockType type = block.getBlockType(); if (y < minY || y > maxY) { return false; @@ -79,7 +79,7 @@ public class DataValidatorExtent extends AbstractDelegateExtent { @Override public boolean setBiome(BlockVector3 location, BiomeType biome) { - final int y = location.getBlockY(); + final int y = location.y(); if (y < minY || y > maxY) { return false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SideEffectExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SideEffectExtent.java index 5a90aebbb..413bd31bf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SideEffectExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SideEffectExtent.java @@ -88,7 +88,7 @@ public class SideEffectExtent extends AbstractDelegateExtent { @Override public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { if (sideEffectSet.getState(SideEffect.LIGHTING) == SideEffect.State.DELAYED) { - dirtyChunks.add(BlockVector2.at(location.getBlockX() >> 4, location.getBlockZ() >> 4)); + dirtyChunks.add(BlockVector2.at(location.x() >> 4, location.z() >> 4)); } if (postEditSimulation) { positions.put(location, world.getBlock(location)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java index 6ae4ad2ec..90d7f31cf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java @@ -70,7 +70,7 @@ public class BiomeReplace implements FlatRegionFunction, RegionFunction { @Deprecated public boolean apply(BlockVector2 position) throws WorldEditException { boolean success = false; - for (int y = extent.getMinimumPoint().getY(); y <= extent.getMaximumPoint().getY(); y++) { + for (int y = extent.getMinimumPoint().y(); y <= extent.getMaximumPoint().y(); y++) { success |= apply(position.toBlockVector3(y)); } return success; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/ExtentBiomeCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/ExtentBiomeCopy.java index 076c1f561..5643da36a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/ExtentBiomeCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/ExtentBiomeCopy.java @@ -102,7 +102,7 @@ public class ExtentBiomeCopy implements FlatRegionFunction, RegionFunction { @Deprecated public boolean apply(BlockVector2 position) throws WorldEditException { boolean success = false; - for (int y = destination.getMinimumPoint().getY(); y <= destination.getMaximumPoint().getY(); y++) { + for (int y = destination.getMinimumPoint().y(); y <= destination.getMaximumPoint().y(); y++) { success |= apply(position.toBlockVector3(y)); } return success; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java index c84fcc67a..4027220b2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java @@ -105,7 +105,7 @@ public class SnowSimulator implements LayerFunction { // Can't put snow this far up - if (position.getBlockY() == this.extent.getMaximumPoint().getBlockY()) { + if (position.y() == this.extent.getMaximumPoint().y()) { return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java index fa3ef1dc4..149464bef 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java @@ -206,9 +206,9 @@ public class ExtentEntityCopy implements EntityFunction { BlockVector3 newLeash = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint(); return new BaseEntity(state.getType(), tag.createBuilder() .put("Leash", leashCompound.createBuilder() - .putInt("X", newLeash.getBlockX()) - .putInt("Y", newLeash.getBlockY()) - .putInt("Z", newLeash.getBlockZ()) + .putInt("X", newLeash.x()) + .putInt("Y", newLeash.y()) + .putInt("Z", newLeash.z()) .build() ).build()); } @@ -226,9 +226,9 @@ public class ExtentEntityCopy implements EntityFunction { BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint(); CompoundTagBuilder builder = tag.createBuilder() - .putInt("TileX", newTilePosition.getBlockX()) - .putInt("TileY", newTilePosition.getBlockY()) - .putInt("TileZ", newTilePosition.getBlockZ()); + .putInt("TileX", newTilePosition.x()) + .putInt("TileY", newTilePosition.y()) + .putInt("TileZ", newTilePosition.z()); if (hasFacing) { boolean isPainting = state.getType() == EntityTypes.PAINTING; // Paintings have different facing values diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/ApplyLayer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/ApplyLayer.java index 88e3218c0..c7ecc1207 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/ApplyLayer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/ApplyLayer.java @@ -53,8 +53,8 @@ public class ApplyLayer implements Contextual { return new LayerVisitor( localRegion, - localRegion.getMinimumPoint().getY(), - localRegion.getMaximumPoint().getY(), + localRegion.getMinimumPoint().y(), + localRegion.getMaximumPoint().y(), function.createFromContext(context), //FAWE start - provide extent for preloading context.getDestination() diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java index 115c05044..b4ccd0a55 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java @@ -141,13 +141,13 @@ public class Deform implements Contextual { zero = max.add(min).multiply(0.5); unit = max.subtract(zero); - if (unit.getX() == 0) { + if (unit.x() == 0) { unit = unit.withX(1.0); } - if (unit.getY() == 0) { + if (unit.y() == 0) { unit = unit.withY(1.0); } - if (unit.getZ() == 0) { + if (unit.z() == 0) { unit = unit.withZ(1.0); } break; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java index dfe1841d4..808465416 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java @@ -48,7 +48,7 @@ public class BoundedHeightMask extends AbstractMask { @Override public boolean test(BlockVector3 vector) { - return vector.getY() >= minY && vector.getY() <= maxY; + return vector.y() >= minY && vector.y() <= maxY; } @Nullable diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java index 1b95057ba..e5647332e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java @@ -73,10 +73,10 @@ public class ExpressionMask extends AbstractMask { ((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector.toVector3()); } if (timeout == null) { - return expression.evaluate(vector.getX(), vector.getY(), vector.getZ()) > 0; + return expression.evaluate(vector.x(), vector.y(), vector.z()) > 0; } else { return expression.evaluate( - new double[]{vector.getX(), vector.getY(), vector.getZ()}, + new double[]{vector.x(), vector.y(), vector.z()}, timeout.getAsInt() ) > 0; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java index 0d2854b7c..7d5e22e99 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java @@ -63,9 +63,9 @@ public class ExpressionMask2D extends AbstractMask2D { public boolean test(BlockVector2 vector) { try { if (timeout == null) { - return expression.evaluate(vector.getX(), 0, vector.getZ()) > 0; + return expression.evaluate(vector.x(), 0, vector.z()) > 0; } else { - return expression.evaluate(timeout.getAsInt(), vector.getX(), 0, vector.getZ()) > 0; + return expression.evaluate(timeout.getAsInt(), vector.x(), 0, vector.z()) > 0; } } catch (EvaluationException e) { return false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java index 684148505..8dd9c26d9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java @@ -97,7 +97,7 @@ public class NoiseFilter extends AbstractMask { @Override public boolean test(BlockVector3 vector) { //FAWE start - mutable - return noiseGenerator.noise(mutable.setComponents(vector.getX(), vector.getZ(), vector.getZ())) <= density; + return noiseGenerator.noise(mutable.setComponents(vector.x(), vector.y(), vector.z())) <= density; //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java index 2c809ada4..39eda315b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java @@ -116,7 +116,7 @@ public class OffsetMask extends AbstractMask { public boolean test(BlockVector3 vector) { //FAWE start - ignore resultant position outside world height range BlockVector3 testPos = vector.add(offset); - if (testPos.getBlockY() < minY || testPos.getBlockY() > maxY) { + if (testPos.y() < minY || testPos.y() > maxY) { return false; } return getMask().test(testPos); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java index 3e70c9ddd..f08811513 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java @@ -89,13 +89,13 @@ public class OffsetMask2D extends AbstractMask2D { //FAWE start @Override public boolean test(BlockVector2 vector) { - mutableBlockVector2.setComponents(vector.getX() + offset.getX(), vector.getZ() + offset.getZ()); + mutableBlockVector2.setComponents(vector.x() + offset.x(), vector.z() + offset.z()); return getMask().test(mutableBlockVector2); } @Override public Mask2D copy2D() { - return new OffsetMask2D(mask.copy2D(), BlockVector2.at(offset.getX(), offset.getZ())); + return new OffsetMask2D(mask.copy2D(), BlockVector2.at(offset.x(), offset.z())); } //FAWE end diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java index f766cf8d7..75018d96d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java @@ -52,9 +52,9 @@ public class BackwardsExtentBlockCopy extends RegionVisitor implements Operation BlockVector3 max = BlockVector3.at(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE); BlockVector3 pos1 = region.getMinimumPoint(); BlockVector3 pos2 = region.getMaximumPoint(); - for (int x : new int[]{pos1.getBlockX(), pos2.getBlockX()}) { - for (int y : new int[]{pos1.getBlockY(), pos2.getBlockY()}) { - for (int z : new int[]{pos1.getBlockZ(), pos2.getBlockZ()}) { + for (int x : new int[]{pos1.x(), pos2.x()}) { + for (int y : new int[]{pos1.y(), pos2.y()}) { + for (int z : new int[]{pos1.z(), pos2.z()}) { BlockVector3 pt = transform(transform, BlockVector3.at(x, y, z)); min = min.getMinimum(pt); max = max.getMaximum(pt); @@ -65,13 +65,13 @@ public class BackwardsExtentBlockCopy extends RegionVisitor implements Operation } private BlockVector3 transform(Transform transform, BlockVector3 pt) { - mutV3.mutX(((pt.getBlockX() - origin.getBlockX()))); - mutV3.mutY(((pt.getBlockY() - origin.getBlockY()))); - mutV3.mutZ(((pt.getBlockZ() - origin.getBlockZ()))); + mutV3.mutX(((pt.x() - origin.x()))); + mutV3.mutY(((pt.y() - origin.y()))); + mutV3.mutZ(((pt.z() - origin.z()))); Vector3 tmp = transform.apply(mutV3); - mutBV3.mutX((tmp.getBlockX() + origin.getBlockX())); - mutBV3.mutY((tmp.getBlockY() + origin.getBlockY())); - mutBV3.mutZ((tmp.getBlockZ() + origin.getBlockZ())); + mutBV3.mutX((tmp.getBlockX() + origin.x())); + mutBV3.mutY((tmp.getBlockY() + origin.y())); + mutBV3.mutZ((tmp.getBlockZ() + origin.z())); return mutBV3; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index 4c475de60..0c6508cd3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -329,9 +329,9 @@ public class ForwardExtentCopy implements Operation { if (!translation.equals(BlockVector3.ZERO)) { finalDest = new BlockTranslateExtent( finalDest, - translation.getBlockX(), - translation.getBlockY(), - translation.getBlockZ() + translation.x(), + translation.y(), + translation.z() ); } //FAWE end @@ -372,21 +372,21 @@ public class ForwardExtentCopy implements Operation { if (sourceFunction != null) { BlockVector3 disAbs = translation.abs(); BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1); - boolean overlap = (disAbs.getBlockX() < size.getBlockX() && disAbs.getBlockY() < size.getBlockY() && disAbs.getBlockZ() < size - .getBlockZ()); + boolean overlap = (disAbs.x() < size.x() && disAbs.y() < size.y() && disAbs.z() < size + .z()); RegionFunction copySrcFunc = sourceFunction; if (overlap && translation.length() != 0) { - int x = translation.getBlockX(); - int y = translation.getBlockY(); - int z = translation.getBlockZ(); + int x = translation.x(); + int y = translation.y(); + int z = translation.z(); maskFunc = position -> { BlockVector3 bv = BlockVector3.at( - position.getBlockX() + x, - position.getBlockY() + y, - position.getBlockZ() + z + position.x() + x, + position.y() + y, + position.z() + z ); if (region.contains(bv)) { return sourceFunction.apply(bv); @@ -396,9 +396,9 @@ public class ForwardExtentCopy implements Operation { copySrcFunc = position -> { BlockVector3 bv = BlockVector3.at( - position.getBlockX() - x, - position.getBlockY() - y, - position.getBlockZ() - z + position.x() - x, + position.y() - y, + position.z() - z ); if (!region.contains(bv)) { return sourceFunction.apply(position); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java index c45629e5f..bc13fe4de 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java @@ -107,12 +107,12 @@ public class RandomPattern extends AbstractPattern { @Override public BaseBlock applyBlock(BlockVector3 position) { - return collection.next(position.getBlockX(), position.getBlockY(), position.getBlockZ()).applyBlock(position); + return collection.next(position.x(), position.y(), position.z()).applyBlock(position); } @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { - return collection.next(get.getBlockX(), get.getBlockY(), get.getBlockZ()).apply(extent, get, set); + return collection.next(get.x(), get.y(), get.z()).apply(extent, get, set); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java index 490c47cf2..ed62f92d8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java @@ -88,9 +88,9 @@ public class RepeatingExtentPattern extends AbstractExtentPattern { @Override public BaseBlock applyBlock(BlockVector3 position) { //FAWE start - calculate offset - int x = Math.floorMod(position.getBlockX() + offset.getBlockX(), size.getBlockX()) + origin.getBlockX(); - int y = Math.floorMod(position.getBlockY() + offset.getBlockY(), size.getBlockY()) + origin.getBlockY(); - int z = Math.floorMod(position.getBlockZ() + offset.getBlockZ(), size.getBlockZ()) + origin.getBlockZ(); + int x = Math.floorMod(position.x() + offset.x(), size.x()) + origin.x(); + int y = Math.floorMod(position.y() + offset.y(), size.y()) + origin.y(); + int z = Math.floorMod(position.z() + offset.z(), size.z()) + origin.z(); //FAWE end return getExtent().getFullBlock(x, y, z); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java index 7f3e5da63..796f02700 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java @@ -305,10 +305,10 @@ public abstract class BreadthFirstSearch implements Operation { if (loadCount > Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT) { break outer; } - int x = from.getBlockX() + direction.getBlockX(); - int z = from.getBlockZ() + direction.getBlockX(); + int x = from.x() + direction.x(); + int z = from.z() + direction.x(); if (cx != (cx = x >> 4) || cz != (cz = z >> 4)) { - int y = from.getBlockY() + direction.getBlockY(); + int y = from.y() + direction.y(); if (y < singleQueue.getMinY() || y > singleQueue.getMaxY()) { continue; } @@ -320,7 +320,7 @@ public abstract class BreadthFirstSearch implements Operation { } } for (BlockVector3 chunk : chunkLoadSet) { - singleQueue.addChunkLoad(chunk.getBlockX(), chunk.getBlockZ()); + singleQueue.addChunkLoad(chunk.x(), chunk.z()); } } for (BlockVector3 from : queue) { @@ -329,12 +329,12 @@ public abstract class BreadthFirstSearch implements Operation { } for (int i = 0, j = 0; i < dirs.length && j < maxBranch; i++) { BlockVector3 direction = dirs[i]; - int y = from.getBlockY() + direction.getY(); + int y = from.y() + direction.y(); if (y < minY || y > maxY) { continue; } - int x = from.getBlockX() + direction.getX(); - int z = from.getBlockZ() + direction.getZ(); + int x = from.x() + direction.x(); + int z = from.z() + direction.z(); if (!visited.contains(x, y, z)) { if (isVisitable(from, mutable.setComponents(x, y, z))) { j++; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java index f8204b085..2e5f07736 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java @@ -102,8 +102,8 @@ public class DownwardVisitor extends RecursiveVisitor { @Override protected boolean isVisitable(BlockVector3 from, BlockVector3 to) { - int fromY = from.getBlockY(); - return (fromY == baseY || to.subtract(from).getBlockY() < 0) && super.isVisitable(from, to); + int fromY = from.y(); + return (fromY == baseY || to.subtract(from).y() < 0) && super.isVisitable(from, to); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java index ff6b67e03..5ed98c354 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java @@ -111,8 +111,8 @@ public class RegionVisitor implements Operation { while (trailIter.hasNext()) { BlockVector3 pt = trailIter.next(); apply(pt); - int cx = pt.getBlockX() >> 4; - int cz = pt.getBlockZ() >> 4; + int cx = pt.x() >> 4; + int cz = pt.z() >> 4; if (cx != lastTrailChunkX || cz != lastTrailChunkZ) { lastTrailChunkX = cx; lastTrailChunkZ = cz; @@ -128,8 +128,8 @@ public class RegionVisitor implements Operation { lead: for (int count = 0; count < amount; ) { BlockVector3 v = leadIter.next(); - int vcx = v.getBlockX() >> 4; - int vcz = v.getBlockZ() >> 4; + int vcx = v.x() >> 4; + int vcz = v.z() >> 4; if (vcx != lastLeadChunkX || vcz != lastLeadChunkZ) { lastLeadChunkX = vcx; lastLeadChunkZ = vcz; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java index ff624e81e..1bad79fb9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java @@ -83,7 +83,7 @@ public class ArrayListHistory implements ChangeSet { if (change instanceof BlockChange) { BlockChange blockChange = (BlockChange) change; BlockVector3 pos = blockChange.getPosition(); - summary.add(pos.getX(), pos.getZ(), blockChange.getCurrent().getOrdinal()); + summary.add(pos.x(), pos.z(), blockChange.getCurrent().getOrdinal()); } } return summary; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java index e4dcd99ab..1c88a1f2d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java @@ -54,7 +54,7 @@ public final class ChunkDeleter { private static final Logger LOGGER = LogManagerCompat.getLogger(); private static final Comparator chunkSorter = Comparator.comparing( - pos -> (pos.getBlockX() & 31) + (pos.getBlockZ() & 31) * 32 + pos -> (pos.x() & 31) + (pos.z() & 31) * 32 ); private static final Gson chunkDeleterGson = new GsonBuilder() @@ -182,15 +182,15 @@ public final class ChunkDeleter { int startZ = regZ << 5; int endZ = (regZ << 5) + 31; - int minX = Math.max(Math.min(startX, endX), minChunk.getBlockX()); - int minZ = Math.max(Math.min(startZ, endZ), minChunk.getBlockZ()); - int maxX = Math.min(Math.max(startX, endX), maxChunk.getBlockX()); - int maxZ = Math.min(Math.max(startZ, endZ), maxChunk.getBlockZ()); + int minX = Math.max(Math.min(startX, endX), minChunk.x()); + int minZ = Math.max(Math.min(startZ, endZ), minChunk.z()); + int maxX = Math.min(Math.max(startX, endX), maxChunk.x()); + int maxZ = Math.min(Math.max(startZ, endZ), maxChunk.z()); Stream stream = Stream.iterate( BlockVector2.at(minX, minZ), bv2 -> { - int nextX = bv2.getBlockX(); - int nextZ = bv2.getBlockZ(); + int nextX = bv2.x(); + int nextZ = bv2.z(); if (++nextX > maxX) { nextX = minX; if (++nextZ > maxZ) { @@ -295,8 +295,8 @@ public final class ChunkDeleter { @Override public void write(JsonWriter out, BlockVector2 value) throws IOException { out.beginArray(); - out.value(value.getBlockX()); - out.value(value.getBlockZ()); + out.value(value.x()); + out.value(value.z()); out.endArray(); } @@ -317,8 +317,8 @@ public final class ChunkDeleter { private final int z; RegionFilePos(BlockVector2 chunk) { - this.x = chunk.getBlockX() >> 5; - this.z = chunk.getBlockZ() >> 5; + this.x = chunk.x() >> 5; + this.z = chunk.z() >> 5; } RegionFilePos(int regX, int regZ) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeletionInfo.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeletionInfo.java index 13b9d3847..ffcb5f885 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeletionInfo.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeletionInfo.java @@ -45,7 +45,7 @@ public class ChunkDeletionInfo { return chunks.size(); } final BlockVector2 dist = maxChunk.subtract(minChunk).add(1, 1); - return dist.getBlockX() * dist.getBlockZ(); + return dist.x() * dist.z(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/RegionAccess.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/RegionAccess.java index 80eb6989e..7c545040e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/RegionAccess.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/RegionAccess.java @@ -57,8 +57,8 @@ class RegionAccess implements AutoCloseable { } private static int indexChunk(BlockVector2 pos) { - int x = pos.getBlockX() & 31; - int z = pos.getBlockZ() & 31; + int x = pos.x() & 31; + int z = pos.z() & 31; return x + z * 32; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java index a0c5eb328..b07f3f61d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java @@ -20,6 +20,8 @@ package com.sk89q.worldedit.internal.command.exception; import com.fastasyncworldedit.core.configuration.Caption; +import com.fastasyncworldedit.core.exception.BrushRadiusLimitException; +import com.fastasyncworldedit.core.exception.RadiusLimitException; import com.fastasyncworldedit.core.internal.exception.FaweException; import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.DisallowedItemException; @@ -134,6 +136,18 @@ public class WorldEditExceptionConverter extends ExceptionConverterHelper { ); } + //FAWE start + @ExceptionMatch + public void convert(BrushRadiusLimitException e) throws CommandException { + throw newCommandException(Caption.of("fawe.error.limit.max-brush-radius", TextComponent.of(e.getMaxRadius())), e); + } + + @ExceptionMatch + public void convert(RadiusLimitException e) throws CommandException { + throw newCommandException(Caption.of("fawe.error.limit.max-radius", TextComponent.of(e.getMaxRadius())), e); + } + //FAWE end + @ExceptionMatch public void convert(UnknownDirectionException e) throws CommandException { throw newCommandException(e.getRichMessage(), e); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java index b9cf79fe0..4150f9a5c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java @@ -42,11 +42,11 @@ public class SelectionCylinderEvent implements CUIEvent { @Override public String[] getParameters() { return new String[]{ - String.valueOf(pos.getBlockX()), - String.valueOf(pos.getBlockY()), - String.valueOf(pos.getBlockZ()), - String.valueOf(radius.getX()), - String.valueOf(radius.getZ()) + String.valueOf(pos.x()), + String.valueOf(pos.y()), + String.valueOf(pos.z()), + String.valueOf(radius.x()), + String.valueOf(radius.z()) }; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java index 3bf609b1b..4e0131329 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java @@ -40,9 +40,9 @@ public class SelectionEllipsoidPointEvent implements CUIEvent { public String[] getParameters() { return new String[]{ String.valueOf(id), - String.valueOf(pos.getBlockX()), - String.valueOf(pos.getBlockY()), - String.valueOf(pos.getBlockZ()) + String.valueOf(pos.x()), + String.valueOf(pos.y()), + String.valueOf(pos.z()) }; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java index f27eda25c..f01c240a2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java @@ -32,30 +32,30 @@ public class SelectionPoint2DEvent implements CUIEvent { @Deprecated public SelectionPoint2DEvent(int id, BlockVector2 pos, int area) { this.id = id; - this.blockX = pos.getX(); - this.blockZ = pos.getZ(); + this.blockX = pos.x(); + this.blockZ = pos.z(); this.area = area; } @Deprecated public SelectionPoint2DEvent(int id, BlockVector3 pos, int area) { this.id = id; - this.blockX = pos.getX(); - this.blockZ = pos.getZ(); + this.blockX = pos.x(); + this.blockZ = pos.z(); this.area = area; } public SelectionPoint2DEvent(int id, BlockVector2 pos, long area) { this.id = id; - this.blockX = pos.getX(); - this.blockZ = pos.getZ(); + this.blockX = pos.x(); + this.blockZ = pos.z(); this.area = area; } public SelectionPoint2DEvent(int id, BlockVector3 pos, long area) { this.id = id; - this.blockX = pos.getX(); - this.blockZ = pos.getZ(); + this.blockX = pos.x(); + this.blockZ = pos.z(); this.area = area; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java index 1ee2e466d..42718c7ae 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java @@ -49,9 +49,9 @@ public class SelectionPointEvent implements CUIEvent { public String[] getParameters() { return new String[]{ String.valueOf(id), - String.valueOf(pos.getBlockX()), - String.valueOf(pos.getBlockY()), - String.valueOf(pos.getBlockZ()), + String.valueOf(pos.x()), + String.valueOf(pos.y()), + String.valueOf(pos.z()), String.valueOf(area) }; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java index b9f3891f3..8cc91f969 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java @@ -79,9 +79,9 @@ public class ServerCUIHandler { try { CuboidRegion region = ((CuboidRegionSelector) regionSelector).getRegion(); - posX = region.getMinimumPoint().getBlockX(); - posY = region.getMinimumPoint().getBlockY(); - posZ = region.getMinimumPoint().getBlockZ(); + posX = region.getMinimumPoint().x(); + posY = region.getMinimumPoint().y(); + posZ = region.getMinimumPoint().z(); width = region.getWidth(); height = region.getHeight(); @@ -104,9 +104,9 @@ public class ServerCUIHandler { } // Just select the point. - posX = point.getBlockX(); - posY = point.getBlockY(); - posZ = point.getBlockZ(); + posX = point.x(); + posY = point.y(); + posZ = point.z(); width = 1; height = 1; length = 1; @@ -128,8 +128,8 @@ public class ServerCUIHandler { double rotX = location.getYaw(); double rotY = location.getPitch(); double xz = Math.cos(Math.toRadians(rotY)); - int x = (int) (location.getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12); - int z = (int) (location.getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12); + int x = (int) (location.x() - (-xz * Math.sin(Math.toRadians(rotX))) * 12); + int z = (int) (location.z() - (xz * Math.cos(Math.toRadians(rotX))) * 12); int y = Math.max( player.getWorld().getMinY(), Math.min(Math.min(player.getWorld().getMaxY(), posY + MAX_DISTANCE), posY + 3) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/RegionOptimizedVectorSorter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/RegionOptimizedVectorSorter.java index b30bd8f49..4fdcb2118 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/RegionOptimizedVectorSorter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/RegionOptimizedVectorSorter.java @@ -62,13 +62,13 @@ public class RegionOptimizedVectorSorter { private static final long FLIP_REGION_Z_SIGN = 0x1_00_00L << REGION_Z_SHIFT; private static long key(BlockVector3 elem) { - long x = elem.getX(); - long z = elem.getZ(); + long x = elem.x(); + long z = elem.z(); return (((x << (REGION_X_SHIFT - 9)) & REGION_X_MASK) ^ FLIP_REGION_X_SIGN) | (((z << (REGION_Z_SHIFT - 9)) & REGION_Z_MASK) ^ FLIP_REGION_Z_SIGN) | ((x << (CHUNK_X_SHIFT - 4)) & CHUNK_X_MASK) | ((z << (CHUNK_Z_SHIFT - 4)) & CHUNK_Z_MASK) - | (Y_MAX - elem.getY()); + | (Y_MAX - elem.y()); } private static final int NUMBER_OF_BITS = 64; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/wna/WorldNativeAccess.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/wna/WorldNativeAccess.java index 769773b96..aa90cb816 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/wna/WorldNativeAccess.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/wna/WorldNativeAccess.java @@ -50,9 +50,9 @@ public interface WorldNativeAccess { checkNotNull(block); setCurrentSideEffectSet(sideEffects); - int x = position.getBlockX(); - int y = position.getBlockY(); - int z = position.getBlockZ(); + int x = position.x(); + int y = position.y(); + int z = position.z(); // First set the block NC chunk = getChunk(x >> 4, z >> 4); @@ -75,9 +75,9 @@ public interface WorldNativeAccess { if (tag != null) { tag = tag.put(ImmutableMap.of( "id", StringBinaryTag.of(baseBlock.getNbtId()), - "x", IntBinaryTag.of(position.getX()), - "y", IntBinaryTag.of(position.getY()), - "z", IntBinaryTag.of(position.getZ()) + "x", IntBinaryTag.of(position.x()), + "y", IntBinaryTag.of(position.y()), + "z", IntBinaryTag.of(position.z()) )); // update if TE changed as well @@ -99,8 +99,8 @@ public interface WorldNativeAccess { default void applySideEffects(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) { setCurrentSideEffectSet(sideEffectSet); - NP pos = getPosition(position.getX(), position.getY(), position.getZ()); - NC chunk = getChunk(position.getX() >> 4, position.getZ() >> 4); + NP pos = getPosition(position.x(), position.y(), position.z()); + NC chunk = getChunk(position.x() >> 4, position.z() >> 4); NBS oldData = toNative(previousType); NBS newData = getBlockState(chunk, pos); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java index fe95ad3ad..baed5ffde 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java @@ -27,7 +27,7 @@ import java.util.Comparator; /** * An immutable 2-dimensional vector. */ -//FAWE start - un-finalize +//FAWE start - not a record public class BlockVector2 { //FAWE end @@ -53,7 +53,7 @@ public class BlockVector2 { * */ public static final Comparator COMPARING_GRID_ARRANGEMENT = - Comparator.comparingInt(BlockVector2::getZ).thenComparingInt(BlockVector2::getX); + Comparator.comparingInt(BlockVector2::z).thenComparingInt(BlockVector2::x); public static BlockVector2 at(double x, double z) { return at((int) Math.floor(x), (int) Math.floor(z)); @@ -122,7 +122,19 @@ public class BlockVector2 { * Get the X coordinate. * * @return the x coordinate + * @since TODO */ + public int x() { + return x; + } + + /** + * Get the X coordinate. + * + * @return the x coordinate + * @deprecated use {@link #x()} instead + */ + @Deprecated(forRemoval = true, since = "TODO") public int getX() { return x; } @@ -131,7 +143,9 @@ public class BlockVector2 { * Get the X coordinate. * * @return the x coordinate + * @deprecated use {@link #x()} instead */ + @Deprecated(forRemoval = true, since = "TODO") public int getBlockX() { return x; } @@ -150,7 +164,19 @@ public class BlockVector2 { * Get the Z coordinate. * * @return the z coordinate + * @since TODO */ + public int z() { + return z; + } + + /** + * Get the Z coordinate. + * + * @return the z coordinate + * @deprecated use {@link #z()} instead + */ + @Deprecated(forRemoval = true, since = "TODO") public int getZ() { return z; } @@ -159,7 +185,9 @@ public class BlockVector2 { * Get the Z coordinate. * * @return the z coordinate + * @deprecated use {@link #z()} instead */ + @Deprecated(forRemoval = true, since = "TODO") public int getBlockZ() { return z; } @@ -598,13 +626,13 @@ public class BlockVector2 { return BlockVector3.at(x, y, z); } + //FAWE start - not a record, need own implementations @Override public boolean equals(Object obj) { - if (!(obj instanceof BlockVector2)) { + if (!(obj instanceof BlockVector2 other)) { return false; } - BlockVector2 other = (BlockVector2) obj; return other.x == this.x && other.z == this.z; } @@ -613,6 +641,7 @@ public class BlockVector2 { public int hashCode() { return (x << 16) ^ z; } + //FAWE end @Override public String toString() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java index 5f1c14842..3d239b352 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java @@ -38,7 +38,9 @@ import static com.sk89q.worldedit.math.BitMath.unpackZ; /** * An immutable 3-dimensional vector. */ +//FAWE start - not a record public abstract class BlockVector3 { +//FAWE end public static final BlockVector3 ZERO = BlockVector3.at(0, 0, 0); public static final BlockVector3 UNIT_X = BlockVector3.at(1, 0, 0); @@ -85,9 +87,9 @@ public abstract class BlockVector3 { } public static boolean isLongPackable(BlockVector3 location) { - return isHorizontallyInBounds(location.getX()) - && isHorizontallyInBounds(location.getZ()) - && WORLD_Y_MIN <= location.getY() && location.getY() <= WORLD_Y_MAX; + return isHorizontallyInBounds(location.x()) + && isHorizontallyInBounds(location.z()) + && WORLD_Y_MIN <= location.y() && location.y() <= WORLD_Y_MAX; } public static void checkLongPackable(BlockVector3 location) { @@ -107,9 +109,9 @@ public abstract class BlockVector3 { private static final class YzxOrderComparator { private static final Comparator YZX_ORDER = - Comparator.comparingInt(BlockVector3::getY) - .thenComparingInt(BlockVector3::getZ) - .thenComparingInt(BlockVector3::getX); + Comparator.comparingInt(BlockVector3::y) + .thenComparingInt(BlockVector3::z) + .thenComparingInt(BlockVector3::x); } @@ -135,57 +137,69 @@ public abstract class BlockVector3 { public long toLongPackedForm() { checkLongPackable(this); - return (getX() & BITS_26) | ((getZ() & BITS_26) << 26) | (((getY() & BITS_12) << (26 + 26))); + return (x() & BITS_26) | ((z() & BITS_26) << 26) | (((y() & BITS_12) << (26 + 26))); } public MutableBlockVector3 mutX(double x) { - return new MutableBlockVector3((int) x, getY(), getZ()); + return new MutableBlockVector3((int) x, y(), z()); } public MutableBlockVector3 mutY(double y) { - return new MutableBlockVector3(getX(), (int) y, getZ()); + return new MutableBlockVector3(x(), (int) y, z()); } public MutableBlockVector3 mutZ(double z) { - return new MutableBlockVector3(getX(), getY(), (int) z); + return new MutableBlockVector3(x(), y(), (int) z); } public MutableBlockVector3 mutX(int x) { - return new MutableBlockVector3(x, getY(), getZ()); + return new MutableBlockVector3(x, y(), z()); } public MutableBlockVector3 mutY(int y) { - return new MutableBlockVector3(getX(), y, getZ()); + return new MutableBlockVector3(x(), y, z()); } public MutableBlockVector3 mutZ(int z) { - return new MutableBlockVector3(getX(), getY(), z); + return new MutableBlockVector3(x(), y(), z); } public BlockVector3 toImmutable() { - return BlockVector3.at(getX(), getY(), getZ()); + return BlockVector3.at(x(), y(), z()); } //FAWE end + //FAWE start - make record getters to abstract methods /** * Get the X coordinate. * * @return the x coordinate + * @since TODO */ - //FAWE start - Made abstract - public abstract int getX(); + public abstract int x(); //FAWE end /** * Get the X coordinate. * * @return the x coordinate + * @deprecated use {@link #x()} instead */ - //FAWE start - getter + @Deprecated(forRemoval = true, since = "TODO") + public int getX() { + return this.x(); //FAWE - access abstract getter instead of local field + } + + /** + * Get the X coordinate. + * + * @return the x coordinate + * @deprecated use {@link #x()} instead + */ + @Deprecated(forRemoval = true, since = "TODO") public int getBlockX() { - return getX(); + return this.x(); //FAWE - access abstract getter instead of local field } - //FAWE end /** * Set the X coordinate. @@ -195,29 +209,42 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 withX(int x) { - return BlockVector3.at(x, getY(), getZ()); + return BlockVector3.at(x, y(), z()); } //FAWE end + + //FAWE start - make record getters to abstract methods /** * Get the Y coordinate. * * @return the y coordinate + * @since TODO */ - //FAWE start - Made abstract - public abstract int getY(); + public abstract int y(); //FAWE end /** * Get the Y coordinate. * * @return the y coordinate + * @deprecated use {@link #y()} instead */ - //FAWE start - getter + @Deprecated(forRemoval = true, since = "TODO") + public int getY() { + return this.y(); //FAWE - access abstract getter instead of local field + } + + /** + * Get the Y coordinate. + * + * @return the y coordinate + * @deprecated use {@link #y()} instead + */ + @Deprecated(forRemoval = true, since = "TODO") public int getBlockY() { - return getY(); + return this.y(); //FAWE - access abstract getter instead of local field } - //FAWE end /** * Set the Y coordinate. @@ -227,29 +254,41 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 withY(int y) { - return BlockVector3.at(getX(), y, getZ()); + return BlockVector3.at(x(), y, z()); } //FAWE end + //FAWE start - make record getters to abstract methods /** * Get the Z coordinate. * - * @return the z coordinate + * @return the Z coordinate + * @since TODO */ - //FAWE start - Made abstract - public abstract int getZ(); + public abstract int z(); //FAWE end /** * Get the Z coordinate. * * @return the z coordinate + * @deprecated use {@link #z()} instead */ - //FAWE start - getter + @Deprecated(forRemoval = true, since = "TODO") + public int getZ() { + return this.z(); //FAWE - access abstract getter instead of local field + } + + /** + * Get the Z coordinate. + * + * @return the z coordinate + * @deprecated use {@link #z()} instead + */ + @Deprecated(forRemoval = true, since = "TODO") public int getBlockZ() { - return getZ(); + return this.z(); //FAWE - access abstract getter instead of local field } - //FAWE end /** * Set the Z coordinate. @@ -259,7 +298,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 withZ(int z) { - return BlockVector3.at(getX(), getY(), z); + return BlockVector3.at(x(), y(), z); } //FAWE end @@ -271,7 +310,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 add(BlockVector3 other) { - return add(other.getX(), other.getY(), other.getZ()); + return add(other.x(), other.y(), other.z()); } //FAWE end @@ -285,7 +324,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 add(int x, int y, int z) { - return BlockVector3.at(this.getX() + x, this.getY() + y, this.getZ() + z); + return BlockVector3.at(this.x() + x, this.y() + y, this.z() + z); } //FAWE end @@ -298,14 +337,14 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 add(BlockVector3... others) { - int newX = getX(); - int newY = getY(); - int newZ = getZ(); + int newX = x(); + int newY = y(); + int newZ = z(); for (BlockVector3 other : others) { - newX += other.getX(); - newY += other.getY(); - newZ += other.getZ(); + newX += other.x(); + newY += other.y(); + newZ += other.z(); } return BlockVector3.at(newX, newY, newZ); @@ -321,7 +360,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 subtract(BlockVector3 other) { - return subtract(other.getX(), other.getY(), other.getZ()); + return subtract(other.x(), other.y(), other.z()); } //FAWE end @@ -336,7 +375,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 subtract(int x, int y, int z) { - return BlockVector3.at(this.getX() - x, this.getY() - y, this.getZ() - z); + return BlockVector3.at(this.x() - x, this.y() - y, this.z() - z); } //FAWE end @@ -349,14 +388,14 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 subtract(BlockVector3... others) { - int newX = getX(); - int newY = getY(); - int newZ = getZ(); + int newX = x(); + int newY = y(); + int newZ = z(); for (BlockVector3 other : others) { - newX -= other.getX(); - newY -= other.getY(); - newZ -= other.getZ(); + newX -= other.x(); + newY -= other.y(); + newZ -= other.z(); } return BlockVector3.at(newX, newY, newZ); @@ -371,7 +410,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 multiply(BlockVector3 other) { - return multiply(other.getX(), other.getY(), other.getZ()); + return multiply(other.x(), other.y(), other.z()); } //FAWE end @@ -385,7 +424,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 multiply(int x, int y, int z) { - return BlockVector3.at(this.getX() * x, this.getY() * y, this.getZ() * z); + return BlockVector3.at(this.x() * x, this.y() * y, this.z() * z); } //FAWE end @@ -397,14 +436,14 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 multiply(BlockVector3... others) { - int newX = getX(); - int newY = getY(); - int newZ = getZ(); + int newX = x(); + int newY = y(); + int newZ = z(); for (BlockVector3 other : others) { - newX *= other.getX(); - newY *= other.getY(); - newZ *= other.getZ(); + newX *= other.x(); + newY *= other.y(); + newZ *= other.z(); } return BlockVector3.at(newX, newY, newZ); @@ -429,7 +468,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 divide(BlockVector3 other) { - return divide(other.getX(), other.getY(), other.getZ()); + return divide(other.x(), other.y(), other.z()); } //FAWE end @@ -443,7 +482,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 divide(int x, int y, int z) { - return BlockVector3.at(this.getX() / x, this.getY() / y, this.getZ() / z); + return BlockVector3.at(this.x() / x, this.y() / y, this.z() / z); } //FAWE end @@ -467,7 +506,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 shr(int x, int y, int z) { - return at(this.getX() >> x, this.getY() >> y, this.getZ() >> z); + return at(this.x() >> x, this.y() >> y, this.z() >> z); } //FAWE end @@ -491,7 +530,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 shl(int x, int y, int z) { - return at(this.getX() << x, this.getY() << y, this.getZ() << z); + return at(this.x() << x, this.y() << y, this.z() << z); } //FAWE end @@ -521,7 +560,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public int lengthSq() { - return getX() * getX() + getY() * getY() + getZ() * getZ(); + return x() * x() + y() * y() + z() * z(); } //FAWE end @@ -543,9 +582,9 @@ public abstract class BlockVector3 { */ //FAWE start - getter public int distanceSq(BlockVector3 other) { - int dx = other.getX() - getX(); - int dy = other.getY() - getY(); - int dz = other.getZ() - getZ(); + int dx = other.x() - x(); + int dy = other.y() - y(); + int dz = other.z() - z(); return dx * dx + dy * dy + dz * dz; } //FAWE end @@ -559,9 +598,9 @@ public abstract class BlockVector3 { //FAWE start - getter public BlockVector3 normalize() { double len = length(); - double x = this.getX() / len; - double y = this.getY() / len; - double z = this.getZ() / len; + double x = this.x() / len; + double y = this.y() / len; + double z = this.z() / len; return BlockVector3.at(x, y, z); } //FAWE end @@ -574,7 +613,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public double dot(BlockVector3 other) { - return getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ(); + return x() * other.x() + y() * other.y() + z() * other.z(); } //FAWE end @@ -587,9 +626,9 @@ public abstract class BlockVector3 { //FAWE start - getter public BlockVector3 cross(BlockVector3 other) { return new BlockVector3Imp( - getY() * other.getZ() - getZ() * other.getY(), - getZ() * other.getX() - getX() * other.getZ(), - getX() * other.getY() - getY() * other.getX() + y() * other.z() - z() * other.y(), + z() * other.x() - x() * other.z(), + x() * other.y() - y() * other.x() ); } //FAWE end @@ -603,8 +642,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public boolean containedWithin(BlockVector3 min, BlockVector3 max) { - return getX() >= min.getX() && getX() <= max.getX() && getY() >= min.getY() && getY() <= max - .getY() && getZ() >= min.getZ() && getZ() <= max.getZ(); + return x() >= min.x() && x() <= max.x() && y() >= min.y() && y() <= max.y() && z() >= min.z() && z() <= max.z(); } //FAWE end @@ -618,11 +656,11 @@ public abstract class BlockVector3 { //FAWE start - getter public BlockVector3 clampY(int min, int max) { checkArgument(min <= max, "minimum cannot be greater than maximum"); - if (getY() < min) { - return BlockVector3.at(getX(), min, getZ()); + if (y() < min) { + return BlockVector3.at(x(), min, z()); } - if (getY() > max) { - return BlockVector3.at(getX(), max, getZ()); + if (y() > max) { + return BlockVector3.at(x(), max, z()); } return this; } @@ -668,7 +706,7 @@ public abstract class BlockVector3 { */ //FAWE start - getter public BlockVector3 abs() { - return BlockVector3.at(Math.abs(getX()), Math.abs(getY()), Math.abs(getZ())); + return BlockVector3.at(Math.abs(x()), Math.abs(y()), Math.abs(z())); } //FAWE end @@ -686,8 +724,8 @@ public abstract class BlockVector3 { //FAWE start - getter public BlockVector3 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { angle = Math.toRadians(angle); - double x = this.getX() - aboutX; - double z = this.getZ() - aboutZ; + double x = this.x() - aboutX; + double z = this.z() - aboutZ; double cos = Math.cos(angle); double sin = Math.sin(angle); double x2 = x * cos - z * sin; @@ -695,7 +733,7 @@ public abstract class BlockVector3 { return BlockVector3.at( x2 + aboutX + translateX, - getY(), + y(), z2 + aboutZ + translateZ ); } @@ -707,16 +745,16 @@ public abstract class BlockVector3 { * @return pitch in radians */ public double toPitch() { - double x = getX(); - double z = getZ(); + double x = x(); + double z = z(); if (x == 0 && z == 0) { - return getY() > 0 ? -90 : 90; + return y() > 0 ? -90 : 90; } else { double x2 = x * x; double z2 = z * z; double xz = Math.sqrt(x2 + z2); - return Math.toDegrees(Math.atan(-getY() / xz)); + return Math.toDegrees(Math.atan(-y() / xz)); } } @@ -726,8 +764,8 @@ public abstract class BlockVector3 { * @return yaw in radians */ public double toYaw() { - double x = getX(); - double z = getZ(); + double x = x(); + double z = z(); double t = Math.atan2(-x, z); double tau = 2 * Math.PI; @@ -744,9 +782,9 @@ public abstract class BlockVector3 { //FAWE start - getter public BlockVector3 getMinimum(BlockVector3 v2) { return new BlockVector3Imp( - Math.min(getX(), v2.getX()), - Math.min(getY(), v2.getY()), - Math.min(getZ(), v2.getZ()) + Math.min(x(), v2.x()), + Math.min(y(), v2.y()), + Math.min(z(), v2.z()) ); } //FAWE end @@ -760,9 +798,9 @@ public abstract class BlockVector3 { //FAWE start - getter public BlockVector3 getMaximum(BlockVector3 v2) { return new BlockVector3Imp( - Math.max(getX(), v2.getX()), - Math.max(getY(), v2.getY()), - Math.max(getZ(), v2.getZ()) + Math.max(x(), v2.x()), + Math.max(y(), v2.y()), + Math.max(z(), v2.z()) ); } //FAWE end @@ -815,19 +853,19 @@ public abstract class BlockVector3 { } public CompoundTag getNbtData(Extent orDefault) { - return orDefault.getFullBlock(getX(), getY(), getZ()).getNbtData(); + return orDefault.getFullBlock(x(), y(), z()).getNbtData(); } public BlockState getOrdinalBelow(Extent orDefault) { - return orDefault.getBlock(getX(), getY() - 1, getZ()); + return orDefault.getBlock(x(), y() - 1, z()); } public BlockState getStateAbove(Extent orDefault) { - return orDefault.getBlock(getX(), getY() + 1, getZ()); + return orDefault.getBlock(x(), y() + 1, z()); } public BlockState getStateRelativeY(Extent orDefault, final int y) { - return orDefault.getBlock(getX(), getY() + y, getZ()); + return orDefault.getBlock(x(), y() + y, z()); } /** @@ -836,21 +874,21 @@ public abstract class BlockVector3 { * @return a new {@link BlockVector2} */ public BlockVector2 toBlockVector2() { - return BlockVector2.at(getX(), getZ()); + return BlockVector2.at(x(), z()); } public Vector3 toVector3() { - return Vector3.at(getX(), getY(), getZ()); + return Vector3.at(x(), y(), z()); } + //FAWE start - not a record, need own implementations @Override public boolean equals(Object obj) { - if (!(obj instanceof BlockVector3)) { + if (!(obj instanceof final BlockVector3 other)) { return false; } - BlockVector3 other = (BlockVector3) obj; - return other.getX() == this.getX() && other.getY() == this.getY() && other.getZ() == this.getZ(); + return other.x() == this.x() && other.y() == this.y() && other.z() == this.z(); } public final boolean equals(BlockVector3 other) { @@ -858,17 +896,18 @@ public abstract class BlockVector3 { return false; } - return other.getX() == this.getX() && other.getY() == this.getY() && other.getZ() == this.getZ(); + return other.x() == this.x() && other.y() == this.y() && other.z() == this.z(); } @Override public int hashCode() { - return (getX() ^ (getZ() << 12)) ^ (getY() << 24); + return (x() ^ (z() << 12)) ^ (y() << 24); } + //FAWE end @Override public String toString() { - return "(" + getX() + ", " + getY() + ", " + getZ() + ")"; + return "(" + x() + ", " + y() + ", " + z() + ")"; } /** @@ -877,7 +916,7 @@ public abstract class BlockVector3 { * @return string */ public String toParserString() { - return getX() + "," + getY() + "," + getZ(); + return x() + "," + y() + "," + z(); } //Used by VS fork diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3Imp.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3Imp.java index ab202e83b..5ec2f4fe2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3Imp.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3Imp.java @@ -56,33 +56,33 @@ public final class BlockVector3Imp extends BlockVector3 { } @Override - public final int getX() { + public int x() { return x; } @Override - public final int getY() { + public int y() { return y; } @Override - public final int getZ() { + public int z() { return z; } @Override public int hashCode() { - return (getX() ^ (getZ() << 12)) ^ (getY() << 24); + return (x() ^ (z() << 12)) ^ (y() << 24); } @Override - public final BlockVector3 toImmutable() { + public BlockVector3 toImmutable() { return this; } @Override public String toString() { - return "(" + getX() + ", " + getY() + ", " + getZ() + ")"; + return "(" + x() + ", " + y() + ", " + z() + ")"; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java index d680b0c0d..9d08676f9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java @@ -19,12 +19,13 @@ package com.sk89q.worldedit.math; +import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.math.transform.AffineTransform; /** * An immutable 2-dimensional vector. */ -public final class Vector2 { +public record Vector2(double x, double z) { public static final Vector2 ZERO = new Vector2(0, 0); public static final Vector2 UNIT_X = new Vector2(1, 0); @@ -50,29 +51,27 @@ public final class Vector2 { return new Vector2(x, z); } - private final double x; - private final double z; - - /** - * Construct an instance. - * - * @param x the X coordinate - * @param z the Z coordinate - */ - private Vector2(double x, double z) { - this.x = x; - this.z = z; - } - /** * Get the X coordinate. * * @return the x coordinate + * @deprecated use {@link #x()} instead */ + @Deprecated(forRemoval = true, since = "TODO") public double getX() { return x; } + /** + * Get the X coordinate, aligned to the block grid. + * + * @return the block-aligned x coordinate + * @since TODO + */ + public int blockX() { + return MathMan.roundInt(x); + } + /** * Set the X coordinate. * @@ -83,11 +82,23 @@ public final class Vector2 { return Vector2.at(x, z); } + /** + * Get the Z coordinate, aligned to the block grid. + * + * @return the block-aligned z coordinate + * @since TODO + */ + public int blockZ() { + return MathMan.roundInt(z); + } + /** * Get the Z coordinate. * * @return the z coordinate + * @deprecated use {@link #z()} instead */ + @Deprecated(forRemoval = true, since = "TODO") public double getZ() { return z; } @@ -458,24 +469,6 @@ public final class Vector2 { return Vector3.at(x, y, z); } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Vector2)) { - return false; - } - - Vector2 other = (Vector2) obj; - return other.x == this.x && other.z == this.z; - - } - - @Override - public int hashCode() { - //FAWE start - XOR over x z calc - return (int) x << 16 ^ (int) z; - //FAWE end - } - @Override public String toString() { return "(" + x + ", " + z + ")"; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java index 5a4d550b4..898bb5241 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java @@ -32,7 +32,9 @@ import static com.google.common.base.Preconditions.checkArgument; /** * An immutable 3-dimensional vector. */ +//FAWE start - not a record, make abstract public abstract class Vector3 { +//FAWE end public static final Vector3 ZERO = Vector3.at(0, 0, 0); public static final Vector3 UNIT_X = Vector3.at(1, 0, 0); @@ -69,9 +71,9 @@ public abstract class Vector3 { private static final Comparator YZX_ORDER = (a, b) -> { return ComparisonChain.start() - .compare(a.getY(), b.getY()) - .compare(a.getZ(), b.getZ()) - .compare(a.getX(), b.getX()) + .compare(a.y(), b.y()) + .compare(a.z(), b.z()) + .compare(a.x(), b.x()) .result(); }; @@ -96,7 +98,7 @@ public abstract class Vector3 { * @return the x coordinate */ public int getBlockX() { - return MathMan.roundInt(getX()); + return MathMan.roundInt(x()); } /** @@ -105,7 +107,7 @@ public abstract class Vector3 { * @return the y coordinate */ public int getBlockY() { - return MathMan.roundInt(getY()); + return MathMan.roundInt(y()); } /** @@ -114,7 +116,7 @@ public abstract class Vector3 { * @return the z coordinate */ public int getBlockZ() { - return MathMan.roundInt(getZ()); + return MathMan.roundInt(z()); } public MutableVector3 setComponents(Vector3 other) { @@ -130,27 +132,27 @@ public abstract class Vector3 { } public MutableVector3 mutX(int x) { - return new MutableVector3(x, getY(), getZ()); + return new MutableVector3(x, y(), z()); } public MutableVector3 mutX(double x) { - return new MutableVector3(x, getY(), getZ()); + return new MutableVector3(x, y(), z()); } public MutableVector3 mutY(int y) { - return new MutableVector3(getX(), y, getZ()); + return new MutableVector3(x(), y, z()); } public MutableVector3 mutY(double y) { - return new MutableVector3(getX(), y, getZ()); + return new MutableVector3(x(), y, z()); } public MutableVector3 mutZ(int z) { - return new MutableVector3(getX(), getY(), z); + return new MutableVector3(x(), y(), z); } public MutableVector3 mutZ(double z) { - return new MutableVector3(getX(), getY(), z); + return new MutableVector3(x(), y(), z); } //FAWE end @@ -158,10 +160,29 @@ public abstract class Vector3 { * Get the X coordinate. * * @return the x coordinate + * @since TODO */ - //FAWE start - made abstract - public abstract double getX(); - //FAWE end + public abstract double x(); + + /** + * Get the X coordinate, aligned to the block grid. + * + * @return the block-aligned x coordinate + */ + public int blockX() { + return MathMan.roundInt(this.x()); + } + + /** + * Get the X coordinate. + * + * @return the x coordinate + * @deprecated use {@link #x()} instead + */ + @Deprecated(forRemoval = true, since = "TODO") + public double getX() { + return this.x(); + } /** * Set the X coordinate. @@ -171,18 +192,38 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 withX(double x) { - return Vector3.at(x, getY(), getZ()); + return Vector3.at(x, y(), z()); } //FAWE end + /** * Get the Y coordinate. * * @return the y coordinate + * @since TODO */ - //FAWE start - made abstract - public abstract double getY(); - //FAWE end + public abstract double y(); + + /** + * Get the Y coordinate, aligned to the block grid. + * + * @return the block-aligned y coordinate + */ + public int blockY() { + return MathMan.roundInt(this.y()); + } + + /** + * Get the Y coordinate. + * + * @return the y coordinate + * @deprecated use {@link #y()} instead + */ + @Deprecated(forRemoval = true, since = "TODO") + public double getY() { + return this.y(); + } /** * Set the Y coordinate. @@ -192,7 +233,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 withY(double y) { - return Vector3.at(getX(), y, getZ()); + return Vector3.at(x(), y, z()); } //FAWE end @@ -200,10 +241,29 @@ public abstract class Vector3 { * Get the Z coordinate. * * @return the z coordinate + * @since TODO */ - //FAWE start - made abstract - public abstract double getZ(); - //FAWE end + public abstract double z(); + + /** + * Get the Z coordinate, aligned to the block grid. + * + * @return the block-aligned z coordinate + */ + public int blockZ() { + return MathMan.roundInt(this.z()); + } + + /** + * Get the Z coordinate. + * + * @return the z coordinate + * @deprecated use {@link #z()} instead + */ + @Deprecated(forRemoval = true, since = "TODO") + public double getZ() { + return this.z(); + } /** * Set the Z coordinate. @@ -213,7 +273,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 withZ(double z) { - return Vector3.at(getX(), getY(), z); + return Vector3.at(x(), y(), z); } //FAWE end @@ -225,7 +285,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 add(Vector3 other) { - return add(other.getX(), other.getY(), other.getZ()); + return add(other.x(), other.y(), other.z()); } //FAWE end @@ -239,7 +299,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 add(double x, double y, double z) { - return Vector3.at(this.getX() + x, this.getY() + y, this.getZ() + z); + return Vector3.at(this.x() + x, this.y() + y, this.z() + z); } //FAWE end @@ -252,14 +312,14 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 add(Vector3... others) { - double newX = getX(); - double newY = getY(); - double newZ = getZ(); + double newX = x(); + double newY = y(); + double newZ = z(); for (Vector3 other : others) { - newX += other.getX(); - newY += other.getY(); - newZ += other.getZ(); + newX += other.x(); + newY += other.y(); + newZ += other.z(); } return Vector3.at(newX, newY, newZ); @@ -275,7 +335,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 subtract(Vector3 other) { - return subtract(other.getX(), other.getY(), other.getZ()); + return subtract(other.x(), other.y(), other.z()); } //FAWE end @@ -290,7 +350,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 subtract(double x, double y, double z) { - return Vector3.at(this.getX() - x, this.getY() - y, this.getZ() - z); + return Vector3.at(this.x() - x, this.y() - y, this.z() - z); } //FAWE end @@ -303,14 +363,14 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 subtract(Vector3... others) { - double newX = getX(); - double newY = getY(); - double newZ = getZ(); + double newX = x(); + double newY = y(); + double newZ = z(); for (Vector3 other : others) { - newX -= other.getX(); - newY -= other.getY(); - newZ -= other.getZ(); + newX -= other.x(); + newY -= other.y(); + newZ -= other.z(); } return Vector3.at(newX, newY, newZ); @@ -325,7 +385,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 multiply(Vector3 other) { - return multiply(other.getX(), other.getY(), other.getZ()); + return multiply(other.x(), other.y(), other.z()); } //FAWE end @@ -339,7 +399,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 multiply(double x, double y, double z) { - return Vector3.at(this.getX() * x, this.getY() * y, this.getZ() * z); + return Vector3.at(this.x() * x, this.y() * y, this.z() * z); } //FAWE end @@ -351,14 +411,14 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 multiply(Vector3... others) { - double newX = getX(); - double newY = getY(); - double newZ = getZ(); + double newX = x(); + double newY = y(); + double newZ = z(); for (Vector3 other : others) { - newX *= other.getX(); - newY *= other.getY(); - newZ *= other.getZ(); + newX *= other.x(); + newY *= other.y(); + newZ *= other.z(); } return Vector3.at(newX, newY, newZ); @@ -383,7 +443,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 divide(Vector3 other) { - return divide(other.getX(), other.getY(), other.getZ()); + return divide(other.x(), other.y(), other.z()); } //FAWE end @@ -397,7 +457,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 divide(double x, double y, double z) { - return Vector3.at(this.getX() / x, this.getY() / y, this.getZ() / z); + return Vector3.at(this.x() / x, this.y() / y, this.z() / z); } //FAWE end @@ -427,7 +487,7 @@ public abstract class Vector3 { */ //FAWE start - getter public double lengthSq() { - return getX() * getX() + getY() * getY() + getZ() * getZ(); + return x() * x() + y() * y() + z() * z(); } //FAWE end @@ -449,9 +509,9 @@ public abstract class Vector3 { */ //FAWE start - getter public double distanceSq(Vector3 other) { - double dx = other.getX() - getX(); - double dy = other.getY() - getY(); - double dz = other.getZ() - getZ(); + double dx = other.x() - x(); + double dy = other.y() - y(); + double dz = other.z() - z(); return dx * dx + dy * dy + dz * dz; } //FAWE end @@ -474,7 +534,7 @@ public abstract class Vector3 { */ //FAWE start - getter public double dot(Vector3 other) { - return getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ(); + return x() * other.x() + y() * other.y() + z() * other.z(); } //FAWE end @@ -487,9 +547,9 @@ public abstract class Vector3 { //FAWE start - getter public Vector3 cross(Vector3 other) { return Vector3.at( - getY() * other.getZ() - getZ() * other.getY(), - getZ() * other.getX() - getX() * other.getZ(), - getX() * other.getY() - getY() * other.getX() + y() * other.z() - z() * other.y(), + z() * other.x() - x() * other.z(), + x() * other.y() - y() * other.x() ); } //FAWE end @@ -503,8 +563,7 @@ public abstract class Vector3 { */ //FAWE start - getter public boolean containedWithin(Vector3 min, Vector3 max) { - return getX() >= min.getX() && getX() <= max.getX() && getY() >= min.getY() && getY() <= max.getY() && getZ() >= min.getZ() && getZ() <= max - .getZ(); + return x() >= min.x() && x() <= max.x() && y() >= min.y() && y() <= max.y() && z() >= min.z() && z() <= max.z(); } //FAWE end @@ -518,11 +577,11 @@ public abstract class Vector3 { //FAWE start - getter public Vector3 clampY(int min, int max) { checkArgument(min <= max, "minimum cannot be greater than maximum"); - if (getY() < min) { - return Vector3.at(getX(), min, getZ()); + if (y() < min) { + return Vector3.at(x(), min, z()); } - if (getY() > max) { - return Vector3.at(getX(), max, getZ()); + if (y() > max) { + return Vector3.at(x(), max, z()); } return this; } @@ -535,7 +594,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 floor() { - return Vector3.at(Math.floor(getX()), Math.floor(getY()), Math.floor(getZ())); + return Vector3.at(Math.floor(x()), Math.floor(y()), Math.floor(z())); } //FAWE end @@ -546,7 +605,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 ceil() { - return Vector3.at(Math.ceil(getX()), Math.ceil(getY()), Math.ceil(getZ())); + return Vector3.at(Math.ceil(x()), Math.ceil(y()), Math.ceil(z())); } //FAWE end @@ -559,7 +618,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 round() { - return Vector3.at(Math.floor(getX() + 0.5), Math.floor(getY() + 0.5), Math.floor(getZ() + 0.5)); + return Vector3.at(Math.floor(x() + 0.5), Math.floor(y() + 0.5), Math.floor(z() + 0.5)); } //FAWE end @@ -570,7 +629,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 roundHalfUp() { - return Vector3.at(MathUtils.roundHalfUp(getX()), MathUtils.roundHalfUp(getY()), MathUtils.roundHalfUp(getZ())); + return Vector3.at(MathUtils.roundHalfUp(x()), MathUtils.roundHalfUp(y()), MathUtils.roundHalfUp(z())); } //FAWE end @@ -582,7 +641,7 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector3 abs() { - return Vector3.at(Math.abs(getX()), Math.abs(getY()), Math.abs(getZ())); + return Vector3.at(Math.abs(x()), Math.abs(y()), Math.abs(z())); } //FAWE end @@ -600,8 +659,8 @@ public abstract class Vector3 { //FAWE start - getter public Vector3 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { angle = Math.toRadians(angle); - double x = this.getX() - aboutX; - double z = this.getZ() - aboutZ; + double x = this.x() - aboutX; + double z = this.z() - aboutZ; double cos = Math.cos(angle); double sin = Math.sin(angle); double x2 = x * cos - z * sin; @@ -609,7 +668,7 @@ public abstract class Vector3 { return Vector3.at( x2 + aboutX + translateX, - getY(), + y(), z2 + aboutZ + translateZ ); } @@ -621,16 +680,16 @@ public abstract class Vector3 { * @return pitch in radians */ public double toPitch() { - double x = getX(); - double z = getZ(); + double x = x(); + double z = z(); if (x == 0 && z == 0) { - return getY() > 0 ? -90 : 90; + return y() > 0 ? -90 : 90; } else { double x2 = x * x; double z2 = z * z; double xz = Math.sqrt(x2 + z2); - return Math.toDegrees(Math.atan(-getY() / xz)); + return Math.toDegrees(Math.atan(-y() / xz)); } } @@ -640,8 +699,8 @@ public abstract class Vector3 { * @return yaw in radians */ public double toYaw() { - double x = getX(); - double z = getZ(); + double x = x(); + double z = z(); double t = Math.atan2(-x, z); double tau = 2 * Math.PI; @@ -658,9 +717,9 @@ public abstract class Vector3 { //FAWE start - getter public Vector3 getMinimum(Vector3 v2) { return Vector3.at( - Math.min(getX(), v2.getX()), - Math.min(getY(), v2.getY()), - Math.min(getZ(), v2.getZ()) + Math.min(x(), v2.x()), + Math.min(y(), v2.y()), + Math.min(z(), v2.z()) ); } //FAWE end @@ -674,9 +733,9 @@ public abstract class Vector3 { //FAWE start - getter public Vector3 getMaximum(Vector3 v2) { return Vector3.at( - Math.max(getX(), v2.getX()), - Math.max(getY(), v2.getY()), - Math.max(getZ(), v2.getZ()) + Math.max(x(), v2.x()), + Math.max(y(), v2.y()), + Math.max(z(), v2.z()) ); } //FAWE end @@ -700,7 +759,7 @@ public abstract class Vector3 { */ //FAWE start - getter public BlockVector3 toBlockPoint() { - return toBlockPoint(getX(), getY(), getZ()); + return toBlockPoint(x(), y(), z()); } //FAWE end @@ -711,24 +770,20 @@ public abstract class Vector3 { */ //FAWE start - getter public Vector2 toVector2() { - return Vector2.at(getX(), getZ()); + return Vector2.at(x(), z()); } //FAWE end + //FAWE start - not a record, need own implementations @Override public boolean equals(Object obj) { - if (!(obj instanceof Vector3)) { + if (!(obj instanceof final Vector3 other)) { return false; } - Vector3 other = (Vector3) obj; - //FAWE start - getter - return other.getX() == this.getX() && other.getY() == this.getY() && other.getZ() == this.getZ(); - //FAWE end + return other.x() == this.x() && other.y() == this.y() && other.z() == this.z(); } - //FAWE start - /** * Tests if vectors are equal, accounting for floating point errors * @@ -741,28 +796,27 @@ public abstract class Vector3 { } // Minecraft deals in whole blocks, thus any difference smaller than this is unnecessary - if (Math.abs(getX() - other.getX()) > 0.000001d) { + if (Math.abs(x() - other.x()) > 0.000001d) { return false; } - if (Math.abs(getY() - other.getY()) > 0.000001d) { + if (Math.abs(y() - other.y()) > 0.000001d) { return false; } - return !(Math.abs(getZ() - other.getZ()) > 0.000001d); + return !(Math.abs(z() - other.z()) > 0.000001d); + } + + @Override + public int hashCode() { + return (int) x() ^ (int) z() << 12 ^ (int) y() << 24; } //FAWE end - @Override - //FAWE start - XOR over get calculating all values independently - public int hashCode() { - return (int) getX() ^ (int) getZ() << 12 ^ (int) getY() << 24; - } - @Override public String toString() { //FAWE start - getter & ternary - String x = (getX() == getBlockX() ? "" + getBlockX() : "" + getX()); - String y = (getY() == getBlockY() ? "" + getBlockY() : "" + getY()); - String z = (getZ() == getBlockZ() ? "" + getBlockZ() : "" + getZ()); + String x = (x() == blockX() ? "" + blockX() : "" + x()); + String y = (y() == blockY() ? "" + blockY() : "" + y()); + String z = (z() == blockZ() ? "" + blockZ() : "" + z()); //FAWE end return "(" + x + ", " + y + ", " + z + ")"; } @@ -774,7 +828,7 @@ public abstract class Vector3 { */ //FAWE start - getter public String toParserString() { - return getX() + "," + getY() + "," + getZ(); + return x() + "," + y() + "," + z(); } //FAWE end diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java index 68e62e937..0eeabee70 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java @@ -89,10 +89,10 @@ public class HeightMap { this.maxSessionY = session.getMaxY(); //FAWE end - int minX = region.getMinimumPoint().getBlockX(); - int minY = region.getMinimumPoint().getBlockY(); - int minZ = region.getMinimumPoint().getBlockZ(); - int maxY = region.getMaximumPoint().getBlockY(); + int minX = region.getMinimumPoint().x(); + int minY = region.getMinimumPoint().y(); + int minZ = region.getMinimumPoint().z(); + int maxY = region.getMaximumPoint().y(); // Store current heightmap data data = new int[width * height]; @@ -100,14 +100,14 @@ public class HeightMap { //FAWE start if (layers) { BlockVector3 min = region.getMinimumPoint(); - int bx = min.getBlockX(); - int bz = min.getBlockZ(); + int bx = min.x(); + int bz = min.z(); Iterator flat = Regions.asFlatRegion(region).asFlatRegion().iterator(); int layer = session.getMinY(); while (flat.hasNext()) { BlockVector2 pos = flat.next(); - int x = pos.getBlockX(); - int z = pos.getBlockZ(); + int x = pos.x(); + int z = pos.z(); layer = session.getNearestSurfaceLayer(x, z, (layer + 7) >> 3, session.getMinY(), maxY); data[(z - bz) * width + (x - bx)] = layer; } @@ -169,10 +169,10 @@ public class HeightMap { checkNotNull(data); BlockVector3 min = region.getMinimumPoint(); - int originX = min.getBlockX(); - int originZ = min.getBlockZ(); + int originX = min.x(); + int originZ = min.z(); - int maxY = region.getMaximumPoint().getBlockY(); + int maxY = region.getMaximumPoint().y(); BlockState fillerAir = BlockTypes.AIR.getDefaultState(); @@ -261,11 +261,11 @@ public class HeightMap { checkNotNull(data); BlockVector3 min = region.getMinimumPoint(); - int originX = min.getBlockX(); - int originY = min.getBlockY(); - int originZ = min.getBlockZ(); + int originX = min.x(); + int originY = min.y(); + int originZ = min.z(); - int maxY = region.getMaximumPoint().getBlockY(); + int maxY = region.getMaximumPoint().y(); BlockState fillerAir = BlockTypes.AIR.getDefaultState(); int blocksChanged = 0; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/SnowHeightMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/SnowHeightMap.java index 97f58f9e1..0c12c4652 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/SnowHeightMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/SnowHeightMap.java @@ -65,10 +65,10 @@ public class SnowHeightMap { this.width = region.getWidth(); this.height = region.getLength(); - int minX = region.getMinimumPoint().getBlockX(); - int minY = region.getMinimumPoint().getBlockY(); - int minZ = region.getMinimumPoint().getBlockZ(); - int maxY = region.getMaximumPoint().getBlockY(); + int minX = region.getMinimumPoint().x(); + int minY = region.getMinimumPoint().y(); + int minZ = region.getMinimumPoint().z(); + int maxY = region.getMaximumPoint().y(); // Store current heightmap data data = new float[width * height]; @@ -134,11 +134,11 @@ public class SnowHeightMap { checkNotNull(data); BlockVector3 minY = region.getMinimumPoint(); - int originX = minY.getBlockX(); - int originY = minY.getBlockY(); - int originZ = minY.getBlockZ(); + int originX = minY.x(); + int originY = minY.y(); + int originZ = minY.z(); - int maxY = region.getMaximumPoint().getBlockY(); + int maxY = region.getMaximumPoint().y(); BlockState fillerAir = BlockTypes.AIR.getDefaultState(); BlockState fillerSnow = BlockTypes.SNOW_BLOCK.getDefaultState(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java index 561ba14bf..0ecced12e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java @@ -164,10 +164,10 @@ public class KochanekBartelsInterpolation implements Interpolation { //FAWE start double r2 = remainder * remainder; double r3 = r2 * remainder; - mutable.mutX((a.getX() * r3 + b.getX() * r2 + c.getX() * remainder + d.getX())); - mutable.mutY((a.getY() * r3 + b.getY() * r2 + c.getY() * remainder + d.getY())); - mutable.mutZ((a.getZ() * r3 + b.getZ() * r2 + c.getZ() * remainder + d.getZ())); - return Vector3.at(mutable.getX(), mutable.getY(), mutable.getZ()); + mutable.mutX((a.x() * r3 + b.x() * r2 + c.x() * remainder + d.x())); + mutable.mutY((a.y() * r3 + b.y() * r2 + c.y() * remainder + d.y())); + mutable.mutZ((a.z() * r3 + b.z() * r2 + c.z() * remainder + d.z())); + return Vector3.at(mutable.x(), mutable.y(), mutable.z()); //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/JLibNoiseGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/JLibNoiseGenerator.java index a7f3fe449..c541d2d3d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/JLibNoiseGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/JLibNoiseGenerator.java @@ -47,12 +47,12 @@ abstract class JLibNoiseGenerator implements NoiseGenerator { @Override public float noise(Vector2 position) { - return forceRange(module.GetValue(position.getX(), 0, position.getZ())); + return forceRange(module.GetValue(position.x(), 0, position.z())); } @Override public float noise(Vector3 position) { - return forceRange(module.GetValue(position.getX(), position.getY(), position.getZ())); + return forceRange(module.GetValue(position.x(), position.y(), position.z())); } private float forceRange(double value) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java index 02ee75d44..92e81eea2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java @@ -265,11 +265,11 @@ public class AffineTransform implements Transform, Serializable { } public AffineTransform translate(Vector3 vec) { - return translate(vec.getX(), vec.getY(), vec.getZ()); + return translate(vec.x(), vec.y(), vec.z()); } public AffineTransform translate(BlockVector3 vec) { - return translate(vec.getX(), vec.getY(), vec.getZ()); + return translate(vec.x(), vec.y(), vec.z()); } public AffineTransform translate(double x, double y, double z) { @@ -315,29 +315,29 @@ public class AffineTransform implements Transform, Serializable { } public AffineTransform scale(Vector3 vec) { - return scale(vec.getX(), vec.getY(), vec.getZ()); + return scale(vec.x(), vec.y(), vec.z()); } //FAWE start public boolean isScaled(Vector3 vector) { - boolean flip = vector.getX() != 0 && m00 < 0; - if (vector.getY() != 0 && m11 < 0) { + boolean flip = vector.x() != 0 && m00 < 0; + if (vector.y() != 0 && m11 < 0) { flip = !flip; } - if (vector.getZ() != 0 && m22 < 0) { + if (vector.z() != 0 && m22 < 0) { flip = !flip; } if (flip) { return true; } // Check for flip-and-rotate - if (vector.getX() != 0 && vector.getY() != 0 && ((m01 < 0 && m10 < 0) || (m01 > 0 && m10 > 0))) { + if (vector.x() != 0 && vector.y() != 0 && ((m01 < 0 && m10 < 0) || (m01 > 0 && m10 > 0))) { flip = true; } - if (vector.getX() != 0 && vector.getZ() != 0 && ((m02 < 0 && m20 < 0) || (m02 > 0 && m20 > 0))) { + if (vector.x() != 0 && vector.z() != 0 && ((m02 < 0 && m20 < 0) || (m02 > 0 && m20 > 0))) { flip = !flip; } - if (vector.getY() != 0 && vector.getZ() != 0 && ((m12 < 0 && m21 < 0) || (m12 > 0 && m21 > 0))) { + if (vector.y() != 0 && vector.z() != 0 && ((m12 < 0 && m21 < 0) || (m12 > 0 && m21 > 0))) { flip = !flip; } return flip; @@ -346,9 +346,9 @@ public class AffineTransform implements Transform, Serializable { @Override public Vector3 apply(Vector3 vector) { - double x = (vector.getX() * m00 + vector.getY() * m01 + vector.getZ() * m02 + m03); - double y = (vector.getX() * m10 + vector.getY() * m11 + vector.getZ() * m12 + m13); - double z = (vector.getX() * m20 + vector.getY() * m21 + vector.getZ() * m22 + m23); + double x = (vector.x() * m00 + vector.y() * m01 + vector.z() * m02 + m03); + double y = (vector.x() * m10 + vector.y() * m11 + vector.z() * m12 + m13); + double z = (vector.x() * m20 + vector.y() * m21 + vector.z() * m22 + m23); vector = vector.mutX(x); vector = vector.mutY(y); vector = vector.mutZ(z); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractFlatRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractFlatRegion.java index 8534f0f35..a868e0262 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractFlatRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractFlatRegion.java @@ -29,12 +29,12 @@ public abstract class AbstractFlatRegion extends AbstractRegion implements FlatR @Override public int getMinimumY() { - return getMinimumPoint().getBlockY(); + return getMinimumPoint().y(); } @Override public int getMaximumY() { - return getMaximumPoint().getBlockY(); + return getMaximumPoint().y(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java index 85979b217..f87f9741b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java @@ -20,8 +20,6 @@ package com.sk89q.worldedit.regions; import com.fastasyncworldedit.core.math.BlockVectorSet; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; @@ -109,10 +107,10 @@ public abstract class AbstractRegion extends AbstractSet implement final List points = new ArrayList<>(4); - points.add(BlockVector2.at(min.getX(), min.getZ())); - points.add(BlockVector2.at(min.getX(), max.getZ())); - points.add(BlockVector2.at(max.getX(), max.getZ())); - points.add(BlockVector2.at(max.getX(), min.getZ())); + points.add(BlockVector2.at(min.x(), min.z())); + points.add(BlockVector2.at(min.x(), max.z())); + points.add(BlockVector2.at(max.x(), max.z())); + points.add(BlockVector2.at(max.x(), min.z())); return points; } @@ -122,9 +120,9 @@ public abstract class AbstractRegion extends AbstractSet implement BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - return (max.getX() - min.getX() + 1L) - * (max.getY() - min.getY() + 1L) - * (max.getZ() - min.getZ() + 1L); + return (max.x() - min.x() + 1L) + * (max.y() - min.y() + 1L) + * (max.z() - min.z() + 1L); } /** @@ -137,7 +135,7 @@ public abstract class AbstractRegion extends AbstractSet implement BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - return max.getX() - min.getX() + 1; + return max.x() - min.x() + 1; } /** @@ -150,7 +148,7 @@ public abstract class AbstractRegion extends AbstractSet implement BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - return max.getY() - min.getY() + 1; + return max.y() - min.y() + 1; } /** @@ -163,7 +161,7 @@ public abstract class AbstractRegion extends AbstractSet implement BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - return max.getZ() - min.getZ() + 1; + return max.z() - min.z() + 1; } /** @@ -179,12 +177,12 @@ public abstract class AbstractRegion extends AbstractSet implement final BlockVector3 maxBlock = getMaximumPoint(); //FAWE start - final BlockVector2 min = BlockVector2.at(minBlock.getX() >> 4, minBlock.getZ() >> 4); - final BlockVector2 max = BlockVector2.at(maxBlock.getX() >> 4, maxBlock.getZ() >> 4); + final BlockVector2 min = BlockVector2.at(minBlock.x() >> 4, minBlock.z() >> 4); + final BlockVector2 max = BlockVector2.at(maxBlock.x() >> 4, maxBlock.z() >> 4); //FAWE end - for (int X = min.getBlockX(); X <= max.getBlockX(); ++X) { - for (int Z = min.getBlockZ(); Z <= max.getBlockZ(); ++Z) { + for (int X = min.x(); X <= max.x(); ++X) { + for (int Z = min.z(); Z <= max.z(); ++Z) { if (containsChunk(X, Z)) { chunks.add(BlockVector2.at(X, Z)); } @@ -201,9 +199,9 @@ public abstract class AbstractRegion extends AbstractSet implement final BlockVector3 min = getMinimumPoint(); final BlockVector3 max = getMaximumPoint(); - for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) { - for (int y = min.getBlockY(); y <= max.getBlockY(); ++y) { - for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) { + for (int x = min.x(); x <= max.x(); ++x) { + for (int y = min.y(); y <= max.y(); ++y) { + for (int z = min.z(); z <= max.z(); ++z) { if (!contains(BlockVector3.at(x, y, z))) { continue; } 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 16906b0b9..a05c8b4a7 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 @@ -160,12 +160,12 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } pos1 = pos1.clampY(getWorldMinY(), getWorldMaxY()); pos2 = pos2.clampY(getWorldMinY(), getWorldMaxY()); - minX = Math.min(pos1.getX(), pos2.getX()); - minY = Math.min(pos1.getY(), pos2.getY()); - minZ = Math.min(pos1.getZ(), pos2.getZ()); - maxX = Math.max(pos1.getX(), pos2.getX()); - maxY = Math.max(pos1.getY(), pos2.getY()); - maxZ = Math.max(pos1.getZ(), pos2.getZ()); + minX = Math.min(pos1.x(), pos2.x()); + minY = Math.min(pos1.y(), pos2.y()); + minZ = Math.min(pos1.z(), pos2.z()); + maxX = Math.max(pos1.x(), pos2.x()); + maxY = Math.max(pos1.y(), pos2.y()); + maxZ = Math.max(pos1.z(), pos2.z()); } //FAWE start - allow region to be created without clamping Y @@ -176,12 +176,12 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { if (pos1 == null || pos2 == null) { return; } - minX = Math.min(pos1.getX(), pos2.getX()); - minY = Math.min(pos1.getY(), pos2.getY()); - minZ = Math.min(pos1.getZ(), pos2.getZ()); - maxX = Math.max(pos1.getX(), pos2.getX()); - maxY = Math.max(pos1.getY(), pos2.getY()); - maxZ = Math.max(pos1.getZ(), pos2.getZ()); + minX = Math.min(pos1.x(), pos2.x()); + minY = Math.min(pos1.y(), pos2.y()); + minZ = Math.min(pos1.z(), pos2.z()); + maxX = Math.max(pos1.x(), pos2.x()); + maxY = Math.max(pos1.y(), pos2.y()); + maxZ = Math.max(pos1.z(), pos2.z()); } //FAWE end @@ -196,16 +196,16 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { return new RegionIntersection( // Project to Z-Y plane - new CuboidRegion(pos1.withX(min.getX()), pos2.withX(min.getX())), - new CuboidRegion(pos1.withX(max.getX()), pos2.withX(max.getX())), + new CuboidRegion(pos1.withX(min.x()), pos2.withX(min.x())), + new CuboidRegion(pos1.withX(max.x()), pos2.withX(max.x())), // Project to X-Y plane - new CuboidRegion(pos1.withZ(min.getZ()), pos2.withZ(min.getZ())), - new CuboidRegion(pos1.withZ(max.getZ()), pos2.withZ(max.getZ())), + new CuboidRegion(pos1.withZ(min.z()), pos2.withZ(min.z())), + new CuboidRegion(pos1.withZ(max.z()), pos2.withZ(max.z())), // Project to the X-Z plane - new CuboidRegion(pos1.withY(min.getY()), pos2.withY(min.getY())), - new CuboidRegion(pos1.withY(max.getY()), pos2.withY(max.getY())) + new CuboidRegion(pos1.withY(min.y()), pos2.withY(min.y())), + new CuboidRegion(pos1.withY(max.y()), pos2.withY(max.y())) ); } @@ -221,7 +221,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { BlockVector3 dimensions = getDimensions(); //FAWE start - if (dimensions.getX() <= 2 || dimensions.getZ() <= 2) { + if (dimensions.x() <= 2 || dimensions.z() <= 2) { // The wall are the region return new RegionIntersection(this); } @@ -229,18 +229,18 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { return new RegionIntersection( // Project to Z-Y plane - new CuboidRegion(pos1.withX(min.getX()), pos2.withX(min.getX())), - new CuboidRegion(pos1.withX(max.getX()), pos2.withX(max.getX())), + new CuboidRegion(pos1.withX(min.x()), pos2.withX(min.x())), + new CuboidRegion(pos1.withX(max.x()), pos2.withX(max.x())), // Project to X-Y plane //FAWE start = prevent overlap new CuboidRegion( - pos1.withZ(min.getZ()).add(BlockVector3.UNIT_X), - pos2.withZ(min.getZ()).subtract(BlockVector3.UNIT_X) + pos1.withZ(min.z()).add(BlockVector3.UNIT_X), + pos2.withZ(min.z()).subtract(BlockVector3.UNIT_X) ), new CuboidRegion( - pos1.withZ(max.getZ()).add(BlockVector3.UNIT_X), - pos2.withZ(max.getZ()).subtract(BlockVector3.UNIT_X) + pos1.withZ(max.z()).add(BlockVector3.UNIT_X), + pos2.withZ(max.z()).subtract(BlockVector3.UNIT_X) ) //FAWE end ); @@ -276,45 +276,45 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { checkNotNull(changes); for (BlockVector3 change : changes) { - if (change.getX() > 0) { - if (Math.max(pos1.getX(), pos2.getX()) == pos1.getX()) { - pos1 = pos1.add(change.getX(), 0, 0); + if (change.x() > 0) { + if (Math.max(pos1.x(), pos2.x()) == pos1.x()) { + pos1 = pos1.add(change.x(), 0, 0); } else { - pos2 = pos2.add(change.getX(), 0, 0); + pos2 = pos2.add(change.x(), 0, 0); } } else { - if (Math.min(pos1.getX(), pos2.getX()) == pos1.getX()) { - pos1 = pos1.add(change.getX(), 0, 0); + if (Math.min(pos1.x(), pos2.x()) == pos1.x()) { + pos1 = pos1.add(change.x(), 0, 0); } else { - pos2 = pos2.add(change.getX(), 0, 0); + pos2 = pos2.add(change.x(), 0, 0); } } - if (change.getY() > 0) { - if (Math.max(pos1.getY(), pos2.getY()) == pos1.getY()) { - pos1 = pos1.add(0, change.getY(), 0); + if (change.y() > 0) { + if (Math.max(pos1.y(), pos2.y()) == pos1.y()) { + pos1 = pos1.add(0, change.y(), 0); } else { - pos2 = pos2.add(0, change.getY(), 0); + pos2 = pos2.add(0, change.y(), 0); } } else { - if (Math.min(pos1.getY(), pos2.getY()) == pos1.getY()) { - pos1 = pos1.add(0, change.getY(), 0); + if (Math.min(pos1.y(), pos2.y()) == pos1.y()) { + pos1 = pos1.add(0, change.y(), 0); } else { - pos2 = pos2.add(0, change.getY(), 0); + pos2 = pos2.add(0, change.y(), 0); } } - if (change.getZ() > 0) { - if (Math.max(pos1.getZ(), pos2.getZ()) == pos1.getZ()) { - pos1 = pos1.add(0, 0, change.getZ()); + if (change.z() > 0) { + if (Math.max(pos1.z(), pos2.z()) == pos1.z()) { + pos1 = pos1.add(0, 0, change.z()); } else { - pos2 = pos2.add(0, 0, change.getZ()); + pos2 = pos2.add(0, 0, change.z()); } } else { - if (Math.min(pos1.getZ(), pos2.getZ()) == pos1.getZ()) { - pos1 = pos1.add(0, 0, change.getZ()); + if (Math.min(pos1.z(), pos2.z()) == pos1.z()) { + pos1 = pos1.add(0, 0, change.z()); } else { - pos2 = pos2.add(0, 0, change.getZ()); + pos2 = pos2.add(0, 0, change.z()); } } } @@ -327,45 +327,45 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { checkNotNull(changes); for (BlockVector3 change : changes) { - if (change.getX() < 0) { - if (Math.max(pos1.getX(), pos2.getX()) == pos1.getX()) { - pos1 = pos1.add(change.getX(), 0, 0); + if (change.x() < 0) { + if (Math.max(pos1.x(), pos2.x()) == pos1.x()) { + pos1 = pos1.add(change.x(), 0, 0); } else { - pos2 = pos2.add(change.getX(), 0, 0); + pos2 = pos2.add(change.x(), 0, 0); } } else { - if (Math.min(pos1.getX(), pos2.getX()) == pos1.getX()) { - pos1 = pos1.add(change.getX(), 0, 0); + if (Math.min(pos1.x(), pos2.x()) == pos1.x()) { + pos1 = pos1.add(change.x(), 0, 0); } else { - pos2 = pos2.add(change.getX(), 0, 0); + pos2 = pos2.add(change.x(), 0, 0); } } - if (change.getY() < 0) { - if (Math.max(pos1.getY(), pos2.getY()) == pos1.getY()) { - pos1 = pos1.add(0, change.getY(), 0); + if (change.y() < 0) { + if (Math.max(pos1.y(), pos2.y()) == pos1.y()) { + pos1 = pos1.add(0, change.y(), 0); } else { - pos2 = pos2.add(0, change.getY(), 0); + pos2 = pos2.add(0, change.y(), 0); } } else { - if (Math.min(pos1.getY(), pos2.getY()) == pos1.getY()) { - pos1 = pos1.add(0, change.getY(), 0); + if (Math.min(pos1.y(), pos2.y()) == pos1.y()) { + pos1 = pos1.add(0, change.y(), 0); } else { - pos2 = pos2.add(0, change.getY(), 0); + pos2 = pos2.add(0, change.y(), 0); } } - if (change.getZ() < 0) { - if (Math.max(pos1.getZ(), pos2.getZ()) == pos1.getZ()) { - pos1 = pos1.add(0, 0, change.getZ()); + if (change.z() < 0) { + if (Math.max(pos1.z(), pos2.z()) == pos1.z()) { + pos1 = pos1.add(0, 0, change.z()); } else { - pos2 = pos2.add(0, 0, change.getZ()); + pos2 = pos2.add(0, 0, change.z()); } } else { - if (Math.min(pos1.getZ(), pos2.getZ()) == pos1.getZ()) { - pos1 = pos1.add(0, 0, change.getZ()); + if (Math.min(pos1.z(), pos2.z()) == pos1.z()) { + pos1 = pos1.add(0, 0, change.z()); } else { - pos2 = pos2.add(0, 0, change.getZ()); + pos2 = pos2.add(0, 0, change.z()); } } } @@ -385,10 +385,10 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { public Set getChunks() { BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - final int maxX = max.getBlockX() >> ChunkStore.CHUNK_SHIFTS; - final int minX = min.getBlockX() >> ChunkStore.CHUNK_SHIFTS; - final int maxZ = max.getBlockZ() >> ChunkStore.CHUNK_SHIFTS; - final int minZ = min.getBlockZ() >> ChunkStore.CHUNK_SHIFTS; + final int maxX = max.x() >> ChunkStore.CHUNK_SHIFTS; + final int minX = min.x() >> ChunkStore.CHUNK_SHIFTS; + final int maxZ = max.z() >> ChunkStore.CHUNK_SHIFTS; + final int minZ = min.z() >> ChunkStore.CHUNK_SHIFTS; final int size = (maxX - minX + 1) * (maxZ - minZ + 1); //FAWE start @@ -471,7 +471,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { public boolean contains(Object o) { if (o instanceof BlockVector2) { BlockVector2 cv = (BlockVector2) o; - return cv.getX() >= minX && cv.getX() <= maxX && cv.getZ() >= minZ && cv.getZ() <= maxZ; + return cv.x() >= minX && cv.x() <= maxX && cv.z() >= minZ && cv.z() <= maxZ; } return false; } @@ -488,9 +488,9 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - for (int x = min.getBlockX() >> ChunkStore.CHUNK_SHIFTS; x <= max.getBlockX() >> ChunkStore.CHUNK_SHIFTS; ++x) { - for (int z = min.getBlockZ() >> ChunkStore.CHUNK_SHIFTS; z <= max.getBlockZ() >> ChunkStore.CHUNK_SHIFTS; ++z) { - for (int y = min.getBlockY() >> ChunkStore.CHUNK_SHIFTS; y <= max.getBlockY() >> ChunkStore.CHUNK_SHIFTS; ++y) { + for (int x = min.x() >> ChunkStore.CHUNK_SHIFTS; x <= max.x() >> ChunkStore.CHUNK_SHIFTS; ++x) { + for (int z = min.z() >> ChunkStore.CHUNK_SHIFTS; z <= max.z() >> ChunkStore.CHUNK_SHIFTS; ++z) { + for (int y = min.y() >> ChunkStore.CHUNK_SHIFTS; y <= max.y() >> ChunkStore.CHUNK_SHIFTS; ++y) { chunks.add(BlockVector3.at(x, y, z)); } } @@ -503,7 +503,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public boolean contains(BlockVector3 position) { //FAWE start - return contains(position.getX(), position.getY(), position.getZ()); + return contains(position.x(), position.y(), position.z()); //FAWE end } @@ -532,17 +532,17 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { private final BlockVector3 min = getMinimumPoint(); private final BlockVector3 max = getMaximumPoint(); - final int bx = min.getBlockX(); - final int by = min.getBlockY(); - final int bz = min.getBlockZ(); + final int bx = min.x(); + final int by = min.y(); + final int bz = min.z(); - final int tx = max.getBlockX(); - final int ty = max.getBlockY(); - final int tz = max.getBlockZ(); + final int tx = max.x(); + final int ty = max.y(); + final int tz = max.z(); - private int x = min.getBlockX(); - private int y = min.getBlockY(); - private int z = min.getBlockZ(); + private int x = min.x(); + private int y = min.y(); + private int z = min.z(); int cx = x >> 4; int cz = z >> 4; @@ -611,9 +611,9 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { return new Iterator() { private final BlockVector3 min = getMinimumPoint(); private final BlockVector3 max = getMaximumPoint(); - private int nextX = min.getBlockX(); - private int nextY = min.getBlockY(); - private int nextZ = min.getBlockZ(); + private int nextX = min.x(); + private int nextY = min.y(); + private int nextZ = min.z(); private boolean hasNext = true; @Override @@ -626,17 +626,17 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { mutable.mutX(nextX); mutable.mutY(nextY); mutable.mutZ(nextZ); - if (++nextX > max.getBlockX()) { - nextX = min.getBlockX(); - if (++nextZ > max.getBlockZ()) { - nextZ = min.getBlockZ(); - if (++nextY > max.getBlockY()) { + if (++nextX > max.x()) { + nextX = min.x(); + if (++nextZ > max.z()) { + nextZ = min.z(); + if (++nextY > max.y()) { if (!hasNext()) { throw new NoSuchElementException(); } - nextX = max.getBlockX(); - nextZ = max.getBlockZ(); - nextY = max.getBlockY(); + nextX = max.x(); + nextZ = max.z(); + nextY = max.y(); hasNext = false; } } @@ -652,8 +652,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { return () -> new Iterator() { private final BlockVector3 min = getMinimumPoint(); private final BlockVector3 max = getMaximumPoint(); - private int nextX = min.getBlockX(); - private int nextZ = min.getBlockZ(); + private int nextX = min.x(); + private int nextZ = min.z(); @Override public boolean hasNext() { @@ -666,9 +666,9 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { throw new NoSuchElementException(); } BlockVector2 answer = BlockVector2.at(nextX, nextZ); - if (++nextX > max.getBlockX()) { - nextX = min.getBlockX(); - if (++nextZ > max.getBlockZ()) { + if (++nextX > max.x()) { + nextX = min.x(); + if (++nextZ > max.z()) { nextZ = Integer.MAX_VALUE; nextX = Integer.MAX_VALUE; } @@ -705,10 +705,10 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { public static boolean contains(CuboidRegion region) { BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); - return region.contains(min.getBlockX(), min.getBlockY(), min.getBlockZ()) && region.contains( - max.getBlockX(), - max.getBlockY(), - max.getBlockZ() + return region.contains(min.x(), min.y(), min.z()) && region.contains( + max.x(), + max.y(), + max.z() ); } //FAWE end diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java index 6439d6079..85c62e771 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java @@ -197,8 +197,8 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { @Override public long getVolume() { - return BigDecimal.valueOf(radius.getX()) - .multiply(BigDecimal.valueOf(radius.getZ())) + return BigDecimal.valueOf(radius.x()) + .multiply(BigDecimal.valueOf(radius.z())) .multiply(PI) .multiply(BigDecimal.valueOf(getHeight())) .setScale(0, RoundingMode.FLOOR) @@ -207,7 +207,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { @Override public int getWidth() { - return (int) (2 * radius.getX()); + return (int) (2 * radius.x()); } @Override @@ -217,7 +217,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { @Override public int getLength() { - return (int) (2 * radius.getZ()); + return (int) (2 * radius.z()); } private BlockVector2 calculateDiff2D(BlockVector3... changes) throws RegionOperationException { @@ -226,7 +226,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { diff = diff.add(change.toBlockVector2()); } - if ((diff.getBlockX() & 1) + (diff.getBlockZ() & 1) != 0) { + if ((diff.x() & 1) + (diff.z() & 1) != 0) { throw new RegionOperationException(Caption.of("worldedit.selection.cylinder.error.even-horizontal")); } @@ -254,7 +254,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { radius = radius.add(calculateChanges2D(changes).toVector2()); this.radiusInverse = Vector2.ONE.divide(radius); for (BlockVector3 change : changes) { - int changeY = change.getBlockY(); + int changeY = change.y(); if (changeY > 0) { maxY += changeY; } else { @@ -276,7 +276,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { this.radiusInverse = Vector2.ONE.divide(radius); for (BlockVector3 change : changes) { int height = maxY - minY; - int changeY = change.getBlockY(); + int changeY = change.y(); if (changeY > 0) { minY += Math.min(height, changeY); } else { @@ -289,7 +289,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { public void shift(BlockVector3 change) throws RegionOperationException { center = center.add(change.toBlockVector2()); - int changeY = change.getBlockY(); + int changeY = change.y(); maxY += changeY; minY += changeY; } @@ -322,15 +322,15 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { @Override public boolean contains(int x, int z) { - double dx = Math.abs(x - center.getBlockX()) * radiusInverse.getX(); - double dz = Math.abs(z - center.getBlockZ()) * radiusInverse.getZ(); + double dx = Math.abs(x - center.x()) * radiusInverse.x(); + double dz = Math.abs(z - center.z()) * radiusInverse.z(); return dx * dx + dz * dz <= 1; } @Override public boolean contains(BlockVector3 position) { - return contains(position.getX(), position.getY(), position.getZ()); + return contains(position.x(), position.y(), position.z()); } //FAWE end @@ -402,8 +402,8 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { checkNotNull(extent); checkNotNull(center); Vector2 radiusVec = Vector2.at(radius, radius); - int minY = extent.getMinimumPoint().getBlockY(); - int maxY = extent.getMaximumPoint().getBlockY(); + int minY = extent.getMinimumPoint().y(); + int maxY = extent.getMaximumPoint().y(); return new CylinderRegion(center, radiusVec, minY, maxY); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java index c3aed2a53..944e7a14c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java @@ -102,32 +102,32 @@ public class EllipsoidRegion extends AbstractRegion { @Override public long getVolume() { return ELLIPSOID_BASE_MULTIPLIER - .multiply(BigDecimal.valueOf(radius.getX())) - .multiply(BigDecimal.valueOf(radius.getY())) - .multiply(BigDecimal.valueOf(radius.getZ())) + .multiply(BigDecimal.valueOf(radius.x())) + .multiply(BigDecimal.valueOf(radius.y())) + .multiply(BigDecimal.valueOf(radius.z())) .setScale(0, RoundingMode.FLOOR) .longValue(); } @Override public int getWidth() { - return (int) (2 * radius.getX()); + return (int) (2 * radius.x()); } @Override public int getHeight() { - return (int) (2 * radius.getY()); + return (int) (2 * radius.y()); } @Override public int getLength() { - return (int) (2 * radius.getZ()); + return (int) (2 * radius.z()); } private BlockVector3 calculateDiff(BlockVector3... changes) throws RegionOperationException { BlockVector3 diff = BlockVector3.ZERO.add(changes); - if ((diff.getBlockX() & 1) + (diff.getBlockY() & 1) + (diff.getBlockZ() & 1) != 0) { + if ((diff.x() & 1) + (diff.y() & 1) + (diff.z() & 1) != 0) { throw new RegionOperationException(Caption.of("worldedit.selection.ellipsoid.error.even-horizontal")); } @@ -198,8 +198,8 @@ public class EllipsoidRegion extends AbstractRegion { this.radius = radius.add(0.5, 0.5, 0.5); //FAWE start radiusSqr = radius.multiply(radius); - radiusLengthSqr = (int) radiusSqr.getX(); - this.sphere = radius.getY() == radius.getX() && radius.getX() == radius.getZ(); + radiusLengthSqr = (int) radiusSqr.x(); + this.sphere = radius.y() == radius.x() && radius.x() == radius.z(); inverseRadiusSqr = Vector3.ONE.divide(radiusSqr); //FAWE end } @@ -210,10 +210,10 @@ public class EllipsoidRegion extends AbstractRegion { final BlockVector3 min = getMinimumPoint(); final BlockVector3 max = getMaximumPoint(); - final int centerY = center.getBlockY(); + final int centerY = center.y(); - for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) { - for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) { + for (int x = min.x(); x <= max.x(); ++x) { + for (int z = min.z(); z <= max.z(); ++z) { if (!contains(x, centerY, z)) { continue; } @@ -231,17 +231,17 @@ public class EllipsoidRegion extends AbstractRegion { //FAWE start @Override public boolean contains(int x, int y, int z) { - int cx = x - center.getBlockX(); + int cx = x - center.x(); int cx2 = cx * cx; if (cx2 > radiusSqr.getBlockX()) { return false; } - int cz = z - center.getBlockZ(); + int cz = z - center.z(); int cz2 = cz * cz; if (cz2 > radiusSqr.getBlockZ()) { return false; } - int cy = y - center.getBlockY(); + int cy = y - center.y(); int cy2 = cy * cy; if (radiusSqr.getBlockY() < getWorldMaxY() && cy2 > radiusSqr.getBlockY()) { return false; @@ -249,9 +249,9 @@ public class EllipsoidRegion extends AbstractRegion { if (sphere) { return cx2 + cy2 + cz2 <= radiusLengthSqr; } - double cxd = cx2 * inverseRadiusSqr.getX(); - double cyd = cy2 * inverseRadiusSqr.getY(); - double czd = cz2 * inverseRadiusSqr.getZ(); + double cxd = cx2 * inverseRadiusSqr.x(); + double cyd = cy2 * inverseRadiusSqr.y(); + double czd = cz2 * inverseRadiusSqr.z(); return cxd + cyd + czd <= 1; } @@ -265,23 +265,23 @@ public class EllipsoidRegion extends AbstractRegion { @Override public boolean contains(BlockVector3 position) { - return contains(position.getX(), position.getY(), position.getZ()); + return contains(position.x(), position.y(), position.z()); } @Override public boolean contains(int x, int z) { - int cx = x - center.getBlockX(); + int cx = x - center.x(); int cx2 = cx * cx; if (cx2 > radiusSqr.getBlockX()) { return false; } - int cz = z - center.getBlockZ(); + int cz = z - center.z(); int cz2 = cz * cz; if (cz2 > radiusSqr.getBlockZ()) { return false; } - double cxd = cx2 * inverseRadiusSqr.getX(); - double czd = cz2 * inverseRadiusSqr.getZ(); + double cxd = cx2 * inverseRadiusSqr.x(); + double czd = cz2 * inverseRadiusSqr.z(); return cxd + czd <= 1; } //FAWE end @@ -339,9 +339,9 @@ public class EllipsoidRegion extends AbstractRegion { int layer, int y1, int y2, int bx, int bz, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set ) { - int cx = center.getBlockX(); - int cy = center.getBlockY(); - int cz = center.getBlockZ(); + int cx = center.x(); + int cy = center.y(); + int cz = center.z(); block.initLayer(get, set, layer); @@ -376,8 +376,8 @@ public class EllipsoidRegion extends AbstractRegion { ) { // Check bounds // This needs to be able to perform 50M blocks/sec otherwise it becomes a bottleneck - int cx = center.getBlockX(); - int cz = center.getBlockZ(); + int cx = center.x(); + int cz = center.z(); int bx = chunk.getX() << 4; int bz = chunk.getZ() << 4; int tx = bx + 15; @@ -415,7 +415,7 @@ public class EllipsoidRegion extends AbstractRegion { block = block.initChunk(chunk.getX(), chunk.getZ()); // Get the solid layers - int cy = center.getBlockY(); + int cy = center.y(); int diffYFull = MathMan.usqrt(diffY2); int yBotFull = Math.max(getWorldMinY(), cy - diffYFull); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java index 021e042be..b07503762 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java @@ -111,14 +111,14 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { return; } - int minX = points.get(0).getBlockX(); - int minZ = points.get(0).getBlockZ(); - int maxX = points.get(0).getBlockX(); - int maxZ = points.get(0).getBlockZ(); + int minX = points.get(0).x(); + int minZ = points.get(0).z(); + int maxX = points.get(0).x(); + int maxZ = points.get(0).z(); for (BlockVector2 v : points) { - int x = v.getBlockX(); - int z = v.getBlockZ(); + int x = v.x(); + int z = v.z(); if (x < minX) { minX = x; } @@ -161,7 +161,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { * @param position the position */ public void addPoint(BlockVector3 position) { - points.add(BlockVector2.at(position.getBlockX(), position.getBlockZ())); + points.add(BlockVector2.at(position.x(), position.z())); recalculate(); } @@ -214,8 +214,8 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { int j = points.size() - 1; for (i = 0; i < points.size(); ++i) { - long x = points.get(j).getBlockX() + points.get(i).getBlockX(); - long z = points.get(j).getBlockZ() - points.get(i).getBlockZ(); + long x = points.get(j).x() + points.get(i).x(); + long z = points.get(j).z() - points.get(i).z(); area += x * z; j = i; } @@ -229,7 +229,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { @Override public int getWidth() { - return max.getBlockX() - min.getBlockX() + 1; + return max.x() - min.x() + 1; } @Override @@ -239,16 +239,16 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { @Override public int getLength() { - return max.getBlockZ() - min.getBlockZ() + 1; + return max.z() - min.z() + 1; } @Override public void expand(BlockVector3... changes) throws RegionOperationException { for (BlockVector3 change : changes) { - if (change.getBlockX() != 0 || change.getBlockZ() != 0) { + if (change.x() != 0 || change.z() != 0) { throw new RegionOperationException(Caption.of("worldedit.selection.polygon2d.error.expand-only-vertical")); } - int changeY = change.getBlockY(); + int changeY = change.y(); if (changeY > 0) { maxY += changeY; } else { @@ -261,10 +261,10 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { @Override public void contract(BlockVector3... changes) throws RegionOperationException { for (BlockVector3 change : changes) { - if (change.getBlockX() != 0 || change.getBlockZ() != 0) { + if (change.x() != 0 || change.z() != 0) { throw new RegionOperationException(Caption.of("worldedit.selection.polygon2d.error.contract-only-vertical")); } - int changeY = change.getBlockY(); + int changeY = change.y(); if (changeY > 0) { minY += changeY; } else { @@ -276,13 +276,13 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { @Override public void shift(BlockVector3 change) throws RegionOperationException { - final double changeX = change.getX(); - final double changeY = change.getY(); - final double changeZ = change.getZ(); + final double changeX = change.x(); + final double changeY = change.y(); + final double changeZ = change.z(); for (int i = 0; i < points.size(); ++i) { BlockVector2 point = points.get(i); - points.set(i, BlockVector2.at(point.getX() + changeX, point.getZ() + changeZ)); + points.set(i, BlockVector2.at(point.x() + changeX, point.z() + changeZ)); } minY += changeY; @@ -307,12 +307,12 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { long crossproduct; int i; - xOld = points.get(npoints - 1).getBlockX(); - zOld = points.get(npoints - 1).getBlockZ(); + xOld = points.get(npoints - 1).x(); + zOld = points.get(npoints - 1).z(); for (i = 0; i < npoints; ++i) { - xNew = points.get(i).getBlockX(); - zNew = points.get(i).getBlockZ(); + xNew = points.get(i).x(); + zNew = points.get(i).z(); //Check for corner if (xNew == targetX && zNew == targetZ) { return true; @@ -365,9 +365,9 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { if (points.size() < 3) { return false; } - int targetX = pt.getBlockX(); //wide - int targetY = pt.getBlockY(); //height - int targetZ = pt.getBlockZ(); //depth + int targetX = pt.x(); //wide + int targetY = pt.y(); //height + int targetZ = pt.z(); //depth if (targetY < minY || targetY > maxY) { return false; @@ -384,12 +384,12 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { long crossproduct; int i; - int xOld = points.get(npoints - 1).getBlockX(); - int zOld = points.get(npoints - 1).getBlockZ(); + int xOld = points.get(npoints - 1).x(); + int zOld = points.get(npoints - 1).z(); for (i = 0; i < npoints; ++i) { - xNew = points.get(i).getBlockX(); - zNew = points.get(i).getBlockZ(); + xNew = points.get(i).x(); + zNew = points.get(i).z(); //Check for corner if (xNew == targetX && zNew == targetZ) { return true; @@ -478,7 +478,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { Iterator it = pts.iterator(); while (it.hasNext()) { BlockVector2 current = it.next(); - sb.append("(").append(current.getBlockX()).append(", ").append(current.getBlockZ()).append(")"); + sb.append("(").append(current.x()).append(", ").append(current.z()).append(")"); if (it.hasNext()) { sb.append(" - "); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java index d2fa35310..e8c6da179 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java @@ -235,15 +235,15 @@ public interface Region extends Iterable, Cloneable, IBatchProcess default boolean isGlobal() { BlockVector3 pos1 = getMinimumPoint(); BlockVector3 pos2 = getMaximumPoint(); - return pos1.getBlockX() == Integer.MIN_VALUE && pos1.getBlockZ() == Integer.MIN_VALUE && pos2.getBlockX() == Integer.MAX_VALUE && pos2 - .getBlockZ() == Integer.MAX_VALUE - && pos1.getBlockY() <= WorldEdit + return pos1.x() == Integer.MIN_VALUE && pos1.z() == Integer.MIN_VALUE && pos2.x() == Integer.MAX_VALUE && pos2 + .z() == Integer.MAX_VALUE + && pos1.y() <= WorldEdit .getInstance() .getPlatformManager() .queryCapability( Capability.WORLD_EDITING) .versionMinY() - && pos2.getBlockY() >= WorldEdit + && pos2.y() >= WorldEdit .getInstance() .getPlatformManager() .queryCapability(Capability.WORLD_EDITING) @@ -251,11 +251,11 @@ public interface Region extends Iterable, Cloneable, IBatchProcess } default int getMinimumY() { - return getMinimumPoint().getY(); + return getMinimumPoint().y(); } default int getMaximumY() { - return getMaximumPoint().getY(); + return getMaximumPoint().y(); } default void filter( @@ -385,7 +385,7 @@ public interface Region extends Iterable, Cloneable, IBatchProcess int tz = bz + 15; BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - return tx >= min.getX() && bx <= max.getX() && tz >= min.getZ() && bz <= max.getZ(); + return tx >= min.x() && bx <= max.x() && tz >= min.z() && bz <= max.z(); } @Override @@ -397,7 +397,7 @@ public interface Region extends Iterable, Cloneable, IBatchProcess BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - if (tx >= min.getX() && bx <= max.getX() && tz >= min.getZ() && bz <= max.getZ()) { + if (tx >= min.x() && bx <= max.x() && tz >= min.z() && bz <= max.z()) { // contains some boolean processExtra = false; for (int layer = getMinimumY() >> 4; layer <= getMaximumY() >> 4; layer++) { @@ -451,7 +451,7 @@ public interface Region extends Iterable, Cloneable, IBatchProcess BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - if (tx >= min.getX() && bx <= max.getX() && tz >= min.getZ() && bz <= max.getZ()) { + if (tx >= min.x() && bx <= max.x() && tz >= min.z() && bz <= max.z()) { // contains some boolean processExtra = false; for (int layer = getMinimumY() >> 4; layer <= getMaximumY() >> 4; layer++) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java index 7a3e91343..c1a81834c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java @@ -168,7 +168,7 @@ public class RegionIntersection extends AbstractRegion { for (Region region : regions) { BlockVector3 regMin = region.getMinimumPoint(); BlockVector3 regMax = region.getMaximumPoint(); - if (tx >= regMin.getX() && bx <= regMax.getX() && tz >= regMin.getZ() && bz <= regMax.getZ()) { + if (tx >= regMin.x() && bx <= regMax.x() && tz >= regMin.z() && bz <= regMax.z()) { intersecting.add(region); } } @@ -204,7 +204,7 @@ public class RegionIntersection extends AbstractRegion { for (Region region : regions) { BlockVector3 regMin = region.getMinimumPoint(); BlockVector3 regMax = region.getMaximumPoint(); - if (tx >= regMin.getX() && bx <= regMax.getX() && tz >= regMin.getZ() && bz <= regMax.getZ()) { + if (tx >= regMin.x() && bx <= regMax.x() && tz >= regMin.z() && bz <= regMax.z()) { return region.processSet(chunk, get, set, true); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Regions.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Regions.java index 040ec2803..d562190cb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Regions.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Regions.java @@ -35,7 +35,7 @@ public final class Regions { * @return the Y coordinate */ public static double minimumY(Region region) { - return region.getMinimumPoint().getY(); + return region.getMinimumPoint().y(); } /** @@ -46,7 +46,7 @@ public final class Regions { * @return the Y coordinate */ public static double maximumY(Region region) { - return region.getMaximumPoint().getY(); + return region.getMaximumPoint().y(); } /** @@ -57,7 +57,7 @@ public final class Regions { * @return the Y coordinate */ public static int minimumBlockY(Region region) { - return region.getMinimumPoint().getBlockY(); + return region.getMinimumPoint().y(); } /** @@ -68,7 +68,7 @@ public final class Regions { * @return the Y coordinate */ public static int maximumBlockY(Region region) { - return region.getMaximumPoint().getBlockY(); + return region.getMaximumPoint().y(); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/TransformRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/TransformRegion.java index b2471af32..782fcebae 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/TransformRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/TransformRegion.java @@ -119,17 +119,17 @@ public class TransformRegion extends AbstractRegion { @Override public int getWidth() { - return getMaximumPoint().subtract(getMinimumPoint()).getBlockX() + 1; + return getMaximumPoint().subtract(getMinimumPoint()).x() + 1; } @Override public int getHeight() { - return getMaximumPoint().subtract(getMinimumPoint()).getBlockY() + 1; + return getMaximumPoint().subtract(getMinimumPoint()).y() + 1; } @Override public int getLength() { - return getMaximumPoint().subtract(getMinimumPoint()).getBlockZ() + 1; + return getMaximumPoint().subtract(getMinimumPoint()).z() + 1; } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CylinderRegionFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CylinderRegionFactory.java index 386700b1e..67112c68c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CylinderRegionFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CylinderRegionFactory.java @@ -37,8 +37,8 @@ public class CylinderRegionFactory implements RegionFactory { return new CylinderRegion( position, Vector2.at(size, size), - position.getBlockY() - (int) (height / 2), - position.getBlockY() + (int) (height / 2) + position.y() - (int) (height / 2), + position.y() + (int) (height / 2) ); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegion3DIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegion3DIterator.java index e7ae99340..12c5f90d9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegion3DIterator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegion3DIterator.java @@ -68,7 +68,7 @@ public class FlatRegion3DIterator implements Iterator { throw new NoSuchElementException(); } - BlockVector3 current = BlockVector3.at(next2D.getBlockX(), nextY, next2D.getBlockZ()); + BlockVector3 current = BlockVector3.at(next2D.x(), nextY, next2D.z()); if (nextY < maxY) { nextY++; } else if (flatIterator.hasNext()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java index e62c72ecd..3db019499 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java @@ -46,15 +46,15 @@ public class FlatRegionIterator implements Iterator { BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); - this.y = min.getBlockY(); + this.y = min.y(); - this.minX = min.getBlockX(); + this.minX = min.x(); this.nextX = minX; - this.nextZ = min.getBlockZ(); + this.nextZ = min.z(); - this.maxX = max.getBlockX(); - this.maxZ = max.getBlockZ(); + this.maxX = max.x(); + this.maxZ = max.z(); forward(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/RegionIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/RegionIterator.java index 9e2c9b8e8..54f67b4de 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/RegionIterator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/RegionIterator.java @@ -43,14 +43,14 @@ public class RegionIterator implements Iterator { this.region = region; BlockVector3 max = region.getMaximumPoint(); - this.maxX = max.getBlockX(); - this.maxY = max.getBlockY(); - this.maxZ = max.getBlockZ(); + this.maxX = max.x(); + this.maxY = max.y(); + this.maxZ = max.z(); this.min = region.getMinimumPoint(); - this.nextX = min.getBlockX(); - this.nextY = min.getBlockY(); - this.nextZ = min.getBlockZ(); + this.nextX = min.x(); + this.nextY = min.y(); + this.nextZ = min.z(); forward(); } @@ -84,12 +84,12 @@ public class RegionIterator implements Iterator { if (++nextX <= maxX) { return; } - nextX = min.getBlockX(); + nextX = min.x(); if (++nextY <= maxY) { return; } - nextY = min.getBlockY(); + nextY = min.y(); if (++nextZ <= maxZ) { return; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java index 70471ceae..ac3141c02 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java @@ -101,8 +101,8 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion return; } - final int minY = oldRegion.getMinimumPoint().getBlockY(); - final int maxY = oldRegion.getMaximumPoint().getBlockY(); + final int minY = oldRegion.getMinimumPoint().y(); + final int maxY = oldRegion.getMaximumPoint().y(); region = new ConvexPolyhedralRegion(oldRegion.getWorld()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java index 0798b06e6..5a9d3748b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java @@ -115,8 +115,8 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { region.setCenter(center.toBlockVector2()); region.setRadius(pos2.toBlockVector2().subtract(center.toBlockVector2()).toVector2()); - region.setMaximumY(Math.max(pos1.getBlockY(), pos2.getBlockY())); - region.setMinimumY(Math.min(pos1.getBlockY(), pos2.getBlockY())); + region.setMaximumY(Math.max(pos1.y(), pos2.y())); + region.setMinimumY(Math.min(pos1.y(), pos2.y())); selectedCenter = true; selectedRadius = true; @@ -164,7 +164,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { region = new CylinderRegion(region.getWorld()); region.setCenter(position.toBlockVector2()); - region.setY(position.getBlockY()); + region.setY(position.y()); selectedCenter = true; selectedRadius = false; @@ -182,7 +182,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { final Vector2 minRadius = diff.getMaximum(diff.multiply(-1.0)); region.extendRadius(minRadius); - region.setY(position.getBlockY()); + region.setY(position.y()); selectedRadius = true; @@ -201,8 +201,8 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { if (selectedCenter) { player.print(Caption.of( "worldedit.selection.cylinder.explain.secondary", - TextComponent.of(NUMBER_FORMAT.format(region.getRadius().getX())), - TextComponent.of(NUMBER_FORMAT.format(region.getRadius().getZ())), + TextComponent.of(NUMBER_FORMAT.format(region.getRadius().x())), + TextComponent.of(NUMBER_FORMAT.format(region.getRadius().z())), TextComponent.of(region.getVolume()) )); } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ExtendingCuboidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ExtendingCuboidRegionSelector.java index 5d74d7ae6..e75f8bbb5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ExtendingCuboidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ExtendingCuboidRegionSelector.java @@ -107,13 +107,13 @@ public class ExtendingCuboidRegionSelector extends CuboidRegionSelector { return false; } - double x1 = Math.min(position.getX(), position1.getX()); - double y1 = Math.min(position.getY(), position1.getY()); - double z1 = Math.min(position.getZ(), position1.getZ()); + double x1 = Math.min(position.x(), position1.x()); + double y1 = Math.min(position.y(), position1.y()); + double z1 = Math.min(position.z(), position1.z()); - double x2 = Math.max(position.getX(), position2.getX()); - double y2 = Math.max(position.getY(), position2.getY()); - double z2 = Math.max(position.getZ(), position2.getZ()); + double x2 = Math.max(position.x(), position2.x()); + double y2 = Math.max(position.y(), position2.y()); + double z2 = Math.max(position.z(), position2.z()); final BlockVector3 o1 = position1; final BlockVector3 o2 = position2; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java index bf472615a..be9134f15 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java @@ -96,8 +96,8 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { return; } - final int minY = oldRegion.getMinimumPoint().getBlockY(); - final int maxY = oldRegion.getMaximumPoint().getBlockY(); + final int minY = oldRegion.getMinimumPoint().y(); + final int maxY = oldRegion.getMaximumPoint().y(); List points = oldRegion.polygonize(Integer.MAX_VALUE); @@ -118,7 +118,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { checkNotNull(points); final BlockVector2 pos2D = points.get(0); - pos1 = BlockVector3.at(pos2D.getX(), minY, pos2D.getZ()); + pos1 = BlockVector3.at(pos2D.x(), minY, pos2D.z()); region = new Polygonal2DRegion(world, points, minY, maxY); } @@ -142,7 +142,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { pos1 = position; region = new Polygonal2DRegion(region.getWorld()); region.addPoint(position); - region.expandY(position.getBlockY()); + region.expandY(position.y()); return true; } @@ -153,7 +153,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { final List points = region.getPoints(); final BlockVector2 lastPoint = points.get(region.size() - 1); - if (lastPoint.getBlockX() == position.getBlockX() && lastPoint.getBlockZ() == position.getBlockZ()) { + if (lastPoint.x() == position.x() && lastPoint.z() == position.z()) { return false; } @@ -165,7 +165,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { } region.addPoint(position); - region.expandY(position.getBlockY()); + region.expandY(position.y()); return true; } @@ -228,7 +228,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { @Override public void learnChanges() { BlockVector2 pt = region.getPoints().get(0); - pos1 = BlockVector3.at(pt.getBlockX(), region.getMinimumPoint().getBlockY(), pt.getBlockZ()); + pos1 = BlockVector3.at(pt.x(), region.getMinimumPoint().y(), pt.z()); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/SphereRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/SphereRegionSelector.java index a0eff3046..7394015ab 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/SphereRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/SphereRegionSelector.java @@ -61,7 +61,7 @@ public class SphereRegionSelector extends EllipsoidRegionSelector { super(oldSelector); if (selectedRadius) { final Vector3 radius = region.getRadius(); - final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ()); + final double radiusScalar = Math.max(Math.max(radius.x(), radius.y()), radius.z()); region.setRadius(Vector3.at(radiusScalar, radiusScalar, radiusScalar)); } } @@ -96,11 +96,11 @@ public class SphereRegionSelector extends EllipsoidRegionSelector { if (isDefined()) { player.print(Caption.of( "worldedit.selection.sphere.explain.secondary-defined", - TextComponent.of(region.getRadius().getX()), + TextComponent.of(region.getRadius().x()), TextComponent.of(region.getVolume()) )); } else { - player.print(Caption.of("worldedit.selection.sphere.explain.secondary", TextComponent.of(region.getRadius().getX()))); + player.print(Caption.of("worldedit.selection.sphere.explain.secondary", TextComponent.of(region.getRadius().x()))); } session.describeCUI(player); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java index 9f2ef87b0..2fb9e6588 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java @@ -59,13 +59,13 @@ public abstract class ArbitraryBiomeShape { BlockVector3 min = extent.getMinimumPoint(); BlockVector3 max = extent.getMaximumPoint(); - cacheOffsetX = min.getBlockX() - 1; - cacheOffsetY = min.getBlockY() - 1; - cacheOffsetZ = min.getBlockZ() - 1; + cacheOffsetX = min.x() - 1; + cacheOffsetY = min.y() - 1; + cacheOffsetZ = min.z() - 1; - cacheSizeX = max.getX() - cacheOffsetX + 2; - cacheSizeY = max.getY() - cacheOffsetY + 2; - cacheSizeZ = max.getZ() - cacheOffsetZ + 2; + cacheSizeX = max.x() - cacheOffsetX + 2; + cacheSizeY = max.y() - cacheOffsetY + 2; + cacheSizeZ = max.z() - cacheOffsetZ + 2; cache = new BiomeType[cacheSizeX * cacheSizeY * cacheSizeZ]; isCached = new BitSet(cache.length); @@ -128,9 +128,9 @@ public abstract class ArbitraryBiomeShape { int affected = 0; for (BlockVector3 position : getExtent()) { - int x = position.getBlockX(); - int y = position.getBlockY(); - int z = position.getBlockZ(); + int x = position.x(); + int y = position.y(); + int z = position.z(); if (!hollow) { final BiomeType material = getBiome(x, y, z, baseBiome); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java index 4feff6b8f..dbb516b1b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java @@ -59,13 +59,13 @@ public abstract class ArbitraryShape { BlockVector3 min = extent.getMinimumPoint(); BlockVector3 max = extent.getMaximumPoint(); - cacheOffsetX = min.getBlockX() - 1; - cacheOffsetY = min.getBlockY() - 1; - cacheOffsetZ = min.getBlockZ() - 1; + cacheOffsetX = min.x() - 1; + cacheOffsetY = min.y() - 1; + cacheOffsetZ = min.z() - 1; - cacheSizeX = max.getX() - cacheOffsetX + 2; - cacheSizeY = max.getY() - cacheOffsetY + 2; - cacheSizeZ = max.getZ() - cacheOffsetZ + 2; + cacheSizeX = max.x() - cacheOffsetX + 2; + cacheSizeY = max.y() - cacheOffsetY + 2; + cacheSizeZ = max.z() - cacheOffsetZ + 2; cache = new byte[cacheSizeX * cacheSizeY * cacheSizeZ]; } @@ -98,9 +98,9 @@ public abstract class ArbitraryShape { int affected = 0; for (BlockVector3 position : getExtent()) { - int x = position.getBlockX(); - int y = position.getBlockY(); - int z = position.getBlockZ(); + int x = position.x(); + int y = position.y(); + int z = position.z(); if (!hollow) { BaseBlock material = getMaterial(x, y, z, pattern.applyBlock(position)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java index d117ff328..c10312503 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java @@ -84,7 +84,7 @@ public enum Direction { } Direction(Vector3 vector, int flags, int left, int right) { - this.blockPoint = BlockVector3.at(Math.signum(vector.getX()), Math.signum(vector.getY()), Math.signum(vector.getZ())); + this.blockPoint = BlockVector3.at(Math.signum(vector.x()), Math.signum(vector.y()), Math.signum(vector.z())); this.direction = vector.normalize(); this.flags = flags; this.left = left; @@ -104,27 +104,27 @@ public enum Direction { } public double getX() { - return direction.getX(); + return direction.x(); } public double getY() { - return direction.getY(); + return direction.y(); } public double getZ() { - return direction.getZ(); + return direction.z(); } public int getBlockX() { - return blockPoint.getX(); + return blockPoint.x(); } public int getBlockY() { - return blockPoint.getY(); + return blockPoint.y(); } public int getBlockZ() { - return blockPoint.getZ(); + return blockPoint.z(); } //FAWE end diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java index 3a3cd6fb8..52c1a3e62 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java @@ -302,11 +302,11 @@ public class Location extends Vector3Impl { @Override public Location clampY(int min, int max) { checkArgument(min <= max, "minimum cannot be greater than maximum"); - if (getY() < min) { - return new Location(extent, getX(), min, getZ()); + if (y() < min) { + return new Location(extent, x(), min, z()); } - if (getY() > max) { - return new Location(extent, getX(), max, getZ()); + if (y() > max) { + return new Location(extent, x(), max, z()); } return this; @@ -331,13 +331,13 @@ public class Location extends Vector3Impl { return false; } //FAWE start - if (this.getX() != location.getX()) { + if (this.x() != location.x()) { return false; } - if (this.getZ() != location.getZ()) { + if (this.z() != location.z()) { return false; } - if (this.getY() != location.getY()) { + if (this.y() != location.y()) { return false; } return extent.equals(location.extent); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java index f350af03f..3804be8d3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java @@ -136,6 +136,14 @@ public class PropertiesConfiguration extends LocalConfiguration { scriptsDir = getString("craftscript-dir", scriptsDir); butcherDefaultRadius = getInt("butcher-default-radius", butcherDefaultRadius); butcherMaxRadius = getInt("butcher-max-radius", butcherMaxRadius); + + //FAWE start + MAX_RADIUS = maxRadius; + MAX_BRUSH_RADIUS = maxBrushRadius; + MAX_SUPER_RADIUS = maxSuperPickaxeSize; + MAX_BUTCHER_RADIUS = butcherMaxRadius; + //FAWE end + allowSymlinks = getBool("allow-symbolic-links", allowSymlinks); serverSideCUI = getBool("server-side-cui", serverSideCUI); extendedYLimit = getBool("extended-y-limit", extendedYLimit); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java index 01444f269..557709931 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java @@ -223,15 +223,15 @@ public class TargetBlock { curDistance += checkDistance; targetPosDouble = offset.add( - targetPosDouble.getX(), - targetPosDouble.getY(), - targetPosDouble.getZ() + targetPosDouble.x(), + targetPosDouble.y(), + targetPosDouble.z() ); targetPos = targetPosDouble.toBlockPoint(); } while (curDistance <= maxDistance - && targetPos.getBlockX() == prevPos.getBlockX() - && targetPos.getBlockY() == prevPos.getBlockY() - && targetPos.getBlockZ() == prevPos.getBlockZ()); + && targetPos.x() == prevPos.x() + && targetPos.y() == prevPos.y() + && targetPos.z() == prevPos.z()); if (curDistance > maxDistance) { return null; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java index cf5c05278..f529b6c5e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java @@ -135,9 +135,9 @@ public final class TreeGenerator { public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { //FAWE start - perform sanity check on generation location if (editSession - .getBlockType(pos.getX(), pos.getY(), pos.getZ()) + .getBlockType(pos.x(), pos.y(), pos.z()) .getMaterial() - .isAir() && canGenerateOn(editSession.getBlockType(pos.getX(), pos.getY() - 1, pos.getZ()))) { + .isAir() && canGenerateOn(editSession.getBlockType(pos.x(), pos.y() - 1, pos.z()))) { makePineTree(editSession, pos); return true; } @@ -151,7 +151,7 @@ public final class TreeGenerator { //FAWE start - ensure canGenerateOn is called. // chorus plants have to generate starting in the end stone itself, not the air above the ground BlockVector3 down = pos.subtract(0, 1, 0); - if (!canGenerateOn(editSession.getBlockType(down.getX(), down.getY(), down.getZ()))) { + if (!canGenerateOn(editSession.getBlockType(down.x(), down.y(), down.z()))) { return false; } return editSession.getWorld().generateTree(this, editSession, down); @@ -212,9 +212,9 @@ public final class TreeGenerator { public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { //FAWE start - check for ability for tree to generate on block if (editSession - .getBlockType(pos.getX(), pos.getY(), pos.getZ()) + .getBlockType(pos.x(), pos.y(), pos.z()) .getMaterial() - .isAir() && canGenerateOn(editSession.getBlockType(pos.getX(), pos.getY() - 1, pos.getZ()))) { + .isAir() && canGenerateOn(editSession.getBlockType(pos.x(), pos.y() - 1, pos.z()))) { return editSession.getWorld().generateTree(this, editSession, pos); } return false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index 1a8b0667c..7b0cbf4b8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -95,6 +95,13 @@ public class YAMLConfiguration extends LocalConfiguration { butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius)); butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius)); + //FAWE start + MAX_RADIUS = maxRadius; + MAX_BRUSH_RADIUS = maxBrushRadius; + MAX_SUPER_RADIUS = maxSuperPickaxeSize; + MAX_BUTCHER_RADIUS = butcherMaxRadius; + //FAWE end + disallowedBlocks = config.getStringList("limits.disallowed-blocks", Lists.newArrayList(getDefaultDisallowedBlocks())) .stream() .map(s -> s.contains(":") ? s.toLowerCase(Locale.ROOT) : ("minecraft:" + s).toLowerCase(Locale.ROOT)) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/BlockMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/BlockMap.java index 43c175dbc..a17f6a04f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/BlockMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/BlockMap.java @@ -85,15 +85,15 @@ public class BlockMap extends AbstractMap { private static final int BITS_6 = mask(6); private static long toGroupKey(BlockVector3 location) { - return ((location.getX() >>> 6) & BITS_20) - | (((location.getZ() >>> 6) & BITS_20) << 20) - | (((location.getY() >>> 8) & BITS_24) << (20 + 20)); + return ((location.x() >>> 6) & BITS_20) + | (((location.z() >>> 6) & BITS_20) << 20) + | (((location.y() >>> 8) & BITS_24) << (20 + 20)); } private static int toInnerKey(BlockVector3 location) { - return (location.getX() & BITS_6) - | ((location.getZ() & BITS_6) << 6) - | ((location.getY() & BITS_8) << (6 + 6)); + return (location.x() & BITS_6) + | ((location.z() & BITS_6) << 6) + | ((location.y() & BITS_8) << (6 + 6)); } private static final long GROUP_X = BITS_20; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/VectorPositionList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/VectorPositionList.java index 3a2759e67..3e725712d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/VectorPositionList.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/VectorPositionList.java @@ -46,9 +46,9 @@ class VectorPositionList implements PositionList { @Override public void add(BlockVector3 vector) { - delegateX.add(vector.getX()); - delegateY.add(vector.getY()); - delegateZ.add(vector.getZ()); + delegateX.add(vector.x()); + delegateY.add(vector.y()); + delegateZ.add(vector.z()); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java index 908e0bac6..ccf8d8535 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java @@ -184,7 +184,7 @@ public class NullWorld extends AbstractWorld { @Override public BlockState getBlock(BlockVector3 position) { - return this.getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + return this.getBlock(position.x(), position.y(), position.z()); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java index 5e4292cd4..5535f4305 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java @@ -130,9 +130,9 @@ public class AnvilChunk implements Chunk { } private int getBlockID(BlockVector3 position) throws DataException { - int x = position.getX() - rootX * 16; - int y = position.getY(); - int z = position.getZ() - rootZ * 16; + int x = position.x() - rootX * 16; + int y = position.y(); + int z = position.z() - rootZ * 16; int section = y >> 4; if (section < 0 || section >= blocks.length) { @@ -163,9 +163,9 @@ public class AnvilChunk implements Chunk { } private int getBlockData(BlockVector3 position) throws DataException { - int x = position.getX() - rootX * 16; - int y = position.getY(); - int z = position.getZ() - rootZ * 16; + int x = position.x() - rootX * 16; + int y = position.y(); + int z = position.z() - rootZ * 16; int section = y >> 4; int yIndex = y & 0x0F; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java index 9b0d764f1..31bb7606c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java @@ -231,9 +231,9 @@ public class AnvilChunk13 implements Chunk { @Override public BaseBlock getBlock(BlockVector3 position) throws DataException { //FAWE start - simplified - int x = position.getX() & 15; - int y = position.getY(); - int z = position.getZ() & 15; + int x = position.x() & 15; + int y = position.y(); + int z = position.z() & 15; //FAWE end int section = y >> 4; @@ -261,8 +261,8 @@ public class AnvilChunk13 implements Chunk { if (biomes == null) { populateBiomes(); } - int rx = position.getX() & 15; - int rz = position.getZ() & 15; + int rx = position.x() & 15; + int rz = position.z() & 15; return biomes[rz << 4 | rx]; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk15.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk15.java index 7565f66c1..60b9d9617 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk15.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk15.java @@ -60,9 +60,9 @@ public class AnvilChunk15 extends AnvilChunk13 { if (biomes == null) { populateBiomes(); } - int x = (position.getX() & 15) >> 2; - int y = position.getY() >> 2; - int z = (position.getZ() & 15) >> 2; + int x = (position.x() & 15) >> 2; + int y = position.y() >> 2; + int z = (position.z() & 15) >> 2; return biomes[y << 4 | z << 2 | x]; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk17.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk17.java index a6fa95b53..6d366c295 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk17.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk17.java @@ -234,9 +234,9 @@ public class AnvilChunk17 implements Chunk { @Override public BaseBlock getBlock(BlockVector3 position) throws DataException { - int x = position.getX() & 15; - int y = position.getY(); - int z = position.getZ() & 15; + int x = position.x() & 15; + int y = position.y(); + int z = position.z() & 15; int section = y >> 4; int yIndex = y & 0x0F; @@ -262,9 +262,9 @@ public class AnvilChunk17 implements Chunk { if (biomes == null) { populateBiomes(); } - int x = (position.getX() & 15) >> 2; - int y = (position.getY() - (minSectionPosition << 4)) >> 2; // normalize - int z = (position.getZ() & 15) >> 2; + int x = (position.x() & 15) >> 2; + int y = (position.y() - (minSectionPosition << 4)) >> 2; // normalize + int z = (position.z() & 15) >> 2; return biomes[y << 4 | z << 2 | x]; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk18.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk18.java index bb18e8ed5..4fa50629e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk18.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk18.java @@ -232,9 +232,9 @@ public class AnvilChunk18 implements Chunk { @Override public BaseBlock getBlock(BlockVector3 position) throws DataException { - int x = position.getX() & 15; - int y = position.getY(); - int z = position.getZ() & 15; + int x = position.x() & 15; + int y = position.y(); + int z = position.z() & 15; int section = y >> 4; int yIndex = y & 0x0F; @@ -259,10 +259,10 @@ public class AnvilChunk18 implements Chunk { if (biomes == null) { populateBiomes(); } - int x = (position.getX() & 15) >> 2; - int y = (position.getY() & 15) >> 2; - int z = (position.getZ() & 15) >> 2; - int section = position.getY() >> 4; + int x = (position.x() & 15) >> 2; + int y = (position.y() & 15) >> 2; + int z = (position.z() & 15) >> 2; + int section = position.y() >> 4; BiomeType[] sectionBiomes = biomes.get(section); if (sectionBiomes.length == 1) { return sectionBiomes[0]; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java index aabf38ac9..7edb163e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java @@ -162,15 +162,15 @@ public class OldChunk implements Chunk { @Override public BaseBlock getBlock(BlockVector3 position) throws DataException { - if (position.getY() >= 128) { + if (position.y() >= 128) { return BlockTypes.VOID_AIR.getDefaultState().toBaseBlock(); } int id; int dataVal; - int x = position.getX() - rootX * 16; - int y = position.getY(); - int z = position.getZ() - rootZ * 16; + int x = position.x() - rootX * 16; + int y = position.y(); + int z = position.z() - rootZ * 16; int index = y + (z * 128 + (x * 128 * 16)); try { id = blocks[index]; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java index 0d86679cf..3e3201fb6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java @@ -114,9 +114,9 @@ public class SnapshotRestore { // First, we need to group points by chunk so that we only need // to keep one chunk in memory at any given moment - for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) { - for (int y = min.getBlockY(); y <= max.getBlockY(); ++y) { - for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) { + for (int x = min.x(); x <= max.x(); ++x) { + for (int y = min.y(); y <= max.y(); ++y) { + for (int z = min.z(); z <= max.z(); ++z) { BlockVector3 pos = BlockVector3.at(x, y, z); checkAndAddBlock(pos); } @@ -185,7 +185,7 @@ public class SnapshotRestore { try { editSession.setBlock(pos, chunk.getBlock(pos)); //FAWE start - biome and entity restore - if (restoreBiomes && (pos.getX() & 3) == 0 && (pos.getY() & 3) == 0 && (pos.getZ() & 3) == 0) { + if (restoreBiomes && (pos.x() & 3) == 0 && (pos.y() & 3) == 0 && (pos.z() & 3) == 0) { editSession.setBiome(pos, chunk.getBiome(pos)); } //FAWE end diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/experimental/SnapshotRestore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/experimental/SnapshotRestore.java index 9493fc76f..5f9880fc0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/experimental/SnapshotRestore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/experimental/SnapshotRestore.java @@ -109,9 +109,9 @@ public class SnapshotRestore { // First, we need to group points by chunk so that we only need // to keep one chunk in memory at any given moment - for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) { - for (int y = min.getBlockY(); y <= max.getBlockY(); ++y) { - for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) { + for (int x = min.x(); x <= max.x(); ++x) { + for (int y = min.y(); y <= max.y(); ++y) { + for (int z = min.z(); z <= max.z(); ++z) { BlockVector3 pos = BlockVector3.at(x, y, z); checkAndAddBlock(pos); } @@ -181,7 +181,7 @@ public class SnapshotRestore { try { editSession.setBlock(pos, chunk.getBlock(pos)); //FAWE start - biome and entity restore - if (restoreBiomes && (pos.getX() & 3) == 0 && (pos.getY() & 3) == 0 && (pos.getZ() & 3) == 0) { + if (restoreBiomes && (pos.x() & 3) == 0 && (pos.y() & 3) == 0 && (pos.z() & 3) == 0) { editSession.setBiome(pos, chunk.getBiome(pos)); } //FAWE end diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java index 6b8de78fc..6b42ba727 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java @@ -73,7 +73,7 @@ public abstract class ChunkStore implements Closeable { * @return chunk coordinates */ public static BlockVector2 toChunk(BlockVector3 position) { - return BlockVector2.at(position.getX() >> CHUNK_SHIFTS, position.getZ() >> CHUNK_SHIFTS); + return BlockVector2.at(position.x() >> CHUNK_SHIFTS, position.z() >> CHUNK_SHIFTS); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java index 5e534765a..0159c3880 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java @@ -44,8 +44,8 @@ public abstract class LegacyChunkStore extends ChunkStore { * @return pathname */ public static String getFilename(BlockVector2 position, String separator) { - int x = position.getBlockX(); - int z = position.getBlockZ(); + int x = position.x(); + int z = position.z(); String folder1 = Integer.toString(divisorMod(x, 64), 36); String folder2 = Integer.toString(divisorMod(z, 64), 36); @@ -68,8 +68,8 @@ public abstract class LegacyChunkStore extends ChunkStore { @Override public CompoundTag getChunkTag(BlockVector2 position, World world) throws DataException, IOException { - int x = position.getBlockX(); - int z = position.getBlockZ(); + int x = position.x(); + int z = position.z(); String folder1 = Integer.toString(divisorMod(x, 64), 36); String folder2 = Integer.toString(divisorMod(z, 64), 36); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java index 5b43de521..a4e06145e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java @@ -40,8 +40,8 @@ public abstract class McRegionChunkStore extends ChunkStore { * @return the filename */ public static String getFilename(BlockVector2 position) { - int x = position.getBlockX(); - int z = position.getBlockZ(); + int x = position.x(); + int z = position.z(); return "r." + (x >> 5) + "." + (z >> 5) + ".mca"; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionReader.java index 193f03b06..88e455200 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionReader.java @@ -119,8 +119,8 @@ public class McRegionReader { * @throws DataException if there is an error getting the chunk data */ public synchronized InputStream getChunkInputStream(BlockVector2 position) throws IOException, DataException { - int x = position.getBlockX() & 31; - int z = position.getBlockZ() & 31; + int x = position.x() & 31; + int z = position.z() & 31; int offset = getOffset(x, z); diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index 208de9027..c343dd623 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -137,6 +137,8 @@ "fawe.error.limit.disallowed-property": "Your limit disallows use of property '{0}'", "fawe.error.region-mask-invalid": "Invalid region mask: {0}", "fawe.error.occurred-continuing": "Ignorable error occurred during edit: {0}", + "fawe.error.limit.max-brush-radius": "Maximum brush radius in limit: {0}", + "fawe.error.limit.max-radius": "Maximum radius in limit: {0}", "fawe.cancel.count": "Cancelled {0} edits.", "fawe.cancel.reason.confirm": "Use //confirm to execute {0}", "fawe.cancel.reason.confirm.region": "Your selection is large ({0} -> {1}, containing {3} blocks). Use //confirm to execute {2}", diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/RealExpressionTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/RealExpressionTest.java index 444e1db9d..a4dd3062a 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/RealExpressionTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/RealExpressionTest.java @@ -74,7 +74,7 @@ class RealExpressionTest extends BaseExpressionTest { Expression compiled = compile(expr, "x", "y", "z"); for (TestCase aCase : cases) { Vector3 loc = aCase.loc; - assertEquals(aCase.result, compiled.evaluate(loc.getX(), loc.getY(), loc.getZ()), 0, + assertEquals(aCase.result, compiled.evaluate(loc.x(), loc.y(), loc.z()), 0, "Test case " + aCase + " failed (result)" ); aCase.postChecks.accept(compiled); diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/util/RegionOptimizedVectorSorterTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/util/RegionOptimizedVectorSorterTest.java index a1582bf04..11057ca25 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/util/RegionOptimizedVectorSorterTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/util/RegionOptimizedVectorSorterTest.java @@ -100,10 +100,10 @@ public class RegionOptimizedVectorSorterTest { for (int i = 0; i < toSort.size() - 1; i++) { BlockVector3 curr = toSort.get(i); BlockVector3 next = toSort.get(i + 1); - int currChunkX = curr.getX() >> 4; - int nextChunkX = next.getX() >> 4; - int currChunkZ = curr.getZ() >> 4; - int nextChunkZ = next.getZ() >> 4; + int currChunkX = curr.x() >> 4; + int nextChunkX = next.x() >> 4; + int currChunkZ = curr.z() >> 4; + int nextChunkZ = next.z() >> 4; int currRegionX = currChunkX >> 5; int nextRegionX = nextChunkX >> 5; int currRegionZ = currChunkZ >> 5; @@ -125,7 +125,7 @@ public class RegionOptimizedVectorSorterTest { fail(spaceship + " " + currChunkZ + " chunk z should be less than or equal to " + nextChunkZ); } else if (currChunkZ == nextChunkZ) { - if (curr.getY() < next.getY()) { + if (curr.y() < next.y()) { fail(spaceship + " " + curr + " y should be greater than or equal to " + next); } diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/util/LocationTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/util/LocationTest.java index 44962055b..2a16b4373 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/util/LocationTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/util/LocationTest.java @@ -65,7 +65,7 @@ public class LocationTest { public void testGetX() throws Exception { World world = mock(World.class); Location location = new Location(world, Vector3.at(TEST_VALUE, 0, 0)); - assertEquals(TEST_VALUE, location.getX(), EPSILON); + assertEquals(TEST_VALUE, location.x(), EPSILON); } @Test @@ -80,17 +80,17 @@ public class LocationTest { World world = mock(World.class); Location location1 = new Location(world, Vector3.ZERO); Location location2 = location1.setX(TEST_VALUE); - assertEquals(0, location1.getX(), EPSILON); - assertEquals(TEST_VALUE, location2.getX(), EPSILON); - assertEquals(0, location2.getY(), EPSILON); - assertEquals(0, location2.getZ(), EPSILON); + assertEquals(0, location1.x(), EPSILON); + assertEquals(TEST_VALUE, location2.x(), EPSILON); + assertEquals(0, location2.y(), EPSILON); + assertEquals(0, location2.z(), EPSILON); } @Test public void testGetY() throws Exception { World world = mock(World.class); Location location = new Location(world, Vector3.at(0, TEST_VALUE, 0)); - assertEquals(TEST_VALUE, location.getY(), EPSILON); + assertEquals(TEST_VALUE, location.y(), EPSILON); } @Test @@ -105,17 +105,17 @@ public class LocationTest { World world = mock(World.class); Location location1 = new Location(world, Vector3.ZERO); Location location2 = location1.setY(TEST_VALUE); - assertEquals(0, location1.getY(), EPSILON); - assertEquals(0, location2.getX(), EPSILON); - assertEquals(TEST_VALUE, location2.getY(), EPSILON); - assertEquals(0, location2.getZ(), EPSILON); + assertEquals(0, location1.y(), EPSILON); + assertEquals(0, location2.x(), EPSILON); + assertEquals(TEST_VALUE, location2.y(), EPSILON); + assertEquals(0, location2.z(), EPSILON); } @Test public void testGetZ() throws Exception { World world = mock(World.class); Location location = new Location(world, Vector3.at(0, 0, TEST_VALUE)); - assertEquals(TEST_VALUE, location.getZ(), EPSILON); + assertEquals(TEST_VALUE, location.z(), EPSILON); } @Test @@ -130,10 +130,10 @@ public class LocationTest { World world = mock(World.class); Location location1 = new Location(world, Vector3.ZERO); Location location2 = location1.setZ(TEST_VALUE); - assertEquals(0, location1.getZ(), EPSILON); - assertEquals(0, location2.getX(), EPSILON); - assertEquals(0, location2.getY(), EPSILON); - assertEquals(TEST_VALUE, location2.getZ(), EPSILON); + assertEquals(0, location1.z(), EPSILON); + assertEquals(0, location2.x(), EPSILON); + assertEquals(0, location2.y(), EPSILON); + assertEquals(TEST_VALUE, location2.z(), EPSILON); } @RepeatedTest(value = 5) @@ -141,7 +141,7 @@ public class LocationTest { World world = mock(World.class); long start = System.currentTimeMillis(); BlockVector3 location1 = BlockVector3.ZERO; - BlockVector3.at(location1.getX() + 10, location1.getY() + 10, location1.getZ() + 10); + BlockVector3.at(location1.x() + 10, location1.y() + 10, location1.z() + 10); System.out.println(System.currentTimeMillis() - start + " ms"); } diff --git a/worldedit-sponge/build.gradle.kts b/worldedit-sponge/build.gradle.kts index 6498cca7e..1c3ad6b68 100644 --- a/worldedit-sponge/build.gradle.kts +++ b/worldedit-sponge/build.gradle.kts @@ -28,7 +28,7 @@ dependencies { }) api("org.apache.logging.log4j:log4j-api") api("org.bstats:bstats-sponge:1.7") - testImplementation("org.mockito:mockito-core:5.11.0") + testImplementation("org.mockito:mockito-core:5.12.0") } <<<<<<< HEAD