From eb43018ae2211b4257e418209fef1b922a03cf91 Mon Sep 17 00:00:00 2001 From: Europia79 Date: Thu, 25 Jun 2015 22:38:00 -0500 Subject: [PATCH 001/182] Fixes issue 3315 with VirtualPlayers http://youtrack.sk89q.com/issue/WORLDEDIT-3315 --- .../main/java/com/sk89q/worldedit/session/SessionManager.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index 60c788ca9..60849debc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -155,9 +155,7 @@ public class SessionManager { session.setBlockChangeLimit(config.defaultChangeLimit); // Remember the session if the session is still active - if (sessionKey.isActive()) { - sessions.put(getKey(owner), new SessionHolder(sessionKey, session)); - } + sessions.put(getKey(owner), new SessionHolder(sessionKey, session)); } // Set the limit on the number of blocks that an operation can From 780b39198790bf5eff9496b152abde9e0508ad73 Mon Sep 17 00:00:00 2001 From: Europia79 Date: Fri, 26 Jun 2015 00:09:09 -0500 Subject: [PATCH 002/182] Updated comment to reflect code changes --- .../main/java/com/sk89q/worldedit/session/SessionManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index 60849debc..c88ebd0ff 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -154,7 +154,8 @@ public class SessionManager { session.setConfiguration(config); session.setBlockChangeLimit(config.defaultChangeLimit); - // Remember the session if the session is still active + // Remember the session regardless of if it's currently active or not. + // And have the SessionTracker FLUSH inactive sessions. sessions.put(getKey(owner), new SessionHolder(sessionKey, session)); } From 6ecbf19406b5ae72022ea4a0280f4f22eabeea53 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 8 Oct 2018 22:32:07 +1000 Subject: [PATCH 003/182] Properly rotate fences etc --- .../transform/BlockTransformExtent.java | 30 ++++++++++++++++++- worldedit-sponge/build.gradle | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) 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 7b44ce4b5..8fea3cb81 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 @@ -21,6 +21,7 @@ package com.sk89q.worldedit.extent.transform; import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.collect.Sets; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.world.block.BaseBlock; @@ -33,6 +34,11 @@ import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + import javax.annotation.Nullable; /** @@ -105,6 +111,8 @@ public class BlockTransformExtent extends AbstractDelegateExtent { return transform(block, transform, block); } + private static final Set directionNames = Sets.newHashSet("north", "south", "east", "west"); + /** * Transform the given block using the given transform. * @@ -117,7 +125,9 @@ public class BlockTransformExtent extends AbstractDelegateExtent { checkNotNull(block); checkNotNull(transform); - for (Property property : block.getBlockType().getProperties()) { + List properties = block.getBlockType().getProperties(); + + for (Property property : properties) { if (property instanceof DirectionalProperty) { Direction value = (Direction) block.getState(property); if (value != null) { @@ -129,6 +139,24 @@ public class BlockTransformExtent extends AbstractDelegateExtent { } } + List directionalProperties = properties.stream() + .filter(prop -> directionNames.contains(prop.getName())) + .filter(prop -> ((Boolean) block.getState(prop))) + .map(Property::getName) + .map(String::toUpperCase) + .map(Direction::valueOf) + .map(dir -> Direction.findClosest(transform.apply(dir.toVector()), Direction.Flag.CARDINAL)) + .filter(Objects::nonNull) + .map(Direction::name) + .map(String::toLowerCase) + .collect(Collectors.toList()); + + if (directionalProperties.size() > 0) { + for (String directionName : directionNames) { + changedBlock = (T) changedBlock.with(block.getBlockType().getProperty(directionName), directionalProperties.contains(directionName)); + } + } + return changedBlock; } diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index ec3da06c1..4aac1db72 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -9,7 +9,7 @@ buildscript { plugins { id 'signing' - id 'org.spongepowered.plugin' version '0.8.1' + id 'org.spongepowered.plugin' version '0.9.0' } repositories { From bf38b371d80d6f62b005492302724bd7b00fb6c3 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 10 Oct 2018 16:59:18 +1000 Subject: [PATCH 004/182] Update bStats because they deleted their old repo. --- worldedit-bukkit/build.gradle | 6 +++--- worldedit-sponge/build.gradle | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 8d9ca0eea..983091a85 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -4,14 +4,14 @@ apply plugin: 'maven' repositories { maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } - maven { url "http://repo.bstats.org/content/repositories/releases/" } + maven { url "https://jitpack.io" } } dependencies { compile project(':worldedit-core') compile 'com.sk89q:dummypermscompat:1.8' compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz - compile 'org.bstats:bstats-bukkit:1.2' + compile 'org.bstats.bStats-Metrics:bstats-bukkit:1.3' testCompile 'org.mockito:mockito-core:1.9.0-rc1' } @@ -37,7 +37,7 @@ shadowJar { dependencies { include(dependency(':worldedit-core')) relocate ("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { - include(dependency("org.bstats:bstats-bukkit:1.2")) + include(dependency("org.bstats:bstats-bukkit:1.3")) } } } diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index 4aac1db72..796e49418 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -13,13 +13,13 @@ plugins { } repositories { - maven { url "http://repo.bstats.org/content/repositories/releases/" } + maven { url "https://jitpack.io" } } dependencies { compile project(':worldedit-core') compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT' - compile 'org.bstats:bstats-sponge:1.2' + compile 'org.bstats.bStats-Metrics:bstats-sponge:1.3' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' } @@ -42,9 +42,7 @@ jar { shadowJar { dependencies { include(dependency(':worldedit-core')) - relocate ("org.bstats", "com.sk89q.worldedit.sponge.bstats") { - include(dependency("org.bstats:bstats-sponge:1.2")) - } + include(dependency('org.bstats.bStats-Metrics:bstats-sponge:1.3')) } } From cf7ce70802bcf1421fa7ac4723518ae400840e5f Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 10 Oct 2018 17:09:20 +1000 Subject: [PATCH 005/182] Skip signing in artefactory publish --- worldedit-sponge/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index 796e49418..81e84475e 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -53,4 +53,5 @@ artifacts { signing { required false sign shadowJar + artifactoryPublish.skip = true } \ No newline at end of file From c32c13fdcd680cd7b9571288bad3b3df6b630eef Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 10 Oct 2018 19:34:18 +1000 Subject: [PATCH 006/182] Fixed a typo in the gradle file --- worldedit-bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 983091a85..3fbad53e5 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -37,7 +37,7 @@ shadowJar { dependencies { include(dependency(':worldedit-core')) relocate ("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { - include(dependency("org.bstats:bstats-bukkit:1.3")) + include(dependency("org.bstats.bStats-Metrics:bstats-bukkit:1.3")) } } } From e3001586e597040e1753ffbf855212194a4b1df2 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 10 Oct 2018 19:39:09 +1000 Subject: [PATCH 007/182] Make bStats compileOnly so transitive projects won't load it, Jitpack has issues. --- worldedit-bukkit/build.gradle | 2 +- worldedit-sponge/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 3fbad53e5..a5b629550 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -11,7 +11,7 @@ dependencies { compile project(':worldedit-core') compile 'com.sk89q:dummypermscompat:1.8' compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz - compile 'org.bstats.bStats-Metrics:bstats-bukkit:1.3' + compileOnly 'org.bstats.bStats-Metrics:bstats-bukkit:1.3' testCompile 'org.mockito:mockito-core:1.9.0-rc1' } diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index 81e84475e..3c319b6b4 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -19,7 +19,7 @@ repositories { dependencies { compile project(':worldedit-core') compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT' - compile 'org.bstats.bStats-Metrics:bstats-sponge:1.3' + compileOnly 'org.bstats.bStats-Metrics:bstats-sponge:1.3' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' } From d1cb6e2156e9198cedfea5ade308b88865b29691 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 10 Oct 2018 23:22:38 +1000 Subject: [PATCH 008/182] compileOnly breaks shadowJar. bStats needs to fix their repos. --- CHANGELOG.txt | 2 +- worldedit-bukkit/build.gradle | 2 +- worldedit-sponge/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ebd61502d..0eb07256a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -7,7 +7,7 @@ - Added a compatibility layer for old schematics. - Rewrote the block parser, now uses official Minecraft format, minecraft:snow[layers=7] - Removed deprecated code. -- Many more major changes! +- Many more major changes! (Read this blog post for more details https://blog.me4502.com/updating-worldedit-to-minecraft-113.html) 6.1 - Added support for Spigot for MC 1.8.3 to 1.8.6. diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index a5b629550..3fbad53e5 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -11,7 +11,7 @@ dependencies { compile project(':worldedit-core') compile 'com.sk89q:dummypermscompat:1.8' compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz - compileOnly 'org.bstats.bStats-Metrics:bstats-bukkit:1.3' + compile 'org.bstats.bStats-Metrics:bstats-bukkit:1.3' testCompile 'org.mockito:mockito-core:1.9.0-rc1' } diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index 3c319b6b4..81e84475e 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -19,7 +19,7 @@ repositories { dependencies { compile project(':worldedit-core') compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT' - compileOnly 'org.bstats.bStats-Metrics:bstats-sponge:1.3' + compile 'org.bstats.bStats-Metrics:bstats-sponge:1.3' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' } From e059490cd16f6430ca095f897236bd78173f0109 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Thu, 4 Oct 2018 00:12:06 -0700 Subject: [PATCH 009/182] Rework block-batching, create draft of chunk batching --- .../java/com/sk89q/worldedit/Vector2D.java | 25 ++++ .../extent/reorder/ChunkBatchingExtent.java | 93 ++++++++++++++ .../extent/reorder/MultiStageReorder.java | 29 ++--- ...EntryPlacer.java => SetLocatedBlocks.java} | 35 ++---- .../changeset/BlockOptimizedHistory.java | 32 ++--- .../sk89q/worldedit/util/LocatedBlock.java | 66 ++++++++++ .../util/collection/FastListIterator.java | 114 ------------------ .../util/collection/LocatedBlockList.java | 87 +++++++++++++ .../util/collection/TupleArrayList.java | 94 --------------- 9 files changed, 306 insertions(+), 269 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java rename worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/{BlockMapEntryPlacer.java => SetLocatedBlocks.java} (56%) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/FastListIterator.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/TupleArrayList.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java index ae58566b7..c4ecc15f7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java @@ -19,12 +19,37 @@ package com.sk89q.worldedit; +import com.google.common.collect.ComparisonChain; import com.sk89q.worldedit.math.transform.AffineTransform; +import java.util.Comparator; + /** * An immutable 2-dimensional vector. */ public class Vector2D { + + /** + * A comparator for Vector2Ds that orders the vectors by rows, with x as the + * column and z as the row. + * + * For example, if x is the horizontal axis and z is the vertical axis, it + * sorts like so: + * + *
+     * 0123
+     * 4567
+     * 90ab
+     * cdef
+     * 
+ */ + public static final Comparator COMPARING_GRID_ARRANGEMENT = (a, b) -> { + return ComparisonChain.start() + .compare(a.getBlockZ(), b.getBlockZ()) + .compare(a.getBlockX(), b.getBlockX()) + .result(); + }; + public static final Vector2D ZERO = new Vector2D(0, 0); public static final Vector2D UNIT_X = new Vector2D(1, 0); public static final Vector2D UNIT_Z = new Vector2D(0, 1); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java new file mode 100644 index 000000000..82ddad252 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -0,0 +1,93 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +package com.sk89q.worldedit.extent.reorder; + +import com.sk89q.worldedit.BlockVector2D; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.extent.AbstractDelegateExtent; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.function.operation.RunContext; +import com.sk89q.worldedit.function.operation.SetLocatedBlocks; +import com.sk89q.worldedit.util.collection.LocatedBlockList; +import com.sk89q.worldedit.world.block.BlockStateHolder; + +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.SortedMap; +import java.util.TreeMap; + +/** + * A special extent that batches changes into Minecraft chunks. This helps + * improve the speed of setting the blocks, since chunks do not need to be + * loaded repeatedly, however it does take more memory due to caching the + * blocks. + */ +public class ChunkBatchingExtent extends AbstractDelegateExtent { + + /** + * Comparator optimized for sorting chunks by the region file they reside + * in. This allows for file caches to be used while loading the chunk. + */ + private static final Comparator REGION_OPTIMIZED_SORT = + Comparator.comparing(vec -> vec.divide(32).floor(), Vector2D.COMPARING_GRID_ARRANGEMENT) + .thenComparing(Vector2D.COMPARING_GRID_ARRANGEMENT); + + private final SortedMap batches = new TreeMap<>(REGION_OPTIMIZED_SORT); + + protected ChunkBatchingExtent(Extent extent) { + super(extent); + } + + @Override + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + BlockVector2D chunkPos = new BlockVector2D(location.getBlockX() >> 4, location.getBlockZ() >> 4); + batches.computeIfAbsent(chunkPos, k -> new LocatedBlockList()).add(location, block); + return true; + } + + @Override + protected Operation commitBefore() { + return new Operation() { + + private final Iterator batchIterator = batches.values().iterator(); + + @Override + public Operation resume(RunContext run) throws WorldEditException { + if (!batchIterator.hasNext()) { + return null; + } + new SetLocatedBlocks(getExtent(), batchIterator.next()).resume(run); + return this; + } + + @Override + public void cancel() { + } + + @Override + public void addStatusMessages(List messages) { + } + }; + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index 153ad1af0..3ef74dd7a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -19,19 +19,20 @@ package com.sk89q.worldedit.extent.reorder; -import com.google.common.collect.Iterators; +import com.google.common.collect.Iterables; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.Blocks; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.function.operation.BlockMapEntryPlacer; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.OperationQueue; import com.sk89q.worldedit.function.operation.RunContext; +import com.sk89q.worldedit.function.operation.SetLocatedBlocks; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.util.collection.TupleArrayList; +import com.sk89q.worldedit.util.LocatedBlock; +import com.sk89q.worldedit.util.collection.LocatedBlockList; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -50,9 +51,9 @@ import java.util.Set; */ public class MultiStageReorder extends AbstractDelegateExtent implements ReorderingExtent { - private TupleArrayList stage1 = new TupleArrayList<>(); - private TupleArrayList stage2 = new TupleArrayList<>(); - private TupleArrayList stage3 = new TupleArrayList<>(); + private LocatedBlockList stage1 = new LocatedBlockList(); + private LocatedBlockList stage2 = new LocatedBlockList(); + private LocatedBlockList stage3 = new LocatedBlockList(); private boolean enabled; /** @@ -103,18 +104,18 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder if (Blocks.shouldPlaceLast(block.getBlockType())) { // Place torches, etc. last - stage2.put(location.toBlockVector(), block); + stage2.add(location.toBlockVector(), block); return !existing.equalsFuzzy(block); } else if (Blocks.shouldPlaceFinal(block.getBlockType())) { // Place signs, reed, etc even later - stage3.put(location.toBlockVector(), block); + stage3.add(location.toBlockVector(), block); return !existing.equalsFuzzy(block); } else if (Blocks.shouldPlaceLast(existing.getBlockType())) { // Destroy torches, etc. first super.setBlock(location, BlockTypes.AIR.getDefaultState()); return super.setBlock(location, block); } else { - stage1.put(location.toBlockVector(), block); + stage1.add(location.toBlockVector(), block); return !existing.equalsFuzzy(block); } } @@ -122,9 +123,9 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder @Override public Operation commitBefore() { return new OperationQueue( - new BlockMapEntryPlacer( + new SetLocatedBlocks( getExtent(), - Iterators.concat(stage1.iterator(), stage2.iterator())), + Iterables.concat(stage1, stage2)), new Stage3Committer()); } @@ -136,10 +137,10 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder final Set blocks = new HashSet<>(); final Map blockTypes = new HashMap<>(); - for (Map.Entry entry : stage3) { - final BlockVector pt = entry.getKey(); + for (LocatedBlock entry : stage3) { + final BlockVector pt = entry.getLocation().toBlockVector(); blocks.add(pt); - blockTypes.put(pt, entry.getValue()); + blockTypes.put(pt, entry.getBlock()); } while (!blocks.isEmpty()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java similarity index 56% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java index 849f3f73f..e6778e910 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java @@ -16,50 +16,31 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ - package com.sk89q.worldedit.function.operation; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.util.LocatedBlock; -import java.util.Iterator; import java.util.List; -import java.util.Map; -/** - * Sets block from an iterator of {@link Map.Entry} containing a - * {@link BlockVector} as the key and a {@link BaseBlock} as the value. - */ -public class BlockMapEntryPlacer implements Operation { +public class SetLocatedBlocks implements Operation { private final Extent extent; - private final Iterator> iterator; + private final Iterable blocks; - /** - * Create a new instance. - * - * @param extent the extent to set the blocks on - * @param iterator the iterator - */ - public BlockMapEntryPlacer(Extent extent, Iterator> iterator) { - checkNotNull(extent); - checkNotNull(iterator); - this.extent = extent; - this.iterator = iterator; + public SetLocatedBlocks(Extent extent, Iterable blocks) { + this.extent = checkNotNull(extent); + this.blocks = checkNotNull(blocks); } @Override public Operation resume(RunContext run) throws WorldEditException { - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - extent.setBlock(entry.getKey(), entry.getValue()); + for (LocatedBlock block : blocks) { + extent.setBlock(block.getLocation(), block.getBlock()); } - return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java index 3239789bc..23f724110 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java @@ -20,15 +20,13 @@ package com.sk89q.worldedit.history.changeset; import static com.google.common.base.Preconditions.checkNotNull; -import static java.util.Map.Entry; -import com.google.common.base.Function; import com.google.common.collect.Iterators; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.history.change.Change; -import com.sk89q.worldedit.util.collection.TupleArrayList; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.util.LocatedBlock; +import com.sk89q.worldedit.util.collection.LocatedBlockList; import java.util.ArrayList; import java.util.Iterator; @@ -43,8 +41,12 @@ import java.util.Iterator; */ public class BlockOptimizedHistory extends ArrayListHistory { - private final TupleArrayList previous = new TupleArrayList<>(); - private final TupleArrayList current = new TupleArrayList<>(); + private static Change createChange(LocatedBlock block) { + return new BlockChange(block.getLocation().toBlockPoint(), block.getBlock(), block.getBlock()); + } + + private final LocatedBlockList previous = new LocatedBlockList(); + private final LocatedBlockList current = new LocatedBlockList(); @Override public void add(Change change) { @@ -53,8 +55,8 @@ public class BlockOptimizedHistory extends ArrayListHistory { if (change instanceof BlockChange) { BlockChange blockChange = (BlockChange) change; BlockVector position = blockChange.getPosition(); - previous.put(position, blockChange.getPrevious()); - current.put(position, blockChange.getCurrent()); + previous.add(position, blockChange.getPrevious()); + current.add(position, blockChange.getCurrent()); } else { super.add(change); } @@ -64,14 +66,14 @@ public class BlockOptimizedHistory extends ArrayListHistory { public Iterator forwardIterator() { return Iterators.concat( super.forwardIterator(), - Iterators.transform(current.iterator(), createTransform())); + Iterators.transform(current.iterator(), BlockOptimizedHistory::createChange)); } @Override public Iterator backwardIterator() { return Iterators.concat( super.backwardIterator(), - Iterators.transform(previous.iterator(true), createTransform())); + Iterators.transform(previous.reverseIterator(), BlockOptimizedHistory::createChange)); } @Override @@ -79,14 +81,4 @@ public class BlockOptimizedHistory extends ArrayListHistory { return super.size() + previous.size(); } - /** - * Create a function that transforms each entry from the double array lists' iterator - * into an {@link Change}. - * - * @return a function - */ - private Function, Change> createTransform() { - return entry -> new BlockChange(entry.getKey(), entry.getValue(), entry.getValue()); - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java new file mode 100644 index 000000000..d22a2315e --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java @@ -0,0 +1,66 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +package com.sk89q.worldedit.util; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.world.block.BlockStateHolder; + +import java.util.Objects; + +/** + * Represents a block located at some position. + */ +public final class LocatedBlock { + + private final Vector location; + private final BlockStateHolder block; + + public LocatedBlock(Vector location, BlockStateHolder block) { + this.location = checkNotNull(location); + this.block = checkNotNull(block); + } + + public Vector getLocation() { + return location; + } + + public BlockStateHolder getBlock() { + return block; + } + + @Override + public int hashCode() { + return Objects.hash(location, block); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (this.getClass() != obj.getClass()) { + return false; + } + LocatedBlock lb = (LocatedBlock) obj; + return Objects.equals(location, lb.location) && Objects.equals(block, lb.block); + } + +} \ No newline at end of file diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/FastListIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/FastListIterator.java deleted file mode 100644 index 3182502f6..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/FastListIterator.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.util.collection; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * A fast iterator for lists that uses an internal index integer - * and caches the size of the list. The size of the list cannot change - * during iteration and {@link Iterator#remove()} is not supported. - * - *

The iterator in Java, at least in older Java versions, is very slow, - * causing a significant amount of time in operations in WorldEdit - * being spent on {@link Iterator#hasNext()}. In contrast, the iterator - * implemented by this class is very quick, as long as - * {@link List#get(int)} is fast.

- * - * @param the element - */ -public class FastListIterator implements Iterator { - - private final List list; - private int index; - private final int size; - private final int increment; - - /** - * Create a new fast iterator. - * - * @param list the list - * @param index the index to start from - * @param size the size of the list - * @param increment the increment amount (i.e. 1 or -1) - */ - private FastListIterator(List list, int index, int size, int increment) { - checkNotNull(list); - checkArgument(size >= 0, "size >= 0 required"); - checkArgument(index >= 0, "index >= 0 required"); - this.list = list; - this.index = index; - this.size = size; - this.increment = increment; - } - - @Override - public boolean hasNext() { - return index >= 0 && index < size; - } - - @Override - public E next() { - if (hasNext()) { - E entry = list.get(index); - index += increment; - return entry; - } else { - throw new NoSuchElementException(); - } - } - - @Override - public void remove() { - throw new UnsupportedOperationException("Not supported"); - } - - /** - * Create a new forward iterator for the given list. - * - * @param list the list - * @param the element - * @return an iterator - */ - public static Iterator forwardIterator(List list) { - return new FastListIterator<>(list, 0, list.size(), 1); - } - - /** - * Create a new reverse iterator for the given list. - * - * @param list the list - * @param the element - * @return an iterator - */ - public static Iterator reverseIterator(List list) { - if (!list.isEmpty()) { - return new FastListIterator<>(list, list.size() - 1, list.size(), -1); - } else { - return new FastListIterator<>(list, 0, 0, -1); - } - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java new file mode 100644 index 000000000..41eb4e8da --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java @@ -0,0 +1,87 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +package com.sk89q.worldedit.util.collection; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.util.LocatedBlock; +import com.sk89q.worldedit.world.block.BlockStateHolder; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +/** + * Wrapper around a list of blocks located in the world. + */ +public class LocatedBlockList implements Iterable { + + private final List list; + + public LocatedBlockList() { + list = new ArrayList<>(); + } + + public LocatedBlockList(Collection collection) { + list = new ArrayList<>(collection); + } + + public void add(LocatedBlock setBlockCall) { + checkNotNull(setBlockCall); + list.add(setBlockCall); + } + + public void add(Vector location, BlockStateHolder block) { + add(new LocatedBlock(location, block)); + } + + public int size() { + return list.size(); + } + + public void clear() { + list.clear(); + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + public Iterator reverseIterator() { + return new Iterator() { + + private final ListIterator backingIterator = list.listIterator(list.size()); + + @Override + public boolean hasNext() { + return backingIterator.hasPrevious(); + } + + @Override + public LocatedBlock next() { + return backingIterator.previous(); + } + }; + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/TupleArrayList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/TupleArrayList.java deleted file mode 100644 index 8247607f1..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/TupleArrayList.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.util.collection; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; - -/** - * An {@link ArrayList} that takes {@link Map.Entry}-like tuples. This class - * exists for legacy reasons. - * - * @param the first type in the tuple - * @param the second type in the tuple - */ -public class TupleArrayList extends ArrayList> { - - /** - * Add an item to the list. - * - * @param a the 'key' - * @param b the 'value' - */ - public void put(A a, B b) { - add(new Tuple<>(a, b)); - } - - /** - * Return an entry iterator that traverses in the reverse direction. - * - * @param reverse true to return the reverse iterator - * @return an entry iterator - */ - public Iterator> iterator(boolean reverse) { - return reverse ? reverseIterator() : iterator(); - } - - @Override - public Iterator> iterator() { - return FastListIterator.forwardIterator(this); - } - - /** - * Return an entry iterator that traverses in the reverse direction. - * - * @return an entry iterator - */ - public Iterator> reverseIterator() { - return FastListIterator.reverseIterator(this); - } - - private static class Tuple implements Map.Entry { - private A key; - private B value; - - private Tuple(A key, B value) { - this.key = key; - this.value = value; - } - - @Override - public A getKey() { - return key; - } - - @Override - public B getValue() { - return value; - } - - @Override - public B setValue(B value) { - throw new UnsupportedOperationException(); - } - } - -} From f73be4b75c165225793d84d6edaeb0ab9125c46d Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Thu, 4 Oct 2018 00:17:13 -0700 Subject: [PATCH 010/182] Add newline to LocatedBlock.java --- .../src/main/java/com/sk89q/worldedit/util/LocatedBlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java index d22a2315e..13d0eac7d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java @@ -63,4 +63,4 @@ public final class LocatedBlock { return Objects.equals(location, lb.location) && Objects.equals(block, lb.block); } -} \ No newline at end of file +} From ff391ca0b3dfa5a724aca695b831a24c2258d268 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Thu, 4 Oct 2018 10:05:31 -0700 Subject: [PATCH 011/182] Update licenses --- .../com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java | 1 + .../com/sk89q/worldedit/function/operation/SetLocatedBlocks.java | 1 + .../src/main/java/com/sk89q/worldedit/util/LocatedBlock.java | 1 + .../com/sk89q/worldedit/util/collection/LocatedBlockList.java | 1 + 4 files changed, 4 insertions(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index 82ddad252..1a665ec15 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -16,6 +16,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ + package com.sk89q.worldedit.extent.reorder; import com.sk89q.worldedit.BlockVector2D; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java index e6778e910..1e418bb04 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java @@ -16,6 +16,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ + package com.sk89q.worldedit.function.operation; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java index 13d0eac7d..9a768e33d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java @@ -16,6 +16,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ + package com.sk89q.worldedit.util; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java index 41eb4e8da..7c821b0f3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java @@ -16,6 +16,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ + package com.sk89q.worldedit.util.collection; import static com.google.common.base.Preconditions.checkNotNull; From 7d4906cfe9fc48ea125f967264e6258001f40ec7 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Thu, 4 Oct 2018 10:37:58 -0700 Subject: [PATCH 012/182] Add chunk batching flag, enable by default --- .../worldedit/bukkit/WorldEditPlugin.java | 2 +- .../java/com/sk89q/worldedit/EditSession.java | 30 +++++++++++++++++++ .../com/sk89q/worldedit/LocalSession.java | 4 +-- .../command/composition/SelectionCommand.java | 2 +- .../extent/reorder/ChunkBatchingExtent.java | 23 +++++++++++++- .../internal/command/WorldEditBinding.java | 2 +- .../scripting/CraftScriptContext.java | 2 +- 7 files changed, 58 insertions(+), 7 deletions(-) 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 8cc6f544b..41ab53a7c 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 @@ -272,7 +272,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { EditSession editSession = WorldEdit.getInstance().getEditSessionFactory() .getEditSession(wePlayer.getWorld(), session.getBlockChangeLimit(), blockBag, wePlayer); - editSession.enableQueue(); + editSession.enableStandardMode(); return editSession; } 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 593f6ec91..2049be07d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -36,6 +36,7 @@ import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer; import com.sk89q.worldedit.extent.cache.LastAccessExtentCache; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBagExtent; +import com.sk89q.worldedit.extent.reorder.ChunkBatchingExtent; import com.sk89q.worldedit.extent.reorder.MultiStageReorder; import com.sk89q.worldedit.extent.validation.BlockChangeLimiter; import com.sk89q.worldedit.extent.validation.DataValidatorExtent; @@ -151,6 +152,7 @@ public class EditSession implements Extent { private @Nullable FastModeExtent fastModeExtent; private final SurvivalModeExtent survivalExtent; + private @Nullable ChunkBatchingExtent chunkBatchingExtent; private @Nullable ChunkLoadingExtent chunkLoadingExtent; private @Nullable LastAccessExtentCache cacheExtent; private @Nullable BlockQuirkExtent quirkExtent; @@ -190,6 +192,7 @@ public class EditSession implements Extent { extent = fastModeExtent = new FastModeExtent(world, false); extent = survivalExtent = new SurvivalModeExtent(extent, world); extent = quirkExtent = new BlockQuirkExtent(extent, world); + extent = chunkBatchingExtent = new ChunkBatchingExtent(extent); extent = chunkLoadingExtent = new ChunkLoadingExtent(extent, world); extent = cacheExtent = new LastAccessExtentCache(extent); extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE); @@ -229,6 +232,16 @@ public class EditSession implements Extent { return event.getExtent(); } + /** + * Turns on specific features for a normal WorldEdit session, such as + * {@link #enableQueue() queuing} and {@link #setBatchingChunks(boolean) + * chunk batching}. + */ + public void enableStandardMode() { + enableQueue(); + setBatchingChunks(true); + } + /** * Get the world. * @@ -378,6 +391,23 @@ public class EditSession implements Extent { return blockBagExtent.popMissing(); } + public boolean isBatchingChunks() { + return chunkBatchingExtent != null && chunkBatchingExtent.isEnabled(); + } + + public void setBatchingChunks(boolean batchingChunks) { + if (chunkBatchingExtent == null) { + if (batchingChunks) { + throw new UnsupportedOperationException("Chunk batching not supported by this session."); + } + return; + } + if (!batchingChunks) { + flushQueue(); + } + chunkBatchingExtent.setEnabled(batchingChunks); + } + /** * Get the number of blocks changed, including repeated block changes. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 85ca1d12a..d30e4ec6f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -226,7 +226,7 @@ public class LocalSession { EditSession editSession = history.get(historyPointer); EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() .getEditSession(editSession.getWorld(), -1, newBlockBag, player); - newEditSession.enableQueue(); + newEditSession.enableStandardMode(); newEditSession.setFastMode(fastMode); editSession.undo(newEditSession); return editSession; @@ -249,7 +249,7 @@ public class LocalSession { EditSession editSession = history.get(historyPointer); EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() .getEditSession(editSession.getWorld(), -1, newBlockBag, player); - newEditSession.enableQueue(); + newEditSession.enableStandardMode(); newEditSession.setFastMode(fastMode); editSession.redo(newEditSession); ++historyPointer; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java index 087963aed..ffb06db2e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java @@ -72,7 +72,7 @@ public class SelectionCommand extends SimpleCommand { Region selection = session.getSelection(player.getWorld()); EditSession editSession = session.createEditSession(player); - editSession.enableQueue(); + editSession.enableStandardMode(); locals.put(EditSession.class, editSession); session.tellVersion(player); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index 1a665ec15..c5be5c565 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -54,13 +54,30 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { .thenComparing(Vector2D.COMPARING_GRID_ARRANGEMENT); private final SortedMap batches = new TreeMap<>(REGION_OPTIMIZED_SORT); + private boolean enabled; - protected ChunkBatchingExtent(Extent extent) { + public ChunkBatchingExtent(Extent extent) { + this(extent, true); + } + + public ChunkBatchingExtent(Extent extent, boolean enabled) { super(extent); + this.enabled = enabled; + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; } @Override public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + if (!enabled) { + return getExtent().setBlock(location, block); + } BlockVector2D chunkPos = new BlockVector2D(location.getBlockX() >> 4, location.getBlockZ() >> 4); batches.computeIfAbsent(chunkPos, k -> new LocatedBlockList()).add(location, block); return true; @@ -68,6 +85,9 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { @Override protected Operation commitBefore() { + if (!enabled) { + return null; + } return new Operation() { private final Iterator batchIterator = batches.values().iterator(); @@ -78,6 +98,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { return null; } new SetLocatedBlocks(getExtent(), batchIterator.next()).resume(run); + batchIterator.remove(); return this; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index 664af4c4e..1bdeee5c5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -103,7 +103,7 @@ public class WorldEditBinding extends BindingHelper { Player sender = getPlayer(context); LocalSession session = worldEdit.getSessionManager().get(sender); EditSession editSession = session.createEditSession(sender); - editSession.enableQueue(); + editSession.enableStandardMode(); context.getContext().getLocals().put(EditSession.class, editSession); session.tellVersion(sender); return editSession; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java index 98c62ec59..543a28e4f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java @@ -65,7 +65,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { EditSession editSession = controller.getEditSessionFactory() .getEditSession(player.getWorld(), session.getBlockChangeLimit(), session.getBlockBag(player), player); - editSession.enableQueue(); + editSession.enableStandardMode(); editSessions.add(editSession); return editSession; } From 2824a92c19811c76d51aa0968c88cd5f50e62290 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 10 Oct 2018 12:23:00 -0700 Subject: [PATCH 013/182] Fix some minor ordering bugs --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 2 +- .../sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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 2049be07d..5b74a8d9e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -192,7 +192,6 @@ public class EditSession implements Extent { extent = fastModeExtent = new FastModeExtent(world, false); extent = survivalExtent = new SurvivalModeExtent(extent, world); extent = quirkExtent = new BlockQuirkExtent(extent, world); - extent = chunkBatchingExtent = new ChunkBatchingExtent(extent); extent = chunkLoadingExtent = new ChunkLoadingExtent(extent, world); extent = cacheExtent = new LastAccessExtentCache(extent); extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE); @@ -201,6 +200,7 @@ public class EditSession implements Extent { // This extent can be skipped by calling rawSetBlock() extent = reorderExtent = new MultiStageReorder(extent, false); + extent = chunkBatchingExtent = new ChunkBatchingExtent(extent); extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_REORDER); // These extents can be skipped by calling smartSetBlock() diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index c5be5c565..b819bcac4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -90,10 +90,14 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { } return new Operation() { - private final Iterator batchIterator = batches.values().iterator(); + // we get modified between create/resume -- only create this on resume to prevent CME + private Iterator batchIterator; @Override public Operation resume(RunContext run) throws WorldEditException { + if (batchIterator == null) { + batchIterator = batches.values().iterator(); + } if (!batchIterator.hasNext()) { return null; } From 495b9d07b5f2d81ef7fe93d603f9d588540c7ee8 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 11 Oct 2018 21:39:21 +1000 Subject: [PATCH 014/182] Not all "north/south/east/west" are boolean --- .../worldedit/extent/transform/BlockTransformExtent.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 8fea3cb81..d776be6b2 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 @@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.Sets; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.registry.state.BooleanProperty; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; @@ -140,8 +141,10 @@ public class BlockTransformExtent extends AbstractDelegateExtent { } List directionalProperties = properties.stream() + .filter(prop -> prop instanceof BooleanProperty) .filter(prop -> directionNames.contains(prop.getName())) - .filter(prop -> ((Boolean) block.getState(prop))) + .map(prop -> (BooleanProperty) prop) + .filter(block::getState) .map(Property::getName) .map(String::toUpperCase) .map(Direction::valueOf) From 844971bca6dcbb95e3ee6e3cdd1a28f574b4d136 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 11 Oct 2018 22:04:16 +1000 Subject: [PATCH 015/182] Java on TC doesn't compile this code for some reason. --- .../sk89q/worldedit/extent/transform/BlockTransformExtent.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 d776be6b2..6c1c93302 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 @@ -143,8 +143,7 @@ public class BlockTransformExtent extends AbstractDelegateExtent { List directionalProperties = properties.stream() .filter(prop -> prop instanceof BooleanProperty) .filter(prop -> directionNames.contains(prop.getName())) - .map(prop -> (BooleanProperty) prop) - .filter(block::getState) + .filter(property -> (Boolean) block.getState(property)) .map(Property::getName) .map(String::toUpperCase) .map(Direction::valueOf) From bb923aeb594571b64b8737432e6dc564d26b10f0 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Thu, 2 Nov 2017 14:39:37 -0700 Subject: [PATCH 016/182] Attach a configurable timeout to expression evaluation --- .../sk89q/worldedit/LocalConfiguration.java | 1 + .../internal/expression/Expression.java | 41 +++++++- .../internal/expression/runtime/For.java | 3 + .../expression/runtime/SimpleFor.java | 3 + .../internal/expression/runtime/While.java | 6 ++ .../util/PropertiesConfiguration.java | 1 + .../worldedit/util/YAMLConfiguration.java | 2 + .../expression/ExpressionPlatform.java | 96 +++++++++++++++++++ 8 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionPlatform.java 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 81b4d892a..3ef39d94b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -127,6 +127,7 @@ public abstract class LocalConfiguration { public String navigationWand = ItemTypes.COMPASS.getId(); public int navigationWandMaxDistance = 50; public int scriptTimeout = 3000; + public int calculationTimeout = 100; public Set allowedDataCycleBlocks = new HashSet<>(); public String saveDir = "schematics"; public String scriptsDir = "craftscripts"; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java index 463792213..27266e642 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.internal.expression; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.internal.expression.lexer.Lexer; import com.sk89q.worldedit.internal.expression.lexer.tokens.Token; import com.sk89q.worldedit.internal.expression.parser.Parser; @@ -34,6 +36,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; /** * Compiles and evaluates expressions. @@ -69,6 +78,11 @@ import java.util.Stack; public class Expression { private static final ThreadLocal> instance = new ThreadLocal<>(); + private static final ExecutorService evalThread = Executors.newCachedThreadPool( + new ThreadFactoryBuilder() + .setDaemon(true) + .setNameFormat("worldedit-expression-eval-%d") + .build()); private final Map variables = new HashMap<>(); private final String[] variableNames; @@ -115,9 +129,30 @@ public class Expression { pushInstance(); try { - return root.getValue(); - } catch (ReturnException e) { - return e.getValue(); + Future result = evalThread.submit(new Callable() { + @Override + public Double call() throws Exception { + return root.getValue(); + } + }); + try { + return result.get(WorldEdit.getInstance().getConfiguration().calculationTimeout, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } catch (ExecutionException e) { + Throwable cause = e.getCause(); + if (cause instanceof ReturnException) { + return ((ReturnException) cause).getValue(); + } + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } + throw new RuntimeException(cause); + } catch (TimeoutException e) { + result.cancel(true); + throw new EvaluationException(-1, "Calculations exceeded time limit."); + } } finally { popInstance(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/For.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/For.java index 868c83f96..6334a7350 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/For.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/For.java @@ -50,6 +50,9 @@ public class For extends Node { if (iterations > 256) { throw new EvaluationException(getPosition(), "Loop exceeded 256 iterations."); } + if (Thread.interrupted()) { + throw new EvaluationException(getPosition(), "Calculations exceeded time limit."); + } ++iterations; try { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/SimpleFor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/SimpleFor.java index 36cf5da81..1576c3484 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/SimpleFor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/SimpleFor.java @@ -53,6 +53,9 @@ public class SimpleFor extends Node { if (iterations > 256) { throw new EvaluationException(getPosition(), "Loop exceeded 256 iterations."); } + if (Thread.interrupted()) { + throw new EvaluationException(getPosition(), "Calculations exceeded time limit."); + } ++iterations; try { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/While.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/While.java index 4c277058a..5da3dae01 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/While.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/While.java @@ -49,6 +49,9 @@ public class While extends Node { if (iterations > 256) { throw new EvaluationException(getPosition(), "Loop exceeded 256 iterations."); } + if (Thread.interrupted()) { + throw new EvaluationException(getPosition(), "Calculations exceeded time limit."); + } ++iterations; try { @@ -66,6 +69,9 @@ public class While extends Node { if (iterations > 256) { throw new EvaluationException(getPosition(), "Loop exceeded 256 iterations."); } + if (Thread.interrupted()) { + throw new EvaluationException(getPosition(), "Calculations exceeded time limit."); + } ++iterations; try { 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 65f44c691..fee1917aa 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 @@ -109,6 +109,7 @@ public class PropertiesConfiguration extends LocalConfiguration { navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance); navigationUseGlass = getBool("nav-use-glass", navigationUseGlass); scriptTimeout = getInt("scripting-timeout", scriptTimeout); + calculationTimeout = getInt("calculation-timeout", calculationTimeout); saveDir = getString("schematic-save-dir", saveDir); scriptsDir = getString("craftscript-dir", scriptsDir); butcherDefaultRadius = getInt("butcher-default-radius", butcherDefaultRadius); 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 41745a0aa..9fa16df5f 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 @@ -105,6 +105,8 @@ public class YAMLConfiguration extends LocalConfiguration { scriptTimeout = config.getInt("scripting.timeout", scriptTimeout); scriptsDir = config.getString("scripting.dir", scriptsDir); + calculationTimeout = config.getInt("calculation.timeout", calculationTimeout); + saveDir = config.getString("saving.dir", saveDir); allowSymlinks = config.getBoolean("files.allow-symbolic-links", false); diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionPlatform.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionPlatform.java new file mode 100644 index 000000000..6d806d8ab --- /dev/null +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionPlatform.java @@ -0,0 +1,96 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.internal.expression; + +import com.google.common.collect.ImmutableMap; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.platform.AbstractPlatform; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.extension.platform.Preference; +import com.sk89q.worldedit.util.command.Dispatcher; +import com.sk89q.worldedit.world.World; + +import java.util.Map; + +final class ExpressionPlatform extends AbstractPlatform { + + @Override + public int resolveItem(String name) { + return 0; + } + + @Override + public boolean isValidMobType(String type) { + return false; + } + + @Override + public void reload() { + } + + @Override + public Player matchPlayer(Player player) { + return null; + } + + @Override + public World matchWorld(World world) { + return null; + } + + @Override + public void registerCommands(Dispatcher dispatcher) { + } + + @Override + public void registerGameHooks() { + } + + @Override + public LocalConfiguration getConfiguration() { + return new LocalConfiguration() { + + @Override + public void load() { + } + }; + } + + @Override + public String getVersion() { + return "INVALID"; + } + + @Override + public String getPlatformName() { + return "Expression Test"; + } + + @Override + public String getPlatformVersion() { + return "INVALID"; + } + + @Override + public Map getCapabilities() { + return ImmutableMap.of(Capability.CONFIGURATION, Preference.PREFER_OTHERS); + } +} From 21db86f26b3515e1b40035318f26b51546f427cc Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Mon, 6 Nov 2017 10:28:32 -0800 Subject: [PATCH 017/182] Register a platform for expression tests --- .../internal/expression/Expression.java | 50 +++++++++---------- .../internal/expression/ExpressionTest.java | 12 ++++- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java index 27266e642..b6bd21bb7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java @@ -127,34 +127,34 @@ public class Expression { ((Variable) invokable).value = values[i]; } - pushInstance(); - try { - Future result = evalThread.submit(new Callable() { - @Override - public Double call() throws Exception { + Future result = evalThread.submit(new Callable() { + @Override + public Double call() throws Exception { + pushInstance(); + try { return root.getValue(); + } finally { + popInstance(); } - }); - try { - return result.get(WorldEdit.getInstance().getConfiguration().calculationTimeout, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new RuntimeException(e); - } catch (ExecutionException e) { - Throwable cause = e.getCause(); - if (cause instanceof ReturnException) { - return ((ReturnException) cause).getValue(); - } - if (cause instanceof RuntimeException) { - throw (RuntimeException) cause; - } - throw new RuntimeException(cause); - } catch (TimeoutException e) { - result.cancel(true); - throw new EvaluationException(-1, "Calculations exceeded time limit."); } - } finally { - popInstance(); + }); + try { + return result.get(WorldEdit.getInstance().getConfiguration().calculationTimeout, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } catch (ExecutionException e) { + Throwable cause = e.getCause(); + if (cause instanceof ReturnException) { + return ((ReturnException) cause).getValue(); + } + if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } + throw new RuntimeException(cause); + } catch (TimeoutException e) { + result.cancel(true); + throw new EvaluationException(-1, "Calculations exceeded time limit."); } } diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java index 1d0456d01..207bb4e56 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java @@ -24,13 +24,23 @@ import static java.lang.Math.sin; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import org.junit.Before; +import org.junit.Test; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.internal.expression.lexer.LexerException; import com.sk89q.worldedit.internal.expression.parser.ParserException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; -import org.junit.Test; public class ExpressionTest { + @Before + public void setup() { + WorldEdit.getInstance().getPlatformManager().register(new ExpressionPlatform()); + WorldEdit.getInstance().getPlatformManager().handlePlatformReady(new PlatformReadyEvent()); + } + @Test public void testEvaluate() throws ExpressionException { // check From 776eb24c0e7621b761f399b97fb90568ae92ba26 Mon Sep 17 00:00:00 2001 From: Legoman99573 Date: Wed, 22 Nov 2017 18:04:12 -0600 Subject: [PATCH 018/182] Calculation Config missing and typo --- worldedit-bukkit/src/main/resources/defaults/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/worldedit-bukkit/src/main/resources/defaults/config.yml b/worldedit-bukkit/src/main/resources/defaults/config.yml index a01430cfd..58bff2d20 100644 --- a/worldedit-bukkit/src/main/resources/defaults/config.yml +++ b/worldedit-bukkit/src/main/resources/defaults/config.yml @@ -136,6 +136,9 @@ files: history: size: 15 expiration: 10 + +calculation: + timeout: 100 wand-item: minecraft:wooden_axe shell-save-type: From e16dacc11ee0f6df7854989d4e1b0d6068adfd75 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Mon, 1 Oct 2018 16:04:48 -0700 Subject: [PATCH 019/182] Small patches for timed-calc post-1.12-merge --- .../src/main/resources/defaults/config.yml | 4 +- .../internal/expression/Expression.java | 14 +-- .../expression/ExpressionPlatform.java | 96 ------------------- .../internal/expression/ExpressionTest.java | 24 ++++- 4 files changed, 30 insertions(+), 108 deletions(-) delete mode 100644 worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionPlatform.java diff --git a/worldedit-bukkit/src/main/resources/defaults/config.yml b/worldedit-bukkit/src/main/resources/defaults/config.yml index 58bff2d20..108994b61 100644 --- a/worldedit-bukkit/src/main/resources/defaults/config.yml +++ b/worldedit-bukkit/src/main/resources/defaults/config.yml @@ -136,7 +136,7 @@ files: history: size: 15 expiration: 10 - + calculation: timeout: 100 @@ -146,4 +146,4 @@ no-double-slash: false no-op-permissions: false debug: false show-help-on-first-use: true -server-side-cui: true \ No newline at end of file +server-side-cui: true diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java index b6bd21bb7..ec774f088 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java @@ -181,20 +181,20 @@ public class Expression { } private void pushInstance() { - Stack foo = instance.get(); - if (foo == null) { - instance.set(foo = new Stack<>()); + Stack threadLocalExprStack = instance.get(); + if (threadLocalExprStack == null) { + instance.set(threadLocalExprStack = new Stack<>()); } - foo.push(this); + threadLocalExprStack.push(this); } private void popInstance() { - Stack foo = instance.get(); + Stack threadLocalExprStack = instance.get(); - foo.pop(); + threadLocalExprStack.pop(); - if (foo.isEmpty()) { + if (threadLocalExprStack.isEmpty()) { instance.set(null); } } diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionPlatform.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionPlatform.java deleted file mode 100644 index 6d806d8ab..000000000 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionPlatform.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.internal.expression; - -import com.google.common.collect.ImmutableMap; -import com.sk89q.worldedit.LocalConfiguration; -import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.extension.platform.AbstractPlatform; -import com.sk89q.worldedit.extension.platform.Capability; -import com.sk89q.worldedit.extension.platform.Preference; -import com.sk89q.worldedit.util.command.Dispatcher; -import com.sk89q.worldedit.world.World; - -import java.util.Map; - -final class ExpressionPlatform extends AbstractPlatform { - - @Override - public int resolveItem(String name) { - return 0; - } - - @Override - public boolean isValidMobType(String type) { - return false; - } - - @Override - public void reload() { - } - - @Override - public Player matchPlayer(Player player) { - return null; - } - - @Override - public World matchWorld(World world) { - return null; - } - - @Override - public void registerCommands(Dispatcher dispatcher) { - } - - @Override - public void registerGameHooks() { - } - - @Override - public LocalConfiguration getConfiguration() { - return new LocalConfiguration() { - - @Override - public void load() { - } - }; - } - - @Override - public String getVersion() { - return "INVALID"; - } - - @Override - public String getPlatformName() { - return "Expression Test"; - } - - @Override - public String getPlatformVersion() { - return "INVALID"; - } - - @Override - public Map getCapabilities() { - return ImmutableMap.of(Capability.CONFIGURATION, Preference.PREFER_OTHERS); - } -} diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java index 207bb4e56..bdb91abc2 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java @@ -22,13 +22,16 @@ package com.sk89q.worldedit.internal.expression; import static java.lang.Math.atan2; import static java.lang.Math.sin; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; +import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.event.platform.PlatformReadyEvent; +import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.internal.expression.lexer.LexerException; import com.sk89q.worldedit.internal.expression.parser.ParserException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; @@ -37,8 +40,13 @@ import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; public class ExpressionTest { @Before public void setup() { - WorldEdit.getInstance().getPlatformManager().register(new ExpressionPlatform()); - WorldEdit.getInstance().getPlatformManager().handlePlatformReady(new PlatformReadyEvent()); + Platform mockPlat = Mockito.mock(Platform.class); + Mockito.when(mockPlat.getConfiguration()).thenReturn(new LocalConfiguration() { + @Override + public void load() { + } + }); + WorldEdit.getInstance().getPlatformManager().register(mockPlat); } @Test @@ -172,6 +180,16 @@ public class ExpressionTest { assertEquals(1, simpleEval("!queryRel(3,4,5,100,200)"), 0); } + @Test + public void testTimeout() throws Exception { + try { + simpleEval("for(i=0;i<256;i++){for(j=0;j<256;j++){for(k=0;k<256;k++){for(l=0;l<256;l++){ln(pi)}}}}"); + fail("Loop was not stopped."); + } catch (EvaluationException e) { + assertTrue(e.getMessage().contains("Calculations exceeded time limit")); + } + } + private double simpleEval(String expressionString) throws ExpressionException { final Expression expression = compile(expressionString); From 0a149a796fad65c716da6d70c337083bb6593e89 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 19 Aug 2018 17:53:29 +1000 Subject: [PATCH 020/182] Make distr operation based --- .../java/com/sk89q/worldedit/EditSession.java | 116 ++---------------- .../worldedit/command/SelectionCommands.java | 35 ++---- .../block/BlockDistributionCounter.java | 77 ++++++++++++ .../worldedit/world/block/BaseBlock.java | 3 +- .../worldedit/world/block/BlockState.java | 14 +++ 5 files changed, 112 insertions(+), 133 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java 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 593f6ec91..b57ca8d6a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -25,6 +25,8 @@ import static com.sk89q.worldedit.regions.Regions.asFlatRegion; import static com.sk89q.worldedit.regions.Regions.maximumBlockY; import static com.sk89q.worldedit.regions.Regions.minimumBlockY; +import com.sk89q.worldedit.function.block.BlockDistributionCounter; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.event.extent.EditSessionEvent; @@ -1652,115 +1654,11 @@ public class EditSession implements Extent { * @param region a region * @return the results */ - public List> getBlockDistribution(Region region) { - List> distribution = new ArrayList<>(); - Map> map = new HashMap<>(); - - if (region instanceof CuboidRegion) { - // Doing this for speed - Vector min = region.getMinimumPoint(); - Vector max = region.getMaximumPoint(); - - int minX = min.getBlockX(); - int minY = min.getBlockY(); - int minZ = min.getBlockZ(); - int maxX = max.getBlockX(); - int maxY = max.getBlockY(); - int maxZ = max.getBlockZ(); - - for (int x = minX; x <= maxX; ++x) { - for (int y = minY; y <= maxY; ++y) { - for (int z = minZ; z <= maxZ; ++z) { - Vector pt = new Vector(x, y, z); - - BlockType type = getBlock(pt).getBlockType(); - - if (map.containsKey(type)) { - map.get(type).increment(); - } else { - Countable c = new Countable<>(type, 1); - map.put(type, c); - distribution.add(c); - } - } - } - } - } else { - for (Vector pt : region) { - BlockType type = getBlock(pt).getBlockType(); - - if (map.containsKey(type)) { - map.get(type).increment(); - } else { - Countable c = new Countable<>(type, 1); - map.put(type, c); - } - } - } - - Collections.sort(distribution); - // Collections.reverse(distribution); - - return distribution; - } - - /** - * Get the block distribution (with data values) inside a region. - * - * @param region a region - * @return the results - */ - // TODO reduce code duplication - probably during ops-redux - public List> getBlockDistributionWithData(Region region) { - List> distribution = new ArrayList<>(); - Map> map = new HashMap<>(); - - if (region instanceof CuboidRegion) { - // Doing this for speed - Vector min = region.getMinimumPoint(); - Vector max = region.getMaximumPoint(); - - int minX = min.getBlockX(); - int minY = min.getBlockY(); - int minZ = min.getBlockZ(); - int maxX = max.getBlockX(); - int maxY = max.getBlockY(); - int maxZ = max.getBlockZ(); - - for (int x = minX; x <= maxX; ++x) { - for (int y = minY; y <= maxY; ++y) { - for (int z = minZ; z <= maxZ; ++z) { - Vector pt = new Vector(x, y, z); - - BlockStateHolder blk = getBlock(pt); - - if (map.containsKey(blk)) { - map.get(blk).increment(); - } else { - Countable c = new Countable<>(blk, 1); - map.put(blk, c); - distribution.add(c); - } - } - } - } - } else { - for (Vector pt : region) { - BlockStateHolder blk = getBlock(pt); - - if (map.containsKey(blk)) { - map.get(blk).increment(); - } else { - Countable c = new Countable<>(blk, 1); - map.put(blk, c); - } - } - } - - Collections.sort(distribution); - // Collections.reverse(distribution); - - return distribution; + public List> getBlockDistribution(Region region, boolean fuzzy) { + BlockDistributionCounter count = new BlockDistributionCounter(this, fuzzy); + RegionVisitor visitor = new RegionVisitor(region, count); + Operations.completeBlindly(visitor); + return count.getDistribution(); } public int makeShape(final Region region, final Vector zero, final Vector unit, final Pattern pattern, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException { 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 fb4d9824e..5f4fca09c 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 @@ -662,49 +662,40 @@ public class SelectionCommands { int size; boolean useData = args.hasFlag('d'); - List> distribution = null; - List> distributionData = null; + List> distribution; if (args.hasFlag('c')) { // TODO: Update for new clipboard throw new CommandException("Needs to be re-written again"); } else { - if (useData) { - distributionData = editSession.getBlockDistributionWithData(session.getSelection(player.getWorld())); - } else { - distribution = editSession.getBlockDistribution(session.getSelection(player.getWorld())); - } + distribution = editSession.getBlockDistribution(session.getSelection(player.getWorld()), !useData); size = session.getSelection(player.getWorld()).getArea(); } - if ((useData && distributionData.size() <= 0) || (!useData && distribution.size() <= 0)) { // *Should* always be false + if (distribution.isEmpty()) { // *Should* always be false player.printError("No blocks counted."); return; } player.print("# total blocks: " + size); - if (useData) { - for (Countable c : distributionData) { - String name = c.getID().getBlockType().getName(); - String str = String.format("%-7s (%.3f%%) %s #%s%s", + for (Countable c : distribution) { + String name = c.getID().getBlockType().getName(); + String str; + if (useData) { + str = String.format("%-7s (%.3f%%) %s #%s", String.valueOf(c.getAmount()), c.getAmount() / (double) size * 100, name, - c.getID().getBlockType().getId(), - c.getID().getStates()); - player.print(str); - } - } else { - for (Countable c : distribution) { - String name = c.getID().getName(); - String str = String.format("%-7s (%.3f%%) %s #%s", + c.getID().getAsString()); + } else { + str = String.format("%-7s (%.3f%%) %s #%s", String.valueOf(c.getAmount()), c.getAmount() / (double) size * 100, name, - c.getID().getId()); - player.print(str); + c.getID().getBlockType().getId()); } + player.print(str); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java new file mode 100644 index 000000000..8d282e9c3 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java @@ -0,0 +1,77 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.block; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.RegionFunction; +import com.sk89q.worldedit.util.Countable; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BlockDistributionCounter implements RegionFunction { + + private Extent extent; + private boolean fuzzy; + + private List> distribution = new ArrayList<>(); + private Map> map = new HashMap<>(); + + public BlockDistributionCounter(Extent extent, boolean fuzzy) { + this.extent = extent; + this.fuzzy = fuzzy; + } + + @Override + public boolean apply(Vector position) throws WorldEditException { + BlockStateHolder blk = extent.getBlock(position); + if (fuzzy) { + blk = ((BlockState) blk).toFuzzy(); + } + + if (map.containsKey(blk)) { + map.get(blk).increment(); + } else { + Countable c = new Countable<>(blk, 1); + map.put(blk, c); + distribution.add(c); + } + + return true; + } + + /** + * Gets the distribution list. + * + * @return The distribution + */ + public List> getDistribution() { + Collections.sort(distribution); + Collections.reverse(distribution); + return this.distribution; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java index e3dd5d7d3..d92979155 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java @@ -142,8 +142,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { final BaseBlock otherBlock = (BaseBlock) o; - return Objects.equals(this.toImmutableState(), otherBlock.toImmutableState()) && Objects.equals(getNbtData(), otherBlock.getNbtData()); - + return this.toImmutableState().equalsFuzzy(otherBlock.toImmutableState()) && Objects.equals(getNbtData(), otherBlock.getNbtData()); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index de527baf4..ef2a9c281 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -239,4 +239,18 @@ public class BlockState implements BlockStateHolder { public String toString() { return getAsString(); } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof BlockState)) { + return false; + } + + return equalsFuzzy((BlockState) obj); + } + + @Override + public int hashCode() { + return Objects.hash(blockType, values, fuzzy); + } } From 0fe1fe33cc94fd6d3b671e9b790a92280701454c Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 12 Oct 2018 16:09:52 +1000 Subject: [PATCH 021/182] Replace BukkitImplementationTester with paperLib --- worldedit-bukkit/build.gradle | 5 + .../bukkit/BukkitImplementationTester.java | 91 ------------------- .../worldedit/bukkit/WorldEditPlugin.java | 3 - 3 files changed, 5 insertions(+), 94 deletions(-) delete mode 100644 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitImplementationTester.java diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 3fbad53e5..f833afb19 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -5,6 +5,7 @@ apply plugin: 'maven' repositories { maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } maven { url "https://jitpack.io" } + maven { url 'https://papermc.io/repo/repository/maven-public/' } } dependencies { @@ -12,6 +13,7 @@ dependencies { compile 'com.sk89q:dummypermscompat:1.8' compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz compile 'org.bstats.bStats-Metrics:bstats-bukkit:1.3' + compile "io.papermc:paperlib:1.0.1" testCompile 'org.mockito:mockito-core:1.9.0-rc1' } @@ -39,6 +41,9 @@ shadowJar { relocate ("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { include(dependency("org.bstats.bStats-Metrics:bstats-bukkit:1.3")) } + relocate ("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") { + include(dependency("io.papermc:paperlib:1.0.1")) + } } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitImplementationTester.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitImplementationTester.java deleted file mode 100644 index 1345f6a81..000000000 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitImplementationTester.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit; - -/** - * Adds methods to test if different API methods are possible based on implementation. - */ -public class BukkitImplementationTester { - - private BukkitImplementationTester() { - } - - /** - * Known Bukkit implementations - */ - public enum BukkitImplementation { - CRAFTBUKKIT, - SPIGOT, - PAPER, - } - - private static final String implementationMessage = "************************************************" + - "* Note: PaperMC (https://papermc.io/) is *" + - "* recommended for optimal performance with *" + - "* WorldEdit, WorldGuard, or CraftBook. *" + - "************************************************"; - - private static BukkitImplementation implementation; - - /** - * Gets the implementation currently in use on the server. - * - * @return The server implementation - */ - public static BukkitImplementation getImplementation() { - if (implementation == null) { - try { - Class.forName("com.destroystokyo.paper.PaperConfig"); - implementation = BukkitImplementation.PAPER; - } catch (Exception e) { - try { - Class.forName("org.spigotmc.SpigotConfig"); - implementation = BukkitImplementation.SPIGOT; - } catch (Exception e2) { - implementation = BukkitImplementation.CRAFTBUKKIT; - } - } - - if (implementation != BukkitImplementation.PAPER) { -// Bukkit.getServer().getConsoleSender().sendMessage(implementationMessage); // TODO Decide if good idea. - } - } - - return implementation; - } - - /** - * Check if this implementation is compatible with Spigot APIs - * - * @return If compatible with Spigot APIs - */ - public static boolean isSpigotCompatible() { - return getImplementation() == BukkitImplementation.SPIGOT || getImplementation() == BukkitImplementation.PAPER; - } - - /** - * Check if this implementation is compatible with Paper APIs - * - * @return If compatible with Paper APIs - */ - public static boolean isPaperCompatible() { - return getImplementation() == BukkitImplementation.PAPER; - } -} 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 8cc6f544b..c4b017e83 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 @@ -104,9 +104,6 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { // platforms to be worried about... at the current time of writing WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); - // Setup the BukkitImplementationTester. - BukkitImplementationTester.getImplementation(); - // Enable metrics new Metrics(this); } From 815f14d4a165418de486333d4721e3f1271f2480 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 13 Oct 2018 15:12:04 +1000 Subject: [PATCH 022/182] Remove a config option that's now unused. --- worldedit-bukkit/src/main/resources/defaults/config.yml | 1 - .../src/main/resources/defaults/worldedit.properties | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/worldedit-bukkit/src/main/resources/defaults/config.yml b/worldedit-bukkit/src/main/resources/defaults/config.yml index 108994b61..794b69eda 100644 --- a/worldedit-bukkit/src/main/resources/defaults/config.yml +++ b/worldedit-bukkit/src/main/resources/defaults/config.yml @@ -17,7 +17,6 @@ # limits: - allow-extra-data-values: false max-blocks-changed: default: -1 maximum: -1 diff --git a/worldedit-forge/src/main/resources/defaults/worldedit.properties b/worldedit-forge/src/main/resources/defaults/worldedit.properties index 4fa5671d5..f14a7a7d3 100644 --- a/worldedit-forge/src/main/resources/defaults/worldedit.properties +++ b/worldedit-forge/src/main/resources/defaults/worldedit.properties @@ -1,13 +1,12 @@ #Don't put comments; they get removed default-max-polygon-points=-1 schematic-save-dir=schematics -allow-extra-data-values=false super-pickaxe-many-drop-items=true register-help=true nav-wand-item=minecraft:compass profile=false super-pickaxe-drop-items=true -disallowed-blocks=minecraft:oak_sapling,minecraft:jungle_sapling,minecraft:dark_oak_sapling:,minecraft:spruce_sapling,minecraft:birch_sapling,minecraft:acacia_sapling,minecraft:black_bed,minecraft:blue_bed,minecraft:brown_bed,minecraft:cyan_bed,minecraft:gray_bed,minecraft:green_bed,minecraft:light_blue_bed,minecraft:light_gray_bed,minecraft:lime_bed,minecraft:magenta_bed,minecraft:orange_bed,minecraft:pink_bed,minecraft:purple_bed,minecraft:red_bed,minecraft:white_bed,minecraft:yellow_bed,minecraft:powered_rail,minecraft:detector_rail,minecraft:grass,minecraft:dead_bush,minecraft:moving_piston,minecraft:piston_head,minecraft:sunflower,minecraft:rose_bush,minecraft:dandelion,minecraft:poppy,minecraft:brown_mushroom,minecraft:red_mushroom,minecraft:tnt,minecraft:torch,minecraft:fire,minecraft:redstone_wire,minecraft:wheat,minecraft:potatoes,minecraft:carrots,minecraft:melon_stem,minecraft:pumpkin_stem,minecraft:beetroots,minecraft:rail,minecraft:lever,minecraft:redstone_torch,minecraft:redstone_wall_torch,minecraft:repeater,minecraft:comparator,minecraft:stone_button,minecraft:birch_button,minecraft:acacia_button,minecraft:dark_oak_button,minecraft:jungle_button,minecraft:oak_button,minecraft:spruce_button,minecraft:cactus,minecraft:sugar_cane,minecraft:bedrock +disallowed-blocks=minecraft:oak_sapling,minecraft:jungle_sapling,minecraft:dark_oak_sapling,minecraft:spruce_sapling,minecraft:birch_sapling,minecraft:acacia_sapling,minecraft:black_bed,minecraft:blue_bed,minecraft:brown_bed,minecraft:cyan_bed,minecraft:gray_bed,minecraft:green_bed,minecraft:light_blue_bed,minecraft:light_gray_bed,minecraft:lime_bed,minecraft:magenta_bed,minecraft:orange_bed,minecraft:pink_bed,minecraft:purple_bed,minecraft:red_bed,minecraft:white_bed,minecraft:yellow_bed,minecraft:powered_rail,minecraft:detector_rail,minecraft:grass,minecraft:dead_bush,minecraft:moving_piston,minecraft:piston_head,minecraft:sunflower,minecraft:rose_bush,minecraft:dandelion,minecraft:poppy,minecraft:brown_mushroom,minecraft:red_mushroom,minecraft:tnt,minecraft:torch,minecraft:fire,minecraft:redstone_wire,minecraft:wheat,minecraft:potatoes,minecraft:carrots,minecraft:melon_stem,minecraft:pumpkin_stem,minecraft:beetroots,minecraft:rail,minecraft:lever,minecraft:redstone_torch,minecraft:redstone_wall_torch,minecraft:repeater,minecraft:comparator,minecraft:stone_button,minecraft:birch_button,minecraft:acacia_button,minecraft:dark_oak_button,minecraft:jungle_button,minecraft:oak_button,minecraft:spruce_button,minecraft:cactus,minecraft:sugar_cane,minecraft:bedrock max-super-pickaxe-size=5 max-brush-radius=10 craftscript-dir=craftscripts From f8bf547c9e6d146881b30744f19f436035a2406f Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 14 Oct 2018 17:55:57 +1000 Subject: [PATCH 023/182] Added some missing bukkit registries --- .../bukkit/BukkitBlockCategoryRegistry.java | 52 +++++++++++++++++++ .../bukkit/BukkitItemCategoryRegistry.java | 52 +++++++++++++++++++ .../worldedit/bukkit/BukkitRegistries.java | 14 +++++ .../world/registry/CategoryRegistry.java | 8 --- .../registry/NullBlockCategoryRegistry.java | 5 -- .../registry/NullItemCategoryRegistry.java | 5 -- 6 files changed, 118 insertions(+), 18 deletions(-) create mode 100644 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCategoryRegistry.java create mode 100644 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemCategoryRegistry.java diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCategoryRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCategoryRegistry.java new file mode 100644 index 000000000..cecec0691 --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCategoryRegistry.java @@ -0,0 +1,52 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.bukkit; + +import com.sk89q.worldedit.registry.Category; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.registry.BlockCategoryRegistry; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.Tag; + +import java.util.Set; +import java.util.stream.Collectors; + +public class BukkitBlockCategoryRegistry implements BlockCategoryRegistry { + + private Set getFromBukkitTag(Tag tag) { + return tag.getValues().stream().map(BukkitAdapter::asBlockType).collect(Collectors.toSet()); + } + + @Override + public Set getCategorisedByName(String category) { + String[] split = category.split(":"); + String namespace = split.length > 1 ? split[0] : "minecraft"; + String key = split.length > 1 ? split[1] : category; + Tag tag = Bukkit.getTag(Tag.REGISTRY_BLOCKS, new NamespacedKey(namespace, key), Material.class); + return getFromBukkitTag(tag); + } + + @Override + public Set getAll(Category category) { + return getCategorisedByName(category.getId()); + } +} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemCategoryRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemCategoryRegistry.java new file mode 100644 index 000000000..c75c56eb2 --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemCategoryRegistry.java @@ -0,0 +1,52 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.bukkit; + +import com.sk89q.worldedit.registry.Category; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.registry.ItemCategoryRegistry; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.Tag; + +import java.util.Set; +import java.util.stream.Collectors; + +public class BukkitItemCategoryRegistry implements ItemCategoryRegistry { + + private Set getFromBukkitTag(Tag tag) { + return tag.getValues().stream().map(BukkitAdapter::asItemType).collect(Collectors.toSet()); + } + + @Override + public Set getCategorisedByName(String category) { + String[] split = category.split(":"); + String namespace = split.length > 1 ? split[0] : "minecraft"; + String key = split.length > 1 ? split[1] : category; + Tag tag = Bukkit.getTag(Tag.REGISTRY_ITEMS, new NamespacedKey(namespace, key), Material.class); + return getFromBukkitTag(tag); + } + + @Override + public Set getAll(Category category) { + return getCategorisedByName(category.getId()); + } +} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java index 6ed0999c7..5c93a8422 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java @@ -20,8 +20,10 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.worldedit.world.registry.BiomeRegistry; +import com.sk89q.worldedit.world.registry.BlockCategoryRegistry; import com.sk89q.worldedit.world.registry.BlockRegistry; import com.sk89q.worldedit.world.registry.BundledRegistries; +import com.sk89q.worldedit.world.registry.ItemCategoryRegistry; /** * World data for the Bukkit platform. @@ -31,6 +33,8 @@ class BukkitRegistries extends BundledRegistries { private static final BukkitRegistries INSTANCE = new BukkitRegistries(); private final BlockRegistry blockRegistry = new BukkitBlockRegistry(); private final BiomeRegistry biomeRegistry = new BukkitBiomeRegistry(); + private final BlockCategoryRegistry blockCategoryRegistry = new BukkitBlockCategoryRegistry(); + private final ItemCategoryRegistry itemCategoryRegistry = new BukkitItemCategoryRegistry(); /** * Create a new instance. @@ -48,6 +52,16 @@ class BukkitRegistries extends BundledRegistries { return biomeRegistry; } + @Override + public BlockCategoryRegistry getBlockCategoryRegistry() { + return blockCategoryRegistry; + } + + @Override + public ItemCategoryRegistry getItemCategoryRegistry() { + return itemCategoryRegistry; + } + /** * Get a static instance. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/CategoryRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/CategoryRegistry.java index 1a54c7961..496893821 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/CategoryRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/CategoryRegistry.java @@ -37,12 +37,4 @@ public interface CategoryRegistry { Set getCategorisedByName(String category); Set getAll(final Category category); - - /** - * Gets a list of categories given to a value. - * - * @param categorised The value - * @return A set of categories - */ - Set getCategories(T categorised); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBlockCategoryRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBlockCategoryRegistry.java index b26286498..4484d67d2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBlockCategoryRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBlockCategoryRegistry.java @@ -36,9 +36,4 @@ public class NullBlockCategoryRegistry implements BlockCategoryRegistry { public Set getAll(final Category category) { return Collections.emptySet(); } - - @Override - public Set getCategories(BlockType categorised) { - return Collections.emptySet(); - } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemCategoryRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemCategoryRegistry.java index d047706c2..8eb5d9ee6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemCategoryRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemCategoryRegistry.java @@ -36,9 +36,4 @@ public class NullItemCategoryRegistry implements ItemCategoryRegistry { public Set getAll(final Category category) { return Collections.emptySet(); } - - @Override - public Set getCategories(ItemType categorised) { - return Collections.emptySet(); - } } From 1fa1ff895b6b22e7ffb8c0de581929942dd72fca Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Sat, 20 Oct 2018 18:54:58 -0700 Subject: [PATCH 024/182] Flush or disable buffers in tools --- .../worldedit/bukkit/WorldEditPlugin.java | 2 +- .../java/com/sk89q/worldedit/EditSession.java | 40 +++++++++++++++---- .../java/com/sk89q/worldedit/WorldEdit.java | 2 +- .../worldedit/command/UtilityCommands.java | 4 +- .../worldedit/command/tool/AreaPickaxe.java | 2 +- .../worldedit/command/tool/BlockReplacer.java | 3 +- .../worldedit/command/tool/BrushTool.java | 3 +- .../command/tool/RecursivePickaxe.java | 2 +- .../worldedit/command/tool/SinglePickaxe.java | 2 +- .../extension/platform/CommandManager.java | 2 +- 10 files changed, 44 insertions(+), 18 deletions(-) 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 6da9f6821..4e74d4814 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 @@ -285,7 +285,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { LocalSession session = WorldEdit.getInstance().getSessionManager().get(wePlayer); session.remember(editSession); - editSession.flushQueue(); + editSession.flushSession(); WorldEdit.getInstance().flushBlockBag(wePlayer, editSession); } 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 1e3005f59..e9c9cf8e4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -298,13 +298,13 @@ public class EditSession implements Extent { } /** - * Disable the queue. This will flush the queue. + * Disable the queue. This will {@linkplain #flushSession() flush the session}. */ public void disableQueue() { if (isQueueEnabled()) { - flushQueue(); + flushSession(); } - reorderExtent.setEnabled(true); + reorderExtent.setEnabled(false); } /** @@ -393,10 +393,21 @@ public class EditSession implements Extent { return blockBagExtent.popMissing(); } + /** + * Returns chunk batching status. + * + * @return whether chunk batching is enabled + */ public boolean isBatchingChunks() { return chunkBatchingExtent != null && chunkBatchingExtent.isEnabled(); } + /** + * Enable or disable chunk batching. Disabling will + * {@linkplain #flushSession() flush the session}. + * + * @param batchingChunks {@code true} to enable, {@code false} to disable + */ public void setBatchingChunks(boolean batchingChunks) { if (chunkBatchingExtent == null) { if (batchingChunks) { @@ -405,11 +416,23 @@ public class EditSession implements Extent { return; } if (!batchingChunks) { - flushQueue(); + flushSession(); } chunkBatchingExtent.setEnabled(batchingChunks); } + /** + * Disable all buffering extents. + * + * @see #disableQueue() + * @see #setBatchingChunks(boolean) + */ + public void disableBuffering() { + // We optimize here to avoid double calls to flushSession. + reorderExtent.setEnabled(false); + setBatchingChunks(false); + } + /** * Get the number of blocks changed, including repeated block changes. * @@ -569,7 +592,7 @@ public class EditSession implements Extent { UndoContext context = new UndoContext(); context.setExtent(editSession.bypassHistory); Operations.completeBlindly(ChangeSetExecutor.createUndo(changeSet, context)); - editSession.flushQueue(); + editSession.flushSession(); } /** @@ -581,7 +604,7 @@ public class EditSession implements Extent { UndoContext context = new UndoContext(); context.setExtent(editSession.bypassHistory); Operations.completeBlindly(ChangeSetExecutor.createRedo(changeSet, context)); - editSession.flushQueue(); + editSession.flushSession(); } /** @@ -614,9 +637,10 @@ public class EditSession implements Extent { } /** - * Finish off the queue. + * Communicate to the EditSession that all block changes are complete, + * and that it should apply them to the world. */ - public void flushQueue() { + public void flushSession() { Operations.completeBlindly(commit()); } 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 c25e5a2c0..69a62a5c2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -628,7 +628,7 @@ public class WorldEdit { logger.log(Level.WARNING, "Failed to execute script", e); } finally { for (EditSession editSession : scriptContext.getEditSessions()) { - editSession.flushQueue(); + editSession.flushSession(); session.remember(editSession); } } 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 f20b54d51..96e3e9875 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 @@ -460,7 +460,7 @@ public class UtilityCommands { if (editSession != null) { session.remember(editSession); - editSession.flushQueue(); + editSession.flushSession(); } } @@ -520,7 +520,7 @@ public class UtilityCommands { if (editSession != null) { session.remember(editSession); - editSession.flushQueue(); + editSession.flushSession(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java index e7b64ad7e..33dcb2d81 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java @@ -83,7 +83,7 @@ public class AreaPickaxe implements BlockTool { } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { - editSession.flushQueue(); + editSession.flushSession(); session.remember(editSession); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java index 1388b66ea..1ddfae39e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java @@ -53,16 +53,17 @@ public class BlockReplacer implements DoubleActionBlockTool { BlockBag bag = session.getBlockBag(player); EditSession editSession = session.createEditSession(player); + editSession.disableBuffering(); try { Vector position = clicked.toVector(); editSession.setBlock(position, pattern.apply(position)); } catch (MaxChangedBlocksException ignored) { } finally { + session.remember(editSession); if (bag != null) { bag.flushChanges(); } - session.remember(editSession); } return true; 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 9096a4d19..e1b6c906d 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 @@ -193,10 +193,11 @@ public class BrushTool implements TraceTool { } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { + session.remember(editSession); + editSession.flushSession(); if (bag != null) { bag.flushChanges(); } - session.remember(editSession); } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java index b2fcf6525..3b35abf42 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java @@ -75,7 +75,7 @@ public class RecursivePickaxe implements BlockTool { } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { - editSession.flushQueue(); + editSession.flushSession(); session.remember(editSession); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java index f3f4c9945..1ceabcbe2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java @@ -57,7 +57,7 @@ public class SinglePickaxe implements BlockTool { } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { - editSession.flushQueue(); + editSession.flushSession(); } world.playEffect(clicked.toVector(), 2001, blockType.getLegacyId()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java index 12f56a81a..297ccf318 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java @@ -316,7 +316,7 @@ public final class CommandManager { if (editSession != null) { session.remember(editSession); - editSession.flushQueue(); + editSession.flushSession(); if (config.profile) { long time = System.currentTimeMillis() - start; From a3f1c71d97abb42e85aceb6ff514ac75f479343a Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Sat, 20 Oct 2018 19:50:35 -0700 Subject: [PATCH 025/182] Make EditSession closeable for easy flushing --- .../java/com/sk89q/worldedit/EditSession.java | 10 ++++- .../worldedit/command/tool/AreaPickaxe.java | 36 ++++++++--------- .../worldedit/command/tool/BlockReplacer.java | 20 +++++----- .../worldedit/command/tool/BrushTool.java | 39 ++++++++++--------- .../command/tool/RecursivePickaxe.java | 20 +++++----- .../worldedit/command/tool/SinglePickaxe.java | 8 +--- 6 files changed, 69 insertions(+), 64 deletions(-) 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 e9c9cf8e4..aa630bfa1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -134,7 +134,7 @@ import javax.annotation.Nullable; * using the {@link ChangeSetExtent}.

*/ @SuppressWarnings({"FieldCanBeLocal"}) -public class EditSession implements Extent { +public class EditSession implements Extent, AutoCloseable { private static final Logger log = Logger.getLogger(EditSession.class.getCanonicalName()); @@ -636,6 +636,14 @@ public class EditSession implements Extent { return bypassNone.getEntities(); } + /** + * Closing an EditSession {@linkplain #flushSession() flushes its buffers}. + */ + @Override + public void close() { + flushSession(); + } + /** * Communicate to the EditSession that all block changes are complete, * and that it should apply them to the world. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java index 33dcb2d81..1af33599c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java @@ -62,29 +62,29 @@ public class AreaPickaxe implements BlockTool { return true; } - EditSession editSession = session.createEditSession(player); - editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); + try (EditSession editSession = session.createEditSession(player)) { + editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); - try { - for (int x = ox - range; x <= ox + range; ++x) { - for (int y = oy - range; y <= oy + range; ++y) { - for (int z = oz - range; z <= oz + range; ++z) { - Vector pos = new Vector(x, y, z); - if (editSession.getBlock(pos).getBlockType() != initialType) { - continue; + try { + for (int x = ox - range; x <= ox + range; ++x) { + for (int y = oy - range; y <= oy + range; ++y) { + for (int z = oz - range; z <= oz + range; ++z) { + Vector pos = new Vector(x, y, z); + if (editSession.getBlock(pos).getBlockType() != initialType) { + continue; + } + + ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().distanceSq(pos)); + + editSession.setBlock(pos, BlockTypes.AIR.getDefaultState()); } - - ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().distanceSq(pos)); - - editSession.setBlock(pos, BlockTypes.AIR.getDefaultState()); } } + } catch (MaxChangedBlocksException e) { + player.printError("Max blocks change limit reached."); + } finally { + session.remember(editSession); } - } catch (MaxChangedBlocksException e) { - player.printError("Max blocks change limit reached."); - } finally { - editSession.flushSession(); - session.remember(editSession); } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java index 1ddfae39e..38619396b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java @@ -52,15 +52,16 @@ public class BlockReplacer implements DoubleActionBlockTool { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { BlockBag bag = session.getBlockBag(player); - EditSession editSession = session.createEditSession(player); - editSession.disableBuffering(); - - try { - Vector position = clicked.toVector(); - editSession.setBlock(position, pattern.apply(position)); - } catch (MaxChangedBlocksException ignored) { + try (EditSession editSession = session.createEditSession(player)) { + try { + editSession.disableBuffering(); + Vector position = clicked.toVector(); + editSession.setBlock(position, pattern.apply(position)); + } catch (MaxChangedBlocksException ignored) { + } finally { + session.remember(editSession); + } } finally { - session.remember(editSession); if (bag != null) { bag.flushChanges(); } @@ -72,8 +73,7 @@ public class BlockReplacer implements DoubleActionBlockTool { @Override public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { - EditSession editSession = session.createEditSession(player); - BlockStateHolder targetBlock = editSession.getBlock(clicked.toVector()); + BlockStateHolder targetBlock = player.getWorld().getBlock(clicked.toVector()); if (targetBlock != null) { pattern = new BlockPattern(targetBlock); 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 e1b6c906d..55d2947f7 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 @@ -172,29 +172,30 @@ public class BrushTool implements TraceTool { BlockBag bag = session.getBlockBag(player); - EditSession editSession = session.createEditSession(player); - Request.request().setEditSession(editSession); - if (mask != null) { - Mask existingMask = editSession.getMask(); + try (EditSession editSession = session.createEditSession(player)) { + Request.request().setEditSession(editSession); + if (mask != null) { + Mask existingMask = editSession.getMask(); - if (existingMask == null) { - editSession.setMask(mask); - } else if (existingMask instanceof MaskIntersection) { - ((MaskIntersection) existingMask).add(mask); - } else { - MaskIntersection newMask = new MaskIntersection(existingMask); - newMask.add(mask); - editSession.setMask(newMask); + if (existingMask == null) { + editSession.setMask(mask); + } else if (existingMask instanceof MaskIntersection) { + ((MaskIntersection) existingMask).add(mask); + } else { + MaskIntersection newMask = new MaskIntersection(existingMask); + newMask.add(mask); + editSession.setMask(newMask); + } } - } - try { - brush.build(editSession, target.toVector(), material, size); - } catch (MaxChangedBlocksException e) { - player.printError("Max blocks change limit reached."); + try { + brush.build(editSession, target.toVector(), material, size); + } catch (MaxChangedBlocksException e) { + player.printError("Max blocks change limit reached."); + } finally { + session.remember(editSession); + } } finally { - session.remember(editSession); - editSession.flushSession(); if (bag != null) { bag.flushChanges(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java index 3b35abf42..afeb4728d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java @@ -66,17 +66,17 @@ public class RecursivePickaxe implements BlockTool { return true; } - EditSession editSession = session.createEditSession(player); - editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); + try (EditSession editSession = session.createEditSession(player)) { + editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); - try { - recurse(server, editSession, world, clicked.toVector().toBlockVector(), - clicked.toVector(), range, initialType, new HashSet<>()); - } catch (MaxChangedBlocksException e) { - player.printError("Max blocks change limit reached."); - } finally { - editSession.flushSession(); - session.remember(editSession); + try { + recurse(server, editSession, world, clicked.toVector().toBlockVector(), + clicked.toVector(), range, initialType, new HashSet<>()); + } catch (MaxChangedBlocksException e) { + player.printError("Max blocks change limit reached."); + } finally { + session.remember(editSession); + } } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java index 1ceabcbe2..fbf1874ce 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java @@ -49,15 +49,11 @@ public class SinglePickaxe implements BlockTool { return true; } - EditSession editSession = session.createEditSession(player); - editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop); - - try { + try (EditSession editSession = session.createEditSession(player)) { + editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop); editSession.setBlock(clicked.toVector(), BlockTypes.AIR.getDefaultState()); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); - } finally { - editSession.flushSession(); } world.playEffect(clicked.toVector(), 2001, blockType.getLegacyId()); From d1312c66e1d3556cef039e5895e959842f733c0a Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Sat, 20 Oct 2018 19:54:13 -0700 Subject: [PATCH 026/182] Ensure we flush iff it is needed --- .../main/java/com/sk89q/worldedit/EditSession.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 aa630bfa1..bc98a20e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -415,7 +415,7 @@ public class EditSession implements Extent, AutoCloseable { } return; } - if (!batchingChunks) { + if (!batchingChunks && isBatchingChunks()) { flushSession(); } chunkBatchingExtent.setEnabled(batchingChunks); @@ -428,9 +428,15 @@ public class EditSession implements Extent, AutoCloseable { * @see #setBatchingChunks(boolean) */ public void disableBuffering() { - // We optimize here to avoid double calls to flushSession. + // We optimize here to avoid repeated calls to flushSession. + boolean needsFlush = isQueueEnabled() || isBatchingChunks(); + if (needsFlush) { + flushSession(); + } reorderExtent.setEnabled(false); - setBatchingChunks(false); + if (chunkBatchingExtent != null) { + chunkBatchingExtent.setEnabled(false); + } } /** From 275a2fa887c9c2851458efc3c850ed5a7e3e6096 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 24 Oct 2018 16:33:04 +1000 Subject: [PATCH 027/182] Fixed a few bad javadoc imports --- .../src/main/java/com/sk89q/worldedit/WorldEdit.java | 11 +++++++---- .../sk89q/worldedit/command/SchematicCommands.java | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) 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 69a62a5c2..cc2f9a440 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -38,6 +38,8 @@ import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.PlatformManager; import com.sk89q.worldedit.extent.inventory.BlockBag; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.scripting.CraftScriptContext; import com.sk89q.worldedit.scripting.CraftScriptEngine; import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; @@ -68,6 +70,7 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; +import javax.annotation.Nullable; import javax.script.ScriptException; /** @@ -164,7 +167,7 @@ public class WorldEdit { } /** - * Get the mask factory from which new {@link com.sk89q.worldedit.function.mask.Mask}s + * Get the mask factory from which new {@link Mask}s * can be constructed. * * @return the mask factory @@ -174,7 +177,7 @@ public class WorldEdit { } /** - * Get the pattern factory from which new {@link com.sk89q.worldedit.function.pattern.Pattern}s + * Get the pattern factory from which new {@link Pattern}s * can be constructed. * * @return the pattern factory @@ -240,12 +243,12 @@ public class WorldEdit { * @return a file * @throws FilenameException thrown if the filename is invalid */ - private File getSafeFile(Player player, File dir, String filename, String defaultExt, String[] extensions, boolean isSave) throws FilenameException { + private File getSafeFile(@Nullable Player player, File dir, String filename, String defaultExt, String[] extensions, boolean isSave) throws FilenameException { if (extensions != null && (extensions.length == 1 && extensions[0] == null)) extensions = null; File f; - if (filename.equals("#")) { + if (filename.equals("#") && player != null) { if (isSave) { f = player.openFileSaveDialog(extensions); } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index affa4b491..bb5ecba27 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -34,6 +34,7 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; @@ -92,7 +93,7 @@ public class SchematicCommands { LocalConfiguration config = worldEdit.getConfiguration(); File dir = worldEdit.getWorkingDirectoryFile(config.saveDir); - File f = worldEdit.getSafeOpenFile(player, dir, filename, "schematic", ClipboardFormats.getFileExtensionArray()); + File f = worldEdit.getSafeOpenFile(player, dir, filename, BuiltInClipboardFormat.SPONGE_SCHEMATIC.getPrimaryFileExtension(), ClipboardFormats.getFileExtensionArray()); if (!f.exists()) { player.printError("Schematic " + filename + " does not exist!"); From 93de97dc191c4941235ddcf7821212537fb40442 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 24 Oct 2018 16:50:15 +1000 Subject: [PATCH 028/182] Allow modifying the region of a BlockArrayClipboard --- .../sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 eba334e5a..cd817f9bf 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 @@ -70,7 +70,7 @@ public class BlockArrayClipboard implements Clipboard { @Override public Region getRegion() { - return region.clone(); + return region; } @Override From 3b5972b7f2e60a8e84016f2eeb4b575401674a4c Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Tue, 30 Oct 2018 18:06:00 -0700 Subject: [PATCH 029/182] Flush / unbuffer more tools --- .../command/tool/BlockDataCyler.java | 18 +++++----- .../command/tool/FloatingTreeRemover.java | 34 +++++++++---------- .../worldedit/command/tool/FloodFillTool.java | 18 +++++----- .../command/tool/LongRangeBuildTool.java | 8 ++--- .../worldedit/command/tool/TreePlanter.java | 32 ++++++++--------- 5 files changed, 56 insertions(+), 54 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java index faee49faf..474c689b3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java @@ -79,15 +79,17 @@ public class BlockDataCyler implements DoubleActionBlockTool { index = (index + 1) % currentProperty.getValues().size(); BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index)); - EditSession editSession = session.createEditSession(player); + try (EditSession editSession = session.createEditSession(player)) { + editSession.disableBuffering(); - try { - editSession.setBlock(clicked.toVector(), newBlock); - player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString()); - } catch (MaxChangedBlocksException e) { - player.printError("Max blocks change limit reached."); - } finally { - session.remember(editSession); + try { + editSession.setBlock(clicked.toVector(), newBlock); + player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString()); + } catch (MaxChangedBlocksException e) { + player.printError("Max blocks change limit reached."); + } finally { + session.remember(editSession); + } } } else { List> properties = Lists.newArrayList(block.getStates().keySet()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java index b0a47626d..5c457f13b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java @@ -76,25 +76,25 @@ public class FloatingTreeRemover implements BlockTool { return true; } - final EditSession editSession = session.createEditSession(player); - - try { - final Set blockSet = bfs(world, clicked.toVector()); - if (blockSet == null) { - player.printError("That's not a floating tree."); - return true; - } - - for (Vector blockVector : blockSet) { - final BlockState otherState = editSession.getBlock(blockVector); - if (isTreeBlock(otherState.getBlockType())) { - editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState()); + try (EditSession editSession = session.createEditSession(player)) { + try { + final Set blockSet = bfs(world, clicked.toVector()); + if (blockSet == null) { + player.printError("That's not a floating tree."); + return true; } + + for (Vector blockVector : blockSet) { + final BlockState otherState = editSession.getBlock(blockVector); + if (isTreeBlock(otherState.getBlockType())) { + editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState()); + } + } + } catch (MaxChangedBlocksException e) { + player.printError("Max blocks change limit reached."); + } finally { + session.remember(editSession); } - } catch (MaxChangedBlocksException e) { - player.printError("Max blocks change limit reached."); - } finally { - session.remember(editSession); } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java index 3d5220c8a..16030d299 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java @@ -69,15 +69,15 @@ public class FloodFillTool implements BlockTool { return true; } - EditSession editSession = session.createEditSession(player); - - try { - recurse(editSession, clicked.toVector().toBlockVector(), - clicked.toVector(), range, initialType, new HashSet<>()); - } catch (MaxChangedBlocksException e) { - player.printError("Max blocks change limit reached."); - } finally { - session.remember(editSession); + try (EditSession editSession = session.createEditSession(player)) { + try { + recurse(editSession, clicked.toVector().toBlockVector(), + clicked.toVector(), range, initialType, new HashSet<>()); + } catch (MaxChangedBlocksException e) { + player.printError("Max blocks change limit reached."); + } finally { + session.remember(editSession); + } } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java index 445c5e158..3d056de68 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java @@ -53,8 +53,8 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) { Location pos = getTargetFace(player); if (pos == null) return false; - EditSession eS = session.createEditSession(player); - try { + try (EditSession eS = session.createEditSession(player)) { + eS.disableBuffering(); BlockStateHolder applied = secondary.apply(pos.toVector()); if (applied.getBlockType().getMaterial().isAir()) { eS.setBlock(pos.toVector(), secondary); @@ -73,8 +73,8 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) { Location pos = getTargetFace(player); if (pos == null) return false; - EditSession eS = session.createEditSession(player); - try { + try (EditSession eS = session.createEditSession(player)) { + eS.disableBuffering(); BlockStateHolder applied = primary.apply(pos.toVector()); if (applied.getBlockType().getMaterial().isAir()) { eS.setBlock(pos.toVector(), primary); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java index 436d42104..27c1df2e9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java @@ -48,25 +48,25 @@ public class TreePlanter implements BlockTool { @Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { - EditSession editSession = session.createEditSession(player); + try (EditSession editSession = session.createEditSession(player)) { + try { + boolean successful = false; - try { - boolean successful = false; - - for (int i = 0; i < 10; i++) { - if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0))) { - successful = true; - break; + for (int i = 0; i < 10; i++) { + if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0))) { + successful = true; + break; + } } + + if (!successful) { + player.printError("A tree can't go there."); + } + } catch (MaxChangedBlocksException e) { + player.printError("Max. blocks changed reached."); + } finally { + session.remember(editSession); } - - if (!successful) { - player.printError("A tree can't go there."); - } - } catch (MaxChangedBlocksException e) { - player.printError("Max. blocks changed reached."); - } finally { - session.remember(editSession); } return true; From e1fbaaff592b87fcb651081f8c28b413d295634a Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Tue, 30 Oct 2018 18:39:51 -0700 Subject: [PATCH 030/182] Add tracing for unflushed EditSessions --- .../src/main/resources/defaults/config.yml | 3 ++ .../java/com/sk89q/worldedit/EditSession.java | 10 ++++ .../sk89q/worldedit/EditSessionFactory.java | 9 ++-- .../sk89q/worldedit/LocalConfiguration.java | 1 + .../sk89q/worldedit/TracedEditSession.java | 49 +++++++++++++++++++ .../extent/reorder/ChunkBatchingExtent.java | 4 ++ .../extent/reorder/MultiStageReorder.java | 4 ++ .../util/PropertiesConfiguration.java | 1 + .../worldedit/util/YAMLConfiguration.java | 1 + .../resources/defaults/worldedit.properties | 1 + .../config/ConfigurateConfiguration.java | 1 + 11 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java diff --git a/worldedit-bukkit/src/main/resources/defaults/config.yml b/worldedit-bukkit/src/main/resources/defaults/config.yml index 794b69eda..a67dfb37c 100644 --- a/worldedit-bukkit/src/main/resources/defaults/config.yml +++ b/worldedit-bukkit/src/main/resources/defaults/config.yml @@ -139,6 +139,9 @@ history: calculation: timeout: 100 +debugging: + trace-unflushed-sessions: false + wand-item: minecraft:wooden_axe shell-save-type: no-double-slash: false 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 bc98a20e3..daf542958 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -234,6 +234,16 @@ public class EditSession implements Extent, AutoCloseable { return event.getExtent(); } + // pkg private for TracedEditSession only + + ChunkBatchingExtent getChunkBatchingExtent() { + return chunkBatchingExtent; + } + + MultiStageReorder getReorderExtent() { + return reorderExtent; + } + /** * Turns on specific features for a normal WorldEdit session, such as * {@link #enableQueue() queuing} and {@link #setBatchingChunks(boolean) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java index 094da742e..9b288271f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java @@ -152,21 +152,24 @@ public class EditSessionFactory { @Override public EditSession getEditSession(World world, int maxBlocks) { - return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, null, maxBlocks, null)); + return getEditSession(world, maxBlocks, null, null); } @Override public EditSession getEditSession(World world, int maxBlocks, Player player) { - return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, player, maxBlocks, null)); + return getEditSession(world, maxBlocks, null, player); } @Override public EditSession getEditSession(World world, int maxBlocks, BlockBag blockBag) { - return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null)); + return getEditSession(world, maxBlocks, blockBag, null); } @Override public EditSession getEditSession(World world, int maxBlocks, BlockBag blockBag, Player player) { + if (WorldEdit.getInstance().getConfiguration().traceUnflushedSessions) { + return new TracedEditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, player, maxBlocks, null)); + } return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, player, maxBlocks, null)); } 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 3ef39d94b..a56e2f06e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -100,6 +100,7 @@ public abstract class LocalConfiguration { }; public boolean profile = false; + public boolean traceUnflushedSessions = false; public Set disallowedBlocks = new HashSet<>(); public int defaultChangeLimit = -1; public int maxChangeLimit = -1; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java new file mode 100644 index 000000000..efa79a0fd --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java @@ -0,0 +1,49 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit; + +import com.sk89q.worldedit.event.extent.EditSessionEvent; +import com.sk89q.worldedit.extent.inventory.BlockBag; +import com.sk89q.worldedit.util.eventbus.EventBus; +import com.sk89q.worldedit.world.World; + +import java.util.logging.Level; + +public class TracedEditSession extends EditSession { + + TracedEditSession(EventBus eventBus, World world, int maxBlocks, BlockBag blockBag, EditSessionEvent event) { + super(eventBus, world, maxBlocks, blockBag, event); + } + + private final Throwable stacktrace = new Throwable("Creation trace."); + + @Override + protected void finalize() throws Throwable { + if (!isQueueEnabled() && !isBatchingChunks()) { + return; + } + + if (getChunkBatchingExtent().commitRequired() || getReorderExtent().commitRequired()) { + WorldEdit.logger.warning("####### LEFTOVER BUFFER BLOCKS DETECTED #######"); + WorldEdit.logger.warning("This means that some code did not flush their EditSession."); + WorldEdit.logger.log(Level.WARNING, "Here is a stacktrace from the creation of this EditSession:", stacktrace); + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index b819bcac4..b5cd68572 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -73,6 +73,10 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { this.enabled = enabled; } + public boolean commitRequired() { + return batches.size() > 0; + } + @Override public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { if (!enabled) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index 3ef74dd7a..af9a5e437 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -94,6 +94,10 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder this.enabled = enabled; } + public boolean commitRequired() { + return stage1.size() > 0 || stage2.size() > 0 || stage3.size() > 0; + } + @Override public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { BlockState existing = getBlock(location); 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 fee1917aa..67b23b608 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 @@ -75,6 +75,7 @@ public class PropertiesConfiguration extends LocalConfiguration { loadExtra(); profile = getBool("profile", profile); + traceUnflushedSessions = getBool("traceUnflushedSessions", traceUnflushedSessions); disallowedBlocks = getStringSet("disallowed-blocks", defaultDisallowedBlocks); defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit); maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); 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 9fa16df5f..697e77e56 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 @@ -54,6 +54,7 @@ public class YAMLConfiguration extends LocalConfiguration { } profile = config.getBoolean("debug", profile); + traceUnflushedSessions = config.getBoolean("debugging.trace-unflushed-sessions", traceUnflushedSessions); wandItem = convertLegacyItem(config.getString("wand-item", wandItem)); defaultChangeLimit = Math.max(-1, config.getInt( diff --git a/worldedit-forge/src/main/resources/defaults/worldedit.properties b/worldedit-forge/src/main/resources/defaults/worldedit.properties index f14a7a7d3..567118f0f 100644 --- a/worldedit-forge/src/main/resources/defaults/worldedit.properties +++ b/worldedit-forge/src/main/resources/defaults/worldedit.properties @@ -5,6 +5,7 @@ super-pickaxe-many-drop-items=true register-help=true nav-wand-item=minecraft:compass profile=false +traceUnflushedSessions=false super-pickaxe-drop-items=true disallowed-blocks=minecraft:oak_sapling,minecraft:jungle_sapling,minecraft:dark_oak_sapling,minecraft:spruce_sapling,minecraft:birch_sapling,minecraft:acacia_sapling,minecraft:black_bed,minecraft:blue_bed,minecraft:brown_bed,minecraft:cyan_bed,minecraft:gray_bed,minecraft:green_bed,minecraft:light_blue_bed,minecraft:light_gray_bed,minecraft:lime_bed,minecraft:magenta_bed,minecraft:orange_bed,minecraft:pink_bed,minecraft:purple_bed,minecraft:red_bed,minecraft:white_bed,minecraft:yellow_bed,minecraft:powered_rail,minecraft:detector_rail,minecraft:grass,minecraft:dead_bush,minecraft:moving_piston,minecraft:piston_head,minecraft:sunflower,minecraft:rose_bush,minecraft:dandelion,minecraft:poppy,minecraft:brown_mushroom,minecraft:red_mushroom,minecraft:tnt,minecraft:torch,minecraft:fire,minecraft:redstone_wire,minecraft:wheat,minecraft:potatoes,minecraft:carrots,minecraft:melon_stem,minecraft:pumpkin_stem,minecraft:beetroots,minecraft:rail,minecraft:lever,minecraft:redstone_torch,minecraft:redstone_wall_torch,minecraft:repeater,minecraft:comparator,minecraft:stone_button,minecraft:birch_button,minecraft:acacia_button,minecraft:dark_oak_button,minecraft:jungle_button,minecraft:oak_button,minecraft:spruce_button,minecraft:cactus,minecraft:sugar_cane,minecraft:bedrock max-super-pickaxe-size=5 diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java index d824e0a8f..29fe11b78 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java @@ -58,6 +58,7 @@ public class ConfigurateConfiguration extends LocalConfiguration { } profile = node.getNode("debug").getBoolean(profile); + traceUnflushedSessions = node.getNode("debugging", "traceUnflushedSessions").getBoolean(traceUnflushedSessions); wandItem = node.getNode("wand-item").getString(wandItem); try { wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).getId(); From b8ae611c7381c4b166489a9e7c34bb3f8d3d5261 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Tue, 30 Oct 2018 18:44:32 -0700 Subject: [PATCH 031/182] Checkstyle requires calling super.finalize --- .../src/main/java/com/sk89q/worldedit/TracedEditSession.java | 1 + 1 file changed, 1 insertion(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java index efa79a0fd..046046795 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java @@ -36,6 +36,7 @@ public class TracedEditSession extends EditSession { @Override protected void finalize() throws Throwable { + super.finalize(); if (!isQueueEnabled() && !isBatchingChunks()) { return; } From 351a8bbc6cbfffbfddc99444560c933885ebc0ef Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Tue, 30 Oct 2018 18:45:53 -0700 Subject: [PATCH 032/182] Align configurate with yaml config --- .../sk89q/worldedit/sponge/config/ConfigurateConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java index 29fe11b78..ed9f76c5c 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java @@ -58,7 +58,7 @@ public class ConfigurateConfiguration extends LocalConfiguration { } profile = node.getNode("debug").getBoolean(profile); - traceUnflushedSessions = node.getNode("debugging", "traceUnflushedSessions").getBoolean(traceUnflushedSessions); + traceUnflushedSessions = node.getNode("debugging", "trace-unflushed-sessions").getBoolean(traceUnflushedSessions); wandItem = node.getNode("wand-item").getString(wandItem); try { wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).getId(); From e202348dac02449f14db7daac5a89f5be2b49aa6 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Sat, 3 Nov 2018 22:22:43 -0700 Subject: [PATCH 033/182] Simplify commit-required detection --- .../java/com/sk89q/worldedit/EditSession.java | 20 +++++++++---------- .../sk89q/worldedit/TracedEditSession.java | 5 +---- 2 files changed, 10 insertions(+), 15 deletions(-) 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 daf542958..094d52327 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -104,7 +104,6 @@ import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.world.NullWorld; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BaseBiome; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -113,8 +112,6 @@ import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; @@ -234,14 +231,15 @@ public class EditSession implements Extent, AutoCloseable { return event.getExtent(); } - // pkg private for TracedEditSession only - - ChunkBatchingExtent getChunkBatchingExtent() { - return chunkBatchingExtent; - } - - MultiStageReorder getReorderExtent() { - return reorderExtent; + // pkg private for TracedEditSession only, may later become public API + boolean commitRequired() { + if (isQueueEnabled() && reorderExtent.commitRequired()) { + return true; + } + if (isBatchingChunks() && chunkBatchingExtent.commitRequired()) { + return true; + } + return false; } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java index 046046795..5793a4f04 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java @@ -37,11 +37,8 @@ public class TracedEditSession extends EditSession { @Override protected void finalize() throws Throwable { super.finalize(); - if (!isQueueEnabled() && !isBatchingChunks()) { - return; - } - if (getChunkBatchingExtent().commitRequired() || getReorderExtent().commitRequired()) { + if (commitRequired()) { WorldEdit.logger.warning("####### LEFTOVER BUFFER BLOCKS DETECTED #######"); WorldEdit.logger.warning("This means that some code did not flush their EditSession."); WorldEdit.logger.log(Level.WARNING, "Here is a stacktrace from the creation of this EditSession:", stacktrace); From 399e0ad5fa7637d5d3ccce7ead1ad409e85c7dd2 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Sun, 14 Oct 2018 03:40:53 -0700 Subject: [PATCH 034/182] Refactor vector system to be cleaner - Move Vector, etc. into `.math` package - Drop many methods that will be auto-promoted anyways, eg. with `divide(int)` and `divide(double)` the first is now gone. - Take Block vectors into their own class hierarchy - Make it clear throughout the API what takes blockvectors - many more improvements --- .../sk89q/worldedit/bukkit/BukkitAdapter.java | 40 +- .../sk89q/worldedit/bukkit/BukkitPlayer.java | 16 +- .../sk89q/worldedit/bukkit/BukkitWorld.java | 47 +- .../EditSessionBlockChangeDelegate.java | 10 +- .../bukkit/adapter/BukkitImplAdapter.java | 4 +- .../main/java/com/sk89q/jnbt/NBTUtils.java | 6 +- .../java/com/sk89q/util/yaml/YAMLNode.java | 40 +- .../java/com/sk89q/worldedit/BlockVector.java | 97 -- .../com/sk89q/worldedit/BlockVector2D.java | 93 -- .../java/com/sk89q/worldedit/EditSession.java | 270 +++--- .../com/sk89q/worldedit/LocalSession.java | 9 +- .../com/sk89q/worldedit/PlayerDirection.java | 27 +- .../main/java/com/sk89q/worldedit/Vector.java | 846 ------------------ .../java/com/sk89q/worldedit/Vector2D.java | 691 -------------- .../java/com/sk89q/worldedit/WorldEdit.java | 5 +- .../worldedit/command/BiomeCommands.java | 16 +- .../worldedit/command/BrushCommands.java | 4 +- .../worldedit/command/ChunkCommands.java | 14 +- .../worldedit/command/ClipboardCommands.java | 18 +- .../command/FlattenedClipboardTransform.java | 39 +- .../worldedit/command/GenerationCommands.java | 67 +- .../worldedit/command/RegionCommands.java | 41 +- .../worldedit/command/SelectionCommands.java | 98 +- .../worldedit/command/UtilityCommands.java | 16 +- .../command/argument/ItemUseParser.java | 4 +- .../command/composition/DeformCommand.java | 2 +- .../worldedit/command/tool/AreaPickaxe.java | 8 +- .../command/tool/BlockDataCyler.java | 6 +- .../worldedit/command/tool/BlockReplacer.java | 6 +- .../worldedit/command/tool/BrushTool.java | 2 +- .../worldedit/command/tool/DistanceWand.java | 11 +- .../command/tool/FloatingTreeRemover.java | 34 +- .../worldedit/command/tool/FloodFillTool.java | 25 +- .../command/tool/LongRangeBuildTool.java | 15 +- .../worldedit/command/tool/QueryTool.java | 6 +- .../command/tool/RecursivePickaxe.java | 26 +- .../worldedit/command/tool/SinglePickaxe.java | 6 +- .../worldedit/command/tool/TreePlanter.java | 2 +- .../worldedit/command/tool/brush/Brush.java | 4 +- .../command/tool/brush/ButcherBrush.java | 4 +- .../command/tool/brush/ClipboardBrush.java | 6 +- .../command/tool/brush/CylinderBrush.java | 4 +- .../command/tool/brush/GravityBrush.java | 8 +- .../tool/brush/HollowCylinderBrush.java | 4 +- .../command/tool/brush/HollowSphereBrush.java | 4 +- .../tool/brush/OperationFactoryBrush.java | 4 +- .../command/tool/brush/SmoothBrush.java | 12 +- .../command/tool/brush/SphereBrush.java | 4 +- .../com/sk89q/worldedit/entity/Player.java | 11 +- .../event/extent/EditSessionEvent.java | 4 +- .../extension/factory/DefaultBlockParser.java | 4 +- .../extension/factory/DefaultMaskParser.java | 7 +- .../platform/AbstractPlayerActor.java | 45 +- .../extension/platform/PlatformManager.java | 15 +- .../extension/platform/PlayerProxy.java | 7 +- .../extent/AbstractDelegateExtent.java | 20 +- .../worldedit/extent/ChangeSetExtent.java | 8 +- .../com/sk89q/worldedit/extent/Extent.java | 6 +- .../sk89q/worldedit/extent/InputExtent.java | 12 +- .../sk89q/worldedit/extent/MaskingExtent.java | 4 +- .../sk89q/worldedit/extent/NullExtent.java | 26 +- .../sk89q/worldedit/extent/OutputExtent.java | 8 +- .../extent/buffer/ForgetfulExtentBuffer.java | 46 +- .../extent/cache/LastAccessExtentCache.java | 17 +- .../extent/clipboard/BlockArrayClipboard.java | 38 +- .../worldedit/extent/clipboard/Clipboard.java | 8 +- .../clipboard/io/MCEditSchematicReader.java | 21 +- .../clipboard/io/SpongeSchematicReader.java | 19 +- .../clipboard/io/SpongeSchematicWriter.java | 13 +- .../extent/inventory/BlockBagExtent.java | 4 +- .../extent/reorder/ChunkBatchingExtent.java | 17 +- .../extent/reorder/MultiStageReorder.java | 27 +- .../transform/BlockTransformExtent.java | 21 +- .../extent/validation/BlockChangeLimiter.java | 4 +- .../validation/DataValidatorExtent.java | 4 +- .../extent/world/BlockQuirkExtent.java | 4 +- .../extent/world/ChunkLoadingExtent.java | 4 +- .../extent/world/FastModeExtent.java | 10 +- .../extent/world/SurvivalModeExtent.java | 4 +- .../function/CombinedRegionFunction.java | 4 +- .../function/FlatRegionFunction.java | 4 +- .../function/FlatRegionMaskingFilter.java | 6 +- .../worldedit/function/GroundFunction.java | 6 +- .../worldedit/function/LayerFunction.java | 6 +- .../worldedit/function/RegionFunction.java | 4 +- .../function/RegionMaskingFilter.java | 6 +- .../function/biome/BiomeReplace.java | 4 +- .../block/BlockDistributionCounter.java | 4 +- .../function/block/BlockReplace.java | 4 +- .../worldedit/function/block/Counter.java | 11 +- .../function/block/ExtentBlockCopy.java | 19 +- .../worldedit/function/block/Naturalizer.java | 6 +- .../function/entity/ExtentEntityCopy.java | 23 +- .../worldedit/function/factory/Deform.java | 34 +- .../function/generator/FloraGenerator.java | 4 +- .../function/generator/ForestGenerator.java | 4 +- .../generator/GardenPatchGenerator.java | 12 +- .../worldedit/function/mask/BiomeMask2D.java | 4 +- .../function/mask/BlockCategoryMask.java | 4 +- .../worldedit/function/mask/BlockMask.java | 4 +- .../function/mask/BlockTypeMask.java | 4 +- .../function/mask/BoundedHeightMask.java | 4 +- .../function/mask/ExistingBlockMask.java | 4 +- .../function/mask/ExpressionMask.java | 6 +- .../function/mask/ExpressionMask2D.java | 4 +- .../sk89q/worldedit/function/mask/Mask.java | 4 +- .../sk89q/worldedit/function/mask/Mask2D.java | 4 +- .../function/mask/MaskIntersection.java | 4 +- .../function/mask/MaskIntersection2D.java | 4 +- .../worldedit/function/mask/MaskUnion.java | 4 +- .../worldedit/function/mask/MaskUnion2D.java | 4 +- .../sk89q/worldedit/function/mask/Masks.java | 20 +- .../worldedit/function/mask/NoiseFilter.java | 6 +- .../function/mask/NoiseFilter2D.java | 6 +- .../worldedit/function/mask/OffsetMask.java | 14 +- .../worldedit/function/mask/OffsetMask2D.java | 12 +- .../worldedit/function/mask/RegionMask.java | 4 +- .../function/mask/SolidBlockMask.java | 4 +- .../function/operation/ForwardExtentCopy.java | 15 +- .../function/pattern/BlockPattern.java | 4 +- .../function/pattern/ClipboardPattern.java | 8 +- .../worldedit/function/pattern/Pattern.java | 4 +- .../function/pattern/RandomPattern.java | 4 +- .../pattern/RepeatingExtentPattern.java | 18 +- .../function/util/FlatRegionOffset.java | 12 +- .../worldedit/function/util/RegionOffset.java | 12 +- .../function/visitor/BreadthFirstSearch.java | 55 +- .../function/visitor/DownwardVisitor.java | 16 +- .../function/visitor/FlatRegionVisitor.java | 4 +- .../function/visitor/LayerVisitor.java | 10 +- .../function/visitor/NonRisingVisitor.java | 14 +- .../function/visitor/RecursiveVisitor.java | 4 +- .../function/visitor/RegionVisitor.java | 4 +- .../worldedit/history/change/BlockChange.java | 8 +- .../changeset/BlockOptimizedHistory.java | 7 +- .../internal/annotation/Direction.java | 4 +- .../command/CommandLoggingHandler.java | 6 +- .../internal/command/WorldEditBinding.java | 8 +- .../internal/cui/SelectionCylinderEvent.java | 10 +- .../cui/SelectionEllipsoidPointEvent.java | 6 +- .../internal/cui/SelectionPoint2DEvent.java | 24 +- .../internal/cui/SelectionPointEvent.java | 6 +- .../internal/cui/ServerCUIHandler.java | 4 +- .../expression/runtime/Functions.java | 8 +- .../sk89q/worldedit/math/BlockVector2.java | 529 +++++++++++ .../sk89q/worldedit/math/BlockVector3.java | 613 +++++++++++++ .../com/sk89q/worldedit/math/Vector2.java | 471 ++++++++++ .../com/sk89q/worldedit/math/Vector3.java | 596 ++++++++++++ .../worldedit/math/convolution/HeightMap.java | 16 +- .../sk89q/worldedit/math/geom/Polygons.java | 14 +- .../math/interpolation/Interpolation.java | 6 +- .../KochanekBartelsInterpolation.java | 56 +- .../interpolation/LinearInterpolation.java | 18 +- .../worldedit/math/interpolation/Node.java | 12 +- .../ReparametrisingInterpolation.java | 6 +- .../math/noise/JLibNoiseGenerator.java | 9 +- .../worldedit/math/noise/NoiseGenerator.java | 8 +- .../worldedit/math/noise/RandomNoise.java | 8 +- .../math/transform/AffineTransform.java | 15 +- .../math/transform/CombinedTransform.java | 4 +- .../worldedit/math/transform/Identity.java | 4 +- .../worldedit/math/transform/Transform.java | 6 +- .../worldedit/regions/AbstractRegion.java | 83 +- .../regions/ConvexPolyhedralRegion.java | 80 +- .../sk89q/worldedit/regions/CuboidRegion.java | 197 ++-- .../worldedit/regions/CylinderRegion.java | 94 +- .../worldedit/regions/EllipsoidRegion.java | 77 +- .../sk89q/worldedit/regions/FlatRegion.java | 4 +- .../sk89q/worldedit/regions/NullRegion.java | 44 +- .../worldedit/regions/Polygonal2DRegion.java | 89 +- .../com/sk89q/worldedit/regions/Region.java | 29 +- .../worldedit/regions/RegionIntersection.java | 25 +- .../worldedit/regions/RegionSelector.java | 13 +- .../worldedit/regions/TransformRegion.java | 48 +- .../regions/factory/CuboidRegionFactory.java | 4 +- .../factory/CylinderRegionFactory.java | 8 +- .../regions/factory/RegionFactory.java | 4 +- .../regions/factory/SphereRegionFactory.java | 7 +- .../iterator/FlatRegion3DIterator.java | 16 +- .../regions/iterator/FlatRegionIterator.java | 24 +- .../regions/iterator/RegionIterator.java | 15 +- .../worldedit/regions/polyhedron/Edge.java | 12 +- .../regions/polyhedron/Triangle.java | 16 +- .../ConvexPolyhedralRegionSelector.java | 35 +- .../selector/CuboidRegionSelector.java | 41 +- .../selector/CylinderRegionSelector.java | 55 +- .../selector/EllipsoidRegionSelector.java | 48 +- .../ExtendingCuboidRegionSelector.java | 33 +- .../selector/Polygonal2DRegionSelector.java | 39 +- .../selector/SphereRegionSelector.java | 19 +- .../regions/shape/ArbitraryBiomeShape.java | 10 +- .../regions/shape/ArbitraryShape.java | 4 +- .../worldedit/regions/shape/RegionShape.java | 4 +- .../shape/WorldEditExpressionEnvironment.java | 20 +- .../sk89q/worldedit/session/PasteBuilder.java | 6 +- .../session/request/RequestSelection.java | 29 +- .../com/sk89q/worldedit/util/Direction.java | 60 +- .../sk89q/worldedit/util/LocatedBlock.java | 8 +- .../com/sk89q/worldedit/util/Location.java | 83 +- .../com/sk89q/worldedit/util/TargetBlock.java | 27 +- .../sk89q/worldedit/util/TreeGenerator.java | 24 +- .../util/collection/LocatedBlockList.java | 4 +- .../sk89q/worldedit/util/gson/GsonUtil.java | 4 +- .../worldedit/util/gson/VectorAdapter.java | 8 +- .../sk89q/worldedit/world/AbstractWorld.java | 35 +- .../com/sk89q/worldedit/world/NullWorld.java | 25 +- .../java/com/sk89q/worldedit/world/World.java | 37 +- .../worldedit/world/chunk/AnvilChunk.java | 29 +- .../worldedit/world/chunk/AnvilChunk13.java | 19 +- .../sk89q/worldedit/world/chunk/Chunk.java | 4 +- .../sk89q/worldedit/world/chunk/OldChunk.java | 21 +- .../world/registry/BundledBlockData.java | 4 +- .../world/registry/BundledItemData.java | 4 +- .../world/registry/LegacyMapper.java | 4 +- .../world/snapshot/SnapshotRestore.java | 34 +- .../worldedit/world/storage/ChunkStore.java | 16 +- .../world/storage/LegacyChunkStore.java | 9 +- .../world/storage/McRegionChunkStore.java | 9 +- .../world/storage/McRegionReader.java | 4 +- .../world/storage/MissingChunkException.java | 8 +- .../java/com/sk89q/worldedit/VectorTest.java | 152 ---- .../sk89q/worldedit/util/LocationTest.java | 22 +- .../sk89q/worldedit/forge/ForgeAdapter.java | 15 +- .../sk89q/worldedit/forge/ForgeEntity.java | 4 +- .../sk89q/worldedit/forge/ForgePlayer.java | 15 +- .../com/sk89q/worldedit/forge/ForgeWorld.java | 51 +- .../worldedit/forge/TileEntityUtils.java | 11 +- .../sk89q/worldedit/sponge/SpongePlayer.java | 8 +- .../sk89q/worldedit/sponge/SpongeWorld.java | 24 +- .../sponge/adapter/SpongeImplAdapter.java | 5 +- 230 files changed, 4216 insertions(+), 3913 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector.java delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector2D.java delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/Vector.java delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java delete mode 100644 worldedit-core/src/test/java/com/sk89q/worldedit/VectorTest.java 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 2f30ed2e9..ddb2c2e26 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 @@ -23,13 +23,14 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.Function; import com.sk89q.worldedit.NotABlockException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockState; @@ -42,6 +43,7 @@ import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; + import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.data.BlockData; @@ -159,7 +161,7 @@ public class BukkitAdapter { */ public static Location adapt(org.bukkit.Location location) { checkNotNull(location); - Vector position = asVector(location); + Vector3 position = asVector(location); return new com.sk89q.worldedit.util.Location( adapt(location.getWorld()), position, @@ -175,7 +177,7 @@ public class BukkitAdapter { */ public static org.bukkit.Location adapt(Location location) { checkNotNull(location); - Vector position = location.toVector(); + Vector3 position = location.toVector(); return new org.bukkit.Location( adapt((World) location.getExtent()), position.getX(), position.getY(), position.getZ(), @@ -190,7 +192,22 @@ public class BukkitAdapter { * @param position the WorldEdit position * @return a Bukkit location */ - public static org.bukkit.Location adapt(org.bukkit.World world, Vector position) { + public static org.bukkit.Location adapt(org.bukkit.World world, Vector3 position) { + checkNotNull(world); + checkNotNull(position); + return new org.bukkit.Location( + world, + position.getX(), position.getY(), position.getZ()); + } + + /** + * Create a Bukkit location from a WorldEdit position with a Bukkit world. + * + * @param world the Bukkit world + * @param position the WorldEdit position + * @return a Bukkit location + */ + public static org.bukkit.Location adapt(org.bukkit.World world, BlockVector3 position) { checkNotNull(world); checkNotNull(position); return new org.bukkit.Location( @@ -221,9 +238,20 @@ public class BukkitAdapter { * @param location The Bukkit location * @return a WorldEdit vector */ - public static Vector asVector(org.bukkit.Location location) { + public static Vector3 asVector(org.bukkit.Location location) { checkNotNull(location); - return new Vector(location.getX(), location.getY(), location.getZ()); + return new Vector3(location.getX(), location.getY(), location.getZ()); + } + + /** + * Create a WorldEdit BlockVector from a Bukkit location. + * + * @param location The Bukkit location + * @return a WorldEdit vector + */ + public static BlockVector3 asBlockVector(org.bukkit.Location location) { + checkNotNull(location); + return new BlockVector3(location.getX(), location.getY(), location.getZ()); } /** 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 46a0564a6..d5db5ca53 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 @@ -20,22 +20,24 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.util.StringUtil; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; +import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.internal.cui.CUIEvent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -115,7 +117,7 @@ public class BukkitPlayer extends AbstractPlayerActor { } @Override - public void setPosition(Vector pos, float pitch, float yaw) { + public void setPosition(Vector3 pos, float pitch, float yaw) { player.teleport(new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ(), yaw, pitch)); } @@ -173,7 +175,7 @@ public class BukkitPlayer extends AbstractPlayerActor { return; } - setPosition(new Vector(x + 0.5, y, z + 0.5)); + setPosition(new Vector3(x + 0.5, y, z + 0.5)); player.setFlying(true); } @@ -185,7 +187,7 @@ public class BukkitPlayer extends AbstractPlayerActor { @Override public com.sk89q.worldedit.util.Location getLocation() { Location nativeLocation = player.getLocation(); - Vector position = BukkitAdapter.asVector(nativeLocation); + Vector3 position = BukkitAdapter.asVector(nativeLocation); return new com.sk89q.worldedit.util.Location( getWorld(), position, @@ -243,7 +245,7 @@ public class BukkitPlayer extends AbstractPlayerActor { } @Override - public void sendFakeBlock(Vector pos, BlockStateHolder block) { + public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ()); if (block == null) { player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData()); 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 d8956542d..ad1cb83c2 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 @@ -21,16 +21,16 @@ package com.sk89q.worldedit.bukkit; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.history.change.BlockChange; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.world.AbstractWorld; @@ -39,6 +39,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.weather.WeatherType; import com.sk89q.worldedit.world.weather.WeatherTypes; + import org.bukkit.Effect; import org.bukkit.TreeType; import org.bukkit.World; @@ -90,7 +91,7 @@ public class BukkitWorld extends AbstractWorld { List ents = world.getEntities(); List entities = new ArrayList<>(); for (Entity ent : ents) { - if (region.contains(BukkitAdapter.asVector(ent.getLocation()))) { + if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) { entities.add(BukkitAdapter.adapt(ent)); } } @@ -159,7 +160,7 @@ public class BukkitWorld extends AbstractWorld { } @Override - public int getBlockLightLevel(Vector pt) { + public int getBlockLightLevel(BlockVector3 pt) { return getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel(); } @@ -167,14 +168,14 @@ public class BukkitWorld extends AbstractWorld { public boolean regenerate(Region region, EditSession editSession) { BlockStateHolder[] history = new BlockStateHolder[16 * 16 * (getMaxY() + 1)]; - for (Vector2D chunk : region.getChunks()) { - Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16); + for (BlockVector2 chunk : region.getChunks()) { + BlockVector3 min = new BlockVector3(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16); // First save all the blocks inside for (int x = 0; x < 16; ++x) { for (int y = 0; y < (getMaxY() + 1); ++y) { for (int z = 0; z < 16; ++z) { - Vector pt = min.add(x, y, z); + BlockVector3 pt = min.add(x, y, z); int index = y * 16 * 16 + z * 16 + x; history[index] = editSession.getFullBlock(pt); } @@ -191,14 +192,14 @@ public class BukkitWorld extends AbstractWorld { for (int x = 0; x < 16; ++x) { for (int y = 0; y < (getMaxY() + 1); ++y) { for (int z = 0; z < 16; ++z) { - Vector pt = min.add(x, y, z); + BlockVector3 pt = min.add(x, y, z); int index = y * 16 * 16 + z * 16 + x; // We have to restore the block if it was outside if (!region.contains(pt)) { editSession.smartSetBlock(pt, history[index]); } else { // Otherwise fool with history - editSession.getChangeSet().add(new BlockChange(pt.toBlockVector(), history[index], editSession.getFullBlock(pt))); + editSession.getChangeSet().add(new BlockChange(pt, history[index], editSession.getFullBlock(pt))); } } } @@ -237,7 +238,7 @@ public class BukkitWorld extends AbstractWorld { } @Override - public boolean clearContainerBlockContents(Vector pt) { + public boolean clearContainerBlockContents(BlockVector3 pt) { Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); if (block == null) { return false; @@ -291,7 +292,7 @@ public class BukkitWorld extends AbstractWorld { } @Override - public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector pt) { + public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 pt) { World world = getWorld(); TreeType bukkitType = toBukkitTreeType(type); return type != null && world.generateTree(BukkitAdapter.adapt(world, pt), bukkitType, @@ -299,13 +300,13 @@ public class BukkitWorld extends AbstractWorld { } @Override - public void dropItem(Vector pt, BaseItemStack item) { + public void dropItem(Vector3 pt, BaseItemStack item) { World world = getWorld(); world.dropItemNaturally(BukkitAdapter.adapt(world, pt), BukkitAdapter.adapt(item)); } @Override - public void checkLoadedChunk(Vector pt) { + public void checkLoadedChunk(BlockVector3 pt) { World world = getWorld(); if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) { @@ -337,15 +338,15 @@ public class BukkitWorld extends AbstractWorld { } @Override - public void fixAfterFastMode(Iterable chunks) { + public void fixAfterFastMode(Iterable chunks) { World world = getWorld(); - for (BlockVector2D chunkPos : chunks) { + for (BlockVector2 chunkPos : chunks) { world.refreshChunk(chunkPos.getBlockX(), chunkPos.getBlockZ()); } } @Override - public boolean playEffect(Vector position, int type, int data) { + public boolean playEffect(Vector3 position, int type, int data) { World world = getWorld(); final Effect effect = effects.get(type); @@ -404,18 +405,18 @@ public class BukkitWorld extends AbstractWorld { } @Override - public void simulateBlockMine(Vector pt) { + public void simulateBlockMine(BlockVector3 pt) { getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally(); } @Override - public com.sk89q.worldedit.world.block.BlockState getBlock(Vector position) { + public com.sk89q.worldedit.world.block.BlockState getBlock(BlockVector3 position) { Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); return BukkitAdapter.adapt(bukkitBlock.getBlockData()); } @Override - public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { try { @@ -438,7 +439,7 @@ public class BukkitWorld extends AbstractWorld { } @Override - public BaseBlock getFullBlock(Vector position) { + public BaseBlock getFullBlock(BlockVector3 position) { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position)); @@ -448,7 +449,7 @@ public class BukkitWorld extends AbstractWorld { } @Override - public BaseBiome getBiome(Vector2D position) { + public BaseBiome getBiome(BlockVector2 position) { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { int id = adapter.getBiomeId(getWorld().getBiome(position.getBlockX(), position.getBlockZ())); @@ -459,7 +460,7 @@ public class BukkitWorld extends AbstractWorld { } @Override - public boolean setBiome(Vector2D position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BaseBiome biome) { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { Biome bukkitBiome = adapter.getBiome(biome.getId()); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java index 97fa2b170..35b3afe50 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.math.BlockVector3; + import org.bukkit.BlockChangeDelegate; import org.bukkit.block.data.BlockData; @@ -40,7 +40,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { @Override public boolean setBlockData(int x, int y, int z, BlockData blockData) { try { - editSession.setBlock(new Vector(x, y, z), BukkitAdapter.adapt(blockData)); + editSession.setBlock(new BlockVector3(x, y, z), BukkitAdapter.adapt(blockData)); } catch (MaxChangedBlocksException e) { return false; } @@ -49,7 +49,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { @Override public BlockData getBlockData(int x, int y, int z) { - return BukkitAdapter.adapt(editSession.getBlock(new Vector(x, y, z))); + return BukkitAdapter.adapt(editSession.getBlock(new BlockVector3(x, y, z))); } @Override @@ -59,7 +59,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { @Override public boolean isEmpty(int x, int y, int z) { - return editSession.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isAir(); + return editSession.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir(); } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index e08f9daf5..393877581 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -20,9 +20,9 @@ package com.sk89q.worldedit.bukkit.adapter; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -112,7 +112,7 @@ public interface BukkitImplAdapter { * @param pos The position * @param nbtData The NBT Data */ - void sendFakeNBT(Player player, Vector pos, CompoundTag nbtData); + void sendFakeNBT(Player player, BlockVector3 pos, CompoundTag nbtData); /** * Make the client think it has operator status. diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java index e44262911..d0fdaae58 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java @@ -21,7 +21,7 @@ package com.sk89q.jnbt; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.storage.InvalidFormatException; import java.util.Map; @@ -167,9 +167,9 @@ public final class NBTUtils { * @param listTag the list tag * @return a vector */ - public static Vector toVector(ListTag listTag) { + public static Vector3 toVector(ListTag listTag) { checkNotNull(listTag); - return new Vector(listTag.asDouble(0), listTag.asDouble(1), listTag.asDouble(2)); + return new Vector3(listTag.asDouble(0), listTag.asDouble(1), listTag.asDouble(2)); } /** 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 d0e5fc0c7..158b72074 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 @@ -19,9 +19,9 @@ package com.sk89q.util.yaml; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.Vector2; +import com.sk89q.worldedit.math.Vector3; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -111,9 +111,9 @@ public class YAMLNode { * @return the new object */ private Object prepareSerialization(Object value) { - if (value instanceof Vector) { + if (value instanceof Vector3) { Map out = new LinkedHashMap<>(); - Vector vec = (Vector) value; + Vector3 vec = (Vector3) value; out.put("x", vec.getX()); out.put("y", vec.getY()); out.put("z", vec.getZ()); @@ -201,7 +201,7 @@ public class YAMLNode { * @param path path to node (dot notation) * @return string or default */ - public Vector getVector(String path) { + public Vector3 getVector(String path) { YAMLNode o = getNode(path); if (o == null) { return null; @@ -215,7 +215,7 @@ public class YAMLNode { return null; } - return new Vector(x, y, z); + return new Vector3(x, y, z); } /** @@ -226,7 +226,7 @@ public class YAMLNode { * @param path path to node (dot notation) * @return string or default */ - public Vector2D getVector2d(String path) { + public Vector2 getVector2(String path) { YAMLNode o = getNode(path); if (o == null) { return null; @@ -239,7 +239,7 @@ public class YAMLNode { return null; } - return new Vector2D(x, z); + return new Vector2(x, z); } /** @@ -251,8 +251,8 @@ public class YAMLNode { * @param def default value * @return string or default */ - public Vector getVector(String path, Vector def) { - Vector v = getVector(path); + public Vector3 getVector(String path, Vector3 def) { + Vector3 v = getVector(path); if (v == null) { if (writeDefaults) setProperty(path, def); return def; @@ -558,9 +558,9 @@ public class YAMLNode { * @param def default value or null for an empty list as default * @return list of integers */ - public List getVectorList(String path, List def) { + public List getVectorList(String path, List def) { List raw = getNodeList(path, null); - List list = new ArrayList<>(); + List list = new ArrayList<>(); for (YAMLNode o : raw) { Double x = o.getDouble("x"); @@ -571,7 +571,7 @@ public class YAMLNode { continue; } - list.add(new Vector(x, y, z)); + list.add(new Vector3(x, y, z)); } return list; @@ -588,10 +588,10 @@ public class YAMLNode { * @param def default value or null for an empty list as default * @return list of integers */ - public List getVector2dList(String path, List def) { + public List getVector2List(String path, List def) { List raw = getNodeList(path, null); - List list = new ArrayList<>(); + List list = new ArrayList<>(); for (YAMLNode o : raw) { Double x = o.getDouble("x"); @@ -601,7 +601,7 @@ public class YAMLNode { continue; } - list.add(new Vector2D(x, z)); + list.add(new Vector2(x, z)); } return list; @@ -618,10 +618,10 @@ public class YAMLNode { * @param def default value or null for an empty list as default * @return list of integers */ - public List getBlockVector2dList(String path, List def) { + public List getBlockVector2List(String path, List def) { List raw = getNodeList(path, null); - List list = new ArrayList<>(); + List list = new ArrayList<>(); for (YAMLNode o : raw) { Double x = o.getDouble("x"); @@ -631,7 +631,7 @@ public class YAMLNode { continue; } - list.add(new BlockVector2D(x, z)); + list.add(new BlockVector2(x, z)); } return list; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector.java deleted file mode 100644 index c444d80d1..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -/** - * Extension of {@code Vector} that that compares with other instances - * using integer components. - */ -public class BlockVector extends Vector { - - public static final BlockVector ZERO = new BlockVector(0, 0, 0); - public static final BlockVector UNIT_X = new BlockVector(1, 0, 0); - public static final BlockVector UNIT_Y = new BlockVector(0, 1, 0); - public static final BlockVector UNIT_Z = new BlockVector(0, 0, 1); - public static final BlockVector ONE = new BlockVector(1, 1, 1); - - /** - * Construct an instance as a copy of another instance. - * - * @param position the other position - */ - public BlockVector(Vector position) { - super(position); - } - - /** - * Construct a new instance. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public BlockVector(int x, int y, int z) { - super(x, y, z); - } - - /** - * Construct a new instance. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public BlockVector(float x, float y, float z) { - super(x, y, z); - } - - /** - * Construct a new instance. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public BlockVector(double x, double y, double z) { - super(x, y, z); - } - - @Override - public int hashCode() { - return ((int) x ^ ((int) z << 12)) ^ ((int) y << 24); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Vector)) { - return false; - } - Vector other = (Vector) obj; - return (int) other.getX() == (int) this.x && (int) other.getY() == (int) this.y - && (int) other.getZ() == (int) this.z; - - } - - @Override - public BlockVector toBlockVector() { - return this; - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector2D.java deleted file mode 100644 index 07d54430b..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector2D.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -/** - * Extension of {@code Vector2D} that that compares with other instances - * using integer components. - */ -public class BlockVector2D extends Vector2D { - - public static final BlockVector2D ZERO = new BlockVector2D(0, 0); - public static final BlockVector2D UNIT_X = new BlockVector2D(1, 0); - public static final BlockVector2D UNIT_Z = new BlockVector2D(0, 1); - public static final BlockVector2D ONE = new BlockVector2D(1, 1); - - /** - * Construct an instance from another instance. - * - * @param position the position to copy - */ - public BlockVector2D(Vector2D position) { - super(position); - } - - /** - * Construct a new instance. - * - * @param x the X coordinate - * @param z the Z coordinate - */ - public BlockVector2D(int x, int z) { - super(x, z); - } - - /** - * Construct a new instance. - * - * @param x the X coordinate - * @param z the Z coordinate - */ - public BlockVector2D(float x, float z) { - super(x, z); - } - - /** - * Construct a new instance. - * - * @param x the X coordinate - * @param z the Z coordinate - */ - public BlockVector2D(double x, double z) { - super(x, z); - } - - @Override - public int hashCode() { - return ((int) x << 16) ^ (int) z; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Vector2D)) { - return false; - } - - Vector2D other = (Vector2D) obj; - return (int) other.x == (int) this.x && (int) other.z == (int) this.z; - - } - - @Override - public BlockVector2D toBlockVector2D() { - return this; - } - -} 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 bc98a20e3..2e896a221 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -25,8 +25,6 @@ import static com.sk89q.worldedit.regions.Regions.asFlatRegion; import static com.sk89q.worldedit.regions.Regions.maximumBlockY; import static com.sk89q.worldedit.regions.Regions.minimumBlockY; -import com.sk89q.worldedit.function.block.BlockDistributionCounter; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.event.extent.EditSessionEvent; @@ -48,6 +46,7 @@ import com.sk89q.worldedit.extent.world.FastModeExtent; import com.sk89q.worldedit.extent.world.SurvivalModeExtent; import com.sk89q.worldedit.function.GroundFunction; import com.sk89q.worldedit.function.RegionMaskingFilter; +import com.sk89q.worldedit.function.block.BlockDistributionCounter; import com.sk89q.worldedit.function.block.BlockReplace; import com.sk89q.worldedit.function.block.Counter; import com.sk89q.worldedit.function.block.Naturalizer; @@ -81,7 +80,11 @@ import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.RValue; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.MathUtils; +import com.sk89q.worldedit.math.Vector2; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.interpolation.Interpolation; import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation; import com.sk89q.worldedit.math.interpolation.Node; @@ -113,8 +116,6 @@ import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; @@ -139,7 +140,7 @@ public class EditSession implements Extent, AutoCloseable { private static final Logger log = Logger.getLogger(EditSession.class.getCanonicalName()); /** - * Used by {@link #setBlock(Vector, BlockStateHolder, Stage)} to + * Used by {@link EditSession#setBlock(BlockVector3, BlockStateHolder, Stage)} to * determine which {@link Extent}s should be bypassed. */ public enum Stage { @@ -451,22 +452,22 @@ public class EditSession implements Extent, AutoCloseable { } @Override - public BaseBiome getBiome(Vector2D position) { + public BaseBiome getBiome(BlockVector2 position) { return bypassNone.getBiome(position); } @Override - public boolean setBiome(Vector2D position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BaseBiome biome) { return bypassNone.setBiome(position, biome); } @Override - public BlockState getBlock(Vector position) { + public BlockState getBlock(BlockVector3 position) { return world.getBlock(position); } @Override - public BaseBlock getFullBlock(Vector position) { + public BaseBlock getFullBlock(BlockVector3 position) { return world.getFullBlock(position); } @@ -481,7 +482,7 @@ public class EditSession implements Extent, AutoCloseable { */ public int getHighestTerrainBlock(int x, int z, int minY, int maxY) { for (int y = maxY; y >= minY; --y) { - Vector pt = new Vector(x, y, z); + BlockVector3 pt = new BlockVector3(x, y, z); BlockState block = getBlock(pt); if (block.getBlockType().getMaterial().isMovementBlocker()) { return y; @@ -500,7 +501,7 @@ public class EditSession implements Extent, AutoCloseable { * @return whether the block changed * @throws WorldEditException thrown on a set error */ - public boolean setBlock(Vector position, BlockStateHolder block, Stage stage) throws WorldEditException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block, Stage stage) throws WorldEditException { switch (stage) { case BEFORE_HISTORY: return bypassNone.setBlock(position, block); @@ -520,7 +521,7 @@ public class EditSession implements Extent, AutoCloseable { * @param block the block * @return whether the block changed */ - public boolean rawSetBlock(Vector position, BlockStateHolder block) { + public boolean rawSetBlock(BlockVector3 position, BlockStateHolder block) { try { return setBlock(position, block, Stage.BEFORE_CHANGE); } catch (WorldEditException e) { @@ -535,7 +536,7 @@ public class EditSession implements Extent, AutoCloseable { * @param block the block * @return whether the block changed */ - public boolean smartSetBlock(Vector position, BlockStateHolder block) { + public boolean smartSetBlock(BlockVector3 position, BlockStateHolder block) { try { return setBlock(position, block, Stage.BEFORE_REORDER); } catch (WorldEditException e) { @@ -544,7 +545,7 @@ public class EditSession implements Extent, AutoCloseable { } @Override - public boolean setBlock(Vector position, BlockStateHolder block) throws MaxChangedBlocksException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws MaxChangedBlocksException { try { return setBlock(position, block, Stage.BEFORE_HISTORY); } catch (MaxChangedBlocksException e) { @@ -562,7 +563,7 @@ public class EditSession implements Extent, AutoCloseable { * @return Whether the block changed -- not entirely dependable * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public boolean setBlock(Vector position, Pattern pattern) throws MaxChangedBlocksException { + public boolean setBlock(BlockVector3 position, Pattern pattern) throws MaxChangedBlocksException { return setBlock(position, pattern.apply(position)); } @@ -575,9 +576,9 @@ public class EditSession implements Extent, AutoCloseable { * @return the number of changed blocks * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - private int setBlocks(Set vset, Pattern pattern) throws MaxChangedBlocksException { + private int setBlocks(Set vset, Pattern pattern) throws MaxChangedBlocksException { int affected = 0; - for (Vector v : vset) { + for (BlockVector3 v : vset) { affected += setBlock(v, pattern) ? 1 : 0; } return affected; @@ -623,12 +624,12 @@ public class EditSession implements Extent, AutoCloseable { } @Override - public Vector getMinimumPoint() { + public BlockVector3 getMinimumPoint() { return getWorld().getMinimumPoint(); } @Override - public Vector getMaximumPoint() { + public BlockVector3 getMaximumPoint() { return getWorld().getMaximumPoint(); } @@ -690,7 +691,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int fillXZ(Vector origin, BlockStateHolder block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { + public int fillXZ(BlockVector3 origin, BlockStateHolder block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { return fillXZ(origin, new BlockPattern(block), radius, depth, recursive); } @@ -705,14 +706,14 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int fillXZ(Vector origin, Pattern pattern, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { + public int fillXZ(BlockVector3 origin, Pattern pattern, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { checkNotNull(origin); checkNotNull(pattern); checkArgument(radius >= 0, "radius >= 0"); checkArgument(depth >= 1, "depth >= 1"); MaskIntersection mask = new MaskIntersection( - new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), + new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))), new BoundedHeightMask( Math.max(origin.getBlockY() - depth + 1, 0), Math.min(getWorld().getMaxY(), origin.getBlockY())), @@ -747,7 +748,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int removeAbove(Vector position, int apothem, int height) throws MaxChangedBlocksException { + public int removeAbove(BlockVector3 position, int apothem, int height) throws MaxChangedBlocksException { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); checkArgument(height >= 1, "height >= 1"); @@ -769,7 +770,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int removeBelow(Vector position, int apothem, int height) throws MaxChangedBlocksException { + public int removeBelow(BlockVector3 position, int apothem, int height) throws MaxChangedBlocksException { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); checkArgument(height >= 1, "height >= 1"); @@ -791,12 +792,12 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int removeNear(Vector position, BlockType blockType, int apothem) throws MaxChangedBlocksException { + public int removeNear(BlockVector3 position, BlockType blockType, int apothem) throws MaxChangedBlocksException { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); Mask mask = new BlockTypeMask(this, blockType); - Vector adjustment = new Vector(1, 1, 1).multiply(apothem - 1); + BlockVector3 adjustment = BlockVector3.ONE.multiply(apothem - 1); Region region = new CuboidRegion( getWorld(), // Causes clamping of Y range position.add(adjustment.multiply(-1)), @@ -900,11 +901,11 @@ public class EditSession implements Extent, AutoCloseable { checkNotNull(region); checkNotNull(pattern); - Vector center = region.getCenter(); + Vector3 center = region.getCenter(); Region centerRegion = new CuboidRegion( getWorld(), // Causes clamping of Y range - new Vector(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())), - new Vector(MathUtils.roundHalfUp(center.getX()), + new BlockVector3(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())), + new BlockVector3(MathUtils.roundHalfUp(center.getX()), center.getY(), MathUtils.roundHalfUp(center.getZ()))); return setBlocks(centerRegion, pattern); } @@ -1054,7 +1055,7 @@ public class EditSession implements Extent, AutoCloseable { checkNotNull(pattern); BlockReplace replace = new BlockReplace(this, pattern); - RegionOffset offset = new RegionOffset(new Vector(0, 1, 0), replace); + RegionOffset offset = new RegionOffset(new BlockVector3(0, 1, 0), replace); GroundFunction ground = new GroundFunction(new ExistingBlockMask(this), offset); LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); Operations.completeLegacy(visitor); @@ -1089,13 +1090,13 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int stackCuboidRegion(Region region, Vector dir, int count, boolean copyAir) throws MaxChangedBlocksException { + public int stackCuboidRegion(Region region, BlockVector3 dir, int count, boolean copyAir) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(dir); checkArgument(count >= 1, "count >= 1 required"); - Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1); - Vector to = region.getMinimumPoint(); + BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1); + BlockVector3 to = region.getMinimumPoint(); ForwardExtentCopy copy = new ForwardExtentCopy(this, region, this, to); copy.setRepetitions(count); copy.setTransform(new AffineTransform().translate(dir.multiply(size))); @@ -1117,12 +1118,12 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks moved * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int moveRegion(Region region, Vector dir, int distance, boolean copyAir, BlockStateHolder replacement) throws MaxChangedBlocksException { + public int moveRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, BlockStateHolder replacement) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(dir); checkArgument(distance >= 1, "distance >= 1 required"); - Vector to = region.getMinimumPoint(); + BlockVector3 to = region.getMinimumPoint(); // Remove the original blocks com.sk89q.worldedit.function.pattern.Pattern pattern = replacement != null ? @@ -1161,7 +1162,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks moved * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int moveCuboidRegion(Region region, Vector dir, int distance, boolean copyAir, BlockStateHolder replacement) throws MaxChangedBlocksException { + public int moveCuboidRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, BlockStateHolder replacement) throws MaxChangedBlocksException { return moveRegion(region, dir, distance, copyAir, replacement); } @@ -1173,20 +1174,20 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int drainArea(Vector origin, double radius) throws MaxChangedBlocksException { + public int drainArea(BlockVector3 origin, double radius) throws MaxChangedBlocksException { checkNotNull(origin); checkArgument(radius >= 0, "radius >= 0 required"); MaskIntersection mask = new MaskIntersection( new BoundedHeightMask(0, getWorld().getMaxY()), - new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), + new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))), getWorld().createLiquidMask()); BlockReplace replace = new BlockReplace(this, new BlockPattern(BlockTypes.AIR.getDefaultState())); RecursiveVisitor visitor = new RecursiveVisitor(mask, replace); // Around the origin in a 3x3 block - for (BlockVector position : CuboidRegion.fromCenter(origin, 1)) { + for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) { if (mask.test(position)) { visitor.visit(position); } @@ -1206,7 +1207,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int fixLiquid(Vector origin, double radius, BlockType fluid) throws MaxChangedBlocksException { + public int fixLiquid(BlockVector3 origin, double radius, BlockType fluid) throws MaxChangedBlocksException { checkNotNull(origin); checkArgument(radius >= 0, "radius >= 0 required"); @@ -1219,7 +1220,7 @@ public class EditSession implements Extent, AutoCloseable { // There are boundaries that the routine needs to stay in MaskIntersection mask = new MaskIntersection( new BoundedHeightMask(0, Math.min(origin.getBlockY(), getWorld().getMaxY())), - new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), + new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))), blockMask ); @@ -1227,7 +1228,7 @@ public class EditSession implements Extent, AutoCloseable { NonRisingVisitor visitor = new NonRisingVisitor(mask, replace); // Around the origin in a 3x3 block - for (BlockVector position : CuboidRegion.fromCenter(origin, 1)) { + for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) { if (liquidMask.test(position)) { visitor.visit(position); } @@ -1249,7 +1250,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makeCylinder(Vector pos, Pattern block, double radius, int height, boolean filled) throws MaxChangedBlocksException { + public int makeCylinder(BlockVector3 pos, Pattern block, double radius, int height, boolean filled) throws MaxChangedBlocksException { return makeCylinder(pos, block, radius, radius, height, filled); } @@ -1265,7 +1266,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makeCylinder(Vector pos, Pattern block, double radiusX, double radiusZ, int height, boolean filled) throws MaxChangedBlocksException { + public int makeCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, boolean filled) throws MaxChangedBlocksException { int affected = 0; radiusX += 0.5; @@ -1279,7 +1280,7 @@ public class EditSession implements Extent, AutoCloseable { } if (pos.getBlockY() < 0) { - pos = pos.setY(0); + pos = pos.withY(0); } else if (pos.getBlockY() + height - 1 > world.getMaxY()) { height = world.getMaxY() - pos.getBlockY() + 1; } @@ -1343,7 +1344,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makeSphere(Vector pos, Pattern block, double radius, boolean filled) throws MaxChangedBlocksException { + public int makeSphere(BlockVector3 pos, Pattern block, double radius, boolean filled) throws MaxChangedBlocksException { return makeSphere(pos, block, radius, radius, radius, filled); } @@ -1359,7 +1360,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makeSphere(Vector pos, Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled) throws MaxChangedBlocksException { + public int makeSphere(BlockVector3 pos, Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled) throws MaxChangedBlocksException { int affected = 0; radiusX += 0.5; @@ -1445,7 +1446,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makePyramid(Vector position, Pattern block, int size, boolean filled) throws MaxChangedBlocksException { + public int makePyramid(BlockVector3 position, Pattern block, int size, boolean filled) throws MaxChangedBlocksException { int affected = 0; int height = size; @@ -1485,7 +1486,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int thaw(Vector position, double radius) + public int thaw(BlockVector3 position, double radius) throws MaxChangedBlocksException { int affected = 0; double radiusSq = radius * radius; @@ -1500,12 +1501,12 @@ public class EditSession implements Extent, AutoCloseable { int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) { - if ((new Vector(x, oy, z)).distanceSq(position) > radiusSq) { + if ((new BlockVector3(x, oy, z)).distanceSq(position) > radiusSq) { continue; } for (int y = world.getMaxY(); y >= 1; --y) { - Vector pt = new Vector(x, y, z); + BlockVector3 pt = new BlockVector3(x, y, z); BlockType id = getBlock(pt).getBlockType(); if (id == BlockTypes.ICE) { @@ -1536,7 +1537,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int simulateSnow(Vector position, double radius) throws MaxChangedBlocksException { + public int simulateSnow(BlockVector3 position, double radius) throws MaxChangedBlocksException { int affected = 0; double radiusSq = radius * radius; @@ -1550,12 +1551,12 @@ public class EditSession implements Extent, AutoCloseable { int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) { - if ((new Vector(x, oy, z)).distanceSq(position) > radiusSq) { + if ((new BlockVector3(x, oy, z)).distanceSq(position) > radiusSq) { continue; } for (int y = world.getMaxY(); y >= 1; --y) { - Vector pt = new Vector(x, y, z); + BlockVector3 pt = new BlockVector3(x, y, z); BlockType id = getBlock(pt).getBlockType(); if (id.getMaterial().isAir()) { @@ -1604,7 +1605,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int green(Vector position, double radius, boolean onlyNormalDirt) + public int green(BlockVector3 position, double radius, boolean onlyNormalDirt) throws MaxChangedBlocksException { int affected = 0; final double radiusSq = radius * radius; @@ -1618,12 +1619,12 @@ public class EditSession implements Extent, AutoCloseable { final int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) { - if ((new Vector(x, oy, z)).distanceSq(position) > radiusSq) { + if ((new BlockVector3(x, oy, z)).distanceSq(position) > radiusSq) { continue; } for (int y = world.getMaxY(); y >= 1; --y) { - final Vector pt = new Vector(x, y, z); + final BlockVector3 pt = new BlockVector3(x, y, z); final BlockState block = getBlock(pt); if (block.getBlockType() == BlockTypes.DIRT || @@ -1652,7 +1653,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of patches created * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makePumpkinPatches(Vector position, int apothem) throws MaxChangedBlocksException { + public int makePumpkinPatches(BlockVector3 position, int apothem) throws MaxChangedBlocksException { // We want to generate pumpkins GardenPatchGenerator generator = new GardenPatchGenerator(this); generator.setPlant(GardenPatchGenerator.getPumpkinPattern()); @@ -1681,7 +1682,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of trees created * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makeForest(Vector basePosition, int size, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException { + public int makeForest(BlockVector3 basePosition, int size, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException { int affected = 0; for (int x = basePosition.getBlockX() - size; x <= basePosition.getBlockX() @@ -1689,7 +1690,7 @@ public class EditSession implements Extent, AutoCloseable { for (int z = basePosition.getBlockZ() - size; z <= basePosition.getBlockZ() + size; ++z) { // Don't want to be in the ground - if (!getBlock(new Vector(x, basePosition.getBlockY(), z)).getBlockType().getMaterial().isAir()) { + if (!getBlock(new BlockVector3(x, basePosition.getBlockY(), z)).getBlockType().getMaterial().isAir()) { continue; } // The gods don't want a tree here @@ -1699,13 +1700,13 @@ public class EditSession implements Extent, AutoCloseable { for (int y = basePosition.getBlockY(); y >= basePosition.getBlockY() - 10; --y) { // Check if we hit the ground - BlockType t = getBlock(new Vector(x, y, z)).getBlockType(); + BlockType t = getBlock(new BlockVector3(x, y, z)).getBlockType(); if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) { - treeType.generate(this, new Vector(x, y + 1, z)); + treeType.generate(this, new BlockVector3(x, y + 1, z)); ++affected; break; } else if (t == BlockTypes.SNOW) { - setBlock(new Vector(x, y, z), BlockTypes.AIR.getDefaultState()); + setBlock(new BlockVector3(x, y, z), BlockTypes.AIR.getDefaultState()); } else if (!t.getMaterial().isAir()) { // Trees won't grow on this! break; } @@ -1729,7 +1730,7 @@ public class EditSession implements Extent, AutoCloseable { return count.getDistribution(); } - public int makeShape(final Region region, final Vector zero, final Vector unit, final Pattern pattern, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException { + public int makeShape(final Region region, final Vector3 zero, final Vector3 unit, final Pattern pattern, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException { final Expression expression = Expression.compile(expressionString, "x", "y", "z", "type", "data"); expression.optimize(); @@ -1742,9 +1743,9 @@ public class EditSession implements Extent, AutoCloseable { final ArbitraryShape shape = new ArbitraryShape(region) { @Override protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { - final Vector current = new Vector(x, y, z); + final Vector3 current = new Vector3(x, y, z); environment.setCurrentBlock(current); - final Vector scaled = current.subtract(zero).divide(unit); + final Vector3 scaled = current.subtract(zero).divide(unit); try { if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), defaultMaterial.getBlockType().getLegacyId(), 0) <= 0) { @@ -1763,7 +1764,7 @@ public class EditSession implements Extent, AutoCloseable { return shape.generate(this, pattern, hollow); } - public int deformRegion(final Region region, final Vector zero, final Vector unit, final String expressionString) throws ExpressionException, MaxChangedBlocksException { + public int deformRegion(final Region region, final Vector3 zero, final Vector3 unit, final String expressionString) throws ExpressionException, MaxChangedBlocksException { final Expression expression = Expression.compile(expressionString, "x", "y", "z"); expression.optimize(); @@ -1774,16 +1775,16 @@ public class EditSession implements Extent, AutoCloseable { final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(this, unit, zero); expression.setEnvironment(environment); - final DoubleArrayList queue = new DoubleArrayList<>(false); + final DoubleArrayList queue = new DoubleArrayList<>(false); - for (BlockVector position : region) { + for (BlockVector3 position : region) { // offset, scale - final Vector scaled = position.subtract(zero).divide(unit); + final Vector3 scaled = position.toVector3().subtract(zero).divide(unit); // transform expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ()); - final BlockVector sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue()); + final BlockVector3 sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue()); // read block from world final BaseBlock material = world.getFullBlock(sourcePosition); @@ -1793,8 +1794,8 @@ public class EditSession implements Extent, AutoCloseable { } int affected = 0; - for (Map.Entry entry : queue) { - BlockVector position = entry.getKey(); + for (Map.Entry entry : queue) { + BlockVector3 position = entry.getKey(); BaseBlock material = entry.getValue(); // set at new position @@ -1819,10 +1820,10 @@ public class EditSession implements Extent, AutoCloseable { public int hollowOutRegion(Region region, int thickness, Pattern pattern) throws MaxChangedBlocksException { int affected = 0; - final Set outside = new HashSet<>(); + final Set outside = new HashSet<>(); - final Vector min = region.getMinimumPoint(); - final Vector max = region.getMaximumPoint(); + final BlockVector3 min = region.getMinimumPoint(); + final BlockVector3 max = region.getMaximumPoint(); final int minX = min.getBlockX(); final int minY = min.getBlockY(); @@ -1833,30 +1834,30 @@ public class EditSession implements Extent, AutoCloseable { for (int x = minX; x <= maxX; ++x) { for (int y = minY; y <= maxY; ++y) { - recurseHollow(region, new BlockVector(x, y, minZ), outside); - recurseHollow(region, new BlockVector(x, y, maxZ), outside); + recurseHollow(region, new BlockVector3(x, y, minZ), outside); + recurseHollow(region, new BlockVector3(x, y, maxZ), outside); } } for (int y = minY; y <= maxY; ++y) { for (int z = minZ; z <= maxZ; ++z) { - recurseHollow(region, new BlockVector(minX, y, z), outside); - recurseHollow(region, new BlockVector(maxX, y, z), outside); + recurseHollow(region, new BlockVector3(minX, y, z), outside); + recurseHollow(region, new BlockVector3(maxX, y, z), outside); } } for (int z = minZ; z <= maxZ; ++z) { for (int x = minX; x <= maxX; ++x) { - recurseHollow(region, new BlockVector(x, minY, z), outside); - recurseHollow(region, new BlockVector(x, maxY, z), outside); + recurseHollow(region, new BlockVector3(x, minY, z), outside); + recurseHollow(region, new BlockVector3(x, maxY, z), outside); } } for (int i = 1; i < thickness; ++i) { - final Set newOutside = new HashSet<>(); - outer: for (BlockVector position : region) { - for (Vector recurseDirection: recurseDirections) { - BlockVector neighbor = position.add(recurseDirection).toBlockVector(); + final Set newOutside = new HashSet<>(); + outer: for (BlockVector3 position : region) { + for (BlockVector3 recurseDirection : recurseDirections) { + BlockVector3 neighbor = position.add(recurseDirection); if (outside.contains(neighbor)) { newOutside.add(position); @@ -1868,9 +1869,9 @@ public class EditSession implements Extent, AutoCloseable { outside.addAll(newOutside); } - outer: for (BlockVector position : region) { - for (Vector recurseDirection: recurseDirections) { - BlockVector neighbor = position.add(recurseDirection).toBlockVector(); + outer: for (BlockVector3 position : region) { + for (BlockVector3 recurseDirection : recurseDirections) { + BlockVector3 neighbor = position.add(recurseDirection); if (outside.contains(neighbor)) { continue outer; @@ -1897,10 +1898,10 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int drawLine(Pattern pattern, Vector pos1, Vector pos2, double radius, boolean filled) + public int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled) throws MaxChangedBlocksException { - Set vset = new HashSet<>(); + Set vset = new HashSet<>(); boolean notdrawn = true; int x1 = pos1.getBlockX(), y1 = pos1.getBlockY(), z1 = pos1.getBlockZ(); @@ -1909,7 +1910,7 @@ public class EditSession implements Extent, AutoCloseable { int dx = Math.abs(x2 - x1), dy = Math.abs(y2 - y1), dz = Math.abs(z2 - z1); if (dx + dy + dz == 0) { - vset.add(new Vector(tipx, tipy, tipz)); + vset.add(new BlockVector3(tipx, tipy, tipz)); notdrawn = false; } @@ -1919,7 +1920,7 @@ public class EditSession implements Extent, AutoCloseable { tipy = (int) Math.round(y1 + domstep * ((double) dy) / ((double) dx) * (y2 - y1 > 0 ? 1 : -1)); tipz = (int) Math.round(z1 + domstep * ((double) dz) / ((double) dx) * (z2 - z1 > 0 ? 1 : -1)); - vset.add(new Vector(tipx, tipy, tipz)); + vset.add(new BlockVector3(tipx, tipy, tipz)); } notdrawn = false; } @@ -1930,7 +1931,7 @@ public class EditSession implements Extent, AutoCloseable { tipx = (int) Math.round(x1 + domstep * ((double) dx) / ((double) dy) * (x2 - x1 > 0 ? 1 : -1)); tipz = (int) Math.round(z1 + domstep * ((double) dz) / ((double) dy) * (z2 - z1 > 0 ? 1 : -1)); - vset.add(new Vector(tipx, tipy, tipz)); + vset.add(new BlockVector3(tipx, tipy, tipz)); } notdrawn = false; } @@ -1941,7 +1942,7 @@ public class EditSession implements Extent, AutoCloseable { tipy = (int) Math.round(y1 + domstep * ((double) dy) / ((double) dz) * (y2-y1>0 ? 1 : -1)); tipx = (int) Math.round(x1 + domstep * ((double) dx) / ((double) dz) * (x2-x1>0 ? 1 : -1)); - vset.add(new Vector(tipx, tipy, tipz)); + vset.add(new BlockVector3(tipx, tipy, tipz)); } notdrawn = false; } @@ -1968,16 +1969,16 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int drawSpline(Pattern pattern, List nodevectors, double tension, double bias, double continuity, double quality, double radius, boolean filled) + public int drawSpline(Pattern pattern, List nodevectors, double tension, double bias, double continuity, double quality, double radius, boolean filled) throws MaxChangedBlocksException { - Set vset = new HashSet<>(); + Set vset = new HashSet<>(); List nodes = new ArrayList<>(nodevectors.size()); Interpolation interpol = new KochanekBartelsInterpolation(); - for (Vector nodevector : nodevectors) { - Node n = new Node(nodevector); + for (BlockVector3 nodevector : nodevectors) { + Node n = new Node(nodevector.toVector3()); n.setTension(tension); n.setBias(bias); n.setContinuity(continuity); @@ -1987,12 +1988,9 @@ public class EditSession implements Extent, AutoCloseable { interpol.setNodes(nodes); double splinelength = interpol.arcLength(0, 1); for (double loop = 0; loop <= 1; loop += 1D / splinelength / quality) { - Vector tipv = interpol.getPosition(loop); - int tipx = (int) Math.round(tipv.getX()); - int tipy = (int) Math.round(tipv.getY()); - int tipz = (int) Math.round(tipv.getZ()); + Vector3 tipv = interpol.getPosition(loop); - vset.add(new Vector(tipx, tipy, tipz)); + vset.add(tipv.toBlockPoint()); } vset = getBallooned(vset, radius); @@ -2010,18 +2008,18 @@ public class EditSession implements Extent, AutoCloseable { return Math.sqrt(sum); } - private static Set getBallooned(Set vset, double radius) { - Set returnset = new HashSet<>(); + private static Set getBallooned(Set vset, double radius) { + Set returnset = new HashSet<>(); int ceilrad = (int) Math.ceil(radius); - for (Vector v : vset) { + for (BlockVector3 v : vset) { int tipx = v.getBlockX(), tipy = v.getBlockY(), tipz = v.getBlockZ(); for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) { for (int loopy = tipy - ceilrad; loopy <= tipy + ceilrad; loopy++) { for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) { if (hypot(loopx - tipx, loopy - tipy, loopz - tipz) <= radius) { - returnset.add(new Vector(loopx, loopy, loopz)); + returnset.add(new BlockVector3(loopx, loopy, loopz)); } } } @@ -2030,28 +2028,28 @@ public class EditSession implements Extent, AutoCloseable { return returnset; } - private static Set getHollowed(Set vset) { - Set returnset = new HashSet<>(); - for (Vector v : vset) { + private static Set getHollowed(Set vset) { + Set returnset = new HashSet<>(); + for (BlockVector3 v : vset) { double x = v.getX(), y = v.getY(), z = v.getZ(); - if (!(vset.contains(new Vector(x + 1, y, z)) && - vset.contains(new Vector(x - 1, y, z)) && - vset.contains(new Vector(x, y + 1, z)) && - vset.contains(new Vector(x, y - 1, z)) && - vset.contains(new Vector(x, y, z + 1)) && - vset.contains(new Vector(x, y, z - 1)))) { + if (!(vset.contains(new BlockVector3(x + 1, y, z)) && + vset.contains(new BlockVector3(x - 1, y, z)) && + vset.contains(new BlockVector3(x, y + 1, z)) && + vset.contains(new BlockVector3(x, y - 1, z)) && + vset.contains(new BlockVector3(x, y, z + 1)) && + vset.contains(new BlockVector3(x, y, z - 1)))) { returnset.add(v); } } return returnset; } - private void recurseHollow(Region region, BlockVector origin, Set outside) { - final LinkedList queue = new LinkedList<>(); + private void recurseHollow(Region region, BlockVector3 origin, Set outside) { + final LinkedList queue = new LinkedList<>(); queue.addLast(origin); while (!queue.isEmpty()) { - final BlockVector current = queue.removeFirst(); + final BlockVector3 current = queue.removeFirst(); final BlockState block = getBlock(current); if (block.getBlockType().getMaterial().isMovementBlocker()) { continue; @@ -2065,15 +2063,15 @@ public class EditSession implements Extent, AutoCloseable { continue; } - for (Vector recurseDirection: recurseDirections) { - queue.addLast(current.add(recurseDirection).toBlockVector()); + for (BlockVector3 recurseDirection : recurseDirections) { + queue.addLast(current.add(recurseDirection)); } - } // while + } } - public int makeBiomeShape(final Region region, final Vector zero, final Vector unit, final BaseBiome biomeType, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException { - final Vector2D zero2D = zero.toVector2D(); - final Vector2D unit2D = unit.toVector2D(); + public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BaseBiome biomeType, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException { + final Vector2 zero2D = zero.toVector2(); + final Vector2 unit2D = unit.toVector2(); final Expression expression = Expression.compile(expressionString, "x", "z"); expression.optimize(); @@ -2085,9 +2083,9 @@ public class EditSession implements Extent, AutoCloseable { final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) { @Override protected BaseBiome getBiome(int x, int z, BaseBiome defaultBiomeType) { - final Vector2D current = new Vector2D(x, z); - environment.setCurrentBlock(current.toVector(0)); - final Vector2D scaled = current.subtract(zero2D).divide(unit2D); + final Vector2 current = new Vector2(x, z); + environment.setCurrentBlock(current.toVector3(0)); + final Vector2 scaled = current.subtract(zero2D).divide(unit2D); try { if (expression.evaluate(scaled.getX(), scaled.getZ()) <= 0) { @@ -2106,13 +2104,13 @@ public class EditSession implements Extent, AutoCloseable { return shape.generate(this, biomeType, hollow); } - private static final Vector[] recurseDirections = { - Direction.NORTH.toVector(), - Direction.EAST.toVector(), - Direction.SOUTH.toVector(), - Direction.WEST.toVector(), - Direction.UP.toVector(), - Direction.DOWN.toVector(), + private static final BlockVector3[] recurseDirections = { + Direction.NORTH.toBlockVector(), + Direction.EAST.toBlockVector(), + Direction.SOUTH.toBlockVector(), + Direction.WEST.toBlockVector(), + Direction.UP.toBlockVector(), + Direction.DOWN.toBlockVector(), }; private static double lengthSq(double x, double y, double z) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index d30e4ec6f..567488fbe 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -40,6 +40,7 @@ import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionShapeEvent; import com.sk89q.worldedit.internal.cui.ServerCUIHandler; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; @@ -91,7 +92,7 @@ public class LocalSession { private transient boolean fastMode = false; private transient Mask mask; private transient TimeZone timezone = TimeZone.getDefault(); - private transient Vector cuiTemporaryBlock; + private transient BlockVector3 cuiTemporaryBlock; // Saved properties private String lastScript; @@ -450,10 +451,10 @@ public class LocalSession { * @return the position to use * @throws IncompleteRegionException thrown if a region is not fully selected */ - public Vector getPlacementPosition(Player player) throws IncompleteRegionException { + public BlockVector3 getPlacementPosition(Player player) throws IncompleteRegionException { checkNotNull(player); if (!placeAtPos1) { - return player.getBlockIn().toVector(); + return player.getBlockIn().toVector().toBlockPoint(); } return selector.getPrimaryPosition(); @@ -661,7 +662,7 @@ public class LocalSession { if (block != null) { // If it's null, we don't need to do anything. The old was already removed. Map tags = block.getNbtData().getValue(); - cuiTemporaryBlock = new Vector( + cuiTemporaryBlock = new BlockVector3( ((IntTag) tags.get("x")).getValue(), ((IntTag) tags.get("y")).getValue(), ((IntTag) tags.get("z")).getValue() diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java index 2a82fea88..39a7c0409 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Direction; /** @@ -28,26 +29,26 @@ import com.sk89q.worldedit.util.Direction; */ public enum PlayerDirection { - NORTH(new Vector(0, 0, -1), true), - NORTH_EAST((new Vector(1, 0, -1)).normalize(), false), - EAST(new Vector(1, 0, 0), true), - SOUTH_EAST((new Vector(1, 0, 1)).normalize(), false), - SOUTH(new Vector(0, 0, 1), true), - SOUTH_WEST((new Vector(-1, 0, 1)).normalize(), false), - WEST(new Vector(-1, 0, 0), true), - NORTH_WEST((new Vector(-1, 0, -1)).normalize(), false), - UP(new Vector(0, 1, 0), true), - DOWN(new Vector(0, -1, 0), true); + NORTH(new Vector3(0, 0, -1), true), + NORTH_EAST((new Vector3(1, 0, -1)).normalize(), false), + EAST(new Vector3(1, 0, 0), true), + SOUTH_EAST((new Vector3(1, 0, 1)).normalize(), false), + SOUTH(new Vector3(0, 0, 1), true), + SOUTH_WEST((new Vector3(-1, 0, 1)).normalize(), false), + WEST(new Vector3(-1, 0, 0), true), + NORTH_WEST((new Vector3(-1, 0, -1)).normalize(), false), + UP(new Vector3(0, 1, 0), true), + DOWN(new Vector3(0, -1, 0), true); - private final Vector dir; + private final Vector3 dir; private final boolean isOrthogonal; - PlayerDirection(Vector vec, boolean isOrthogonal) { + PlayerDirection(Vector3 vec, boolean isOrthogonal) { this.dir = vec; this.isOrthogonal = isOrthogonal; } - public Vector vector() { + public Vector3 vector() { return dir; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/Vector.java deleted file mode 100644 index a47210ce6..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector.java +++ /dev/null @@ -1,846 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.sk89q.worldedit.math.transform.AffineTransform; - -import javax.annotation.Nullable; - -/** - * An immutable 3-dimensional vector. - */ -public class Vector implements Comparable { - - public static final Vector ZERO = new Vector(0, 0, 0); - public static final Vector UNIT_X = new Vector(1, 0, 0); - public static final Vector UNIT_Y = new Vector(0, 1, 0); - public static final Vector UNIT_Z = new Vector(0, 0, 1); - public static final Vector ONE = new Vector(1, 1, 1); - - protected final double x, y, z; - - /** - * Construct an instance. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public Vector(double x, double y, double z) { - this.x = x; - this.y = y; - this.z = z; - } - - /** - * Construct an instance. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public Vector(int x, int y, int z) { - this.x = (double) x; - this.y = (double) y; - this.z = (double) z; - } - - /** - * Construct an instance. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public Vector(float x, float y, float z) { - this.x = (double) x; - this.y = (double) y; - this.z = (double) z; - } - - /** - * Copy another vector. - * - * @param other another vector to make a copy of - */ - public Vector(Vector other) { - this.x = other.x; - this.y = other.y; - this.z = other.z; - } - - /** - * Construct a new instance with X, Y, and Z coordinates set to 0. - * - *

One can also refer to a static {@link #ZERO}.

- */ - public Vector() { - this.x = 0; - this.y = 0; - this.z = 0; - } - - /** - * Get the X coordinate. - * - * @return the x coordinate - */ - public double getX() { - return x; - } - - /** - * Get the X coordinate rounded. - * - * @return the x coordinate - */ - public int getBlockX() { - return (int) Math.round(x); - } - - /** - * Set the X coordinate. - * - * @param x the new X - * @return a new vector - */ - public Vector setX(double x) { - return new Vector(x, y, z); - } - - /** - * Set the X coordinate. - * - * @param x the X coordinate - * @return new vector - */ - public Vector setX(int x) { - return new Vector(x, y, z); - } - - /** - * Get the Y coordinate. - * - * @return the y coordinate - */ - public double getY() { - return y; - } - - /** - * Get the Y coordinate rounded. - * - * @return the y coordinate - */ - public int getBlockY() { - return (int) Math.round(y); - } - - /** - * Set the Y coordinate. - * - * @param y the new Y - * @return a new vector - */ - public Vector setY(double y) { - return new Vector(x, y, z); - } - - /** - * Set the Y coordinate. - * - * @param y the new Y - * @return a new vector - */ - public Vector setY(int y) { - return new Vector(x, y, z); - } - - /** - * Get the Z coordinate. - * - * @return the z coordinate - */ - public double getZ() { - return z; - } - - /** - * Get the Z coordinate rounded. - * - * @return the z coordinate - */ - public int getBlockZ() { - return (int) Math.round(z); - } - - /** - * Set the Z coordinate. - * - * @param z the new Z - * @return a new vector - */ - public Vector setZ(double z) { - return new Vector(x, y, z); - } - - /** - * Set the Z coordinate. - * - * @param z the new Z - * @return a new vector - */ - public Vector setZ(int z) { - return new Vector(x, y, z); - } - - /** - * Add another vector to this vector and return the result as a new vector. - * - * @param other the other vector - * @return a new vector - */ - public Vector add(Vector other) { - return new Vector(x + other.x, y + other.y, z + other.z); - } - - /** - * Add another vector to this vector and return the result as a new vector. - * - * @param x the value to add - * @param y the value to add - * @param z the value to add - * @return a new vector - */ - public Vector add(double x, double y, double z) { - return new Vector(this.x + x, this.y + y, this.z + z); - } - - /** - * Add another vector to this vector and return the result as a new vector. - * - * @param x the value to add - * @param y the value to add - * @param z the value to add - * @return a new vector - */ - public Vector add(int x, int y, int z) { - return new Vector(this.x + x, this.y + y, this.z + z); - } - - /** - * Add a list of vectors to this vector and return the - * result as a new vector. - * - * @param others an array of vectors - * @return a new vector - */ - public Vector add(Vector... others) { - double newX = x, newY = y, newZ = z; - - for (Vector other : others) { - newX += other.x; - newY += other.y; - newZ += other.z; - } - - return new Vector(newX, newY, newZ); - } - - /** - * Subtract another vector from this vector and return the result - * as a new vector. - * - * @param other the other vector - * @return a new vector - */ - public Vector subtract(Vector other) { - return new Vector(x - other.x, y - other.y, z - other.z); - } - - /** - * Subtract another vector from this vector and return the result - * as a new vector. - * - * @param x the value to subtract - * @param y the value to subtract - * @param z the value to subtract - * @return a new vector - */ - public Vector subtract(double x, double y, double z) { - return new Vector(this.x - x, this.y - y, this.z - z); - } - - /** - * Subtract another vector from this vector and return the result - * as a new vector. - * - * @param x the value to subtract - * @param y the value to subtract - * @param z the value to subtract - * @return a new vector - */ - public Vector subtract(int x, int y, int z) { - return new Vector(this.x - x, this.y - y, this.z - z); - } - - /** - * Subtract a list of vectors from this vector and return the result - * as a new vector. - * - * @param others an array of vectors - * @return a new vector - */ - public Vector subtract(Vector... others) { - double newX = x, newY = y, newZ = z; - - for (Vector other : others) { - newX -= other.x; - newY -= other.y; - newZ -= other.z; - } - - return new Vector(newX, newY, newZ); - } - - /** - * Multiply this vector by another vector on each component. - * - * @param other the other vector - * @return a new vector - */ - public Vector multiply(Vector other) { - return new Vector(x * other.x, y * other.y, z * other.z); - } - - /** - * Multiply this vector by another vector on each component. - * - * @param x the value to multiply - * @param y the value to multiply - * @param z the value to multiply - * @return a new vector - */ - public Vector multiply(double x, double y, double z) { - return new Vector(this.x * x, this.y * y, this.z * z); - } - - /** - * Multiply this vector by another vector on each component. - * - * @param x the value to multiply - * @param y the value to multiply - * @param z the value to multiply - * @return a new vector - */ - public Vector multiply(int x, int y, int z) { - return new Vector(this.x * x, this.y * y, this.z * z); - } - - /** - * Multiply this vector by zero or more vectors on each component. - * - * @param others an array of vectors - * @return a new vector - */ - public Vector multiply(Vector... others) { - double newX = x, newY = y, newZ = z; - - for (Vector other : others) { - newX *= other.x; - newY *= other.y; - newZ *= other.z; - } - - return new Vector(newX, newY, newZ); - } - - /** - * Perform scalar multiplication and return a new vector. - * - * @param n the value to multiply - * @return a new vector - */ - public Vector multiply(double n) { - return new Vector(this.x * n, this.y * n, this.z * n); - } - - /** - * Perform scalar multiplication and return a new vector. - * - * @param n the value to multiply - * @return a new vector - */ - public Vector multiply(float n) { - return new Vector(this.x * n, this.y * n, this.z * n); - } - - /** - * Perform scalar multiplication and return a new vector. - * - * @param n the value to multiply - * @return a new vector - */ - public Vector multiply(int n) { - return new Vector(this.x * n, this.y * n, this.z * n); - } - - /** - * Divide this vector by another vector on each component. - * - * @param other the other vector - * @return a new vector - */ - public Vector divide(Vector other) { - return new Vector(x / other.x, y / other.y, z / other.z); - } - - /** - * Divide this vector by another vector on each component. - * - * @param x the value to divide by - * @param y the value to divide by - * @param z the value to divide by - * @return a new vector - */ - public Vector divide(double x, double y, double z) { - return new Vector(this.x / x, this.y / y, this.z / z); - } - - /** - * Divide this vector by another vector on each component. - * - * @param x the value to divide by - * @param y the value to divide by - * @param z the value to divide by - * @return a new vector - */ - public Vector divide(int x, int y, int z) { - return new Vector(this.x / x, this.y / y, this.z / z); - } - - /** - * Perform scalar division and return a new vector. - * - * @param n the value to divide by - * @return a new vector - */ - public Vector divide(int n) { - return new Vector(x / n, y / n, z / n); - } - - /** - * Perform scalar division and return a new vector. - * - * @param n the value to divide by - * @return a new vector - */ - public Vector divide(double n) { - return new Vector(x / n, y / n, z / n); - } - - /** - * Perform scalar division and return a new vector. - * - * @param n the value to divide by - * @return a new vector - */ - public Vector divide(float n) { - return new Vector(x / n, y / n, z / n); - } - - /** - * Get the length of the vector. - * - * @return length - */ - public double length() { - return Math.sqrt(x * x + y * y + z * z); - } - - /** - * Get the length, squared, of the vector. - * - * @return length, squared - */ - public double lengthSq() { - return x * x + y * y + z * z; - } - - /** - * Get the distance between this vector and another vector. - * - * @param other the other vector - * @return distance - */ - public double distance(Vector other) { - return Math.sqrt(Math.pow(other.x - x, 2) + - Math.pow(other.y - y, 2) + - Math.pow(other.z - z, 2)); - } - - /** - * Get the distance between this vector and another vector, squared. - * - * @param other the other vector - * @return distance - */ - public double distanceSq(Vector other) { - return Math.pow(other.x - x, 2) + - Math.pow(other.y - y, 2) + - Math.pow(other.z - z, 2); - } - - /** - * Get the normalized vector, which is the vector divided by its - * length, as a new vector. - * - * @return a new vector - */ - public Vector normalize() { - return divide(length()); - } - - /** - * Gets the dot product of this and another vector. - * - * @param other the other vector - * @return the dot product of this and the other vector - */ - public double dot(Vector other) { - return x * other.x + y * other.y + z * other.z; - } - - /** - * Gets the cross product of this and another vector. - * - * @param other the other vector - * @return the cross product of this and the other vector - */ - public Vector cross(Vector other) { - return new Vector( - y * other.z - z * other.y, - z * other.x - x * other.z, - x * other.y - y * other.x - ); - } - - /** - * Checks to see if a vector is contained with another. - * - * @param min the minimum point (X, Y, and Z are the lowest) - * @param max the maximum point (X, Y, and Z are the lowest) - * @return true if the vector is contained - */ - public boolean containedWithin(Vector min, Vector max) { - return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; - } - - /** - * Checks to see if a vector is contained with another, comparing - * using discrete comparisons, inclusively. - * - * @param min the minimum point (X, Y, and Z are the lowest) - * @param max the maximum point (X, Y, and Z are the lowest) - * @return true if the vector is contained - */ - public boolean containedWithinBlock(Vector min, Vector max) { - return getBlockX() >= min.getBlockX() && getBlockX() <= max.getBlockX() - && getBlockY() >= min.getBlockY() && getBlockY() <= max.getBlockY() - && getBlockZ() >= min.getBlockZ() && getBlockZ() <= max.getBlockZ(); - } - - /** - * Clamp the Y component. - * - * @param min the minimum value - * @param max the maximum value - * @return a new vector - */ - public Vector clampY(int min, int max) { - return new Vector(x, Math.max(min, Math.min(max, y)), z); - } - - /** - * Floors the values of all components. - * - * @return a new vector - */ - public Vector floor() { - return new Vector(Math.floor(x), Math.floor(y), Math.floor(z)); - } - - /** - * Rounds all components up. - * - * @return a new vector - */ - public Vector ceil() { - return new Vector(Math.ceil(x), Math.ceil(y), Math.ceil(z)); - } - - /** - * Rounds all components to the closest integer. - * - *

Components < 0.5 are rounded down, otherwise up.

- * - * @return a new vector - */ - public Vector round() { - return new Vector(Math.floor(x + 0.5), Math.floor(y + 0.5), Math.floor(z + 0.5)); - } - - /** - * Returns a vector with the absolute values of the components of - * this vector. - * - * @return a new vector - */ - public Vector positive() { - return new Vector(Math.abs(x), Math.abs(y), Math.abs(z)); - } - - /** - * Perform a 2D transformation on this vector and return a new one. - * - * @param angle in degrees - * @param aboutX about which x coordinate to rotate - * @param aboutZ about which z coordinate to rotate - * @param translateX what to add after rotation - * @param translateZ what to add after rotation - * @return a new vector - * @see AffineTransform another method to transform vectors - */ - public Vector transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { - angle = Math.toRadians(angle); - double x = this.x - aboutX; - double z = this.z - aboutZ; - double x2 = x * Math.cos(angle) - z * Math.sin(angle); - double z2 = x * Math.sin(angle) + z * Math.cos(angle); - - return new Vector( - x2 + aboutX + translateX, - y, - z2 + aboutZ + translateZ - ); - } - - /** - * Returns whether this vector is collinear with another vector. - * - * @param other the other vector - * @return true if collinear - */ - public boolean isCollinearWith(Vector other) { - if (x == 0 && y == 0 && z == 0) { - // this is a zero vector - return true; - } - - final double otherX = other.x; - final double otherY = other.y; - final double otherZ = other.z; - - if (otherX == 0 && otherY == 0 && otherZ == 0) { - // other is a zero vector - return true; - } - - if ((x == 0) != (otherX == 0)) return false; - if ((y == 0) != (otherY == 0)) return false; - if ((z == 0) != (otherZ == 0)) return false; - - final double quotientX = otherX / x; - if (!Double.isNaN(quotientX)) { - return other.equals(multiply(quotientX)); - } - - final double quotientY = otherY / y; - if (!Double.isNaN(quotientY)) { - return other.equals(multiply(quotientY)); - } - - final double quotientZ = otherZ / z; - if (!Double.isNaN(quotientZ)) { - return other.equals(multiply(quotientZ)); - } - - throw new RuntimeException("This should not happen"); - } - - /** - * Get this vector's pitch as used within the game. - * - * @return pitch in radians - */ - public float toPitch() { - double x = getX(); - double z = getZ(); - - if (x == 0 && z == 0) { - return getY() > 0 ? -90 : 90; - } else { - double x2 = x * x; - double z2 = z * z; - double xz = Math.sqrt(x2 + z2); - return (float) Math.toDegrees(Math.atan(-getY() / xz)); - } - } - - /** - * Get this vector's yaw as used within the game. - * - * @return yaw in radians - */ - public float toYaw() { - double x = getX(); - double z = getZ(); - - double t = Math.atan2(-x, z); - double _2pi = 2 * Math.PI; - - return (float) Math.toDegrees(((t + _2pi) % _2pi)); - } - - /** - * Create a new {@code BlockVector} using the given components. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - * @return a new {@code BlockVector} - */ - public static BlockVector toBlockPoint(double x, double y, double z) { - return new BlockVector( - Math.floor(x), - Math.floor(y), - Math.floor(z) - ); - } - - /** - * Create a new {@code BlockVector} from this vector. - * - * @return a new {@code BlockVector} - */ - public BlockVector toBlockPoint() { - return new BlockVector( - Math.floor(x), - Math.floor(y), - Math.floor(z) - ); - } - - /** - * Create a new {@code BlockVector} from this vector. - * - * @return a new {@code BlockVector} - */ - public BlockVector toBlockVector() { - return toBlockPoint(); -// return new BlockVector(this); TODO Look into this further. - } - - /** - * Creates a 2D vector by dropping the Y component from this vector. - * - * @return a new {@code Vector2D} - */ - public Vector2D toVector2D() { - return new Vector2D(x, z); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Vector)) { - return false; - } - - Vector other = (Vector) obj; - return other.x == this.x && other.y == this.y && other.z == this.z; - } - - @Override - public int compareTo(@Nullable Vector other) { - if (other == null) { - throw new IllegalArgumentException("null not supported"); - } - if (y != other.y) return Double.compare(y, other.y); - if (z != other.z) return Double.compare(z, other.z); - if (x != other.x) return Double.compare(x, other.x); - return 0; - } - - @Override - public int hashCode() { - return ((int) x ^ ((int) z << 12)) ^ ((int) y << 24); - } - - @Override - public String toString() { - return "(" + x + ", " + y + ", " + z + ")"; - } - - /** - * Gets the minimum components of two vectors. - * - * @param v1 the first vector - * @param v2 the second vector - * @return minimum - */ - public static Vector getMinimum(Vector v1, Vector v2) { - return new Vector( - Math.min(v1.x, v2.x), - Math.min(v1.y, v2.y), - Math.min(v1.z, v2.z) - ); - } - - /** - * Gets the maximum components of two vectors. - * - * @param v1 the first vector - * @param v2 the second vector - * @return maximum - */ - public static Vector getMaximum(Vector v1, Vector v2) { - return new Vector( - Math.max(v1.x, v2.x), - Math.max(v1.y, v2.y), - Math.max(v1.z, v2.z) - ); - } - - /** - * Gets the midpoint of two vectors. - * - * @param v1 the first vector - * @param v2 the second vector - * @return maximum - */ - public static Vector getMidpoint(Vector v1, Vector v2) { - return new Vector( - (v1.x + v2.x) / 2, - (v1.y + v2.y) / 2, - (v1.z + v2.z) / 2 - ); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java deleted file mode 100644 index c4ecc15f7..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java +++ /dev/null @@ -1,691 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.google.common.collect.ComparisonChain; -import com.sk89q.worldedit.math.transform.AffineTransform; - -import java.util.Comparator; - -/** - * An immutable 2-dimensional vector. - */ -public class Vector2D { - - /** - * A comparator for Vector2Ds that orders the vectors by rows, with x as the - * column and z as the row. - * - * For example, if x is the horizontal axis and z is the vertical axis, it - * sorts like so: - * - *
-     * 0123
-     * 4567
-     * 90ab
-     * cdef
-     * 
- */ - public static final Comparator COMPARING_GRID_ARRANGEMENT = (a, b) -> { - return ComparisonChain.start() - .compare(a.getBlockZ(), b.getBlockZ()) - .compare(a.getBlockX(), b.getBlockX()) - .result(); - }; - - public static final Vector2D ZERO = new Vector2D(0, 0); - public static final Vector2D UNIT_X = new Vector2D(1, 0); - public static final Vector2D UNIT_Z = new Vector2D(0, 1); - public static final Vector2D ONE = new Vector2D(1, 1); - - protected final double x, z; - - /** - * Construct an instance. - * - * @param x the X coordinate - * @param z the Z coordinate - */ - public Vector2D(double x, double z) { - this.x = x; - this.z = z; - } - - /** - * Construct an instance. - * - * @param x the X coordinate - * @param z the Z coordinate - */ - public Vector2D(int x, int z) { - this.x = (double) x; - this.z = (double) z; - } - - /** - * Construct an instance. - * - * @param x the X coordinate - * @param z the Z coordinate - */ - public Vector2D(float x, float z) { - this.x = (double) x; - this.z = (double) z; - } - - /** - * Copy another vector. - * - * @param other the other vector - */ - public Vector2D(Vector2D other) { - this.x = other.x; - this.z = other.z; - } - - /** - * Construct a new instance with X and Z coordinates set to 0. - * - *

One can also refer to a static {@link #ZERO}.

- */ - public Vector2D() { - this.x = 0; - this.z = 0; - } - - /** - * Get the X coordinate. - * - * @return the x coordinate - */ - public double getX() { - return x; - } - - /** - * Get the X coordinate rounded. - * - * @return the x coordinate - */ - public int getBlockX() { - return (int) Math.round(x); - } - - /** - * Set the X coordinate. - * - * @param x the new X - * @return a new vector - */ - public Vector2D setX(double x) { - return new Vector2D(x, z); - } - - /** - * Set the X coordinate. - * - * @param x the new X - * @return a new vector - */ - public Vector2D setX(int x) { - return new Vector2D(x, z); - } - - /** - * Get the Z coordinate. - * - * @return the z coordinate - */ - public double getZ() { - return z; - } - - /** - * Get the Z coordinate rounded. - * - * @return the z coordinate - */ - public int getBlockZ() { - return (int) Math.round(z); - } - - /** - * Set the Z coordinate. - * - * @param z the new Z - * @return a new vector - */ - public Vector2D setZ(double z) { - return new Vector2D(x, z); - } - - /** - * Set the Z coordinate. - * - * @param z the new Z - * @return a new vector - */ - public Vector2D setZ(int z) { - return new Vector2D(x, z); - } - - /** - * Add another vector to this vector and return the result as a new vector. - * - * @param other the other vector - * @return a new vector - */ - public Vector2D add(Vector2D other) { - return new Vector2D(x + other.x, z + other.z); - } - - /** - * Add another vector to this vector and return the result as a new vector. - * - * @param x the value to add - * @param z the value to add - * @return a new vector - */ - public Vector2D add(double x, double z) { - return new Vector2D(this.x + x, this.z + z); - } - - /** - * Add another vector to this vector and return the result as a new vector. - * - * @param x the value to add - * @param z the value to add - * @return a new vector - */ - public Vector2D add(int x, int z) { - return new Vector2D(this.x + x, this.z + z); - } - - /** - * Add a list of vectors to this vector and return the - * result as a new vector. - * - * @param others an array of vectors - * @return a new vector - */ - public Vector2D add(Vector2D... others) { - double newX = x, newZ = z; - - for (Vector2D other : others) { - newX += other.x; - newZ += other.z; - } - - return new Vector2D(newX, newZ); - } - - /** - * Subtract another vector from this vector and return the result - * as a new vector. - * - * @param other the other vector - * @return a new vector - */ - public Vector2D subtract(Vector2D other) { - return new Vector2D(x - other.x, z - other.z); - } - - /** - * Subtract another vector from this vector and return the result - * as a new vector. - * - * @param x the value to subtract - * @param z the value to subtract - * @return a new vector - */ - public Vector2D subtract(double x, double z) { - return new Vector2D(this.x - x, this.z - z); - } - - /** - * Subtract another vector from this vector and return the result - * as a new vector. - * - * @param x the value to subtract - * @param z the value to subtract - * @return a new vector - */ - public Vector2D subtract(int x, int z) { - return new Vector2D(this.x - x, this.z - z); - } - - /** - * Subtract a list of vectors from this vector and return the result - * as a new vector. - * - * @param others an array of vectors - * @return a new vector - */ - public Vector2D subtract(Vector2D... others) { - double newX = x, newZ = z; - - for (Vector2D other : others) { - newX -= other.x; - newZ -= other.z; - } - - return new Vector2D(newX, newZ); - } - - /** - * Multiply this vector by another vector on each component. - * - * @param other the other vector - * @return a new vector - */ - public Vector2D multiply(Vector2D other) { - return new Vector2D(x * other.x, z * other.z); - } - - /** - * Multiply this vector by another vector on each component. - * - * @param x the value to multiply - * @param z the value to multiply - * @return a new vector - */ - public Vector2D multiply(double x, double z) { - return new Vector2D(this.x * x, this.z * z); - } - - /** - * Multiply this vector by another vector on each component. - * - * @param x the value to multiply - * @param z the value to multiply - * @return a new vector - */ - public Vector2D multiply(int x, int z) { - return new Vector2D(this.x * x, this.z * z); - } - - /** - * Multiply this vector by zero or more vectors on each component. - * - * @param others an array of vectors - * @return a new vector - */ - public Vector2D multiply(Vector2D... others) { - double newX = x, newZ = z; - - for (Vector2D other : others) { - newX *= other.x; - newZ *= other.z; - } - - return new Vector2D(newX, newZ); - } - - /** - * Perform scalar multiplication and return a new vector. - * - * @param n the value to multiply - * @return a new vector - */ - public Vector2D multiply(double n) { - return new Vector2D(this.x * n, this.z * n); - } - - /** - * Perform scalar multiplication and return a new vector. - * - * @param n the value to multiply - * @return a new vector - */ - public Vector2D multiply(float n) { - return new Vector2D(this.x * n, this.z * n); - } - - /** - * Perform scalar multiplication and return a new vector. - * - * @param n the value to multiply - * @return a new vector - */ - public Vector2D multiply(int n) { - return new Vector2D(this.x * n, this.z * n); - } - - /** - * Divide this vector by another vector on each component. - * - * @param other the other vector - * @return a new vector - */ - public Vector2D divide(Vector2D other) { - return new Vector2D(x / other.x, z / other.z); - } - - /** - * Divide this vector by another vector on each component. - * - * @param x the value to divide by - * @param z the value to divide by - * @return a new vector - */ - public Vector2D divide(double x, double z) { - return new Vector2D(this.x / x, this.z / z); - } - - /** - * Divide this vector by another vector on each component. - * - * @param x the value to divide by - * @param z the value to divide by - * @return a new vector - */ - public Vector2D divide(int x, int z) { - return new Vector2D(this.x / x, this.z / z); - } - - /** - * Perform scalar division and return a new vector. - * - * @param n the value to divide by - * @return a new vector - */ - public Vector2D divide(int n) { - return new Vector2D(x / n, z / n); - } - - /** - * Perform scalar division and return a new vector. - * - * @param n the value to divide by - * @return a new vector - */ - public Vector2D divide(double n) { - return new Vector2D(x / n, z / n); - } - - /** - * Perform scalar division and return a new vector. - * - * @param n the value to divide by - * @return a new vector - */ - public Vector2D divide(float n) { - return new Vector2D(x / n, z / n); - } - - /** - * Get the length of the vector. - * - * @return length - */ - public double length() { - return Math.sqrt(x * x + z * z); - } - - /** - * Get the length, squared, of the vector. - * - * @return length, squared - */ - public double lengthSq() { - return x * x + z * z; - } - - /** - * Get the distance between this vector and another vector. - * - * @param other the other vector - * @return distance - */ - public double distance(Vector2D other) { - return Math.sqrt(Math.pow(other.x - x, 2) + Math.pow(other.z - z, 2)); - } - - /** - * Get the distance between this vector and another vector, squared. - * - * @param other the other vector - * @return distance - */ - public double distanceSq(Vector2D other) { - return Math.pow(other.x - x, 2) + - Math.pow(other.z - z, 2); - } - - /** - * Get the normalized vector, which is the vector divided by its - * length, as a new vector. - * - * @return a new vector - */ - public Vector2D normalize() { - return divide(length()); - } - - /** - * Gets the dot product of this and another vector. - * - * @param other the other vector - * @return the dot product of this and the other vector - */ - public double dot(Vector2D other) { - return x * other.x + z * other.z; - } - - /** - * Checks to see if a vector is contained with another. - * - * @param min the minimum point (X, Y, and Z are the lowest) - * @param max the maximum point (X, Y, and Z are the lowest) - * @return true if the vector is contained - */ - public boolean containedWithin(Vector2D min, Vector2D max) { - return x >= min.x && x <= max.x - && z >= min.z && z <= max.z; - } - - /** - * Checks to see if a vector is contained with another. - * - * @param min the minimum point (X, Y, and Z are the lowest) - * @param max the maximum point (X, Y, and Z are the lowest) - * @return true if the vector is contained - */ - public boolean containedWithinBlock(Vector2D min, Vector2D max) { - return getBlockX() >= min.getBlockX() && getBlockX() <= max.getBlockX() - && getBlockZ() >= min.getBlockZ() && getBlockZ() <= max.getBlockZ(); - } - - /** - * Floors the values of all components. - * - * @return a new vector - */ - public Vector2D floor() { - return new Vector2D(Math.floor(x), Math.floor(z)); - } - - /** - * Rounds all components up. - * - * @return a new vector - */ - public Vector2D ceil() { - return new Vector2D(Math.ceil(x), Math.ceil(z)); - } - - /** - * Rounds all components to the closest integer. - * - *

Components < 0.5 are rounded down, otherwise up.

- * - * @return a new vector - */ - public Vector2D round() { - return new Vector2D(Math.floor(x + 0.5), Math.floor(z + 0.5)); - } - - /** - * Returns a vector with the absolute values of the components of - * this vector. - * - * @return a new vector - */ - public Vector2D positive() { - return new Vector2D(Math.abs(x), Math.abs(z)); - } - - /** - * Perform a 2D transformation on this vector and return a new one. - * - * @param angle in degrees - * @param aboutX about which x coordinate to rotate - * @param aboutZ about which z coordinate to rotate - * @param translateX what to add after rotation - * @param translateZ what to add after rotation - * @return a new vector - * @see AffineTransform another method to transform vectors - */ - public Vector2D transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { - angle = Math.toRadians(angle); - double x = this.x - aboutX; - double z = this.z - aboutZ; - double x2 = x * Math.cos(angle) - z * Math.sin(angle); - double z2 = x * Math.sin(angle) + z * Math.cos(angle); - return new Vector2D( - x2 + aboutX + translateX, - z2 + aboutZ + translateZ - ); - } - - /** - * Returns whether this vector is collinear with another vector. - * - * @param other the other vector - * @return true if collinear - */ - public boolean isCollinearWith(Vector2D other) { - if (x == 0 && z == 0) { - // this is a zero vector - return true; - } - - final double otherX = other.x; - final double otherZ = other.z; - - if (otherX == 0 && otherZ == 0) { - // other is a zero vector - return true; - } - - if ((x == 0) != (otherX == 0)) return false; - if ((z == 0) != (otherZ == 0)) return false; - - final double quotientX = otherX / x; - if (!Double.isNaN(quotientX)) { - return other.equals(multiply(quotientX)); - } - - final double quotientZ = otherZ / z; - if (!Double.isNaN(quotientZ)) { - return other.equals(multiply(quotientZ)); - } - - throw new RuntimeException("This should not happen"); - } - - /** - * Create a new {@code BlockVector2D} from this vector. - * - * @return a new {@code BlockVector2D} - */ - public BlockVector2D toBlockVector2D() { - return new BlockVector2D(this); - } - - /** - * Creates a 3D vector by adding a zero Y component to this vector. - * - * @return a new vector - */ - public Vector toVector() { - return new Vector(x, 0, z); - } - - /** - * Creates a 3D vector by adding the specified Y component to this vector. - * - * @param y the Y component - * @return a new vector - */ - public Vector toVector(double y) { - return new Vector(x, y, z); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Vector2D)) { - return false; - } - - Vector2D other = (Vector2D) obj; - return other.x == this.x && other.z == this.z; - - } - - @Override - public int hashCode() { - return ((int) x << 16) ^ (int) z; - } - - @Override - public String toString() { - return "(" + x + ", " + z + ")"; - } - - /** - * Gets the minimum components of two vectors. - * - * @param v1 the first vector - * @param v2 the second vector - * @return minimum - */ - public static Vector2D getMinimum(Vector2D v1, Vector2D v2) { - return new Vector2D( - Math.min(v1.x, v2.x), - Math.min(v1.z, v2.z) - ); - } - - /** - * Gets the maximum components of two vectors. - * - * @param v1 the first vector - * @param v2 the second vector - * @return maximum - */ - public static Vector2D getMaximum(Vector2D v1, Vector2D v2) { - return new Vector2D( - Math.max(v1.x, v2.x), - Math.max(v1.z, v2.z) - ); - } - -} 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 cc2f9a440..2f9232062 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -40,6 +40,7 @@ import com.sk89q.worldedit.extension.platform.PlatformManager; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.scripting.CraftScriptContext; import com.sk89q.worldedit.scripting.CraftScriptEngine; import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; @@ -370,7 +371,7 @@ public class WorldEdit { * @return a direction vector * @throws UnknownDirectionException thrown if the direction is not known */ - public Vector getDirection(Player player, String dirStr) throws UnknownDirectionException { + public BlockVector3 getDirection(Player player, String dirStr) throws UnknownDirectionException { dirStr = dirStr.toLowerCase(); final PlayerDirection dir = getPlayerDirection(player, dirStr); @@ -382,7 +383,7 @@ public class WorldEdit { case NORTH: case UP: case DOWN: - return dir.vector(); + return dir.vector().toBlockPoint(); default: throw new UnknownDirectionException(dir.name()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java index 70deb8133..8d94ae739 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java @@ -28,8 +28,6 @@ import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; @@ -41,6 +39,8 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask2D; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.visitor.FlatRegionVisitor; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.FlatRegion; import com.sk89q.worldedit.regions.Region; @@ -139,12 +139,12 @@ public class BiomeCommands { return; } - BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toVector2D()); + BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2()); biomes.add(biome); qualifier = "at line of sight point"; } else if (args.hasFlag('p')) { - BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toVector2D()); + BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2()); biomes.add(biome); qualifier = "at your position"; @@ -153,12 +153,12 @@ public class BiomeCommands { Region region = session.getSelection(world); if (region instanceof FlatRegion) { - for (Vector2D pt : ((FlatRegion) region).asFlatRegion()) { + for (BlockVector2 pt : ((FlatRegion) region).asFlatRegion()) { biomes.add(world.getBiome(pt)); } } else { - for (Vector pt : region) { - biomes.add(world.getBiome(pt.toVector2D())); + for (BlockVector3 pt : region) { + biomes.add(world.getBiome(pt.toBlockVector2())); } } @@ -195,7 +195,7 @@ public class BiomeCommands { Mask2D mask2d = mask != null ? mask.toMask2D() : null; if (atPosition) { - region = new CuboidRegion(player.getLocation().toVector(), player.getLocation().toVector()); + region = new CuboidRegion(player.getLocation().toVector().toBlockPoint(), player.getLocation().toVector().toBlockPoint()); } else { region = session.getSelection(world); } 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 126653046..2ce7a07ea 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 @@ -27,7 +27,6 @@ import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.tool.BrushTool; @@ -45,6 +44,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.command.binding.Switch; @@ -143,7 +143,7 @@ public class BrushCommands { ClipboardHolder holder = session.getClipboard(); Clipboard clipboard = holder.getClipboard(); - Vector size = clipboard.getDimensions(); + BlockVector3 size = clipboard.getDimensions(); worldEdit.checkMaxBrushRadius(size.getBlockX()); worldEdit.checkMaxBrushRadius(size.getBlockY()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java index ae96027b0..d213184f3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java @@ -29,10 +29,10 @@ import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.MathUtils; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.storage.LegacyChunkStore; @@ -76,7 +76,7 @@ public class ChunkCommands { player.print("Chunk: " + chunkX + ", " + chunkZ); player.print("Old format: " + folder1 + "/" + folder2 + "/" + filename); player.print("McRegion: region/" + McRegionChunkStore.getFilename( - new Vector2D(chunkX, chunkZ))); + new BlockVector2(chunkX, chunkZ))); } @Command( @@ -88,9 +88,9 @@ public class ChunkCommands { ) @CommandPermissions("worldedit.listchunks") public void listChunks(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - Set chunks = session.getSelection(player.getWorld()).getChunks(); + Set chunks = session.getSelection(player.getWorld()).getChunks(); - for (Vector2D chunk : chunks) { + for (BlockVector2 chunk : chunks) { player.print(LegacyChunkStore.getFilename(chunk)); } } @@ -108,7 +108,7 @@ public class ChunkCommands { player.print("Note that this command does not yet support the mcregion format."); LocalConfiguration config = worldEdit.getConfiguration(); - Set chunks = session.getSelection(player.getWorld()).getChunks(); + Set chunks = session.getSelection(player.getWorld()).getChunks(); FileOutputStream out = null; if (config.shellSaveType == null) { @@ -125,7 +125,7 @@ public class ChunkCommands { writer.write("ECHO.\r\n"); writer.write("PAUSE\r\n"); - for (Vector2D chunk : chunks) { + for (BlockVector2 chunk : chunks) { String filename = LegacyChunkStore.getFilename(chunk); writer.write("ECHO " + filename + "\r\n"); writer.write("DEL \"world/" + filename + "\"\r\n"); @@ -156,7 +156,7 @@ public class ChunkCommands { writer.write("echo\n"); writer.write("read -p \"Press any key to continue...\"\n"); - for (Vector2D chunk : chunks) { + for (BlockVector2 chunk : chunks) { String filename = LegacyChunkStore.getFilename(chunk); writer.write("echo " + filename + "\n"); writer.write("rm \"world/" + filename + "\"\n"); 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 181f648d7..51c8c3602 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 @@ -28,7 +28,6 @@ import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; @@ -42,6 +41,8 @@ import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.Selection; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; @@ -154,7 +155,7 @@ public class ClipboardCommands { Clipboard clipboard = holder.getClipboard(); Region region = clipboard.getRegion(); - Vector to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player); + BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player); Operation operation = holder .createPaste(editSession) .to(to) @@ -163,10 +164,10 @@ public class ClipboardCommands { Operations.completeLegacy(operation); if (selectPasted) { - Vector clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); - Vector realTo = to.add(holder.getTransform().apply(clipboardOffset)); - Vector max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()))); - RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max); + BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); + Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3())); + Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3())); + RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo.toBlockPoint(), max.toBlockPoint()); session.setRegionSelector(player.getWorld(), selector); selector.learnChanges(); selector.explainRegionAdjust(player, session); @@ -211,11 +212,10 @@ public class ClipboardCommands { ) @CommandPermissions("worldedit.clipboard.flip") public void flip(Player player, LocalSession session, EditSession editSession, - @Optional(Direction.AIM) @Direction Vector direction) throws WorldEditException { + @Optional(Direction.AIM) @Direction BlockVector3 direction) throws WorldEditException { ClipboardHolder holder = session.getClipboard(); - Clipboard clipboard = holder.getClipboard(); AffineTransform transform = new AffineTransform(); - transform = transform.scale(direction.positive().multiply(-2).add(1, 1, 1)); + transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3()); holder.setTransform(holder.getTransform().combine(transform)); player.print("The clipboard copy has been flipped."); } 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 b15d444d9..204f062ec 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 @@ -21,12 +21,12 @@ package com.sk89q.worldedit.command; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.transform.BlockTransformExtent; import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.CombinedTransform; import com.sk89q.worldedit.math.transform.Transform; @@ -66,8 +66,8 @@ class FlattenedClipboardTransform { */ public Region getTransformedRegion() { Region region = original.getRegion(); - Vector minimum = region.getMinimumPoint(); - Vector maximum = region.getMaximumPoint(); + Vector3 minimum = region.getMinimumPoint().toVector3(); + Vector3 maximum = region.getMaximumPoint().toVector3(); Transform transformAround = new CombinedTransform( @@ -75,39 +75,34 @@ class FlattenedClipboardTransform { transform, new AffineTransform().translate(original.getOrigin())); - Vector[] corners = new Vector[] { + Vector3[] corners = new Vector3[] { minimum, maximum, - minimum.setX(maximum.getX()), - minimum.setY(maximum.getY()), - minimum.setZ(maximum.getZ()), - maximum.setX(minimum.getX()), - maximum.setY(minimum.getY()), - maximum.setZ(minimum.getZ()) }; + minimum.withX(maximum.getX()), + minimum.withY(maximum.getY()), + minimum.withZ(maximum.getZ()), + maximum.withX(minimum.getX()), + maximum.withY(minimum.getY()), + maximum.withZ(minimum.getZ()) }; for (int i = 0; i < corners.length; i++) { corners[i] = transformAround.apply(corners[i]); } - Vector newMinimum = corners[0]; - Vector newMaximum = corners[0]; + Vector3 newMinimum = corners[0]; + Vector3 newMaximum = corners[0]; for (int i = 1; i < corners.length; i++) { - newMinimum = Vector.getMinimum(newMinimum, corners[i]); - newMaximum = Vector.getMaximum(newMaximum, corners[i]); + newMinimum = newMinimum.getMinimum(corners[i]); + newMaximum = newMaximum.getMaximum(corners[i]); } // After transformation, the points may not really sit on a block, // so we should expand the region for edge cases - newMinimum = newMinimum.setX(Math.floor(newMinimum.getX())); - newMinimum = newMinimum.setY(Math.floor(newMinimum.getY())); - newMinimum = newMinimum.setZ(Math.floor(newMinimum.getZ())); + newMinimum = newMinimum.floor(); + newMaximum = newMaximum.ceil(); - newMaximum = newMaximum.setX(Math.ceil(newMaximum.getX())); - newMaximum = newMaximum.setY(Math.ceil(newMaximum.getY())); - newMaximum = newMaximum.setZ(Math.ceil(newMaximum.getZ())); - - return new CuboidRegion(newMinimum, newMaximum); + return new CuboidRegion(newMinimum.toBlockPoint(), newMaximum.toBlockPoint()); } /** 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 381de7a8a..5e0a6139c 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 @@ -29,13 +29,14 @@ import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.expression.ExpressionException; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.util.command.binding.Range; @@ -116,7 +117,7 @@ public class GenerationCommands { worldEdit.checkMaxRadius(radiusZ); worldEdit.checkMaxRadius(height); - Vector pos = session.getPlacementPosition(player); + BlockVector3 pos = session.getPlacementPosition(player); int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow); player.print(affected + " block(s) have been created."); } @@ -177,9 +178,9 @@ public class GenerationCommands { worldEdit.checkMaxRadius(radiusY); worldEdit.checkMaxRadius(radiusZ); - Vector pos = session.getPlacementPosition(player); + BlockVector3 pos = session.getPlacementPosition(player); if (raised) { - pos = pos.add(0, radiusY, 0); + pos = pos.add(0, (int) radiusY, 0); } int affected = editSession.makeSphere(pos, pattern, radiusX, radiusY, radiusZ, !hollow); @@ -240,7 +241,7 @@ public class GenerationCommands { @CommandPermissions("worldedit.generation.pyramid") @Logging(PLACEMENT) public void pyramid(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow) throws WorldEditException { - Vector pos = session.getPlacementPosition(player); + BlockVector3 pos = session.getPlacementPosition(player); worldEdit.checkMaxRadius(size); int affected = editSession.makePyramid(pos, pattern, size, !hollow); player.findFreePosition(); @@ -277,31 +278,31 @@ public class GenerationCommands { @Switch('o') boolean offset, @Switch('c') boolean offsetCenter) throws WorldEditException { - final Vector zero; - Vector unit; + final Vector3 zero; + Vector3 unit; if (useRawCoords) { - zero = Vector.ZERO; - unit = Vector.ONE; + zero = Vector3.ZERO; + unit = Vector3.ONE; } else if (offset) { - zero = session.getPlacementPosition(player); - unit = Vector.ONE; + zero = session.getPlacementPosition(player).toVector3(); + unit = Vector3.ONE; } else if (offsetCenter) { - final Vector min = region.getMinimumPoint(); - final Vector max = region.getMaximumPoint(); + final Vector3 min = region.getMinimumPoint().toVector3(); + final Vector3 max = region.getMaximumPoint().toVector3(); zero = max.add(min).multiply(0.5); - unit = Vector.ONE; + unit = Vector3.ONE; } else { - final Vector min = region.getMinimumPoint(); - final Vector max = region.getMaximumPoint(); + final Vector3 min = region.getMinimumPoint().toVector3(); + final Vector3 max = region.getMaximumPoint().toVector3(); zero = max.add(min).multiply(0.5); unit = max.subtract(zero); - if (unit.getX() == 0) unit = unit.setX(1.0); - if (unit.getY() == 0) unit = unit.setY(1.0); - if (unit.getZ() == 0) unit = unit.setZ(1.0); + if (unit.getX() == 0) unit = unit.withX(1.0); + if (unit.getY() == 0) unit = unit.withY(1.0); + if (unit.getZ() == 0) unit = unit.withZ(1.0); } try { @@ -342,31 +343,31 @@ public class GenerationCommands { @Switch('r') boolean useRawCoords, @Switch('o') boolean offset, @Switch('c') boolean offsetCenter) throws WorldEditException { - final Vector zero; - Vector unit; + final Vector3 zero; + Vector3 unit; if (useRawCoords) { - zero = Vector.ZERO; - unit = Vector.ONE; + zero = Vector3.ZERO; + unit = Vector3.ONE; } else if (offset) { - zero = session.getPlacementPosition(player); - unit = Vector.ONE; + zero = session.getPlacementPosition(player).toVector3(); + unit = Vector3.ONE; } else if (offsetCenter) { - final Vector min = region.getMinimumPoint(); - final Vector max = region.getMaximumPoint(); + final Vector3 min = region.getMinimumPoint().toVector3(); + final Vector3 max = region.getMaximumPoint().toVector3(); zero = max.add(min).multiply(0.5); - unit = Vector.ONE; + unit = Vector3.ONE; } else { - final Vector min = region.getMinimumPoint(); - final Vector max = region.getMaximumPoint(); + final Vector3 min = region.getMinimumPoint().toVector3(); + final Vector3 max = region.getMaximumPoint().toVector3(); zero = max.add(min).multiply(0.5); unit = max.subtract(zero); - if (unit.getX() == 0) unit = unit.setX(1.0); - if (unit.getY() == 0) unit = unit.setY(1.0); - if (unit.getZ() == 0) unit = unit.setZ(1.0); + if (unit.getX() == 0) unit = unit.withX(1.0); + if (unit.getY() == 0) unit = unit.withY(1.0); + if (unit.getZ() == 0) unit = unit.withZ(1.0); } try { 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 3b7efa781..9eb113c09 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 @@ -32,7 +32,6 @@ import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; @@ -48,6 +47,8 @@ import com.sk89q.worldedit.function.visitor.LayerVisitor; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.expression.ExpressionException; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.convolution.GaussianKernel; import com.sk89q.worldedit.math.convolution.HeightMap; import com.sk89q.worldedit.math.convolution.HeightMapFilter; @@ -110,8 +111,8 @@ public class RegionCommands { } CuboidRegion cuboidregion = (CuboidRegion) region; - Vector pos1 = cuboidregion.getPos1(); - Vector pos2 = cuboidregion.getPos2(); + BlockVector3 pos1 = cuboidregion.getPos1(); + BlockVector3 pos2 = cuboidregion.getPos2(); int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell); player.print(blocksChanged + " block(s) have been changed."); @@ -143,7 +144,7 @@ public class RegionCommands { } ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region; - List vectors = new ArrayList<>(cpregion.getVertices()); + List vectors = new ArrayList<>(cpregion.getVertices()); int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell); @@ -274,7 +275,7 @@ public class RegionCommands { public void move(Player player, EditSession editSession, LocalSession session, @Selection Region region, @Optional("1") @Range(min = 1) int count, - @Optional(Direction.AIM) @Direction Vector direction, + @Optional(Direction.AIM) @Direction BlockVector3 direction, @Optional("air") BlockStateHolder replace, @Switch('s') boolean moveSelection) throws WorldEditException { @@ -312,16 +313,16 @@ public class RegionCommands { public void stack(Player player, EditSession editSession, LocalSession session, @Selection Region region, @Optional("1") @Range(min = 1) int count, - @Optional(Direction.AIM) @Direction Vector direction, + @Optional(Direction.AIM) @Direction BlockVector3 direction, @Switch('s') boolean moveSelection, @Switch('a') boolean ignoreAirBlocks) throws WorldEditException { int affected = editSession.stackCuboidRegion(region, direction, count, !ignoreAirBlocks); if (moveSelection) { try { - final Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()); + final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()); - final Vector shiftVector = direction.multiply(count * (Math.abs(direction.dot(size)) + 1)); + final BlockVector3 shiftVector = direction.toVector3().multiply(count * (Math.abs(direction.dot(size)) + 1)).toBlockPoint(); region.shift(shiftVector); session.getRegionSelector(player.getWorld()).learnChanges(); @@ -378,25 +379,25 @@ public class RegionCommands { @Text String expression, @Switch('r') boolean useRawCoords, @Switch('o') boolean offset) throws WorldEditException { - final Vector zero; - Vector unit; + final Vector3 zero; + Vector3 unit; if (useRawCoords) { - zero = Vector.ZERO; - unit = Vector.ONE; + zero = Vector3.ZERO; + unit = Vector3.ONE; } else if (offset) { - zero = session.getPlacementPosition(player); - unit = Vector.ONE; + zero = session.getPlacementPosition(player).toVector3(); + unit = Vector3.ONE; } else { - final Vector min = region.getMinimumPoint(); - final Vector max = region.getMaximumPoint(); + final Vector3 min = region.getMinimumPoint().toVector3(); + final Vector3 max = region.getMaximumPoint().toVector3(); - zero = max.add(min).multiply(0.5); + zero = max.add(min).divide(2); unit = max.subtract(zero); - if (unit.getX() == 0) unit = unit.setX(1.0); - if (unit.getY() == 0) unit = unit.setY(1.0); - if (unit.getZ() == 0) unit = unit.setZ(1.0); + if (unit.getX() == 0) unit = unit.withX(1.0); + if (unit.getY() == 0) unit = unit.withY(1.0); + if (unit.getZ() == 0) unit = unit.withZ(1.0); } try { 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 5f4fca09c..d5c8aaa75 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 @@ -29,8 +29,6 @@ import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItemStack; @@ -38,6 +36,8 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; import com.sk89q.worldedit.regions.RegionSelector; @@ -58,7 +58,6 @@ import com.sk89q.worldedit.util.formatting.StyledFragment; import com.sk89q.worldedit.util.formatting.component.CommandListBox; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.storage.ChunkStore; @@ -103,13 +102,13 @@ public class SelectionCommands { pos = player.getBlockIn(); } - if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector(), ActorSelectorLimits.forActor(player))) { + if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) { player.printError("Position already set."); return; } session.getRegionSelector(player.getWorld()) - .explainPrimarySelection(player, session, pos.toVector()); + .explainPrimarySelection(player, session, pos.toVector().toBlockPoint()); } @Command( @@ -138,13 +137,13 @@ public class SelectionCommands { pos = player.getBlockIn(); } - if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector(), ActorSelectorLimits.forActor(player))) { + if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) { player.printError("Position already set."); return; } session.getRegionSelector(player.getWorld()) - .explainSecondarySelection(player, session, pos.toVector()); + .explainSecondarySelection(player, session, pos.toVector().toBlockPoint()); } @Command( @@ -160,13 +159,13 @@ public class SelectionCommands { Location pos = player.getBlockTrace(300); if (pos != null) { - if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector(), ActorSelectorLimits.forActor(player))) { + if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) { player.printError("Position already set."); return; } session.getRegionSelector(player.getWorld()) - .explainPrimarySelection(player, session, pos.toVector()); + .explainPrimarySelection(player, session, pos.toVector().toBlockPoint()); } else { player.printError("No block in sight!"); } @@ -185,13 +184,13 @@ public class SelectionCommands { Location pos = player.getBlockTrace(300); if (pos != null) { - if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector(), ActorSelectorLimits.forActor(player))) { + if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) { player.printError("Position already set."); return; } session.getRegionSelector(player.getWorld()) - .explainSecondarySelection(player, session, pos.toVector()); + .explainSecondarySelection(player, session, pos.toVector().toBlockPoint()); } else { player.printError("No block in sight!"); } @@ -216,23 +215,23 @@ public class SelectionCommands { @Logging(POSITION) @CommandPermissions("worldedit.selection.chunk") public void chunk(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - final Vector min; - final Vector max; + final BlockVector3 min; + final BlockVector3 max; final World world = player.getWorld(); if (args.hasFlag('s')) { Region region = session.getSelection(world); - final Vector2D min2D = ChunkStore.toChunk(region.getMinimumPoint()); - final Vector2D max2D = ChunkStore.toChunk(region.getMaximumPoint()); + final BlockVector2 min2D = ChunkStore.toChunk(region.getMinimumPoint()); + final BlockVector2 max2D = ChunkStore.toChunk(region.getMaximumPoint()); - min = new Vector(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); - max = new Vector(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15); + min = new BlockVector3(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); + max = new BlockVector3(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15); player.print("Chunks selected: (" + min2D.getBlockX() + ", " + min2D.getBlockZ() + ") - (" + max2D.getBlockX() + ", " + max2D.getBlockZ() + ")"); } else { - final Vector2D min2D; + final BlockVector2 min2D; if (args.argsLength() == 1) { // coords specified String[] coords = args.getString(0).split(","); @@ -241,14 +240,14 @@ public class SelectionCommands { } int x = Integer.parseInt(coords[0]); int z = Integer.parseInt(coords[1]); - Vector2D pos = new Vector2D(x, z); - min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toVector()); + BlockVector2 pos = new BlockVector2(x, z); + min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toBlockVector3()); } else { // use player loc - min2D = ChunkStore.toChunk(player.getBlockIn().toVector()); + min2D = ChunkStore.toChunk(player.getBlockIn().toVector().toBlockPoint()); } - min = new Vector(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); + min = new BlockVector3(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); max = min.add(15, world.getMaxY(), 15); player.print("Chunk selected: " @@ -321,8 +320,8 @@ public class SelectionCommands { try { int oldSize = region.getArea(); region.expand( - new Vector(0, (player.getWorld().getMaxY() + 1), 0), - new Vector(0, -(player.getWorld().getMaxY() + 1), 0)); + new BlockVector3(0, (player.getWorld().getMaxY() + 1), 0), + new BlockVector3(0, -(player.getWorld().getMaxY() + 1), 0)); session.getRegionSelector(player.getWorld()).learnChanges(); int newSize = region.getArea(); session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session); @@ -335,7 +334,7 @@ public class SelectionCommands { return; } - List dirs = new ArrayList<>(); + List dirs = new ArrayList<>(); int change = args.getInteger(0); int reverseChange = 0; @@ -380,11 +379,11 @@ public class SelectionCommands { int oldSize = region.getArea(); if (reverseChange == 0) { - for (Vector dir : dirs) { + for (BlockVector3 dir : dirs) { region.expand(dir.multiply(change)); } } else { - for (Vector dir : dirs) { + for (BlockVector3 dir : dirs) { region.expand(dir.multiply(change), dir.multiply(-reverseChange)); } } @@ -408,7 +407,7 @@ public class SelectionCommands { @CommandPermissions("worldedit.selection.contract") public void contract(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - List dirs = new ArrayList<>(); + List dirs = new ArrayList<>(); int change = args.getInteger(0); int reverseChange = 0; @@ -452,11 +451,11 @@ public class SelectionCommands { Region region = session.getSelection(player.getWorld()); int oldSize = region.getArea(); if (reverseChange == 0) { - for (Vector dir : dirs) { + for (BlockVector3 dir : dirs) { region.contract(dir.multiply(change)); } } else { - for (Vector dir : dirs) { + for (BlockVector3 dir : dirs) { region.contract(dir.multiply(change), dir.multiply(-reverseChange)); } } @@ -483,7 +482,7 @@ public class SelectionCommands { @CommandPermissions("worldedit.selection.shift") public void shift(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - List dirs = new ArrayList<>(); + List dirs = new ArrayList<>(); int change = args.getInteger(0); if (args.argsLength() == 2) { if (args.getString(1).contains(",")) { @@ -500,7 +499,7 @@ public class SelectionCommands { try { Region region = session.getSelection(player.getWorld()); - for (Vector dir : dirs) { + for (BlockVector3 dir : dirs) { region.shift(dir.multiply(change)); } @@ -560,23 +559,23 @@ public class SelectionCommands { player.print("Region inset."); } - private Vector[] getChangesForEachDir(CommandContext args) { - List changes = new ArrayList<>(6); + private BlockVector3[] getChangesForEachDir(CommandContext args) { + List changes = new ArrayList<>(6); int change = args.getInteger(0); if (!args.hasFlag('h')) { - changes.add((new Vector(0, 1, 0)).multiply(change)); - changes.add((new Vector(0, -1, 0)).multiply(change)); + changes.add((new BlockVector3(0, 1, 0)).multiply(change)); + changes.add((new BlockVector3(0, -1, 0)).multiply(change)); } if (!args.hasFlag('v')) { - changes.add((new Vector(1, 0, 0)).multiply(change)); - changes.add((new Vector(-1, 0, 0)).multiply(change)); - changes.add((new Vector(0, 0, 1)).multiply(change)); - changes.add((new Vector(0, 0, -1)).multiply(change)); + changes.add((new BlockVector3(1, 0, 0)).multiply(change)); + changes.add((new BlockVector3(-1, 0, 0)).multiply(change)); + changes.add((new BlockVector3(0, 0, 1)).multiply(change)); + changes.add((new BlockVector3(0, 0, -1)).multiply(change)); } - return changes.toArray(new Vector[0]); + return changes.toArray(new BlockVector3[0]); } @Command( @@ -589,34 +588,33 @@ public class SelectionCommands { ) @CommandPermissions("worldedit.selection.size") public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - if (args.hasFlag('c')) { ClipboardHolder holder = session.getClipboard(); Clipboard clipboard = holder.getClipboard(); Region region = clipboard.getRegion(); - Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()); - Vector origin = clipboard.getOrigin(); + BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()); + BlockVector3 origin = clipboard.getOrigin(); player.print("Cuboid dimensions (max - min): " + size); player.print("Offset: " + origin); - player.print("Cuboid distance: " + size.distance(Vector.ONE)); + player.print("Cuboid distance: " + size.distance(BlockVector3.ONE)); player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ())); return; } - + Region region = session.getSelection(player.getWorld()); - Vector size = region.getMaximumPoint() + BlockVector3 size = region.getMaximumPoint() .subtract(region.getMinimumPoint()) .add(1, 1, 1); - + player.print("Type: " + session.getRegionSelector(player.getWorld()) .getTypeName()); - + for (String line : session.getRegionSelector(player.getWorld()) .getInformationLines()) { player.print(line); } - + player.print("Size: " + size); player.print("Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint())); player.print("# of blocks: " + region.getArea()); 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 96e3e9875..c87da1110 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 @@ -30,7 +30,6 @@ import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.util.CreatureButcher; @@ -49,6 +48,7 @@ import com.sk89q.worldedit.function.visitor.EntityVisitor; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CylinderRegion; import com.sk89q.worldedit.regions.Region; @@ -103,7 +103,7 @@ public class UtilityCommands { we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1; - Vector pos = session.getPlacementPosition(player); + BlockVector3 pos = session.getPlacementPosition(player); int affected = editSession.fillXZ(pos, pattern, radius, depth, false); player.print(affected + " block(s) have been created."); } @@ -129,7 +129,7 @@ public class UtilityCommands { we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE; - Vector pos = session.getPlacementPosition(player); + BlockVector3 pos = session.getPlacementPosition(player); int affected = 0; if (pattern instanceof BlockPattern) { affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true); @@ -290,9 +290,9 @@ public class UtilityCommands { to = we.getPatternFactory().parseFromInput(args.getString(2), context); } - Vector base = session.getPlacementPosition(player); - Vector min = base.subtract(size, size, size); - Vector max = base.add(size, size, size); + BlockVector3 base = session.getPlacementPosition(player); + BlockVector3 min = base.subtract(size, size, size); + BlockVector3 max = base.add(size, size, size); Region region = new CuboidRegion(player.getWorld(), min, max); if (to instanceof BlockPattern) { @@ -432,7 +432,7 @@ public class UtilityCommands { if (player != null) { session = we.getSessionManager().get(player); - Vector center = session.getPlacementPosition(player); + BlockVector3 center = session.getPlacementPosition(player); editSession = session.createEditSession(player); List entities; if (radius >= 0) { @@ -492,7 +492,7 @@ public class UtilityCommands { if (player != null) { session = we.getSessionManager().get(player); - Vector center = session.getPlacementPosition(player); + BlockVector3 center = session.getPlacementPosition(player); editSession = session.createEditSession(player); List entities; if (radius >= 0) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java index 2ce222c5b..816516978 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java @@ -22,12 +22,12 @@ package com.sk89q.worldedit.command.argument; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.function.Contextual; import com.sk89q.worldedit.function.EditContext; import com.sk89q.worldedit.function.RegionFunction; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.command.argument.CommandArgs; import com.sk89q.worldedit.util.command.composition.SimpleCommand; @@ -82,7 +82,7 @@ public class ItemUseParser extends SimpleCommand> { } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { return world.useItem(position, item, Direction.UP); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/DeformCommand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/DeformCommand.java index 3bcb8a063..cae499dce 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/DeformCommand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/DeformCommand.java @@ -60,7 +60,7 @@ public class DeformCommand extends SimpleCommand Player player = (Player) locals.get(Actor.class); LocalSession session = WorldEdit.getInstance().getSessionManager().get(locals.get(Actor.class)); try { - deform.setOffset(session.getPlacementPosition(player)); + deform.setOffset(session.getPlacementPosition(player).toVector3()); } catch (IncompleteRegionException e) { throw new WrappedCommandException(e); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java index 1af33599c..58405c6b5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java @@ -23,10 +23,10 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; @@ -52,7 +52,7 @@ public class AreaPickaxe implements BlockTool { int ox = clicked.getBlockX(); int oy = clicked.getBlockY(); int oz = clicked.getBlockZ(); - BlockType initialType = clicked.getExtent().getBlock(clicked.toVector()).getBlockType(); + BlockType initialType = clicked.getExtent().getBlock(clicked.toVector().toBlockPoint()).getBlockType(); if (initialType.getMaterial().isAir()) { return true; @@ -69,12 +69,12 @@ public class AreaPickaxe implements BlockTool { for (int x = ox - range; x <= ox + range; ++x) { for (int y = oy - range; y <= oy + range; ++y) { for (int z = oz - range; z <= oz + range; ++z) { - Vector pos = new Vector(x, y, z); + BlockVector3 pos = new BlockVector3(x, y, z); if (editSession.getBlock(pos).getBlockType() != initialType) { continue; } - ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().distanceSq(pos)); + ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos)); editSession.setBlock(pos, BlockTypes.AIR.getDefaultState()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java index 474c689b3..2cc5e6e87 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; @@ -54,7 +55,8 @@ public class BlockDataCyler implements DoubleActionBlockTool { World world = (World) clicked.getExtent(); - BlockState block = world.getBlock(clicked.toVector()); + BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); + BlockState block = world.getBlock(blockPoint); if (!config.allowedDataCycleBlocks.isEmpty() && !player.hasPermission("worldedit.override.data-cycler") @@ -83,7 +85,7 @@ public class BlockDataCyler implements DoubleActionBlockTool { editSession.disableBuffering(); try { - editSession.setBlock(clicked.toVector(), newBlock); + editSession.setBlock(blockPoint, newBlock); player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString()); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java index 38619396b..4b5ecd79e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java @@ -23,13 +23,13 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; /** @@ -55,7 +55,7 @@ public class BlockReplacer implements DoubleActionBlockTool { try (EditSession editSession = session.createEditSession(player)) { try { editSession.disableBuffering(); - Vector position = clicked.toVector(); + BlockVector3 position = clicked.toVector().toBlockPoint(); editSession.setBlock(position, pattern.apply(position)); } catch (MaxChangedBlocksException ignored) { } finally { @@ -73,7 +73,7 @@ public class BlockReplacer implements DoubleActionBlockTool { @Override public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { - BlockStateHolder targetBlock = player.getWorld().getBlock(clicked.toVector()); + BlockStateHolder targetBlock = player.getWorld().getBlock(clicked.toVector().toBlockPoint()); if (targetBlock != null) { pattern = new BlockPattern(targetBlock); 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 55d2947f7..403361f02 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 @@ -189,7 +189,7 @@ public class BrushTool implements TraceTool { } try { - brush.build(editSession, target.toVector(), material, size); + brush.build(editSession, target.toVector().toBlockPoint(), material, size); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java index 7488c14ad..5fa95d04b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.util.Location; @@ -49,8 +50,9 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool { if (target == null) return true; RegionSelector selector = session.getRegionSelector(player.getWorld()); - if (selector.selectPrimary(target.toVector(), ActorSelectorLimits.forActor(player))) { - selector.explainPrimarySelection(player, session, target.toVector()); + BlockVector3 blockPoint = target.toVector().toBlockPoint(); + if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) { + selector.explainPrimarySelection(player, session, blockPoint); } return true; @@ -66,8 +68,9 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool { if (target == null) return true; RegionSelector selector = session.getRegionSelector(player.getWorld()); - if (selector.selectSecondary(target.toVector(), ActorSelectorLimits.forActor(player))) { - selector.explainSecondarySelection(player, session, target.toVector()); + BlockVector3 blockPoint = target.toVector().toBlockPoint(); + if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) { + selector.explainSecondarySelection(player, session, blockPoint); } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java index 5c457f13b..b60ab4dc1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java @@ -23,10 +23,10 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; @@ -69,7 +69,7 @@ public class FloatingTreeRemover implements BlockTool { Player player, LocalSession session, Location clicked) { final World world = (World) clicked.getExtent(); - final BlockState state = world.getBlock(clicked.toVector()); + final BlockState state = world.getBlock(clicked.toVector().toBlockPoint()); if (!isTreeBlock(state.getBlockType())) { player.printError("That's not a tree."); @@ -78,13 +78,13 @@ public class FloatingTreeRemover implements BlockTool { try (EditSession editSession = session.createEditSession(player)) { try { - final Set blockSet = bfs(world, clicked.toVector()); + final Set blockSet = bfs(world, clicked.toVector().toBlockPoint()); if (blockSet == null) { player.printError("That's not a floating tree."); return true; } - for (Vector blockVector : blockSet) { + for (BlockVector3 blockVector : blockSet) { final BlockState otherState = editSession.getBlock(blockVector); if (isTreeBlock(otherState.getBlockType())) { editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState()); @@ -100,13 +100,13 @@ public class FloatingTreeRemover implements BlockTool { return true; } - private Vector[] recurseDirections = { - Direction.NORTH.toVector(), - Direction.EAST.toVector(), - Direction.SOUTH.toVector(), - Direction.WEST.toVector(), - Direction.UP.toVector(), - Direction.DOWN.toVector(), + private BlockVector3[] recurseDirections = { + Direction.NORTH.toBlockVector(), + Direction.EAST.toBlockVector(), + Direction.SOUTH.toBlockVector(), + Direction.WEST.toBlockVector(), + Direction.UP.toBlockVector(), + Direction.DOWN.toBlockVector(), }; /** @@ -116,17 +116,17 @@ public class FloatingTreeRemover implements BlockTool { * @param origin any point contained in the floating tree * @return a set containing all blocks in the tree/shroom or null if this is not a floating tree/shroom. */ - private Set bfs(World world, Vector origin) throws MaxChangedBlocksException { - final Set visited = new HashSet<>(); - final LinkedList queue = new LinkedList<>(); + private Set bfs(World world, BlockVector3 origin) throws MaxChangedBlocksException { + final Set visited = new HashSet<>(); + final LinkedList queue = new LinkedList<>(); queue.addLast(origin); visited.add(origin); while (!queue.isEmpty()) { - final Vector current = queue.removeFirst(); - for (Vector recurseDirection : recurseDirections) { - final Vector next = current.add(recurseDirection); + final BlockVector3 current = queue.removeFirst(); + for (BlockVector3 recurseDirection : recurseDirections) { + final BlockVector3 next = current.add(recurseDirection); if (origin.distanceSq(next) > rangeSq) { // Maximum range exceeded => stop walking continue; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java index 16030d299..2206b8f94 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java @@ -19,16 +19,15 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockType; @@ -59,7 +58,8 @@ public class FloodFillTool implements BlockTool { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { World world = (World) clicked.getExtent(); - BlockType initialType = world.getBlock(clicked.toVector()).getBlockType(); + BlockVector3 origin = clicked.toVector().toBlockPoint(); + BlockType initialType = world.getBlock(origin).getBlockType(); if (initialType.getMaterial().isAir()) { return true; @@ -71,8 +71,7 @@ public class FloodFillTool implements BlockTool { try (EditSession editSession = session.createEditSession(player)) { try { - recurse(editSession, clicked.toVector().toBlockVector(), - clicked.toVector(), range, initialType, new HashSet<>()); + recurse(editSession, origin, origin, range, initialType, new HashSet<>()); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { @@ -83,8 +82,8 @@ public class FloodFillTool implements BlockTool { return true; } - private void recurse(EditSession editSession, BlockVector pos, Vector origin, int size, BlockType initialType, - Set visited) throws MaxChangedBlocksException { + private void recurse(EditSession editSession, BlockVector3 pos, BlockVector3 origin, int size, BlockType initialType, + Set visited) throws MaxChangedBlocksException { if (origin.distance(pos) > size || visited.contains(pos)) { return; @@ -98,17 +97,17 @@ public class FloodFillTool implements BlockTool { return; } - recurse(editSession, pos.add(1, 0, 0).toBlockVector(), + recurse(editSession, pos.add(1, 0, 0), origin, size, initialType, visited); - recurse(editSession, pos.add(-1, 0, 0).toBlockVector(), + recurse(editSession, pos.add(-1, 0, 0), origin, size, initialType, visited); - recurse(editSession, pos.add(0, 0, 1).toBlockVector(), + recurse(editSession, pos.add(0, 0, 1), origin, size, initialType, visited); - recurse(editSession, pos.add(0, 0, -1).toBlockVector(), + recurse(editSession, pos.add(0, 0, -1), origin, size, initialType, visited); - recurse(editSession, pos.add(0, 1, 0).toBlockVector(), + recurse(editSession, pos.add(0, 1, 0), origin, size, initialType, visited); - recurse(editSession, pos.add(0, -1, 0).toBlockVector(), + recurse(editSession, pos.add(0, -1, 0), origin, size, initialType, visited); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java index 3d056de68..046a53749 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -55,11 +56,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo if (pos == null) return false; try (EditSession eS = session.createEditSession(player)) { eS.disableBuffering(); - BlockStateHolder applied = secondary.apply(pos.toVector()); + BlockVector3 blockPoint = pos.toVector().toBlockPoint(); + BlockStateHolder applied = secondary.apply(blockPoint); if (applied.getBlockType().getMaterial().isAir()) { - eS.setBlock(pos.toVector(), secondary); + eS.setBlock(blockPoint, secondary); } else { - eS.setBlock(pos.getDirection(), secondary); + eS.setBlock(pos.getDirection().toBlockPoint(), secondary); } return true; } catch (MaxChangedBlocksException e) { @@ -75,11 +77,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo if (pos == null) return false; try (EditSession eS = session.createEditSession(player)) { eS.disableBuffering(); - BlockStateHolder applied = primary.apply(pos.toVector()); + BlockVector3 blockPoint = pos.toVector().toBlockPoint(); + BlockStateHolder applied = primary.apply(blockPoint); if (applied.getBlockType().getMaterial().isAir()) { - eS.setBlock(pos.toVector(), primary); + eS.setBlock(blockPoint, primary); } else { - eS.setBlock(pos.getDirection(), primary); + eS.setBlock(pos.getDirection().toBlockPoint(), primary); } return true; } catch (MaxChangedBlocksException e) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java index 1ad0441a4..59e21bfde 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java @@ -26,6 +26,7 @@ import com.sk89q.worldedit.blocks.MobSpawnerBlock; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -44,13 +45,14 @@ public class QueryTool implements BlockTool { World world = (World) clicked.getExtent(); EditSession editSession = session.createEditSession(player); - BlockStateHolder block = editSession.getFullBlock(clicked.toVector()); + BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); + BlockStateHolder block = editSession.getFullBlock(blockPoint); player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e" + block.getBlockType().getName() + "\u00A77" + " (" + block.toString() + ") " + "\u00A7f" - + " (" + world.getBlockLightLevel(clicked.toVector()) + "/" + world.getBlockLightLevel(clicked.toVector().add(0, 1, 0)) + ")"); + + " (" + world.getBlockLightLevel(blockPoint) + "/" + world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")"); if (block instanceof MobSpawnerBlock) { player.printRaw("\u00A7e" + "Mob Type: " diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java index afeb4728d..e49a17374 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java @@ -19,15 +19,14 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; @@ -56,7 +55,8 @@ public class RecursivePickaxe implements BlockTool { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { World world = (World) clicked.getExtent(); - BlockType initialType = world.getBlock(clicked.toVector()).getBlockType(); + BlockVector3 origin = clicked.toVector().toBlockPoint(); + BlockType initialType = world.getBlock(origin).getBlockType(); if (initialType.getMaterial().isAir()) { return true; @@ -70,8 +70,8 @@ public class RecursivePickaxe implements BlockTool { editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); try { - recurse(server, editSession, world, clicked.toVector().toBlockVector(), - clicked.toVector(), range, initialType, new HashSet<>()); + recurse(server, editSession, world, clicked.toVector().toBlockPoint(), + clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>()); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { @@ -82,8 +82,8 @@ public class RecursivePickaxe implements BlockTool { return true; } - private static void recurse(Platform server, EditSession editSession, World world, BlockVector pos, - Vector origin, double size, BlockType initialType, Set visited) throws MaxChangedBlocksException { + private static void recurse(Platform server, EditSession editSession, World world, BlockVector3 pos, + BlockVector3 origin, double size, BlockType initialType, Set visited) throws MaxChangedBlocksException { final double distanceSq = origin.distanceSq(pos); if (distanceSq > size*size || visited.contains(pos)) { @@ -100,17 +100,17 @@ public class RecursivePickaxe implements BlockTool { editSession.setBlock(pos, BlockTypes.AIR.getDefaultState()); - recurse(server, editSession, world, pos.add(1, 0, 0).toBlockVector(), + recurse(server, editSession, world, pos.add(1, 0, 0), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(-1, 0, 0).toBlockVector(), + recurse(server, editSession, world, pos.add(-1, 0, 0), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(0, 0, 1).toBlockVector(), + recurse(server, editSession, world, pos.add(0, 0, 1), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(0, 0, -1).toBlockVector(), + recurse(server, editSession, world, pos.add(0, 0, -1), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(0, 1, 0).toBlockVector(), + recurse(server, editSession, world, pos.add(0, 1, 0), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(0, -1, 0).toBlockVector(), + recurse(server, editSession, world, pos.add(0, -1, 0), origin, size, initialType, visited); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java index fbf1874ce..8ba789626 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java @@ -26,6 +26,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; @@ -43,7 +44,8 @@ public class SinglePickaxe implements BlockTool { @Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { World world = (World) clicked.getExtent(); - final BlockType blockType = world.getBlock(clicked.toVector()).getBlockType(); + BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); + final BlockType blockType = world.getBlock(blockPoint).getBlockType(); if (blockType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) { return true; @@ -51,7 +53,7 @@ public class SinglePickaxe implements BlockTool { try (EditSession editSession = session.createEditSession(player)) { editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop); - editSession.setBlock(clicked.toVector(), BlockTypes.AIR.getDefaultState()); + editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState()); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java index 27c1df2e9..8c353ed74 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java @@ -53,7 +53,7 @@ public class TreePlanter implements BlockTool { boolean successful = false; for (int i = 0; i < 10; i++) { - if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0))) { + if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0).toBlockPoint())) { successful = true; break; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java index 0caf07dbe..c066c7d10 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; /** * A brush is a long-range build tool. @@ -38,6 +38,6 @@ public interface Brush { * @param size the size of the brush * @throws MaxChangedBlocksException */ - void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException; + void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java index 175cc32ae..f715c424f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java @@ -21,12 +21,12 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.command.util.CreatureButcher; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.visitor.EntityVisitor; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CylinderRegion; import java.util.List; @@ -40,7 +40,7 @@ public class ButcherBrush implements Brush { } @Override - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { + public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { CylinderRegion region = CylinderRegion.createRadius(editSession, position, size); List entities = editSession.getEntities(region); Operations.completeLegacy(new EntityVisitor(entities.iterator(), flags.createFunction())); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java index 184480787..d6abe3cc9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java @@ -21,11 +21,11 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.session.ClipboardHolder; @@ -42,10 +42,10 @@ public class ClipboardBrush implements Brush { } @Override - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { + public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { Clipboard clipboard = holder.getClipboard(); Region region = clipboard.getRegion(); - Vector centerOffset = region.getCenter().subtract(clipboard.getOrigin()); + BlockVector3 centerOffset = region.getCenter().toBlockPoint().subtract(clipboard.getOrigin()); Operation operation = holder .createPaste(editSession) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java index 10db344ca..12a663ed3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java @@ -21,9 +21,9 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockTypes; public class CylinderBrush implements Brush { @@ -35,7 +35,7 @@ public class CylinderBrush implements Brush { } @Override - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { + public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } 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 8eaf1fbce..5ae29bec7 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 @@ -21,8 +21,8 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; @@ -39,21 +39,21 @@ public class GravityBrush implements Brush { } @Override - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { + public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { final double startY = fullHeight ? editSession.getWorld().getMaxY() : position.getBlockY() + size; for (double x = position.getBlockX() + size; x > position.getBlockX() - size; --x) { for (double z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) { double y = startY; final List blockTypes = new ArrayList<>(); for (; y > position.getBlockY() - size; --y) { - final Vector pt = new Vector(x, y, z); + final BlockVector3 pt = new BlockVector3(x, y, z); final BlockStateHolder block = editSession.getBlock(pt); if (!block.getBlockType().getMaterial().isAir()) { blockTypes.add(block); editSession.setBlock(pt, BlockTypes.AIR.getDefaultState()); } } - Vector pt = new Vector(x, y, z); + BlockVector3 pt = new BlockVector3(x, y, z); Collections.reverse(blockTypes); for (int i = 0; i < blockTypes.size();) { if (editSession.getBlock(pt).getBlockType().getMaterial().isAir()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java index 3f9eb06c7..dbf959e1b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java @@ -21,9 +21,9 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockTypes; public class HollowCylinderBrush implements Brush { @@ -35,7 +35,7 @@ public class HollowCylinderBrush implements Brush { } @Override - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { + public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java index 7980ec744..0e89b3c16 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java @@ -21,15 +21,15 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockTypes; public class HollowSphereBrush implements Brush { @Override - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { + public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/OperationFactoryBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/OperationFactoryBrush.java index f9a679d62..6a323f14b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/OperationFactoryBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/OperationFactoryBrush.java @@ -21,12 +21,12 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.Contextual; import com.sk89q.worldedit.function.EditContext; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.factory.RegionFactory; public class OperationFactoryBrush implements Brush { @@ -40,7 +40,7 @@ public class OperationFactoryBrush implements Brush { } @Override - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { + public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { EditContext context = new EditContext(); context.setDestination(editSession); context.setRegion(regionFactory.createCenteredAt(position, size)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java index df76950d4..d46b1ec3a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java @@ -21,8 +21,9 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.convolution.GaussianKernel; import com.sk89q.worldedit.math.convolution.HeightMap; import com.sk89q.worldedit.math.convolution.HeightMapFilter; @@ -39,10 +40,11 @@ public class SmoothBrush implements Brush { } @Override - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { - Location min = new Location(editSession.getWorld(), position.subtract(size, size, size)); - Vector max = position.add(size, size + 10, size); - Region region = new CuboidRegion(editSession.getWorld(), min.toVector(), max); + public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { + Vector3 posDouble = position.toVector3(); + Location min = new Location(editSession.getWorld(), posDouble.subtract(size, size, size)); + BlockVector3 max = posDouble.add(size, size + 10, size).toBlockPoint(); + Region region = new CuboidRegion(editSession.getWorld(), min.toVector().toBlockPoint(), max); HeightMap heightMap = new HeightMap(editSession, region); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); heightMap.applyFilter(filter, iterations); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java index ba4b3eaf2..d8028f2ae 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java @@ -21,15 +21,15 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockTypes; public class SphereBrush implements Brush { @Override - public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { + public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java index ac2fc81ed..4b8b4483f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -20,15 +20,16 @@ package com.sk89q.worldedit.entity; import com.sk89q.worldedit.PlayerDirection; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.inventory.BlockBag; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.gamemode.GameMode; @@ -256,14 +257,14 @@ public interface Player extends Entity, Actor { * @param pitch the pitch (up/down) of the player's view in degrees * @param yaw the yaw (left/right) of the player's view in degrees */ - void setPosition(Vector pos, float pitch, float yaw); + void setPosition(Vector3 pos, float pitch, float yaw); /** * Move the player. * * @param pos where to move them */ - void setPosition(Vector pos); + void setPosition(Vector3 pos); /** * Sends a fake block to the client. @@ -275,5 +276,5 @@ public interface Player extends Entity, Actor { * @param pos The position of the block * @param block The block to send, null to reset */ - void sendFakeBlock(Vector pos, @Nullable BlockStateHolder block); + void sendFakeBlock(BlockVector3 pos, @Nullable BlockStateHolder block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java index d1bf6a238..a84ffc152 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java @@ -23,10 +23,10 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.EditSession.Stage; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -53,7 +53,7 @@ import javax.annotation.Nullable; * is set to {@link Stage#BEFORE_HISTORY}, then you can drop (or log) changes * before the change has reached the history, reordering, and actual change * extents, but that means that any changes made with - * {@link EditSession#rawSetBlock(Vector, BlockStateHolder)} will skip your + * {@link EditSession#rawSetBlock(BlockVector3, BlockStateHolder)} will skip your * custom {@link Extent} because that method bypasses history (and reorder). * It is thus recommended that loggers intercept at {@link Stage#BEFORE_CHANGE} * and block interceptors intercept at BOTH {@link Stage#BEFORE_CHANGE} and diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java index 510656828..d75b9c739 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java @@ -19,7 +19,6 @@ package com.sk89q.worldedit.extension.factory; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.NotABlockException; import com.sk89q.worldedit.WorldEdit; @@ -37,6 +36,7 @@ import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.world.World; @@ -245,7 +245,7 @@ class DefaultBlockParser extends InputParser { } else if ("pos1".equalsIgnoreCase(typeString)) { // Get the block type from the "primary position" final World world = context.requireWorld(); - final BlockVector primaryPosition; + final BlockVector3 primaryPosition; try { primaryPosition = context.requireSession().getRegionSelector(world).getPrimaryPosition(); } catch (IncompleteRegionException e) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java index 981e60800..5f9c9b806 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java @@ -20,7 +20,6 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.IncompleteRegionException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; @@ -42,6 +41,8 @@ import com.sk89q.worldedit.function.mask.SolidBlockMask; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.noise.RandomNoise; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; import com.sk89q.worldedit.session.request.Request; @@ -134,7 +135,7 @@ class DefaultMaskParser extends InputParser { } else { submask = new ExistingBlockMask(extent); } - OffsetMask offsetMask = new OffsetMask(submask, new Vector(0, firstChar == '>' ? -1 : 1, 0)); + OffsetMask offsetMask = new OffsetMask(submask, new BlockVector3(0, firstChar == '>' ? -1 : 1, 0)); return new MaskIntersection(offsetMask, Masks.negate(submask)); case '$': @@ -161,7 +162,7 @@ class DefaultMaskParser extends InputParser { try { Expression exp = Expression.compile(component.substring(1), "x", "y", "z"); WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment( - Request.request().getEditSession(), Vector.ONE, Vector.ZERO); + Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO); exp.setEnvironment(env); return new ExpressionMask(exp); } catch (ExpressionException e) { 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 d08b2bf18..fabfe0662 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 @@ -21,16 +21,17 @@ package com.sk89q.worldedit.extension.platform; import com.sk89q.worldedit.NotABlockException; import com.sk89q.worldedit.PlayerDirection; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.cui.CUIEvent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TargetBlock; import com.sk89q.worldedit.util.auth.AuthorizationException; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -105,7 +106,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte free = 0; while (y <= world.getMaximumPoint().getBlockY() + 2) { - if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -113,7 +114,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { if (free == 2) { if (y - 1 != origY) { - setPosition(new Vector(x + 0.5, y - 2 + 1, z + 0.5)); + setPosition(new Vector3(x + 0.5, y - 2 + 1, z + 0.5)); } return; @@ -131,10 +132,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { int z = searchPos.getBlockZ(); while (y >= 0) { - final Vector pos = new Vector(x, y, z); + final BlockVector3 pos = new BlockVector3(x, y, z); final BlockState id = world.getBlock(pos); if (id.getBlockType().getMaterial().isMovementBlocker()) { - setPosition(new Vector(x + 0.5, y + 1, z + 0.5)); + setPosition(new Vector3(x + 0.5, y + 1, z + 0.5)); return; } @@ -159,7 +160,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte spots = 0; while (y <= world.getMaximumPoint().getY() + 2) { - if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -168,7 +169,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { if (free == 2) { ++spots; if (spots == 2) { - final Vector platform = new Vector(x, y - 2, z); + final BlockVector3 platform = new BlockVector3(x, y - 2, z); final BlockStateHolder block = world.getBlock(platform); final com.sk89q.worldedit.world.block.BlockType type = block.getBlockType(); @@ -177,7 +178,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { return false; } - setPosition(platform.add(0.5, 1, 0.5)); + setPosition(platform.toVector3().add(0.5, 1, 0.5)); return true; } } @@ -199,7 +200,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte free = 0; while (y >= 1) { - if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -210,14 +211,14 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { // lightly and also check to see if there's something to // stand upon while (y >= 0) { - final Vector platform = new Vector(x, y, z); + final BlockVector3 platform = new BlockVector3(x, y, z); final BlockStateHolder block = world.getBlock(platform); final BlockType type = block.getBlockType(); // Don't want to end up in lava if (!type.getMaterial().isAir() && type != BlockTypes.LAVA) { // Found a block! - setPosition(platform.add(0.5, 1, 0.5)); + setPosition(platform.toVector3().add(0.5, 1, 0.5)); return true; } @@ -248,13 +249,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { Extent world = getLocation().getExtent(); // No free space above - if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isAir()) { + if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir()) { return false; } while (y <= world.getMaximumPoint().getY()) { // Found a ceiling! - if (world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { int platformY = Math.max(initialY, y - 3 - clearance); floatAt(x, platformY + 1, z, alwaysGlass); return true; @@ -282,7 +283,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { final Extent world = getLocation().getExtent(); while (y <= world.getMaximumPoint().getY() + 2) { - if (world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { break; // Hit something } else if (y > maxY + 1) { break; @@ -300,24 +301,24 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public void floatAt(int x, int y, int z, boolean alwaysGlass) { try { - Vector spot = new Vector(x, y - 1, z); + BlockVector3 spot = new BlockVector3(x, y - 1, z); if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) { getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState()); } } catch (WorldEditException e) { e.printStackTrace(); } - setPosition(new Vector(x + 0.5, y, z + 0.5)); + setPosition(new Vector3(x + 0.5, y, z + 0.5)); } @Override public Location getBlockIn() { - return getLocation().setPosition(getLocation().toVector().toBlockVector()); + return getLocation().setPosition(getLocation().toVector().floor()); } @Override public Location getBlockOn() { - return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().toBlockVector()); + return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().floor()); } @Override @@ -392,7 +393,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { boolean inFree = false; while ((block = hitBlox.getNextBlock()) != null) { - boolean free = !world.getBlock(block.toVector()).getBlockType().getMaterial().isMovementBlocker(); + boolean free = !world.getBlock(block.toVector().toBlockPoint()).getBlockType().getMaterial().isMovementBlocker(); if (firstBlock) { firstBlock = false; @@ -426,7 +427,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { } @Override - public void setPosition(Vector pos) { + public void setPosition(Vector3 pos) { setPosition(pos, getLocation().getPitch(), getLocation().getYaw()); } @@ -499,7 +500,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { } @Override - public void sendFakeBlock(Vector pos, BlockStateHolder block) { + public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index 95c202455..6ff415d4b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.tool.BlockTool; import com.sk89q.worldedit.command.tool.DoubleActionBlockTool; @@ -38,6 +37,8 @@ import com.sk89q.worldedit.event.platform.PlatformInitializeEvent; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.event.platform.PlayerInputEvent; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; @@ -302,7 +303,7 @@ public class PlatformManager { Actor actor = createProxyActor(event.getCause()); Location location = event.getLocation(); - Vector vector = location.toVector(); + Vector3 vector = location.toVector(); // At this time, only handle interaction from players if (actor instanceof Player) { @@ -321,8 +322,9 @@ public class PlatformManager { RegionSelector selector = session.getRegionSelector(player.getWorld()); - if (selector.selectPrimary(location.toVector(), ActorSelectorLimits.forActor(player))) { - selector.explainPrimarySelection(actor, session, vector); + BlockVector3 blockPoint = vector.toBlockPoint(); + if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) { + selector.explainPrimarySelection(actor, session, blockPoint); } event.setCancelled(true); @@ -356,8 +358,9 @@ public class PlatformManager { } RegionSelector selector = session.getRegionSelector(player.getWorld()); - if (selector.selectSecondary(vector, ActorSelectorLimits.forActor(player))) { - selector.explainSecondarySelection(actor, session, vector); + BlockVector3 blockPoint = vector.toBlockPoint(); + if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) { + selector.explainSecondarySelection(actor, session, blockPoint); } event.setCancelled(true); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java index adb5e2e83..be748c2c7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java @@ -21,12 +21,13 @@ package com.sk89q.worldedit.extension.platform; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.internal.cui.CUIEvent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; @@ -92,7 +93,7 @@ class PlayerProxy extends AbstractPlayerActor { } @Override - public void setPosition(Vector pos, float pitch, float yaw) { + public void setPosition(Vector3 pos, float pitch, float yaw) { basePlayer.setPosition(pos, pitch, yaw); } @@ -158,7 +159,7 @@ class PlayerProxy extends AbstractPlayerActor { } @Override - public void sendFakeBlock(Vector pos, BlockStateHolder block) { + public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { basePlayer.sendFakeBlock(pos, block); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index a93c9b93d..94c346ff6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -21,17 +21,17 @@ package com.sk89q.worldedit.extent; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.OperationQueue; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -66,17 +66,17 @@ public abstract class AbstractDelegateExtent implements Extent { } @Override - public BlockState getBlock(Vector position) { + public BlockState getBlock(BlockVector3 position) { return extent.getBlock(position); } @Override - public BaseBlock getFullBlock(Vector position) { + public BaseBlock getFullBlock(BlockVector3 position) { return extent.getFullBlock(position); } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { return extent.setBlock(location, block); } @@ -97,22 +97,22 @@ public abstract class AbstractDelegateExtent implements Extent { } @Override - public BaseBiome getBiome(Vector2D position) { + public BaseBiome getBiome(BlockVector2 position) { return extent.getBiome(position); } @Override - public boolean setBiome(Vector2D position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BaseBiome biome) { return extent.setBiome(position, biome); } @Override - public Vector getMinimumPoint() { + public BlockVector3 getMinimumPoint() { return extent.getMinimumPoint(); } @Override - public Vector getMaximumPoint() { + public BlockVector3 getMaximumPoint() { return extent.getMaximumPoint(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java index e4f6ba48d..15ccf544b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java @@ -21,17 +21,17 @@ package com.sk89q.worldedit.extent; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.history.change.EntityCreate; import com.sk89q.worldedit.history.change.EntityRemove; import com.sk89q.worldedit.history.changeset.ChangeSet; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.ArrayList; @@ -59,9 +59,9 @@ public class ChangeSetExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { BaseBlock previous = getFullBlock(location); - changeSet.add(new BlockChange(location.toBlockVector(), previous, block)); + changeSet.add(new BlockChange(location, previous, block)); return super.setBlock(location, block); } 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 5ed584351..e76170f95 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 @@ -19,9 +19,9 @@ package com.sk89q.worldedit.extent; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; @@ -46,7 +46,7 @@ public interface Extent extends InputExtent, OutputExtent { * * @return the minimum point */ - Vector getMinimumPoint(); + BlockVector3 getMinimumPoint(); /** * Get the maximum point in the extent. @@ -56,7 +56,7 @@ public interface Extent extends InputExtent, OutputExtent { * * @return the maximum point */ - Vector getMaximumPoint(); + BlockVector3 getMaximumPoint(); /** * Get a list of all entities within the given region. 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 61ea293c8..8b0fd2d48 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 @@ -19,11 +19,11 @@ package com.sk89q.worldedit.extent; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; /** @@ -45,7 +45,7 @@ public interface InputExtent { * @param position position of the block * @return the block */ - BlockState getBlock(Vector position); + BlockState getBlock(BlockVector3 position); /** * Get a immutable snapshot of the block at the given location. @@ -53,7 +53,7 @@ public interface InputExtent { * @param position position of the block * @return the block */ - BaseBlock getFullBlock(Vector position); + BaseBlock getFullBlock(BlockVector3 position); /** * Get the biome at the given location. @@ -64,6 +64,6 @@ public interface InputExtent { * @param position the (x, z) location to check the biome at * @return the biome at the location */ - BaseBiome getBiome(Vector2D position); + BaseBiome getBiome(BlockVector2 position); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java index cbd21675c..6f27d0dae 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java @@ -21,9 +21,9 @@ package com.sk89q.worldedit.extent; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; /** @@ -65,7 +65,7 @@ public class MaskingExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { return mask.test(location) && super.setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java index 93ffb6e94..832ecd489 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java @@ -19,16 +19,16 @@ package com.sk89q.worldedit.extent; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; @@ -44,16 +44,14 @@ import javax.annotation.Nullable; */ public class NullExtent implements Extent { - private final Vector nullPoint = new Vector(0, 0, 0); - @Override - public Vector getMinimumPoint() { - return nullPoint; + public BlockVector3 getMinimumPoint() { + return BlockVector3.ZERO; } @Override - public Vector getMaximumPoint() { - return nullPoint; + public BlockVector3 getMaximumPoint() { + return BlockVector3.ZERO; } @Override @@ -73,28 +71,28 @@ public class NullExtent implements Extent { } @Override - public BlockState getBlock(Vector position) { + public BlockState getBlock(BlockVector3 position) { return BlockTypes.AIR.getDefaultState(); } @Override - public BaseBlock getFullBlock(Vector position) { + public BaseBlock getFullBlock(BlockVector3 position) { return getBlock(position).toBaseBlock(); } @Nullable @Override - public BaseBiome getBiome(Vector2D position) { + public BaseBiome getBiome(BlockVector2 position) { return null; } @Override - public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException { return false; } @Override - public boolean setBiome(Vector2D position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BaseBiome biome) { return false; } 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 36747fd97..002ed755b 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 @@ -19,10 +19,10 @@ package com.sk89q.worldedit.extent; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -50,7 +50,7 @@ public interface OutputExtent { * @return true if the block was successfully set (return value may not be accurate) * @throws WorldEditException thrown on an error */ - boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException; + boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException; /** * Set the biome. @@ -59,7 +59,7 @@ public interface OutputExtent { * @param biome the biome to set to * @return true if the biome was successfully set (return value may not be accurate) */ - boolean setBiome(Vector2D position, BaseBiome biome); + boolean setBiome(BlockVector2 position, BaseBiome biome); /** * Return an {@link Operation} that should be called to tie up loose ends diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java index 3905f4ccb..ebb5afea5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java @@ -21,14 +21,14 @@ package com.sk89q.worldedit.extent.buffer; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.AbstractRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; @@ -44,19 +44,19 @@ import java.util.Map; * actual application of the changes. * *

This buffer will not attempt to return results from the buffer when - * accessor methods (such as {@link #getBlock(Vector)}) are called.

+ * accessor methods (such as {@link #getBlock(BlockVector3)}) are called.

*/ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pattern { - private final Map buffer = new LinkedHashMap<>(); + private final Map buffer = new LinkedHashMap<>(); private final Mask mask; - private Vector min = null; - private Vector max = null; + private BlockVector3 min = null; + private BlockVector3 max = null; /** * Create a new extent buffer that will buffer every change. * - * @param delegate the delegate extent for {@link Extent#getBlock(Vector)}, etc. calls + * @param delegate the delegate extent for {@link Extent#getBlock(BlockVector3)}, etc. calls */ public ForgetfulExtentBuffer(Extent delegate) { this(delegate, Masks.alwaysTrue()); @@ -66,7 +66,7 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat * Create a new extent buffer that will buffer changes that meet the criteria * of the given mask. * - * @param delegate the delegate extent for {@link Extent#getBlock(Vector)}, etc. calls + * @param delegate the delegate extent for {@link Extent#getBlock(BlockVector3)}, etc. calls * @param mask the mask */ public ForgetfulExtentBuffer(Extent delegate, Mask mask) { @@ -77,22 +77,22 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { // Update minimum if (min == null) { min = location; } else { - min = Vector.getMinimum(min, location); + min = min.getMinimum(location); } // Update maximum if (max == null) { max = location; } else { - max = Vector.getMaximum(max, location); + max = max.getMaximum(location); } - BlockVector blockVector = location.toBlockVector(); + BlockVector3 blockVector = location; if (mask.test(blockVector)) { buffer.put(blockVector, block); return true; @@ -102,8 +102,8 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat } @Override - public BlockStateHolder apply(Vector pos) { - BlockStateHolder block = buffer.get(pos.toBlockVector()); + public BlockStateHolder apply(BlockVector3 pos) { + BlockStateHolder block = buffer.get(pos); if (block != null) { return block; } else { @@ -119,32 +119,32 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat public Region asRegion() { return new AbstractRegion(null) { @Override - public Vector getMinimumPoint() { - return min != null ? min : new Vector(); + public BlockVector3 getMinimumPoint() { + return min != null ? min : BlockVector3.ZERO; } @Override - public Vector getMaximumPoint() { - return max != null ? max : new Vector(); + public BlockVector3 getMaximumPoint() { + return max != null ? max : BlockVector3.ZERO; } @Override - public void expand(Vector... changes) throws RegionOperationException { + public void expand(BlockVector3... changes) throws RegionOperationException { throw new UnsupportedOperationException("Cannot change the size of this region"); } @Override - public void contract(Vector... changes) throws RegionOperationException { + public void contract(BlockVector3... changes) throws RegionOperationException { throw new UnsupportedOperationException("Cannot change the size of this region"); } @Override - public boolean contains(Vector position) { - return buffer.containsKey(position.toBlockVector()); + public boolean contains(BlockVector3 position) { + return buffer.containsKey(position); } @Override - public Iterator iterator() { + public Iterator iterator() { return buffer.keySet().iterator(); } }; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java index b4c4e267a..4fdb6e430 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java @@ -19,15 +19,15 @@ package com.sk89q.worldedit.extent.cache; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.block.BlockState; /** * Returns the same cached {@link BlockState} for repeated calls to - * {@link #getBlock(Vector)} with the same position. + * {@link #getBlock(BlockVector3)} with the same position. */ public class LastAccessExtentCache extends AbstractDelegateExtent { @@ -43,23 +43,22 @@ public class LastAccessExtentCache extends AbstractDelegateExtent { } @Override - public BlockState getBlock(Vector position) { - BlockVector blockVector = position.toBlockVector(); + public BlockState getBlock(BlockVector3 position) { CachedBlock lastBlock = this.lastBlock; - if (lastBlock != null && lastBlock.position.equals(blockVector)) { + if (lastBlock != null && lastBlock.position.equals(position)) { return lastBlock.block; } else { BlockState block = super.getBlock(position); - this.lastBlock = new CachedBlock(blockVector, block); + this.lastBlock = new CachedBlock(position, block); return block; } } private static class CachedBlock { - private final BlockVector position; + private final BlockVector3 position; private final BlockState block; - private CachedBlock(BlockVector position, BlockState block) { + private CachedBlock(BlockVector3 position, BlockState block) { this.position = position; this.block = block; } 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 cd817f9bf..32e4a17d8 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 @@ -21,16 +21,16 @@ package com.sk89q.worldedit.extent.clipboard; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; @@ -48,7 +48,7 @@ import javax.annotation.Nullable; public class BlockArrayClipboard implements Clipboard { private final Region region; - private Vector origin; + private BlockVector3 origin; private final BlockStateHolder[][][] blocks; private final List entities = new ArrayList<>(); @@ -64,7 +64,7 @@ public class BlockArrayClipboard implements Clipboard { this.region = region.clone(); this.origin = region.getMinimumPoint(); - Vector dimensions = getDimensions(); + BlockVector3 dimensions = getDimensions(); blocks = new BlockStateHolder[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()]; } @@ -74,27 +74,27 @@ public class BlockArrayClipboard implements Clipboard { } @Override - public Vector getOrigin() { + public BlockVector3 getOrigin() { return origin; } @Override - public void setOrigin(Vector origin) { + public void setOrigin(BlockVector3 origin) { this.origin = origin; } @Override - public Vector getDimensions() { + public BlockVector3 getDimensions() { return region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1); } @Override - public Vector getMinimumPoint() { + public BlockVector3 getMinimumPoint() { return region.getMinimumPoint(); } @Override - public Vector getMaximumPoint() { + public BlockVector3 getMaximumPoint() { return region.getMaximumPoint(); } @@ -102,7 +102,7 @@ public class BlockArrayClipboard implements Clipboard { public List getEntities(Region region) { List filtered = new ArrayList<>(); for (Entity entity : entities) { - if (region.contains(entity.getLocation().toVector())) { + if (region.contains(entity.getLocation().toVector().toBlockPoint())) { filtered.add(entity); } } @@ -123,9 +123,9 @@ public class BlockArrayClipboard implements Clipboard { } @Override - public BlockState getBlock(Vector position) { + public BlockState getBlock(BlockVector3 position) { if (region.contains(position)) { - Vector v = position.subtract(region.getMinimumPoint()); + BlockVector3 v = position.subtract(region.getMinimumPoint()); BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; if (block != null) { return block.toImmutableState(); @@ -136,9 +136,9 @@ public class BlockArrayClipboard implements Clipboard { } @Override - public BaseBlock getFullBlock(Vector position) { + public BaseBlock getFullBlock(BlockVector3 position) { if (region.contains(position)) { - Vector v = position.subtract(region.getMinimumPoint()); + BlockVector3 v = position.subtract(region.getMinimumPoint()); BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; if (block != null) { return block.toBaseBlock(); @@ -149,9 +149,9 @@ public class BlockArrayClipboard implements Clipboard { } @Override - public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException { if (region.contains(position)) { - Vector v = position.subtract(region.getMinimumPoint()); + BlockVector3 v = position.subtract(region.getMinimumPoint()); blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()] = block; return true; } else { @@ -160,12 +160,12 @@ public class BlockArrayClipboard implements Clipboard { } @Override - public BaseBiome getBiome(Vector2D position) { + public BaseBiome getBiome(BlockVector2 position) { return new BaseBiome(0); } @Override - public boolean setBiome(Vector2D position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BaseBiome biome) { return false; } 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 fa7ff1929..e0022d480 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 @@ -19,8 +19,8 @@ package com.sk89q.worldedit.extent.clipboard; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; /** @@ -42,20 +42,20 @@ public interface Clipboard extends Extent { * * @return the dimensions */ - Vector getDimensions(); + BlockVector3 getDimensions(); /** * Get the origin point from which the copy was made from. * * @return the origin */ - Vector getOrigin(); + BlockVector3 getOrigin(); /** * Set the origin point from which the copy was made from. * * @param origin the origin */ - void setOrigin(Vector origin); + void setOrigin(BlockVector3 origin); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index f3e653827..f278595a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -30,14 +30,13 @@ import com.sk89q.jnbt.NamedTag; import com.sk89q.jnbt.ShortTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.legacycompat.NBTCompatibilityHandler; import com.sk89q.worldedit.extent.clipboard.io.legacycompat.SignCompatibilityHandler; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; @@ -105,7 +104,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { // Metadata // ==================================================================== - Vector origin; + BlockVector3 origin; Region region; // Get information @@ -117,18 +116,18 @@ public class MCEditSchematicReader extends NBTSchematicReader { int originX = requireTag(schematic, "WEOriginX", IntTag.class).getValue(); int originY = requireTag(schematic, "WEOriginY", IntTag.class).getValue(); int originZ = requireTag(schematic, "WEOriginZ", IntTag.class).getValue(); - Vector min = new Vector(originX, originY, originZ); + BlockVector3 min = new BlockVector3(originX, originY, originZ); int offsetX = requireTag(schematic, "WEOffsetX", IntTag.class).getValue(); int offsetY = requireTag(schematic, "WEOffsetY", IntTag.class).getValue(); int offsetZ = requireTag(schematic, "WEOffsetZ", IntTag.class).getValue(); - Vector offset = new Vector(offsetX, offsetY, offsetZ); + BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ); origin = min.subtract(offset); - region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE)); + region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); } catch (IOException ignored) { - origin = new Vector(0, 0, 0); - region = new CuboidRegion(origin, origin.add(width, height, length).subtract(Vector.ONE)); + origin = BlockVector3.ZERO; + region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE)); } // ==================================================================== @@ -162,7 +161,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { // Need to pull out tile entities List tileEntities = requireTag(schematic, "TileEntities", ListTag.class).getValue(); - Map> tileEntitiesMap = new HashMap<>(); + Map> tileEntitiesMap = new HashMap<>(); for (Tag tag : tileEntities) { if (!(tag instanceof CompoundTag)) continue; @@ -206,7 +205,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { } } - BlockVector vec = new BlockVector(x, y, z); + BlockVector3 vec = new BlockVector3(x, y, z); tileEntitiesMap.put(vec, values); } @@ -220,7 +219,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { for (int y = 0; y < height; ++y) { for (int z = 0; z < length; ++z) { int index = y * width * length + z * width + x; - BlockVector pt = new BlockVector(x, y, z); + BlockVector3 pt = new BlockVector3(x, y, z); BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(blocks[index], blockData[index]); try { 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 e1541bc63..b9c582bad 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 @@ -31,8 +31,6 @@ import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NamedTag; import com.sk89q.jnbt.ShortTag; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extension.input.InputParseException; @@ -40,6 +38,7 @@ import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.legacycompat.NBTCompatibilityHandler; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.block.BlockState; @@ -96,7 +95,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { } private Clipboard readVersion1(Map schematic) throws IOException { - Vector origin; + BlockVector3 origin; Region region; Map metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue(); @@ -110,19 +109,19 @@ public class SpongeSchematicReader extends NBTSchematicReader { throw new IOException("Invalid offset specified in schematic."); } - Vector min = new Vector(offsetParts[0], offsetParts[1], offsetParts[2]); + BlockVector3 min = new BlockVector3(offsetParts[0], offsetParts[1], offsetParts[2]); if (metadata.containsKey("WEOffsetX")) { // We appear to have WorldEdit Metadata int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue(); int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue(); int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue(); - Vector offset = new Vector(offsetX, offsetY, offsetZ); + BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ); origin = min.subtract(offset); - region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE)); + region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); } else { origin = min; - region = new CuboidRegion(origin, origin.add(width, height, length).subtract(Vector.ONE)); + region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE)); } int paletteMax = requireTag(schematic, "PaletteMax", IntTag.class).getValue(); @@ -151,7 +150,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue(); - Map> tileEntitiesMap = new HashMap<>(); + Map> tileEntitiesMap = new HashMap<>(); try { List> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream() .map(tag -> (CompoundTag) tag) @@ -160,7 +159,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { for (Map tileEntity : tileEntityTags) { int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); - tileEntitiesMap.put(new BlockVector(pos[0], pos[1], pos[2]).toBlockVector(), tileEntity); + tileEntitiesMap.put(new BlockVector3(pos[0], pos[1], pos[2]), tileEntity); } } catch (Exception e) { throw new IOException("Failed to load Tile Entities: " + e.getMessage()); @@ -193,7 +192,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { int z = (index % (width * length)) / width; int x = (index % (width * length)) % width; BlockState state = palette.get(value); - BlockVector pt = new BlockVector(x, y, z); + BlockVector3 pt = new BlockVector3(x, y, z); try { if (tileEntitiesMap.containsKey(pt)) { Map values = Maps.newHashMap(tileEntitiesMap.get(pt)); 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 8ed384e5e..629eb22ba 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 @@ -30,11 +30,10 @@ import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.ShortTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.world.block.BaseBlock; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -76,9 +75,9 @@ public class SpongeSchematicWriter implements ClipboardWriter { */ private Map write1(Clipboard clipboard) throws IOException { Region region = clipboard.getRegion(); - Vector origin = clipboard.getOrigin(); - Vector min = region.getMinimumPoint(); - Vector offset = min.subtract(origin); + BlockVector3 origin = clipboard.getOrigin(); + BlockVector3 min = region.getMinimumPoint(); + BlockVector3 offset = min.subtract(origin); int width = region.getWidth(); int height = region.getHeight(); int length = region.getLength(); @@ -127,7 +126,7 @@ public class SpongeSchematicWriter implements ClipboardWriter { int z0 = min.getBlockZ() + z; for (int x = 0; x < width; x++) { int x0 = min.getBlockX() + x; - BlockVector point = new BlockVector(x0, y0, z0); + BlockVector3 point = new BlockVector3(x0, y0, z0); BaseBlock block = clipboard.getFullBlock(point); if (block.getNbtData() != null) { Map values = new HashMap<>(); 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 95af3d0c8..21b790ee9 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 @@ -19,10 +19,10 @@ package com.sk89q.worldedit.extent.inventory; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -82,7 +82,7 @@ public class BlockBagExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException { if (blockBag != null) { BlockState existing = getExtent().getBlock(position); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index b819bcac4..92a3b6188 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -19,15 +19,14 @@ package com.sk89q.worldedit.extent.reorder; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; import com.sk89q.worldedit.function.operation.SetLocatedBlocks; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.collection.LocatedBlockList; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -49,11 +48,11 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { * Comparator optimized for sorting chunks by the region file they reside * in. This allows for file caches to be used while loading the chunk. */ - private static final Comparator REGION_OPTIMIZED_SORT = - Comparator.comparing(vec -> vec.divide(32).floor(), Vector2D.COMPARING_GRID_ARRANGEMENT) - .thenComparing(Vector2D.COMPARING_GRID_ARRANGEMENT); + private static final Comparator REGION_OPTIMIZED_SORT = + Comparator.comparing((BlockVector2 vec) -> vec.divide(32), BlockVector2.COMPARING_GRID_ARRANGEMENT) + .thenComparing(BlockVector2.COMPARING_GRID_ARRANGEMENT); - private final SortedMap batches = new TreeMap<>(REGION_OPTIMIZED_SORT); + private final SortedMap batches = new TreeMap<>(REGION_OPTIMIZED_SORT); private boolean enabled; public ChunkBatchingExtent(Extent extent) { @@ -74,11 +73,11 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (!enabled) { return getExtent().setBlock(location, block); } - BlockVector2D chunkPos = new BlockVector2D(location.getBlockX() >> 4, location.getBlockZ() >> 4); + BlockVector2 chunkPos = new BlockVector2(location.getBlockX() >> 4, location.getBlockZ() >> 4); batches.computeIfAbsent(chunkPos, k -> new LocatedBlockList()).add(location, block); return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index 3ef74dd7a..44eea7d45 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -20,8 +20,6 @@ package com.sk89q.worldedit.extent.reorder; import com.google.common.collect.Iterables; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.Blocks; import com.sk89q.worldedit.extent.AbstractDelegateExtent; @@ -30,6 +28,7 @@ import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.OperationQueue; import com.sk89q.worldedit.function.operation.RunContext; import com.sk89q.worldedit.function.operation.SetLocatedBlocks; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.LocatedBlock; import com.sk89q.worldedit.util.collection.LocatedBlockList; @@ -95,7 +94,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { BlockState existing = getBlock(location); if (!enabled) { @@ -104,18 +103,18 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder if (Blocks.shouldPlaceLast(block.getBlockType())) { // Place torches, etc. last - stage2.add(location.toBlockVector(), block); + stage2.add(location, block); return !existing.equalsFuzzy(block); } else if (Blocks.shouldPlaceFinal(block.getBlockType())) { // Place signs, reed, etc even later - stage3.add(location.toBlockVector(), block); + stage3.add(location, block); return !existing.equalsFuzzy(block); } else if (Blocks.shouldPlaceLast(existing.getBlockType())) { // Destroy torches, etc. first super.setBlock(location, BlockTypes.AIR.getDefaultState()); return super.setBlock(location, block); } else { - stage1.add(location.toBlockVector(), block); + stage1.add(location, block); return !existing.equalsFuzzy(block); } } @@ -135,21 +134,21 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder public Operation resume(RunContext run) throws WorldEditException { Extent extent = getExtent(); - final Set blocks = new HashSet<>(); - final Map blockTypes = new HashMap<>(); + final Set blocks = new HashSet<>(); + final Map blockTypes = new HashMap<>(); for (LocatedBlock entry : stage3) { - final BlockVector pt = entry.getLocation().toBlockVector(); + final BlockVector3 pt = entry.getLocation(); blocks.add(pt); blockTypes.put(pt, entry.getBlock()); } while (!blocks.isEmpty()) { - BlockVector current = blocks.iterator().next(); + BlockVector3 current = blocks.iterator().next(); if (!blocks.contains(current)) { continue; } - final Deque walked = new LinkedList<>(); + final Deque walked = new LinkedList<>(); while (true) { walked.addFirst(current); @@ -162,13 +161,13 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder Property halfProperty = blockStateHolder.getBlockType().getProperty("half"); if (blockStateHolder.getState(halfProperty).equals("lower")) { // Deal with lower door halves being attached to the floor AND the upper half - BlockVector upperBlock = current.add(0, 1, 0).toBlockVector(); + BlockVector3 upperBlock = current.add(0, 1, 0); if (blocks.contains(upperBlock) && !walked.contains(upperBlock)) { walked.addFirst(upperBlock); } } } else if (BlockCategories.RAILS.contains(blockStateHolder.getBlockType())) { - BlockVector lowerBlock = current.add(0, -1, 0).toBlockVector(); + BlockVector3 lowerBlock = current.add(0, -1, 0); if (blocks.contains(lowerBlock) && !walked.contains(lowerBlock)) { walked.addFirst(lowerBlock); } @@ -192,7 +191,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } } - for (BlockVector pt : walked) { + for (BlockVector3 pt : walked) { extent.setBlock(pt, blockTypes.get(pt)); blocks.remove(pt); } 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 6c1c93302..b0ecc66ae 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 @@ -22,16 +22,17 @@ package com.sk89q.worldedit.extent.transform; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.Sets; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.registry.state.BooleanProperty; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Transform; +import com.sk89q.worldedit.registry.state.BooleanProperty; import com.sk89q.worldedit.registry.state.DirectionalProperty; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Direction; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -84,17 +85,17 @@ public class BlockTransformExtent extends AbstractDelegateExtent { } @Override - public BlockState getBlock(Vector position) { + public BlockState getBlock(BlockVector3 position) { return transformBlock(super.getBlock(position), false); } @Override - public BaseBlock getFullBlock(Vector position) { + public BaseBlock getFullBlock(BlockVector3 position) { return transformBlock(super.getFullBlock(position), false); } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { return super.setBlock(location, transformBlock(block, true)); } @@ -132,7 +133,7 @@ public class BlockTransformExtent extends AbstractDelegateExtent { if (property instanceof DirectionalProperty) { Direction value = (Direction) block.getState(property); if (value != null) { - Vector newValue = getNewStateValue((DirectionalProperty) property, transform, value.toVector()); + Vector3 newValue = getNewStateValue((DirectionalProperty) property, transform, value.toVector()); if (newValue != null) { changedBlock = (T) changedBlock.with(property, Direction.findClosest(newValue, Direction.Flag.ALL)); } @@ -171,9 +172,9 @@ public class BlockTransformExtent extends AbstractDelegateExtent { * @return a new state or null if none could be found */ @Nullable - private static Vector getNewStateValue(DirectionalProperty state, Transform transform, Vector oldDirection) { - Vector newDirection = transform.apply(oldDirection).subtract(transform.apply(Vector.ZERO)).normalize(); - Vector newValue = null; + private static Vector3 getNewStateValue(DirectionalProperty state, Transform transform, Vector3 oldDirection) { + Vector3 newDirection = transform.apply(oldDirection).subtract(transform.apply(Vector3.ZERO)).normalize(); + Vector3 newValue = null; double closest = -2; boolean found = false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java index a25477235..48267a7be 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java @@ -22,10 +22,10 @@ package com.sk89q.worldedit.extent.validation; import static com.google.common.base.Preconditions.checkArgument; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; /** @@ -77,7 +77,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (limit >= 0) { if (count >= limit) { throw new MaxChangedBlocksException(limit); 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 ffb2b175a..64d27cd97 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 @@ -21,10 +21,10 @@ package com.sk89q.worldedit.extent.validation; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -49,7 +49,7 @@ public class DataValidatorExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { final int y = location.getBlockY(); final BlockType type = block.getBlockType(); if (y < 0 || y > world.getMaxY()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java index 25591defb..85ba63585 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java @@ -21,10 +21,10 @@ package com.sk89q.worldedit.extent.world; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -51,7 +51,7 @@ public class BlockQuirkExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException { BlockType existing = getExtent().getBlock(position).getBlockType(); if (existing.getMaterial().hasContainer()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java index 845276a58..c20177927 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java @@ -21,10 +21,10 @@ package com.sk89q.worldedit.extent.world; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -61,7 +61,7 @@ public class ChunkLoadingExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { world.checkLoadedChunk(location); return super.setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index 9ad839a32..7914762b5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -21,12 +21,12 @@ package com.sk89q.worldedit.extent.world; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -40,7 +40,7 @@ import java.util.Set; public class FastModeExtent extends AbstractDelegateExtent { private final World world; - private final Set dirtyChunks = new HashSet<>(); + private final Set dirtyChunks = new HashSet<>(); private boolean enabled = true; /** @@ -84,9 +84,9 @@ public class FastModeExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (enabled) { - dirtyChunks.add(new BlockVector2D(location.getBlockX() >> 4, location.getBlockZ() >> 4)); + dirtyChunks.add(new BlockVector2(location.getBlockX() >> 4, location.getBlockZ() >> 4)); return world.setBlock(location, block, false); } else { return world.setBlock(location, block, true); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java index 52fe0af5e..efb5a208f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java @@ -21,10 +21,10 @@ package com.sk89q.worldedit.extent.world; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -79,7 +79,7 @@ public class SurvivalModeExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (toolUse && block.getBlockType().getMaterial().isAir()) { world.simulateBlockMine(location); return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java index ba853eba9..b5dd22af2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.function; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.math.BlockVector3; import java.util.ArrayList; import java.util.Arrays; @@ -81,7 +81,7 @@ public class CombinedRegionFunction implements RegionFunction { } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { boolean ret = false; for (RegionFunction function : functions) { if (function.apply(position)) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionFunction.java index 41144fc8f..fa8e0f9da 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionFunction.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.function; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.FlatRegion; /** @@ -36,6 +36,6 @@ public interface FlatRegionFunction { * @return true if something was changed * @throws WorldEditException thrown on an error */ - boolean apply(Vector2D position) throws WorldEditException; + boolean apply(BlockVector2 position) throws WorldEditException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java index ff287632c..961a5721d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java @@ -21,12 +21,12 @@ package com.sk89q.worldedit.function; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.mask.Mask2D; +import com.sk89q.worldedit.math.BlockVector2; /** - * Passes calls to {@link #apply(com.sk89q.worldedit.Vector2D)} to the + * Passes calls to {@link #apply(BlockVector2)} to the * delegate {@link com.sk89q.worldedit.function.FlatRegionFunction} if they * match the given mask. */ @@ -50,7 +50,7 @@ public class FlatRegionMaskingFilter implements FlatRegionFunction { } @Override - public boolean apply(Vector2D position) throws WorldEditException { + public boolean apply(BlockVector2 position) throws WorldEditException { return mask.test(position) && function.apply(position); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java index 2b14b57b2..d3162ff13 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java @@ -21,9 +21,9 @@ package com.sk89q.worldedit.function; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.math.BlockVector3; /** * Applies a {@link RegionFunction} to the first ground block. @@ -76,12 +76,12 @@ public class GroundFunction implements LayerFunction { } @Override - public boolean isGround(Vector position) { + public boolean isGround(BlockVector3 position) { return mask.test(position); } @Override - public boolean apply(Vector position, int depth) throws WorldEditException { + public boolean apply(BlockVector3 position, int depth) throws WorldEditException { if (depth == 0) { if (function.apply(position)) { affected++; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/LayerFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/LayerFunction.java index bd9acb7cb..8d82f016f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/LayerFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/LayerFunction.java @@ -19,9 +19,9 @@ package com.sk89q.worldedit.function; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.visitor.LayerVisitor; +import com.sk89q.worldedit.math.BlockVector3; /** * A function that takes a position and a depth. @@ -35,7 +35,7 @@ public interface LayerFunction { * @param position return whether the given block is the ground * @return true if the search should stop */ - boolean isGround(Vector position); + boolean isGround(BlockVector3 position); /** * Apply the function to the given position. @@ -48,5 +48,5 @@ public interface LayerFunction { * @return true whether this method should be called for further layers * @throws WorldEditException thrown on an error */ - boolean apply(Vector position, int depth) throws WorldEditException; + boolean apply(BlockVector3 position, int depth) throws WorldEditException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java index 91276d237..332565e35 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.function; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.math.BlockVector3; /** * Performs a function on points in a region. @@ -34,6 +34,6 @@ public interface RegionFunction { * @return true if something was changed * @throws WorldEditException thrown on an error */ - boolean apply(Vector position) throws WorldEditException; + boolean apply(BlockVector3 position) throws WorldEditException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java index 673d411d2..cea580d8b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java @@ -21,12 +21,12 @@ package com.sk89q.worldedit.function; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.math.BlockVector3; /** - * Passes calls to {@link #apply(com.sk89q.worldedit.Vector)} to the + * Passes calls to {@link #apply(BlockVector3)} to the * delegate {@link com.sk89q.worldedit.function.RegionFunction} if they * match the given mask. */ @@ -49,7 +49,7 @@ public class RegionMaskingFilter implements RegionFunction { } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { return mask.test(position) && function.apply(position); } 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 ac5fdf98d..444f0e4e1 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 @@ -21,10 +21,10 @@ package com.sk89q.worldedit.function.biome; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.FlatRegionFunction; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.world.biome.BaseBiome; /** @@ -49,7 +49,7 @@ public class BiomeReplace implements FlatRegionFunction { } @Override - public boolean apply(Vector2D position) throws WorldEditException { + public boolean apply(BlockVector2 position) throws WorldEditException { return extent.setBiome(position, biome); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java index 8d282e9c3..258e02871 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.function.block; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.RegionFunction; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -47,7 +47,7 @@ public class BlockDistributionCounter implements RegionFunction { } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { BlockStateHolder blk = extent.getBlock(position); if (fuzzy) { blk = ((BlockState) blk).toFuzzy(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java index 0013ade94..fbc0c9acf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java @@ -21,11 +21,11 @@ package com.sk89q.worldedit.function.block; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; /** * Replaces blocks with a given pattern. @@ -49,7 +49,7 @@ public class BlockReplace implements RegionFunction { } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { return extent.setBlock(position, pattern.apply(position)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Counter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Counter.java index 8c5cd8001..06b5284bd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Counter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Counter.java @@ -19,17 +19,18 @@ package com.sk89q.worldedit.function.block; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; +import com.sk89q.worldedit.math.BlockVector3; /** - * Keeps a count of the number of times that {@link #apply(Vector)} is called. + * Keeps a count of the number of times that {@link #apply(BlockVector3)} is + * called. */ - public class Counter implements RegionFunction { +public class Counter implements RegionFunction { private int count; - + /** * Returns the number of blocks that have been counted. * @@ -40,7 +41,7 @@ import com.sk89q.worldedit.function.RegionFunction; } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { count++; return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java index 223b419b3..1e5c62873 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java @@ -23,15 +23,16 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTagBuilder; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.internal.helper.MCDirections; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Direction.Flag; +import com.sk89q.worldedit.world.block.BaseBlock; /** * Copies blocks from one extent to another. @@ -40,8 +41,8 @@ public class ExtentBlockCopy implements RegionFunction { private final Extent source; private final Extent destination; - private final Vector from; - private final Vector to; + private final BlockVector3 from; + private final BlockVector3 to; private final Transform transform; /** @@ -53,7 +54,7 @@ public class ExtentBlockCopy implements RegionFunction { * @param to the destination offset * @param transform a transform to apply to positions (after source offset, before destination offset) */ - public ExtentBlockCopy(Extent source, Vector from, Extent destination, Vector to, Transform transform) { + public ExtentBlockCopy(Extent source, BlockVector3 from, Extent destination, BlockVector3 to, Transform transform) { checkNotNull(source); checkNotNull(from); checkNotNull(destination); @@ -67,10 +68,10 @@ public class ExtentBlockCopy implements RegionFunction { } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { BaseBlock block = source.getFullBlock(position); - Vector orig = position.subtract(from); - Vector transformed = transform.apply(orig); + BlockVector3 orig = position.subtract(from); + BlockVector3 transformed = transform.apply(orig.toVector3()).toBlockPoint(); // Apply transformations to NBT data if necessary block = transformNbtData(block); @@ -96,7 +97,7 @@ public class ExtentBlockCopy implements RegionFunction { Direction direction = MCDirections.fromRotation(rot); if (direction != null) { - Vector vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector.ZERO)).normalize(); + Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize(); Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL | Flag.ORDINAL | Flag.SECONDARY_ORDINAL); if (newDirection != null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java index ba2cf9a3d..c4c72951e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java @@ -22,11 +22,11 @@ package com.sk89q.worldedit.function.block; import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.LayerFunction; import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockTypes; /** @@ -61,12 +61,12 @@ public class Naturalizer implements LayerFunction { } @Override - public boolean isGround(Vector position) { + public boolean isGround(BlockVector3 position) { return mask.test(position); } @Override - public boolean apply(Vector position, int depth) throws WorldEditException { + public boolean apply(BlockVector3 position, int depth) throws WorldEditException { if (mask.test(position)) { affected++; switch (depth) { 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 e157de444..af33fecbf 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 @@ -23,13 +23,14 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTagBuilder; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.EntityFunction; import com.sk89q.worldedit.internal.helper.MCDirections; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Direction.Flag; @@ -42,8 +43,8 @@ import com.sk89q.worldedit.util.Location; public class ExtentEntityCopy implements EntityFunction { private final Extent destination; - private final Vector from; - private final Vector to; + private final Vector3 from; + private final Vector3 to; private final Transform transform; private boolean removing; @@ -55,7 +56,7 @@ public class ExtentEntityCopy implements EntityFunction { * @param to the destination position * @param transform the transformation to apply to both position and orientation */ - public ExtentEntityCopy(Vector from, Extent destination, Vector to, Transform transform) { + public ExtentEntityCopy(Vector3 from, Extent destination, Vector3 to, Transform transform) { checkNotNull(from); checkNotNull(destination); checkNotNull(to); @@ -91,13 +92,13 @@ public class ExtentEntityCopy implements EntityFunction { Location newLocation; Location location = entity.getLocation(); - Vector pivot = from.round().add(0.5, 0.5, 0.5); - Vector newPosition = transform.apply(location.toVector().subtract(pivot)); - Vector newDirection; + Vector3 pivot = from.round().add(0.5, 0.5, 0.5); + Vector3 newPosition = transform.apply(location.toVector().subtract(pivot)); + Vector3 newDirection; newDirection = transform.isIdentity() ? entity.getLocation().getDirection() - : transform.apply(location.getDirection()).subtract(transform.apply(Vector.ZERO)).normalize(); + : transform.apply(location.getDirection()).subtract(transform.apply(Vector3.ZERO)).normalize(); newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection); // Some entities store their position data in NBT @@ -134,8 +135,8 @@ public class ExtentEntityCopy implements EntityFunction { boolean hasFacing = tag.containsKey("Facing"); if (hasTilePosition) { - Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); - Vector newTilePosition = transform.apply(tilePosition.subtract(from)).add(to); + Vector3 tilePosition = new Vector3(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); + BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint(); CompoundTagBuilder builder = tag.createBuilder() .putInt("TileX", newTilePosition.getBlockX()) @@ -155,7 +156,7 @@ public class ExtentEntityCopy implements EntityFunction { Direction direction = MCDirections.fromHanging(d); if (direction != null) { - Vector vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector.ZERO)).normalize(); + Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize(); Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL); if (newDirection != null) { 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 d80ad4570..ac52933be 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 @@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; @@ -32,6 +31,7 @@ import com.sk89q.worldedit.function.EditContext; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; import com.sk89q.worldedit.internal.expression.ExpressionException; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.NullRegion; import com.sk89q.worldedit.regions.Region; @@ -43,7 +43,7 @@ public class Deform implements Contextual { private Region region; private String expression; private Mode mode = Mode.UNIT_CUBE; - private Vector offset = new Vector(); + private Vector3 offset = Vector3.ZERO; public Deform(String expression) { this(new NullExtent(), new NullRegion(), expression); @@ -104,11 +104,11 @@ public class Deform implements Contextual { this.mode = mode; } - public Vector getOffset() { + public Vector3 getOffset() { return offset; } - public void setOffset(Vector offset) { + public void setOffset(Vector3 offset) { checkNotNull(offset, "offset"); this.offset = offset; } @@ -120,31 +120,31 @@ public class Deform implements Contextual { @Override public Operation createFromContext(final EditContext context) { - final Vector zero; - Vector unit; + final Vector3 zero; + Vector3 unit; Region region = firstNonNull(context.getRegion(), this.region); switch (mode) { case UNIT_CUBE: - final Vector min = region.getMinimumPoint(); - final Vector max = region.getMaximumPoint(); + final Vector3 min = region.getMinimumPoint().toVector3(); + final Vector3 max = region.getMaximumPoint().toVector3(); zero = max.add(min).multiply(0.5); unit = max.subtract(zero); - if (unit.getX() == 0) unit = unit.setX(1.0); - if (unit.getY() == 0) unit = unit.setY(1.0); - if (unit.getZ() == 0) unit = unit.setZ(1.0); + if (unit.getX() == 0) unit = unit.withX(1.0); + if (unit.getY() == 0) unit = unit.withY(1.0); + if (unit.getZ() == 0) unit = unit.withZ(1.0); break; case RAW_COORD: - zero = Vector.ZERO; - unit = Vector.ONE; + zero = Vector3.ZERO; + unit = Vector3.ONE; break; case OFFSET: default: zero = offset; - unit = Vector.ONE; + unit = Vector3.ONE; } return new DeformOperation(context.getDestination(), region, zero, unit, expression); @@ -153,11 +153,11 @@ public class Deform implements Contextual { private static final class DeformOperation implements Operation { private final Extent destination; private final Region region; - private final Vector zero; - private final Vector unit; + private final Vector3 zero; + private final Vector3 unit; private final String expression; - private DeformOperation(Extent destination, Region region, Vector zero, Vector unit, String expression) { + private DeformOperation(Extent destination, Region region, Vector3 zero, Vector3 unit, String expression) { this.destination = destination; this.region = region; this.zero = zero; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java index 3f6265de7..506dc218f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java @@ -20,12 +20,12 @@ package com.sk89q.worldedit.function.generator; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.RandomPattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; @@ -103,7 +103,7 @@ public class FloraGenerator implements RegionFunction { } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { BlockStateHolder block = editSession.getBlock(position); if (block.getBlockType() == BlockTypes.GRASS_BLOCK) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java index bf37a4d9c..3e63aa83a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java @@ -20,9 +20,9 @@ package com.sk89q.worldedit.function.generator; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -49,7 +49,7 @@ public class ForestGenerator implements RegionFunction { } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { BlockStateHolder block = editSession.getBlock(position); BlockType t = block.getBlockType(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java index 48f85b841..a8d154955 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java @@ -21,11 +21,11 @@ package com.sk89q.worldedit.function.generator; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; @@ -84,12 +84,12 @@ public class GardenPatchGenerator implements RegionFunction { * @param basePos the base position * @param pos the vine position */ - private void placeVine(Vector basePos, Vector pos) throws MaxChangedBlocksException { + private void placeVine(BlockVector3 basePos, BlockVector3 pos) throws MaxChangedBlocksException { if (pos.distance(basePos) > 4) return; if (!editSession.getBlock(pos).getBlockType().getMaterial().isAir()) return; for (int i = -1; i > -3; --i) { - Vector testPos = pos.add(0, i, 0); + BlockVector3 testPos = pos.add(0, i, 0); if (editSession.getBlock(testPos).getBlockType().getMaterial().isAir()) { pos = testPos; } else { @@ -102,7 +102,7 @@ public class GardenPatchGenerator implements RegionFunction { int t = random.nextInt(4); int h = random.nextInt(3) - 1; - Vector p; + BlockVector3 p; BlockState log = BlockTypes.OAK_LOG.getDefaultState(); @@ -158,7 +158,7 @@ public class GardenPatchGenerator implements RegionFunction { } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { if (!editSession.getBlock(position).getBlockType().getMaterial().isAir()) { position = position.add(0, 1, 0); } @@ -198,7 +198,7 @@ public class GardenPatchGenerator implements RegionFunction { * @return if block was changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - private static boolean setBlockIfAir(EditSession session, Vector position, BlockStateHolder block) throws MaxChangedBlocksException { + private static boolean setBlockIfAir(EditSession session, BlockVector3 position, BlockStateHolder block) throws MaxChangedBlocksException { return session.getBlock(position).getBlockType().getMaterial().isAir() && session.setBlock(position, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java index d7bf33c8a..9b04d871d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.world.biome.BaseBiome; import java.util.Arrays; @@ -90,7 +90,7 @@ public class BiomeMask2D extends AbstractMask2D { } @Override - public boolean test(Vector2D vector) { + public boolean test(BlockVector2 vector) { BaseBiome biome = extent.getBiome(vector); return biomes.contains(biome); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java index fae7888a0..625d8b781 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockCategory; import javax.annotation.Nullable; @@ -41,7 +41,7 @@ public class BlockCategoryMask extends AbstractExtentMask { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { return category.contains(getExtent().getBlock(vector)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java index d200f3f30..839f377ef 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.Arrays; @@ -94,7 +94,7 @@ public class BlockMask extends AbstractExtentMask { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { BlockStateHolder block = getExtent().getBlock(vector); for (BlockStateHolder testBlock : blocks) { if (testBlock.equalsFuzzy(block)) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java index 0e2ab590e..d388fef67 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockType; import java.util.Arrays; @@ -94,7 +94,7 @@ public class BlockTypeMask extends AbstractExtentMask { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { return blocks.contains(getExtent().getBlock(vector).getBlockType()); } 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 3622926e3..2f72d5a1d 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 @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkArgument; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import javax.annotation.Nullable; @@ -47,7 +47,7 @@ public class BoundedHeightMask extends AbstractMask { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { return vector.getY() >= minY && vector.getY() <= maxY; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java index 911b4ce69..ac4d24452 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import javax.annotation.Nullable; @@ -40,7 +40,7 @@ public class ExistingBlockMask extends AbstractExtentMask { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { return !getExtent().getBlock(vector).getBlockType().getMaterial().isAir(); } 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 d662e0fa3..9f597e267 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 @@ -21,10 +21,10 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; import javax.annotation.Nullable; @@ -61,10 +61,10 @@ public class ExpressionMask extends AbstractMask { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { try { if (expression.getEnvironment() instanceof WorldEditExpressionEnvironment) { - ((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector); + ((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector.toVector3()); } return expression.evaluate(vector.getX(), vector.getY(), vector.getZ()) > 0; } catch (EvaluationException e) { 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 2b4031ca8..ffc6c9a94 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 @@ -21,10 +21,10 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; +import com.sk89q.worldedit.math.BlockVector2; public class ExpressionMask2D extends AbstractMask2D { @@ -52,7 +52,7 @@ public class ExpressionMask2D extends AbstractMask2D { } @Override - public boolean test(Vector2D vector) { + public boolean test(BlockVector2 vector) { try { return expression.evaluate(vector.getX(), 0, vector.getZ()) > 0; } catch (EvaluationException e) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java index 96b4af82b..16a9a7c70 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import javax.annotation.Nullable; @@ -34,7 +34,7 @@ public interface Mask { * @param vector the vector to test * @return true if the criteria is met */ - boolean test(Vector vector); + boolean test(BlockVector3 vector); /** * Get the 2D version of this mask if one exists. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask2D.java index ad48dcb5e..3e48a0e9a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask2D.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; /** * Tests whether a given vector meets a criteria. @@ -32,6 +32,6 @@ public interface Mask2D { * @param vector the vector to test * @return true if the criteria is met */ - boolean test(Vector2D vector); + boolean test(BlockVector2 vector); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java index 5968b3b6c..bd7d49ad0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import java.util.ArrayList; import java.util.Arrays; @@ -89,7 +89,7 @@ public class MaskIntersection extends AbstractMask { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { if (masks.isEmpty()) { return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java index 07e43be38..eec35eab9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; import java.util.Arrays; import java.util.Collection; @@ -83,7 +83,7 @@ public class MaskIntersection2D implements Mask2D { } @Override - public boolean test(Vector2D vector) { + public boolean test(BlockVector2 vector) { if (masks.isEmpty()) { return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java index a54794255..3a301a874 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import java.util.ArrayList; import java.util.Collection; @@ -53,7 +53,7 @@ public class MaskUnion extends MaskIntersection { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { Collection masks = getMasks(); for (Mask mask : masks) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion2D.java index 099dc9a05..678fcbdd4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion2D.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; import java.util.Collection; @@ -47,7 +47,7 @@ public class MaskUnion2D extends MaskIntersection2D { } @Override - public boolean test(Vector2D vector) { + public boolean test(BlockVector2 vector) { Collection masks = getMasks(); for (Mask2D mask : masks) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java index 007520485..f2375de83 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import javax.annotation.Nullable; @@ -71,7 +71,7 @@ public final class Masks { checkNotNull(mask); return new AbstractMask() { @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { return !mask.test(vector); } @@ -104,7 +104,7 @@ public final class Masks { checkNotNull(mask); return new AbstractMask2D() { @Override - public boolean test(Vector2D vector) { + public boolean test(BlockVector2 vector) { return !mask.test(vector); } }; @@ -119,8 +119,8 @@ public final class Masks { public static Mask asMask(final Mask2D mask) { return new AbstractMask() { @Override - public boolean test(Vector vector) { - return mask.test(vector.toVector2D()); + public boolean test(BlockVector3 vector) { + return mask.test(vector.toBlockVector2()); } @Nullable @@ -133,12 +133,12 @@ public final class Masks { private static class AlwaysTrue implements Mask, Mask2D { @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { return true; } @Override - public boolean test(Vector2D vector) { + public boolean test(BlockVector2 vector) { return true; } @@ -151,12 +151,12 @@ public final class Masks { private static class AlwaysFalse implements Mask, Mask2D { @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { return false; } @Override - public boolean test(Vector2D vector) { + public boolean test(BlockVector2 vector) { 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 04c793bde..ee9b6e44d 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 @@ -22,7 +22,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.noise.NoiseGenerator; import javax.annotation.Nullable; @@ -85,8 +85,8 @@ public class NoiseFilter extends AbstractMask { } @Override - public boolean test(Vector vector) { - return noiseGenerator.noise(vector) <= density; + public boolean test(BlockVector3 vector) { + return noiseGenerator.noise(vector.toVector3()) <= density; } @Nullable diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java index fdcbcd59b..a64889f54 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.noise.NoiseGenerator; /** @@ -83,8 +83,8 @@ public class NoiseFilter2D extends AbstractMask2D { } @Override - public boolean test(Vector2D pos) { - return noiseGenerator.noise(pos) <= density; + public boolean test(BlockVector2 pos) { + return noiseGenerator.noise(pos.toVector2()) <= density; } } 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 d8d3d455f..e5df3b153 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 @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import javax.annotation.Nullable; @@ -32,7 +32,7 @@ import javax.annotation.Nullable; public class OffsetMask extends AbstractMask { private Mask mask; - private Vector offset; + private BlockVector3 offset; /** * Create a new instance. @@ -40,7 +40,7 @@ public class OffsetMask extends AbstractMask { * @param mask the mask * @param offset the offset */ - public OffsetMask(Mask mask, Vector offset) { + public OffsetMask(Mask mask, BlockVector3 offset) { checkNotNull(mask); checkNotNull(offset); this.mask = mask; @@ -71,7 +71,7 @@ public class OffsetMask extends AbstractMask { * * @return the offset */ - public Vector getOffset() { + public BlockVector3 getOffset() { return offset; } @@ -80,13 +80,13 @@ public class OffsetMask extends AbstractMask { * * @param offset the offset */ - public void setOffset(Vector offset) { + public void setOffset(BlockVector3 offset) { checkNotNull(offset); this.offset = offset; } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { return getMask().test(vector.add(offset)); } @@ -95,7 +95,7 @@ public class OffsetMask extends AbstractMask { public Mask2D toMask2D() { Mask2D childMask = getMask().toMask2D(); if (childMask != null) { - return new OffsetMask2D(childMask, getOffset().toVector2D()); + return new OffsetMask2D(childMask, getOffset().toBlockVector2()); } else { return null; } 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 74daead9d..94b595fdf 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 @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; /** * Checks whether another mask tests true for a position that is offset @@ -30,7 +30,7 @@ import com.sk89q.worldedit.Vector2D; public class OffsetMask2D extends AbstractMask2D { private Mask2D mask; - private Vector2D offset; + private BlockVector2 offset; /** * Create a new instance. @@ -38,7 +38,7 @@ public class OffsetMask2D extends AbstractMask2D { * @param mask the mask * @param offset the offset */ - public OffsetMask2D(Mask2D mask, Vector2D offset) { + public OffsetMask2D(Mask2D mask, BlockVector2 offset) { checkNotNull(mask); checkNotNull(offset); this.mask = mask; @@ -69,7 +69,7 @@ public class OffsetMask2D extends AbstractMask2D { * * @return the offset */ - public Vector2D getOffset() { + public BlockVector2 getOffset() { return offset; } @@ -78,13 +78,13 @@ public class OffsetMask2D extends AbstractMask2D { * * @param offset the offset */ - public void setOffset(Vector2D offset) { + public void setOffset(BlockVector2 offset) { checkNotNull(offset); this.offset = offset; } @Override - public boolean test(Vector2D vector) { + public boolean test(BlockVector2 vector) { return getMask().test(vector.add(offset)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java index 7d2d78dfc..28df2c206 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import javax.annotation.Nullable; @@ -62,7 +62,7 @@ public class RegionMask extends AbstractMask { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { return region.contains(vector); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java index 917c22f36..b8ea48288 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockState; import javax.annotation.Nullable; @@ -32,7 +32,7 @@ public class SolidBlockMask extends AbstractExtentMask { } @Override - public boolean test(Vector vector) { + public boolean test(BlockVector3 vector) { Extent extent = getExtent(); BlockState block = extent.getBlock(vector); return block.getBlockType().getMaterial().isMovementBlocker(); 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 3a9a38d4e..77037c7df 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 @@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.Lists; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.metadata.EntityProperties; @@ -37,6 +36,8 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.visitor.EntityVisitor; import com.sk89q.worldedit.function.visitor.RegionVisitor; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Identity; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.regions.Region; @@ -55,8 +56,8 @@ public class ForwardExtentCopy implements Operation { private final Extent source; private final Extent destination; private final Region region; - private final Vector from; - private final Vector to; + private final BlockVector3 from; + private final BlockVector3 to; private int repetitions = 1; private Mask sourceMask = Masks.alwaysTrue(); private boolean removingEntities; @@ -75,9 +76,9 @@ public class ForwardExtentCopy implements Operation { * @param region the region to copy * @param destination the destination extent * @param to the destination position - * @see #ForwardExtentCopy(Extent, Region, Vector, Extent, Vector) the main constructor + * @see #ForwardExtentCopy(Extent, Region, BlockVector3, Extent, BlockVector3) the main constructor */ - public ForwardExtentCopy(Extent source, Region region, Extent destination, Vector to) { + public ForwardExtentCopy(Extent source, Region region, Extent destination, BlockVector3 to) { this(source, region, region.getMinimumPoint(), destination, to); } @@ -90,7 +91,7 @@ public class ForwardExtentCopy implements Operation { * @param destination the destination extent * @param to the destination position */ - public ForwardExtentCopy(Extent source, Region region, Vector from, Extent destination, Vector to) { + public ForwardExtentCopy(Extent source, Region region, BlockVector3 from, Extent destination, BlockVector3 to) { checkNotNull(source); checkNotNull(region); checkNotNull(from); @@ -255,7 +256,7 @@ public class ForwardExtentCopy implements Operation { lastVisitor = blockVisitor; if (copyingEntities) { - ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform); + ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform); entityCopy.setRemoving(removingEntities); List entities = Lists.newArrayList(source.getEntities(region)); entities.removeIf(entity -> { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java index c45b90986..2a0edba8c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.pattern; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -61,7 +61,7 @@ public class BlockPattern extends AbstractPattern { } @Override - public BlockStateHolder apply(Vector position) { + public BlockStateHolder apply(BlockVector3 position) { return block; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java index 6f08d5b34..7159d13e2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.function.pattern; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; /** @@ -31,7 +31,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; public class ClipboardPattern extends AbstractPattern { private final Clipboard clipboard; - private final Vector size; + private final BlockVector3 size; /** * Create a new clipboard pattern. @@ -45,12 +45,12 @@ public class ClipboardPattern extends AbstractPattern { } @Override - public BlockStateHolder apply(Vector position) { + public BlockStateHolder apply(BlockVector3 position) { int xp = Math.abs(position.getBlockX()) % size.getBlockX(); int yp = Math.abs(position.getBlockY()) % size.getBlockY(); int zp = Math.abs(position.getBlockZ()) % size.getBlockZ(); - return clipboard.getFullBlock(clipboard.getMinimumPoint().add(new Vector(xp, yp, zp))); + return clipboard.getFullBlock(clipboard.getMinimumPoint().add(xp, yp, zp)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java index 5b73f720b..75c5cf20b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.function.pattern; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; /** @@ -33,6 +33,6 @@ public interface Pattern { * @param position the position * @return a block */ - BlockStateHolder apply(Vector position); + BlockStateHolder apply(BlockVector3 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 c28c147f9..acdcdd662 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 @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.pattern; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.ArrayList; @@ -53,7 +53,7 @@ public class RandomPattern extends AbstractPattern { } @Override - public BlockStateHolder apply(Vector position) { + public BlockStateHolder apply(BlockVector3 position) { double r = random.nextDouble(); double offset = 0; 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 659fef612..54434f1b0 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 @@ -21,8 +21,8 @@ package com.sk89q.worldedit.function.pattern; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; /** @@ -31,7 +31,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; public class RepeatingExtentPattern extends AbstractPattern { private Extent extent; - private Vector offset; + private BlockVector3 offset; /** * Create a new instance. @@ -39,7 +39,7 @@ public class RepeatingExtentPattern extends AbstractPattern { * @param extent the extent * @param offset the offset */ - public RepeatingExtentPattern(Extent extent, Vector offset) { + public RepeatingExtentPattern(Extent extent, BlockVector3 offset) { setExtent(extent); setOffset(offset); } @@ -68,7 +68,7 @@ public class RepeatingExtentPattern extends AbstractPattern { * * @return the offset */ - public Vector getOffset() { + public BlockVector3 getOffset() { return offset; } @@ -77,19 +77,19 @@ public class RepeatingExtentPattern extends AbstractPattern { * * @param offset the offset */ - public void setOffset(Vector offset) { + public void setOffset(BlockVector3 offset) { checkNotNull(offset); this.offset = offset; } @Override - public BlockStateHolder apply(Vector position) { - Vector base = position.add(offset); - Vector size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1); + public BlockStateHolder apply(BlockVector3 position) { + BlockVector3 base = position.add(offset); + BlockVector3 size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1); int x = base.getBlockX() % size.getBlockX(); int y = base.getBlockY() % size.getBlockY(); int z = base.getBlockZ() % size.getBlockZ(); - return extent.getFullBlock(new Vector(x, y, z)); + return extent.getFullBlock(new BlockVector3(x, y, z)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java index 6a21a50c3..9682ff378 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java @@ -21,16 +21,16 @@ package com.sk89q.worldedit.function.util; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.FlatRegionFunction; +import com.sk89q.worldedit.math.BlockVector2; /** * Offsets the position parameter by adding a given offset vector. */ public class FlatRegionOffset implements FlatRegionFunction { - private Vector2D offset; + private BlockVector2 offset; private final FlatRegionFunction function; /** @@ -39,7 +39,7 @@ public class FlatRegionOffset implements FlatRegionFunction { * @param offset the offset * @param function the function that is called with the offset position */ - public FlatRegionOffset(Vector2D offset, FlatRegionFunction function) { + public FlatRegionOffset(BlockVector2 offset, FlatRegionFunction function) { checkNotNull(function); setOffset(offset); this.function = function; @@ -50,7 +50,7 @@ public class FlatRegionOffset implements FlatRegionFunction { * * @return the offset */ - public Vector2D getOffset() { + public BlockVector2 getOffset() { return offset; } @@ -59,13 +59,13 @@ public class FlatRegionOffset implements FlatRegionFunction { * * @param offset the offset */ - public void setOffset(Vector2D offset) { + public void setOffset(BlockVector2 offset) { checkNotNull(offset); this.offset = offset; } @Override - public boolean apply(Vector2D position) throws WorldEditException { + public boolean apply(BlockVector2 position) throws WorldEditException { return function.apply(position.add(offset)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java index c1f395be6..7ac57da1f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java @@ -21,16 +21,16 @@ package com.sk89q.worldedit.function.util; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; +import com.sk89q.worldedit.math.BlockVector3; /** * Offsets the position parameter by adding a given offset vector. */ public class RegionOffset implements RegionFunction { - private Vector offset; + private BlockVector3 offset; private final RegionFunction function; /** @@ -39,7 +39,7 @@ public class RegionOffset implements RegionFunction { * @param offset the offset * @param function the function that is called with the offset position */ - public RegionOffset(Vector offset, RegionFunction function) { + public RegionOffset(BlockVector3 offset, RegionFunction function) { checkNotNull(function); setOffset(offset); this.function = function; @@ -50,7 +50,7 @@ public class RegionOffset implements RegionFunction { * * @return the offset */ - public Vector getOffset() { + public BlockVector3 getOffset() { return offset; } @@ -59,13 +59,13 @@ public class RegionOffset implements RegionFunction { * * @param offset the offset */ - public void setOffset(Vector offset) { + public void setOffset(BlockVector3 offset) { checkNotNull(offset); this.offset = offset; } @Override - public boolean apply(Vector position) throws WorldEditException { + public boolean apply(BlockVector3 position) throws WorldEditException { return function.apply(position.add(offset)); } 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 1601caf40..c1ff8e53b 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 @@ -21,12 +21,11 @@ package com.sk89q.worldedit.function.visitor; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; +import com.sk89q.worldedit.math.BlockVector3; import java.util.ArrayDeque; import java.util.ArrayList; @@ -38,9 +37,9 @@ import java.util.Set; /** * Performs a breadth-first search starting from points added with - * {@link #visit(com.sk89q.worldedit.Vector)}. The search continues + * {@link #visit(BlockVector3)}. The search continues * to a certain adjacent point provided that the method - * {@link #isVisitable(com.sk89q.worldedit.Vector, com.sk89q.worldedit.Vector)} + * {@link #isVisitable(BlockVector3, BlockVector3)} * returns true for that point. * *

As an abstract implementation, this class can be used to implement @@ -50,9 +49,9 @@ import java.util.Set; public abstract class BreadthFirstSearch implements Operation { private final RegionFunction function; - private final Queue queue = new ArrayDeque<>(); - private final Set visited = new HashSet<>(); - private final List directions = new ArrayList<>(); + private final Queue queue = new ArrayDeque<>(); + private final Set visited = new HashSet<>(); + private final List directions = new ArrayList<>(); private int affected = 0; /** @@ -69,16 +68,16 @@ public abstract class BreadthFirstSearch implements Operation { /** * Get the list of directions will be visited. * - *

Directions are {@link com.sk89q.worldedit.Vector}s that determine + *

Directions are {@link BlockVector3}s that determine * what adjacent points area available. Vectors should not be * unit vectors. An example of a valid direction is - * {@code new Vector(1, 0, 1)}.

+ * {@code new BlockVector3(1, 0, 1)}.

* *

The list of directions can be cleared.

* * @return the list of directions */ - protected Collection getDirections() { + protected Collection getDirections() { return directions; } @@ -86,29 +85,29 @@ public abstract class BreadthFirstSearch implements Operation { * Add the directions along the axes as directions to visit. */ protected void addAxes() { - directions.add(new Vector(0, -1, 0)); - directions.add(new Vector(0, 1, 0)); - directions.add(new Vector(-1, 0, 0)); - directions.add(new Vector(1, 0, 0)); - directions.add(new Vector(0, 0, -1)); - directions.add(new Vector(0, 0, 1)); + directions.add(new BlockVector3(0, -1, 0)); + directions.add(new BlockVector3(0, 1, 0)); + directions.add(new BlockVector3(-1, 0, 0)); + directions.add(new BlockVector3(1, 0, 0)); + directions.add(new BlockVector3(0, 0, -1)); + directions.add(new BlockVector3(0, 0, 1)); } /** * Add the diagonal directions as directions to visit. */ protected void addDiagonal() { - directions.add(new Vector(1, 0, 1)); - directions.add(new Vector(-1, 0, -1)); - directions.add(new Vector(1, 0, -1)); - directions.add(new Vector(-1, 0, 1)); + directions.add(new BlockVector3(1, 0, 1)); + directions.add(new BlockVector3(-1, 0, -1)); + directions.add(new BlockVector3(1, 0, -1)); + directions.add(new BlockVector3(-1, 0, 1)); } /** * Add the given location to the list of locations to visit, provided * that it has not been visited. The position passed to this method * will still be visited even if it fails - * {@link #isVisitable(com.sk89q.worldedit.Vector, com.sk89q.worldedit.Vector)}. + * {@link #isVisitable(BlockVector3, BlockVector3)}. * *

This method should be used before the search begins, because if * the position does fail the test, and the search has already @@ -118,8 +117,8 @@ public abstract class BreadthFirstSearch implements Operation { * * @param position the position */ - public void visit(Vector position) { - BlockVector blockVector = position.toBlockVector(); + public void visit(BlockVector3 position) { + BlockVector3 blockVector = position; if (!visited.contains(blockVector)) { queue.add(blockVector); visited.add(blockVector); @@ -132,8 +131,8 @@ public abstract class BreadthFirstSearch implements Operation { * @param from the origin block * @param to the block under question */ - private void visit(Vector from, Vector to) { - BlockVector blockVector = to.toBlockVector(); + private void visit(BlockVector3 from, BlockVector3 to) { + BlockVector3 blockVector = to; if (!visited.contains(blockVector)) { visited.add(blockVector); if (isVisitable(from, to)) { @@ -150,7 +149,7 @@ public abstract class BreadthFirstSearch implements Operation { * @param to the block under question * @return true if the 'to' block should be visited */ - protected abstract boolean isVisitable(Vector from, Vector to); + protected abstract boolean isVisitable(BlockVector3 from, BlockVector3 to); /** * Get the number of affected objects. @@ -163,14 +162,14 @@ public abstract class BreadthFirstSearch implements Operation { @Override public Operation resume(RunContext run) throws WorldEditException { - Vector position; + BlockVector3 position; while ((position = queue.poll()) != null) { if (function.apply(position)) { affected++; } - for (Vector dir : directions) { + for (BlockVector3 dir : directions) { visit(position, position.add(dir)); } } 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 3788d547d..62363a205 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 @@ -21,9 +21,9 @@ package com.sk89q.worldedit.function.visitor; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.math.BlockVector3; import java.util.Collection; @@ -51,17 +51,17 @@ public class DownwardVisitor extends RecursiveVisitor { this.baseY = baseY; - Collection directions = getDirections(); + Collection directions = getDirections(); directions.clear(); - directions.add(new Vector(1, 0, 0)); - directions.add(new Vector(-1, 0, 0)); - directions.add(new Vector(0, 0, 1)); - directions.add(new Vector(0, 0, -1)); - directions.add(new Vector(0, -1, 0)); + directions.add(new BlockVector3(1, 0, 0)); + directions.add(new BlockVector3(-1, 0, 0)); + directions.add(new BlockVector3(0, 0, 1)); + directions.add(new BlockVector3(0, 0, -1)); + directions.add(new BlockVector3(0, -1, 0)); } @Override - protected boolean isVisitable(Vector from, Vector to) { + protected boolean isVisitable(BlockVector3 from, BlockVector3 to) { int fromY = from.getBlockY(); return (fromY == baseY || to.subtract(from).getBlockY() < 0) && super.isVisitable(from, to); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java index 1f0d96e42..46ef33dc0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java @@ -21,11 +21,11 @@ package com.sk89q.worldedit.function.visitor; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.FlatRegionFunction; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.FlatRegion; import java.util.List; @@ -64,7 +64,7 @@ public class FlatRegionVisitor implements Operation { @Override public Operation resume(RunContext run) throws WorldEditException { - for (Vector2D pt : flatRegion.asFlatRegion()) { + for (BlockVector2 pt : flatRegion.asFlatRegion()) { if (function.apply(pt)) { affected++; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java index b6dcf4882..f3a191e12 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java @@ -22,14 +22,14 @@ package com.sk89q.worldedit.function.visitor; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.LayerFunction; import com.sk89q.worldedit.function.mask.Mask2D; import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.FlatRegion; import java.util.List; @@ -92,20 +92,20 @@ public class LayerVisitor implements Operation { @Override public Operation resume(RunContext run) throws WorldEditException { - for (Vector2D column : flatRegion.asFlatRegion()) { + for (BlockVector2 column : flatRegion.asFlatRegion()) { if (!mask.test(column)) { continue; } // Abort if we are underground - if (function.isGround(column.toVector(maxY + 1))) { + if (function.isGround(column.toBlockVector3(maxY + 1))) { return null; } boolean found = false; int groundY = 0; for (int y = maxY; y >= minY; --y) { - Vector test = column.toVector(y); + BlockVector3 test = column.toBlockVector3(y); if (!found) { if (function.isGround(test)) { found = true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java index 8be7466b1..21aa8b6f6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java @@ -19,9 +19,9 @@ package com.sk89q.worldedit.function.visitor; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.math.BlockVector3; import java.util.Collection; @@ -38,13 +38,13 @@ public class NonRisingVisitor extends RecursiveVisitor { */ public NonRisingVisitor(Mask mask, RegionFunction function) { super(mask, function); - Collection directions = getDirections(); + Collection directions = getDirections(); directions.clear(); - directions.add(new Vector(1, 0, 0)); - directions.add(new Vector(-1, 0, 0)); - directions.add(new Vector(0, 0, 1)); - directions.add(new Vector(0, 0, -1)); - directions.add(new Vector(0, -1, 0)); + directions.add(new BlockVector3(1, 0, 0)); + directions.add(new BlockVector3(-1, 0, 0)); + directions.add(new BlockVector3(0, 0, 1)); + directions.add(new BlockVector3(0, 0, -1)); + directions.add(new BlockVector3(0, -1, 0)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java index ac89393a3..d3dda04f7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java @@ -21,9 +21,9 @@ package com.sk89q.worldedit.function.visitor; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.math.BlockVector3; /** * An implementation of an {@link BreadthFirstSearch} that uses a mask to @@ -46,7 +46,7 @@ public class RecursiveVisitor extends BreadthFirstSearch { } @Override - protected boolean isVisitable(Vector from, Vector to) { + protected boolean isVisitable(BlockVector3 from, BlockVector3 to) { return mask.test(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 d6fc7d45c..12a955c0d 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 @@ -19,11 +19,11 @@ package com.sk89q.worldedit.function.visitor; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import java.util.List; @@ -53,7 +53,7 @@ public class RegionVisitor implements Operation { @Override public Operation resume(RunContext run) throws WorldEditException { - for (Vector pt : region) { + for (BlockVector3 pt : region) { if (function.apply(pt)) { affected++; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java index 4bb94aa09..1bbef8ab0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java @@ -21,10 +21,10 @@ package com.sk89q.worldedit.history.change; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.history.UndoContext; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; /** @@ -36,7 +36,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; */ public class BlockChange implements Change { - private final BlockVector position; + private final BlockVector3 position; private final BlockStateHolder previous; private final BlockStateHolder current; @@ -47,7 +47,7 @@ public class BlockChange implements Change { * @param previous the previous block * @param current the current block */ - public BlockChange(BlockVector position, BlockStateHolder previous, BlockStateHolder current) { + public BlockChange(BlockVector3 position, BlockStateHolder previous, BlockStateHolder current) { checkNotNull(position); checkNotNull(previous); checkNotNull(current); @@ -61,7 +61,7 @@ public class BlockChange implements Change { * * @return the position */ - public BlockVector getPosition() { + public BlockVector3 getPosition() { return position; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java index 23f724110..9c9ad2a85 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java @@ -22,9 +22,9 @@ package com.sk89q.worldedit.history.changeset; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.Iterators; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.history.change.Change; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.LocatedBlock; import com.sk89q.worldedit.util.collection.LocatedBlockList; @@ -42,7 +42,7 @@ import java.util.Iterator; public class BlockOptimizedHistory extends ArrayListHistory { private static Change createChange(LocatedBlock block) { - return new BlockChange(block.getLocation().toBlockPoint(), block.getBlock(), block.getBlock()); + return new BlockChange(block.getLocation(), block.getBlock(), block.getBlock()); } private final LocatedBlockList previous = new LocatedBlockList(); @@ -54,7 +54,7 @@ public class BlockOptimizedHistory extends ArrayListHistory { if (change instanceof BlockChange) { BlockChange blockChange = (BlockChange) change; - BlockVector position = blockChange.getPosition(); + BlockVector3 position = blockChange.getPosition(); previous.add(position, blockChange.getPrevious()); current.add(position, blockChange.getCurrent()); } else { @@ -80,5 +80,4 @@ public class BlockOptimizedHistory extends ArrayListHistory { public int size() { return super.size() + previous.size(); } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java index eac88237c..7f42b3a36 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.internal.annotation; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -27,7 +27,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Annotates a {@link Vector} parameter to inject a direction. + * Annotates a {@link Vector3} parameter to inject a direction. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java index a6371961f..262bdd0af 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java @@ -26,10 +26,10 @@ import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.command.parametric.AbstractInvokeListener; import com.sk89q.worldedit.util.command.parametric.InvokeHandler; import com.sk89q.worldedit.util.command.parametric.ParameterData; @@ -102,13 +102,13 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv } if (logMode != null && sender.isPlayer()) { - Vector position = player.getLocation().toVector(); + Vector3 position = player.getLocation().toVector(); LocalSession session = worldEdit.getSessionManager().get(player); switch (logMode) { case PLACEMENT: try { - position = session.getPlacementPosition(player); + position = session.getPlacementPosition(player).toVector3(); } catch (IncompleteRegionException e) { break; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index 1bdeee5c5..4cdebe5cb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -23,10 +23,8 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.UnknownDirectionException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.input.NoMatchException; @@ -38,6 +36,7 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.Selection; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator.TreeType; @@ -49,6 +48,7 @@ import com.sk89q.worldedit.util.command.parametric.ParameterException; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.Biomes; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.registry.BiomeRegistry; @@ -258,10 +258,10 @@ public class WorldEditBinding extends BindingHelper { * @throws UnknownDirectionException on an unknown direction */ @BindingMatch(classifier = Direction.class, - type = Vector.class, + type = BlockVector3.class, behavior = BindingBehavior.CONSUMES, consumedCount = 1) - public Vector getDirection(ArgumentStack context, Direction direction) + public BlockVector3 getDirection(ArgumentStack context, Direction direction) throws ParameterException, UnknownDirectionException { Player sender = getPlayer(context); return worldEdit.getDirection(sender, context.next()); 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 d23fd9a74..d10f5fb68 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 @@ -21,15 +21,15 @@ package com.sk89q.worldedit.internal.cui; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector2; public class SelectionCylinderEvent implements CUIEvent { - protected final Vector pos; - protected final Vector2D radius; + protected final BlockVector3 pos; + protected final Vector2 radius; - public SelectionCylinderEvent(Vector pos, Vector2D radius) { + public SelectionCylinderEvent(BlockVector3 pos, Vector2 radius) { this.pos = pos; this.radius = radius; } 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 3e371b105..e8c051040 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 @@ -19,14 +19,14 @@ package com.sk89q.worldedit.internal.cui; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; public class SelectionEllipsoidPointEvent implements CUIEvent { protected final int id; - protected final Vector pos; + protected final BlockVector3 pos; - public SelectionEllipsoidPointEvent(int id, Vector pos) { + public SelectionEllipsoidPointEvent(int id, BlockVector3 pos) { this.id = id; this.pos = pos; } 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 dc4d0adaa..1586dced9 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 @@ -19,27 +19,27 @@ package com.sk89q.worldedit.internal.cui; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; public class SelectionPoint2DEvent implements CUIEvent { protected final int id; - protected final int blockx; - protected final int blockz; + protected final int blockX; + protected final int blockZ; protected final int area; - public SelectionPoint2DEvent(int id, Vector2D pos, int area) { + public SelectionPoint2DEvent(int id, BlockVector2 pos, int area) { this.id = id; - this.blockx = pos.getBlockX(); - this.blockz = pos.getBlockZ(); + this.blockX = pos.getX(); + this.blockZ = pos.getZ(); this.area = area; } - public SelectionPoint2DEvent(int id, Vector pos, int area) { + public SelectionPoint2DEvent(int id, BlockVector3 pos, int area) { this.id = id; - this.blockx = pos.getBlockX(); - this.blockz = pos.getBlockZ(); + this.blockX = pos.getX(); + this.blockZ = pos.getZ(); this.area = area; } @@ -52,8 +52,8 @@ public class SelectionPoint2DEvent implements CUIEvent { public String[] getParameters() { return new String[] { String.valueOf(id), - String.valueOf(blockx), - String.valueOf(blockz), + String.valueOf(blockX), + String.valueOf(blockZ), String.valueOf(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 e719b1855..baac3ab1f 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 @@ -19,15 +19,15 @@ package com.sk89q.worldedit.internal.cui; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; public class SelectionPointEvent implements CUIEvent { protected final int id; - protected final Vector pos; + protected final BlockVector3 pos; protected final int area; - public SelectionPointEvent(int id, Vector pos, int area) { + public SelectionPointEvent(int id, BlockVector3 pos, int area) { this.id = id; this.pos = pos; this.area = 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 af63bebe0..5a13140db 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 @@ -26,9 +26,9 @@ import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; @@ -85,7 +85,7 @@ public class ServerCUIHandler { } } else { CuboidRegion region = ((CuboidRegionSelector) regionSelector).getIncompleteRegion(); - Vector point; + BlockVector3 point; if (region.getPos1() != null) { point = region.getPos1(); } else if (region.getPos2() != null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java index 4b4cbad13..9f7eaceb1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java @@ -19,9 +19,9 @@ package com.sk89q.worldedit.internal.expression.runtime; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.runtime.Function.Dynamic; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.noise.PerlinNoise; import com.sk89q.worldedit.math.noise.RidgedMultiFractalNoise; import com.sk89q.worldedit.math.noise.VoronoiNoise; @@ -392,7 +392,7 @@ public final class Functions { } catch (IllegalArgumentException e) { throw new EvaluationException(0, "Perlin noise error: " + e.getMessage()); } - return perlin.noise(new Vector(x.getValue(), y.getValue(), z.getValue())); + return perlin.noise(new Vector3(x.getValue(), y.getValue(), z.getValue())); } private static final ThreadLocal localVoronoi = ThreadLocal.withInitial(VoronoiNoise::new); @@ -405,7 +405,7 @@ public final class Functions { } catch (IllegalArgumentException e) { throw new EvaluationException(0, "Voronoi error: " + e.getMessage()); } - return voronoi.noise(new Vector(x.getValue(), y.getValue(), z.getValue())); + return voronoi.noise(new Vector3(x.getValue(), y.getValue(), z.getValue())); } private static final ThreadLocal localRidgedMulti = ThreadLocal.withInitial(RidgedMultiFractalNoise::new); @@ -419,7 +419,7 @@ public final class Functions { } catch (IllegalArgumentException e) { throw new EvaluationException(0, "Ridged multi error: " + e.getMessage()); } - return ridgedMulti.noise(new Vector(x.getValue(), y.getValue(), z.getValue())); + return ridgedMulti.noise(new Vector3(x.getValue(), y.getValue(), z.getValue())); } private static double queryInternal(RValue type, RValue data, double typeId, double dataValue) throws EvaluationException { 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 new file mode 100644 index 000000000..864e8c19c --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java @@ -0,0 +1,529 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.math; + +import com.google.common.collect.ComparisonChain; +import com.sk89q.worldedit.math.transform.AffineTransform; + +import java.util.Comparator; + +/** + * An immutable 2-dimensional vector. + */ +public final class BlockVector2 { + + public static final BlockVector2 ZERO = new BlockVector2(0, 0); + public static final BlockVector2 UNIT_X = new BlockVector2(1, 0); + public static final BlockVector2 UNIT_Z = new BlockVector2(0, 1); + public static final BlockVector2 ONE = new BlockVector2(1, 1); + + /** + * A comparator for BlockVector2ds that orders the vectors by rows, with x as the + * column and z as the row. + * + * For example, if x is the horizontal axis and z is the vertical axis, it + * sorts like so: + * + *

+     * 0123
+     * 4567
+     * 90ab
+     * cdef
+     * 
+ */ + public static final Comparator COMPARING_GRID_ARRANGEMENT = (a, b) -> { + return ComparisonChain.start() + .compare(a.getBlockZ(), b.getBlockZ()) + .compare(a.getBlockX(), b.getBlockX()) + .result(); + }; + + private final int x, z; + + /** + * Construct an instance. + * + * @param x the X coordinate + * @param z the Z coordinate + */ + public BlockVector2(double x, double z) { + this((int) Math.floor(x), (int) Math.floor(z)); + } + + /** + * Construct an instance. + * + * @param x the X coordinate + * @param z the Z coordinate + */ + public BlockVector2(int x, int z) { + this.x = x; + this.z = z; + } + + /** + * Get the X coordinate. + * + * @return the x coordinate + */ + public int getX() { + return x; + } + + /** + * Get the X coordinate. + * + * @return the x coordinate + */ + public int getBlockX() { + return x; + } + + /** + * Set the X coordinate. + * + * @param x the new X + * @return a new vector + */ + public BlockVector2 withX(int x) { + return new BlockVector2(x, z); + } + + /** + * Get the Z coordinate. + * + * @return the z coordinate + */ + public int getZ() { + return z; + } + + /** + * Get the Z coordinate. + * + * @return the z coordinate + */ + public int getBlockZ() { + return z; + } + + /** + * Set the Z coordinate. + * + * @param z the new Z + * @return a new vector + */ + public BlockVector2 withZ(int z) { + return new BlockVector2(x, z); + } + + /** + * Add another vector to this vector and return the result as a new vector. + * + * @param other the other vector + * @return a new vector + */ + public BlockVector2 add(BlockVector2 other) { + return add(other.x, other.z); + } + + /** + * Add another vector to this vector and return the result as a new vector. + * + * @param x the value to add + * @param z the value to add + * @return a new vector + */ + public BlockVector2 add(int x, int z) { + return new BlockVector2(this.x + x, this.z + z); + } + + /** + * Add a list of vectors to this vector and return the + * result as a new vector. + * + * @param others an array of vectors + * @return a new vector + */ + public BlockVector2 add(BlockVector2... others) { + int newX = x, newZ = z; + + for (BlockVector2 other : others) { + newX += other.x; + newZ += other.z; + } + + return new BlockVector2(newX, newZ); + } + + /** + * Subtract another vector from this vector and return the result + * as a new vector. + * + * @param other the other vector + * @return a new vector + */ + public BlockVector2 subtract(BlockVector2 other) { + return subtract(other.x, other.z); + } + + /** + * Subtract another vector from this vector and return the result + * as a new vector. + * + * @param x the value to subtract + * @param z the value to subtract + * @return a new vector + */ + public BlockVector2 subtract(int x, int z) { + return new BlockVector2(this.x - x, this.z - z); + } + + /** + * Subtract a list of vectors from this vector and return the result + * as a new vector. + * + * @param others an array of vectors + * @return a new vector + */ + public BlockVector2 subtract(BlockVector2... others) { + int newX = x, newZ = z; + + for (BlockVector2 other : others) { + newX -= other.x; + newZ -= other.z; + } + + return new BlockVector2(newX, newZ); + } + + /** + * Multiply this vector by another vector on each component. + * + * @param other the other vector + * @return a new vector + */ + public BlockVector2 multiply(BlockVector2 other) { + return multiply(other.x, other.z); + } + + /** + * Multiply this vector by another vector on each component. + * + * @param x the value to multiply + * @param z the value to multiply + * @return a new vector + */ + public BlockVector2 multiply(int x, int z) { + return new BlockVector2(this.x * x, this.z * z); + } + + /** + * Multiply this vector by zero or more vectors on each component. + * + * @param others an array of vectors + * @return a new vector + */ + public BlockVector2 multiply(BlockVector2... others) { + int newX = x, newZ = z; + + for (BlockVector2 other : others) { + newX *= other.x; + newZ *= other.z; + } + + return new BlockVector2(newX, newZ); + } + + /** + * Perform scalar multiplication and return a new vector. + * + * @param n the value to multiply + * @return a new vector + */ + public BlockVector2 multiply(int n) { + return multiply(n, n); + } + + /** + * Divide this vector by another vector on each component. + * + * @param other the other vector + * @return a new vector + */ + public BlockVector2 divide(BlockVector2 other) { + return divide(other.x, other.z); + } + + /** + * Divide this vector by another vector on each component. + * + * @param x the value to divide by + * @param z the value to divide by + * @return a new vector + */ + public BlockVector2 divide(int x, int z) { + return new BlockVector2(this.x / x, this.z / z); + } + + /** + * Perform scalar division and return a new vector. + * + * @param n the value to divide by + * @return a new vector + */ + public BlockVector2 divide(int n) { + return divide(n, n); + } + + /** + * Get the length of the vector. + * + * @return length + */ + public double length() { + return Math.sqrt(lengthSq()); + } + + /** + * Get the length, squared, of the vector. + * + * @return length, squared + */ + public int lengthSq() { + return x * x + z * z; + } + + /** + * Get the distance between this vector and another vector. + * + * @param other the other vector + * @return distance + */ + public double distance(BlockVector2 other) { + return Math.sqrt(distanceSq(other)); + } + + /** + * Get the distance between this vector and another vector, squared. + * + * @param other the other vector + * @return distance + */ + public int distanceSq(BlockVector2 other) { + int dx = other.x - x; + int dz = other.z - z; + return dx * dx + dz * dz; + } + + /** + * Get the normalized vector, which is the vector divided by its + * length, as a new vector. + * + * @return a new vector + */ + public BlockVector2 normalize() { + double len = length(); + double x = this.x / len; + double z = this.z / len; + return new BlockVector2(x, z); + } + + /** + * Gets the dot product of this and another vector. + * + * @param other the other vector + * @return the dot product of this and the other vector + */ + public int dot(BlockVector2 other) { + return x * other.x + z * other.z; + } + + /** + * Checks to see if a vector is contained with another. + * + * @param min the minimum point (X, Y, and Z are the lowest) + * @param max the maximum point (X, Y, and Z are the lowest) + * @return true if the vector is contained + */ + public boolean containedWithin(BlockVector2 min, BlockVector2 max) { + return x >= min.x && x <= max.x + && z >= min.z && z <= max.z; + } + + /** + * Floors the values of all components. + * + * @return a new vector + */ + public BlockVector2 floor() { + // already floored, kept for feature parity with Vector2 + return this; + } + + /** + * Rounds all components up. + * + * @return a new vector + */ + public BlockVector2 ceil() { + // already raised, kept for feature parity with Vector2 + return this; + } + + /** + * Rounds all components to the closest integer. + * + *

Components < 0.5 are rounded down, otherwise up.

+ * + * @return a new vector + */ + public BlockVector2 round() { + // already rounded, kept for feature parity with Vector2 + return this; + } + + /** + * Returns a vector with the absolute values of the components of + * this vector. + * + * @return a new vector + */ + public BlockVector2 abs() { + return new BlockVector2(Math.abs(x), Math.abs(z)); + } + + /** + * Perform a 2D transformation on this vector and return a new one. + * + * @param angle in degrees + * @param aboutX about which x coordinate to rotate + * @param aboutZ about which z coordinate to rotate + * @param translateX what to add after rotation + * @param translateZ what to add after rotation + * @return a new vector + * @see AffineTransform another method to transform vectors + */ + public BlockVector2 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { + angle = Math.toRadians(angle); + 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; + double z2 = x * sin + z * cos; + return new BlockVector2( + x2 + aboutX + translateX, + z2 + aboutZ + translateZ); + } + + /** + * Gets the minimum components of two vectors. + * + * @param v2 the second vector + * @return minimum + */ + public BlockVector2 getMinimum(BlockVector2 v2) { + return new BlockVector2( + Math.min(x, v2.x), + Math.min(z, v2.z) + ); + } + + /** + * Gets the maximum components of two vectors. + * + * @param v2 the second vector + * @return maximum + */ + public BlockVector2 getMaximum(BlockVector2 v2) { + return new BlockVector2( + Math.max(x, v2.x), + Math.max(z, v2.z) + ); + } + + public Vector2 toVector2() { + return new Vector2(x, z); + } + + /** + * Creates a 3D vector by adding a zero Y component to this vector. + * + * @return a new vector + */ + public Vector3 toVector3() { + return toVector3(0); + } + + /** + * Creates a 3D vector by adding the specified Y component to this vector. + * + * @param y the Y component + * @return a new vector + */ + public Vector3 toVector3(double y) { + return new Vector3(x, y, z); + } + + /** + * Creates a 3D vector by adding a zero Y component to this vector. + * + * @return a new vector + */ + public BlockVector3 toBlockVector3() { + return toBlockVector3(0); + } + + /** + * Creates a 3D vector by adding the specified Y component to this vector. + * + * @param y the Y component + * @return a new vector + */ + public BlockVector3 toBlockVector3(int y) { + return new BlockVector3(x, y, z); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof BlockVector2)) { + return false; + } + + BlockVector2 other = (BlockVector2) obj; + return other.x == this.x && other.z == this.z; + + } + + @Override + public int hashCode() { + int hash = 17; + hash = 31 * hash + Integer.hashCode(x); + hash = 31 * hash + Integer.hashCode(z); + return hash; + } + + @Override + public String toString() { + return "(" + x + ", " + z + ")"; + } + +} \ No newline at end of file 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 new file mode 100644 index 000000000..efe56e8af --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java @@ -0,0 +1,613 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.math; + +import static com.google.common.base.Preconditions.checkArgument; + +import com.google.common.collect.ComparisonChain; +import com.sk89q.worldedit.math.transform.AffineTransform; + +import java.util.Comparator; + +/** + * An immutable 3-dimensional vector. + */ +public final class BlockVector3 { + + public static final BlockVector3 ZERO = new BlockVector3(0, 0, 0); + public static final BlockVector3 UNIT_X = new BlockVector3(1, 0, 0); + public static final BlockVector3 UNIT_Y = new BlockVector3(0, 1, 0); + public static final BlockVector3 UNIT_Z = new BlockVector3(0, 0, 1); + public static final BlockVector3 ONE = new BlockVector3(1, 1, 1); + + // thread-safe initialization idiom + private static final class YzxOrderComparator { + private static final Comparator YZX_ORDER = (a, b) -> { + return ComparisonChain.start() + .compare(a.y, b.y) + .compare(a.z, b.z) + .compare(a.x, b.x) + .result(); + }; + } + + /** + * Returns a comparator that sorts vectors first by Y, then Z, then X. + * + *

+ * Useful for sorting by chunk block storage order. + */ + public static Comparator sortByCoordsYzx() { + return YzxOrderComparator.YZX_ORDER; + } + + private final int x, y, z; + + /** + * Construct an instance. + * + * @param x the X coordinate + * @param y the Y coordinate + * @param z the Z coordinate + */ + public BlockVector3(double x, double y, double z) { + this((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z)); + } + + /** + * Construct an instance. + * + * @param x the X coordinate + * @param y the Y coordinate + * @param z the Z coordinate + */ + public BlockVector3(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + + /** + * Get the X coordinate. + * + * @return the x coordinate + */ + public int getX() { + return x; + } + + /** + * Get the X coordinate. + * + * @return the x coordinate + */ + public int getBlockX() { + return x; + } + + /** + * Set the X coordinate. + * + * @param x the new X + * @return a new vector + */ + public BlockVector3 withX(int x) { + return new BlockVector3(x, y, z); + } + + /** + * Get the Y coordinate. + * + * @return the y coordinate + */ + public int getY() { + return y; + } + + /** + * Get the Y coordinate. + * + * @return the y coordinate + */ + public int getBlockY() { + return y; + } + + /** + * Set the Y coordinate. + * + * @param y the new Y + * @return a new vector + */ + public BlockVector3 withY(int y) { + return new BlockVector3(x, y, z); + } + + /** + * Get the Z coordinate. + * + * @return the z coordinate + */ + public int getZ() { + return z; + } + + /** + * Get the Z coordinate. + * + * @return the z coordinate + */ + public int getBlockZ() { + return z; + } + + /** + * Set the Z coordinate. + * + * @param z the new Z + * @return a new vector + */ + public BlockVector3 withZ(int z) { + return new BlockVector3(x, y, z); + } + + /** + * Add another vector to this vector and return the result as a new vector. + * + * @param other the other vector + * @return a new vector + */ + public BlockVector3 add(BlockVector3 other) { + return add(other.x, other.y, other.z); + } + + /** + * Add another vector to this vector and return the result as a new vector. + * + * @param x the value to add + * @param y the value to add + * @param z the value to add + * @return a new vector + */ + public BlockVector3 add(int x, int y, int z) { + return new BlockVector3(this.x + x, this.y + y, this.z + z); + } + + /** + * Add a list of vectors to this vector and return the + * result as a new vector. + * + * @param others an array of vectors + * @return a new vector + */ + public BlockVector3 add(BlockVector3... others) { + int newX = x, newY = y, newZ = z; + + for (BlockVector3 other : others) { + newX += other.x; + newY += other.y; + newZ += other.z; + } + + return new BlockVector3(newX, newY, newZ); + } + + /** + * Subtract another vector from this vector and return the result + * as a new vector. + * + * @param other the other vector + * @return a new vector + */ + public BlockVector3 subtract(BlockVector3 other) { + return subtract(other.x, other.y, other.z); + } + + /** + * Subtract another vector from this vector and return the result + * as a new vector. + * + * @param x the value to subtract + * @param y the value to subtract + * @param z the value to subtract + * @return a new vector + */ + public BlockVector3 subtract(int x, int y, int z) { + return new BlockVector3(this.x - x, this.y - y, this.z - z); + } + + /** + * Subtract a list of vectors from this vector and return the result + * as a new vector. + * + * @param others an array of vectors + * @return a new vector + */ + public BlockVector3 subtract(BlockVector3... others) { + int newX = x, newY = y, newZ = z; + + for (BlockVector3 other : others) { + newX -= other.x; + newY -= other.y; + newZ -= other.z; + } + + return new BlockVector3(newX, newY, newZ); + } + + /** + * Multiply this vector by another vector on each component. + * + * @param other the other vector + * @return a new vector + */ + public BlockVector3 multiply(BlockVector3 other) { + return multiply(other.x, other.y, other.z); + } + + /** + * Multiply this vector by another vector on each component. + * + * @param x the value to multiply + * @param y the value to multiply + * @param z the value to multiply + * @return a new vector + */ + public BlockVector3 multiply(int x, int y, int z) { + return new BlockVector3(this.x * x, this.y * y, this.z * z); + } + + /** + * Multiply this vector by zero or more vectors on each component. + * + * @param others an array of vectors + * @return a new vector + */ + public BlockVector3 multiply(BlockVector3... others) { + int newX = x, newY = y, newZ = z; + + for (BlockVector3 other : others) { + newX *= other.x; + newY *= other.y; + newZ *= other.z; + } + + return new BlockVector3(newX, newY, newZ); + } + + /** + * Perform scalar multiplication and return a new vector. + * + * @param n the value to multiply + * @return a new vector + */ + public BlockVector3 multiply(int n) { + return multiply(n, n, n); + } + + /** + * Divide this vector by another vector on each component. + * + * @param other the other vector + * @return a new vector + */ + public BlockVector3 divide(BlockVector3 other) { + return divide(other.x, other.y, other.z); + } + + /** + * Divide this vector by another vector on each component. + * + * @param x the value to divide by + * @param y the value to divide by + * @param z the value to divide by + * @return a new vector + */ + public BlockVector3 divide(int x, int y, int z) { + return new BlockVector3(this.x / x, this.y / y, this.z / z); + } + + /** + * Perform scalar division and return a new vector. + * + * @param n the value to divide by + * @return a new vector + */ + public BlockVector3 divide(int n) { + return divide(n, n, n); + } + + /** + * Get the length of the vector. + * + * @return length + */ + public double length() { + return Math.sqrt(lengthSq()); + } + + /** + * Get the length, squared, of the vector. + * + * @return length, squared + */ + public int lengthSq() { + return x * x + y * y + z * z; + } + + /** + * Get the distance between this vector and another vector. + * + * @param other the other vector + * @return distance + */ + public double distance(BlockVector3 other) { + return Math.sqrt(distanceSq(other)); + } + + /** + * Get the distance between this vector and another vector, squared. + * + * @param other the other vector + * @return distance + */ + public int distanceSq(BlockVector3 other) { + int dx = other.x - x; + int dy = other.y - y; + int dz = other.z - z; + return dx * dx + dy * dy + dz * dz; + } + + /** + * Get the normalized vector, which is the vector divided by its + * length, as a new vector. + * + * @return a new vector + */ + public BlockVector3 normalize() { + double len = length(); + double x = this.x / len; + double y = this.y / len; + double z = this.z / len; + return new BlockVector3(x, y, z); + } + + /** + * Gets the dot product of this and another vector. + * + * @param other the other vector + * @return the dot product of this and the other vector + */ + public double dot(BlockVector3 other) { + return x * other.x + y * other.y + z * other.z; + } + + /** + * Gets the cross product of this and another vector. + * + * @param other the other vector + * @return the cross product of this and the other vector + */ + public BlockVector3 cross(BlockVector3 other) { + return new BlockVector3( + y * other.z - z * other.y, + z * other.x - x * other.z, + x * other.y - y * other.x + ); + } + + /** + * Checks to see if a vector is contained with another. + * + * @param min the minimum point (X, Y, and Z are the lowest) + * @param max the maximum point (X, Y, and Z are the lowest) + * @return true if the vector is contained + */ + public boolean containedWithin(BlockVector3 min, BlockVector3 max) { + return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; + } + + /** + * Clamp the Y component. + * + * @param min the minimum value + * @param max the maximum value + * @return a new vector + */ + public BlockVector3 clampY(int min, int max) { + checkArgument(min <= max, "minimum cannot be greater than maximum"); + if (y < min) { + return new BlockVector3(x, min, z); + } + if (y > max) { + return new BlockVector3(x, max, z); + } + return this; + } + + /** + * Floors the values of all components. + * + * @return a new vector + */ + public BlockVector3 floor() { + // already floored, kept for feature parity with Vector3 + return this; + } + + /** + * Rounds all components up. + * + * @return a new vector + */ + public BlockVector3 ceil() { + // already raised, kept for feature parity with Vector3 + return this; + } + + /** + * Rounds all components to the closest integer. + * + *

Components < 0.5 are rounded down, otherwise up.

+ * + * @return a new vector + */ + public BlockVector3 round() { + // already rounded, kept for feature parity with Vector3 + return this; + } + + /** + * Returns a vector with the absolute values of the components of + * this vector. + * + * @return a new vector + */ + public BlockVector3 abs() { + return new BlockVector3(Math.abs(x), Math.abs(y), Math.abs(z)); + } + + /** + * Perform a 2D transformation on this vector and return a new one. + * + * @param angle in degrees + * @param aboutX about which x coordinate to rotate + * @param aboutZ about which z coordinate to rotate + * @param translateX what to add after rotation + * @param translateZ what to add after rotation + * @return a new vector + * @see AffineTransform another method to transform vectors + */ + public BlockVector3 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { + angle = Math.toRadians(angle); + 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; + double z2 = x * sin + z * cos; + + return new BlockVector3( + x2 + aboutX + translateX, + y, + z2 + aboutZ + translateZ + ); + } + + /** + * Get this vector's pitch as used within the game. + * + * @return pitch in radians + */ + public double toPitch() { + double x = getX(); + double z = getZ(); + + if (x == 0 && z == 0) { + return getY() > 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)); + } + } + + /** + * Get this vector's yaw as used within the game. + * + * @return yaw in radians + */ + public double toYaw() { + double x = getX(); + double z = getZ(); + + double t = Math.atan2(-x, z); + double tau = 2 * Math.PI; + + return Math.toDegrees(((t + tau) % tau)); + } + + /** + * Gets the minimum components of two vectors. + * + * @param v2 the second vector + * @return minimum + */ + public BlockVector3 getMinimum(BlockVector3 v2) { + return new BlockVector3( + Math.min(x, v2.x), + Math.min(y, v2.y), + Math.min(z, v2.z) + ); + } + + /** + * Gets the maximum components of two vectors. + * + * @param v2 the second vector + * @return maximum + */ + public BlockVector3 getMaximum(BlockVector3 v2) { + return new BlockVector3( + Math.max(x, v2.x), + Math.max(y, v2.y), + Math.max(z, v2.z) + ); + } + + /** + * Creates a 2D vector by dropping the Y component from this vector. + * + * @return a new {@link BlockVector2} + */ + public BlockVector2 toBlockVector2() { + return new BlockVector2(x, z); + } + + public Vector3 toVector3() { + return new Vector3(x, y, z); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof BlockVector3)) { + return false; + } + + BlockVector3 other = (BlockVector3) obj; + return other.x == this.x && other.y == this.y && other.z == this.z; + } + + @Override + public int hashCode() { + int hash = 17; + hash = 31 * hash + Integer.hashCode(x); + hash = 31 * hash + Integer.hashCode(y); + hash = 31 * hash + Integer.hashCode(z); + return hash; + } + + @Override + public String toString() { + return "(" + x + ", " + y + ", " + z + ")"; + } + +} \ No newline at end of file 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 new file mode 100644 index 000000000..e403cc5ea --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java @@ -0,0 +1,471 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.math; + +import com.sk89q.worldedit.math.transform.AffineTransform; + +/** + * An immutable 2-dimensional vector. + */ +public final class Vector2 { + + public static final Vector2 ZERO = new Vector2(0, 0); + public static final Vector2 UNIT_X = new Vector2(1, 0); + public static final Vector2 UNIT_Z = new Vector2(0, 1); + public static final Vector2 ONE = new Vector2(1, 1); + + private final double x, z; + + /** + * Construct an instance. + * + * @param x the X coordinate + * @param z the Z coordinate + */ + public Vector2(double x, double z) { + this.x = x; + this.z = z; + } + + /** + * Copy another vector. + * + * @param other the other vector + */ + public Vector2(Vector2 other) { + this.x = other.x; + this.z = other.z; + } + + /** + * Get the X coordinate. + * + * @return the x coordinate + */ + public double getX() { + return x; + } + + /** + * Set the X coordinate. + * + * @param x the new X + * @return a new vector + */ + public Vector2 withX(double x) { + return new Vector2(x, z); + } + + /** + * Get the Z coordinate. + * + * @return the z coordinate + */ + public double getZ() { + return z; + } + + /** + * Set the Z coordinate. + * + * @param z the new Z + * @return a new vector + */ + public Vector2 withZ(double z) { + return new Vector2(x, z); + } + + /** + * Add another vector to this vector and return the result as a new vector. + * + * @param other the other vector + * @return a new vector + */ + public Vector2 add(Vector2 other) { + return add(other.x, other.z); + } + + /** + * Add another vector to this vector and return the result as a new vector. + * + * @param x the value to add + * @param z the value to add + * @return a new vector + */ + public Vector2 add(double x, double z) { + return new Vector2(this.x + x, this.z + z); + } + + /** + * Add a list of vectors to this vector and return the + * result as a new vector. + * + * @param others an array of vectors + * @return a new vector + */ + public Vector2 add(Vector2... others) { + double newX = x, newZ = z; + + for (Vector2 other : others) { + newX += other.x; + newZ += other.z; + } + + return new Vector2(newX, newZ); + } + + /** + * Subtract another vector from this vector and return the result + * as a new vector. + * + * @param other the other vector + * @return a new vector + */ + public Vector2 subtract(Vector2 other) { + return subtract(other.x, other.z); + } + + /** + * Subtract another vector from this vector and return the result + * as a new vector. + * + * @param x the value to subtract + * @param z the value to subtract + * @return a new vector + */ + public Vector2 subtract(double x, double z) { + return new Vector2(this.x - x, this.z - z); + } + + /** + * Subtract a list of vectors from this vector and return the result + * as a new vector. + * + * @param others an array of vectors + * @return a new vector + */ + public Vector2 subtract(Vector2... others) { + double newX = x, newZ = z; + + for (Vector2 other : others) { + newX -= other.x; + newZ -= other.z; + } + + return new Vector2(newX, newZ); + } + + /** + * Multiply this vector by another vector on each component. + * + * @param other the other vector + * @return a new vector + */ + public Vector2 multiply(Vector2 other) { + return multiply(other.x, other.z); + } + + /** + * Multiply this vector by another vector on each component. + * + * @param x the value to multiply + * @param z the value to multiply + * @return a new vector + */ + public Vector2 multiply(double x, double z) { + return new Vector2(this.x * x, this.z * z); + } + + /** + * Multiply this vector by zero or more vectors on each component. + * + * @param others an array of vectors + * @return a new vector + */ + public Vector2 multiply(Vector2... others) { + double newX = x, newZ = z; + + for (Vector2 other : others) { + newX *= other.x; + newZ *= other.z; + } + + return new Vector2(newX, newZ); + } + + /** + * Perform scalar multiplication and return a new vector. + * + * @param n the value to multiply + * @return a new vector + */ + public Vector2 multiply(double n) { + return multiply(n, n); + } + + /** + * Divide this vector by another vector on each component. + * + * @param other the other vector + * @return a new vector + */ + public Vector2 divide(Vector2 other) { + return divide(other.x, other.z); + } + + /** + * Divide this vector by another vector on each component. + * + * @param x the value to divide by + * @param z the value to divide by + * @return a new vector + */ + public Vector2 divide(double x, double z) { + return new Vector2(this.x / x, this.z / z); + } + + /** + * Perform scalar division and return a new vector. + * + * @param n the value to divide by + * @return a new vector + */ + public Vector2 divide(double n) { + return divide(n, n); + } + + /** + * Get the length of the vector. + * + * @return length + */ + public double length() { + return Math.sqrt(lengthSq()); + } + + /** + * Get the length, squared, of the vector. + * + * @return length, squared + */ + public double lengthSq() { + return x * x + z * z; + } + + /** + * Get the distance between this vector and another vector. + * + * @param other the other vector + * @return distance + */ + public double distance(Vector2 other) { + return Math.sqrt(distanceSq(other)); + } + + /** + * Get the distance between this vector and another vector, squared. + * + * @param other the other vector + * @return distance + */ + public double distanceSq(Vector2 other) { + double dx = other.x - x; + double dz = other.z - z; + return dx * dx + dz * dz; + } + + /** + * Get the normalized vector, which is the vector divided by its + * length, as a new vector. + * + * @return a new vector + */ + public Vector2 normalize() { + return divide(length()); + } + + /** + * Gets the dot product of this and another vector. + * + * @param other the other vector + * @return the dot product of this and the other vector + */ + public double dot(Vector2 other) { + return x * other.x + z * other.z; + } + + /** + * Checks to see if a vector is contained with another. + * + * @param min the minimum point (X, Y, and Z are the lowest) + * @param max the maximum point (X, Y, and Z are the lowest) + * @return true if the vector is contained + */ + public boolean containedWithin(Vector2 min, Vector2 max) { + return x >= min.x && x <= max.x + && z >= min.z && z <= max.z; + } + + /** + * Floors the values of all components. + * + * @return a new vector + */ + public Vector2 floor() { + return new Vector2(Math.floor(x), Math.floor(z)); + } + + /** + * Rounds all components up. + * + * @return a new vector + */ + public Vector2 ceil() { + return new Vector2(Math.ceil(x), Math.ceil(z)); + } + + /** + * Rounds all components to the closest integer. + * + *

Components < 0.5 are rounded down, otherwise up.

+ * + * @return a new vector + */ + public Vector2 round() { + return new Vector2(Math.floor(x + 0.5), Math.floor(z + 0.5)); + } + + /** + * Returns a vector with the absolute values of the components of + * this vector. + * + * @return a new vector + */ + public Vector2 abs() { + return new Vector2(Math.abs(x), Math.abs(z)); + } + + /** + * Perform a 2D transformation on this vector and return a new one. + * + * @param angle in degrees + * @param aboutX about which x coordinate to rotate + * @param aboutZ about which z coordinate to rotate + * @param translateX what to add after rotation + * @param translateZ what to add after rotation + * @return a new vector + * @see AffineTransform another method to transform vectors + */ + public Vector2 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { + angle = Math.toRadians(angle); + 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; + double z2 = x * sin + z * cos; + return new Vector2( + x2 + aboutX + translateX, + z2 + aboutZ + translateZ); + } + + /** + * Gets the minimum components of two vectors. + * + * @param v2 the second vector + * @return minimum + */ + public Vector2 getMinimum(Vector2 v2) { + return new Vector2( + Math.min(x, v2.x), + Math.min(z, v2.z) + ); + } + + /** + * Gets the maximum components of two vectors. + * + * @param v2 the second vector + * @return maximum + */ + public Vector2 getMaximum(Vector2 v2) { + return new Vector2( + Math.max(x, v2.x), + Math.max(z, v2.z) + ); + } + + public static BlockVector2 toBlockPoint(double x, double z) { + return new BlockVector2(x, z); + } + + /** + * Create a new {@link BlockVector2} from this vector. + * + * @return a new {@link BlockVector2} + */ + public BlockVector2 toBlockPoint() { + return toBlockPoint(x, z); + } + + /** + * Creates a 3D vector by adding a zero Y component to this vector. + * + * @return a new vector + */ + public Vector3 toVector3() { + return toVector3(0); + } + + /** + * Creates a 3D vector by adding the specified Y component to this vector. + * + * @param y the Y component + * @return a new vector + */ + public Vector3 toVector3(double y) { + return new Vector3(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() { + int hash = 17; + hash = 31 * hash + Double.hashCode(x); + hash = 31 * hash + Double.hashCode(z); + return hash; + } + + @Override + public String toString() { + return "(" + x + ", " + z + ")"; + } + +} \ No newline at end of file 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 new file mode 100644 index 000000000..59847cbf2 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java @@ -0,0 +1,596 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.math; + +import static com.google.common.base.Preconditions.checkArgument; + +import com.google.common.collect.ComparisonChain; +import com.sk89q.worldedit.math.transform.AffineTransform; + +import java.util.Comparator; + +/** + * An immutable 3-dimensional vector. + */ +public final class Vector3 { + + public static final Vector3 ZERO = new Vector3(0, 0, 0); + public static final Vector3 UNIT_X = new Vector3(1, 0, 0); + public static final Vector3 UNIT_Y = new Vector3(0, 1, 0); + public static final Vector3 UNIT_Z = new Vector3(0, 0, 1); + public static final Vector3 ONE = new Vector3(1, 1, 1); + + // thread-safe initialization idiom + private static final class YzxOrderComparator { + private static final Comparator YZX_ORDER = (a, b) -> { + return ComparisonChain.start() + .compare(a.y, b.y) + .compare(a.z, b.z) + .compare(a.x, b.x) + .result(); + }; + } + + /** + * Returns a comparator that sorts vectors first by Y, then Z, then X. + * + *

+ * Useful for sorting by chunk block storage order. + */ + public static Comparator sortByCoordsYzx() { + return YzxOrderComparator.YZX_ORDER; + } + + private final double x, y, z; + + /** + * Construct an instance. + * + * @param x the X coordinate + * @param y the Y coordinate + * @param z the Z coordinate + */ + public Vector3(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } + + /** + * Copy another vector. + * + * @param other another vector to make a copy of + */ + public Vector3(Vector3 other) { + this.x = other.x; + this.y = other.y; + this.z = other.z; + } + + /** + * Get the X coordinate. + * + * @return the x coordinate + */ + public double getX() { + return x; + } + + /** + * Set the X coordinate. + * + * @param x the new X + * @return a new vector + */ + public Vector3 withX(double x) { + return new Vector3(x, y, z); + } + + /** + * Get the Y coordinate. + * + * @return the y coordinate + */ + public double getY() { + return y; + } + + /** + * Set the Y coordinate. + * + * @param y the new Y + * @return a new vector + */ + public Vector3 withY(double y) { + return new Vector3(x, y, z); + } + + /** + * Get the Z coordinate. + * + * @return the z coordinate + */ + public double getZ() { + return z; + } + + /** + * Set the Z coordinate. + * + * @param z the new Z + * @return a new vector + */ + public Vector3 withZ(double z) { + return new Vector3(x, y, z); + } + + /** + * Add another vector to this vector and return the result as a new vector. + * + * @param other the other vector + * @return a new vector + */ + public Vector3 add(Vector3 other) { + return add(other.x, other.y, other.z); + } + + /** + * Add another vector to this vector and return the result as a new vector. + * + * @param x the value to add + * @param y the value to add + * @param z the value to add + * @return a new vector + */ + public Vector3 add(double x, double y, double z) { + return new Vector3(this.x + x, this.y + y, this.z + z); + } + + /** + * Add a list of vectors to this vector and return the + * result as a new vector. + * + * @param others an array of vectors + * @return a new vector + */ + public Vector3 add(Vector3... others) { + double newX = x, newY = y, newZ = z; + + for (Vector3 other : others) { + newX += other.x; + newY += other.y; + newZ += other.z; + } + + return new Vector3(newX, newY, newZ); + } + + /** + * Subtract another vector from this vector and return the result + * as a new vector. + * + * @param other the other vector + * @return a new vector + */ + public Vector3 subtract(Vector3 other) { + return subtract(other.x, other.y, other.z); + } + + /** + * Subtract another vector from this vector and return the result + * as a new vector. + * + * @param x the value to subtract + * @param y the value to subtract + * @param z the value to subtract + * @return a new vector + */ + public Vector3 subtract(double x, double y, double z) { + return new Vector3(this.x - x, this.y - y, this.z - z); + } + + /** + * Subtract a list of vectors from this vector and return the result + * as a new vector. + * + * @param others an array of vectors + * @return a new vector + */ + public Vector3 subtract(Vector3... others) { + double newX = x, newY = y, newZ = z; + + for (Vector3 other : others) { + newX -= other.x; + newY -= other.y; + newZ -= other.z; + } + + return new Vector3(newX, newY, newZ); + } + + /** + * Multiply this vector by another vector on each component. + * + * @param other the other vector + * @return a new vector + */ + public Vector3 multiply(Vector3 other) { + return multiply(other.x, other.y, other.z); + } + + /** + * Multiply this vector by another vector on each component. + * + * @param x the value to multiply + * @param y the value to multiply + * @param z the value to multiply + * @return a new vector + */ + public Vector3 multiply(double x, double y, double z) { + return new Vector3(this.x * x, this.y * y, this.z * z); + } + + /** + * Multiply this vector by zero or more vectors on each component. + * + * @param others an array of vectors + * @return a new vector + */ + public Vector3 multiply(Vector3... others) { + double newX = x, newY = y, newZ = z; + + for (Vector3 other : others) { + newX *= other.x; + newY *= other.y; + newZ *= other.z; + } + + return new Vector3(newX, newY, newZ); + } + + /** + * Perform scalar multiplication and return a new vector. + * + * @param n the value to multiply + * @return a new vector + */ + public Vector3 multiply(double n) { + return multiply(n, n, n); + } + + /** + * Divide this vector by another vector on each component. + * + * @param other the other vector + * @return a new vector + */ + public Vector3 divide(Vector3 other) { + return divide(other.x, other.y, other.z); + } + + /** + * Divide this vector by another vector on each component. + * + * @param x the value to divide by + * @param y the value to divide by + * @param z the value to divide by + * @return a new vector + */ + public Vector3 divide(double x, double y, double z) { + return new Vector3(this.x / x, this.y / y, this.z / z); + } + + /** + * Perform scalar division and return a new vector. + * + * @param n the value to divide by + * @return a new vector + */ + public Vector3 divide(double n) { + return divide(n, n, n); + } + + /** + * Get the length of the vector. + * + * @return length + */ + public double length() { + return Math.sqrt(lengthSq()); + } + + /** + * Get the length, squared, of the vector. + * + * @return length, squared + */ + public double lengthSq() { + return x * x + y * y + z * z; + } + + /** + * Get the distance between this vector and another vector. + * + * @param other the other vector + * @return distance + */ + public double distance(Vector3 other) { + return Math.sqrt(distanceSq(other)); + } + + /** + * Get the distance between this vector and another vector, squared. + * + * @param other the other vector + * @return distance + */ + public double distanceSq(Vector3 other) { + double dx = other.x - x; + double dy = other.y - y; + double dz = other.z - z; + return dx * dx + dy * dy + dz * dz; + } + + /** + * Get the normalized vector, which is the vector divided by its + * length, as a new vector. + * + * @return a new vector + */ + public Vector3 normalize() { + return divide(length()); + } + + /** + * Gets the dot product of this and another vector. + * + * @param other the other vector + * @return the dot product of this and the other vector + */ + public double dot(Vector3 other) { + return x * other.x + y * other.y + z * other.z; + } + + /** + * Gets the cross product of this and another vector. + * + * @param other the other vector + * @return the cross product of this and the other vector + */ + public Vector3 cross(Vector3 other) { + return new Vector3( + y * other.z - z * other.y, + z * other.x - x * other.z, + x * other.y - y * other.x + ); + } + + /** + * Checks to see if a vector is contained with another. + * + * @param min the minimum point (X, Y, and Z are the lowest) + * @param max the maximum point (X, Y, and Z are the lowest) + * @return true if the vector is contained + */ + public boolean containedWithin(Vector3 min, Vector3 max) { + return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; + } + + /** + * Clamp the Y component. + * + * @param min the minimum value + * @param max the maximum value + * @return a new vector + */ + public Vector3 clampY(int min, int max) { + checkArgument(min <= max, "minimum cannot be greater than maximum"); + if (y < min) { + return new Vector3(x, min, z); + } + if (y > max) { + return new Vector3(x, max, z); + } + return this; + } + + /** + * Floors the values of all components. + * + * @return a new vector + */ + public Vector3 floor() { + return new Vector3(Math.floor(x), Math.floor(y), Math.floor(z)); + } + + /** + * Rounds all components up. + * + * @return a new vector + */ + public Vector3 ceil() { + return new Vector3(Math.ceil(x), Math.ceil(y), Math.ceil(z)); + } + + /** + * Rounds all components to the closest integer. + * + *

Components < 0.5 are rounded down, otherwise up.

+ * + * @return a new vector + */ + public Vector3 round() { + return new Vector3(Math.floor(x + 0.5), Math.floor(y + 0.5), Math.floor(z + 0.5)); + } + + /** + * Returns a vector with the absolute values of the components of + * this vector. + * + * @return a new vector + */ + public Vector3 abs() { + return new Vector3(Math.abs(x), Math.abs(y), Math.abs(z)); + } + + /** + * Perform a 2D transformation on this vector and return a new one. + * + * @param angle in degrees + * @param aboutX about which x coordinate to rotate + * @param aboutZ about which z coordinate to rotate + * @param translateX what to add after rotation + * @param translateZ what to add after rotation + * @return a new vector + * @see AffineTransform another method to transform vectors + */ + public Vector3 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { + angle = Math.toRadians(angle); + 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; + double z2 = x * sin + z * cos; + + return new Vector3( + x2 + aboutX + translateX, + y, + z2 + aboutZ + translateZ + ); + } + + /** + * Get this vector's pitch as used within the game. + * + * @return pitch in radians + */ + public double toPitch() { + double x = getX(); + double z = getZ(); + + if (x == 0 && z == 0) { + return getY() > 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)); + } + } + + /** + * Get this vector's yaw as used within the game. + * + * @return yaw in radians + */ + public double toYaw() { + double x = getX(); + double z = getZ(); + + double t = Math.atan2(-x, z); + double tau = 2 * Math.PI; + + return Math.toDegrees(((t + tau) % tau)); + } + + /** + * Gets the minimum components of two vectors. + * + * @param v2 the second vector + * @return minimum + */ + public Vector3 getMinimum(Vector3 v2) { + return new Vector3( + Math.min(x, v2.x), + Math.min(y, v2.y), + Math.min(z, v2.z) + ); + } + + /** + * Gets the maximum components of two vectors. + * + * @param v2 the second vector + * @return maximum + */ + public Vector3 getMaximum(Vector3 v2) { + return new Vector3( + Math.max(x, v2.x), + Math.max(y, v2.y), + Math.max(z, v2.z) + ); + } + + /** + * Create a new {@code BlockVector} using the given components. + * + * @param x the X coordinate + * @param y the Y coordinate + * @param z the Z coordinate + * @return a new {@code BlockVector} + */ + public static BlockVector3 toBlockPoint(double x, double y, double z) { + return new BlockVector3(x, y, z); + } + + /** + * Create a new {@code BlockVector} from this vector. + * + * @return a new {@code BlockVector} + */ + public BlockVector3 toBlockPoint() { + return toBlockPoint(x, y, z); + } + + /** + * Creates a 2D vector by dropping the Y component from this vector. + * + * @return a new {@link Vector2} + */ + public Vector2 toVector2() { + return new Vector2(x, z); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Vector3)) { + return false; + } + + Vector3 other = (Vector3) obj; + return other.x == this.x && other.y == this.y && other.z == this.z; + } + + @Override + public int hashCode() { + int hash = 17; + hash = 31 * hash + Double.hashCode(x); + hash = 31 * hash + Double.hashCode(y); + hash = 31 * hash + Double.hashCode(z); + return hash; + } + + @Override + public String toString() { + return "(" + x + ", " + y + ", " + z + ")"; + } + +} \ No newline at end of file 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 0cfd4c35f..c12beee56 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 @@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; @@ -105,7 +105,7 @@ public class HeightMap { public int apply(int[] data) throws MaxChangedBlocksException { checkNotNull(data); - Vector minY = region.getMinimumPoint(); + BlockVector3 minY = region.getMinimumPoint(); int originX = minY.getBlockX(); int originY = minY.getBlockY(); int originZ = minY.getBlockZ(); @@ -134,17 +134,17 @@ public class HeightMap { // Depending on growing or shrinking we need to start at the bottom or top if (newHeight > curHeight) { // Set the top block of the column to be the same type (this might go wrong with rounding) - BlockState existing = session.getBlock(new Vector(xr, curHeight, zr)); + BlockState existing = session.getBlock(new BlockVector3(xr, curHeight, zr)); // Skip water/lava if (existing.getBlockType() != BlockTypes.WATER && existing.getBlockType() != BlockTypes.LAVA) { - session.setBlock(new Vector(xr, newHeight, zr), existing); + session.setBlock(new BlockVector3(xr, newHeight, zr), existing); ++blocksChanged; // Grow -- start from 1 below top replacing airblocks for (int y = newHeight - 1 - originY; y >= 0; --y) { int copyFrom = (int) (y * scale); - session.setBlock(new Vector(xr, originY + y, zr), session.getBlock(new Vector(xr, originY + copyFrom, zr))); + session.setBlock(new BlockVector3(xr, originY + y, zr), session.getBlock(new BlockVector3(xr, originY + copyFrom, zr))); ++blocksChanged; } } @@ -152,18 +152,18 @@ public class HeightMap { // Shrink -- start from bottom for (int y = 0; y < newHeight - originY; ++y) { int copyFrom = (int) (y * scale); - session.setBlock(new Vector(xr, originY + y, zr), session.getBlock(new Vector(xr, originY + copyFrom, zr))); + session.setBlock(new BlockVector3(xr, originY + y, zr), session.getBlock(new BlockVector3(xr, originY + copyFrom, zr))); ++blocksChanged; } // Set the top block of the column to be the same type // (this could otherwise go wrong with rounding) - session.setBlock(new Vector(xr, newHeight, zr), session.getBlock(new Vector(xr, curHeight, zr))); + session.setBlock(new BlockVector3(xr, newHeight, zr), session.getBlock(new BlockVector3(xr, curHeight, zr))); ++blocksChanged; // Fill rest with air for (int y = newHeight + 1; y <= curHeight; ++y) { - session.setBlock(new Vector(xr, y, zr), fillerAir); + session.setBlock(new BlockVector3(xr, y, zr), fillerAir); ++blocksChanged; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java index 007977d58..af191dc72 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.math.geom; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.Vector2; import java.util.ArrayList; import java.util.List; @@ -40,9 +40,9 @@ public final class Polygons { * @param center the center point of the cylinder * @param radius the radius of the cylinder * @param maxPoints max points to be used for the calculation - * @return a list of {@link BlockVector2D} which resemble the shape as a polygon + * @return a list of {@link BlockVector2} which resemble the shape as a polygon */ - public static List polygonizeCylinder(Vector2D center, Vector2D radius, int maxPoints) { + public static List polygonizeCylinder(BlockVector2 center, Vector2 radius, int maxPoints) { int nPoints = (int) Math.ceil(Math.PI*radius.length()); // These strange semantics for maxPoints are copied from the selectSecondary method. @@ -50,11 +50,11 @@ public final class Polygons { nPoints = maxPoints - 1; } - final List points = new ArrayList<>(nPoints); + final List points = new ArrayList<>(nPoints); for (int i = 0; i < nPoints; ++i) { double angle = i * (2.0 * Math.PI) / nPoints; - final Vector2D pos = new Vector2D(Math.cos(angle), Math.sin(angle)); - final BlockVector2D blockVector2D = pos.multiply(radius).add(center).toBlockVector2D(); + final Vector2 pos = new Vector2(Math.cos(angle), Math.sin(angle)); + final BlockVector2 blockVector2D = pos.multiply(radius).toBlockPoint().add(center); points.add(blockVector2D); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java index 68df24b0d..28ce2c492 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.math.interpolation; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import java.util.List; @@ -44,7 +44,7 @@ public interface Interpolation { * @param position the position to interpolate * @return the result */ - Vector getPosition(double position); + Vector3 getPosition(double position); /** * Gets the result of f'(position). @@ -52,7 +52,7 @@ public interface Interpolation { * @param position the position to interpolate * @return the result */ - Vector get1stDerivative(double position); + Vector3 get1stDerivative(double position); /** * Gets the result of ∫ab|f'(t)| dt.
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 f5f41313b..3d87135f9 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 @@ -23,7 +23,7 @@ package com.sk89q.worldedit.math.interpolation; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import java.util.Collections; import java.util.List; @@ -37,10 +37,10 @@ import java.util.List; public class KochanekBartelsInterpolation implements Interpolation { private List nodes; - private Vector[] coeffA; - private Vector[] coeffB; - private Vector[] coeffC; - private Vector[] coeffD; + private Vector3[] coeffA; + private Vector3[] coeffB; + private Vector3[] coeffC; + private Vector3[] coeffD; private double scaling; public KochanekBartelsInterpolation() { @@ -57,10 +57,10 @@ public class KochanekBartelsInterpolation implements Interpolation { private void recalc() { final int nNodes = nodes.size(); - coeffA = new Vector[nNodes]; - coeffB = new Vector[nNodes]; - coeffC = new Vector[nNodes]; - coeffD = new Vector[nNodes]; + coeffA = new Vector3[nNodes]; + coeffB = new Vector3[nNodes]; + coeffC = new Vector3[nNodes]; + coeffD = new Vector3[nNodes]; if (nNodes == 0) return; @@ -107,11 +107,11 @@ public class KochanekBartelsInterpolation implements Interpolation { * @param f4 coefficient for baseIndex+2 * @return linear combination of nodes[n-1..n+2] with f1..4 */ - private Vector linearCombination(int baseIndex, double f1, double f2, double f3, double f4) { - final Vector r1 = retrieve(baseIndex - 1).multiply(f1); - final Vector r2 = retrieve(baseIndex ).multiply(f2); - final Vector r3 = retrieve(baseIndex + 1).multiply(f3); - final Vector r4 = retrieve(baseIndex + 2).multiply(f4); + private Vector3 linearCombination(int baseIndex, double f1, double f2, double f3, double f4) { + final Vector3 r1 = retrieve(baseIndex - 1).multiply(f1); + final Vector3 r2 = retrieve(baseIndex ).multiply(f2); + final Vector3 r3 = retrieve(baseIndex + 1).multiply(f3); + final Vector3 r4 = retrieve(baseIndex + 2).multiply(f4); return r1.add(r2).add(r3).add(r4); } @@ -122,7 +122,7 @@ public class KochanekBartelsInterpolation implements Interpolation { * @param index node index to retrieve * @return nodes[clamp(0, nodes.length-1)] */ - private Vector retrieve(int index) { + private Vector3 retrieve(int index) { if (index < 0) return fastRetrieve(0); @@ -132,12 +132,12 @@ public class KochanekBartelsInterpolation implements Interpolation { return fastRetrieve(index); } - private Vector fastRetrieve(int index) { + private Vector3 fastRetrieve(int index) { return nodes.get(index).getPosition(); } @Override - public Vector getPosition(double position) { + public Vector3 getPosition(double position) { if (coeffA == null) throw new IllegalStateException("Must call setNodes first."); @@ -149,16 +149,16 @@ public class KochanekBartelsInterpolation implements Interpolation { final int index = (int) Math.floor(position); final double remainder = position - index; - final Vector a = coeffA[index]; - final Vector b = coeffB[index]; - final Vector c = coeffC[index]; - final Vector d = coeffD[index]; + final Vector3 a = coeffA[index]; + final Vector3 b = coeffB[index]; + final Vector3 c = coeffC[index]; + final Vector3 d = coeffD[index]; return a.multiply(remainder).add(b).multiply(remainder).add(c).multiply(remainder).add(d); } @Override - public Vector get1stDerivative(double position) { + public Vector3 get1stDerivative(double position) { if (coeffA == null) throw new IllegalStateException("Must call setNodes first."); @@ -170,9 +170,9 @@ public class KochanekBartelsInterpolation implements Interpolation { final int index = (int) Math.floor(position); //final double remainder = position - index; - final Vector a = coeffA[index]; - final Vector b = coeffB[index]; - final Vector c = coeffC[index]; + final Vector3 a = coeffA[index]; + final Vector3 b = coeffB[index]; + final Vector3 c = coeffC[index]; return a.multiply(1.5*position - 3.0*index).add(b).multiply(2.0*position).add(a.multiply(1.5*index).subtract(b).multiply(2.0*index)).add(c).multiply(scaling); } @@ -219,9 +219,9 @@ public class KochanekBartelsInterpolation implements Interpolation { } private double arcLengthRecursive(int index, double remainderLeft, double remainderRight) { - final Vector a = coeffA[index].multiply(3.0); - final Vector b = coeffB[index].multiply(2.0); - final Vector c = coeffC[index]; + final Vector3 a = coeffA[index].multiply(3.0); + final Vector3 b = coeffB[index].multiply(2.0); + final Vector3 c = coeffC[index]; final int nPoints = 8; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/LinearInterpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/LinearInterpolation.java index ea1962119..7b701f5fe 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/LinearInterpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/LinearInterpolation.java @@ -23,7 +23,7 @@ package com.sk89q.worldedit.math.interpolation; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import java.util.List; @@ -42,7 +42,7 @@ public class LinearInterpolation implements Interpolation { } @Override - public Vector getPosition(double position) { + public Vector3 getPosition(double position) { if (nodes == null) throw new IllegalStateException("Must call setNodes first."); @@ -54,8 +54,8 @@ public class LinearInterpolation implements Interpolation { final int index1 = (int) Math.floor(position); final double remainder = position - index1; - final Vector position1 = nodes.get(index1).getPosition(); - final Vector position2 = nodes.get(index1 + 1).getPosition(); + final Vector3 position1 = nodes.get(index1).getPosition(); + final Vector3 position2 = nodes.get(index1 + 1).getPosition(); return position1.multiply(1.0 - remainder).add(position2.multiply(remainder)); } @@ -76,7 +76,7 @@ public class LinearInterpolation implements Interpolation { */ @Override - public Vector get1stDerivative(double position) { + public Vector3 get1stDerivative(double position) { if (nodes == null) throw new IllegalStateException("Must call setNodes first."); @@ -87,8 +87,8 @@ public class LinearInterpolation implements Interpolation { final int index1 = (int) Math.floor(position); - final Vector position1 = nodes.get(index1).getPosition(); - final Vector position2 = nodes.get(index1 + 1).getPosition(); + final Vector3 position1 = nodes.get(index1).getPosition(); + final Vector3 position2 = nodes.get(index1 + 1).getPosition(); return position2.subtract(position1); } @@ -135,8 +135,8 @@ public class LinearInterpolation implements Interpolation { } private double arcLengthRecursive(int index, double remainderA, double remainderB) { - final Vector position1 = nodes.get(index).getPosition(); - final Vector position2 = nodes.get(index + 1).getPosition(); + final Vector3 position1 = nodes.get(index).getPosition(); + final Vector3 position2 = nodes.get(index + 1).getPosition(); return position1.distance(position2) * (remainderB - remainderA); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Node.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Node.java index ce604824c..c2bc1e93b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Node.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Node.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.math.interpolation; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; /** * Represents a node for interpolation. @@ -31,14 +31,14 @@ import com.sk89q.worldedit.Vector; */ public class Node { - private Vector position; + private Vector3 position; private double tension; private double bias; private double continuity; public Node() { - this(new Vector(0, 0, 0)); + this(new Vector3(0, 0, 0)); } public Node(Node other) { @@ -49,16 +49,16 @@ public class Node { this.continuity = other.continuity; } - public Node(Vector position) { + public Node(Vector3 position) { this.position = position; } - public Vector getPosition() { + public Vector3 getPosition() { return position; } - public void setPosition(Vector position) { + public void setPosition(Vector3 position) { this.position = position; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java index d6920b829..29a3ee5ee 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java @@ -23,7 +23,7 @@ package com.sk89q.worldedit.math.interpolation; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import java.util.List; import java.util.Map.Entry; @@ -65,7 +65,7 @@ public class ReparametrisingInterpolation implements Interpolation { } @Override - public Vector getPosition(double position) { + public Vector3 getPosition(double position) { if (position > 1) return null; @@ -73,7 +73,7 @@ public class ReparametrisingInterpolation implements Interpolation { } @Override - public Vector get1stDerivative(double position) { + public Vector3 get1stDerivative(double position) { if (position > 1) return null; 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 dbf7720fd..1da9d5b2d 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 @@ -19,8 +19,9 @@ package com.sk89q.worldedit.math.noise; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.Vector2; +import com.sk89q.worldedit.math.Vector3; + import net.royawesome.jlibnoise.module.Module; import java.util.Random; @@ -46,12 +47,12 @@ abstract class JLibNoiseGenerator implements NoiseGenerator { public abstract int getSeed(); @Override - public float noise(Vector2D position) { + public float noise(Vector2 position) { return forceRange(module.GetValue(position.getX(), 0, position.getZ())); } @Override - public float noise(Vector position) { + public float noise(Vector3 position) { return forceRange(module.GetValue(position.getX(), position.getY(), position.getZ())); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/NoiseGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/NoiseGenerator.java index bb57d23f0..185e41fbb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/NoiseGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/NoiseGenerator.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.math.noise; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.Vector2; +import com.sk89q.worldedit.math.Vector3; /** * Generates noise in a deterministic or non-deterministic manner. @@ -34,7 +34,7 @@ public interface NoiseGenerator { * @param position the position * @return a noise value between 0 (inclusive) and 1 (inclusive) */ - float noise(Vector2D position); + float noise(Vector2 position); /** * Get the noise value for the given position. The returned value may @@ -43,6 +43,6 @@ public interface NoiseGenerator { * @param position the position * @return a noise value between 0 (inclusive) and 1 (inclusive) */ - float noise(Vector position); + float noise(Vector3 position); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/RandomNoise.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/RandomNoise.java index 6daed2841..ff3421404 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/RandomNoise.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/RandomNoise.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.math.noise; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.Vector2; +import com.sk89q.worldedit.math.Vector3; import java.util.Random; @@ -50,12 +50,12 @@ public class RandomNoise implements NoiseGenerator { } @Override - public float noise(Vector2D position) { + public float noise(Vector2 position) { return random.nextFloat(); } @Override - public float noise(Vector position) { + public float noise(Vector3 position) { return random.nextFloat(); } 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 36db0566c..376fd0b33 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 @@ -19,8 +19,9 @@ package com.sk89q.worldedit.math.transform; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.MathUtils; +import com.sk89q.worldedit.math.Vector3; /** * An affine transform. @@ -236,7 +237,11 @@ public class AffineTransform implements Transform { n20, n21, n22, n23); } - public AffineTransform translate(Vector vec) { + public AffineTransform translate(Vector3 vec) { + return translate(vec.getX(), vec.getY(), vec.getZ()); + } + + public AffineTransform translate(BlockVector3 vec) { return translate(vec.getX(), vec.getY(), vec.getZ()); } @@ -282,13 +287,13 @@ public class AffineTransform implements Transform { return concatenate(new AffineTransform(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0)); } - public AffineTransform scale(Vector vec) { + public AffineTransform scale(Vector3 vec) { return scale(vec.getX(), vec.getY(), vec.getZ()); } @Override - public Vector apply(Vector vector) { - return new Vector( + public Vector3 apply(Vector3 vector) { + return new Vector3( vector.getX() * m00 + vector.getY() * m01 + vector.getZ() * m02 + m03, vector.getX() * m10 + vector.getY() * m11 + vector.getZ() * m12 + m13, vector.getX() * m20 + vector.getY() * m21 + vector.getZ() * m22 + m23); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/CombinedTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/CombinedTransform.java index 646e2a209..e5f2a2586 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/CombinedTransform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/CombinedTransform.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.math.transform; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import java.util.ArrayList; import java.util.Arrays; @@ -66,7 +66,7 @@ public class CombinedTransform implements Transform { } @Override - public Vector apply(Vector vector) { + public Vector3 apply(Vector3 vector) { for (Transform transform : transforms) { vector = transform.apply(vector); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Identity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Identity.java index b0f4dddef..f9f1ed125 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Identity.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Identity.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.math.transform; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; /** * Makes no transformation to given vectors. @@ -32,7 +32,7 @@ public class Identity implements Transform { } @Override - public Vector apply(Vector vector) { + public Vector3 apply(Vector3 vector) { return vector; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Transform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Transform.java index b8df8bcbd..e12030022 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Transform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Transform.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.math.transform; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; /** - * Makes a transformation of {@link Vector}s. + * Makes a transformation of {@link Vector3}s. */ public interface Transform { @@ -41,7 +41,7 @@ public interface Transform { * @param input the input * @return the result */ - Vector apply(Vector input); + Vector3 apply(Vector3 input); /** * Create a new inverse transform. 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 44f7070cb..cdaf362db 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 @@ -19,10 +19,9 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.iterator.RegionIterator; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.storage.ChunkStore; @@ -42,8 +41,8 @@ public abstract class AbstractRegion implements Region { } @Override - public Vector getCenter() { - return getMinimumPoint().add(getMaximumPoint()).divide(2); + public Vector3 getCenter() { + return getMinimumPoint().add(getMaximumPoint()).toVector3().divide(2); } /** @@ -52,7 +51,7 @@ public abstract class AbstractRegion implements Region { * @return iterator of points inside the region */ @Override - public Iterator iterator() { + public Iterator iterator() { return new RegionIterator(this); } @@ -67,7 +66,7 @@ public abstract class AbstractRegion implements Region { } @Override - public void shift(Vector change) throws RegionOperationException { + public void shift(BlockVector3 change) throws RegionOperationException { expand(change); contract(change); } @@ -82,20 +81,20 @@ public abstract class AbstractRegion implements Region { } @Override - public List polygonize(int maxPoints) { + public List polygonize(int maxPoints) { if (maxPoints >= 0 && maxPoints < 4) { throw new IllegalArgumentException("Cannot polygonize an AbstractRegion with no overridden polygonize method into less than 4 points."); } - final BlockVector min = getMinimumPoint().toBlockVector(); - final BlockVector max = getMaximumPoint().toBlockVector(); + final BlockVector3 min = getMinimumPoint(); + final BlockVector3 max = getMaximumPoint(); - final List points = new ArrayList<>(4); + final List points = new ArrayList<>(4); - points.add(new BlockVector2D(min.getX(), min.getZ())); - points.add(new BlockVector2D(min.getX(), max.getZ())); - points.add(new BlockVector2D(max.getX(), max.getZ())); - points.add(new BlockVector2D(max.getX(), min.getZ())); + points.add(new BlockVector2(min.getX(), min.getZ())); + points.add(new BlockVector2(min.getX(), max.getZ())); + points.add(new BlockVector2(max.getX(), max.getZ())); + points.add(new BlockVector2(max.getX(), min.getZ())); return points; } @@ -107,12 +106,12 @@ public abstract class AbstractRegion implements Region { */ @Override public int getArea() { - Vector min = getMinimumPoint(); - Vector max = getMaximumPoint(); + BlockVector3 min = getMinimumPoint(); + BlockVector3 max = getMaximumPoint(); - return (int)((max.getX() - min.getX() + 1) * - (max.getY() - min.getY() + 1) * - (max.getZ() - min.getZ() + 1)); + return (max.getX() - min.getX() + 1) * + (max.getY() - min.getY() + 1) * + (max.getZ() - min.getZ() + 1); } /** @@ -122,10 +121,10 @@ public abstract class AbstractRegion implements Region { */ @Override public int getWidth() { - Vector min = getMinimumPoint(); - Vector max = getMaximumPoint(); + BlockVector3 min = getMinimumPoint(); + BlockVector3 max = getMaximumPoint(); - return (int) (max.getX() - min.getX() + 1); + return max.getX() - min.getX() + 1; } /** @@ -135,10 +134,10 @@ public abstract class AbstractRegion implements Region { */ @Override public int getHeight() { - Vector min = getMinimumPoint(); - Vector max = getMaximumPoint(); + BlockVector3 min = getMinimumPoint(); + BlockVector3 max = getMaximumPoint(); - return (int) (max.getY() - min.getY() + 1); + return max.getY() - min.getY() + 1; } /** @@ -148,10 +147,10 @@ public abstract class AbstractRegion implements Region { */ @Override public int getLength() { - Vector min = getMinimumPoint(); - Vector max = getMaximumPoint(); + BlockVector3 min = getMinimumPoint(); + BlockVector3 max = getMaximumPoint(); - return (int) (max.getZ() - min.getZ() + 1); + return max.getZ() - min.getZ() + 1; } /** @@ -160,21 +159,21 @@ public abstract class AbstractRegion implements Region { * @return a set of chunks */ @Override - public Set getChunks() { - final Set chunks = new HashSet<>(); + public Set getChunks() { + final Set chunks = new HashSet<>(); - final Vector min = getMinimumPoint(); - final Vector max = getMaximumPoint(); + final BlockVector3 min = getMinimumPoint(); + final BlockVector3 max = getMaximumPoint(); final int minY = min.getBlockY(); for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) { for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) { - if (!contains(new Vector(x, minY, z))) { + if (!contains(new BlockVector3(x, minY, z))) { continue; } - chunks.add(new BlockVector2D( + chunks.add(new BlockVector2( x >> ChunkStore.CHUNK_SHIFTS, z >> ChunkStore.CHUNK_SHIFTS )); @@ -185,20 +184,20 @@ public abstract class AbstractRegion implements Region { } @Override - public Set getChunkCubes() { - final Set chunks = new HashSet<>(); + public Set getChunkCubes() { + final Set chunks = new HashSet<>(); - final Vector min = getMinimumPoint(); - final Vector max = getMaximumPoint(); + 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) { - if (!contains(new Vector(x, y, z))) { + if (!contains(new BlockVector3(x, y, z))) { continue; } - chunks.add(new BlockVector( + chunks.add(new BlockVector3( x >> ChunkStore.CHUNK_SHIFTS, y >> ChunkStore.CHUNK_SHIFTS, z >> ChunkStore.CHUNK_SHIFTS diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java index fce016e23..ce1fc5b22 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java @@ -21,7 +21,8 @@ package com.sk89q.worldedit.regions; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.polyhedron.Edge; import com.sk89q.worldedit.regions.polyhedron.Triangle; import com.sk89q.worldedit.world.World; @@ -40,7 +41,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { /** * Vertices that are contained in the convex hull. */ - private final Set vertices = new LinkedHashSet<>(); + private final Set vertices = new LinkedHashSet<>(); /** * Triangles that form the convex hull. @@ -50,25 +51,25 @@ public class ConvexPolyhedralRegion extends AbstractRegion { /** * Vertices that are coplanar to the first 3 vertices. */ - private final Set vertexBacklog = new LinkedHashSet<>(); + private final Set vertexBacklog = new LinkedHashSet<>(); /** * Minimum point of the axis-aligned bounding box. */ - private Vector minimumPoint; + private BlockVector3 minimumPoint; /** * Maximum point of the axis-aligned bounding box. */ - private Vector maximumPoint; + private BlockVector3 maximumPoint; /** * Accumulator for the barycenter of the polyhedron. Divide by vertices.size() to get the actual center. */ - private Vector centerAccum = Vector.ZERO; + private BlockVector3 centerAccum = BlockVector3.ZERO; /** - * The last triangle that caused a {@link #contains(Vector)} to classify a point as "outside". Used for optimization. + * The last triangle that caused a {@link #contains(Vector3)} to classify a point as "outside". Used for optimization. */ private Triangle lastTriangle; @@ -108,7 +109,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { minimumPoint = null; maximumPoint = null; - centerAccum = Vector.ZERO; + centerAccum = BlockVector3.ZERO; lastTriangle = null; } @@ -118,7 +119,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { * @param vertex the vertex * @return true, if something changed. */ - public boolean addVertex(Vector vertex) { + public boolean addVertex(BlockVector3 vertex) { checkNotNull(vertex); lastTriangle = null; // Probably not necessary @@ -132,7 +133,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { return false; } - if (containsRaw(vertex)) { + if (containsRaw(vertex.toVector3())) { return vertexBacklog.add(vertex); } } @@ -144,8 +145,8 @@ public class ConvexPolyhedralRegion extends AbstractRegion { if (minimumPoint == null) { minimumPoint = maximumPoint = vertex; } else { - minimumPoint = Vector.getMinimum(minimumPoint, vertex); - maximumPoint = Vector.getMaximum(maximumPoint, vertex); + minimumPoint = minimumPoint.getMinimum(vertex); + maximumPoint = maximumPoint.getMaximum(vertex); } @@ -158,10 +159,10 @@ public class ConvexPolyhedralRegion extends AbstractRegion { case 3: // Generate minimal mesh to start from - final Vector[] v = vertices.toArray(new Vector[vertices.size()]); + final BlockVector3[] v = vertices.toArray(new BlockVector3[vertices.size()]); - triangles.add((new Triangle(v[0], v[1], v[2]))); - triangles.add((new Triangle(v[0], v[2], v[1]))); + triangles.add((new Triangle(v[0].toVector3(), v[1].toVector3(), v[2].toVector3()))); + triangles.add((new Triangle(v[0].toVector3(), v[2].toVector3(), v[1].toVector3()))); return true; } @@ -171,7 +172,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { final Triangle triangle = it.next(); // If the triangle can't be seen, it's not relevant - if (!triangle.above(vertex)) { + if (!triangle.above(vertex.toVector3())) { continue; } @@ -191,7 +192,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { // Add triangles between the remembered edges and the new vertex. for (Edge edge : borderEdges) { - triangles.add(edge.createTriangle(vertex)); + triangles.add(edge.createTriangle(vertex.toVector3())); } if (!vertexBacklog.isEmpty()) { @@ -199,9 +200,9 @@ public class ConvexPolyhedralRegion extends AbstractRegion { vertices.remove(vertex); // Clone, clear and work through the backlog - final List vertexBacklog2 = new ArrayList<>(vertexBacklog); + final List vertexBacklog2 = new ArrayList<>(vertexBacklog); vertexBacklog.clear(); - for (Vector vertex2 : vertexBacklog2) { + for (BlockVector3 vertex2 : vertexBacklog2) { addVertex(vertex2); } @@ -217,39 +218,40 @@ public class ConvexPolyhedralRegion extends AbstractRegion { } @Override - public Vector getMinimumPoint() { + public BlockVector3 getMinimumPoint() { return minimumPoint; } @Override - public Vector getMaximumPoint() { + public BlockVector3 getMaximumPoint() { return maximumPoint; } @Override - public Vector getCenter() { - return centerAccum.divide(vertices.size()); + public Vector3 getCenter() { + return centerAccum.toVector3().divide(vertices.size()); } @Override - public void expand(Vector... changes) throws RegionOperationException { + public void expand(BlockVector3... changes) throws RegionOperationException { } @Override - public void contract(Vector... changes) throws RegionOperationException { + public void contract(BlockVector3... changes) throws RegionOperationException { } @Override - public void shift(Vector change) throws RegionOperationException { + public void shift(BlockVector3 change) throws RegionOperationException { + Vector3 vec = change.toVector3(); shiftCollection(vertices, change); shiftCollection(vertexBacklog, change); for (int i = 0; i < triangles.size(); ++i) { final Triangle triangle = triangles.get(i); - final Vector v0 = change.add(triangle.getVertex(0)); - final Vector v1 = change.add(triangle.getVertex(1)); - final Vector v2 = change.add(triangle.getVertex(2)); + final Vector3 v0 = vec.add(triangle.getVertex(0)); + final Vector3 v1 = vec.add(triangle.getVertex(1)); + final Vector3 v2 = vec.add(triangle.getVertex(2)); triangles.set(i, new Triangle(v0, v1, v2)); } @@ -260,16 +262,16 @@ public class ConvexPolyhedralRegion extends AbstractRegion { lastTriangle = null; } - private static void shiftCollection(Collection collection, Vector change) { - final List tmp = new ArrayList<>(collection); + private static void shiftCollection(Collection collection, BlockVector3 change) { + final List tmp = new ArrayList<>(collection); collection.clear(); - for (Vector vertex : tmp) { + for (BlockVector3 vertex : tmp) { collection.add(change.add(vertex)); } } @Override - public boolean contains(Vector position) { + public boolean contains(BlockVector3 position) { if (!isDefined()) { return false; } @@ -278,8 +280,8 @@ public class ConvexPolyhedralRegion extends AbstractRegion { final int y = position.getBlockY(); final int z = position.getBlockZ(); - final Vector min = getMinimumPoint(); - final Vector max = getMaximumPoint(); + final BlockVector3 min = getMinimumPoint(); + final BlockVector3 max = getMaximumPoint(); if (x < min.getBlockX()) return false; if (x > max.getBlockX()) return false; @@ -288,10 +290,10 @@ public class ConvexPolyhedralRegion extends AbstractRegion { if (z < min.getBlockZ()) return false; if (z > max.getBlockZ()) return false; - return containsRaw(position); + return containsRaw(position.toVector3()); } - private boolean containsRaw(Vector pt) { + private boolean containsRaw(Vector3 pt) { if (lastTriangle != null && lastTriangle.above(pt)) { return false; } @@ -310,12 +312,12 @@ public class ConvexPolyhedralRegion extends AbstractRegion { return true; } - public Collection getVertices() { + public Collection getVertices() { if (vertexBacklog.isEmpty()) { return vertices; } - final List ret = new ArrayList<>(vertices); + final List ret = new ArrayList<>(vertices); ret.addAll(vertexBacklog); return ret; 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 942e92d6e..cebd62098 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 @@ -22,15 +22,14 @@ package com.sk89q.worldedit.regions; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.storage.ChunkStore; import java.util.HashSet; import java.util.Iterator; +import java.util.NoSuchElementException; import java.util.Set; /** @@ -38,8 +37,8 @@ import java.util.Set; */ public class CuboidRegion extends AbstractRegion implements FlatRegion { - private Vector pos1; - private Vector pos2; + private BlockVector3 pos1; + private BlockVector3 pos2; /** * Construct a new instance of this cuboid using two corners of the cuboid. @@ -47,7 +46,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { * @param pos1 the first position * @param pos2 the second position */ - public CuboidRegion(Vector pos1, Vector pos2) { + public CuboidRegion(BlockVector3 pos1, BlockVector3 pos2) { this(null, pos1, pos2); } @@ -58,7 +57,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { * @param pos1 the first position * @param pos2 the second position */ - public CuboidRegion(World world, Vector pos1, Vector pos2) { + public CuboidRegion(World world, BlockVector3 pos1, BlockVector3 pos2) { super(world); checkNotNull(pos1); checkNotNull(pos2); @@ -72,7 +71,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { * * @return a position */ - public Vector getPos1() { + public BlockVector3 getPos1() { return pos1; } @@ -81,7 +80,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { * * @param pos1 a position */ - public void setPos1(Vector pos1) { + public void setPos1(BlockVector3 pos1) { this.pos1 = pos1; } @@ -90,7 +89,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { * * @return a position */ - public Vector getPos2() { + public BlockVector3 getPos2() { return pos2; } @@ -99,7 +98,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { * * @param pos2 a position */ - public void setPos2(Vector pos2) { + public void setPos2(BlockVector3 pos2) { this.pos2 = pos2; } @@ -117,21 +116,21 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { * @return a new complex region */ public Region getFaces() { - Vector min = getMinimumPoint(); - Vector max = getMaximumPoint(); + BlockVector3 min = getMinimumPoint(); + BlockVector3 max = getMaximumPoint(); return new RegionIntersection( // Project to Z-Y plane - new CuboidRegion(pos1.setX(min.getX()), pos2.setX(min.getX())), - new CuboidRegion(pos1.setX(max.getX()), pos2.setX(max.getX())), + new CuboidRegion(pos1.withX(min.getX()), pos2.withX(min.getX())), + new CuboidRegion(pos1.withX(max.getX()), pos2.withX(max.getX())), // Project to X-Y plane - new CuboidRegion(pos1.setZ(min.getZ()), pos2.setZ(min.getZ())), - new CuboidRegion(pos1.setZ(max.getZ()), pos2.setZ(max.getZ())), + new CuboidRegion(pos1.withZ(min.getZ()), pos2.withZ(min.getZ())), + new CuboidRegion(pos1.withZ(max.getZ()), pos2.withZ(max.getZ())), // Project to the X-Z plane - new CuboidRegion(pos1.setY(min.getY()), pos2.setY(min.getY())), - new CuboidRegion(pos1.setY(max.getY()), pos2.setY(max.getY()))); + new CuboidRegion(pos1.withY(min.getY()), pos2.withY(min.getY())), + new CuboidRegion(pos1.withY(max.getY()), pos2.withY(max.getY()))); } /** @@ -141,31 +140,27 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { * @return a new complex region */ public Region getWalls() { - Vector min = getMinimumPoint(); - Vector max = getMaximumPoint(); + BlockVector3 min = getMinimumPoint(); + BlockVector3 max = getMaximumPoint(); return new RegionIntersection( // Project to Z-Y plane - new CuboidRegion(pos1.setX(min.getX()), pos2.setX(min.getX())), - new CuboidRegion(pos1.setX(max.getX()), pos2.setX(max.getX())), + new CuboidRegion(pos1.withX(min.getX()), pos2.withX(min.getX())), + new CuboidRegion(pos1.withX(max.getX()), pos2.withX(max.getX())), // Project to X-Y plane - new CuboidRegion(pos1.setZ(min.getZ()), pos2.setZ(min.getZ())), - new CuboidRegion(pos1.setZ(max.getZ()), pos2.setZ(max.getZ()))); + new CuboidRegion(pos1.withZ(min.getZ()), pos2.withZ(min.getZ())), + new CuboidRegion(pos1.withZ(max.getZ()), pos2.withZ(max.getZ()))); } @Override - public Vector getMinimumPoint() { - return new Vector(Math.min(pos1.getX(), pos2.getX()), - Math.min(pos1.getY(), pos2.getY()), - Math.min(pos1.getZ(), pos2.getZ())); + public BlockVector3 getMinimumPoint() { + return pos1.getMinimum(pos2); } @Override - public Vector getMaximumPoint() { - return new Vector(Math.max(pos1.getX(), pos2.getX()), - Math.max(pos1.getY(), pos2.getY()), - Math.max(pos1.getZ(), pos2.getZ())); + public BlockVector3 getMaximumPoint() { + return pos1.getMaximum(pos2); } @Override @@ -179,49 +174,49 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } @Override - public void expand(Vector... changes) { + public void expand(BlockVector3... changes) { checkNotNull(changes); - for (Vector change : changes) { + for (BlockVector3 change : changes) { if (change.getX() > 0) { if (Math.max(pos1.getX(), pos2.getX()) == pos1.getX()) { - pos1 = pos1.add(new Vector(change.getX(), 0, 0)); + pos1 = pos1.add(change.getX(), 0, 0); } else { - pos2 = pos2.add(new Vector(change.getX(), 0, 0)); + pos2 = pos2.add(change.getX(), 0, 0); } } else { if (Math.min(pos1.getX(), pos2.getX()) == pos1.getX()) { - pos1 = pos1.add(new Vector(change.getX(), 0, 0)); + pos1 = pos1.add(change.getX(), 0, 0); } else { - pos2 = pos2.add(new Vector(change.getX(), 0, 0)); + pos2 = pos2.add(change.getX(), 0, 0); } } if (change.getY() > 0) { if (Math.max(pos1.getY(), pos2.getY()) == pos1.getY()) { - pos1 = pos1.add(new Vector(0, change.getY(), 0)); + pos1 = pos1.add(0, change.getY(), 0); } else { - pos2 = pos2.add(new Vector(0, change.getY(), 0)); + pos2 = pos2.add(0, change.getY(), 0); } } else { if (Math.min(pos1.getY(), pos2.getY()) == pos1.getY()) { - pos1 = pos1.add(new Vector(0, change.getY(), 0)); + pos1 = pos1.add(0, change.getY(), 0); } else { - pos2 = pos2.add(new Vector(0, change.getY(), 0)); + pos2 = pos2.add(0, change.getY(), 0); } } if (change.getZ() > 0) { if (Math.max(pos1.getZ(), pos2.getZ()) == pos1.getZ()) { - pos1 = pos1.add(new Vector(0, 0, change.getZ())); + pos1 = pos1.add(0, 0, change.getZ()); } else { - pos2 = pos2.add(new Vector(0, 0, change.getZ())); + pos2 = pos2.add(0, 0, change.getZ()); } } else { if (Math.min(pos1.getZ(), pos2.getZ()) == pos1.getZ()) { - pos1 = pos1.add(new Vector(0, 0, change.getZ())); + pos1 = pos1.add(0, 0, change.getZ()); } else { - pos2 = pos2.add(new Vector(0, 0, change.getZ())); + pos2 = pos2.add(0, 0, change.getZ()); } } } @@ -230,49 +225,49 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } @Override - public void contract(Vector... changes) { + public void contract(BlockVector3... changes) { checkNotNull(changes); - for (Vector change : changes) { + for (BlockVector3 change : changes) { if (change.getX() < 0) { if (Math.max(pos1.getX(), pos2.getX()) == pos1.getX()) { - pos1 = pos1.add(new Vector(change.getX(), 0, 0)); + pos1 = pos1.add(change.getX(), 0, 0); } else { - pos2 = pos2.add(new Vector(change.getX(), 0, 0)); + pos2 = pos2.add(change.getX(), 0, 0); } } else { if (Math.min(pos1.getX(), pos2.getX()) == pos1.getX()) { - pos1 = pos1.add(new Vector(change.getX(), 0, 0)); + pos1 = pos1.add(change.getX(), 0, 0); } else { - pos2 = pos2.add(new Vector(change.getX(), 0, 0)); + pos2 = pos2.add(change.getX(), 0, 0); } } if (change.getY() < 0) { if (Math.max(pos1.getY(), pos2.getY()) == pos1.getY()) { - pos1 = pos1.add(new Vector(0, change.getY(), 0)); + pos1 = pos1.add(0, change.getY(), 0); } else { - pos2 = pos2.add(new Vector(0, change.getY(), 0)); + pos2 = pos2.add(0, change.getY(), 0); } } else { if (Math.min(pos1.getY(), pos2.getY()) == pos1.getY()) { - pos1 = pos1.add(new Vector(0, change.getY(), 0)); + pos1 = pos1.add(0, change.getY(), 0); } else { - pos2 = pos2.add(new Vector(0, change.getY(), 0)); + pos2 = pos2.add(0, change.getY(), 0); } } if (change.getZ() < 0) { if (Math.max(pos1.getZ(), pos2.getZ()) == pos1.getZ()) { - pos1 = pos1.add(new Vector(0, 0, change.getZ())); + pos1 = pos1.add(0, 0, change.getZ()); } else { - pos2 = pos2.add(new Vector(0, 0, change.getZ())); + pos2 = pos2.add(0, 0, change.getZ()); } } else { if (Math.min(pos1.getZ(), pos2.getZ()) == pos1.getZ()) { - pos1 = pos1.add(new Vector(0, 0, change.getZ())); + pos1 = pos1.add(0, 0, change.getZ()); } else { - pos2 = pos2.add(new Vector(0, 0, change.getZ())); + pos2 = pos2.add(0, 0, change.getZ()); } } } @@ -281,7 +276,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } @Override - public void shift(Vector change) throws RegionOperationException { + public void shift(BlockVector3 change) throws RegionOperationException { pos1 = pos1.add(change); pos2 = pos2.add(change); @@ -289,15 +284,15 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } @Override - public Set getChunks() { - Set chunks = new HashSet<>(); + public Set getChunks() { + Set chunks = new HashSet<>(); - Vector min = getMinimumPoint(); - Vector max = getMaximumPoint(); + 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) { - chunks.add(new BlockVector2D(x, z)); + chunks.add(new BlockVector2(x, z)); } } @@ -305,16 +300,16 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } @Override - public Set getChunkCubes() { - Set chunks = new HashSet<>(); + public Set getChunkCubes() { + Set chunks = new HashSet<>(); - Vector min = getMinimumPoint(); - Vector max = getMaximumPoint(); + 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) { - chunks.add(new BlockVector(x, y, z)); + chunks.add(new BlockVector3(x, y, z)); } } } @@ -323,24 +318,18 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } @Override - public boolean contains(Vector position) { - int x = position.getBlockX(); - int y = position.getBlockY(); - int z = position.getBlockZ(); + public boolean contains(BlockVector3 position) { + BlockVector3 min = getMinimumPoint(); + BlockVector3 max = getMaximumPoint(); - Vector min = getMinimumPoint(); - Vector max = getMaximumPoint(); - - return x >= min.getBlockX() && x <= max.getBlockX() - && y >= min.getBlockY() && y <= max.getBlockY() - && z >= min.getBlockZ() && z <= max.getBlockZ(); + return position.containedWithin(min, max); } @Override - public Iterator iterator() { - return new Iterator() { - private Vector min = getMinimumPoint(); - private Vector max = getMaximumPoint(); + public Iterator iterator() { + return new Iterator() { + private BlockVector3 min = getMinimumPoint(); + private BlockVector3 max = getMaximumPoint(); private int nextX = min.getBlockX(); private int nextY = min.getBlockY(); private int nextZ = min.getBlockZ(); @@ -351,9 +340,9 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } @Override - public BlockVector next() { - if (!hasNext()) throw new java.util.NoSuchElementException(); - BlockVector answer = new BlockVector(nextX, nextY, nextZ); + public BlockVector3 next() { + if (!hasNext()) throw new NoSuchElementException(); + BlockVector3 answer = new BlockVector3(nextX, nextY, nextZ); if (++nextX > max.getBlockX()) { nextX = min.getBlockX(); if (++nextY > max.getBlockY()) { @@ -365,19 +354,14 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } return answer; } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } }; } @Override - public Iterable asFlatRegion() { - return () -> new Iterator() { - private Vector min = getMinimumPoint(); - private Vector max = getMaximumPoint(); + public Iterable asFlatRegion() { + return () -> new Iterator() { + private BlockVector3 min = getMinimumPoint(); + private BlockVector3 max = getMaximumPoint(); private int nextX = min.getBlockX(); private int nextZ = min.getBlockZ(); @@ -387,9 +371,9 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } @Override - public Vector2D next() { - if (!hasNext()) throw new java.util.NoSuchElementException(); - Vector2D answer = new Vector2D(nextX, nextZ); + public BlockVector2 next() { + if (!hasNext()) throw new NoSuchElementException(); + BlockVector2 answer = new BlockVector2(nextX, nextZ); if (++nextX > max.getBlockX()) { nextX = min.getBlockX(); if (++nextZ > max.getBlockZ()) { @@ -398,11 +382,6 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } return answer; } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } }; } @@ -435,10 +414,10 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { * @param apothem the apothem, where 0 is the minimum value to make a 1x1 cuboid * @return a cuboid region */ - public static CuboidRegion fromCenter(Vector origin, int apothem) { + public static CuboidRegion fromCenter(BlockVector3 origin, int apothem) { checkNotNull(origin); checkArgument(apothem >= 0, "apothem => 0 required"); - Vector size = new Vector(1, 1, 1).multiply(apothem); + BlockVector3 size = BlockVector3.ONE.multiply(apothem); return new CuboidRegion(origin.subtract(size), origin.add(size)); } } 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 ed0e70822..acff65c3a 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 @@ -21,11 +21,11 @@ package com.sk89q.worldedit.regions; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.Vector2; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.geom.Polygons; import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator; import com.sk89q.worldedit.regions.iterator.FlatRegionIterator; @@ -39,8 +39,8 @@ import java.util.List; */ public class CylinderRegion extends AbstractRegion implements FlatRegion { - private Vector2D center; - private Vector2D radius; + private BlockVector2 center; + private Vector2 radius; private int minY; private int maxY; private boolean hasY = false; @@ -58,7 +58,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * @param world the world */ public CylinderRegion(World world) { - this(world, new Vector(), new Vector2D(), 0, 0); + this(world, BlockVector3.ZERO, Vector2.ZERO, 0, 0); hasY = false; } @@ -71,9 +71,9 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * @param minY the minimum Y, inclusive * @param maxY the maximum Y, inclusive */ - public CylinderRegion(World world, Vector center, Vector2D radius, int minY, int maxY) { + public CylinderRegion(World world, BlockVector3 center, Vector2 radius, int minY, int maxY) { super(world); - setCenter(center.toVector2D()); + setCenter(center.toBlockVector2()); setRadius(radius); this.minY = minY; this.maxY = maxY; @@ -88,9 +88,9 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * @param minY the minimum Y, inclusive * @param maxY the maximum Y, inclusive */ - public CylinderRegion(Vector center, Vector2D radius, int minY, int maxY) { + public CylinderRegion(BlockVector3 center, Vector2 radius, int minY, int maxY) { super(null); - setCenter(center.toVector2D()); + setCenter(center.toBlockVector2()); setRadius(radius); this.minY = minY; this.maxY = maxY; @@ -98,13 +98,13 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { } public CylinderRegion(CylinderRegion region) { - this(region.world, region.getCenter(), region.getRadius(), region.minY, region.maxY); + this(region.world, region.getCenter().toBlockPoint(), region.getRadius(), region.minY, region.maxY); hasY = region.hasY; } @Override - public Vector getCenter() { - return center.toVector((maxY + minY) / 2); + public Vector3 getCenter() { + return center.toVector3((maxY + minY) / 2); } /** @@ -112,7 +112,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * * @param center the center point */ - public void setCenter(Vector2D center) { + public void setCenter(BlockVector2 center) { this.center = center; } @@ -121,7 +121,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * * @return the radius along the X and Z axes */ - public Vector2D getRadius() { + public Vector2 getRadius() { return radius.subtract(0.5, 0.5); } @@ -130,7 +130,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * * @param radius the radius along the X and Z axes */ - public void setRadius(Vector2D radius) { + public void setRadius(Vector2 radius) { this.radius = radius.add(0.5, 0.5); } @@ -139,8 +139,8 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * * @param minRadius the minimum radius */ - public void extendRadius(Vector2D minRadius) { - setRadius(Vector2D.getMaximum(minRadius, getRadius())); + public void extendRadius(Vector2 minRadius) { + setRadius(minRadius.getMaximum(getRadius())); } /** @@ -164,13 +164,13 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { } @Override - public Vector getMinimumPoint() { - return center.subtract(getRadius()).toVector(minY); + public BlockVector3 getMinimumPoint() { + return center.toVector2().subtract(getRadius()).toVector3(minY).toBlockPoint(); } @Override - public Vector getMaximumPoint() { - return center.add(getRadius()).toVector(maxY); + public BlockVector3 getMaximumPoint() { + return center.toVector2().add(getRadius()).toVector3(maxY).toBlockPoint(); } @Override @@ -203,10 +203,10 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { return (int) (2 * radius.getZ()); } - private Vector2D calculateDiff2D(Vector... changes) throws RegionOperationException { - Vector2D diff = new Vector2D(); - for (Vector change : changes) { - diff = diff.add(change.toVector2D()); + private BlockVector2 calculateDiff2D(BlockVector3... changes) throws RegionOperationException { + BlockVector2 diff = BlockVector2.ZERO; + for (BlockVector3 change : changes) { + diff = diff.add(change.toBlockVector2()); } if ((diff.getBlockX() & 1) + (diff.getBlockZ() & 1) != 0) { @@ -216,10 +216,10 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { return diff.divide(2).floor(); } - private Vector2D calculateChanges2D(Vector... changes) { - Vector2D total = new Vector2D(); - for (Vector change : changes) { - total = total.add(change.toVector2D().positive()); + private BlockVector2 calculateChanges2D(BlockVector3... changes) { + BlockVector2 total = BlockVector2.ZERO; + for (BlockVector3 change : changes) { + total = total.add(change.toBlockVector2().abs()); } return total.divide(2).floor(); @@ -233,10 +233,10 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * @throws RegionOperationException */ @Override - public void expand(Vector... changes) throws RegionOperationException { + public void expand(BlockVector3... changes) throws RegionOperationException { center = center.add(calculateDiff2D(changes)); - radius = radius.add(calculateChanges2D(changes)); - for (Vector change : changes) { + radius = radius.add(calculateChanges2D(changes).toVector2()); + for (BlockVector3 change : changes) { int changeY = change.getBlockY(); if (changeY > 0) { maxY += changeY; @@ -253,11 +253,11 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * @throws RegionOperationException */ @Override - public void contract(Vector... changes) throws RegionOperationException { + public void contract(BlockVector3... changes) throws RegionOperationException { center = center.subtract(calculateDiff2D(changes)); - Vector2D newRadius = radius.subtract(calculateChanges2D(changes)); - radius = Vector2D.getMaximum(new Vector2D(1.5, 1.5), newRadius); - for (Vector change : changes) { + Vector2 newRadius = radius.subtract(calculateChanges2D(changes).toVector2()); + radius = new Vector2(1.5, 1.5).getMaximum(newRadius); + for (BlockVector3 change : changes) { int height = maxY - minY; int changeY = change.getBlockY(); if (changeY > 0) { @@ -269,8 +269,8 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { } @Override - public void shift(Vector change) throws RegionOperationException { - center = center.add(change.toVector2D()); + public void shift(BlockVector3 change) throws RegionOperationException { + center = center.add(change.toBlockVector2()); int changeY = change.getBlockY(); maxY += changeY; @@ -281,13 +281,13 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * Checks to see if a point is inside this region. */ @Override - public boolean contains(Vector position) { + public boolean contains(BlockVector3 position) { final int blockY = position.getBlockY(); if (blockY < minY || blockY > maxY) { return false; } - return position.toVector2D().subtract(center).divide(radius).lengthSq() <= 1; + return position.toBlockVector2().subtract(center).toVector2().divide(radius).lengthSq() <= 1; } @@ -315,12 +315,12 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { } @Override - public Iterator iterator() { + public Iterator iterator() { return new FlatRegion3DIterator(this); } @Override - public Iterable asFlatRegion() { + public Iterable asFlatRegion() { return () -> new FlatRegionIterator(CylinderRegion.this); } @@ -341,7 +341,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { } @Override - public List polygonize(int maxPoints) { + public List polygonize(int maxPoints) { return Polygons.polygonizeCylinder(center, radius, maxPoints); } @@ -355,10 +355,10 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { * @param radius the radius in the X and Z axes * @return a region */ - public static CylinderRegion createRadius(Extent extent, Vector center, double radius) { + public static CylinderRegion createRadius(Extent extent, BlockVector3 center, double radius) { checkNotNull(extent); checkNotNull(center); - Vector2D radiusVec = new Vector2D(radius, radius); + Vector2 radiusVec = new Vector2(radius, radius); int minY = extent.getMinimumPoint().getBlockY(); int maxY = extent.getMaximumPoint().getBlockY(); 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 069cdaff3..0cf5e4b59 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 @@ -19,10 +19,9 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.storage.ChunkStore; @@ -37,12 +36,12 @@ public class EllipsoidRegion extends AbstractRegion { /** * Stores the center. */ - private Vector center; + private BlockVector3 center; /** * Stores the radii plus 0.5 on each axis. */ - private Vector radius; + private Vector3 radius; /** * Construct a new instance of this ellipsoid region. @@ -50,7 +49,7 @@ public class EllipsoidRegion extends AbstractRegion { * @param pos1 the first position * @param pos2 the second position */ - public EllipsoidRegion(Vector pos1, Vector pos2) { + public EllipsoidRegion(BlockVector3 pos1, Vector3 pos2) { this(null, pos1, pos2); } @@ -61,7 +60,7 @@ public class EllipsoidRegion extends AbstractRegion { * @param center the center * @param radius the radius */ - public EllipsoidRegion(World world, Vector center, Vector radius) { + public EllipsoidRegion(World world, BlockVector3 center, Vector3 radius) { super(world); this.center = center; setRadius(radius); @@ -72,13 +71,13 @@ public class EllipsoidRegion extends AbstractRegion { } @Override - public Vector getMinimumPoint() { - return center.subtract(getRadius()); + public BlockVector3 getMinimumPoint() { + return center.toVector3().subtract(getRadius()).toBlockPoint(); } @Override - public Vector getMaximumPoint() { - return center.add(getRadius()); + public BlockVector3 getMaximumPoint() { + return center.toVector3().add(getRadius()).toBlockPoint(); } @Override @@ -101,8 +100,8 @@ public class EllipsoidRegion extends AbstractRegion { return (int) (2 * radius.getZ()); } - private Vector calculateDiff(Vector... changes) throws RegionOperationException { - Vector diff = new Vector().add(changes); + private BlockVector3 calculateDiff(BlockVector3... changes) throws RegionOperationException { + BlockVector3 diff = BlockVector3.ZERO.add(changes); if ((diff.getBlockX() & 1) + (diff.getBlockY() & 1) + (diff.getBlockZ() & 1) != 0) { throw new RegionOperationException( @@ -112,30 +111,30 @@ public class EllipsoidRegion extends AbstractRegion { return diff.divide(2).floor(); } - private Vector calculateChanges(Vector... changes) { - Vector total = new Vector(); - for (Vector change : changes) { - total = total.add(change.positive()); + private Vector3 calculateChanges(BlockVector3... changes) { + Vector3 total = Vector3.ZERO; + for (BlockVector3 change : changes) { + total = total.add(change.abs().toVector3()); } return total.divide(2).floor(); } @Override - public void expand(Vector... changes) throws RegionOperationException { + public void expand(BlockVector3... changes) throws RegionOperationException { center = center.add(calculateDiff(changes)); radius = radius.add(calculateChanges(changes)); } @Override - public void contract(Vector... changes) throws RegionOperationException { + public void contract(BlockVector3... changes) throws RegionOperationException { center = center.subtract(calculateDiff(changes)); - Vector newRadius = radius.subtract(calculateChanges(changes)); - radius = Vector.getMaximum(new Vector(1.5, 1.5, 1.5), newRadius); + Vector3 newRadius = radius.subtract(calculateChanges(changes)); + radius = new Vector3(1.5, 1.5, 1.5).getMaximum(newRadius); } @Override - public void shift(Vector change) throws RegionOperationException { + public void shift(BlockVector3 change) throws RegionOperationException { center = center.add(change); } @@ -145,8 +144,8 @@ public class EllipsoidRegion extends AbstractRegion { * @return center */ @Override - public Vector getCenter() { - return center; + public Vector3 getCenter() { + return center.toVector3(); } /** @@ -154,7 +153,7 @@ public class EllipsoidRegion extends AbstractRegion { * * @param center the center */ - public void setCenter(Vector center) { + public void setCenter(BlockVector3 center) { this.center = center; } @@ -163,7 +162,7 @@ public class EllipsoidRegion extends AbstractRegion { * * @return radii */ - public Vector getRadius() { + public Vector3 getRadius() { return radius.subtract(0.5, 0.5, 0.5); } @@ -172,25 +171,25 @@ public class EllipsoidRegion extends AbstractRegion { * * @param radius the radius */ - public void setRadius(Vector radius) { + public void setRadius(Vector3 radius) { this.radius = radius.add(0.5, 0.5, 0.5); } @Override - public Set getChunks() { - final Set chunks = new HashSet<>(); + public Set getChunks() { + final Set chunks = new HashSet<>(); - final Vector min = getMinimumPoint(); - final Vector max = getMaximumPoint(); - final int centerY = getCenter().getBlockY(); + final BlockVector3 min = getMinimumPoint(); + final BlockVector3 max = getMaximumPoint(); + final int centerY = center.getBlockY(); for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) { for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) { - if (!contains(new BlockVector(x, centerY, z))) { + if (!contains(new BlockVector3(x, centerY, z))) { continue; } - chunks.add(new BlockVector2D( + chunks.add(new BlockVector2( x >> ChunkStore.CHUNK_SHIFTS, z >> ChunkStore.CHUNK_SHIFTS )); @@ -201,8 +200,8 @@ public class EllipsoidRegion extends AbstractRegion { } @Override - public boolean contains(Vector position) { - return position.subtract(center).divide(radius).lengthSq() <= 1; + public boolean contains(BlockVector3 position) { + return position.subtract(center).toVector3().divide(radius).lengthSq() <= 1; } /** @@ -216,8 +215,8 @@ public class EllipsoidRegion extends AbstractRegion { return center + " - " + getRadius(); } - public void extendRadius(Vector minRadius) { - setRadius(Vector.getMaximum(minRadius, getRadius())); + public void extendRadius(Vector3 minRadius) { + setRadius(minRadius.getMaximum(getRadius())); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/FlatRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/FlatRegion.java index 92cdf6e36..bd4561e4d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/FlatRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/FlatRegion.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; public interface FlatRegion extends Region { @@ -42,5 +42,5 @@ public interface FlatRegion extends Region { * * @return a flat region iterable */ - Iterable asFlatRegion(); + Iterable asFlatRegion(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/NullRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/NullRegion.java index 5f1c9653e..58e1d2197 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/NullRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/NullRegion.java @@ -19,10 +19,9 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.World; import java.util.Collections; @@ -39,18 +38,18 @@ public class NullRegion implements Region { private World world; @Override - public Vector getMinimumPoint() { - return new Vector(0, 0, 0); + public BlockVector3 getMinimumPoint() { + return BlockVector3.ZERO; } @Override - public Vector getMaximumPoint() { - return new Vector(0, 0, 0); + public BlockVector3 getMaximumPoint() { + return BlockVector3.ZERO; } @Override - public Vector getCenter() { - return new Vector(0, 0, 0); + public Vector3 getCenter() { + return Vector3.ZERO; } @Override @@ -74,32 +73,32 @@ public class NullRegion implements Region { } @Override - public void expand(Vector... changes) throws RegionOperationException { + public void expand(BlockVector3... changes) throws RegionOperationException { throw new RegionOperationException("Cannot change NullRegion"); } @Override - public void contract(Vector... changes) throws RegionOperationException { + public void contract(BlockVector3... changes) throws RegionOperationException { throw new RegionOperationException("Cannot change NullRegion"); } @Override - public void shift(Vector change) throws RegionOperationException { + public void shift(BlockVector3 change) throws RegionOperationException { throw new RegionOperationException("Cannot change NullRegion"); } @Override - public boolean contains(Vector position) { + public boolean contains(BlockVector3 position) { return false; } @Override - public Set getChunks() { + public Set getChunks() { return Collections.emptySet(); } @Override - public Set getChunkCubes() { + public Set getChunkCubes() { return Collections.emptySet(); } @@ -119,27 +118,22 @@ public class NullRegion implements Region { } @Override - public List polygonize(int maxPoints) { + public List polygonize(int maxPoints) { return Collections.emptyList(); } @Override - public Iterator iterator() { - return new Iterator() { + public Iterator iterator() { + return new Iterator() { @Override public boolean hasNext() { return false; } @Override - public BlockVector next() { + public BlockVector3 next() { throw new NoSuchElementException(); } - - @Override - public void remove() { - throw new UnsupportedOperationException("Cannot remove"); - } }; } 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 b7d607d9d..41cdeebff 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 @@ -19,10 +19,9 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector2; import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator; import com.sk89q.worldedit.regions.iterator.FlatRegionIterator; import com.sk89q.worldedit.world.World; @@ -37,9 +36,9 @@ import java.util.List; */ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { - private List points; - private Vector2D min; - private Vector2D max; + private List points; + private BlockVector2 min; + private BlockVector2 max; private int minY; private int maxY; private boolean hasY = false; @@ -57,7 +56,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { * @param world the world */ public Polygonal2DRegion(World world) { - this(world, Collections.emptyList(), 0, 0); + this(world, Collections.emptyList(), 0, 0); hasY = false; } @@ -69,7 +68,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { * @param minY minimum Y * @param maxY maximum Y */ - public Polygonal2DRegion(World world, List points, int minY, int maxY) { + public Polygonal2DRegion(World world, List points, int minY, int maxY) { super(world); this.points = new ArrayList<>(points); this.minY = minY; @@ -93,7 +92,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { * * @return a list of points */ - public List getPoints() { + public List getPoints() { return Collections.unmodifiableList(points); } @@ -103,9 +102,9 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { */ protected void recalculate() { if (points.isEmpty()) { - min = new Vector2D(0, 0); + min = BlockVector2.ZERO; minY = 0; - max = new Vector2D(0, 0); + max = BlockVector2.ZERO; maxY = 0; return; } @@ -115,7 +114,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { int maxX = points.get(0).getBlockX(); int maxZ = points.get(0).getBlockZ(); - for (BlockVector2D v : points) { + for (BlockVector2 v : points) { int x = v.getBlockX(); int z = v.getBlockZ(); if (x < minX) minX = x; @@ -132,8 +131,8 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { minY = Math.min(Math.max(0, minY), world == null ? 255 : world.getMaxY()); maxY = Math.min(Math.max(0, maxY), world == null ? 255 : world.getMaxY()); - min = new Vector2D(minX, minZ); - max = new Vector2D(maxX, maxZ); + min = new BlockVector2(minX, minZ); + max = new BlockVector2(maxX, maxZ); } /** @@ -141,17 +140,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { * * @param position the position */ - public void addPoint(Vector2D position) { - points.add(position.toBlockVector2D()); - recalculate(); - } - - /** - * Add a point to the list. - * - * @param position the position - */ - public void addPoint(BlockVector2D position) { + public void addPoint(BlockVector2 position) { points.add(position); recalculate(); } @@ -161,8 +150,8 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { * * @param position the position */ - public void addPoint(Vector position) { - points.add(new BlockVector2D(position.getBlockX(), position.getBlockZ())); + public void addPoint(BlockVector3 position) { + points.add(new BlockVector2(position.getBlockX(), position.getBlockZ())); recalculate(); } @@ -199,13 +188,13 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { } @Override - public Vector getMinimumPoint() { - return min.toVector(minY); + public BlockVector3 getMinimumPoint() { + return min.toBlockVector3(minY); } @Override - public Vector getMaximumPoint() { - return max.toVector(maxY); + public BlockVector3 getMaximumPoint() { + return max.toBlockVector3(maxY); } @Override @@ -239,14 +228,11 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { } @Override - public void expand(Vector... changes) throws RegionOperationException { - for (Vector change : changes) { + public void expand(BlockVector3... changes) throws RegionOperationException { + for (BlockVector3 change : changes) { if (change.getBlockX() != 0 || change.getBlockZ() != 0) { throw new RegionOperationException("Polygons can only be expanded vertically."); } - } - - for (Vector change : changes) { int changeY = change.getBlockY(); if (changeY > 0) { maxY += changeY; @@ -258,14 +244,11 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { } @Override - public void contract(Vector... changes) throws RegionOperationException { - for (Vector change : changes) { + public void contract(BlockVector3... changes) throws RegionOperationException { + for (BlockVector3 change : changes) { if (change.getBlockX() != 0 || change.getBlockZ() != 0) { throw new RegionOperationException("Polygons can only be contracted vertically."); } - } - - for (Vector change : changes) { int changeY = change.getBlockY(); if (changeY > 0) { minY += changeY; @@ -277,14 +260,14 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { } @Override - public void shift(Vector change) throws RegionOperationException { + public void shift(BlockVector3 change) throws RegionOperationException { final double changeX = change.getX(); final double changeY = change.getY(); final double changeZ = change.getZ(); for (int i = 0; i < points.size(); ++i) { - BlockVector2D point = points.get(i); - points.set(i, new BlockVector2D(point.getX() + changeX, point.getZ() + changeZ)); + BlockVector2 point = points.get(i); + points.set(i, new BlockVector2(point.getX() + changeX, point.getZ() + changeZ)); } minY += changeY; @@ -294,7 +277,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { } @Override - public boolean contains(Vector position) { + public boolean contains(BlockVector3 position) { return contains(points, minY, maxY, position); } @@ -307,7 +290,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { * @param pt the position to check * @return true if the given polygon contains the given point */ - public static boolean contains(List points, int minY, int maxY, Vector pt) { + public static boolean contains(List points, int minY, int maxY, BlockVector3 pt) { if (points.size() < 3) { return false; } @@ -398,12 +381,12 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { } @Override - public Iterator iterator() { + public Iterator iterator() { return new FlatRegion3DIterator(this); } @Override - public Iterable asFlatRegion() { + public Iterable asFlatRegion() { return () -> new FlatRegionIterator(Polygonal2DRegion.this); } @@ -416,10 +399,10 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { @Override public String toString() { StringBuilder sb = new StringBuilder(); - List pts = getPoints(); - Iterator it = pts.iterator(); + List pts = getPoints(); + Iterator it = pts.iterator(); while (it.hasNext()) { - BlockVector2D current = it.next(); + BlockVector2 current = it.next(); sb.append("(").append(current.getBlockX()).append(", ").append(current.getBlockZ()).append(")"); if (it.hasNext()) sb.append(" - "); } @@ -435,7 +418,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { } @Override - public List polygonize(int maxPoints) { + public List polygonize(int maxPoints) { if (maxPoints >= 0 && maxPoints < points.size()) { throw new IllegalArgumentException("Cannot polygonize a this Polygonal2DRegion into the amount of points given."); } 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 77bfa8440..2d1c88f0a 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 @@ -19,10 +19,9 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.World; import java.util.List; @@ -33,21 +32,21 @@ import javax.annotation.Nullable; /** * Represents a physical shape. */ -public interface Region extends Iterable, Cloneable { +public interface Region extends Iterable, Cloneable { /** * Get the lower point of a region. * * @return min. point */ - Vector getMinimumPoint(); + BlockVector3 getMinimumPoint(); /** * Get the upper point of a region. * * @return max. point */ - Vector getMaximumPoint(); + BlockVector3 getMaximumPoint(); /** * Get the center point of a region. @@ -56,7 +55,7 @@ public interface Region extends Iterable, Cloneable { * * @return center point */ - Vector getCenter(); + Vector3 getCenter(); /** * Get the number of blocks in the region. @@ -92,7 +91,7 @@ public interface Region extends Iterable, Cloneable { * @param changes array/arguments with multiple related changes * @throws RegionOperationException */ - void expand(Vector... changes) throws RegionOperationException; + void expand(BlockVector3... changes) throws RegionOperationException; /** * Contract the region. @@ -100,7 +99,7 @@ public interface Region extends Iterable, Cloneable { * @param changes array/arguments with multiple related changes * @throws RegionOperationException */ - void contract(Vector... changes) throws RegionOperationException; + void contract(BlockVector3... changes) throws RegionOperationException; /** * Shift the region. @@ -108,7 +107,7 @@ public interface Region extends Iterable, Cloneable { * @param change the change * @throws RegionOperationException */ - void shift(Vector change) throws RegionOperationException; + void shift(BlockVector3 change) throws RegionOperationException; /** * Returns true based on whether the region contains the point. @@ -116,21 +115,21 @@ public interface Region extends Iterable, Cloneable { * @param position the position * @return true if contained */ - boolean contains(Vector position); + boolean contains(BlockVector3 position); /** * Get a list of chunks. * * @return a list of chunk coordinates */ - Set getChunks(); + Set getChunks(); /** * Return a list of 16*16*16 chunks in a region * * @return the chunk cubes this region overlaps with */ - Set getChunkCubes(); + Set getChunkCubes(); /** * Sets the world that the selection is in. @@ -159,5 +158,5 @@ public interface Region extends Iterable, Cloneable { * @param maxPoints maximum number of points to generate. -1 for no limit. * @return the points. */ - List polygonize(int maxPoints); + List polygonize(int maxPoints); } 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 ad93903ee..5b26672cb 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 @@ -23,8 +23,7 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.Iterators; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import java.util.ArrayList; @@ -90,37 +89,37 @@ public class RegionIntersection extends AbstractRegion { } @Override - public Vector getMinimumPoint() { - Vector minimum = regions.get(0).getMinimumPoint(); + public BlockVector3 getMinimumPoint() { + BlockVector3 minimum = regions.get(0).getMinimumPoint(); for (int i = 1; i < regions.size(); i++) { - minimum = Vector.getMinimum(regions.get(i).getMinimumPoint(), minimum); + minimum = regions.get(i).getMinimumPoint().getMinimum(minimum); } return minimum; } @Override - public Vector getMaximumPoint() { - Vector maximum = regions.get(0).getMaximumPoint(); + public BlockVector3 getMaximumPoint() { + BlockVector3 maximum = regions.get(0).getMaximumPoint(); for (int i = 1; i < regions.size(); i++) { - maximum = Vector.getMaximum(regions.get(i).getMaximumPoint(), maximum); + maximum = regions.get(i).getMaximumPoint().getMaximum(maximum); } return maximum; } @Override - public void expand(Vector... changes) throws RegionOperationException { + public void expand(BlockVector3... changes) throws RegionOperationException { checkNotNull(changes); throw new RegionOperationException("Cannot expand a region intersection"); } @Override - public void contract(Vector... changes) throws RegionOperationException { + public void contract(BlockVector3... changes) throws RegionOperationException { checkNotNull(changes); throw new RegionOperationException("Cannot contract a region intersection"); } @Override - public boolean contains(Vector position) { + public boolean contains(BlockVector3 position) { checkNotNull(position); for (Region region : regions) { @@ -134,8 +133,8 @@ public class RegionIntersection extends AbstractRegion { @SuppressWarnings({"unchecked", "rawtypes"}) @Override - public Iterator iterator() { - Iterator[] iterators = (Iterator[]) new Iterator[regions.size()]; + public Iterator iterator() { + Iterator[] iterators = (Iterator[]) new Iterator[regions.size()]; for (int i = 0; i < regions.size(); i++) { iterators[i] = regions.get(i).iterator(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java index 278ae4815..fea83d30a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java @@ -19,11 +19,10 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.world.World; @@ -59,7 +58,7 @@ public interface RegionSelector { * @param position the position * @return true if something changed */ - boolean selectPrimary(Vector position, SelectorLimits limits); + boolean selectPrimary(BlockVector3 position, SelectorLimits limits); /** * Called when the second point is selected. @@ -67,7 +66,7 @@ public interface RegionSelector { * @param position the position * @return true if something changed */ - boolean selectSecondary(Vector position, SelectorLimits limits); + boolean selectSecondary(BlockVector3 position, SelectorLimits limits); /** * Tell the player information about his/her primary selection. @@ -76,7 +75,7 @@ public interface RegionSelector { * @param session the session * @param position position */ - void explainPrimarySelection(Actor actor, LocalSession session, Vector position); + void explainPrimarySelection(Actor actor, LocalSession session, BlockVector3 position); /** * Tell the player information about his/her secondary selection. @@ -85,7 +84,7 @@ public interface RegionSelector { * @param session the session * @param position position */ - void explainSecondarySelection(Actor actor, LocalSession session, Vector position); + void explainSecondarySelection(Actor actor, LocalSession session, BlockVector3 position); /** * The the player information about the region's changes. This may resend @@ -102,7 +101,7 @@ public interface RegionSelector { * @return the primary position * @throws IncompleteRegionException thrown if a region has not been fully defined */ - BlockVector getPrimaryPosition() throws IncompleteRegionException; + BlockVector3 getPrimaryPosition() throws IncompleteRegionException; /** * Get the selection. 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 338d5f0e9..911e40b8b 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 @@ -21,9 +21,9 @@ package com.sk89q.worldedit.regions; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Identity; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.world.World; @@ -98,17 +98,17 @@ public class TransformRegion extends AbstractRegion { } @Override - public Vector getMinimumPoint() { - return transform.apply(region.getMinimumPoint()); + public BlockVector3 getMinimumPoint() { + return transform.apply(region.getMinimumPoint().toVector3()).toBlockPoint(); } @Override - public Vector getMaximumPoint() { - return transform.apply(region.getMaximumPoint()); + public BlockVector3 getMaximumPoint() { + return transform.apply(region.getMaximumPoint().toVector3()).toBlockPoint(); } @Override - public Vector getCenter() { + public Vector3 getCenter() { return transform.apply(region.getCenter()); } @@ -133,50 +133,50 @@ public class TransformRegion extends AbstractRegion { } @Override - public void expand(Vector... changes) throws RegionOperationException { + public void expand(BlockVector3... changes) throws RegionOperationException { throw new RegionOperationException("Can't expand a TransformedRegion"); } @Override - public void contract(Vector... changes) throws RegionOperationException { + public void contract(BlockVector3... changes) throws RegionOperationException { throw new RegionOperationException("Can't contract a TransformedRegion"); } @Override - public void shift(Vector change) throws RegionOperationException { + public void shift(BlockVector3 change) throws RegionOperationException { throw new RegionOperationException("Can't change a TransformedRegion"); } @Override - public boolean contains(Vector position) { - return region.contains(transform.inverse().apply(position)); + public boolean contains(BlockVector3 position) { + return region.contains(transform.inverse().apply(position.toVector3()).toBlockPoint()); } @Override - public List polygonize(int maxPoints) { - List origPoints = region.polygonize(maxPoints); - List transformedPoints = new ArrayList<>(); - for (BlockVector2D vector : origPoints) { - transformedPoints.add(transform.apply(vector.toVector(0)).toVector2D().toBlockVector2D()); + public List polygonize(int maxPoints) { + List origPoints = region.polygonize(maxPoints); + List transformedPoints = new ArrayList<>(); + for (BlockVector2 vector : origPoints) { + transformedPoints.add(transform.apply(vector.toVector3(0)).toVector2().toBlockPoint()); } return transformedPoints; } @Override - public Iterator iterator() { - final Iterator it = region.iterator(); + public Iterator iterator() { + final Iterator it = region.iterator(); - return new Iterator() { + return new Iterator() { @Override public boolean hasNext() { return it.hasNext(); } @Override - public BlockVector next() { - BlockVector next = it.next(); + public BlockVector3 next() { + BlockVector3 next = it.next(); if (next != null) { - return transform.apply(next).toBlockVector(); + return transform.apply(next.toVector3()).toBlockPoint(); } else { return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CuboidRegionFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CuboidRegionFactory.java index 2f533f9fe..24be870a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CuboidRegionFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CuboidRegionFactory.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.regions.factory; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; public class CuboidRegionFactory implements RegionFactory { @Override - public Region createCenteredAt(Vector position, double size) { + public Region createCenteredAt(BlockVector3 position, double size) { return CuboidRegion.fromCenter(position, (int) size); } 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 aa2c83cdd..ed3896d06 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 @@ -19,8 +19,8 @@ package com.sk89q.worldedit.regions.factory; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector2; import com.sk89q.worldedit.regions.CylinderRegion; import com.sk89q.worldedit.regions.Region; @@ -33,8 +33,8 @@ public class CylinderRegionFactory implements RegionFactory { } @Override - public Region createCenteredAt(Vector position, double size) { - return new CylinderRegion(position, new Vector2D(size, size), position.getBlockY() - (int) (height / 2), position.getBlockY() + (int) (height / 2)); + public Region createCenteredAt(BlockVector3 position, double size) { + return new CylinderRegion(position, new Vector2(size, size), position.getBlockY() - (int) (height / 2), position.getBlockY() + (int) (height / 2)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/RegionFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/RegionFactory.java index 51cf3bc1f..8294b0c11 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/RegionFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/RegionFactory.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.regions.factory; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; public interface RegionFactory { - Region createCenteredAt(Vector position, double size); + Region createCenteredAt(BlockVector3 position, double size); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/SphereRegionFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/SphereRegionFactory.java index cf0f488f8..4ad8d4125 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/SphereRegionFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/SphereRegionFactory.java @@ -19,15 +19,16 @@ package com.sk89q.worldedit.regions.factory; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.EllipsoidRegion; import com.sk89q.worldedit.regions.Region; public class SphereRegionFactory implements RegionFactory { @Override - public Region createCenteredAt(Vector position, double size) { - return new EllipsoidRegion(position, new Vector(size, size, size)); + public Region createCenteredAt(BlockVector3 position, double size) { + return new EllipsoidRegion(position, new Vector3(size, size, size)); } } 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 8c6628616..786e04a2b 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 @@ -21,23 +21,23 @@ package com.sk89q.worldedit.regions.iterator; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.FlatRegion; import java.util.Iterator; import java.util.NoSuchElementException; -public class FlatRegion3DIterator implements Iterator { +public class FlatRegion3DIterator implements Iterator { - private Iterator flatIterator; + private Iterator flatIterator; private int minY; private int maxY; - private Vector2D next2D; + private BlockVector2 next2D; private int nextY; - public FlatRegion3DIterator(FlatRegion region, Iterator flatIterator) { + public FlatRegion3DIterator(FlatRegion region, Iterator flatIterator) { checkNotNull(region); checkNotNull(flatIterator); @@ -63,12 +63,12 @@ public class FlatRegion3DIterator implements Iterator { } @Override - public BlockVector next() { + public BlockVector3 next() { if (!hasNext()) { throw new NoSuchElementException(); } - BlockVector current = new BlockVector(next2D.getBlockX(), nextY, next2D.getBlockZ()); + BlockVector3 current = new BlockVector3(next2D.getBlockX(), nextY, next2D.getBlockZ()); 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 60018afeb..e4cd6457c 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 @@ -21,13 +21,14 @@ package com.sk89q.worldedit.regions.iterator; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import java.util.Iterator; +import java.util.NoSuchElementException; -public class FlatRegionIterator implements Iterator { +public class FlatRegionIterator implements Iterator { private Region region; private int y; @@ -42,8 +43,8 @@ public class FlatRegionIterator implements Iterator { this.region = region; - Vector min = region.getMinimumPoint(); - Vector max = region.getMaximumPoint(); + BlockVector3 min = region.getMinimumPoint(); + BlockVector3 max = region.getMaximumPoint(); this.y = min.getBlockY(); @@ -64,18 +65,18 @@ public class FlatRegionIterator implements Iterator { } private void forward() { - while (hasNext() && !region.contains(new Vector(nextX, y, nextZ))) { + while (hasNext() && !region.contains(new BlockVector3(nextX, y, nextZ))) { forwardOne(); } } @Override - public Vector2D next() { + public BlockVector2 next() { if (!hasNext()) { - throw new java.util.NoSuchElementException(); + throw new NoSuchElementException(); } - Vector2D answer = new Vector2D(nextX, nextZ); + BlockVector2 answer = new BlockVector2(nextX, nextZ); forwardOne(); forward(); @@ -95,9 +96,4 @@ public class FlatRegionIterator implements Iterator { nextX = Integer.MIN_VALUE; } - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - } 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 35700595c..d2ab586d8 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 @@ -21,19 +21,18 @@ package com.sk89q.worldedit.regions.iterator; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import java.util.Iterator; -public class RegionIterator implements Iterator { +public class RegionIterator implements Iterator { private final Region region; private final int maxX; private final int maxY; private final int maxZ; - private final Vector min; + private final BlockVector3 min; private int nextX; private int nextY; private int nextZ; @@ -43,7 +42,7 @@ public class RegionIterator implements Iterator { this.region = region; - Vector max = region.getMaximumPoint(); + BlockVector3 max = region.getMaximumPoint(); this.maxX = max.getBlockX(); this.maxY = max.getBlockY(); this.maxZ = max.getBlockZ(); @@ -62,16 +61,16 @@ public class RegionIterator implements Iterator { } private void forward() { - while (hasNext() && !region.contains(new BlockVector(nextX, nextY, nextZ))) { + while (hasNext() && !region.contains(new BlockVector3(nextX, nextY, nextZ))) { forwardOne(); } } @Override - public BlockVector next() { + public BlockVector3 next() { if (!hasNext()) throw new java.util.NoSuchElementException(); - BlockVector answer = new BlockVector(nextX, nextY, nextZ); + BlockVector3 answer = new BlockVector3(nextX, nextY, nextZ); forwardOne(); forward(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Edge.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Edge.java index 3495fee83..dcf098d3c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Edge.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Edge.java @@ -21,14 +21,14 @@ package com.sk89q.worldedit.regions.polyhedron; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; public class Edge { - private final Vector start; - private final Vector end; + private final Vector3 start; + private final Vector3 end; - public Edge(Vector start, Vector end) { + public Edge(Vector3 start, Vector3 end) { checkNotNull(start); checkNotNull(end); @@ -71,7 +71,7 @@ public class Edge { * @param vertex the 3rd vertex for the triangle * @return a triangle */ - public Triangle createTriangle(Vector vertex) { + public Triangle createTriangle(Vector3 vertex) { checkNotNull(vertex); return new Triangle(this.start, this.end, vertex); } @@ -82,7 +82,7 @@ public class Edge { * @param vertex the second vertex * @return a new triangle */ - public Triangle createTriangle2(Vector vertex) { + public Triangle createTriangle2(Vector3 vertex) { checkNotNull(vertex); return new Triangle(this.start, vertex, this.end); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Triangle.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Triangle.java index 01bd7f8ae..5e5f7a770 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Triangle.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Triangle.java @@ -21,13 +21,13 @@ package com.sk89q.worldedit.regions.polyhedron; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; public class Triangle { private String tag = "Triangle"; - private final Vector[] vertices; - private final Vector normal; + private final Vector3[] vertices; + private final Vector3 normal; private final double b; /** @@ -37,12 +37,12 @@ public class Triangle { * @param v1 second vertex * @param v2 third vertex */ - public Triangle(Vector v0, Vector v1, Vector v2) { + public Triangle(Vector3 v0, Vector3 v1, Vector3 v2) { checkNotNull(v0); checkNotNull(v1); checkNotNull(v2); - vertices = new Vector[] { v0, v1, v2 }; + vertices = new Vector3[] { v0, v1, v2 }; this.normal = v1.subtract(v0).cross(v2.subtract(v0)).normalize(); this.b = Math.max(Math.max(normal.dot(v0), normal.dot(v1)), normal.dot(v2)); @@ -54,7 +54,7 @@ public class Triangle { * @param index Vertex index. Valid input: 0..2 * @return a vertex */ - public Vector getVertex(int index) { + public Vector3 getVertex(int index) { return vertices[index]; } @@ -77,7 +77,7 @@ public class Triangle { * @param pt the point to test * @return true if the point is below */ - public boolean below(Vector pt) { + public boolean below(Vector3 pt) { checkNotNull(pt); return normal.dot(pt) < b; } @@ -88,7 +88,7 @@ public class Triangle { * @param pt the point to test * @return true if the point is above */ - public boolean above(Vector pt) { + public boolean above(Vector3 pt) { checkNotNull(pt); return normal.dot(pt) > b; } 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 afbcb1ae1..1c16ec77a 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 @@ -21,15 +21,14 @@ package com.sk89q.worldedit.regions.selector; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionPointEvent; import com.sk89q.worldedit.internal.cui.SelectionPolygonEvent; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.ConvexPolyhedralRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; @@ -52,7 +51,7 @@ import javax.annotation.Nullable; public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion { private final transient ConvexPolyhedralRegion region; - private transient BlockVector pos1; + private transient BlockVector3 pos1; /** * Create a new selector with a {@code null} world. @@ -97,9 +96,9 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion region = new ConvexPolyhedralRegion(oldRegion.getWorld()); - for (final BlockVector2D pt : new ArrayList<>(oldRegion.polygonize(Integer.MAX_VALUE))) { - region.addVertex(pt.toVector(minY)); - region.addVertex(pt.toVector(maxY)); + for (final BlockVector2 pt : new ArrayList<>(oldRegion.polygonize(Integer.MAX_VALUE))) { + region.addVertex(pt.toBlockVector3(minY)); + region.addVertex(pt.toBlockVector3(maxY)); } learnChanges(); @@ -118,15 +117,15 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion } @Override - public boolean selectPrimary(Vector position, SelectorLimits limits) { + public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) { checkNotNull(position); clear(); - pos1 = position.toBlockVector(); + pos1 = position; return region.addVertex(position); } @Override - public boolean selectSecondary(Vector position, SelectorLimits limits) { + public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) { checkNotNull(position); Optional vertexLimit = limits.getPolyhedronVertexLimit(); @@ -139,7 +138,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion } @Override - public BlockVector getPrimaryPosition() throws IncompleteRegionException { + public BlockVector3 getPrimaryPosition() throws IncompleteRegionException { return pos1; } @@ -169,7 +168,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion @Override public void learnChanges() { - pos1 = region.getVertices().iterator().next().toBlockVector(); + pos1 = region.getVertices().iterator().next(); } @Override @@ -194,7 +193,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion @Override - public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) { + public void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos) { checkNotNull(player); checkNotNull(session); checkNotNull(pos); @@ -205,7 +204,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion } @Override - public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) { + public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) { checkNotNull(player); checkNotNull(session); checkNotNull(pos); @@ -237,12 +236,12 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion checkNotNull(player); checkNotNull(session); - Collection vertices = region.getVertices(); + Collection vertices = region.getVertices(); Collection triangles = region.getTriangles(); - Map vertexIds = new HashMap<>(vertices.size()); + Map vertexIds = new HashMap<>(vertices.size()); int lastVertexId = -1; - for (Vector vertex : vertices) { + for (BlockVector3 vertex : vertices) { vertexIds.put(vertex, ++lastVertexId); session.dispatchCUIEvent(player, new SelectionPointEvent(lastVertexId, vertex, getArea())); } @@ -250,7 +249,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion for (Triangle triangle : triangles) { final int[] v = new int[3]; for (int i = 0; i < 3; ++i) { - v[i] = vertexIds.get(triangle.getVertex(i)); + v[i] = vertexIds.get(triangle.getVertex(i).toBlockPoint()); } session.dispatchCUIEvent(player, new SelectionPolygonEvent(v)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java index 182c08f0f..9eab91500 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java @@ -21,13 +21,12 @@ package com.sk89q.worldedit.regions.selector; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionPointEvent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; @@ -44,8 +43,8 @@ import javax.annotation.Nullable; */ public class CuboidRegionSelector implements RegionSelector, CUIRegion { - protected transient BlockVector position1; - protected transient BlockVector position2; + protected transient BlockVector3 position1; + protected transient BlockVector3 position2; protected transient CuboidRegion region; /** @@ -61,7 +60,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { * @param world the world, which may be {@code null} */ public CuboidRegionSelector(@Nullable World world) { - region = new CuboidRegion(world, new Vector(), new Vector()); + region = new CuboidRegion(world, BlockVector3.ZERO, BlockVector3.ZERO); } /** @@ -85,8 +84,8 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { return; } - position1 = oldRegion.getMinimumPoint().toBlockVector(); - position2 = oldRegion.getMaximumPoint().toBlockVector(); + position1 = oldRegion.getMinimumPoint(); + position2 = oldRegion.getMaximumPoint(); } region.setPos1(position1); @@ -100,12 +99,12 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { * @param position1 position 1 * @param position2 position 2 */ - public CuboidRegionSelector(@Nullable World world, Vector position1, Vector position2) { + public CuboidRegionSelector(@Nullable World world, BlockVector3 position1, BlockVector3 position2) { this(world); checkNotNull(position1); checkNotNull(position2); - this.position1 = position1.toBlockVector(); - this.position2 = position2.toBlockVector(); + this.position1 = position1; + this.position2 = position2; region.setPos1(position1); region.setPos2(position2); } @@ -122,33 +121,33 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { } @Override - public boolean selectPrimary(Vector position, SelectorLimits limits) { + public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) { checkNotNull(position); - if (position1 != null && (position.compareTo(position1) == 0)) { + if (position1 != null && position1.equals(position)) { return false; } - position1 = position.toBlockVector(); + position1 = position; region.setPos1(position1); return true; } @Override - public boolean selectSecondary(Vector position, SelectorLimits limits) { + public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) { checkNotNull(position); - if (position2 != null && (position.compareTo(position2)) == 0) { + if (position2 != null && position2.equals(position)) { return false; } - position2 = position.toBlockVector(); + position2 = position; region.setPos2(position2); return true; } @Override - public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) { + public void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos) { checkNotNull(player); checkNotNull(session); checkNotNull(pos); @@ -163,7 +162,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { } @Override - public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) { + public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) { checkNotNull(player); checkNotNull(session); checkNotNull(pos); @@ -192,7 +191,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { } @Override - public BlockVector getPrimaryPosition() throws IncompleteRegionException { + public BlockVector3 getPrimaryPosition() throws IncompleteRegionException { if (position1 == null) { throw new IncompleteRegionException(); } @@ -221,8 +220,8 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { @Override public void learnChanges() { - position1 = region.getPos1().toBlockVector(); - position2 = region.getPos2().toBlockVector(); + position1 = region.getPos1(); + position2 = region.getPos2(); } @Override 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 8e4ce873c..ae442482c 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 @@ -21,16 +21,17 @@ package com.sk89q.worldedit.regions.selector; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionCylinderEvent; import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent; import com.sk89q.worldedit.internal.cui.SelectionPointEvent; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector2; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.CylinderRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; @@ -92,12 +93,12 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { return; } - Vector pos1 = oldRegion.getMinimumPoint(); - Vector pos2 = oldRegion.getMaximumPoint(); + BlockVector3 pos1 = oldRegion.getMinimumPoint(); + BlockVector3 pos2 = oldRegion.getMaximumPoint(); - Vector center = pos1.add(pos2).divide(2).floor(); - region.setCenter(center.toVector2D()); - region.setRadius(pos2.toVector2D().subtract(center.toVector2D())); + BlockVector3 center = pos1.add(pos2).divide(2).floor(); + 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())); @@ -113,7 +114,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { * @param minY the minimum Y * @param maxY the maximum Y */ - public CylinderRegionSelector(@Nullable World world, Vector2D center, Vector2D radius, int minY, int maxY) { + public CylinderRegionSelector(@Nullable World world, BlockVector2 center, Vector2 radius, int minY, int maxY) { this(world); region.setCenter(center); @@ -135,27 +136,27 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { } @Override - public boolean selectPrimary(Vector position, SelectorLimits limits) { - if (!region.getCenter().equals(Vector.ZERO) && position.compareTo(region.getCenter()) == 0) { + public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) { + if (!region.getCenter().equals(Vector3.ZERO) && position.equals(region.getCenter().toBlockPoint())) { return false; } region = new CylinderRegion(region.getWorld()); - region.setCenter(position.toVector2D()); + region.setCenter(position.toBlockVector2()); region.setY(position.getBlockY()); return true; } @Override - public boolean selectSecondary(Vector position, SelectorLimits limits) { - Vector center = region.getCenter(); - if ((center.compareTo(Vector.ZERO)) == 0) { + public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) { + Vector3 center = region.getCenter(); + if (center.equals(Vector3.ZERO)) { return true; } - final Vector2D diff = position.subtract(center).toVector2D(); - final Vector2D minRadius = Vector2D.getMaximum(diff, diff.multiply(-1.0)); + final Vector2 diff = position.toVector3().subtract(center).toVector2(); + final Vector2 minRadius = diff.getMaximum(diff.multiply(-1.0)); region.extendRadius(minRadius); region.setY(position.getBlockY()); @@ -164,17 +165,17 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { } @Override - public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) { + public void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos) { player.print("Starting a new cylindrical selection at " + pos + "."); session.describeCUI(player); } @Override - public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) { - Vector center = region.getCenter(); + public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) { + Vector3 center = region.getCenter(); - if (!center.equals(Vector.ZERO)) { + if (!center.equals(Vector3.ZERO)) { player.print("Radius set to " + NUMBER_FORMAT.format(region.getRadius().getX()) + "/" + NUMBER_FORMAT.format(region.getRadius().getZ()) + " blocks. (" + region.getArea() + ")."); } else { player.printError("You must select the center point before setting the radius."); @@ -190,12 +191,12 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { } @Override - public BlockVector getPrimaryPosition() throws IncompleteRegionException { + public BlockVector3 getPrimaryPosition() throws IncompleteRegionException { if (!isDefined()) { throw new IncompleteRegionException(); } - return region.getCenter().toBlockVector(); + return region.getCenter().toBlockPoint(); } @Override @@ -214,7 +215,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { @Override public boolean isDefined() { - return !region.getRadius().equals(Vector2D.ZERO); + return !region.getRadius().equals(Vector2.ZERO); } @Override @@ -235,10 +236,10 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { public List getInformationLines() { final List lines = new ArrayList<>(); - if (!region.getCenter().equals(Vector.ZERO)) { + if (!region.getCenter().equals(Vector3.ZERO)) { lines.add("Center: " + region.getCenter()); } - if (!region.getRadius().equals(Vector2D.ZERO)) { + if (!region.getRadius().equals(Vector2.ZERO)) { lines.add("Radius: " + region.getRadius()); } @@ -252,7 +253,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { @Override public void describeCUI(LocalSession session, Actor player) { - session.dispatchCUIEvent(player, new SelectionCylinderEvent(region.getCenter(), region.getRadius())); + session.dispatchCUIEvent(player, new SelectionCylinderEvent(region.getCenter().toBlockPoint(), region.getRadius())); session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY())); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java index ca32ac3dc..8274a6e7b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java @@ -21,14 +21,14 @@ package com.sk89q.worldedit.regions.selector; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionEllipsoidPointEvent; import com.sk89q.worldedit.internal.cui.SelectionPointEvent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.EllipsoidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; @@ -61,7 +61,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { * @param world the world, which may be {@code null} */ public EllipsoidRegionSelector(@Nullable World world) { - region = new EllipsoidRegion(world, new Vector(), new Vector()); + region = new EllipsoidRegion(world, BlockVector3.ZERO, Vector3.ZERO); } /** @@ -83,12 +83,12 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { return; } - BlockVector pos1 = oldRegion.getMinimumPoint().toBlockVector(); - BlockVector pos2 = oldRegion.getMaximumPoint().toBlockVector(); + BlockVector3 pos1 = oldRegion.getMinimumPoint(); + BlockVector3 pos2 = oldRegion.getMaximumPoint(); - Vector center = pos1.add(pos2).divide(2).floor(); + BlockVector3 center = pos1.add(pos2).divide(2).floor(); region.setCenter(center); - region.setRadius(pos2.subtract(center)); + region.setRadius(pos2.subtract(center).toVector3()); } } @@ -99,7 +99,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { * @param center the center * @param radius the radius */ - public EllipsoidRegionSelector(@Nullable World world, Vector center, Vector radius) { + public EllipsoidRegionSelector(@Nullable World world, BlockVector3 center, Vector3 radius) { this(world); region.setCenter(center); @@ -118,32 +118,32 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { } @Override - public boolean selectPrimary(Vector position, SelectorLimits limits) { + public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) { if (position.equals(region.getCenter()) && region.getRadius().lengthSq() == 0) { return false; } - region.setCenter(position.toBlockVector()); - region.setRadius(new Vector()); + region.setCenter(position); + region.setRadius(Vector3.ZERO); started = true; return true; } @Override - public boolean selectSecondary(Vector position, SelectorLimits limits) { + public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) { if (!started) { return false; } - final Vector diff = position.subtract(region.getCenter()); - final Vector minRadius = Vector.getMaximum(diff, diff.multiply(-1.0)); + final Vector3 diff = position.toVector3().subtract(region.getCenter()); + final Vector3 minRadius = diff.getMaximum(diff.multiply(-1.0)); region.extendRadius(minRadius); return true; } @Override - public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) { + public void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos) { if (isDefined()) { player.print("Center position set to " + region.getCenter() + " (" + region.getArea() + ")."); } else { @@ -154,7 +154,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { } @Override - public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) { + public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) { if (isDefined()) { player.print("Radius set to " + region.getRadius() + " (" + region.getArea() + ")."); } else { @@ -194,8 +194,8 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { @Override public void clear() { - region.setCenter(new Vector()); - region.setRadius(new Vector()); + region.setCenter(BlockVector3.ZERO); + region.setRadius(Vector3.ZERO); } @Override @@ -207,12 +207,12 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { public List getInformationLines() { final List lines = new ArrayList<>(); - final Vector center = region.getCenter(); + final Vector3 center = region.getCenter(); if (center.lengthSq() > 0) { lines.add("Center: " + center); } - final Vector radius = region.getRadius(); + final Vector3 radius = region.getRadius(); if (radius.lengthSq() > 0) { lines.add("X/Y/Z radius: " + radius); } @@ -227,8 +227,8 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { @Override public void describeCUI(LocalSession session, Actor player) { - session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(0, region.getCenter())); - session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(1, region.getRadius())); + session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(0, region.getCenter().toBlockPoint())); + session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(1, region.getRadius().toBlockPoint())); } @Override @@ -253,8 +253,8 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { } @Override - public BlockVector getPrimaryPosition() throws IncompleteRegionException { - return region.getCenter().toBlockVector(); + public BlockVector3 getPrimaryPosition() throws IncompleteRegionException { + return region.getCenter().toBlockPoint(); } } 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 0e239f0d3..bf5aeaace 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 @@ -19,10 +19,9 @@ package com.sk89q.worldedit.regions.selector; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.world.World; @@ -63,8 +62,8 @@ public class ExtendingCuboidRegionSelector extends CuboidRegionSelector { return; } - position1 = region.getMinimumPoint().toBlockVector(); - position2 = region.getMaximumPoint().toBlockVector(); + position1 = region.getMinimumPoint(); + position2 = region.getMaximumPoint(); region.setPos1(position1); region.setPos2(position2); } @@ -76,28 +75,28 @@ public class ExtendingCuboidRegionSelector extends CuboidRegionSelector { * @param position1 the first position * @param position2 the second position */ - public ExtendingCuboidRegionSelector(@Nullable World world, Vector position1, Vector position2) { + public ExtendingCuboidRegionSelector(@Nullable World world, BlockVector3 position1, BlockVector3 position2) { this(world); - position1 = Vector.getMinimum(position1, position2); - position2 = Vector.getMaximum(position1, position2); + position1 = position1.getMinimum(position2); + position2 = position1.getMaximum(position2); region.setPos1(position1); region.setPos2(position2); } @Override - public boolean selectPrimary(Vector position, SelectorLimits limits) { - if (position1 != null && position2 != null && position.compareTo(position1) == 0 && position.compareTo(position2) == 0) { + public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) { + if (position1 != null && position2 != null && position.equals(position1) && position.equals(position2)) { return false; } - position1 = position2 = position.toBlockVector(); + position1 = position2 = position; region.setPos1(position1); region.setPos2(position2); return true; } @Override - public boolean selectSecondary(Vector position, SelectorLimits limits) { + public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) { if (position1 == null || position2 == null) { return selectPrimary(position, limits); } @@ -114,10 +113,10 @@ public class ExtendingCuboidRegionSelector extends CuboidRegionSelector { double y2 = Math.max(position.getY(), position2.getY()); double z2 = Math.max(position.getZ(), position2.getZ()); - final BlockVector o1 = position1; - final BlockVector o2 = position2; - position1 = new BlockVector(x1, y1, z1); - position2 = new BlockVector(x2, y2, z2); + final BlockVector3 o1 = position1; + final BlockVector3 o2 = position2; + position1 = new BlockVector3(x1, y1, z1); + position2 = new BlockVector3(x2, y2, z2); region.setPos1(position1); region.setPos2(position2); @@ -129,14 +128,14 @@ public class ExtendingCuboidRegionSelector extends CuboidRegionSelector { } @Override - public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) { + public void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos) { player.print("Started selection at " + pos + " (" + region.getArea() + ")."); explainRegionAdjust(player, session); } @Override - public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) { + public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) { player.print("Extended selection to encompass " + pos + " (" + region.getArea() + ")."); explainRegionAdjust(player, session); 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 2cf8682b8..fbc2bd123 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 @@ -21,16 +21,15 @@ package com.sk89q.worldedit.regions.selector; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent; import com.sk89q.worldedit.internal.cui.SelectionPoint2DEvent; import com.sk89q.worldedit.internal.cui.SelectionShapeEvent; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Polygonal2DRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; @@ -48,7 +47,7 @@ import javax.annotation.Nullable; */ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { - private transient BlockVector pos1; + private transient BlockVector3 pos1; private transient Polygonal2DRegion region; /** @@ -91,9 +90,9 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { final int minY = oldRegion.getMinimumPoint().getBlockY(); final int maxY = oldRegion.getMaximumPoint().getBlockY(); - List points = oldRegion.polygonize(Integer.MAX_VALUE); + List points = oldRegion.polygonize(Integer.MAX_VALUE); - pos1 = points.get(0).toVector(minY).toBlockVector(); + pos1 = points.get(0).toBlockVector3(minY); region = new Polygonal2DRegion(oldRegion.getWorld(), points, minY, maxY); } } @@ -106,11 +105,11 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { * @param minY the minimum Y * @param maxY the maximum Y */ - public Polygonal2DRegionSelector(@Nullable World world, List points, int minY, int maxY) { + public Polygonal2DRegionSelector(@Nullable World world, List points, int minY, int maxY) { checkNotNull(points); - final BlockVector2D pos2D = points.get(0); - pos1 = new BlockVector(pos2D.getX(), minY, pos2D.getZ()); + final BlockVector2 pos2D = points.get(0); + pos1 = new BlockVector3(pos2D.getX(), minY, pos2D.getZ()); region = new Polygonal2DRegion(world, points, minY, maxY); } @@ -126,12 +125,12 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { } @Override - public boolean selectPrimary(Vector position, SelectorLimits limits) { + public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) { if (position.equals(pos1)) { return false; } - pos1 = position.toBlockVector(); + pos1 = position; region = new Polygonal2DRegion(region.getWorld()); region.addPoint(position); region.expandY(position.getBlockY()); @@ -140,11 +139,11 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { } @Override - public boolean selectSecondary(Vector position, SelectorLimits limits) { + public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) { if (region.size() > 0) { - final List points = region.getPoints(); + final List points = region.getPoints(); - final BlockVector2D lastPoint = points.get(region.size() - 1); + final BlockVector2 lastPoint = points.get(region.size() - 1); if (lastPoint.getBlockX() == position.getBlockX() && lastPoint.getBlockZ() == position.getBlockZ()) { return false; } @@ -163,7 +162,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { } @Override - public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) { + public void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos) { player.print("Starting a new polygon at " + pos + "."); session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID())); @@ -172,7 +171,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { } @Override - public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) { + public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) { player.print("Added point #" + region.size() + " at " + pos + "."); session.dispatchCUIEvent(player, new SelectionPoint2DEvent(region.size() - 1, pos, getArea())); @@ -186,7 +185,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { } @Override - public BlockVector getPrimaryPosition() throws IncompleteRegionException { + public BlockVector3 getPrimaryPosition() throws IncompleteRegionException { if (pos1 == null) { throw new IncompleteRegionException(); } @@ -215,8 +214,8 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { @Override public void learnChanges() { - BlockVector2D pt = region.getPoints().get(0); - pos1 = new BlockVector(pt.getBlockX(), region.getMinimumPoint().getBlockY(), pt.getBlockZ()); + BlockVector2 pt = region.getPoints().get(0); + pos1 = new BlockVector3(pt.getBlockX(), region.getMinimumPoint().getBlockY(), pt.getBlockZ()); } @Override @@ -251,7 +250,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { @Override public void describeCUI(LocalSession session, Actor player) { - final List points = region.getPoints(); + final List points = region.getPoints(); for (int id = 0; id < points.size(); id++) { session.dispatchCUIEvent(player, new SelectionPoint2DEvent(id, points.get(id), getArea())); } 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 8141748f3..6414c2cde 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 @@ -20,8 +20,9 @@ package com.sk89q.worldedit.regions.selector; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.world.World; @@ -56,9 +57,9 @@ public class SphereRegionSelector extends EllipsoidRegionSelector { */ public SphereRegionSelector(RegionSelector oldSelector) { super(oldSelector); - final Vector radius = region.getRadius(); + final Vector3 radius = region.getRadius(); final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ()); - region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar)); + region.setRadius(new Vector3(radiusScalar, radiusScalar, radiusScalar)); } /** @@ -68,24 +69,24 @@ public class SphereRegionSelector extends EllipsoidRegionSelector { * @param center the center position * @param radius the radius */ - public SphereRegionSelector(@Nullable World world, Vector center, int radius) { - super(world, center, new Vector(radius, radius, radius)); + public SphereRegionSelector(@Nullable World world, BlockVector3 center, int radius) { + super(world, center, new Vector3(radius, radius, radius)); } @Override - public boolean selectSecondary(Vector position, SelectorLimits limits) { + public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) { if (!started) { return false; } - final double radiusScalar = Math.ceil(position.distance(region.getCenter())); - region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar)); + final double radiusScalar = Math.ceil(position.toVector3().distance(region.getCenter())); + region.setRadius(new Vector3(radiusScalar, radiusScalar, radiusScalar)); return true; } @Override - public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) { + public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) { if (isDefined()) { player.print("Radius set to " + region.getRadius().getX() + " (" + region.getArea() + ")."); } else { 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 942b55c6c..0ebdc7393 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 @@ -20,7 +20,7 @@ package com.sk89q.worldedit.regions.shape; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.FlatRegion; import com.sk89q.worldedit.regions.Region; @@ -48,8 +48,8 @@ public abstract class ArbitraryBiomeShape { this.extent = new CuboidRegion(extent.getWorld(), extent.getMinimumPoint(), extent.getMaximumPoint()); } - Vector2D min = extent.getMinimumPoint().toVector2D(); - Vector2D max = extent.getMaximumPoint().toVector2D(); + BlockVector2 min = extent.getMinimumPoint().toBlockVector2(); + BlockVector2 max = extent.getMaximumPoint().toBlockVector2(); cacheOffsetX = min.getBlockX() - 1; cacheOffsetZ = min.getBlockZ() - 1; @@ -60,7 +60,7 @@ public abstract class ArbitraryBiomeShape { cache = new BaseBiome[cacheSizeX * cacheSizeZ]; } - protected Iterable getExtent() { + protected Iterable getExtent() { return extent.asFlatRegion(); } @@ -130,7 +130,7 @@ public abstract class ArbitraryBiomeShape { public int generate(EditSession editSession, BaseBiome baseBiome, boolean hollow) { int affected = 0; - for (Vector2D position : getExtent()) { + for (BlockVector2 position : getExtent()) { int x = position.getBlockX(); int z = position.getBlockZ(); 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 7629637d4..a361b528f 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 @@ -19,10 +19,10 @@ package com.sk89q.worldedit.regions.shape; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -65,7 +65,7 @@ public abstract class ArbitraryShape { public int generate(EditSession editSession, Pattern pattern, boolean hollow) throws MaxChangedBlocksException { int affected = 0; - for (BlockVector position : getExtent()) { + for (BlockVector3 position : getExtent()) { int x = position.getBlockX(); int y = position.getBlockY(); int z = position.getBlockZ(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java index e8419cf00..08994c717 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.regions.shape; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -35,7 +35,7 @@ public class RegionShape extends ArbitraryShape { @Override protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { - if (!this.extent.contains(new Vector(x, y, z))) { + if (!this.extent.contains(new BlockVector3(x, y, z))) { return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java index 8757235a3..5022c90af 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java @@ -19,30 +19,30 @@ package com.sk89q.worldedit.regions.shape; -import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; public class WorldEditExpressionEnvironment implements ExpressionEnvironment { - private final Vector unit; - private final Vector zero2; - private Vector current = new Vector(); + private final Vector3 unit; + private final Vector3 zero2; + private Vector3 current = Vector3.ZERO; private EditSession editSession; - public WorldEditExpressionEnvironment(EditSession editSession, Vector unit, Vector zero) { + public WorldEditExpressionEnvironment(EditSession editSession, Vector3 unit, Vector3 zero) { this.editSession = editSession; this.unit = unit; this.zero2 = zero.add(0.5, 0.5, 0.5); } - public BlockVector toWorld(double x, double y, double z) { + public BlockVector3 toWorld(double x, double y, double z) { // unscale, unoffset, round-nearest - return new Vector(x, y, z).multiply(unit).add(zero2).toBlockPoint(); + return new Vector3(x, y, z).multiply(unit).add(zero2).toBlockPoint(); } - public Vector toWorldRel(double x, double y, double z) { + public Vector3 toWorldRel(double x, double y, double z) { return current.add(x, y, z); } @@ -76,7 +76,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { return 0; } - public void setCurrentBlock(Vector current) { + public void setCurrentBlock(Vector3 current) { this.current = current; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java index e4a9ade5a..d50a277ac 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java @@ -21,13 +21,13 @@ package com.sk89q.worldedit.session; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.transform.BlockTransformExtent; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.transform.Transform; /** @@ -39,7 +39,7 @@ public class PasteBuilder { private final Transform transform; private final Extent targetExtent; - private Vector to = new Vector(); + private BlockVector3 to = BlockVector3.ZERO; private boolean ignoreAirBlocks; /** @@ -62,7 +62,7 @@ public class PasteBuilder { * @param to the target location * @return this builder instance */ - public PasteBuilder to(Vector to) { + public PasteBuilder to(BlockVector3 to) { this.to = to; return this; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestSelection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestSelection.java index 72ae6ef2b..9e37e4da0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestSelection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestSelection.java @@ -19,12 +19,11 @@ package com.sk89q.worldedit.session.request; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.NullRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; @@ -64,17 +63,17 @@ public class RequestSelection implements Region { } @Override - public Vector getMinimumPoint() { + public BlockVector3 getMinimumPoint() { return getRegion().getMinimumPoint(); } @Override - public Vector getMaximumPoint() { + public BlockVector3 getMaximumPoint() { return getRegion().getMaximumPoint(); } @Override - public Vector getCenter() { + public Vector3 getCenter() { return getRegion().getCenter(); } @@ -99,32 +98,32 @@ public class RequestSelection implements Region { } @Override - public void expand(Vector... changes) throws RegionOperationException { + public void expand(BlockVector3... changes) throws RegionOperationException { getRegion().expand(changes); } @Override - public void contract(Vector... changes) throws RegionOperationException { + public void contract(BlockVector3... changes) throws RegionOperationException { getRegion().contract(changes); } @Override - public void shift(Vector change) throws RegionOperationException { + public void shift(BlockVector3 change) throws RegionOperationException { getRegion().shift(change); } @Override - public boolean contains(Vector position) { + public boolean contains(BlockVector3 position) { return getRegion().contains(position); } @Override - public Set getChunks() { + public Set getChunks() { return getRegion().getChunks(); } @Override - public Set getChunkCubes() { + public Set getChunkCubes() { return getRegion().getChunkCubes(); } @@ -144,12 +143,12 @@ public class RequestSelection implements Region { } @Override - public List polygonize(int maxPoints) { + public List polygonize(int maxPoints) { return getRegion().polygonize(maxPoints); } @Override - public Iterator iterator() { + public Iterator iterator() { return getRegion().iterator(); } 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 0907753a4..e62796bd7 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 @@ -19,7 +19,8 @@ package com.sk89q.worldedit.util; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import javax.annotation.Nullable; @@ -28,32 +29,32 @@ import javax.annotation.Nullable; */ public enum Direction { - NORTH(new Vector(0, 0, -1), Flag.CARDINAL), - EAST(new Vector(1, 0, 0), Flag.CARDINAL), - SOUTH(new Vector(0, 0, 1), Flag.CARDINAL), - WEST(new Vector(-1, 0, 0), Flag.CARDINAL), + NORTH(new Vector3(0, 0, -1), Flag.CARDINAL), + EAST(new Vector3(1, 0, 0), Flag.CARDINAL), + SOUTH(new Vector3(0, 0, 1), Flag.CARDINAL), + WEST(new Vector3(-1, 0, 0), Flag.CARDINAL), - UP(new Vector(0, 1, 0), Flag.UPRIGHT), - DOWN(new Vector(0, -1, 0), Flag.UPRIGHT), + UP(new Vector3(0, 1, 0), Flag.UPRIGHT), + DOWN(new Vector3(0, -1, 0), Flag.UPRIGHT), - NORTHEAST(new Vector(1, 0, -1), Flag.ORDINAL), - NORTHWEST(new Vector(-1, 0, -1), Flag.ORDINAL), - SOUTHEAST(new Vector(1, 0, 1), Flag.ORDINAL), - SOUTHWEST(new Vector(-1, 0, 1), Flag.ORDINAL), + NORTHEAST(new Vector3(1, 0, -1), Flag.ORDINAL), + NORTHWEST(new Vector3(-1, 0, -1), Flag.ORDINAL), + SOUTHEAST(new Vector3(1, 0, 1), Flag.ORDINAL), + SOUTHWEST(new Vector3(-1, 0, 1), Flag.ORDINAL), - WEST_NORTHWEST(new Vector(-Math.cos(Math.PI / 8), 0, -Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - WEST_SOUTHWEST(new Vector(-Math.cos(Math.PI / 8), 0, Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - NORTH_NORTHWEST(new Vector(-Math.sin(Math.PI / 8), 0, -Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - NORTH_NORTHEAST(new Vector(Math.sin(Math.PI / 8), 0, -Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - EAST_NORTHEAST(new Vector(Math.cos(Math.PI / 8), 0, -Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - EAST_SOUTHEAST(new Vector(Math.cos(Math.PI / 8), 0, Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - SOUTH_SOUTHEAST(new Vector(Math.sin(Math.PI / 8), 0, Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - SOUTH_SOUTHWEST(new Vector(-Math.sin(Math.PI / 8), 0, Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL); + WEST_NORTHWEST(new Vector3(-Math.cos(Math.PI / 8), 0, -Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + WEST_SOUTHWEST(new Vector3(-Math.cos(Math.PI / 8), 0, Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + NORTH_NORTHWEST(new Vector3(-Math.sin(Math.PI / 8), 0, -Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + NORTH_NORTHEAST(new Vector3(Math.sin(Math.PI / 8), 0, -Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + EAST_NORTHEAST(new Vector3(Math.cos(Math.PI / 8), 0, -Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + EAST_SOUTHEAST(new Vector3(Math.cos(Math.PI / 8), 0, Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + SOUTH_SOUTHEAST(new Vector3(Math.sin(Math.PI / 8), 0, Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + SOUTH_SOUTHWEST(new Vector3(-Math.sin(Math.PI / 8), 0, Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL); - private final Vector direction; + private final Vector3 direction; private final int flags; - Direction(Vector vector, int flags) { + Direction(Vector3 vector, int flags) { this.direction = vector.normalize(); this.flags = flags; } @@ -105,10 +106,19 @@ public enum Direction { * * @return the vector */ - public Vector toVector() { + public Vector3 toVector() { return direction; } + /** + * Get the vector. + * + * @return the vector + */ + public BlockVector3 toBlockVector() { + return direction.toBlockPoint(); + } + /** * Find the closest direction to the given direction vector. * @@ -117,9 +127,9 @@ public enum Direction { * @return the closest direction, or null if no direction can be returned */ @Nullable - public static Direction findClosest(Vector vector, int flags) { + public static Direction findClosest(Vector3 vector, int flags) { if ((flags & Flag.UPRIGHT) == 0) { - vector = vector.setY(0); + vector = vector.withY(0); } vector = vector.normalize(); @@ -141,7 +151,7 @@ public enum Direction { } /** - * Flags to use with {@link #findClosest(Vector, int)}. + * Flags to use with {@link #findClosest(Vector3, int)}. */ public static final class Flag { public static int CARDINAL = 0x1; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java index 9a768e33d..35552b8d9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.util; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.Objects; @@ -31,15 +31,15 @@ import java.util.Objects; */ public final class LocatedBlock { - private final Vector location; + private final BlockVector3 location; private final BlockStateHolder block; - public LocatedBlock(Vector location, BlockStateHolder block) { + public LocatedBlock(BlockVector3 location, BlockStateHolder block) { this.location = checkNotNull(location); this.block = checkNotNull(block); } - public Vector getLocation() { + public BlockVector3 getLocation() { return location; } 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 521545b37..82186bbb1 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 @@ -21,8 +21,8 @@ package com.sk89q.worldedit.util; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.Vector3; /** * Represents a location in a world with has a direction. @@ -37,7 +37,7 @@ import com.sk89q.worldedit.extent.Extent; public class Location { private final Extent extent; - private final Vector position; + private final Vector3 position; private final float pitch; private final float yaw; @@ -48,7 +48,7 @@ public class Location { * @param extent the extent */ public Location(Extent extent) { - this(extent, new Vector(), new Vector()); + this(extent, Vector3.ZERO, Vector3.ZERO); } /** @@ -61,7 +61,7 @@ public class Location { * @param z the Z coordinate */ public Location(Extent extent, double x, double y, double z) { - this(extent, new Vector(x, y, z), new Vector()); + this(extent, new Vector3(x, y, z), Vector3.ZERO); } /** @@ -71,8 +71,8 @@ public class Location { * @param extent the extent * @param position the position vector */ - public Location(Extent extent, Vector position) { - this(extent, position, new Vector()); + public Location(Extent extent, Vector3 position) { + this(extent, position, Vector3.ZERO); } /** @@ -85,8 +85,8 @@ public class Location { * @param z the Z coordinate * @param direction the direction vector */ - public Location(Extent extent, double x, double y, double z, Vector direction) { - this(extent, new Vector(x, y, z), direction); + public Location(Extent extent, double x, double y, double z, Vector3 direction) { + this(extent, new Vector3(x, y, z), direction); } /** @@ -101,7 +101,7 @@ public class Location { * @param pitch the pitch, in degrees */ public Location(Extent extent, double x, double y, double z, float yaw, float pitch) { - this(extent, new Vector(x, y, z), yaw, pitch); + this(extent, new Vector3(x, y, z), yaw, pitch); } /** @@ -112,8 +112,8 @@ public class Location { * @param position the position vector * @param direction the direction vector */ - public Location(Extent extent, Vector position, Vector direction) { - this(extent, position, direction.toYaw(), direction.toPitch()); + public Location(Extent extent, Vector3 position, Vector3 direction) { + this(extent, position, (float) direction.toYaw(), (float) direction.toPitch()); } /** @@ -125,7 +125,7 @@ public class Location { * @param yaw the yaw, in degrees * @param pitch the pitch, in degrees */ - public Location(Extent extent, Vector position, float yaw, float pitch) { + public Location(Extent extent, Vector3 position, float yaw, float pitch) { checkNotNull(extent); checkNotNull(position); this.extent = extent; @@ -207,11 +207,11 @@ public class Location { * * @return the direction vector */ - public Vector getDirection() { + public Vector3 getDirection() { double yaw = Math.toRadians(this.getYaw()); double pitch = Math.toRadians(this.getPitch()); double xz = Math.cos(pitch); - return new Vector( + return new Vector3( -xz * Math.sin(yaw), -Math.sin(pitch), xz * Math.cos(yaw)); @@ -232,16 +232,16 @@ public class Location { * @param direction the new direction * @return the new instance */ - public Location setDirection(Vector direction) { - return new Location(extent, position, direction.toYaw(), direction.toPitch()); + public Location setDirection(Vector3 direction) { + return new Location(extent, position, (float) direction.toYaw(), (float) direction.toPitch()); } /** - * Get a {@link Vector} form of this location's position. + * Get a {@link Vector3} form of this location's position. * * @return a vector */ - public Vector toVector() { + public Vector3 toVector() { return position; } @@ -260,7 +260,7 @@ public class Location { * @return the rounded X component */ public int getBlockX() { - return position.getBlockX(); + return (int) Math.floor(position.getX()); } /** @@ -271,18 +271,7 @@ public class Location { * @return a new immutable instance */ public Location setX(double x) { - return new Location(extent, position.setX(x), yaw, pitch); - } - - /** - * Return a copy of this object with the X component of the new object - * set to the given value. - * - * @param x the new value for the X component - * @return a new immutable instance - */ - public Location setX(int x) { - return new Location(extent, position.setX(x), yaw, pitch); + return new Location(extent, position.withX(x), yaw, pitch); } /** @@ -300,7 +289,7 @@ public class Location { * @return the rounded Y component */ public int getBlockY() { - return position.getBlockY(); + return (int) Math.floor(position.getY()); } /** @@ -311,18 +300,7 @@ public class Location { * @return a new immutable instance */ public Location setY(double y) { - return new Location(extent, position.setY(y), yaw, pitch); - } - - /** - * Return a copy of this object with the Y component of the new object - * set to the given value. - * - * @param y the new value for the Y component - * @return a new immutable instance - */ - public Location setY(int y) { - return new Location(extent, position.setY(y), yaw, pitch); + return new Location(extent, position.withY(y), yaw, pitch); } /** @@ -340,7 +318,7 @@ public class Location { * @return the rounded Z component */ public int getBlockZ() { - return position.getBlockZ(); + return (int) Math.floor(position.getZ()); } /** @@ -351,18 +329,7 @@ public class Location { * @return a new immutable instance */ public Location setZ(double z) { - return new Location(extent, position.setZ(z), yaw, pitch); - } - - /** - * Return a copy of this object with the Z component of the new object - * set to the given value. - * - * @param z the new value for the Y component - * @return a new immutable instance - */ - public Location setZ(int z) { - return new Location(extent, position.setZ(z), yaw, pitch); + return new Location(extent, position.withZ(z), yaw, pitch); } /** @@ -371,7 +338,7 @@ public class Location { * @param position The new position * @return a new immutable instance */ - public Location setPosition(Vector position) { + public Location setPosition(Vector3 position) { return new Location(extent, position, yaw, pitch); } 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 be654ec17..1c2a97b3f 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 @@ -19,8 +19,9 @@ package com.sk89q.worldedit.util; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.World; /** @@ -35,10 +36,10 @@ public class TargetBlock { private World world; private int maxDistance; private double checkDistance, curDistance; - private Vector targetPos = new Vector(); - private Vector targetPosDouble = new Vector(); - private Vector prevPos = new Vector(); - private Vector offset = new Vector(); + private BlockVector3 targetPos = BlockVector3.ZERO; + private Vector3 targetPosDouble = Vector3.ZERO; + private BlockVector3 prevPos = BlockVector3.ZERO; + private Vector3 offset = Vector3.ZERO; /** * Constructor requiring a player, uses default values @@ -73,7 +74,7 @@ public class TargetBlock { * @param viewHeight where the view is positioned in y-axis * @param checkDistance how often to check for blocks, the smaller the more precise */ - private void setValues(Vector loc, double xRotation, double yRotation, int maxDistance, double viewHeight, double checkDistance) { + private void setValues(Vector3 loc, double xRotation, double yRotation, int maxDistance, double viewHeight, double checkDistance) { this.maxDistance = maxDistance; this.checkDistance = checkDistance; this.curDistance = 0; @@ -82,7 +83,7 @@ public class TargetBlock { double h = (checkDistance * Math.cos(Math.toRadians(yRotation))); - offset = new Vector((h * Math.cos(Math.toRadians(xRotation))), + offset = new Vector3((h * Math.cos(Math.toRadians(xRotation))), (checkDistance * Math.sin(Math.toRadians(yRotation))), (h * Math.sin(Math.toRadians(xRotation)))); @@ -101,7 +102,7 @@ public class TargetBlock { boolean searchForLastBlock = true; Location lastBlock = null; while (getNextBlock() != null) { - if (world.getBlock(getCurrentBlock().toVector()).getBlockType().getMaterial().isAir()) { + if (world.getBlock(targetPos).getBlockType().getMaterial().isAir()) { if (searchForLastBlock) { lastBlock = getCurrentBlock(); if (lastBlock.getBlockY() <= 0 || lastBlock.getBlockY() >= world.getMaxY()) { @@ -123,7 +124,7 @@ public class TargetBlock { * @return Block */ public Location getTargetBlock() { - while (getNextBlock() != null && world.getBlock(getCurrentBlock().toVector()).getBlockType().getMaterial().isAir()) ; + while (getNextBlock() != null && world.getBlock(targetPos).getBlockType().getMaterial().isAir()) ; return getCurrentBlock(); } @@ -134,7 +135,7 @@ public class TargetBlock { * @return Block */ public Location getSolidTargetBlock() { - while (getNextBlock() != null && !world.getBlock(getCurrentBlock().toVector()).getBlockType().getMaterial().isMovementBlocker()) ; + while (getNextBlock() != null && !world.getBlock(targetPos).getBlockType().getMaterial().isMovementBlocker()) ; return getCurrentBlock(); } @@ -161,7 +162,7 @@ public class TargetBlock { return null; } - return new Location(world, targetPos); + return new Location(world, targetPos.toVector3()); } /** @@ -173,7 +174,7 @@ public class TargetBlock { if (curDistance > maxDistance) { return null; } else { - return new Location(world, targetPos); + return new Location(world, targetPos.toVector3()); } } @@ -183,7 +184,7 @@ public class TargetBlock { * @return block position */ public Location getPreviousBlock() { - return new Location(world, prevPos); + return new Location(world, prevPos.toVector3()); } public Location getAnyTargetBlockFace() { 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 58f32b480..7532f947f 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 @@ -22,7 +22,7 @@ package com.sk89q.worldedit.util; import com.google.common.collect.Sets; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; @@ -49,7 +49,7 @@ public class TreeGenerator { MEGA_REDWOOD("Large spruce tree", "largespruce", "megaredwood"), RANDOM_REDWOOD("Random spruce tree", "randspruce", "randredwood", "randomredwood", "anyredwood") { @Override - public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { + public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { TreeType[] choices = { REDWOOD, TALL_REDWOOD, MEGA_REDWOOD }; return choices[TreeGenerator.RANDOM.nextInt(choices.length)].generate(editSession, pos); } @@ -58,7 +58,7 @@ public class TreeGenerator { TALL_BIRCH("Tall birch tree", "tallbirch"), RANDOM_BIRCH("Random birch tree", "randbirch", "randombirch") { @Override - public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { + public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { TreeType[] choices = { BIRCH, TALL_BIRCH }; return choices[TreeGenerator.RANDOM.nextInt(choices.length)].generate(editSession, pos); } @@ -67,13 +67,13 @@ public class TreeGenerator { SMALL_JUNGLE("Small jungle tree", "shortjungle", "smalljungle"), SHORT_JUNGLE("Short jungle tree") { @Override - public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { + public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { return SMALL_JUNGLE.generate(editSession, pos); } }, RANDOM_JUNGLE("Random jungle tree", "randjungle", "randomjungle") { @Override - public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { + public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { TreeType[] choices = { JUNGLE, SMALL_JUNGLE }; return choices[TreeGenerator.RANDOM.nextInt(choices.length)].generate(editSession, pos); } @@ -83,7 +83,7 @@ public class TreeGenerator { BROWN_MUSHROOM("Brown mushroom", "brownmushroom", "browngiantmushroom"), RANDOM_MUSHROOM("Random mushroom", "randmushroom", "randommushroom") { @Override - public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { + public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { TreeType[] choices = { RED_MUSHROOM, BROWN_MUSHROOM }; return choices[TreeGenerator.RANDOM.nextInt(choices.length)].generate(editSession, pos); } @@ -93,14 +93,14 @@ public class TreeGenerator { DARK_OAK("Dark oak tree", "darkoak"), PINE("Pine tree", "pine") { @Override - public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { + public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { makePineTree(editSession, pos); return true; } }, RANDOM("Random tree", "rand", "random") { @Override - public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { + public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { TreeType[] choices = TreeType.values(); return choices[TreeGenerator.RANDOM.nextInt(choices.length)].generate(editSession, pos); } @@ -139,7 +139,7 @@ public class TreeGenerator { return Collections.unmodifiableSet(primaryAliases); } - public boolean generate(EditSession editSession, Vector pos) throws MaxChangedBlocksException { + public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { return editSession.getWorld().generateTree(this, editSession, pos); } @@ -174,7 +174,7 @@ public class TreeGenerator { * * @param basePosition the base position */ - private static void makePineTree(EditSession editSession, Vector basePosition) + private static void makePineTree(EditSession editSession, BlockVector3 basePosition) throws MaxChangedBlocksException { int trunkHeight = (int) Math.floor(Math.random() * 2) + 3; int height = (int) Math.floor(Math.random() * 5) + 8; @@ -250,7 +250,7 @@ public class TreeGenerator { * @return whether a block was changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - private static boolean setChanceBlockIfAir(EditSession session, Vector position, BlockStateHolder block, double probability) + private static boolean setChanceBlockIfAir(EditSession session, BlockVector3 position, BlockStateHolder block, double probability) throws MaxChangedBlocksException { return Math.random() <= probability && setBlockIfAir(session, position, block); } @@ -263,7 +263,7 @@ public class TreeGenerator { * @return if block was changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - private static boolean setBlockIfAir(EditSession session, Vector position, BlockStateHolder block) throws MaxChangedBlocksException { + private static boolean setBlockIfAir(EditSession session, BlockVector3 position, BlockStateHolder block) throws MaxChangedBlocksException { return session.getBlock(position).getBlockType().getMaterial().isAir() && session.setBlock(position, block); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java index 7c821b0f3..4f303acd6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.util.collection; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.LocatedBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -51,7 +51,7 @@ public class LocatedBlockList implements Iterable { list.add(setBlockCall); } - public void add(Vector location, BlockStateHolder block) { + public void add(BlockVector3 location, BlockStateHolder block) { add(new LocatedBlock(location, block)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/GsonUtil.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/GsonUtil.java index 8d6d4dd2b..5d73c68ea 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/GsonUtil.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/GsonUtil.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.util.gson; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; /** * Utility methods for Google's GSON library. @@ -38,7 +38,7 @@ public final class GsonUtil { */ public static GsonBuilder createBuilder() { GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.registerTypeAdapter(Vector.class, new VectorAdapter()); + gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter()); return gsonBuilder; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java index a1e876dfe..4524e64f9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java @@ -24,17 +24,17 @@ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import java.lang.reflect.Type; /** * Deserializes {@code Vector}s for GSON. */ -public class VectorAdapter implements JsonDeserializer { +public class VectorAdapter implements JsonDeserializer { @Override - public Vector deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + public Vector3 deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonArray jsonArray = json.getAsJsonArray(); if (jsonArray.size() != 3) { throw new JsonParseException("Expected array of 3 length for Vector"); @@ -44,6 +44,6 @@ public class VectorAdapter implements JsonDeserializer { double y = jsonArray.get(1).getAsDouble(); double z = jsonArray.get(2).getAsDouble(); - return new Vector(x, y, z); + return new Vector3(x, y, z); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java index 4007125f6..124187fdd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.world; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; @@ -28,6 +26,9 @@ import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -46,12 +47,12 @@ public abstract class AbstractWorld implements World { private int taskId = -1; @Override - public boolean useItem(Vector position, BaseItem item, Direction face) { + public boolean useItem(BlockVector3 position, BaseItem item, Direction face) { return false; } @Override - public final boolean setBlock(Vector pt, BlockStateHolder block) throws WorldEditException { + public final boolean setBlock(BlockVector3 pt, BlockStateHolder block) throws WorldEditException { return setBlock(pt, block, true); } @@ -66,31 +67,31 @@ public abstract class AbstractWorld implements World { } @Override - public void dropItem(Vector pt, BaseItemStack item, int times) { + public void dropItem(Vector3 pt, BaseItemStack item, int times) { for (int i = 0; i < times; ++i) { dropItem(pt, item); } } @Override - public void checkLoadedChunk(Vector pt) { + public void checkLoadedChunk(BlockVector3 pt) { } @Override - public void fixAfterFastMode(Iterable chunks) { + public void fixAfterFastMode(Iterable chunks) { } @Override - public void fixLighting(Iterable chunks) { + public void fixLighting(Iterable chunks) { } @Override - public boolean playEffect(Vector position, int type, int data) { + public boolean playEffect(Vector3 position, int type, int data) { return false; } @Override - public boolean queueBlockBreakEffect(Platform server, Vector position, BlockType blockType, double priority) { + public boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority) { if (taskId == -1) { taskId = server.schedule(0, 1, () -> { int max = Math.max(1, Math.min(30, effectQueue.size() / 3)); @@ -106,19 +107,19 @@ public abstract class AbstractWorld implements World { return false; } - effectQueue.offer(new QueuedEffect(position, blockType, priority)); + effectQueue.offer(new QueuedEffect(position.toVector3(), blockType, priority)); return true; } @Override - public Vector getMinimumPoint() { - return new Vector(-30000000, 0, -30000000); + public BlockVector3 getMinimumPoint() { + return new BlockVector3(-30000000, 0, -30000000); } @Override - public Vector getMaximumPoint() { - return new Vector(30000000, 255, 30000000); + public BlockVector3 getMaximumPoint() { + return new BlockVector3(30000000, 255, 30000000); } @Override @@ -127,11 +128,11 @@ public abstract class AbstractWorld implements World { } private class QueuedEffect implements Comparable { - private final Vector position; + private final Vector3 position; private final BlockType blockType; private final double priority; - private QueuedEffect(Vector position, BlockType blockType, double priority) { + private QueuedEffect(Vector3 position, BlockType blockType, double priority) { this.position = position; this.blockType = blockType; this.priority = priority; 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 4542d19e2..43ee77e39 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 @@ -21,12 +21,13 @@ package com.sk89q.worldedit.world; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TreeGenerator.TreeType; @@ -59,36 +60,36 @@ public class NullWorld extends AbstractWorld { } @Override - public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { return false; } @Override - public int getBlockLightLevel(Vector position) { + public int getBlockLightLevel(BlockVector3 position) { return 0; } @Override - public boolean clearContainerBlockContents(Vector position) { + public boolean clearContainerBlockContents(BlockVector3 position) { return false; } @Override - public BaseBiome getBiome(Vector2D position) { + public BaseBiome getBiome(BlockVector2 position) { return null; } @Override - public boolean setBiome(Vector2D position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BaseBiome biome) { return false; } @Override - public void dropItem(Vector position, BaseItemStack item) { + public void dropItem(Vector3 position, BaseItemStack item) { } @Override - public void simulateBlockMine(Vector position) { + public void simulateBlockMine(BlockVector3 position) { } @Override @@ -97,7 +98,7 @@ public class NullWorld extends AbstractWorld { } @Override - public boolean generateTree(TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException { + public boolean generateTree(TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException { return false; } @@ -120,12 +121,12 @@ public class NullWorld extends AbstractWorld { } @Override - public BlockState getBlock(Vector position) { + public BlockState getBlock(BlockVector3 position) { return BlockTypes.AIR.getDefaultState(); } @Override - public BaseBlock getFullBlock(Vector position) { + public BaseBlock getFullBlock(BlockVector3 position) { return getBlock(position).toBaseBlock(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java index ed0234e6c..3e7bbf88c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java @@ -19,16 +19,17 @@ package com.sk89q.worldedit.world; -import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.TreeGenerator; @@ -72,10 +73,10 @@ public interface World extends Extent { * @param face The face * @return Whether it succeeded */ - boolean useItem(Vector position, BaseItem item, Direction face); + boolean useItem(BlockVector3 position, BaseItem item, Direction face); /** - * Similar to {@link Extent#setBlock(Vector, BlockStateHolder)} but a + * Similar to {@link Extent#setBlock(BlockVector3, BlockStateHolder)} but a * {@code notifyAndLight} parameter indicates whether adjacent blocks * should be notified that changes have been made and lighting operations * should be executed. @@ -92,7 +93,7 @@ public interface World extends Extent { * @param notifyAndLight true to to notify and light * @return true if the block was successfully set (return value may not be accurate) */ - boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException; + boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException; /** * Get the light level at the given block. @@ -100,7 +101,7 @@ public interface World extends Extent { * @param position the position * @return the light level (0-15) */ - int getBlockLightLevel(Vector position); + int getBlockLightLevel(BlockVector3 position); /** * Clear a chest's contents. @@ -108,7 +109,7 @@ public interface World extends Extent { * @param position the position * @return true if the container was cleared */ - boolean clearContainerBlockContents(Vector position); + boolean clearContainerBlockContents(BlockVector3 position); /** * Drop an item at the given position. @@ -117,23 +118,23 @@ public interface World extends Extent { * @param item the item to drop * @param count the number of individual stacks to drop (number of item entities) */ - void dropItem(Vector position, BaseItemStack item, int count); + void dropItem(Vector3 position, BaseItemStack item, int count); /** * Drop one stack of the item at the given position. * * @param position the position * @param item the item to drop - * @see #dropItem(Vector, BaseItemStack, int) shortcut method to specify the number of stacks + * @see #dropItem(Vector3, BaseItemStack, int) shortcut method to specify the number of stacks */ - void dropItem(Vector position, BaseItemStack item); + void dropItem(Vector3 position, BaseItemStack item); /** * Simulate a block being mined at the given position. * * @param position the position */ - void simulateBlockMine(Vector position); + void simulateBlockMine(BlockVector3 position); /** * Regenerate an area. @@ -153,19 +154,19 @@ public interface World extends Extent { * @return true if generation was successful * @throws MaxChangedBlocksException thrown if too many blocks were changed */ - boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException; + boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException; /** * Load the chunk at the given position if it isn't loaded. * * @param position the position */ - void checkLoadedChunk(Vector position); + void checkLoadedChunk(BlockVector3 position); /** * Fix the given chunks after fast mode was used. * - *

Fast mode makes calls to {@link #setBlock(Vector, BlockStateHolder, boolean)} + *

Fast mode makes calls to {@link #setBlock(BlockVector3, BlockStateHolder, boolean)} * with {@code false} for the {@code notifyAndLight} parameter, which * may causes lighting errors to accumulate. Use of this method, if * it is implemented by the underlying world, corrects those lighting @@ -173,14 +174,14 @@ public interface World extends Extent { * * @param chunks a list of chunk coordinates to fix */ - void fixAfterFastMode(Iterable chunks); + void fixAfterFastMode(Iterable chunks); /** * Relight the given chunks if possible. * * @param chunks a list of chunk coordinates to fix */ - void fixLighting(Iterable chunks); + void fixLighting(Iterable chunks); /** * Play the given effect. @@ -190,7 +191,7 @@ public interface World extends Extent { * @param data the effect data * @return true if the effect was played */ - boolean playEffect(Vector position, int type, int data); + boolean playEffect(Vector3 position, int type, int data); /** * Queue a block break effect. @@ -201,7 +202,7 @@ public interface World extends Extent { * @param priority the priority * @return true if the effect was played */ - boolean queueBlockBreakEffect(Platform server, Vector position, BlockType blockType, double priority); + boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority); /** * Gets the weather type of the world. 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 6b1265854..65f76cd41 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 @@ -26,9 +26,8 @@ import com.sk89q.jnbt.IntTag; import com.sk89q.jnbt.ListTag; import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockState; @@ -52,7 +51,7 @@ public class AnvilChunk implements Chunk { private int rootX; private int rootZ; - private Map> tileEntities; + private Map> tileEntities; /** * Construct the chunk with a compound tag. @@ -119,10 +118,10 @@ public class AnvilChunk implements Chunk { } } - private int getBlockID(Vector position) throws DataException { - int x = position.getBlockX() - rootX * 16; - int y = position.getBlockY(); - int z = position.getBlockZ() - rootZ * 16; + private int getBlockID(BlockVector3 position) throws DataException { + int x = position.getX() - rootX * 16; + int y = position.getY(); + int z = position.getZ() - rootZ * 16; int section = y >> 4; if (section < 0 || section >= blocks.length) { @@ -152,10 +151,10 @@ public class AnvilChunk implements Chunk { } } - private int getBlockData(Vector position) throws DataException { - int x = position.getBlockX() - rootX * 16; - int y = position.getBlockY(); - int z = position.getBlockZ() - rootZ * 16; + private int getBlockData(BlockVector3 position) throws DataException { + int x = position.getX() - rootX * 16; + int y = position.getY(); + int z = position.getZ() - rootZ * 16; int section = y >> 4; int yIndex = y & 0x0F; @@ -225,7 +224,7 @@ public class AnvilChunk implements Chunk { values.put(entry.getKey(), entry.getValue()); } - BlockVector vec = new BlockVector(x, y, z); + BlockVector3 vec = new BlockVector3(x, y, z); tileEntities.put(vec, values); } } @@ -240,12 +239,12 @@ public class AnvilChunk implements Chunk { * @throws DataException thrown if there is a data error */ @Nullable - private CompoundTag getBlockTileEntity(Vector position) throws DataException { + private CompoundTag getBlockTileEntity(BlockVector3 position) throws DataException { if (tileEntities == null) { populateTileEntities(); } - Map values = tileEntities.get(new BlockVector(position)); + Map values = tileEntities.get(position); if (values == null) { return null; } @@ -254,7 +253,7 @@ public class AnvilChunk implements Chunk { } @Override - public BlockStateHolder getBlock(Vector position) throws DataException { + public BlockStateHolder getBlock(BlockVector3 position) throws DataException { int id = getBlockID(position); int data = getBlockData(position); 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 025390c66..cda59cbda 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 @@ -26,8 +26,7 @@ import com.sk89q.jnbt.ListTag; import com.sk89q.jnbt.LongArrayTag; import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.block.BlockState; @@ -52,7 +51,7 @@ public class AnvilChunk13 implements Chunk { private int rootX; private int rootZ; - private Map> tileEntities; + private Map> tileEntities; /** * Construct the chunk with a compound tag. @@ -201,7 +200,7 @@ public class AnvilChunk13 implements Chunk { values.put(entry.getKey(), entry.getValue()); } - BlockVector vec = new BlockVector(x, y, z); + BlockVector3 vec = new BlockVector3(x, y, z); tileEntities.put(vec, values); } } @@ -216,12 +215,12 @@ public class AnvilChunk13 implements Chunk { * @throws DataException thrown if there is a data error */ @Nullable - private CompoundTag getBlockTileEntity(Vector position) throws DataException { + private CompoundTag getBlockTileEntity(BlockVector3 position) throws DataException { if (tileEntities == null) { populateTileEntities(); } - Map values = tileEntities.get(new BlockVector(position)); + Map values = tileEntities.get(position); if (values == null) { return null; } @@ -230,10 +229,10 @@ public class AnvilChunk13 implements Chunk { } @Override - public BlockStateHolder getBlock(Vector position) throws DataException { - int x = position.getBlockX() - rootX * 16; - int y = position.getBlockY(); - int z = position.getBlockZ() - rootZ * 16; + public BlockStateHolder getBlock(BlockVector3 position) throws DataException { + int x = position.getX() - rootX * 16; + int y = position.getY(); + int z = position.getZ() - rootZ * 16; int section = y >> 4; int yIndex = y & 0x0F; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java index 2f261570e..7a1ef7612 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.world.chunk; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -35,6 +35,6 @@ public interface Chunk { * @return block the block * @throws DataException thrown on data error */ - BlockStateHolder getBlock(Vector position) throws DataException; + BlockStateHolder getBlock(BlockVector3 position) throws DataException; } 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 c6f983ced..4a3336e86 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 @@ -25,9 +25,8 @@ import com.sk89q.jnbt.IntTag; import com.sk89q.jnbt.ListTag; import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockState; @@ -51,7 +50,7 @@ public class OldChunk implements Chunk { private int rootX; private int rootZ; - private Map> tileEntities; + private Map> tileEntities; /** * Construct the chunk with a compound tag. @@ -127,7 +126,7 @@ public class OldChunk implements Chunk { values.put(entry.getKey(), entry.getValue()); } - BlockVector vec = new BlockVector(x, y, z); + BlockVector3 vec = new BlockVector3(x, y, z); tileEntities.put(vec, values); } } @@ -141,12 +140,12 @@ public class OldChunk implements Chunk { * @return a tag * @throws DataException */ - private CompoundTag getBlockTileEntity(Vector position) throws DataException { + private CompoundTag getBlockTileEntity(BlockVector3 position) throws DataException { if (tileEntities == null) { populateTileEntities(); } - Map values = tileEntities.get(new BlockVector(position)); + Map values = tileEntities.get(position); if (values == null) { return null; } @@ -154,13 +153,13 @@ public class OldChunk implements Chunk { } @Override - public BlockStateHolder getBlock(Vector position) throws DataException { - if(position.getBlockY() >= 128) BlockTypes.VOID_AIR.getDefaultState().toBaseBlock(); + public BlockStateHolder getBlock(BlockVector3 position) throws DataException { + if(position.getY() >= 128) return BlockTypes.VOID_AIR.getDefaultState().toBaseBlock(); int id, dataVal; - int x = position.getBlockX() - rootX * 16; - int y = position.getBlockY(); - int z = position.getBlockZ() - rootZ * 16; + int x = position.getX() - rootX * 16; + int y = position.getY(); + int z = position.getZ() - 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/registry/BundledBlockData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java index afe73c368..b98238dc0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java @@ -23,7 +23,7 @@ import com.google.common.io.Resources; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.gson.VectorAdapter; import java.io.IOException; @@ -73,7 +73,7 @@ public class BundledBlockData { */ private void loadFromResource() throws IOException { GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.registerTypeAdapter(Vector.class, new VectorAdapter()); + gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter()); Gson gson = gsonBuilder.create(); URL url = BundledBlockData.class.getResource("blocks.json"); if (url == null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java index 00cafb244..2867b2e56 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java @@ -23,7 +23,7 @@ import com.google.common.io.Resources; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.gson.VectorAdapter; import java.io.IOException; @@ -73,7 +73,7 @@ public class BundledItemData { */ private void loadFromResource() throws IOException { GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.registerTypeAdapter(Vector.class, new VectorAdapter()); + gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter()); Gson gson = gsonBuilder.create(); URL url = BundledItemData.class.getResource("items.json"); if (url == null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java index 78bc48131..5ea6044f3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java @@ -25,9 +25,9 @@ import com.google.common.io.Resources; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.gson.VectorAdapter; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.item.ItemType; @@ -71,7 +71,7 @@ public class LegacyMapper { */ private void loadFromResource() throws IOException { GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.registerTypeAdapter(Vector.class, new VectorAdapter()); + gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter()); Gson gson = gsonBuilder.disableHtmlEscaping().create(); URL url = LegacyMapper.class.getResource("legacy.json"); if (url == null) { 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 a7ef7ca9d..5b6691b85 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 @@ -19,12 +19,10 @@ package com.sk89q.worldedit.world.snapshot; -import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; -import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.DataException; @@ -43,11 +41,11 @@ import java.util.Map; */ public class SnapshotRestore { - private final Map> neededChunks = new LinkedHashMap<>(); + private final Map> neededChunks = new LinkedHashMap<>(); private final ChunkStore chunkStore; private final EditSession editSession; - private ArrayList missingChunks; - private ArrayList errorChunks; + private ArrayList missingChunks; + private ArrayList errorChunks; private String lastErrorMessage; /** @@ -74,15 +72,15 @@ public class SnapshotRestore { * @param region The {@link Region} to iterate */ private void findNeededCuboidChunks(Region region) { - Vector min = region.getMinimumPoint(); - Vector max = region.getMaximumPoint(); + BlockVector3 min = region.getMinimumPoint(); + BlockVector3 max = region.getMaximumPoint(); // 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) { - Vector pos = new Vector(x, y, z); + BlockVector3 pos = new BlockVector3(x, y, z); checkAndAddBlock(pos); } } @@ -97,16 +95,16 @@ public class SnapshotRestore { private void findNeededChunks(Region region) { // First, we need to group points by chunk so that we only need // to keep one chunk in memory at any given moment - for (Vector pos : region) { + for (BlockVector3 pos : region) { checkAndAddBlock(pos); } } - private void checkAndAddBlock(Vector pos) { + private void checkAndAddBlock(BlockVector3 pos) { if (editSession.getMask() != null && !editSession.getMask().test(pos)) return; - BlockVector2D chunkPos = ChunkStore.toChunk(pos); + BlockVector2 chunkPos = ChunkStore.toChunk(pos); // Unidentified chunk if (!neededChunks.containsKey(chunkPos)) { @@ -136,8 +134,8 @@ public class SnapshotRestore { errorChunks = new ArrayList<>(); // Now let's start restoring! - for (Map.Entry> entry : neededChunks.entrySet()) { - BlockVector2D chunkPos = entry.getKey(); + for (Map.Entry> entry : neededChunks.entrySet()) { + BlockVector2 chunkPos = entry.getKey(); Chunk chunk; try { @@ -145,7 +143,7 @@ public class SnapshotRestore { // Good, the chunk could be at least loaded // Now just copy blocks! - for (Vector pos : entry.getValue()) { + for (BlockVector3 pos : entry.getValue()) { try { editSession.setBlock(pos, chunk.getBlock(pos)); } catch (DataException e) { @@ -167,7 +165,7 @@ public class SnapshotRestore { * * @return a list of coordinates */ - public List getMissingChunks() { + public List getMissingChunks() { return missingChunks; } @@ -177,7 +175,7 @@ public class SnapshotRestore { * * @return a list of coordinates */ - public List getErrorChunks() { + public List getErrorChunks() { return errorChunks; } 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 a2d5da198..07a4e06a5 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 @@ -21,9 +21,8 @@ package com.sk89q.worldedit.world.storage; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.chunk.AnvilChunk; @@ -57,11 +56,8 @@ public abstract class ChunkStore implements Closeable { * @param position the position * @return chunk coordinates */ - public static BlockVector2D toChunk(Vector position) { - int chunkX = (int) Math.floor(position.getBlockX() / 16.0); - int chunkZ = (int) Math.floor(position.getBlockZ() / 16.0); - - return new BlockVector2D(chunkX, chunkZ); + public static BlockVector2 toChunk(BlockVector3 position) { + return new BlockVector2(position.getX() >> CHUNK_SHIFTS, position.getZ() >> CHUNK_SHIFTS); } /** @@ -72,7 +68,7 @@ public abstract class ChunkStore implements Closeable { * @throws DataException thrown on data error * @throws IOException thrown on I/O error */ - public abstract CompoundTag getChunkTag(Vector2D position, World world) throws DataException, IOException; + public abstract CompoundTag getChunkTag(BlockVector2 position, World world) throws DataException, IOException; /** * Get a chunk at a location. @@ -83,7 +79,7 @@ public abstract class ChunkStore implements Closeable { * @throws DataException thrown on data error * @throws IOException thrown on I/O error */ - public Chunk getChunk(Vector2D position, World world) throws DataException, IOException { + public Chunk getChunk(BlockVector2 position, World world) throws DataException, IOException { CompoundTag rootTag = getChunkTag(position, world); Map children = rootTag.getValue(); 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 0bdf4c6da..b3b5728fe 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 @@ -22,14 +22,13 @@ package com.sk89q.worldedit.world.storage; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.util.Map; import java.util.zip.GZIPInputStream; /** @@ -46,7 +45,7 @@ public abstract class LegacyChunkStore extends ChunkStore { * @param separator folder separator character * @return pathname */ - public static String getFilename(Vector2D position, String separator) { + public static String getFilename(BlockVector2 position, String separator) { int x = position.getBlockX(); int z = position.getBlockZ(); @@ -65,12 +64,12 @@ public abstract class LegacyChunkStore extends ChunkStore { * @param position chunk position * @return pathname */ - public static String getFilename(Vector2D position) { + public static String getFilename(BlockVector2 position) { return getFilename(position, File.separator); } @Override - public CompoundTag getChunkTag(Vector2D position, World world) throws DataException, IOException { + public CompoundTag getChunkTag(BlockVector2 position, World world) throws DataException, IOException { int x = position.getBlockX(); int z = position.getBlockZ(); 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 7959d8a37..5c4eabfd9 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 @@ -22,13 +22,12 @@ package com.sk89q.worldedit.world.storage; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; import java.io.IOException; import java.io.InputStream; -import java.util.Map; public abstract class McRegionChunkStore extends ChunkStore { @@ -41,14 +40,14 @@ public abstract class McRegionChunkStore extends ChunkStore { * @param position chunk position * @return the filename */ - public static String getFilename(Vector2D position) { + public static String getFilename(BlockVector2 position) { int x = position.getBlockX(); int z = position.getBlockZ(); return "r." + (x >> 5) + "." + (z >> 5) + ".mca"; } - protected McRegionReader getReader(Vector2D pos, String worldname) throws DataException, IOException { + protected McRegionReader getReader(BlockVector2 pos, String worldname) throws DataException, IOException { String filename = getFilename(pos); if (curFilename != null) { if (curFilename.equals(filename)) { @@ -67,7 +66,7 @@ public abstract class McRegionChunkStore extends ChunkStore { } @Override - public CompoundTag getChunkTag(Vector2D position, World world) throws DataException, IOException { + public CompoundTag getChunkTag(BlockVector2 position, World world) throws DataException, IOException { McRegionReader reader = getReader(position, world.getName()); InputStream stream = reader.getChunkInputStream(position); 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 6f4509267..e991216ae 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 @@ -55,7 +55,7 @@ package com.sk89q.worldedit.world.storage; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.util.io.ForwardSeekableInputStream; import com.sk89q.worldedit.world.DataException; @@ -120,7 +120,7 @@ public class McRegionReader { * @throws IOException * @throws DataException */ - public synchronized InputStream getChunkInputStream(Vector2D position) throws IOException, DataException { + public synchronized InputStream getChunkInputStream(BlockVector2 position) throws IOException, DataException { int x = position.getBlockX() & 31; int z = position.getBlockZ() & 31; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/MissingChunkException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/MissingChunkException.java index 0ed5c0554..9d1d7c3a1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/MissingChunkException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/MissingChunkException.java @@ -19,20 +19,20 @@ package com.sk89q.worldedit.world.storage; -import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.Vector2; /** * Thrown if a chunk is missing. */ public class MissingChunkException extends ChunkStoreException { - private Vector2D position; + private Vector2 position; public MissingChunkException() { super(); } - public MissingChunkException(Vector2D position) { + public MissingChunkException(Vector2 position) { super(); this.position = position; } @@ -42,7 +42,7 @@ public class MissingChunkException extends ChunkStoreException { * * @return a chunk position */ - public Vector2D getChunkPosition() { + public Vector2 getChunkPosition() { return position; } diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/VectorTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/VectorTest.java deleted file mode 100644 index 51d50f93b..000000000 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/VectorTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class VectorTest { - @Test - public void collinearityTest() { - assertCollinear(0,0,0, 0,0,0); - - assertCollinear(0,0,0, 1,0,0); - assertCollinear(0,0,0, 0,1,0); - assertCollinear(0,0,0, 0,0,1); - - assertCollinear(1,0,0, 0,0,0); - assertCollinear(0,1,0, 0,0,0); - assertCollinear(0,0,1, 0,0,0); - - assertCollinear(1,0,0, 2,0,0); - assertNotCollinear(1,0,0, 0,1,0); - - assertNotCollinear(2,2,2, 8,4,4); - assertCollinear(8,2,2, 8,2,2); - assertNotCollinear(4,2,4, 4,4,4); - assertNotCollinear(1,1,2, 4,8,2); - assertNotCollinear(4,1,8, 1,4,4); - assertCollinear(2,4,2, 1,2,1); - assertNotCollinear(2,2,4, 1,2,1); - assertNotCollinear(4,4,1, 4,4,4); - assertNotCollinear(4,1,4, 1,8,2); - assertCollinear(8,8,4, 4,4,2); - assertNotCollinear(2,1,8, 1,1,2); - assertNotCollinear(8,1,2, 2,1,2); - assertNotCollinear(4,4,8, 2,2,8); - assertNotCollinear(8,4,8, 1,4,8); - assertNotCollinear(2,2,2, 1,4,2); - assertNotCollinear(1,1,2, 8,8,2); - assertNotCollinear(4,4,8, 8,4,4); - assertNotCollinear(1,8,2, 4,4,4); - assertNotCollinear(8,4,2, 1,2,2); - assertNotCollinear(1,8,2, 8,1,4); - assertNotCollinear(4,8,1, 4,8,8); - assertNotCollinear(8,1,8, 8,8,8); - assertNotCollinear(8,4,1, 4,2,2); - assertNotCollinear(4,8,1, 4,2,1); - assertNotCollinear(8,8,1, 2,4,2); - assertCollinear(8,1,4, 8,1,4); - assertNotCollinear(4,1,1, 2,4,8); - assertNotCollinear(4,2,8, 1,4,1); - assertNotCollinear(1,8,2, 1,8,1); - assertNotCollinear(1,1,2, 4,2,2); - - assertCollinear(0,0, 0,0); - - assertCollinear(0,0, 1,0); - assertCollinear(0,0, 0,1); - assertCollinear(0,0, 0,0); - - assertCollinear(1,0, 0,0); - assertCollinear(0,1, 0,0); - assertCollinear(0,0, 0,0); - - assertCollinear(1,0, 2,0); - assertNotCollinear(1,0, 0,1); - - assertNotCollinear(2,2, 8,4); - assertCollinear(8,2, 8,2); - assertNotCollinear(4,2, 4,4); - assertNotCollinear(1,1, 4,8); - assertNotCollinear(4,1, 1,4); - assertCollinear(2,4, 1,2); - assertNotCollinear(2,2, 1,2); - assertCollinear(4,4, 4,4); - assertNotCollinear(4,1, 1,8); - assertCollinear(8,8, 4,4); - assertNotCollinear(2,1, 1,1); - assertNotCollinear(8,1, 2,1); - assertCollinear(4,4, 2,2); - assertNotCollinear(8,4, 1,4); - assertNotCollinear(2,2, 1,4); - assertCollinear(1,1, 8,8); - assertNotCollinear(4,4, 8,4); - assertNotCollinear(1,8, 4,4); - assertNotCollinear(8,4, 1,2); - assertNotCollinear(1,8, 8,1); - assertCollinear(4,8, 4,8); - assertNotCollinear(8,1, 8,8); - assertCollinear(8,4, 4,2); - assertNotCollinear(4,8, 4,2); - assertNotCollinear(8,8, 2,4); - assertCollinear(8,1, 8,1); - assertNotCollinear(4,1, 2,4); - assertNotCollinear(4,2, 1,4); - assertCollinear(1,8, 1,8); - assertNotCollinear(1,1, 4,2); - } - - private void assertCollinear(double ax, double ay, double az, double bx, double by, double bz) { - final Vector a = new Vector(ax,ay,az); - final Vector b = new Vector(bx,by,bz); - assertTrue(a.isCollinearWith(b)); - assertTrue(b.isCollinearWith(a)); - assertTrue(a.multiply(-1.0).isCollinearWith(b)); - assertTrue(a.isCollinearWith(b.multiply(-1.0))); - } - private void assertNotCollinear(double ax, double ay, double az, double bx, double by, double bz) { - final Vector a = new Vector(ax,ay,az); - final Vector b = new Vector(bx,by,bz); - assertFalse(a.isCollinearWith(b)); - assertFalse(b.isCollinearWith(a)); - assertFalse(a.multiply(-1.0).isCollinearWith(b)); - assertFalse(a.isCollinearWith(b.multiply(-1.0))); - } - - private void assertCollinear(double ax, double az, double bx, double bz) { - final Vector2D a = new Vector2D(ax,az); - final Vector2D b = new Vector2D(bx,bz); - assertTrue(a.isCollinearWith(b)); - assertTrue(b.isCollinearWith(a)); - assertTrue(a.multiply(-1.0).isCollinearWith(b)); - assertTrue(a.isCollinearWith(b.multiply(-1.0))); - } - private void assertNotCollinear(double ax, double az, double bx, double bz) { - final Vector2D a = new Vector2D(ax,az); - final Vector2D b = new Vector2D(bx,bz); - assertFalse(a.isCollinearWith(b)); - assertFalse(b.isCollinearWith(a)); - assertFalse(a.multiply(-1.0).isCollinearWith(b)); - assertFalse(a.isCollinearWith(b.multiply(-1.0))); - } -} 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 b7944d476..d7633c15c 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 @@ -22,7 +22,7 @@ package com.sk89q.worldedit.util; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.World; import org.junit.Test; @@ -54,7 +54,7 @@ public class LocationTest { @Test public void testToVector() throws Exception { World world = mock(World.class); - Vector position = new Vector(1, 1, 1); + Vector3 position = new Vector3(1, 1, 1); Location location = new Location(world, position); assertEquals(position, location.toVector()); } @@ -62,21 +62,21 @@ public class LocationTest { @Test public void testGetX() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector(TEST_VALUE, 0, 0)); + Location location = new Location(world, new Vector3(TEST_VALUE, 0, 0)); assertEquals(TEST_VALUE, location.getX(), EPSILON); } @Test public void testGetBlockX() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector(TEST_VALUE, 0, 0)); + Location location = new Location(world, new Vector3(TEST_VALUE, 0, 0)); assertEquals(TEST_VALUE, location.getBlockX()); } @Test public void testSetX() throws Exception { World world = mock(World.class); - Location location1 = new Location(world, new Vector()); + Location location1 = new Location(world, Vector3.ZERO); Location location2 = location1.setX(TEST_VALUE); assertEquals(0, location1.getX(), EPSILON); assertEquals(TEST_VALUE, location2.getX(), EPSILON); @@ -87,21 +87,21 @@ public class LocationTest { @Test public void testGetY() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector(0, TEST_VALUE, 0)); + Location location = new Location(world, new Vector3(0, TEST_VALUE, 0)); assertEquals(TEST_VALUE, location.getY(), EPSILON); } @Test public void testGetBlockY() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector(0, TEST_VALUE, 0)); + Location location = new Location(world, new Vector3(0, TEST_VALUE, 0)); assertEquals(TEST_VALUE, location.getBlockY()); } @Test public void testSetY() throws Exception { World world = mock(World.class); - Location location1 = new Location(world, new Vector()); + Location location1 = new Location(world, Vector3.ZERO); Location location2 = location1.setY(TEST_VALUE); assertEquals(0, location1.getY(), EPSILON); assertEquals(0, location2.getX(), EPSILON); @@ -112,21 +112,21 @@ public class LocationTest { @Test public void testGetZ() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector(0, 0, TEST_VALUE)); + Location location = new Location(world, new Vector3(0, 0, TEST_VALUE)); assertEquals(TEST_VALUE, location.getZ(), EPSILON); } @Test public void testGetBlockZ() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector(0, 0, TEST_VALUE)); + Location location = new Location(world, new Vector3(0, 0, TEST_VALUE)); assertEquals(TEST_VALUE, location.getBlockZ()); } @Test public void testSetZ() throws Exception { World world = mock(World.class); - Location location1 = new Location(world, new Vector()); + Location location1 = new Location(world, Vector3.ZERO); Location location2 = location1.setZ(TEST_VALUE); assertEquals(0, location1.getZ(), EPSILON); assertEquals(0, location2.getX(), EPSILON); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index 18311a5c5..335ef497d 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -20,7 +20,8 @@ package com.sk89q.worldedit.forge; import com.google.common.collect.ImmutableList; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.registry.state.BooleanProperty; import com.sk89q.worldedit.registry.state.DirectionalProperty; import com.sk89q.worldedit.registry.state.EnumProperty; @@ -49,15 +50,15 @@ final class ForgeAdapter { return new ForgeWorld(world); } - public static Vector adapt(Vec3d vector) { - return new Vector(vector.x, vector.y, vector.z); + public static Vector3 adapt(Vec3d vector) { + return new Vector3(vector.x, vector.y, vector.z); } - public static Vector adapt(BlockPos pos) { - return new Vector(pos.getX(), pos.getY(), pos.getZ()); + public static Vector3 adapt(BlockPos pos) { + return new Vector3(pos.getX(), pos.getY(), pos.getZ()); } - public static Vec3d toVec3(Vector vector) { + public static Vec3d toVec3(BlockVector3 vector) { return new Vec3d(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); } @@ -87,7 +88,7 @@ final class ForgeAdapter { } } - public static BlockPos toBlockPos(Vector vector) { + public static BlockPos toBlockPos(BlockVector3 vector) { return new BlockPos(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java index 54e28c244..94bb3c8a5 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java @@ -21,11 +21,11 @@ package com.sk89q.worldedit.forge; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.metadata.EntityProperties; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.NullWorld; import com.sk89q.worldedit.world.entity.EntityTypes; @@ -66,7 +66,7 @@ class ForgeEntity implements Entity { public Location getLocation() { net.minecraft.entity.Entity entity = entityRef.get(); if (entity != null) { - Vector position = new Vector(entity.posX, entity.posY, entity.posZ); + Vector3 position = new Vector3(entity.posX, entity.posY, entity.posZ); float yaw = entity.rotationYaw; float pitch = entity.rotationPitch; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index 817315e92..a09c472da 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -20,19 +20,20 @@ package com.sk89q.worldedit.forge; import com.sk89q.util.StringUtil; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.internal.cui.CUIEvent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.item.ItemTypes; -import io.netty.buffer.Unpooled; + import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -49,6 +50,8 @@ import java.util.UUID; import javax.annotation.Nullable; +import io.netty.buffer.Unpooled; + public class ForgePlayer extends AbstractPlayerActor { private final EntityPlayerMP player; @@ -81,7 +84,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public Location getLocation() { - Vector position = new Vector(this.player.posX, this.player.posY, this.player.posZ); + Vector3 position = new Vector3(this.player.posX, this.player.posY, this.player.posZ); return new Location( ForgeWorldEdit.inst.getWorld(this.player.world), position, @@ -143,7 +146,7 @@ public class ForgePlayer extends AbstractPlayerActor { } @Override - public void setPosition(Vector pos, float pitch, float yaw) { + public void setPosition(Vector3 pos, float pitch, float yaw) { this.player.connection.setPlayerLocation(pos.getX(), pos.getY(), pos.getZ(), yaw, pitch); } @@ -169,8 +172,8 @@ public class ForgePlayer extends AbstractPlayerActor { } @Override - public void sendFakeBlock(Vector pos, BlockStateHolder block) { - BlockPos loc = new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()); + public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { + BlockPos loc = ForgeAdapter.toBlockPos(pos); if (block == null) { // TODO // player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData()); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index abd4e8151..e579711e9 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -23,18 +23,17 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.io.Files; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.internal.Constants; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.registry.state.Property; @@ -170,7 +169,7 @@ public class ForgeWorld extends AbstractWorld { } @Override - public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { checkNotNull(position); checkNotNull(block); @@ -237,15 +236,15 @@ public class ForgeWorld extends AbstractWorld { } @Override - public int getBlockLightLevel(Vector position) { + public int getBlockLightLevel(BlockVector3 position) { checkNotNull(position); - return getWorld().getLight(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ())); + return getWorld().getLight(ForgeAdapter.toBlockPos(position)); } @Override - public boolean clearContainerBlockContents(Vector position) { + public boolean clearContainerBlockContents(BlockVector3 position) { checkNotNull(position); - TileEntity tile = getWorld().getTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ())); + TileEntity tile = getWorld().getTileEntity(ForgeAdapter.toBlockPos(position)); if ((tile instanceof IInventory)) { IInventory inv = (IInventory) tile; int size = inv.getSizeInventory(); @@ -258,13 +257,13 @@ public class ForgeWorld extends AbstractWorld { } @Override - public BaseBiome getBiome(Vector2D position) { + public BaseBiome getBiome(BlockVector2 position) { checkNotNull(position); return new BaseBiome(Biome.getIdForBiome(getWorld().getBiomeForCoordsBody(new BlockPos(position.getBlockX(), 0, position.getBlockZ())))); } @Override - public boolean setBiome(Vector2D position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BaseBiome biome) { checkNotNull(position); checkNotNull(biome); @@ -278,7 +277,7 @@ public class ForgeWorld extends AbstractWorld { } @Override - public boolean useItem(Vector position, BaseItem item, Direction face) { + public boolean useItem(BlockVector3 position, BaseItem item, Direction face) { Item nativeItem = Item.getByNameOrId(item.getType().getId()); ItemStack stack = null; if (item.getNbtData() == null) { @@ -293,7 +292,7 @@ public class ForgeWorld extends AbstractWorld { } @Override - public void dropItem(Vector position, BaseItemStack item) { + public void dropItem(Vector3 position, BaseItemStack item) { checkNotNull(position); checkNotNull(item); @@ -307,7 +306,7 @@ public class ForgeWorld extends AbstractWorld { } @Override - public void simulateBlockMine(Vector position) { + public void simulateBlockMine(BlockVector3 position) { BlockPos pos = ForgeAdapter.toBlockPos(position); IBlockState state = getWorld().getBlockState(pos); state.getBlock().dropBlockAsItem(getWorld(), pos, state, 0); @@ -338,13 +337,13 @@ public class ForgeWorld extends AbstractWorld { // Pre-gen all the chunks // We need to also pull one more chunk in every direction CuboidRegion expandedPreGen = new CuboidRegion(region.getMinimumPoint().subtract(16, 0, 16), region.getMaximumPoint().add(16, 0, 16)); - for (Vector2D chunk : expandedPreGen.getChunks()) { + for (BlockVector2 chunk : expandedPreGen.getChunks()) { freshWorld.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ()); } ForgeWorld from = new ForgeWorld(freshWorld); try { - for (BlockVector vec : region) { + for (BlockVector3 vec : region) { editSession.setBlock(vec, from.getFullBlock(vec)); } } catch (MaxChangedBlocksException e) { @@ -386,32 +385,32 @@ public class ForgeWorld extends AbstractWorld { } @Override - public boolean generateTree(TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException { + public boolean generateTree(TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException { WorldGenerator generator = createWorldGenerator(type); return generator != null && generator.generate(getWorld(), random, ForgeAdapter.toBlockPos(position)); } @Override - public void checkLoadedChunk(Vector pt) { + public void checkLoadedChunk(BlockVector3 pt) { getWorld().getChunkFromBlockCoords(ForgeAdapter.toBlockPos(pt)); } @Override - public void fixAfterFastMode(Iterable chunks) { + public void fixAfterFastMode(Iterable chunks) { fixLighting(chunks); } @Override - public void fixLighting(Iterable chunks) { + public void fixLighting(Iterable chunks) { World world = getWorld(); - for (BlockVector2D chunk : chunks) { + for (BlockVector2 chunk : chunks) { world.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ()).resetRelightChecks(); } } @Override - public boolean playEffect(Vector position, int type, int data) { - getWorld().playEvent(type, ForgeAdapter.toBlockPos(position), data); + public boolean playEffect(Vector3 position, int type, int data) { + getWorld().playEvent(type, ForgeAdapter.toBlockPos(position.toBlockPoint()), data); return true; } @@ -463,7 +462,7 @@ public class ForgeWorld extends AbstractWorld { } @Override - public BlockState getBlock(Vector position) { + public BlockState getBlock(BlockVector3 position) { World world = getWorld(); BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); IBlockState mcState = world.getBlockState(pos); @@ -487,7 +486,7 @@ public class ForgeWorld extends AbstractWorld { } @Override - public BaseBlock getFullBlock(Vector position) { + public BaseBlock getFullBlock(BlockVector3 position) { BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); TileEntity tile = getWorld().getTileEntity(pos); @@ -523,7 +522,7 @@ public class ForgeWorld extends AbstractWorld { public List getEntities(Region region) { List entities = new ArrayList<>(); for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) { - if (region.contains(new Vector(entity.posX, entity.posY, entity.posZ))) { + if (region.contains(new BlockVector3(entity.posX, entity.posY, entity.posZ))) { entities.add(new ForgeEntity(entity)); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java index f87293db8..4147d835c 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java @@ -21,7 +21,8 @@ package com.sk89q.worldedit.forge; import static com.google.common.base.Preconditions.checkNotNull; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.math.BlockVector3; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; import net.minecraft.tileentity.TileEntity; @@ -47,7 +48,7 @@ final class TileEntityUtils { * @param position the position * @return a tag compound */ - private static NBTTagCompound updateForSet(NBTTagCompound tag, Vector position) { + private static NBTTagCompound updateForSet(NBTTagCompound tag, BlockVector3 position) { checkNotNull(tag); checkNotNull(position); @@ -66,7 +67,7 @@ final class TileEntityUtils { * @param clazz the tile entity class * @param tag the tag for the tile entity (may be null to not set NBT data) */ - static void setTileEntity(World world, Vector position, Class clazz, @Nullable NBTTagCompound tag) { + static void setTileEntity(World world, BlockVector3 position, Class clazz, @Nullable NBTTagCompound tag) { checkNotNull(world); checkNotNull(position); checkNotNull(clazz); @@ -94,7 +95,7 @@ final class TileEntityUtils { * @param position the position * @param tag the tag for the tile entity (may be null to do nothing) */ - static void setTileEntity(World world, Vector position, @Nullable NBTTagCompound tag) { + static void setTileEntity(World world, BlockVector3 position, @Nullable NBTTagCompound tag) { if (tag != null) { updateForSet(tag, position); TileEntity tileEntity = TileEntity.create(world, tag); @@ -113,7 +114,7 @@ final class TileEntityUtils { * @return a tile entity (may be null if it failed) */ @Nullable - static TileEntity constructTileEntity(World world, Vector position, Class clazz) { + static TileEntity constructTileEntity(World world, BlockVector3 position, Class clazz) { Constructor baseConstructor; try { baseConstructor = clazz.getConstructor(); // creates "blank" TE diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java index 662d65e55..fba1c81fc 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java @@ -21,12 +21,13 @@ package com.sk89q.worldedit.sponge; import com.flowpowered.math.vector.Vector3d; import com.sk89q.util.StringUtil; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.internal.cui.CUIEvent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; @@ -34,6 +35,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemTypes; + import org.spongepowered.api.Sponge; import org.spongepowered.api.data.type.HandTypes; import org.spongepowered.api.entity.living.player.Player; @@ -144,7 +146,7 @@ public class SpongePlayer extends AbstractPlayerActor { } @Override - public void setPosition(Vector pos, float pitch, float yaw) { + public void setPosition(Vector3 pos, float pitch, float yaw) { org.spongepowered.api.world.Location loc = new org.spongepowered.api.world.Location<>( this.player.getWorld(), pos.getX(), pos.getY(), pos.getZ() ); @@ -185,7 +187,7 @@ public class SpongePlayer extends AbstractPlayerActor { } @Override - public void sendFakeBlock(Vector pos, BlockStateHolder block) { + public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { org.spongepowered.api.world.Location loc = player.getWorld().getLocation(pos.getX(), pos.getY(), pos.getZ()); if (block == null) { player.sendBlockChange(loc.getBlockPosition(), loc.getBlock()); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index fe3db9e16..b62bee328 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -24,22 +24,24 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.flowpowered.math.vector.Vector3d; import com.flowpowered.math.vector.Vector3i; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.weather.WeatherType; import com.sk89q.worldedit.world.weather.WeatherTypes; + import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockSnapshot; import org.spongepowered.api.block.BlockState; @@ -134,7 +136,7 @@ public abstract class SpongeWorld extends AbstractWorld { private static final BlockSnapshot.Builder builder = BlockSnapshot.builder(); @Override - public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { + public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { checkNotNull(position); checkNotNull(block); @@ -167,7 +169,7 @@ public abstract class SpongeWorld extends AbstractWorld { } @Override - public int getBlockLightLevel(Vector position) { + public int getBlockLightLevel(BlockVector3 position) { checkNotNull(position); BlockState state = getWorld().getBlock(new Vector3i(position.getX(), position.getY(), position.getZ())); @@ -185,13 +187,13 @@ public abstract class SpongeWorld extends AbstractWorld { } @Override - public BaseBiome getBiome(Vector2D position) { + public BaseBiome getBiome(BlockVector2 position) { checkNotNull(position); return new BaseBiome(SpongeWorldEdit.inst().getAdapter().resolve(getWorld().getBiome(position.getBlockX(), 0, position.getBlockZ()))); } @Override - public boolean setBiome(Vector2D position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BaseBiome biome) { checkNotNull(position); checkNotNull(biome); @@ -200,7 +202,7 @@ public abstract class SpongeWorld extends AbstractWorld { } @Override - public void dropItem(Vector position, BaseItemStack item) { + public void dropItem(Vector3 position, BaseItemStack item) { checkNotNull(position); checkNotNull(item); @@ -218,7 +220,7 @@ public abstract class SpongeWorld extends AbstractWorld { } @Override - public void simulateBlockMine(Vector position) { + public void simulateBlockMine(BlockVector3 position) { // TODO } @@ -247,7 +249,7 @@ public abstract class SpongeWorld extends AbstractWorld { List entities = new ArrayList<>(); for (org.spongepowered.api.entity.Entity entity : getWorld().getEntities()) { org.spongepowered.api.world.Location loc = entity.getLocation(); - if (region.contains(new Vector(loc.getX(), loc.getY(), loc.getZ()))) { + if (region.contains(new BlockVector3(loc.getX(), loc.getY(), loc.getZ()))) { entities.add(new SpongeEntity(entity)); } } @@ -279,7 +281,7 @@ public abstract class SpongeWorld extends AbstractWorld { } // Overwrite any data set by the NBT application - Vector dir = location.getDirection(); + Vector3 dir = location.getDirection(); newEnt.setLocationAndRotation( new org.spongepowered.api.world.Location<>(getWorld(), pos), diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java index a134e1ac3..01cc7dfc0 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java @@ -20,11 +20,12 @@ package com.sk89q.worldedit.sponge.adapter; import com.flowpowered.math.vector.Vector3d; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.sponge.SpongeWorld; import com.sk89q.worldedit.util.Location; + import org.spongepowered.api.entity.Entity; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.world.World; @@ -56,7 +57,7 @@ public interface SpongeImplAdapter { } default Location adapt(org.spongepowered.api.world.Location loc, Vector3d rot) { - Vector position = new Vector(loc.getX(), loc.getY(), loc.getZ()); + Vector3 position = new Vector3(loc.getX(), loc.getY(), loc.getZ()); return new Location(getWorld(loc.getExtent()), position, (float) rot.getY(), (float) rot.getX()); } From 2c8b2fe0898c420c5cbd55ad5849c7f99cabb08e Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Fri, 19 Oct 2018 13:13:32 -0700 Subject: [PATCH 035/182] Move vectors to static creators, for caching --- .../sk89q/worldedit/bukkit/BukkitAdapter.java | 4 +- .../sk89q/worldedit/bukkit/BukkitPlayer.java | 2 +- .../sk89q/worldedit/bukkit/BukkitWorld.java | 2 +- .../EditSessionBlockChangeDelegate.java | 6 +- .../main/java/com/sk89q/jnbt/NBTUtils.java | 2 +- .../java/com/sk89q/util/yaml/YAMLNode.java | 10 +-- .../java/com/sk89q/worldedit/EditSession.java | 72 +++++++++---------- .../com/sk89q/worldedit/LocalSession.java | 2 +- .../com/sk89q/worldedit/PlayerDirection.java | 20 +++--- .../worldedit/command/ChunkCommands.java | 2 +- .../worldedit/command/SelectionCommands.java | 24 +++---- .../worldedit/command/tool/AreaPickaxe.java | 2 +- .../command/tool/brush/GravityBrush.java | 4 +- .../extension/factory/DefaultMaskParser.java | 2 +- .../platform/AbstractPlayerActor.java | 26 +++---- .../extent/buffer/ForgetfulExtentBuffer.java | 1 - .../extent/cache/LastAccessExtentCache.java | 1 - .../clipboard/io/MCEditSchematicReader.java | 8 +-- .../clipboard/io/SpongeSchematicReader.java | 8 +-- .../clipboard/io/SpongeSchematicWriter.java | 2 +- .../extent/reorder/ChunkBatchingExtent.java | 2 +- .../extent/world/FastModeExtent.java | 2 +- .../function/entity/ExtentEntityCopy.java | 2 +- .../function/operation/ForwardExtentCopy.java | 1 - .../pattern/RepeatingExtentPattern.java | 2 +- .../function/visitor/BreadthFirstSearch.java | 22 +++--- .../function/visitor/DownwardVisitor.java | 10 +-- .../function/visitor/NonRisingVisitor.java | 10 +-- .../expression/runtime/Functions.java | 6 +- .../sk89q/worldedit/math/BlockVector2.java | 62 +++++++++------- .../sk89q/worldedit/math/BlockVector3.java | 69 ++++++++++-------- .../com/sk89q/worldedit/math/Vector2.java | 61 +++++++++------- .../com/sk89q/worldedit/math/Vector3.java | 68 ++++++++++-------- .../worldedit/math/convolution/HeightMap.java | 12 ++-- .../sk89q/worldedit/math/geom/Polygons.java | 2 +- .../worldedit/math/interpolation/Node.java | 2 +- .../math/transform/AffineTransform.java | 2 +- .../worldedit/regions/AbstractRegion.java | 16 ++--- .../sk89q/worldedit/regions/CuboidRegion.java | 8 +-- .../worldedit/regions/CylinderRegion.java | 4 +- .../worldedit/regions/EllipsoidRegion.java | 6 +- .../worldedit/regions/Polygonal2DRegion.java | 9 ++- .../factory/CylinderRegionFactory.java | 2 +- .../regions/factory/SphereRegionFactory.java | 2 +- .../iterator/FlatRegion3DIterator.java | 2 +- .../regions/iterator/FlatRegionIterator.java | 4 +- .../regions/iterator/RegionIterator.java | 4 +- .../ExtendingCuboidRegionSelector.java | 4 +- .../selector/Polygonal2DRegionSelector.java | 4 +- .../selector/SphereRegionSelector.java | 6 +- .../worldedit/regions/shape/RegionShape.java | 2 +- .../shape/WorldEditExpressionEnvironment.java | 2 +- .../com/sk89q/worldedit/util/Direction.java | 36 +++++----- .../com/sk89q/worldedit/util/Location.java | 8 +-- .../com/sk89q/worldedit/util/TargetBlock.java | 2 +- .../worldedit/util/gson/VectorAdapter.java | 2 +- .../sk89q/worldedit/world/AbstractWorld.java | 4 +- .../worldedit/world/chunk/AnvilChunk.java | 2 +- .../worldedit/world/chunk/AnvilChunk13.java | 2 +- .../sk89q/worldedit/world/chunk/OldChunk.java | 2 +- .../world/snapshot/SnapshotRestore.java | 2 +- .../worldedit/world/storage/ChunkStore.java | 2 +- .../sk89q/worldedit/util/LocationTest.java | 14 ++-- .../sk89q/worldedit/forge/ForgeAdapter.java | 4 +- .../sk89q/worldedit/forge/ForgeEntity.java | 2 +- .../sk89q/worldedit/forge/ForgePlayer.java | 2 +- .../com/sk89q/worldedit/forge/ForgeWorld.java | 2 +- .../sk89q/worldedit/sponge/SpongeWorld.java | 2 +- .../sponge/adapter/SpongeImplAdapter.java | 2 +- 69 files changed, 366 insertions(+), 334 deletions(-) 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 ddb2c2e26..aec800ef3 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 class BukkitAdapter { */ public static Vector3 asVector(org.bukkit.Location location) { checkNotNull(location); - return new Vector3(location.getX(), location.getY(), location.getZ()); + return Vector3.at(location.getX(), location.getY(), location.getZ()); } /** @@ -251,7 +251,7 @@ public class BukkitAdapter { */ public static BlockVector3 asBlockVector(org.bukkit.Location location) { checkNotNull(location); - return new BlockVector3(location.getX(), location.getY(), location.getZ()); + return BlockVector3.at(location.getX(), location.getY(), location.getZ()); } /** 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 d5db5ca53..e08e6b6dc 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 @@ -175,7 +175,7 @@ public class BukkitPlayer extends AbstractPlayerActor { return; } - setPosition(new Vector3(x + 0.5, y, z + 0.5)); + setPosition(Vector3.at(x + 0.5, y, z + 0.5)); player.setFlying(true); } 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 ad1cb83c2..afc6c36de 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 @@ -169,7 +169,7 @@ public class BukkitWorld extends AbstractWorld { BlockStateHolder[] history = new BlockStateHolder[16 * 16 * (getMaxY() + 1)]; for (BlockVector2 chunk : region.getChunks()) { - BlockVector3 min = new BlockVector3(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16); + BlockVector3 min = BlockVector3.at(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16); // First save all the blocks inside for (int x = 0; x < 16; ++x) { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java index 35b3afe50..e0613cd97 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java @@ -40,7 +40,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { @Override public boolean setBlockData(int x, int y, int z, BlockData blockData) { try { - editSession.setBlock(new BlockVector3(x, y, z), BukkitAdapter.adapt(blockData)); + editSession.setBlock(BlockVector3.at(x, y, z), BukkitAdapter.adapt(blockData)); } catch (MaxChangedBlocksException e) { return false; } @@ -49,7 +49,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { @Override public BlockData getBlockData(int x, int y, int z) { - return BukkitAdapter.adapt(editSession.getBlock(new BlockVector3(x, y, z))); + return BukkitAdapter.adapt(editSession.getBlock(BlockVector3.at(x, y, z))); } @Override @@ -59,7 +59,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { @Override public boolean isEmpty(int x, int y, int z) { - return editSession.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir(); + return editSession.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isAir(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java index d0fdaae58..d35626ed9 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java @@ -169,7 +169,7 @@ public final class NBTUtils { */ public static Vector3 toVector(ListTag listTag) { checkNotNull(listTag); - return new Vector3(listTag.asDouble(0), listTag.asDouble(1), listTag.asDouble(2)); + return Vector3.at(listTag.asDouble(0), listTag.asDouble(1), listTag.asDouble(2)); } /** 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 158b72074..e9fd96e16 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 @@ -215,7 +215,7 @@ public class YAMLNode { return null; } - return new Vector3(x, y, z); + return Vector3.at(x, y, z); } /** @@ -239,7 +239,7 @@ public class YAMLNode { return null; } - return new Vector2(x, z); + return Vector2.at(x, z); } /** @@ -571,7 +571,7 @@ public class YAMLNode { continue; } - list.add(new Vector3(x, y, z)); + list.add(Vector3.at(x, y, z)); } return list; @@ -601,7 +601,7 @@ public class YAMLNode { continue; } - list.add(new Vector2(x, z)); + list.add(Vector2.at(x, z)); } return list; @@ -631,7 +631,7 @@ public class YAMLNode { continue; } - list.add(new BlockVector2(x, z)); + list.add(BlockVector2.at(x, z)); } return list; 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 2e896a221..af5ed9c83 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -482,7 +482,7 @@ public class EditSession implements Extent, AutoCloseable { */ public int getHighestTerrainBlock(int x, int z, int minY, int maxY) { for (int y = maxY; y >= minY; --y) { - BlockVector3 pt = new BlockVector3(x, y, z); + BlockVector3 pt = BlockVector3.at(x, y, z); BlockState block = getBlock(pt); if (block.getBlockType().getMaterial().isMovementBlocker()) { return y; @@ -713,7 +713,7 @@ public class EditSession implements Extent, AutoCloseable { checkArgument(depth >= 1, "depth >= 1"); MaskIntersection mask = new MaskIntersection( - new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))), + new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), new BoundedHeightMask( Math.max(origin.getBlockY() - depth + 1, 0), Math.min(getWorld().getMaxY(), origin.getBlockY())), @@ -904,8 +904,8 @@ public class EditSession implements Extent, AutoCloseable { Vector3 center = region.getCenter(); Region centerRegion = new CuboidRegion( getWorld(), // Causes clamping of Y range - new BlockVector3(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())), - new BlockVector3(MathUtils.roundHalfUp(center.getX()), + BlockVector3.at(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())), + BlockVector3.at(MathUtils.roundHalfUp(center.getX()), center.getY(), MathUtils.roundHalfUp(center.getZ()))); return setBlocks(centerRegion, pattern); } @@ -1055,7 +1055,7 @@ public class EditSession implements Extent, AutoCloseable { checkNotNull(pattern); BlockReplace replace = new BlockReplace(this, pattern); - RegionOffset offset = new RegionOffset(new BlockVector3(0, 1, 0), replace); + RegionOffset offset = new RegionOffset(BlockVector3.at(0, 1, 0), replace); GroundFunction ground = new GroundFunction(new ExistingBlockMask(this), offset); LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); Operations.completeLegacy(visitor); @@ -1180,7 +1180,7 @@ public class EditSession implements Extent, AutoCloseable { MaskIntersection mask = new MaskIntersection( new BoundedHeightMask(0, getWorld().getMaxY()), - new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))), + new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), getWorld().createLiquidMask()); BlockReplace replace = new BlockReplace(this, new BlockPattern(BlockTypes.AIR.getDefaultState())); @@ -1220,7 +1220,7 @@ public class EditSession implements Extent, AutoCloseable { // There are boundaries that the routine needs to stay in MaskIntersection mask = new MaskIntersection( new BoundedHeightMask(0, Math.min(origin.getBlockY(), getWorld().getMaxY())), - new RegionMask(new EllipsoidRegion(null, origin, new Vector3(radius, radius, radius))), + new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), blockMask ); @@ -1501,12 +1501,12 @@ public class EditSession implements Extent, AutoCloseable { int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) { - if ((new BlockVector3(x, oy, z)).distanceSq(position) > radiusSq) { + if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) { continue; } for (int y = world.getMaxY(); y >= 1; --y) { - BlockVector3 pt = new BlockVector3(x, y, z); + BlockVector3 pt = BlockVector3.at(x, y, z); BlockType id = getBlock(pt).getBlockType(); if (id == BlockTypes.ICE) { @@ -1551,12 +1551,12 @@ public class EditSession implements Extent, AutoCloseable { int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) { - if ((new BlockVector3(x, oy, z)).distanceSq(position) > radiusSq) { + if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) { continue; } for (int y = world.getMaxY(); y >= 1; --y) { - BlockVector3 pt = new BlockVector3(x, y, z); + BlockVector3 pt = BlockVector3.at(x, y, z); BlockType id = getBlock(pt).getBlockType(); if (id.getMaterial().isAir()) { @@ -1619,12 +1619,12 @@ public class EditSession implements Extent, AutoCloseable { final int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { for (int z = oz - ceilRadius; z <= oz + ceilRadius; ++z) { - if ((new BlockVector3(x, oy, z)).distanceSq(position) > radiusSq) { + if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) { continue; } for (int y = world.getMaxY(); y >= 1; --y) { - final BlockVector3 pt = new BlockVector3(x, y, z); + final BlockVector3 pt = BlockVector3.at(x, y, z); final BlockState block = getBlock(pt); if (block.getBlockType() == BlockTypes.DIRT || @@ -1690,7 +1690,7 @@ public class EditSession implements Extent, AutoCloseable { for (int z = basePosition.getBlockZ() - size; z <= basePosition.getBlockZ() + size; ++z) { // Don't want to be in the ground - if (!getBlock(new BlockVector3(x, basePosition.getBlockY(), z)).getBlockType().getMaterial().isAir()) { + if (!getBlock(BlockVector3.at(x, basePosition.getBlockY(), z)).getBlockType().getMaterial().isAir()) { continue; } // The gods don't want a tree here @@ -1700,13 +1700,13 @@ public class EditSession implements Extent, AutoCloseable { for (int y = basePosition.getBlockY(); y >= basePosition.getBlockY() - 10; --y) { // Check if we hit the ground - BlockType t = getBlock(new BlockVector3(x, y, z)).getBlockType(); + BlockType t = getBlock(BlockVector3.at(x, y, z)).getBlockType(); if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) { - treeType.generate(this, new BlockVector3(x, y + 1, z)); + treeType.generate(this, BlockVector3.at(x, y + 1, z)); ++affected; break; } else if (t == BlockTypes.SNOW) { - setBlock(new BlockVector3(x, y, z), BlockTypes.AIR.getDefaultState()); + setBlock(BlockVector3.at(x, y, z), BlockTypes.AIR.getDefaultState()); } else if (!t.getMaterial().isAir()) { // Trees won't grow on this! break; } @@ -1743,7 +1743,7 @@ public class EditSession implements Extent, AutoCloseable { final ArbitraryShape shape = new ArbitraryShape(region) { @Override protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { - final Vector3 current = new Vector3(x, y, z); + final Vector3 current = Vector3.at(x, y, z); environment.setCurrentBlock(current); final Vector3 scaled = current.subtract(zero).divide(unit); @@ -1834,22 +1834,22 @@ public class EditSession implements Extent, AutoCloseable { for (int x = minX; x <= maxX; ++x) { for (int y = minY; y <= maxY; ++y) { - recurseHollow(region, new BlockVector3(x, y, minZ), outside); - recurseHollow(region, new BlockVector3(x, y, maxZ), outside); + recurseHollow(region, BlockVector3.at(x, y, minZ), outside); + recurseHollow(region, BlockVector3.at(x, y, maxZ), outside); } } for (int y = minY; y <= maxY; ++y) { for (int z = minZ; z <= maxZ; ++z) { - recurseHollow(region, new BlockVector3(minX, y, z), outside); - recurseHollow(region, new BlockVector3(maxX, y, z), outside); + recurseHollow(region, BlockVector3.at(minX, y, z), outside); + recurseHollow(region, BlockVector3.at(maxX, y, z), outside); } } for (int z = minZ; z <= maxZ; ++z) { for (int x = minX; x <= maxX; ++x) { - recurseHollow(region, new BlockVector3(x, minY, z), outside); - recurseHollow(region, new BlockVector3(x, maxY, z), outside); + recurseHollow(region, BlockVector3.at(x, minY, z), outside); + recurseHollow(region, BlockVector3.at(x, maxY, z), outside); } } @@ -1910,7 +1910,7 @@ public class EditSession implements Extent, AutoCloseable { int dx = Math.abs(x2 - x1), dy = Math.abs(y2 - y1), dz = Math.abs(z2 - z1); if (dx + dy + dz == 0) { - vset.add(new BlockVector3(tipx, tipy, tipz)); + vset.add(BlockVector3.at(tipx, tipy, tipz)); notdrawn = false; } @@ -1920,7 +1920,7 @@ public class EditSession implements Extent, AutoCloseable { tipy = (int) Math.round(y1 + domstep * ((double) dy) / ((double) dx) * (y2 - y1 > 0 ? 1 : -1)); tipz = (int) Math.round(z1 + domstep * ((double) dz) / ((double) dx) * (z2 - z1 > 0 ? 1 : -1)); - vset.add(new BlockVector3(tipx, tipy, tipz)); + vset.add(BlockVector3.at(tipx, tipy, tipz)); } notdrawn = false; } @@ -1931,7 +1931,7 @@ public class EditSession implements Extent, AutoCloseable { tipx = (int) Math.round(x1 + domstep * ((double) dx) / ((double) dy) * (x2 - x1 > 0 ? 1 : -1)); tipz = (int) Math.round(z1 + domstep * ((double) dz) / ((double) dy) * (z2 - z1 > 0 ? 1 : -1)); - vset.add(new BlockVector3(tipx, tipy, tipz)); + vset.add(BlockVector3.at(tipx, tipy, tipz)); } notdrawn = false; } @@ -1942,7 +1942,7 @@ public class EditSession implements Extent, AutoCloseable { tipy = (int) Math.round(y1 + domstep * ((double) dy) / ((double) dz) * (y2-y1>0 ? 1 : -1)); tipx = (int) Math.round(x1 + domstep * ((double) dx) / ((double) dz) * (x2-x1>0 ? 1 : -1)); - vset.add(new BlockVector3(tipx, tipy, tipz)); + vset.add(BlockVector3.at(tipx, tipy, tipz)); } notdrawn = false; } @@ -2019,7 +2019,7 @@ public class EditSession implements Extent, AutoCloseable { for (int loopy = tipy - ceilrad; loopy <= tipy + ceilrad; loopy++) { for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) { if (hypot(loopx - tipx, loopy - tipy, loopz - tipz) <= radius) { - returnset.add(new BlockVector3(loopx, loopy, loopz)); + returnset.add(BlockVector3.at(loopx, loopy, loopz)); } } } @@ -2032,12 +2032,12 @@ public class EditSession implements Extent, AutoCloseable { Set returnset = new HashSet<>(); for (BlockVector3 v : vset) { double x = v.getX(), y = v.getY(), z = v.getZ(); - if (!(vset.contains(new BlockVector3(x + 1, y, z)) && - vset.contains(new BlockVector3(x - 1, y, z)) && - vset.contains(new BlockVector3(x, y + 1, z)) && - vset.contains(new BlockVector3(x, y - 1, z)) && - vset.contains(new BlockVector3(x, y, z + 1)) && - vset.contains(new BlockVector3(x, y, z - 1)))) { + if (!(vset.contains(BlockVector3.at(x + 1, y, z)) && + vset.contains(BlockVector3.at(x - 1, y, z)) && + vset.contains(BlockVector3.at(x, y + 1, z)) && + vset.contains(BlockVector3.at(x, y - 1, z)) && + vset.contains(BlockVector3.at(x, y, z + 1)) && + vset.contains(BlockVector3.at(x, y, z - 1)))) { returnset.add(v); } } @@ -2083,7 +2083,7 @@ public class EditSession implements Extent, AutoCloseable { final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) { @Override protected BaseBiome getBiome(int x, int z, BaseBiome defaultBiomeType) { - final Vector2 current = new Vector2(x, z); + final Vector2 current = Vector2.at(x, z); environment.setCurrentBlock(current.toVector3(0)); final Vector2 scaled = current.subtract(zero2D).divide(unit2D); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 567488fbe..ee1c038fe 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -662,7 +662,7 @@ public class LocalSession { if (block != null) { // If it's null, we don't need to do anything. The old was already removed. Map tags = block.getNbtData().getValue(); - cuiTemporaryBlock = new BlockVector3( + cuiTemporaryBlock = BlockVector3.at( ((IntTag) tags.get("x")).getValue(), ((IntTag) tags.get("y")).getValue(), ((IntTag) tags.get("z")).getValue() diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java index 39a7c0409..c751ffbbb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java @@ -29,16 +29,16 @@ import com.sk89q.worldedit.util.Direction; */ public enum PlayerDirection { - NORTH(new Vector3(0, 0, -1), true), - NORTH_EAST((new Vector3(1, 0, -1)).normalize(), false), - EAST(new Vector3(1, 0, 0), true), - SOUTH_EAST((new Vector3(1, 0, 1)).normalize(), false), - SOUTH(new Vector3(0, 0, 1), true), - SOUTH_WEST((new Vector3(-1, 0, 1)).normalize(), false), - WEST(new Vector3(-1, 0, 0), true), - NORTH_WEST((new Vector3(-1, 0, -1)).normalize(), false), - UP(new Vector3(0, 1, 0), true), - DOWN(new Vector3(0, -1, 0), true); + NORTH(Vector3.at(0, 0, -1), true), + NORTH_EAST((Vector3.at(1, 0, -1)).normalize(), false), + EAST(Vector3.at(1, 0, 0), true), + SOUTH_EAST((Vector3.at(1, 0, 1)).normalize(), false), + SOUTH(Vector3.at(0, 0, 1), true), + SOUTH_WEST((Vector3.at(-1, 0, 1)).normalize(), false), + WEST(Vector3.at(-1, 0, 0), true), + NORTH_WEST((Vector3.at(-1, 0, -1)).normalize(), false), + UP(Vector3.at(0, 1, 0), true), + DOWN(Vector3.at(0, -1, 0), true); private final Vector3 dir; private final boolean isOrthogonal; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java index d213184f3..39ee0969e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java @@ -76,7 +76,7 @@ public class ChunkCommands { player.print("Chunk: " + chunkX + ", " + chunkZ); player.print("Old format: " + folder1 + "/" + folder2 + "/" + filename); player.print("McRegion: region/" + McRegionChunkStore.getFilename( - new BlockVector2(chunkX, chunkZ))); + BlockVector2.at(chunkX, chunkZ))); } @Command( 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 d5c8aaa75..4db29ef67 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 @@ -224,8 +224,8 @@ public class SelectionCommands { final BlockVector2 min2D = ChunkStore.toChunk(region.getMinimumPoint()); final BlockVector2 max2D = ChunkStore.toChunk(region.getMaximumPoint()); - min = new BlockVector3(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); - max = new BlockVector3(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15); + min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); + max = BlockVector3.at(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15); player.print("Chunks selected: (" + min2D.getBlockX() + ", " + min2D.getBlockZ() + ") - (" @@ -240,14 +240,14 @@ public class SelectionCommands { } int x = Integer.parseInt(coords[0]); int z = Integer.parseInt(coords[1]); - BlockVector2 pos = new BlockVector2(x, z); + BlockVector2 pos = BlockVector2.at(x, z); min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toBlockVector3()); } else { // use player loc min2D = ChunkStore.toChunk(player.getBlockIn().toVector().toBlockPoint()); } - min = new BlockVector3(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); + min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); max = min.add(15, world.getMaxY(), 15); player.print("Chunk selected: " @@ -320,8 +320,8 @@ public class SelectionCommands { try { int oldSize = region.getArea(); region.expand( - new BlockVector3(0, (player.getWorld().getMaxY() + 1), 0), - new BlockVector3(0, -(player.getWorld().getMaxY() + 1), 0)); + BlockVector3.at(0, (player.getWorld().getMaxY() + 1), 0), + BlockVector3.at(0, -(player.getWorld().getMaxY() + 1), 0)); session.getRegionSelector(player.getWorld()).learnChanges(); int newSize = region.getArea(); session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session); @@ -564,15 +564,15 @@ public class SelectionCommands { int change = args.getInteger(0); if (!args.hasFlag('h')) { - changes.add((new BlockVector3(0, 1, 0)).multiply(change)); - changes.add((new BlockVector3(0, -1, 0)).multiply(change)); + changes.add((BlockVector3.at(0, 1, 0)).multiply(change)); + changes.add((BlockVector3.at(0, -1, 0)).multiply(change)); } if (!args.hasFlag('v')) { - changes.add((new BlockVector3(1, 0, 0)).multiply(change)); - changes.add((new BlockVector3(-1, 0, 0)).multiply(change)); - changes.add((new BlockVector3(0, 0, 1)).multiply(change)); - changes.add((new BlockVector3(0, 0, -1)).multiply(change)); + changes.add((BlockVector3.at(1, 0, 0)).multiply(change)); + changes.add((BlockVector3.at(-1, 0, 0)).multiply(change)); + changes.add((BlockVector3.at(0, 0, 1)).multiply(change)); + changes.add((BlockVector3.at(0, 0, -1)).multiply(change)); } return changes.toArray(new BlockVector3[0]); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java index 58405c6b5..35b3a0c3e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java @@ -69,7 +69,7 @@ public class AreaPickaxe implements BlockTool { for (int x = ox - range; x <= ox + range; ++x) { for (int y = oy - range; y <= oy + range; ++y) { for (int z = oz - range; z <= oz + range; ++z) { - BlockVector3 pos = new BlockVector3(x, y, z); + BlockVector3 pos = BlockVector3.at(x, y, z); if (editSession.getBlock(pos).getBlockType() != initialType) { continue; } 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 5ae29bec7..d94f182f0 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 @@ -46,14 +46,14 @@ public class GravityBrush implements Brush { double y = startY; final List blockTypes = new ArrayList<>(); for (; y > position.getBlockY() - size; --y) { - final BlockVector3 pt = new BlockVector3(x, y, z); + final BlockVector3 pt = BlockVector3.at(x, y, z); final BlockStateHolder block = editSession.getBlock(pt); if (!block.getBlockType().getMaterial().isAir()) { blockTypes.add(block); editSession.setBlock(pt, BlockTypes.AIR.getDefaultState()); } } - BlockVector3 pt = new BlockVector3(x, y, z); + BlockVector3 pt = BlockVector3.at(x, y, z); Collections.reverse(blockTypes); for (int i = 0; i < blockTypes.size();) { if (editSession.getBlock(pt).getBlockType().getMaterial().isAir()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java index 5f9c9b806..9fe9844ef 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java @@ -135,7 +135,7 @@ class DefaultMaskParser extends InputParser { } else { submask = new ExistingBlockMask(extent); } - OffsetMask offsetMask = new OffsetMask(submask, new BlockVector3(0, firstChar == '>' ? -1 : 1, 0)); + OffsetMask offsetMask = new OffsetMask(submask, BlockVector3.at(0, firstChar == '>' ? -1 : 1, 0)); return new MaskIntersection(offsetMask, Masks.negate(submask)); case '$': 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 fabfe0662..36089755d 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 @@ -106,7 +106,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte free = 0; while (y <= world.getMaximumPoint().getBlockY() + 2) { - if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -114,7 +114,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { if (free == 2) { if (y - 1 != origY) { - setPosition(new Vector3(x + 0.5, y - 2 + 1, z + 0.5)); + setPosition(Vector3.at(x + 0.5, y - 2 + 1, z + 0.5)); } return; @@ -132,10 +132,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { int z = searchPos.getBlockZ(); while (y >= 0) { - final BlockVector3 pos = new BlockVector3(x, y, z); + final BlockVector3 pos = BlockVector3.at(x, y, z); final BlockState id = world.getBlock(pos); if (id.getBlockType().getMaterial().isMovementBlocker()) { - setPosition(new Vector3(x + 0.5, y + 1, z + 0.5)); + setPosition(Vector3.at(x + 0.5, y + 1, z + 0.5)); return; } @@ -160,7 +160,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte spots = 0; while (y <= world.getMaximumPoint().getY() + 2) { - if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -169,7 +169,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { if (free == 2) { ++spots; if (spots == 2) { - final BlockVector3 platform = new BlockVector3(x, y - 2, z); + final BlockVector3 platform = BlockVector3.at(x, y - 2, z); final BlockStateHolder block = world.getBlock(platform); final com.sk89q.worldedit.world.block.BlockType type = block.getBlockType(); @@ -200,7 +200,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte free = 0; while (y >= 1) { - if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -211,7 +211,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { // lightly and also check to see if there's something to // stand upon while (y >= 0) { - final BlockVector3 platform = new BlockVector3(x, y, z); + final BlockVector3 platform = BlockVector3.at(x, y, z); final BlockStateHolder block = world.getBlock(platform); final BlockType type = block.getBlockType(); @@ -249,13 +249,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { Extent world = getLocation().getExtent(); // No free space above - if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir()) { + if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isAir()) { return false; } while (y <= world.getMaximumPoint().getY()) { // Found a ceiling! - if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { int platformY = Math.max(initialY, y - 3 - clearance); floatAt(x, platformY + 1, z, alwaysGlass); return true; @@ -283,7 +283,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { final Extent world = getLocation().getExtent(); while (y <= world.getMaximumPoint().getY() + 2) { - if (world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { break; // Hit something } else if (y > maxY + 1) { break; @@ -301,14 +301,14 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public void floatAt(int x, int y, int z, boolean alwaysGlass) { try { - BlockVector3 spot = new BlockVector3(x, y - 1, z); + BlockVector3 spot = BlockVector3.at(x, y - 1, z); if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) { getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState()); } } catch (WorldEditException e) { e.printStackTrace(); } - setPosition(new Vector3(x + 0.5, y, z + 0.5)); + setPosition(Vector3.at(x + 0.5, y, z + 0.5)); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java index ebb5afea5..e3451655a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java @@ -28,7 +28,6 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.AbstractRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java index 4fdb6e430..8a582db16 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit.extent.cache; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.block.BlockState; /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index f278595a0..27e9a1d2c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -116,12 +116,12 @@ public class MCEditSchematicReader extends NBTSchematicReader { int originX = requireTag(schematic, "WEOriginX", IntTag.class).getValue(); int originY = requireTag(schematic, "WEOriginY", IntTag.class).getValue(); int originZ = requireTag(schematic, "WEOriginZ", IntTag.class).getValue(); - BlockVector3 min = new BlockVector3(originX, originY, originZ); + BlockVector3 min = BlockVector3.at(originX, originY, originZ); int offsetX = requireTag(schematic, "WEOffsetX", IntTag.class).getValue(); int offsetY = requireTag(schematic, "WEOffsetY", IntTag.class).getValue(); int offsetZ = requireTag(schematic, "WEOffsetZ", IntTag.class).getValue(); - BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ); + BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ); origin = min.subtract(offset); region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); @@ -205,7 +205,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { } } - BlockVector3 vec = new BlockVector3(x, y, z); + BlockVector3 vec = BlockVector3.at(x, y, z); tileEntitiesMap.put(vec, values); } @@ -219,7 +219,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { for (int y = 0; y < height; ++y) { for (int z = 0; z < length; ++z) { int index = y * width * length + z * width + x; - BlockVector3 pt = new BlockVector3(x, y, z); + BlockVector3 pt = BlockVector3.at(x, y, z); BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(blocks[index], blockData[index]); try { 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 b9c582bad..42dfea813 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 @@ -109,14 +109,14 @@ public class SpongeSchematicReader extends NBTSchematicReader { throw new IOException("Invalid offset specified in schematic."); } - BlockVector3 min = new BlockVector3(offsetParts[0], offsetParts[1], offsetParts[2]); + BlockVector3 min = BlockVector3.at(offsetParts[0], offsetParts[1], offsetParts[2]); if (metadata.containsKey("WEOffsetX")) { // We appear to have WorldEdit Metadata int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue(); int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue(); int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue(); - BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ); + BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ); origin = min.subtract(offset); region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); } else { @@ -159,7 +159,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { for (Map tileEntity : tileEntityTags) { int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); - tileEntitiesMap.put(new BlockVector3(pos[0], pos[1], pos[2]), tileEntity); + tileEntitiesMap.put(BlockVector3.at(pos[0], pos[1], pos[2]), tileEntity); } } catch (Exception e) { throw new IOException("Failed to load Tile Entities: " + e.getMessage()); @@ -192,7 +192,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { int z = (index % (width * length)) / width; int x = (index % (width * length)) % width; BlockState state = palette.get(value); - BlockVector3 pt = new BlockVector3(x, y, z); + BlockVector3 pt = BlockVector3.at(x, y, z); try { if (tileEntitiesMap.containsKey(pt)) { Map values = Maps.newHashMap(tileEntitiesMap.get(pt)); 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 629eb22ba..8237106f6 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 @@ -126,7 +126,7 @@ public class SpongeSchematicWriter implements ClipboardWriter { int z0 = min.getBlockZ() + z; for (int x = 0; x < width; x++) { int x0 = min.getBlockX() + x; - BlockVector3 point = new BlockVector3(x0, y0, z0); + BlockVector3 point = BlockVector3.at(x0, y0, z0); BaseBlock block = clipboard.getFullBlock(point); if (block.getNbtData() != null) { Map values = new HashMap<>(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index 92a3b6188..9c9947729 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -77,7 +77,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { if (!enabled) { return getExtent().setBlock(location, block); } - BlockVector2 chunkPos = new BlockVector2(location.getBlockX() >> 4, location.getBlockZ() >> 4); + BlockVector2 chunkPos = BlockVector2.at(location.getBlockX() >> 4, location.getBlockZ() >> 4); batches.computeIfAbsent(chunkPos, k -> new LocatedBlockList()).add(location, block); return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index 7914762b5..b75156d3b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -86,7 +86,7 @@ public class FastModeExtent extends AbstractDelegateExtent { @Override public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (enabled) { - dirtyChunks.add(new BlockVector2(location.getBlockX() >> 4, location.getBlockZ() >> 4)); + dirtyChunks.add(BlockVector2.at(location.getBlockX() >> 4, location.getBlockZ() >> 4)); return world.setBlock(location, block, false); } else { return world.setBlock(location, block, true); 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 af33fecbf..7205c1212 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 @@ -135,7 +135,7 @@ public class ExtentEntityCopy implements EntityFunction { boolean hasFacing = tag.containsKey("Facing"); if (hasTilePosition) { - Vector3 tilePosition = new Vector3(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); + Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint(); CompoundTagBuilder builder = tag.createBuilder() 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 77037c7df..b3f663836 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 @@ -37,7 +37,6 @@ import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.visitor.EntityVisitor; import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Identity; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.regions.Region; 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 54434f1b0..439f2923c 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 @@ -89,7 +89,7 @@ public class RepeatingExtentPattern extends AbstractPattern { int x = base.getBlockX() % size.getBlockX(); int y = base.getBlockY() % size.getBlockY(); int z = base.getBlockZ() % size.getBlockZ(); - return extent.getFullBlock(new BlockVector3(x, y, z)); + return extent.getFullBlock(BlockVector3.at(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 c1ff8e53b..f7260491e 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 @@ -71,7 +71,7 @@ public abstract class BreadthFirstSearch implements Operation { *

Directions are {@link BlockVector3}s that determine * what adjacent points area available. Vectors should not be * unit vectors. An example of a valid direction is - * {@code new BlockVector3(1, 0, 1)}.

+ * {@code BlockVector3.at(1, 0, 1)}.

* *

The list of directions can be cleared.

* @@ -85,22 +85,22 @@ public abstract class BreadthFirstSearch implements Operation { * Add the directions along the axes as directions to visit. */ protected void addAxes() { - directions.add(new BlockVector3(0, -1, 0)); - directions.add(new BlockVector3(0, 1, 0)); - directions.add(new BlockVector3(-1, 0, 0)); - directions.add(new BlockVector3(1, 0, 0)); - directions.add(new BlockVector3(0, 0, -1)); - directions.add(new BlockVector3(0, 0, 1)); + directions.add(BlockVector3.at(0, -1, 0)); + directions.add(BlockVector3.at(0, 1, 0)); + directions.add(BlockVector3.at(-1, 0, 0)); + directions.add(BlockVector3.at(1, 0, 0)); + directions.add(BlockVector3.at(0, 0, -1)); + directions.add(BlockVector3.at(0, 0, 1)); } /** * Add the diagonal directions as directions to visit. */ protected void addDiagonal() { - directions.add(new BlockVector3(1, 0, 1)); - directions.add(new BlockVector3(-1, 0, -1)); - directions.add(new BlockVector3(1, 0, -1)); - directions.add(new BlockVector3(-1, 0, 1)); + directions.add(BlockVector3.at(1, 0, 1)); + directions.add(BlockVector3.at(-1, 0, -1)); + directions.add(BlockVector3.at(1, 0, -1)); + directions.add(BlockVector3.at(-1, 0, 1)); } /** 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 62363a205..6c1740ce5 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 @@ -53,11 +53,11 @@ public class DownwardVisitor extends RecursiveVisitor { Collection directions = getDirections(); directions.clear(); - directions.add(new BlockVector3(1, 0, 0)); - directions.add(new BlockVector3(-1, 0, 0)); - directions.add(new BlockVector3(0, 0, 1)); - directions.add(new BlockVector3(0, 0, -1)); - directions.add(new BlockVector3(0, -1, 0)); + directions.add(BlockVector3.at(1, 0, 0)); + directions.add(BlockVector3.at(-1, 0, 0)); + directions.add(BlockVector3.at(0, 0, 1)); + directions.add(BlockVector3.at(0, 0, -1)); + directions.add(BlockVector3.at(0, -1, 0)); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java index 21aa8b6f6..fd25108c9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java @@ -40,11 +40,11 @@ public class NonRisingVisitor extends RecursiveVisitor { super(mask, function); Collection directions = getDirections(); directions.clear(); - directions.add(new BlockVector3(1, 0, 0)); - directions.add(new BlockVector3(-1, 0, 0)); - directions.add(new BlockVector3(0, 0, 1)); - directions.add(new BlockVector3(0, 0, -1)); - directions.add(new BlockVector3(0, -1, 0)); + directions.add(BlockVector3.at(1, 0, 0)); + directions.add(BlockVector3.at(-1, 0, 0)); + directions.add(BlockVector3.at(0, 0, 1)); + directions.add(BlockVector3.at(0, 0, -1)); + directions.add(BlockVector3.at(0, -1, 0)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java index 9f7eaceb1..d2aede416 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java @@ -392,7 +392,7 @@ public final class Functions { } catch (IllegalArgumentException e) { throw new EvaluationException(0, "Perlin noise error: " + e.getMessage()); } - return perlin.noise(new Vector3(x.getValue(), y.getValue(), z.getValue())); + return perlin.noise(Vector3.at(x.getValue(), y.getValue(), z.getValue())); } private static final ThreadLocal localVoronoi = ThreadLocal.withInitial(VoronoiNoise::new); @@ -405,7 +405,7 @@ public final class Functions { } catch (IllegalArgumentException e) { throw new EvaluationException(0, "Voronoi error: " + e.getMessage()); } - return voronoi.noise(new Vector3(x.getValue(), y.getValue(), z.getValue())); + return voronoi.noise(Vector3.at(x.getValue(), y.getValue(), z.getValue())); } private static final ThreadLocal localRidgedMulti = ThreadLocal.withInitial(RidgedMultiFractalNoise::new); @@ -419,7 +419,7 @@ public final class Functions { } catch (IllegalArgumentException e) { throw new EvaluationException(0, "Ridged multi error: " + e.getMessage()); } - return ridgedMulti.noise(new Vector3(x.getValue(), y.getValue(), z.getValue())); + return ridgedMulti.noise(Vector3.at(x.getValue(), y.getValue(), z.getValue())); } private static double queryInternal(RValue type, RValue data, double typeId, double dataValue) throws EvaluationException { 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 864e8c19c..5924899e5 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 @@ -55,6 +55,26 @@ public final class BlockVector2 { .result(); }; + public static BlockVector2 at(double x, double z) { + return at((int) Math.floor(x), (int) Math.floor(z)); + } + + public static BlockVector2 at(int x, int z) { + switch (x) { + case 0: + if (z == 0) { + return ZERO; + } + break; + case 1: + if (z == 1) { + return ONE; + } + break; + } + return new BlockVector2(x, z); + } + private final int x, z; /** @@ -63,17 +83,7 @@ public final class BlockVector2 { * @param x the X coordinate * @param z the Z coordinate */ - public BlockVector2(double x, double z) { - this((int) Math.floor(x), (int) Math.floor(z)); - } - - /** - * Construct an instance. - * - * @param x the X coordinate - * @param z the Z coordinate - */ - public BlockVector2(int x, int z) { + private BlockVector2(int x, int z) { this.x = x; this.z = z; } @@ -103,7 +113,7 @@ public final class BlockVector2 { * @return a new vector */ public BlockVector2 withX(int x) { - return new BlockVector2(x, z); + return BlockVector2.at(x, z); } /** @@ -131,7 +141,7 @@ public final class BlockVector2 { * @return a new vector */ public BlockVector2 withZ(int z) { - return new BlockVector2(x, z); + return BlockVector2.at(x, z); } /** @@ -152,7 +162,7 @@ public final class BlockVector2 { * @return a new vector */ public BlockVector2 add(int x, int z) { - return new BlockVector2(this.x + x, this.z + z); + return BlockVector2.at(this.x + x, this.z + z); } /** @@ -170,7 +180,7 @@ public final class BlockVector2 { newZ += other.z; } - return new BlockVector2(newX, newZ); + return BlockVector2.at(newX, newZ); } /** @@ -193,7 +203,7 @@ public final class BlockVector2 { * @return a new vector */ public BlockVector2 subtract(int x, int z) { - return new BlockVector2(this.x - x, this.z - z); + return BlockVector2.at(this.x - x, this.z - z); } /** @@ -211,7 +221,7 @@ public final class BlockVector2 { newZ -= other.z; } - return new BlockVector2(newX, newZ); + return BlockVector2.at(newX, newZ); } /** @@ -232,7 +242,7 @@ public final class BlockVector2 { * @return a new vector */ public BlockVector2 multiply(int x, int z) { - return new BlockVector2(this.x * x, this.z * z); + return BlockVector2.at(this.x * x, this.z * z); } /** @@ -249,7 +259,7 @@ public final class BlockVector2 { newZ *= other.z; } - return new BlockVector2(newX, newZ); + return BlockVector2.at(newX, newZ); } /** @@ -280,7 +290,7 @@ public final class BlockVector2 { * @return a new vector */ public BlockVector2 divide(int x, int z) { - return new BlockVector2(this.x / x, this.z / z); + return BlockVector2.at(this.x / x, this.z / z); } /** @@ -343,7 +353,7 @@ public final class BlockVector2 { double len = length(); double x = this.x / len; double z = this.z / len; - return new BlockVector2(x, z); + return BlockVector2.at(x, z); } /** @@ -407,7 +417,7 @@ public final class BlockVector2 { * @return a new vector */ public BlockVector2 abs() { - return new BlockVector2(Math.abs(x), Math.abs(z)); + return BlockVector2.at(Math.abs(x), Math.abs(z)); } /** @@ -429,7 +439,7 @@ public final class BlockVector2 { double sin = Math.sin(angle); double x2 = x * cos - z * sin; double z2 = x * sin + z * cos; - return new BlockVector2( + return BlockVector2.at( x2 + aboutX + translateX, z2 + aboutZ + translateZ); } @@ -461,7 +471,7 @@ public final class BlockVector2 { } public Vector2 toVector2() { - return new Vector2(x, z); + return Vector2.at(x, z); } /** @@ -480,7 +490,7 @@ public final class BlockVector2 { * @return a new vector */ public Vector3 toVector3(double y) { - return new Vector3(x, y, z); + return Vector3.at(x, y, z); } /** @@ -499,7 +509,7 @@ public final class BlockVector2 { * @return a new vector */ public BlockVector3 toBlockVector3(int y) { - return new BlockVector3(x, y, z); + return BlockVector3.at(x, y, z); } @Override 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 efe56e8af..db545c716 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 @@ -37,6 +37,28 @@ public final class BlockVector3 { public static final BlockVector3 UNIT_Z = new BlockVector3(0, 0, 1); public static final BlockVector3 ONE = new BlockVector3(1, 1, 1); + public static BlockVector3 at(double x, double y, double z) { + return at((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z)); + } + + public static BlockVector3 at(int x, int y, int z) { + // switch for efficiency on typical cases + // in MC y is rarely 0/1 on selections + switch (y) { + case 0: + if (x == 0 && z == 0) { + return ZERO; + } + break; + case 1: + if (x == 1 && z == 1) { + return ONE; + } + break; + } + return new BlockVector3(x, y, z); + } + // thread-safe initialization idiom private static final class YzxOrderComparator { private static final Comparator YZX_ORDER = (a, b) -> { @@ -67,18 +89,7 @@ public final class BlockVector3 { * @param y the Y coordinate * @param z the Z coordinate */ - public BlockVector3(double x, double y, double z) { - this((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z)); - } - - /** - * Construct an instance. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public BlockVector3(int x, int y, int z) { + private BlockVector3(int x, int y, int z) { this.x = x; this.y = y; this.z = z; @@ -109,7 +120,7 @@ public final class BlockVector3 { * @return a new vector */ public BlockVector3 withX(int x) { - return new BlockVector3(x, y, z); + return BlockVector3.at(x, y, z); } /** @@ -137,7 +148,7 @@ public final class BlockVector3 { * @return a new vector */ public BlockVector3 withY(int y) { - return new BlockVector3(x, y, z); + return BlockVector3.at(x, y, z); } /** @@ -165,7 +176,7 @@ public final class BlockVector3 { * @return a new vector */ public BlockVector3 withZ(int z) { - return new BlockVector3(x, y, z); + return BlockVector3.at(x, y, z); } /** @@ -187,7 +198,7 @@ public final class BlockVector3 { * @return a new vector */ public BlockVector3 add(int x, int y, int z) { - return new BlockVector3(this.x + x, this.y + y, this.z + z); + return BlockVector3.at(this.x + x, this.y + y, this.z + z); } /** @@ -206,7 +217,7 @@ public final class BlockVector3 { newZ += other.z; } - return new BlockVector3(newX, newY, newZ); + return BlockVector3.at(newX, newY, newZ); } /** @@ -230,7 +241,7 @@ public final class BlockVector3 { * @return a new vector */ public BlockVector3 subtract(int x, int y, int z) { - return new BlockVector3(this.x - x, this.y - y, this.z - z); + return BlockVector3.at(this.x - x, this.y - y, this.z - z); } /** @@ -249,7 +260,7 @@ public final class BlockVector3 { newZ -= other.z; } - return new BlockVector3(newX, newY, newZ); + return BlockVector3.at(newX, newY, newZ); } /** @@ -271,7 +282,7 @@ public final class BlockVector3 { * @return a new vector */ public BlockVector3 multiply(int x, int y, int z) { - return new BlockVector3(this.x * x, this.y * y, this.z * z); + return BlockVector3.at(this.x * x, this.y * y, this.z * z); } /** @@ -289,7 +300,7 @@ public final class BlockVector3 { newZ *= other.z; } - return new BlockVector3(newX, newY, newZ); + return BlockVector3.at(newX, newY, newZ); } /** @@ -321,7 +332,7 @@ public final class BlockVector3 { * @return a new vector */ public BlockVector3 divide(int x, int y, int z) { - return new BlockVector3(this.x / x, this.y / y, this.z / z); + return BlockVector3.at(this.x / x, this.y / y, this.z / z); } /** @@ -386,7 +397,7 @@ public final class BlockVector3 { double x = this.x / len; double y = this.y / len; double z = this.z / len; - return new BlockVector3(x, y, z); + return BlockVector3.at(x, y, z); } /** @@ -434,10 +445,10 @@ public final class BlockVector3 { public BlockVector3 clampY(int min, int max) { checkArgument(min <= max, "minimum cannot be greater than maximum"); if (y < min) { - return new BlockVector3(x, min, z); + return BlockVector3.at(x, min, z); } if (y > max) { - return new BlockVector3(x, max, z); + return BlockVector3.at(x, max, z); } return this; } @@ -481,7 +492,7 @@ public final class BlockVector3 { * @return a new vector */ public BlockVector3 abs() { - return new BlockVector3(Math.abs(x), Math.abs(y), Math.abs(z)); + return BlockVector3.at(Math.abs(x), Math.abs(y), Math.abs(z)); } /** @@ -504,7 +515,7 @@ public final class BlockVector3 { double x2 = x * cos - z * sin; double z2 = x * sin + z * cos; - return new BlockVector3( + return BlockVector3.at( x2 + aboutX + translateX, y, z2 + aboutZ + translateZ @@ -579,11 +590,11 @@ public final class BlockVector3 { * @return a new {@link BlockVector2} */ public BlockVector2 toBlockVector2() { - return new BlockVector2(x, z); + return BlockVector2.at(x, z); } public Vector3 toVector3() { - return new Vector3(x, y, z); + return Vector3.at(x, y, z); } @Override 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 e403cc5ea..5960e74f7 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 @@ -25,12 +25,29 @@ import com.sk89q.worldedit.math.transform.AffineTransform; * An immutable 2-dimensional vector. */ public final class Vector2 { - + public static final Vector2 ZERO = new Vector2(0, 0); public static final Vector2 UNIT_X = new Vector2(1, 0); public static final Vector2 UNIT_Z = new Vector2(0, 1); public static final Vector2 ONE = new Vector2(1, 1); + public static Vector2 at(double x, double z) { + int xTrunc = (int) x; + switch (xTrunc) { + case 0: + if (x == 0 && z == 0) { + return ZERO; + } + break; + case 1: + if (x == 1 && z == 1) { + return ONE; + } + break; + } + return new Vector2(x, z); + } + private final double x, z; /** @@ -39,21 +56,11 @@ public final class Vector2 { * @param x the X coordinate * @param z the Z coordinate */ - public Vector2(double x, double z) { + private Vector2(double x, double z) { this.x = x; this.z = z; } - /** - * Copy another vector. - * - * @param other the other vector - */ - public Vector2(Vector2 other) { - this.x = other.x; - this.z = other.z; - } - /** * Get the X coordinate. * @@ -70,7 +77,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 withX(double x) { - return new Vector2(x, z); + return Vector2.at(x, z); } /** @@ -89,7 +96,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 withZ(double z) { - return new Vector2(x, z); + return Vector2.at(x, z); } /** @@ -110,7 +117,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 add(double x, double z) { - return new Vector2(this.x + x, this.z + z); + return Vector2.at(this.x + x, this.z + z); } /** @@ -128,7 +135,7 @@ public final class Vector2 { newZ += other.z; } - return new Vector2(newX, newZ); + return Vector2.at(newX, newZ); } /** @@ -151,7 +158,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 subtract(double x, double z) { - return new Vector2(this.x - x, this.z - z); + return Vector2.at(this.x - x, this.z - z); } /** @@ -169,7 +176,7 @@ public final class Vector2 { newZ -= other.z; } - return new Vector2(newX, newZ); + return Vector2.at(newX, newZ); } /** @@ -190,7 +197,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 multiply(double x, double z) { - return new Vector2(this.x * x, this.z * z); + return Vector2.at(this.x * x, this.z * z); } /** @@ -207,7 +214,7 @@ public final class Vector2 { newZ *= other.z; } - return new Vector2(newX, newZ); + return Vector2.at(newX, newZ); } /** @@ -238,7 +245,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 divide(double x, double z) { - return new Vector2(this.x / x, this.z / z); + return Vector2.at(this.x / x, this.z / z); } /** @@ -329,7 +336,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 floor() { - return new Vector2(Math.floor(x), Math.floor(z)); + return Vector2.at(Math.floor(x), Math.floor(z)); } /** @@ -338,7 +345,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 ceil() { - return new Vector2(Math.ceil(x), Math.ceil(z)); + return Vector2.at(Math.ceil(x), Math.ceil(z)); } /** @@ -349,7 +356,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 round() { - return new Vector2(Math.floor(x + 0.5), Math.floor(z + 0.5)); + return Vector2.at(Math.floor(x + 0.5), Math.floor(z + 0.5)); } /** @@ -359,7 +366,7 @@ public final class Vector2 { * @return a new vector */ public Vector2 abs() { - return new Vector2(Math.abs(x), Math.abs(z)); + return Vector2.at(Math.abs(x), Math.abs(z)); } /** @@ -413,7 +420,7 @@ public final class Vector2 { } public static BlockVector2 toBlockPoint(double x, double z) { - return new BlockVector2(x, z); + return BlockVector2.at(x, z); } /** @@ -441,7 +448,7 @@ public final class Vector2 { * @return a new vector */ public Vector3 toVector3(double y) { - return new Vector3(x, y, z); + return Vector3.at(x, y, z); } @Override 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 59847cbf2..698f57f8b 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 @@ -37,6 +37,25 @@ public final class Vector3 { public static final Vector3 UNIT_Z = new Vector3(0, 0, 1); public static final Vector3 ONE = new Vector3(1, 1, 1); + public static Vector3 at(double x, double y, double z) { + // switch for efficiency on typical cases + // in MC y is rarely 0/1 on selections + int yTrunc = (int) y; + switch (yTrunc) { + case 0: + if (x == 0 && y == 0 && z == 0) { + return ZERO; + } + break; + case 1: + if (x == 1 && y == 1 && z == 1) { + return ONE; + } + break; + } + return new Vector3(x, y, z); + } + // thread-safe initialization idiom private static final class YzxOrderComparator { private static final Comparator YZX_ORDER = (a, b) -> { @@ -67,23 +86,12 @@ public final class Vector3 { * @param y the Y coordinate * @param z the Z coordinate */ - public Vector3(double x, double y, double z) { + private Vector3(double x, double y, double z) { this.x = x; this.y = y; this.z = z; } - /** - * Copy another vector. - * - * @param other another vector to make a copy of - */ - public Vector3(Vector3 other) { - this.x = other.x; - this.y = other.y; - this.z = other.z; - } - /** * Get the X coordinate. * @@ -100,7 +108,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 withX(double x) { - return new Vector3(x, y, z); + return Vector3.at(x, y, z); } /** @@ -119,7 +127,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 withY(double y) { - return new Vector3(x, y, z); + return Vector3.at(x, y, z); } /** @@ -138,7 +146,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 withZ(double z) { - return new Vector3(x, y, z); + return Vector3.at(x, y, z); } /** @@ -160,7 +168,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 add(double x, double y, double z) { - return new Vector3(this.x + x, this.y + y, this.z + z); + return Vector3.at(this.x + x, this.y + y, this.z + z); } /** @@ -179,7 +187,7 @@ public final class Vector3 { newZ += other.z; } - return new Vector3(newX, newY, newZ); + return Vector3.at(newX, newY, newZ); } /** @@ -203,7 +211,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 subtract(double x, double y, double z) { - return new Vector3(this.x - x, this.y - y, this.z - z); + return Vector3.at(this.x - x, this.y - y, this.z - z); } /** @@ -222,7 +230,7 @@ public final class Vector3 { newZ -= other.z; } - return new Vector3(newX, newY, newZ); + return Vector3.at(newX, newY, newZ); } /** @@ -244,7 +252,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 multiply(double x, double y, double z) { - return new Vector3(this.x * x, this.y * y, this.z * z); + return Vector3.at(this.x * x, this.y * y, this.z * z); } /** @@ -262,7 +270,7 @@ public final class Vector3 { newZ *= other.z; } - return new Vector3(newX, newY, newZ); + return Vector3.at(newX, newY, newZ); } /** @@ -294,7 +302,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 divide(double x, double y, double z) { - return new Vector3(this.x / x, this.y / y, this.z / z); + return Vector3.at(this.x / x, this.y / y, this.z / z); } /** @@ -403,10 +411,10 @@ public final class Vector3 { public Vector3 clampY(int min, int max) { checkArgument(min <= max, "minimum cannot be greater than maximum"); if (y < min) { - return new Vector3(x, min, z); + return Vector3.at(x, min, z); } if (y > max) { - return new Vector3(x, max, z); + return Vector3.at(x, max, z); } return this; } @@ -417,7 +425,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 floor() { - return new Vector3(Math.floor(x), Math.floor(y), Math.floor(z)); + return Vector3.at(Math.floor(x), Math.floor(y), Math.floor(z)); } /** @@ -426,7 +434,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 ceil() { - return new Vector3(Math.ceil(x), Math.ceil(y), Math.ceil(z)); + return Vector3.at(Math.ceil(x), Math.ceil(y), Math.ceil(z)); } /** @@ -437,7 +445,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 round() { - return new Vector3(Math.floor(x + 0.5), Math.floor(y + 0.5), Math.floor(z + 0.5)); + return Vector3.at(Math.floor(x + 0.5), Math.floor(y + 0.5), Math.floor(z + 0.5)); } /** @@ -447,7 +455,7 @@ public final class Vector3 { * @return a new vector */ public Vector3 abs() { - return new Vector3(Math.abs(x), Math.abs(y), Math.abs(z)); + return Vector3.at(Math.abs(x), Math.abs(y), Math.abs(z)); } /** @@ -548,7 +556,7 @@ public final class Vector3 { * @return a new {@code BlockVector} */ public static BlockVector3 toBlockPoint(double x, double y, double z) { - return new BlockVector3(x, y, z); + return BlockVector3.at(x, y, z); } /** @@ -566,7 +574,7 @@ public final class Vector3 { * @return a new {@link Vector2} */ public Vector2 toVector2() { - return new Vector2(x, z); + return Vector2.at(x, z); } @Override 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 c12beee56..ff2dae979 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 @@ -134,17 +134,17 @@ public class HeightMap { // Depending on growing or shrinking we need to start at the bottom or top if (newHeight > curHeight) { // Set the top block of the column to be the same type (this might go wrong with rounding) - BlockState existing = session.getBlock(new BlockVector3(xr, curHeight, zr)); + BlockState existing = session.getBlock(BlockVector3.at(xr, curHeight, zr)); // Skip water/lava if (existing.getBlockType() != BlockTypes.WATER && existing.getBlockType() != BlockTypes.LAVA) { - session.setBlock(new BlockVector3(xr, newHeight, zr), existing); + session.setBlock(BlockVector3.at(xr, newHeight, zr), existing); ++blocksChanged; // Grow -- start from 1 below top replacing airblocks for (int y = newHeight - 1 - originY; y >= 0; --y) { int copyFrom = (int) (y * scale); - session.setBlock(new BlockVector3(xr, originY + y, zr), session.getBlock(new BlockVector3(xr, originY + copyFrom, zr))); + session.setBlock(BlockVector3.at(xr, originY + y, zr), session.getBlock(BlockVector3.at(xr, originY + copyFrom, zr))); ++blocksChanged; } } @@ -152,18 +152,18 @@ public class HeightMap { // Shrink -- start from bottom for (int y = 0; y < newHeight - originY; ++y) { int copyFrom = (int) (y * scale); - session.setBlock(new BlockVector3(xr, originY + y, zr), session.getBlock(new BlockVector3(xr, originY + copyFrom, zr))); + session.setBlock(BlockVector3.at(xr, originY + y, zr), session.getBlock(BlockVector3.at(xr, originY + copyFrom, zr))); ++blocksChanged; } // Set the top block of the column to be the same type // (this could otherwise go wrong with rounding) - session.setBlock(new BlockVector3(xr, newHeight, zr), session.getBlock(new BlockVector3(xr, curHeight, zr))); + session.setBlock(BlockVector3.at(xr, newHeight, zr), session.getBlock(BlockVector3.at(xr, curHeight, zr))); ++blocksChanged; // Fill rest with air for (int y = newHeight + 1; y <= curHeight; ++y) { - session.setBlock(new BlockVector3(xr, y, zr), fillerAir); + session.setBlock(BlockVector3.at(xr, y, zr), fillerAir); ++blocksChanged; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java index af191dc72..13bc259ba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java @@ -53,7 +53,7 @@ public final class Polygons { final List points = new ArrayList<>(nPoints); for (int i = 0; i < nPoints; ++i) { double angle = i * (2.0 * Math.PI) / nPoints; - final Vector2 pos = new Vector2(Math.cos(angle), Math.sin(angle)); + final Vector2 pos = Vector2.at(Math.cos(angle), Math.sin(angle)); final BlockVector2 blockVector2D = pos.multiply(radius).toBlockPoint().add(center); points.add(blockVector2D); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Node.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Node.java index c2bc1e93b..c29190b77 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Node.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Node.java @@ -38,7 +38,7 @@ public class Node { private double continuity; public Node() { - this(new Vector3(0, 0, 0)); + this(Vector3.at(0, 0, 0)); } public Node(Node other) { 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 376fd0b33..f3e9a3876 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 @@ -293,7 +293,7 @@ public class AffineTransform implements Transform { @Override public Vector3 apply(Vector3 vector) { - return new Vector3( + return Vector3.at( vector.getX() * m00 + vector.getY() * m01 + vector.getZ() * m02 + m03, vector.getX() * m10 + vector.getY() * m11 + vector.getZ() * m12 + m13, vector.getX() * m20 + vector.getY() * m21 + vector.getZ() * m22 + m23); 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 cdaf362db..34b9639b7 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 @@ -91,10 +91,10 @@ public abstract class AbstractRegion implements Region { final List points = new ArrayList<>(4); - points.add(new BlockVector2(min.getX(), min.getZ())); - points.add(new BlockVector2(min.getX(), max.getZ())); - points.add(new BlockVector2(max.getX(), max.getZ())); - points.add(new BlockVector2(max.getX(), min.getZ())); + 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())); return points; } @@ -169,11 +169,11 @@ public abstract class AbstractRegion implements Region { for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) { for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) { - if (!contains(new BlockVector3(x, minY, z))) { + if (!contains(BlockVector3.at(x, minY, z))) { continue; } - chunks.add(new BlockVector2( + chunks.add(BlockVector2.at( x >> ChunkStore.CHUNK_SHIFTS, z >> ChunkStore.CHUNK_SHIFTS )); @@ -193,11 +193,11 @@ public abstract class AbstractRegion implements Region { 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) { - if (!contains(new BlockVector3(x, y, z))) { + if (!contains(BlockVector3.at(x, y, z))) { continue; } - chunks.add(new BlockVector3( + chunks.add(BlockVector3.at( x >> ChunkStore.CHUNK_SHIFTS, y >> ChunkStore.CHUNK_SHIFTS, z >> ChunkStore.CHUNK_SHIFTS 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 cebd62098..e011228d0 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 @@ -292,7 +292,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { 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) { - chunks.add(new BlockVector2(x, z)); + chunks.add(BlockVector2.at(x, z)); } } @@ -309,7 +309,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { 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) { - chunks.add(new BlockVector3(x, y, z)); + chunks.add(BlockVector3.at(x, y, z)); } } } @@ -342,7 +342,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public BlockVector3 next() { if (!hasNext()) throw new NoSuchElementException(); - BlockVector3 answer = new BlockVector3(nextX, nextY, nextZ); + BlockVector3 answer = BlockVector3.at(nextX, nextY, nextZ); if (++nextX > max.getBlockX()) { nextX = min.getBlockX(); if (++nextY > max.getBlockY()) { @@ -373,7 +373,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public BlockVector2 next() { if (!hasNext()) throw new NoSuchElementException(); - BlockVector2 answer = new BlockVector2(nextX, nextZ); + BlockVector2 answer = BlockVector2.at(nextX, nextZ); if (++nextX > max.getBlockX()) { nextX = min.getBlockX(); if (++nextZ > max.getBlockZ()) { 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 acff65c3a..7ac227071 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 @@ -256,7 +256,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { public void contract(BlockVector3... changes) throws RegionOperationException { center = center.subtract(calculateDiff2D(changes)); Vector2 newRadius = radius.subtract(calculateChanges2D(changes).toVector2()); - radius = new Vector2(1.5, 1.5).getMaximum(newRadius); + radius = Vector2.at(1.5, 1.5).getMaximum(newRadius); for (BlockVector3 change : changes) { int height = maxY - minY; int changeY = change.getBlockY(); @@ -358,7 +358,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { public static CylinderRegion createRadius(Extent extent, BlockVector3 center, double radius) { checkNotNull(extent); checkNotNull(center); - Vector2 radiusVec = new Vector2(radius, radius); + Vector2 radiusVec = Vector2.at(radius, radius); int minY = extent.getMinimumPoint().getBlockY(); int maxY = extent.getMaximumPoint().getBlockY(); 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 0cf5e4b59..57348c6a6 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 @@ -130,7 +130,7 @@ public class EllipsoidRegion extends AbstractRegion { public void contract(BlockVector3... changes) throws RegionOperationException { center = center.subtract(calculateDiff(changes)); Vector3 newRadius = radius.subtract(calculateChanges(changes)); - radius = new Vector3(1.5, 1.5, 1.5).getMaximum(newRadius); + radius = Vector3.at(1.5, 1.5, 1.5).getMaximum(newRadius); } @Override @@ -185,11 +185,11 @@ public class EllipsoidRegion extends AbstractRegion { for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) { for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) { - if (!contains(new BlockVector3(x, centerY, z))) { + if (!contains(BlockVector3.at(x, centerY, z))) { continue; } - chunks.add(new BlockVector2( + chunks.add(BlockVector2.at( x >> ChunkStore.CHUNK_SHIFTS, z >> ChunkStore.CHUNK_SHIFTS )); 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 41cdeebff..bee1161bf 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 @@ -21,7 +21,6 @@ package com.sk89q.worldedit.regions; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector2; import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator; import com.sk89q.worldedit.regions.iterator.FlatRegionIterator; import com.sk89q.worldedit.world.World; @@ -131,8 +130,8 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { minY = Math.min(Math.max(0, minY), world == null ? 255 : world.getMaxY()); maxY = Math.min(Math.max(0, maxY), world == null ? 255 : world.getMaxY()); - min = new BlockVector2(minX, minZ); - max = new BlockVector2(maxX, maxZ); + min = BlockVector2.at(minX, minZ); + max = BlockVector2.at(maxX, maxZ); } /** @@ -151,7 +150,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { * @param position the position */ public void addPoint(BlockVector3 position) { - points.add(new BlockVector2(position.getBlockX(), position.getBlockZ())); + points.add(BlockVector2.at(position.getBlockX(), position.getBlockZ())); recalculate(); } @@ -267,7 +266,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { for (int i = 0; i < points.size(); ++i) { BlockVector2 point = points.get(i); - points.set(i, new BlockVector2(point.getX() + changeX, point.getZ() + changeZ)); + points.set(i, BlockVector2.at(point.getX() + changeX, point.getZ() + changeZ)); } minY += changeY; 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 ed3896d06..cf55d2fa9 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 @@ -34,7 +34,7 @@ public class CylinderRegionFactory implements RegionFactory { @Override public Region createCenteredAt(BlockVector3 position, double size) { - return new CylinderRegion(position, new Vector2(size, size), position.getBlockY() - (int) (height / 2), position.getBlockY() + (int) (height / 2)); + return new CylinderRegion(position, Vector2.at(size, size), position.getBlockY() - (int) (height / 2), position.getBlockY() + (int) (height / 2)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/SphereRegionFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/SphereRegionFactory.java index 4ad8d4125..f30611b0f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/SphereRegionFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/SphereRegionFactory.java @@ -28,7 +28,7 @@ public class SphereRegionFactory implements RegionFactory { @Override public Region createCenteredAt(BlockVector3 position, double size) { - return new EllipsoidRegion(position, new Vector3(size, size, size)); + return new EllipsoidRegion(position, Vector3.at(size, size, size)); } } 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 786e04a2b..6a7a06780 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 = new BlockVector3(next2D.getBlockX(), nextY, next2D.getBlockZ()); + BlockVector3 current = BlockVector3.at(next2D.getBlockX(), nextY, next2D.getBlockZ()); 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 e4cd6457c..8bd0a48dc 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 @@ -65,7 +65,7 @@ public class FlatRegionIterator implements Iterator { } private void forward() { - while (hasNext() && !region.contains(new BlockVector3(nextX, y, nextZ))) { + while (hasNext() && !region.contains(BlockVector3.at(nextX, y, nextZ))) { forwardOne(); } } @@ -76,7 +76,7 @@ public class FlatRegionIterator implements Iterator { throw new NoSuchElementException(); } - BlockVector2 answer = new BlockVector2(nextX, nextZ); + BlockVector2 answer = BlockVector2.at(nextX, nextZ); forwardOne(); 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 d2ab586d8..c01dfe213 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 @@ -61,7 +61,7 @@ public class RegionIterator implements Iterator { } private void forward() { - while (hasNext() && !region.contains(new BlockVector3(nextX, nextY, nextZ))) { + while (hasNext() && !region.contains(BlockVector3.at(nextX, nextY, nextZ))) { forwardOne(); } } @@ -70,7 +70,7 @@ public class RegionIterator implements Iterator { public BlockVector3 next() { if (!hasNext()) throw new java.util.NoSuchElementException(); - BlockVector3 answer = new BlockVector3(nextX, nextY, nextZ); + BlockVector3 answer = BlockVector3.at(nextX, nextY, nextZ); forwardOne(); forward(); 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 bf5aeaace..16a285c89 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 @@ -115,8 +115,8 @@ public class ExtendingCuboidRegionSelector extends CuboidRegionSelector { final BlockVector3 o1 = position1; final BlockVector3 o2 = position2; - position1 = new BlockVector3(x1, y1, z1); - position2 = new BlockVector3(x2, y2, z2); + position1 = BlockVector3.at(x1, y1, z1); + position2 = BlockVector3.at(x2, y2, z2); region.setPos1(position1); region.setPos2(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 fbc2bd123..4a0fd7595 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 @@ -109,7 +109,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { checkNotNull(points); final BlockVector2 pos2D = points.get(0); - pos1 = new BlockVector3(pos2D.getX(), minY, pos2D.getZ()); + pos1 = BlockVector3.at(pos2D.getX(), minY, pos2D.getZ()); region = new Polygonal2DRegion(world, points, minY, maxY); } @@ -215,7 +215,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { @Override public void learnChanges() { BlockVector2 pt = region.getPoints().get(0); - pos1 = new BlockVector3(pt.getBlockX(), region.getMinimumPoint().getBlockY(), pt.getBlockZ()); + pos1 = BlockVector3.at(pt.getBlockX(), region.getMinimumPoint().getBlockY(), pt.getBlockZ()); } @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 6414c2cde..8f5a96269 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 @@ -59,7 +59,7 @@ public class SphereRegionSelector extends EllipsoidRegionSelector { super(oldSelector); final Vector3 radius = region.getRadius(); final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ()); - region.setRadius(new Vector3(radiusScalar, radiusScalar, radiusScalar)); + region.setRadius(Vector3.at(radiusScalar, radiusScalar, radiusScalar)); } /** @@ -70,7 +70,7 @@ public class SphereRegionSelector extends EllipsoidRegionSelector { * @param radius the radius */ public SphereRegionSelector(@Nullable World world, BlockVector3 center, int radius) { - super(world, center, new Vector3(radius, radius, radius)); + super(world, center, Vector3.at(radius, radius, radius)); } @Override @@ -80,7 +80,7 @@ public class SphereRegionSelector extends EllipsoidRegionSelector { } final double radiusScalar = Math.ceil(position.toVector3().distance(region.getCenter())); - region.setRadius(new Vector3(radiusScalar, radiusScalar, radiusScalar)); + region.setRadius(Vector3.at(radiusScalar, radiusScalar, radiusScalar)); return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java index 08994c717..95c542c6f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java @@ -35,7 +35,7 @@ public class RegionShape extends ArbitraryShape { @Override protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { - if (!this.extent.contains(new BlockVector3(x, y, z))) { + if (!this.extent.contains(BlockVector3.at(x, y, z))) { return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java index 5022c90af..2b1c49309 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java @@ -39,7 +39,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { public BlockVector3 toWorld(double x, double y, double z) { // unscale, unoffset, round-nearest - return new Vector3(x, y, z).multiply(unit).add(zero2).toBlockPoint(); + return Vector3.at(x, y, z).multiply(unit).add(zero2).toBlockPoint(); } public Vector3 toWorldRel(double x, double y, double z) { 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 e62796bd7..940bbe3e6 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 @@ -29,27 +29,27 @@ import javax.annotation.Nullable; */ public enum Direction { - NORTH(new Vector3(0, 0, -1), Flag.CARDINAL), - EAST(new Vector3(1, 0, 0), Flag.CARDINAL), - SOUTH(new Vector3(0, 0, 1), Flag.CARDINAL), - WEST(new Vector3(-1, 0, 0), Flag.CARDINAL), + NORTH(Vector3.at(0, 0, -1), Flag.CARDINAL), + EAST(Vector3.at(1, 0, 0), Flag.CARDINAL), + SOUTH(Vector3.at(0, 0, 1), Flag.CARDINAL), + WEST(Vector3.at(-1, 0, 0), Flag.CARDINAL), - UP(new Vector3(0, 1, 0), Flag.UPRIGHT), - DOWN(new Vector3(0, -1, 0), Flag.UPRIGHT), + UP(Vector3.at(0, 1, 0), Flag.UPRIGHT), + DOWN(Vector3.at(0, -1, 0), Flag.UPRIGHT), - NORTHEAST(new Vector3(1, 0, -1), Flag.ORDINAL), - NORTHWEST(new Vector3(-1, 0, -1), Flag.ORDINAL), - SOUTHEAST(new Vector3(1, 0, 1), Flag.ORDINAL), - SOUTHWEST(new Vector3(-1, 0, 1), Flag.ORDINAL), + NORTHEAST(Vector3.at(1, 0, -1), Flag.ORDINAL), + NORTHWEST(Vector3.at(-1, 0, -1), Flag.ORDINAL), + SOUTHEAST(Vector3.at(1, 0, 1), Flag.ORDINAL), + SOUTHWEST(Vector3.at(-1, 0, 1), Flag.ORDINAL), - WEST_NORTHWEST(new Vector3(-Math.cos(Math.PI / 8), 0, -Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - WEST_SOUTHWEST(new Vector3(-Math.cos(Math.PI / 8), 0, Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - NORTH_NORTHWEST(new Vector3(-Math.sin(Math.PI / 8), 0, -Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - NORTH_NORTHEAST(new Vector3(Math.sin(Math.PI / 8), 0, -Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - EAST_NORTHEAST(new Vector3(Math.cos(Math.PI / 8), 0, -Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - EAST_SOUTHEAST(new Vector3(Math.cos(Math.PI / 8), 0, Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - SOUTH_SOUTHEAST(new Vector3(Math.sin(Math.PI / 8), 0, Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), - SOUTH_SOUTHWEST(new Vector3(-Math.sin(Math.PI / 8), 0, Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL); + WEST_NORTHWEST(Vector3.at(-Math.cos(Math.PI / 8), 0, -Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + WEST_SOUTHWEST(Vector3.at(-Math.cos(Math.PI / 8), 0, Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + NORTH_NORTHWEST(Vector3.at(-Math.sin(Math.PI / 8), 0, -Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + NORTH_NORTHEAST(Vector3.at(Math.sin(Math.PI / 8), 0, -Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + EAST_NORTHEAST(Vector3.at(Math.cos(Math.PI / 8), 0, -Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + EAST_SOUTHEAST(Vector3.at(Math.cos(Math.PI / 8), 0, Math.sin(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + SOUTH_SOUTHEAST(Vector3.at(Math.sin(Math.PI / 8), 0, Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL), + SOUTH_SOUTHWEST(Vector3.at(-Math.sin(Math.PI / 8), 0, Math.cos(Math.PI / 8)), Flag.SECONDARY_ORDINAL); private final Vector3 direction; private final int flags; 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 82186bbb1..8e95e9eb0 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 @@ -61,7 +61,7 @@ public class Location { * @param z the Z coordinate */ public Location(Extent extent, double x, double y, double z) { - this(extent, new Vector3(x, y, z), Vector3.ZERO); + this(extent, Vector3.at(x, y, z), Vector3.ZERO); } /** @@ -86,7 +86,7 @@ public class Location { * @param direction the direction vector */ public Location(Extent extent, double x, double y, double z, Vector3 direction) { - this(extent, new Vector3(x, y, z), direction); + this(extent, Vector3.at(x, y, z), direction); } /** @@ -101,7 +101,7 @@ public class Location { * @param pitch the pitch, in degrees */ public Location(Extent extent, double x, double y, double z, float yaw, float pitch) { - this(extent, new Vector3(x, y, z), yaw, pitch); + this(extent, Vector3.at(x, y, z), yaw, pitch); } /** @@ -211,7 +211,7 @@ public class Location { double yaw = Math.toRadians(this.getYaw()); double pitch = Math.toRadians(this.getPitch()); double xz = Math.cos(pitch); - return new Vector3( + return Vector3.at( -xz * Math.sin(yaw), -Math.sin(pitch), xz * Math.cos(yaw)); 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 1c2a97b3f..60c979dee 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 @@ -83,7 +83,7 @@ public class TargetBlock { double h = (checkDistance * Math.cos(Math.toRadians(yRotation))); - offset = new Vector3((h * Math.cos(Math.toRadians(xRotation))), + offset = Vector3.at((h * Math.cos(Math.toRadians(xRotation))), (checkDistance * Math.sin(Math.toRadians(yRotation))), (h * Math.sin(Math.toRadians(xRotation)))); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java index 4524e64f9..ec164d045 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java @@ -44,6 +44,6 @@ public class VectorAdapter implements JsonDeserializer { double y = jsonArray.get(1).getAsDouble(); double z = jsonArray.get(2).getAsDouble(); - return new Vector3(x, y, z); + return Vector3.at(x, y, z); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java index 124187fdd..060518fb5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java @@ -114,12 +114,12 @@ public abstract class AbstractWorld implements World { @Override public BlockVector3 getMinimumPoint() { - return new BlockVector3(-30000000, 0, -30000000); + return BlockVector3.at(-30000000, 0, -30000000); } @Override public BlockVector3 getMaximumPoint() { - return new BlockVector3(30000000, 255, 30000000); + return BlockVector3.at(30000000, 255, 30000000); } @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 65f76cd41..39d9a04cd 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 @@ -224,7 +224,7 @@ public class AnvilChunk implements Chunk { values.put(entry.getKey(), entry.getValue()); } - BlockVector3 vec = new BlockVector3(x, y, z); + BlockVector3 vec = BlockVector3.at(x, y, z); tileEntities.put(vec, values); } } 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 cda59cbda..a07bbf177 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 @@ -200,7 +200,7 @@ public class AnvilChunk13 implements Chunk { values.put(entry.getKey(), entry.getValue()); } - BlockVector3 vec = new BlockVector3(x, y, z); + BlockVector3 vec = BlockVector3.at(x, y, z); tileEntities.put(vec, values); } } 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 4a3336e86..db6d4b0ed 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 @@ -126,7 +126,7 @@ public class OldChunk implements Chunk { values.put(entry.getKey(), entry.getValue()); } - BlockVector3 vec = new BlockVector3(x, y, z); + BlockVector3 vec = BlockVector3.at(x, y, z); tileEntities.put(vec, values); } } 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 5b6691b85..c5b134c62 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 @@ -80,7 +80,7 @@ public class SnapshotRestore { 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) { - BlockVector3 pos = new BlockVector3(x, y, z); + BlockVector3 pos = BlockVector3.at(x, y, z); checkAndAddBlock(pos); } } 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 07a4e06a5..319503740 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 @@ -57,7 +57,7 @@ public abstract class ChunkStore implements Closeable { * @return chunk coordinates */ public static BlockVector2 toChunk(BlockVector3 position) { - return new BlockVector2(position.getX() >> CHUNK_SHIFTS, position.getZ() >> CHUNK_SHIFTS); + return BlockVector2.at(position.getX() >> CHUNK_SHIFTS, position.getZ() >> CHUNK_SHIFTS); } /** 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 d7633c15c..50dfa649e 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 @@ -54,7 +54,7 @@ public class LocationTest { @Test public void testToVector() throws Exception { World world = mock(World.class); - Vector3 position = new Vector3(1, 1, 1); + Vector3 position = Vector3.at(1, 1, 1); Location location = new Location(world, position); assertEquals(position, location.toVector()); } @@ -62,14 +62,14 @@ public class LocationTest { @Test public void testGetX() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector3(TEST_VALUE, 0, 0)); + Location location = new Location(world, Vector3.at(TEST_VALUE, 0, 0)); assertEquals(TEST_VALUE, location.getX(), EPSILON); } @Test public void testGetBlockX() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector3(TEST_VALUE, 0, 0)); + Location location = new Location(world, Vector3.at(TEST_VALUE, 0, 0)); assertEquals(TEST_VALUE, location.getBlockX()); } @@ -87,14 +87,14 @@ public class LocationTest { @Test public void testGetY() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector3(0, TEST_VALUE, 0)); + Location location = new Location(world, Vector3.at(0, TEST_VALUE, 0)); assertEquals(TEST_VALUE, location.getY(), EPSILON); } @Test public void testGetBlockY() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector3(0, TEST_VALUE, 0)); + Location location = new Location(world, Vector3.at(0, TEST_VALUE, 0)); assertEquals(TEST_VALUE, location.getBlockY()); } @@ -112,14 +112,14 @@ public class LocationTest { @Test public void testGetZ() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector3(0, 0, TEST_VALUE)); + Location location = new Location(world, Vector3.at(0, 0, TEST_VALUE)); assertEquals(TEST_VALUE, location.getZ(), EPSILON); } @Test public void testGetBlockZ() throws Exception { World world = mock(World.class); - Location location = new Location(world, new Vector3(0, 0, TEST_VALUE)); + Location location = new Location(world, Vector3.at(0, 0, TEST_VALUE)); assertEquals(TEST_VALUE, location.getBlockZ()); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index 335ef497d..671e2e0f4 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -51,11 +51,11 @@ final class ForgeAdapter { } public static Vector3 adapt(Vec3d vector) { - return new Vector3(vector.x, vector.y, vector.z); + return Vector3.at(vector.x, vector.y, vector.z); } public static Vector3 adapt(BlockPos pos) { - return new Vector3(pos.getX(), pos.getY(), pos.getZ()); + return Vector3.at(pos.getX(), pos.getY(), pos.getZ()); } public static Vec3d toVec3(BlockVector3 vector) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java index 94bb3c8a5..b5cd5f516 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java @@ -66,7 +66,7 @@ class ForgeEntity implements Entity { public Location getLocation() { net.minecraft.entity.Entity entity = entityRef.get(); if (entity != null) { - Vector3 position = new Vector3(entity.posX, entity.posY, entity.posZ); + Vector3 position = Vector3.at(entity.posX, entity.posY, entity.posZ); float yaw = entity.rotationYaw; float pitch = entity.rotationPitch; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index a09c472da..5523ad642 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -84,7 +84,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public Location getLocation() { - Vector3 position = new Vector3(this.player.posX, this.player.posY, this.player.posZ); + Vector3 position = Vector3.at(this.player.posX, this.player.posY, this.player.posZ); return new Location( ForgeWorldEdit.inst.getWorld(this.player.world), position, diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index e579711e9..23ea709ff 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -522,7 +522,7 @@ public class ForgeWorld extends AbstractWorld { public List getEntities(Region region) { List entities = new ArrayList<>(); for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) { - if (region.contains(new BlockVector3(entity.posX, entity.posY, entity.posZ))) { + if (region.contains(BlockVector3.at(entity.posX, entity.posY, entity.posZ))) { entities.add(new ForgeEntity(entity)); } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index b62bee328..74c2a6a3c 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -249,7 +249,7 @@ public abstract class SpongeWorld extends AbstractWorld { List entities = new ArrayList<>(); for (org.spongepowered.api.entity.Entity entity : getWorld().getEntities()) { org.spongepowered.api.world.Location loc = entity.getLocation(); - if (region.contains(new BlockVector3(loc.getX(), loc.getY(), loc.getZ()))) { + if (region.contains(BlockVector3.at(loc.getX(), loc.getY(), loc.getZ()))) { entities.add(new SpongeEntity(entity)); } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java index 01cc7dfc0..d6cb96f8e 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java @@ -57,7 +57,7 @@ public interface SpongeImplAdapter { } default Location adapt(org.spongepowered.api.world.Location loc, Vector3d rot) { - Vector3 position = new Vector3(loc.getX(), loc.getY(), loc.getZ()); + Vector3 position = Vector3.at(loc.getX(), loc.getY(), loc.getZ()); return new Location(getWorld(loc.getExtent()), position, (float) rot.getY(), (float) rot.getX()); } From b6f6f3dde6b5bfa0a2e1e2a6944f03ed7408e001 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Sat, 3 Nov 2018 23:06:52 -0700 Subject: [PATCH 036/182] Correct trace property name --- .../java/com/sk89q/worldedit/util/PropertiesConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 67b23b608..2454581f1 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 @@ -75,7 +75,7 @@ public class PropertiesConfiguration extends LocalConfiguration { loadExtra(); profile = getBool("profile", profile); - traceUnflushedSessions = getBool("traceUnflushedSessions", traceUnflushedSessions); + traceUnflushedSessions = getBool("trace-unflushed-sessions", traceUnflushedSessions); disallowedBlocks = getStringSet("disallowed-blocks", defaultDisallowedBlocks); defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit); maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); From a2be001a57d4f621b3af8f149e396246c6a6bc25 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 4 Nov 2018 16:14:47 +1000 Subject: [PATCH 037/182] Updated adapters --- .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 21445 -> 21478 bytes .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 21605 -> 22543 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class index 80124e9d9948374cc61cdd820e7cf18e57728513..b4c1e73b500b36c8c8bc3b7e2481d984cecfa0c1 100644 GIT binary patch delta 96 zcmX@QoblOm#tj;Rj0ux91q}pq6H7AmopSP%v%^x8OY)11C&vr=GO7Dao@gV2DY^NC PV6`fvDh|mw^K=;iSHU5E delta 65 zcmaF1obl*##tj;RjG>b?1r6B3Qj<&aizXQ;PVN@eVU(FH&nF5M+k8*3T9r|1vI3t7 KOr+jCT?PQcsTA=5 diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2.class index e0baf570d0f22d4a2c0eea858ea8e542e08c5411..0cf726df3b1c6e2c04be4c4b64c534d9721b0868 100644 GIT binary patch delta 8084 zcmZu$2Y6J~5}uip-LtuS6H?farKAvA8li(hO6V;C1;vPz00BZtkOUC*u_`tcM7)3o zL_rh~qy~2rVgb~kpn`}E1wp}zpkf0lZ{}`7(D&fmv*(^NXXc-o|IFT;T91piqHo{j zov#5vJN3N*mvO%|?-~$+?-}?$9tcH^2Q_|R;351_h7W7}$b}zE_Y;}?)WFa1h{n%d z_=U!!p?D0xl*!{VdBVW2@Q8t5<4I{w8Tbu;YrsJKPI})P_yhWWG@v1#*7%crpOK-n zGWoMKyx|x8H5AX`Z*FdWm*x+Rf6DM*2A;A2Ktt-o@KIk){WSGAU<&Sc(E!5-Q)r+(oo0X2AOj{-wm~^G*iAzyP16mU zZqzi?4J9;8n!yI$L^m5Si-v2uMN_Vrf~+`Ez8Dh%8vq~ zkp?^<&l5FGGGM-R3w$n`%<)1~40sgJxM?a)b5kJ|X_{`pV!Az)W>B%F5`$*4gSolF z4LcZ?&@6*y(;b@T7_gk~)O42tPfGx|qr2VoA4-$nTmw3hPt!e`?ls^!y3c?$G*8q0 znjSD!ZA>0wRt4cI`B7_gBZ)wDp7r)@*k?7Z(zM!uH$=ld^qi(Onw~en zS4A%vu$R_qTBm8f0sH7h1NPGfO&c}6ErNhVM1#ZF)yc-Y3Q{6=T_$3bq(RgJv;vgwlIr&-(@)po0cf(ONO* z1A`6`6UaW=z}C=V1Kt;tJ~EoKE*~>Z&?lNcb>&}i^fes=w(eeVytp^YOBu4HzT;F7Zn$j6ciOAnA2zE&nhUISv+jc z^n8S{v9e*v)#-HWmy`tSV0xH=po^xC@0C}QXKjsc?CEbymdDOKQtYB;(5KcJPpq}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r1=t=%`4P{?T?psryKv6D8&ADCi2l9Q0g1kx@28&Y~{UEc)ev1=JP;|Nj`#AG0EkS zR3O%;l(;jL?jf-l7(7WW|D^b|*xvxlkEW-E(yAl@gLnnj2Q_qOp=?okbX7&-@<9Br zcS2%ablw2(=K4%qf0{mX-&{jkL0=l!{w-zXB-GitB70kC_&t8!c=o;8rSwiNo+P{S zgMQT8-V3zoolim>#SyU-X(~q`o}&i*ynd_4`Qtep(e_dv@AE)27_`tDtDf+pRvU-Q z72eSkhMo%xddqkvkQ`3~5y({tM_hv*7pRr=-HSLjDCDxu^lllw$5a+l1S^oegHBU)Jop~V^?6u+-#heVE37}z?uQ_}2zB3h_DGIG zWo0p?mD37^)5-{a6rqo!^odTa^>DUEC)P&j(BLrVqN`49jnLN-`X)-AyO0$g}2Uoj4SsKce)fjvg+i+NkHs?0cS0 zhVqRmrN4$m=oBh=TOR+7a?boel(USV-l>ghku97;ve`< z{*f2(Pk_WP{1pGnTk#*VZT!c1Fm=GA{VCoS0wU6YG(GqWj=BNf&O1>4DbyBYD=}6T z$JsSp0!rD6yCwV#V1m* Date: Sun, 4 Nov 2018 17:21:01 +1000 Subject: [PATCH 038/182] Update config --- .../src/main/resources/defaults/worldedit.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-forge/src/main/resources/defaults/worldedit.properties b/worldedit-forge/src/main/resources/defaults/worldedit.properties index 567118f0f..d0296c15c 100644 --- a/worldedit-forge/src/main/resources/defaults/worldedit.properties +++ b/worldedit-forge/src/main/resources/defaults/worldedit.properties @@ -5,7 +5,7 @@ super-pickaxe-many-drop-items=true register-help=true nav-wand-item=minecraft:compass profile=false -traceUnflushedSessions=false +trace-unflushed-sessions=false super-pickaxe-drop-items=true disallowed-blocks=minecraft:oak_sapling,minecraft:jungle_sapling,minecraft:dark_oak_sapling,minecraft:spruce_sapling,minecraft:birch_sapling,minecraft:acacia_sapling,minecraft:black_bed,minecraft:blue_bed,minecraft:brown_bed,minecraft:cyan_bed,minecraft:gray_bed,minecraft:green_bed,minecraft:light_blue_bed,minecraft:light_gray_bed,minecraft:lime_bed,minecraft:magenta_bed,minecraft:orange_bed,minecraft:pink_bed,minecraft:purple_bed,minecraft:red_bed,minecraft:white_bed,minecraft:yellow_bed,minecraft:powered_rail,minecraft:detector_rail,minecraft:grass,minecraft:dead_bush,minecraft:moving_piston,minecraft:piston_head,minecraft:sunflower,minecraft:rose_bush,minecraft:dandelion,minecraft:poppy,minecraft:brown_mushroom,minecraft:red_mushroom,minecraft:tnt,minecraft:torch,minecraft:fire,minecraft:redstone_wire,minecraft:wheat,minecraft:potatoes,minecraft:carrots,minecraft:melon_stem,minecraft:pumpkin_stem,minecraft:beetroots,minecraft:rail,minecraft:lever,minecraft:redstone_torch,minecraft:redstone_wall_torch,minecraft:repeater,minecraft:comparator,minecraft:stone_button,minecraft:birch_button,minecraft:acacia_button,minecraft:dark_oak_button,minecraft:jungle_button,minecraft:oak_button,minecraft:spruce_button,minecraft:cactus,minecraft:sugar_cane,minecraft:bedrock max-super-pickaxe-size=5 From 4e4ed6c8931cd1bd8b504c59fb55844c0a4a3e05 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 4 Nov 2018 17:27:36 +1000 Subject: [PATCH 039/182] Fixed missing BaseBlock import --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 1 + 1 file changed, 1 insertion(+) 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 18804bc86..fabf49f3f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -107,6 +107,7 @@ import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.world.NullWorld; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; From 626861aa99c0821fec3a94dabb239a36a2e708ad Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 5 Nov 2018 23:27:03 +1000 Subject: [PATCH 040/182] Fixed serialisation of vectors. --- .../java/com/sk89q/util/yaml/YAMLNode.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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 e9fd96e16..0742c9ceb 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 @@ -20,6 +20,7 @@ package com.sk89q.util.yaml; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector2; import com.sk89q.worldedit.math.Vector3; @@ -118,6 +119,25 @@ public class YAMLNode { out.put("y", vec.getY()); out.put("z", vec.getZ()); 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()); + 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()); + 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()); + return out; } return value; From f0070c111cfded36ce31b6f65337871f9859740f Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 6 Nov 2018 15:53:14 +1000 Subject: [PATCH 041/182] Fixed adapters not being updated --- .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 21478 -> 21397 bytes .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 22543 -> 21557 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class index b4c1e73b500b36c8c8bc3b7e2481d984cecfa0c1..174e1be9a0119d005772a48ffd58f7f67355504f 100644 GIT binary patch delta 4108 zcmZ8k30Rdy7e347&Sma^2wfJDO+dgU1QiX!9oJM0wM|V_asdGaQ`@dfnM-bcTAD3d zscCB3ZPU`!cC*s<`s>fKeY3qZ#sAEQ*wfGRaK1Bh&dj{;J7?y8-NN0e33grSVY=+3v>_KJLROtox)5KBaLt?os%(51&!E zHyrojvo^Tj1`lXFhzN_#(`+VP;53Kpnn*aE*4}PTaWBjj%Ec`^_F%7x+ zsm9UxnZn~5@-58<{M?%07Ye`BSb|?!^R*rJjh*0Ih2Lo?!tZU;4?ZkX_@jpIc)||< z$%hyFu-JxvR``p3{%Xx{3V+x52mYy{KmKLSNsXuQZyP&po8O1y8Eo*wY&`47F$8`L zjv-V;GAps9kw+*{m^EH&lr=tU!bK3$;p8VHOei86fMPUVKmkp$vIN#roT7LQT zwe?dwYOm=+%C%kxMR^+PY+Amej?qBWR>KXp-C0qAhB?;l;-juo2Xv8!d3e~5)2Yyp zHB_YNVhszaIGnmscSSvdntI9(iuu5r4>c^IUYdGSA4Me^R#IO@{WLgs%krteAD7@+ z>kZIQKm!#GQgn%iwKQ16T{J||P(`I0?xA5C?xjl=l_?soVFQiOa6gSybeW>dHEg6S zG;E?P6$P)7U8PYPw%`dxqZN(Ou#K+Pu${&#Dpxd4!%iBnVHZuX`%|IlnsAy(lYBJU zDmz6{rJ^bgdo04;G*wZxq8bf*saC^2nx<&FqB;!+s9wWCnxW`gMKk>nNwYM(h{3~( zW-Gc*!y&tG*J}u;8{|yUjn=zKN`->f%+WNL=2_D7t&TS_ltL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kit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2.class index 0cf726df3b1c6e2c04be4c4b64c534d9721b0868..0fe81f39f6e040531cd9d85e32583170640952f8 100644 GIT binary patch delta 7585 zcmZ`;2Ygk<@}8N^%_irbKoSUWDItN-Qly1qklxWy6^w`wkY0ii>~gIrAR-(^B1*9U zq9PEzH!*^M?}5(-_KF>Q?;_=Wb8ZOe`~UO%-93ADcV=g1=lgcgX8AULVl#)IJO1P@ zBFZ-v4jtjGT0G`ZGH-KuJMTzj!{wGAclZg8XmiwZMFLl9^-1lla`-9UX?a%yKW%w; zBJbh7+WCxj{>$Ni^G=6{@IEc}J6y!iIy8{~qqXN8exAcGIMkS5wEU7j4`|at?R;4a z2)x3tCh}|idJx4MTD)obEp2|=;dl65hX?X|mJjLkeJwuF;zKPy3i2TS*x^t3Q-|8{ zVauO6)Sf?gxR}4N{G~(ra5oGyzj9D~ZTTCA2lKaDe5YdHtAZaa|L9P6{z=FDoWMOT z|Kd<@{#C_)OW};h?6vSqzUGs z#*&U;NmDBsRx%x$%3Bkp8J^NyUtYxGN|r-YB;3N`QfV2KRuZt%+DaQM*+H5sIa;)I zBv1vQtZ$cnds2NGRextSYny%&{qD{$`mV89ojC_9NHn%t<118 z)1fD1mO~Mlt&26sN=c&3l}i$2oZH#(FkHvwp}NNYE1-rS$9 zQg!-P4dXH^w*~1PS+2$HR#vF{D;?e=oFVq{b$d2!h`F_1t=XUs-RH>t@__nxrMmN=BO7Ity0;MC z$YzJ0Q#ywx$K?g!FajJbBEKZL;0U4lCv5YvV#3_qdfO%Bupc zrTj}fR>}uD!`O*fiCU?!Qt53B9^@yzlB7Lc<>lA*zJ@nCY!c&E;0!kG0eOx4-=J)S1kC%1762 z%>mhK<(cxuX{qdOsJE(NkX={)CI5D1pX|5ttSkSK=UfhOyf>nLyWsP#ydW>S@)AGf zZExDD$vM;Kmoml8!o!sVa?oYV307Wq)EFlT0roBi?J*Eg{L} zM%>ut>-c)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5Q6Opb@_{8k|Te}7guE@CpT_@V8hpe$Vq^MB?|i^I?p#8y-)~( zf2R)&>!R{5_%%PubPpu!+4|n2)G8R23|4<%nYRJltlr5!5E^%FfL9%VKYc5Gn2!@< zXQ(I`K)UtfN&bsu9xoz^+66Pc3?TMU8{SJ@`4waqdyq@+qe9;AN5?rhp1NYx8XvTD zWWj53Dr*jMUOg7mSvN1FYK&}HE@yMXpW1OK>3iW|u)t``}sQ4j!0GX)9??FGK$=2#8T0I0d3)6sA z$M@%|tQD1%Ttkm)D6I(7r(yc6iaytlRepr7)Q(kQ`l5=y)Yi5B@HN`HHWa3>!t`|& zeWN`a{GRpNvms31hUvR1I;LiYwONRDyX4Ygz+!RS35@_H3~4Q6yHxh>F#R5;KdR_Y6~EW-*rOeL!}M2}j#Sa#+Of~y&1>4RFHA?P=pSu;vy#%Y zp9+Ecqn@Q>MaFEUkWbq3M&F3%aa{dY)^EKVc-_T?HEv@D6=vh8Y zFYxyunIGUFKZ0a_qF?aSrtr_KKYBLeUpa+;;~xAwvcx}l5dR61`HM&J5uDS1BNsS| zZ0;W%&c}EuALnJlyiSDIi{XtDT^~Xr&`la|<7W{D$%rq_;{`9}ar_)_hpRTC?r3`w zZ7DbyH*hV8WIdji^A4Ya-l&f?{06)NGa?kEUuzKA4N>29q2(k3MPe(2PLQm7=36@{L&#n5UDH1}6b-dhbh-KHZsYa$l${UgIJ9sAo z@>6}KB43Ie>~J>`B;bQporL^42?-}8gn40LD@XrZ(3DdIB}4>4?U()K_V6>fr-DEZ wNEz2e Date: Sat, 10 Nov 2018 19:26:10 +1000 Subject: [PATCH 042/182] Updated bStats --- worldedit-bukkit/build.gradle | 6 +++--- worldedit-sponge/build.gradle | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index f833afb19..680926ac6 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'maven' repositories { maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } - maven { url "https://jitpack.io" } + maven { url "https://repo.codemc.org/repository/maven-public" } maven { url 'https://papermc.io/repo/repository/maven-public/' } } @@ -12,7 +12,7 @@ dependencies { compile project(':worldedit-core') compile 'com.sk89q:dummypermscompat:1.8' compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz - compile 'org.bstats.bStats-Metrics:bstats-bukkit:1.3' + compile 'org.bstats:bstats-bukkit:1.4' compile "io.papermc:paperlib:1.0.1" testCompile 'org.mockito:mockito-core:1.9.0-rc1' } @@ -39,7 +39,7 @@ shadowJar { dependencies { include(dependency(':worldedit-core')) relocate ("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { - include(dependency("org.bstats.bStats-Metrics:bstats-bukkit:1.3")) + include(dependency("org.bstats:bstats-bukkit:1.4")) } relocate ("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") { include(dependency("io.papermc:paperlib:1.0.1")) diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index 81e84475e..d802993e9 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -13,13 +13,13 @@ plugins { } repositories { - maven { url "https://jitpack.io" } + maven { url "https://repo.codemc.org/repository/maven-public" } } dependencies { compile project(':worldedit-core') compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT' - compile 'org.bstats.bStats-Metrics:bstats-sponge:1.3' + compile 'org.bstats:bstats-sponge:1.4' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' } @@ -42,7 +42,7 @@ jar { shadowJar { dependencies { include(dependency(':worldedit-core')) - include(dependency('org.bstats.bStats-Metrics:bstats-sponge:1.3')) + include(dependency('org.bstats:bstats-sponge:1.4')) } } From 24800a662a4963cdf839d6906694355c41b983a9 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 12 Nov 2018 12:38:13 +1000 Subject: [PATCH 043/182] Finish removal of PlayerDirection, and partially added diagonal support back to commands. --- .../com/sk89q/worldedit/PlayerDirection.java | 59 - .../java/com/sk89q/worldedit/WorldEdit.java | 1387 +++++++++-------- .../worldedit/command/RegionCommands.java | 4 +- .../com/sk89q/worldedit/entity/Player.java | 6 +- .../platform/AbstractPlayerActor.java | 30 +- .../internal/annotation/Direction.java | 1 + .../internal/command/WorldEditBinding.java | 6 +- 7 files changed, 727 insertions(+), 766 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java deleted file mode 100644 index c751ffbbb..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.util.Direction; - -/** - * The player's direction. - * - *

    In the future, this class will be replaced with {@link Direction}.

    - */ -public enum PlayerDirection { - - NORTH(Vector3.at(0, 0, -1), true), - NORTH_EAST((Vector3.at(1, 0, -1)).normalize(), false), - EAST(Vector3.at(1, 0, 0), true), - SOUTH_EAST((Vector3.at(1, 0, 1)).normalize(), false), - SOUTH(Vector3.at(0, 0, 1), true), - SOUTH_WEST((Vector3.at(-1, 0, 1)).normalize(), false), - WEST(Vector3.at(-1, 0, 0), true), - NORTH_WEST((Vector3.at(-1, 0, -1)).normalize(), false), - UP(Vector3.at(0, 1, 0), true), - DOWN(Vector3.at(0, -1, 0), true); - - private final Vector3 dir; - private final boolean isOrthogonal; - - PlayerDirection(Vector3 vec, boolean isOrthogonal) { - this.dir = vec; - this.isOrthogonal = isOrthogonal; - } - - public Vector3 vector() { - return dir; - } - - public boolean isOrthogonal() { - return isOrthogonal; - } - -} 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 2f9232062..4952dea8f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -1,686 +1,701 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import static com.sk89q.worldedit.event.platform.Interaction.HIT; -import static com.sk89q.worldedit.event.platform.Interaction.OPEN; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.event.platform.BlockInteractEvent; -import com.sk89q.worldedit.event.platform.InputType; -import com.sk89q.worldedit.event.platform.PlayerInputEvent; -import com.sk89q.worldedit.extension.factory.BlockFactory; -import com.sk89q.worldedit.extension.factory.ItemFactory; -import com.sk89q.worldedit.extension.factory.MaskFactory; -import com.sk89q.worldedit.extension.factory.PatternFactory; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extension.platform.Capability; -import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.extension.platform.PlatformManager; -import com.sk89q.worldedit.extent.inventory.BlockBag; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.scripting.CraftScriptContext; -import com.sk89q.worldedit.scripting.CraftScriptEngine; -import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; -import com.sk89q.worldedit.session.SessionManager; -import com.sk89q.worldedit.session.request.Request; -import com.sk89q.worldedit.util.Location; -import com.sk89q.worldedit.util.eventbus.EventBus; -import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException; -import com.sk89q.worldedit.util.io.file.FilenameException; -import com.sk89q.worldedit.util.io.file.FilenameResolutionException; -import com.sk89q.worldedit.util.io.file.InvalidFilenameException; -import com.sk89q.worldedit.util.logging.WorldEditPrefixHandler; -import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.registry.BundledBlockData; -import com.sk89q.worldedit.world.registry.BundledItemData; -import com.sk89q.worldedit.world.registry.LegacyMapper; - -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.annotation.Nullable; -import javax.script.ScriptException; - -/** - * The entry point and container for a working implementation of WorldEdit. - * - *

    An instance handles event handling; block, mask, pattern, etc. registration; - * the management of sessions; the creation of {@link EditSession}s; and more. - * In order to use WorldEdit, at least one {@link Platform} must be registered - * with WorldEdit using {@link PlatformManager#register(Platform)} on the - * manager retrieved using {@link WorldEdit#getPlatformManager()}.

    - * - *

    An instance of WorldEdit can be retrieved using the static - * method {@link WorldEdit#getInstance()}, which is shared among all - * platforms within the same classloader hierarchy.

    - */ -public class WorldEdit { - - public static final Logger logger = Logger.getLogger(WorldEdit.class.getCanonicalName()); - - private final static WorldEdit instance = new WorldEdit(); - private static String version; - - private final EventBus eventBus = new EventBus(); - private final PlatformManager platformManager = new PlatformManager(this); - private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus); - private final SessionManager sessions = new SessionManager(this); - - private final BlockFactory blockFactory = new BlockFactory(this); - private final ItemFactory itemFactory = new ItemFactory(this); - private final MaskFactory maskFactory = new MaskFactory(this); - private final PatternFactory patternFactory = new PatternFactory(this); - - static { - WorldEditPrefixHandler.register("com.sk89q.worldedit"); - getVersion(); - } - - private WorldEdit() { - } - - /** - * Gets the current instance of this class. - * - *

    An instance will always be available, but no platform may yet be - * registered with WorldEdit, meaning that a number of operations - * may fail. However, event handlers can be registered.

    - * - * @return an instance of WorldEdit. - */ - public static WorldEdit getInstance() { - return instance; - } - - /** - * Get the platform manager, where platforms (that implement WorldEdit) - * can be registered and information about registered platforms can - * be queried. - * - * @return the platform manager - */ - public PlatformManager getPlatformManager() { - return platformManager; - } - - /** - * Get the event bus for WorldEdit. - * - *

    Event handlers can be registered on the event bus.

    - * - * @return the event bus - */ - public EventBus getEventBus() { - return eventBus; - } - - /** - * Get the block factory from which new {@link BlockStateHolder}s can be - * constructed. - * - * @return the block factory - */ - public BlockFactory getBlockFactory() { - return blockFactory; - } - - /** - * Get the item factory from which new {@link BaseItem}s can be - * constructed. - * - * @return the item factory - */ - public ItemFactory getItemFactory() { - return itemFactory; - } - - /** - * Get the mask factory from which new {@link Mask}s - * can be constructed. - * - * @return the mask factory - */ - public MaskFactory getMaskFactory() { - return maskFactory; - } - - /** - * Get the pattern factory from which new {@link Pattern}s - * can be constructed. - * - * @return the pattern factory - */ - public PatternFactory getPatternFactory() { - return patternFactory; - } - - /** - * Return the session manager. - * - * @return the session manager - */ - public SessionManager getSessionManager() { - return sessions; - } - - /** - * Gets the path to a file. This method will check to see if the filename - * has valid characters and has an extension. It also prevents directory - * traversal exploits by checking the root directory and the file directory. - * On success, a {@code java.io.File} object will be returned. - * - * @param player the player - * @param dir sub-directory to look in - * @param filename filename (user-submitted) - * @param defaultExt append an extension if missing one, null to not use - * @param extensions list of extensions, null for any - * @return a file - * @throws FilenameException thrown if the filename is invalid - */ - public File getSafeSaveFile(Player player, File dir, String filename, String defaultExt, String... extensions) throws FilenameException { - return getSafeFile(player, dir, filename, defaultExt, extensions, true); - } - - /** - * Gets the path to a file. This method will check to see if the filename - * has valid characters and has an extension. It also prevents directory - * traversal exploits by checking the root directory and the file directory. - * On success, a {@code java.io.File} object will be returned. - * - * @param player the player - * @param dir sub-directory to look in - * @param filename filename (user-submitted) - * @param defaultExt append an extension if missing one, null to not use - * @param extensions list of extensions, null for any - * @return a file - * @throws FilenameException thrown if the filename is invalid - */ - public File getSafeOpenFile(Player player, File dir, String filename, String defaultExt, String... extensions) throws FilenameException { - return getSafeFile(player, dir, filename, defaultExt, extensions, false); - } - - /** - * Get a safe path to a file. - * - * @param player the player - * @param dir sub-directory to look in - * @param filename filename (user-submitted) - * @param defaultExt append an extension if missing one, null to not use - * @param extensions list of extensions, null for any - * @param isSave true if the purpose is for saving - * @return a file - * @throws FilenameException thrown if the filename is invalid - */ - private File getSafeFile(@Nullable Player player, File dir, String filename, String defaultExt, String[] extensions, boolean isSave) throws FilenameException { - if (extensions != null && (extensions.length == 1 && extensions[0] == null)) extensions = null; - - File f; - - if (filename.equals("#") && player != null) { - if (isSave) { - f = player.openFileSaveDialog(extensions); - } else { - f = player.openFileOpenDialog(extensions); - } - - if (f == null) { - throw new FileSelectionAbortedException("No file selected"); - } - } else { - List exts = extensions == null ? ImmutableList.of(defaultExt) : Lists.asList(defaultExt, extensions); - return getSafeFileWithExtensions(dir, filename, exts, isSave); - } - - try { - String filePath = f.getCanonicalPath(); - String dirPath = dir.getCanonicalPath(); - - if (!filePath.substring(0, dirPath.length()).equals(dirPath) && !getConfiguration().allowSymlinks) { - throw new FilenameResolutionException(filename, - "Path is outside allowable root"); - } - - return f; - } catch (IOException e) { - throw new FilenameResolutionException(filename, - "Failed to resolve path"); - } - } - - private File getSafeFileWithExtensions(File dir, String filename, List exts, boolean isSave) throws InvalidFilenameException { - if (isSave) { - // First is default, only use that. - if (exts.size() != 1) { - exts = exts.subList(0, 1); - } - } - File result = null; - for (Iterator iter = exts.iterator(); iter.hasNext() && (result == null || !result.exists());) { - result = getSafeFileWithExtension(dir, filename, iter.next()); - } - if (result == null) { - throw new InvalidFilenameException(filename, "Invalid characters or extension missing"); - } - return result; - } - - private File getSafeFileWithExtension(File dir, String filename, String extension) { - if (extension != null && filename.lastIndexOf('.') == -1) { - filename += "." + extension; - } - - if (!checkFilename(filename)) { - return null; - } - - return new File(dir, filename); - } - - private boolean checkFilename(String filename) { - return filename.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+\\.[A-Za-z0-9]+$"); - } - - /** - * Load the bundled mappings. - */ - public void loadMappings() { - BundledBlockData.getInstance(); // Load block registry - BundledItemData.getInstance(); // Load item registry - LegacyMapper.getInstance(); // Load item registry - } - - /** - * Checks to see if the specified radius is within bounds. - * - * @param radius the radius - * @throws MaxRadiusException - */ - public void checkMaxRadius(double radius) throws MaxRadiusException { - if (getConfiguration().maxRadius > 0 && radius > getConfiguration().maxRadius) { - throw new MaxRadiusException(); - } - } - - /** - * Checks to see if the specified brush radius is within bounds. - * - * @param radius the radius - * @throws MaxBrushRadiusException - */ - public void checkMaxBrushRadius(double radius) throws MaxBrushRadiusException { - if (getConfiguration().maxBrushRadius > 0 && radius > getConfiguration().maxBrushRadius) { - throw new MaxBrushRadiusException(); - } - } - - /** - * Get a file relative to the defined working directory. If the specified - * path is absolute, then the working directory is not used. - * - * @param path the subpath under the working directory - * @return a working directory - */ - public File getWorkingDirectoryFile(String path) { - File f = new File(path); - if (f.isAbsolute()) { - return f; - } - - return new File(getConfiguration().getWorkingDirectory(), path); - } - - /** - * Get the direction vector for a player's direction. May return - * null if a direction could not be found. - * - * @param player the player - * @param dirStr the direction string - * @return a direction vector - * @throws UnknownDirectionException thrown if the direction is not known - */ - public BlockVector3 getDirection(Player player, String dirStr) throws UnknownDirectionException { - dirStr = dirStr.toLowerCase(); - - final PlayerDirection dir = getPlayerDirection(player, dirStr); - - switch (dir) { - case WEST: - case EAST: - case SOUTH: - case NORTH: - case UP: - case DOWN: - return dir.vector().toBlockPoint(); - - default: - throw new UnknownDirectionException(dir.name()); - } - } - - /** - * Get the direction vector for a player's direction. May return - * null if a direction could not be found. - * - * @param player the player - * @param dirStr the direction string - * @return a direction enum value - * @throws UnknownDirectionException thrown if the direction is not known - */ - private PlayerDirection getPlayerDirection(Player player, String dirStr) throws UnknownDirectionException { - final PlayerDirection dir; - - switch (dirStr.charAt(0)) { - case 'w': - dir = PlayerDirection.WEST; - break; - - case 'e': - dir = PlayerDirection.EAST; - break; - - case 's': - if (dirStr.indexOf('w') > 0) { - return PlayerDirection.SOUTH_WEST; - } - - if (dirStr.indexOf('e') > 0) { - return PlayerDirection.SOUTH_EAST; - } - dir = PlayerDirection.SOUTH; - break; - - case 'n': - if (dirStr.indexOf('w') > 0) { - return PlayerDirection.NORTH_WEST; - } - - if (dirStr.indexOf('e') > 0) { - return PlayerDirection.NORTH_EAST; - } - dir = PlayerDirection.NORTH; - break; - - case 'u': - dir = PlayerDirection.UP; - break; - - case 'd': - dir = PlayerDirection.DOWN; - break; - - case 'm': // me - case 'f': // forward - dir = player.getCardinalDirection(0); - break; - - case 'b': // back - dir = player.getCardinalDirection(180); - break; - - case 'l': // left - dir = player.getCardinalDirection(-90); - break; - - case 'r': // right - dir = player.getCardinalDirection(90); - break; - - default: - throw new UnknownDirectionException(dirStr); - } - return dir; - } - - /** - * Flush a block bag's changes to a player. - * - * @param actor the actor - * @param editSession the edit session - */ - public void flushBlockBag(Actor actor, EditSession editSession) { - BlockBag blockBag = editSession.getBlockBag(); - - if (blockBag != null) { - blockBag.flushChanges(); - } - - Map missingBlocks = editSession.popMissingBlocks(); - - if (!missingBlocks.isEmpty()) { - StringBuilder str = new StringBuilder(); - str.append("Missing these blocks: "); - int size = missingBlocks.size(); - int i = 0; - - for (Map.Entry blockTypeIntegerEntry : missingBlocks.entrySet()) { - str.append((blockTypeIntegerEntry.getKey()).getName()); - - str.append(" [Amt: ").append(blockTypeIntegerEntry.getValue()).append("]"); - - ++i; - - if (i != size) { - str.append(", "); - } - } - - actor.printError(str.toString()); - } - } - - /** - * Called on arm swing. - * - * @param player the player - * @return true if the swing was handled - */ - public boolean handleArmSwing(Player player) { - PlayerInputEvent event = new PlayerInputEvent(player, InputType.PRIMARY); - getEventBus().post(event); - return event.isCancelled(); - } - - /** - * Called on right click (not on a block). - * - * @param player the player - * @return true if the right click was handled - */ - public boolean handleRightClick(Player player) { - PlayerInputEvent event = new PlayerInputEvent(player, InputType.SECONDARY); - getEventBus().post(event); - return event.isCancelled(); - } - - /** - * Called on right click. - * - * @param player the player - * @param clicked the clicked block - * @return false if you want the action to go through - */ - public boolean handleBlockRightClick(Player player, Location clicked) { - BlockInteractEvent event = new BlockInteractEvent(player, clicked, OPEN); - getEventBus().post(event); - return event.isCancelled(); - } - - /** - * Called on left click. - * - * @param player the player - * @param clicked the clicked block - * @return false if you want the action to go through - */ - public boolean handleBlockLeftClick(Player player, Location clicked) { - BlockInteractEvent event = new BlockInteractEvent(player, clicked, HIT); - getEventBus().post(event); - return event.isCancelled(); - } - - /** - * Executes a WorldEdit script. - * - * @param player the player - * @param f the script file to execute - * @param args arguments for the script - * @throws WorldEditException - */ - public void runScript(Player player, File f, String[] args) throws WorldEditException { - Request.reset(); - - String filename = f.getPath(); - int index = filename.lastIndexOf('.'); - String ext = filename.substring(index + 1); - - if (!ext.equalsIgnoreCase("js")) { - player.printError("Only .js scripts are currently supported"); - return; - } - - String script; - - try { - InputStream file; - - if (!f.exists()) { - file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename); - - if (file == null) { - player.printError("Script does not exist: " + filename); - return; - } - } else { - file = new FileInputStream(f); - } - - DataInputStream in = new DataInputStream(file); - byte[] data = new byte[in.available()]; - in.readFully(data); - in.close(); - script = new String(data, 0, data.length, "utf-8"); - } catch (IOException e) { - player.printError("Script read error: " + e.getMessage()); - return; - } - - LocalSession session = getSessionManager().get(player); - CraftScriptContext scriptContext = new CraftScriptContext(this, getPlatformManager().queryCapability(Capability.USER_COMMANDS), - getConfiguration(), session, player, args); - - CraftScriptEngine engine; - - try { - engine = new RhinoCraftScriptEngine(); - } catch (NoClassDefFoundError e) { - player.printError("Failed to find an installed script engine."); - player.printError("Please see http://wiki.sk89q.com/wiki/WorldEdit/Installation"); - return; - } - - engine.setTimeLimit(getConfiguration().scriptTimeout); - - Map vars = new HashMap<>(); - vars.put("argv", args); - vars.put("context", scriptContext); - vars.put("player", player); - - try { - engine.evaluate(script, filename, vars); - } catch (ScriptException e) { - player.printError("Failed to execute:"); - player.printRaw(e.getMessage()); - logger.log(Level.WARNING, "Failed to execute script", e); - } catch (NumberFormatException | WorldEditException e) { - throw e; - } catch (Throwable e) { - player.printError("Failed to execute (see console):"); - player.printRaw(e.getClass().getCanonicalName()); - logger.log(Level.WARNING, "Failed to execute script", e); - } finally { - for (EditSession editSession : scriptContext.getEditSessions()) { - editSession.flushSession(); - session.remember(editSession); - } - } - } - - /** - * Get Worldedit's configuration. - * - * @return a configuration - */ - public LocalConfiguration getConfiguration() { - return getPlatformManager().getConfiguration(); - } - - /** - * Get a factory for {@link EditSession}s. - */ - public EditSessionFactory getEditSessionFactory() { - return editSessionFactory; - } - - /** - * Get the version. - * - * @return the version of WorldEdit - */ - public static String getVersion() { - if (version != null) { - return version; - } - - Package p = WorldEdit.class.getPackage(); - - if (p == null) { - p = Package.getPackage("com.sk89q.worldedit"); - } - - if (p == null) { - version = "(unknown)"; - } else { - version = p.getImplementationVersion(); - - if (version == null) { - version = "(unknown)"; - } - } - - return version; - } - -} +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit; + +import static com.sk89q.worldedit.event.platform.Interaction.HIT; +import static com.sk89q.worldedit.event.platform.Interaction.OPEN; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.sk89q.worldedit.blocks.BaseItem; +import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.event.platform.BlockInteractEvent; +import com.sk89q.worldedit.event.platform.InputType; +import com.sk89q.worldedit.event.platform.PlayerInputEvent; +import com.sk89q.worldedit.extension.factory.BlockFactory; +import com.sk89q.worldedit.extension.factory.ItemFactory; +import com.sk89q.worldedit.extension.factory.MaskFactory; +import com.sk89q.worldedit.extension.factory.PatternFactory; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.extension.platform.PlatformManager; +import com.sk89q.worldedit.extent.inventory.BlockBag; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.scripting.CraftScriptContext; +import com.sk89q.worldedit.scripting.CraftScriptEngine; +import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; +import com.sk89q.worldedit.session.SessionManager; +import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.util.Direction; +import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.util.eventbus.EventBus; +import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException; +import com.sk89q.worldedit.util.io.file.FilenameException; +import com.sk89q.worldedit.util.io.file.FilenameResolutionException; +import com.sk89q.worldedit.util.io.file.InvalidFilenameException; +import com.sk89q.worldedit.util.logging.WorldEditPrefixHandler; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.registry.BundledBlockData; +import com.sk89q.worldedit.world.registry.BundledItemData; +import com.sk89q.worldedit.world.registry.LegacyMapper; + +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.annotation.Nullable; +import javax.script.ScriptException; + +/** + * The entry point and container for a working implementation of WorldEdit. + * + *

    An instance handles event handling; block, mask, pattern, etc. registration; + * the management of sessions; the creation of {@link EditSession}s; and more. + * In order to use WorldEdit, at least one {@link Platform} must be registered + * with WorldEdit using {@link PlatformManager#register(Platform)} on the + * manager retrieved using {@link WorldEdit#getPlatformManager()}.

    + * + *

    An instance of WorldEdit can be retrieved using the static + * method {@link WorldEdit#getInstance()}, which is shared among all + * platforms within the same classloader hierarchy.

    + */ +public class WorldEdit { + + public static final Logger logger = Logger.getLogger(WorldEdit.class.getCanonicalName()); + + private final static WorldEdit instance = new WorldEdit(); + private static String version; + + private final EventBus eventBus = new EventBus(); + private final PlatformManager platformManager = new PlatformManager(this); + private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus); + private final SessionManager sessions = new SessionManager(this); + + private final BlockFactory blockFactory = new BlockFactory(this); + private final ItemFactory itemFactory = new ItemFactory(this); + private final MaskFactory maskFactory = new MaskFactory(this); + private final PatternFactory patternFactory = new PatternFactory(this); + + static { + WorldEditPrefixHandler.register("com.sk89q.worldedit"); + getVersion(); + } + + private WorldEdit() { + } + + /** + * Gets the current instance of this class. + * + *

    An instance will always be available, but no platform may yet be + * registered with WorldEdit, meaning that a number of operations + * may fail. However, event handlers can be registered.

    + * + * @return an instance of WorldEdit. + */ + public static WorldEdit getInstance() { + return instance; + } + + /** + * Get the platform manager, where platforms (that implement WorldEdit) + * can be registered and information about registered platforms can + * be queried. + * + * @return the platform manager + */ + public PlatformManager getPlatformManager() { + return platformManager; + } + + /** + * Get the event bus for WorldEdit. + * + *

    Event handlers can be registered on the event bus.

    + * + * @return the event bus + */ + public EventBus getEventBus() { + return eventBus; + } + + /** + * Get the block factory from which new {@link BlockStateHolder}s can be + * constructed. + * + * @return the block factory + */ + public BlockFactory getBlockFactory() { + return blockFactory; + } + + /** + * Get the item factory from which new {@link BaseItem}s can be + * constructed. + * + * @return the item factory + */ + public ItemFactory getItemFactory() { + return itemFactory; + } + + /** + * Get the mask factory from which new {@link Mask}s + * can be constructed. + * + * @return the mask factory + */ + public MaskFactory getMaskFactory() { + return maskFactory; + } + + /** + * Get the pattern factory from which new {@link Pattern}s + * can be constructed. + * + * @return the pattern factory + */ + public PatternFactory getPatternFactory() { + return patternFactory; + } + + /** + * Return the session manager. + * + * @return the session manager + */ + public SessionManager getSessionManager() { + return sessions; + } + + /** + * Gets the path to a file. This method will check to see if the filename + * has valid characters and has an extension. It also prevents directory + * traversal exploits by checking the root directory and the file directory. + * On success, a {@code java.io.File} object will be returned. + * + * @param player the player + * @param dir sub-directory to look in + * @param filename filename (user-submitted) + * @param defaultExt append an extension if missing one, null to not use + * @param extensions list of extensions, null for any + * @return a file + * @throws FilenameException thrown if the filename is invalid + */ + public File getSafeSaveFile(Player player, File dir, String filename, String defaultExt, String... extensions) throws FilenameException { + return getSafeFile(player, dir, filename, defaultExt, extensions, true); + } + + /** + * Gets the path to a file. This method will check to see if the filename + * has valid characters and has an extension. It also prevents directory + * traversal exploits by checking the root directory and the file directory. + * On success, a {@code java.io.File} object will be returned. + * + * @param player the player + * @param dir sub-directory to look in + * @param filename filename (user-submitted) + * @param defaultExt append an extension if missing one, null to not use + * @param extensions list of extensions, null for any + * @return a file + * @throws FilenameException thrown if the filename is invalid + */ + public File getSafeOpenFile(Player player, File dir, String filename, String defaultExt, String... extensions) throws FilenameException { + return getSafeFile(player, dir, filename, defaultExt, extensions, false); + } + + /** + * Get a safe path to a file. + * + * @param player the player + * @param dir sub-directory to look in + * @param filename filename (user-submitted) + * @param defaultExt append an extension if missing one, null to not use + * @param extensions list of extensions, null for any + * @param isSave true if the purpose is for saving + * @return a file + * @throws FilenameException thrown if the filename is invalid + */ + private File getSafeFile(@Nullable Player player, File dir, String filename, String defaultExt, String[] extensions, boolean isSave) throws FilenameException { + if (extensions != null && (extensions.length == 1 && extensions[0] == null)) extensions = null; + + File f; + + if (filename.equals("#") && player != null) { + if (isSave) { + f = player.openFileSaveDialog(extensions); + } else { + f = player.openFileOpenDialog(extensions); + } + + if (f == null) { + throw new FileSelectionAbortedException("No file selected"); + } + } else { + List exts = extensions == null ? ImmutableList.of(defaultExt) : Lists.asList(defaultExt, extensions); + return getSafeFileWithExtensions(dir, filename, exts, isSave); + } + + try { + String filePath = f.getCanonicalPath(); + String dirPath = dir.getCanonicalPath(); + + if (!filePath.substring(0, dirPath.length()).equals(dirPath) && !getConfiguration().allowSymlinks) { + throw new FilenameResolutionException(filename, + "Path is outside allowable root"); + } + + return f; + } catch (IOException e) { + throw new FilenameResolutionException(filename, + "Failed to resolve path"); + } + } + + private File getSafeFileWithExtensions(File dir, String filename, List exts, boolean isSave) throws InvalidFilenameException { + if (isSave) { + // First is default, only use that. + if (exts.size() != 1) { + exts = exts.subList(0, 1); + } + } + File result = null; + for (Iterator iter = exts.iterator(); iter.hasNext() && (result == null || !result.exists());) { + result = getSafeFileWithExtension(dir, filename, iter.next()); + } + if (result == null) { + throw new InvalidFilenameException(filename, "Invalid characters or extension missing"); + } + return result; + } + + private File getSafeFileWithExtension(File dir, String filename, String extension) { + if (extension != null && filename.lastIndexOf('.') == -1) { + filename += "." + extension; + } + + if (!checkFilename(filename)) { + return null; + } + + return new File(dir, filename); + } + + private boolean checkFilename(String filename) { + return filename.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+\\.[A-Za-z0-9]+$"); + } + + /** + * Load the bundled mappings. + */ + public void loadMappings() { + BundledBlockData.getInstance(); // Load block registry + BundledItemData.getInstance(); // Load item registry + LegacyMapper.getInstance(); // Load item registry + } + + /** + * Checks to see if the specified radius is within bounds. + * + * @param radius the radius + * @throws MaxRadiusException + */ + public void checkMaxRadius(double radius) throws MaxRadiusException { + if (getConfiguration().maxRadius > 0 && radius > getConfiguration().maxRadius) { + throw new MaxRadiusException(); + } + } + + /** + * Checks to see if the specified brush radius is within bounds. + * + * @param radius the radius + * @throws MaxBrushRadiusException + */ + public void checkMaxBrushRadius(double radius) throws MaxBrushRadiusException { + if (getConfiguration().maxBrushRadius > 0 && radius > getConfiguration().maxBrushRadius) { + throw new MaxBrushRadiusException(); + } + } + + /** + * Get a file relative to the defined working directory. If the specified + * path is absolute, then the working directory is not used. + * + * @param path the subpath under the working directory + * @return a working directory + */ + public File getWorkingDirectoryFile(String path) { + File f = new File(path); + if (f.isAbsolute()) { + return f; + } + + return new File(getConfiguration().getWorkingDirectory(), path); + } + + /** + * Get the direction vector for a player's direction. May return + * null if a direction could not be found. + * + * @param player the player + * @param dirStr the direction string + * @return a direction vector + * @throws UnknownDirectionException thrown if the direction is not known + */ + public BlockVector3 getDirection(Player player, String dirStr) throws UnknownDirectionException { + dirStr = dirStr.toLowerCase(); + + final Direction dir = getPlayerDirection(player, dirStr); + + if (dir.isUpright() || dir.isCardinal()) { + return dir.toBlockVector(); + } else { + throw new UnknownDirectionException(dir.name()); + } + } + + /** + * Get the direction vector for a player's direction. May return + * null if a direction could not be found. + * + * @param player the player + * @param dirStr the direction string + * @return a direction vector + * @throws UnknownDirectionException thrown if the direction is not known + */ + public BlockVector3 getDiagonalDirection(Player player, String dirStr) throws UnknownDirectionException { + dirStr = dirStr.toLowerCase(); + + final Direction dir = getPlayerDirection(player, dirStr); + + if (dir.isCardinal() || dir.isOrdinal() || dir.isUpright()) { + return dir.toBlockVector(); + } + + throw new UnknownDirectionException(dir.name()); + } + + /** + * Get the direction vector for a player's direction. May return + * null if a direction could not be found. + * + * @param player the player + * @param dirStr the direction string + * @return a direction enum value + * @throws UnknownDirectionException thrown if the direction is not known + */ + private Direction getPlayerDirection(Player player, String dirStr) throws UnknownDirectionException { + final Direction dir; + + switch (dirStr.charAt(0)) { + case 'w': + dir = Direction.WEST; + break; + + case 'e': + dir = Direction.EAST; + break; + + case 's': + if (dirStr.indexOf('w') > 0) { + return Direction.SOUTHWEST; + } + + if (dirStr.indexOf('e') > 0) { + return Direction.SOUTHEAST; + } + dir = Direction.SOUTH; + break; + + case 'n': + if (dirStr.indexOf('w') > 0) { + return Direction.NORTHWEST; + } + + if (dirStr.indexOf('e') > 0) { + return Direction.NORTHEAST; + } + dir = Direction.NORTH; + break; + + case 'u': + dir = Direction.UP; + break; + + case 'd': + dir = Direction.DOWN; + break; + + case 'm': // me + case 'f': // forward + dir = player.getCardinalDirection(0); + break; + + case 'b': // back + dir = player.getCardinalDirection(180); + break; + + case 'l': // left + dir = player.getCardinalDirection(-90); + break; + + case 'r': // right + dir = player.getCardinalDirection(90); + break; + + default: + throw new UnknownDirectionException(dirStr); + } + return dir; + } + + /** + * Flush a block bag's changes to a player. + * + * @param actor the actor + * @param editSession the edit session + */ + public void flushBlockBag(Actor actor, EditSession editSession) { + BlockBag blockBag = editSession.getBlockBag(); + + if (blockBag != null) { + blockBag.flushChanges(); + } + + Map missingBlocks = editSession.popMissingBlocks(); + + if (!missingBlocks.isEmpty()) { + StringBuilder str = new StringBuilder(); + str.append("Missing these blocks: "); + int size = missingBlocks.size(); + int i = 0; + + for (Map.Entry blockTypeIntegerEntry : missingBlocks.entrySet()) { + str.append((blockTypeIntegerEntry.getKey()).getName()); + + str.append(" [Amt: ").append(blockTypeIntegerEntry.getValue()).append("]"); + + ++i; + + if (i != size) { + str.append(", "); + } + } + + actor.printError(str.toString()); + } + } + + /** + * Called on arm swing. + * + * @param player the player + * @return true if the swing was handled + */ + public boolean handleArmSwing(Player player) { + PlayerInputEvent event = new PlayerInputEvent(player, InputType.PRIMARY); + getEventBus().post(event); + return event.isCancelled(); + } + + /** + * Called on right click (not on a block). + * + * @param player the player + * @return true if the right click was handled + */ + public boolean handleRightClick(Player player) { + PlayerInputEvent event = new PlayerInputEvent(player, InputType.SECONDARY); + getEventBus().post(event); + return event.isCancelled(); + } + + /** + * Called on right click. + * + * @param player the player + * @param clicked the clicked block + * @return false if you want the action to go through + */ + public boolean handleBlockRightClick(Player player, Location clicked) { + BlockInteractEvent event = new BlockInteractEvent(player, clicked, OPEN); + getEventBus().post(event); + return event.isCancelled(); + } + + /** + * Called on left click. + * + * @param player the player + * @param clicked the clicked block + * @return false if you want the action to go through + */ + public boolean handleBlockLeftClick(Player player, Location clicked) { + BlockInteractEvent event = new BlockInteractEvent(player, clicked, HIT); + getEventBus().post(event); + return event.isCancelled(); + } + + /** + * Executes a WorldEdit script. + * + * @param player the player + * @param f the script file to execute + * @param args arguments for the script + * @throws WorldEditException + */ + public void runScript(Player player, File f, String[] args) throws WorldEditException { + Request.reset(); + + String filename = f.getPath(); + int index = filename.lastIndexOf('.'); + String ext = filename.substring(index + 1); + + if (!ext.equalsIgnoreCase("js")) { + player.printError("Only .js scripts are currently supported"); + return; + } + + String script; + + try { + InputStream file; + + if (!f.exists()) { + file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename); + + if (file == null) { + player.printError("Script does not exist: " + filename); + return; + } + } else { + file = new FileInputStream(f); + } + + DataInputStream in = new DataInputStream(file); + byte[] data = new byte[in.available()]; + in.readFully(data); + in.close(); + script = new String(data, 0, data.length, "utf-8"); + } catch (IOException e) { + player.printError("Script read error: " + e.getMessage()); + return; + } + + LocalSession session = getSessionManager().get(player); + CraftScriptContext scriptContext = new CraftScriptContext(this, getPlatformManager().queryCapability(Capability.USER_COMMANDS), + getConfiguration(), session, player, args); + + CraftScriptEngine engine; + + try { + engine = new RhinoCraftScriptEngine(); + } catch (NoClassDefFoundError e) { + player.printError("Failed to find an installed script engine."); + player.printError("Please see http://wiki.sk89q.com/wiki/WorldEdit/Installation"); + return; + } + + engine.setTimeLimit(getConfiguration().scriptTimeout); + + Map vars = new HashMap<>(); + vars.put("argv", args); + vars.put("context", scriptContext); + vars.put("player", player); + + try { + engine.evaluate(script, filename, vars); + } catch (ScriptException e) { + player.printError("Failed to execute:"); + player.printRaw(e.getMessage()); + logger.log(Level.WARNING, "Failed to execute script", e); + } catch (NumberFormatException | WorldEditException e) { + throw e; + } catch (Throwable e) { + player.printError("Failed to execute (see console):"); + player.printRaw(e.getClass().getCanonicalName()); + logger.log(Level.WARNING, "Failed to execute script", e); + } finally { + for (EditSession editSession : scriptContext.getEditSessions()) { + editSession.flushSession(); + session.remember(editSession); + } + } + } + + /** + * Get Worldedit's configuration. + * + * @return a configuration + */ + public LocalConfiguration getConfiguration() { + return getPlatformManager().getConfiguration(); + } + + /** + * Get a factory for {@link EditSession}s. + */ + public EditSessionFactory getEditSessionFactory() { + return editSessionFactory; + } + + /** + * Get the version. + * + * @return the version of WorldEdit + */ + public static String getVersion() { + if (version != null) { + return version; + } + + Package p = WorldEdit.class.getPackage(); + + if (p == null) { + p = Package.getPackage("com.sk89q.worldedit"); + } + + if (p == null) { + version = "(unknown)"; + } else { + version = p.getImplementationVersion(); + + if (version == null) { + version = "(unknown)"; + } + } + + return version; + } + +} 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 9eb113c09..28851dfc1 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 @@ -275,7 +275,7 @@ public class RegionCommands { public void move(Player player, EditSession editSession, LocalSession session, @Selection Region region, @Optional("1") @Range(min = 1) int count, - @Optional(Direction.AIM) @Direction BlockVector3 direction, + @Optional(Direction.AIM) @Direction(includeDiagonals = true) BlockVector3 direction, @Optional("air") BlockStateHolder replace, @Switch('s') boolean moveSelection) throws WorldEditException { @@ -313,7 +313,7 @@ public class RegionCommands { public void stack(Player player, EditSession editSession, LocalSession session, @Selection Region region, @Optional("1") @Range(min = 1) int count, - @Optional(Direction.AIM) @Direction BlockVector3 direction, + @Optional(Direction.AIM) @Direction(includeDiagonals = true) BlockVector3 direction, @Switch('s') boolean moveSelection, @Switch('a') boolean ignoreAirBlocks) throws WorldEditException { int affected = editSession.stackCuboidRegion(region, direction, count, !ignoreAirBlocks); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java index 4b8b4483f..4000d655f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.entity; -import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; +import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; @@ -60,7 +60,7 @@ public interface Player extends Entity, Actor { * * @return the direction */ - PlayerDirection getCardinalDirection(int yawOffset); + Direction getCardinalDirection(int yawOffset); /** * Get the item that the player is holding. @@ -240,7 +240,7 @@ public interface Player extends Entity, Actor { * * @return the direction */ - PlayerDirection getCardinalDirection(); + Direction getCardinalDirection(); /** * Pass through the wall that you are looking at. 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 36089755d..51e8b2190 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 @@ -20,13 +20,13 @@ package com.sk89q.worldedit.extension.platform; import com.sk89q.worldedit.NotABlockException; -import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; +import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TargetBlock; @@ -61,25 +61,25 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { * @param rot yaw * @return the direction */ - private static PlayerDirection getDirection(double rot) { + private static Direction getDirection(double rot) { if (0 <= rot && rot < 22.5) { - return PlayerDirection.SOUTH; + return Direction.SOUTH; } else if (22.5 <= rot && rot < 67.5) { - return PlayerDirection.SOUTH_WEST; + return Direction.SOUTHWEST; } else if (67.5 <= rot && rot < 112.5) { - return PlayerDirection.WEST; + return Direction.WEST; } else if (112.5 <= rot && rot < 157.5) { - return PlayerDirection.NORTH_WEST; + return Direction.NORTHWEST; } else if (157.5 <= rot && rot < 202.5) { - return PlayerDirection.NORTH; + return Direction.NORTH; } else if (202.5 <= rot && rot < 247.5) { - return PlayerDirection.NORTH_EAST; + return Direction.NORTHEAST; } else if (247.5 <= rot && rot < 292.5) { - return PlayerDirection.EAST; + return Direction.EAST; } else if (292.5 <= rot && rot < 337.5) { - return PlayerDirection.SOUTH_EAST; + return Direction.SOUTHEAST; } else if (337.5 <= rot && rot < 360.0) { - return PlayerDirection.SOUTH; + return Direction.SOUTH; } else { return null; } @@ -345,17 +345,17 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { } @Override - public PlayerDirection getCardinalDirection() { + public Direction getCardinalDirection() { return getCardinalDirection(0); } @Override - public PlayerDirection getCardinalDirection(int yawOffset) { + public Direction getCardinalDirection(int yawOffset) { if (getLocation().getPitch() > 67.5) { - return PlayerDirection.DOWN; + return Direction.DOWN; } if (getLocation().getPitch() < -67.5) { - return PlayerDirection.UP; + return Direction.UP; } // From hey0's code diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java index 7f42b3a36..dbc7d3b29 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java @@ -35,4 +35,5 @@ public @interface Direction { String AIM = "me"; + boolean includeDiagonals() default false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index 4cdebe5cb..86c550f9f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -264,7 +264,11 @@ public class WorldEditBinding extends BindingHelper { public BlockVector3 getDirection(ArgumentStack context, Direction direction) throws ParameterException, UnknownDirectionException { Player sender = getPlayer(context); - return worldEdit.getDirection(sender, context.next()); + if (direction.includeDiagonals()) { + return worldEdit.getDiagonalDirection(sender, context.next()); + } else { + return worldEdit.getDirection(sender, context.next()); + } } /** From 2dc9321da65691279cbc3b65a443da108743ac8c Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 17 Nov 2018 12:00:19 +1000 Subject: [PATCH 044/182] Added support for axis rotations. --- .../transform/BlockTransformExtent.java | 46 ++++++++++++++++--- .../com/sk89q/worldedit/util/Direction.java | 20 ++++++++ 2 files changed, 59 insertions(+), 7 deletions(-) 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 b0ecc66ae..ac6858cc5 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 @@ -30,6 +30,7 @@ import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.registry.state.BooleanProperty; import com.sk89q.worldedit.registry.state.DirectionalProperty; +import com.sk89q.worldedit.registry.state.EnumProperty; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.block.BaseBlock; @@ -49,8 +50,6 @@ import javax.annotation.Nullable; */ public class BlockTransformExtent extends AbstractDelegateExtent { - private static final double RIGHT_ANGLE = Math.toRadians(90); - private final Transform transform; /** @@ -129,15 +128,48 @@ public class BlockTransformExtent extends AbstractDelegateExtent { List properties = block.getBlockType().getProperties(); - for (Property property : properties) { + for (Property property : properties) { if (property instanceof DirectionalProperty) { Direction value = (Direction) block.getState(property); if (value != null) { - Vector3 newValue = getNewStateValue((DirectionalProperty) property, transform, value.toVector()); + Vector3 newValue = getNewStateValue((List) property.getValues(), transform, value.toVector()); if (newValue != null) { changedBlock = (T) changedBlock.with(property, Direction.findClosest(newValue, Direction.Flag.ALL)); } } + } else if (property instanceof EnumProperty) { + if (property.getName().equals("axis")) { + // We have an axis - this is something we can do the rotations to :sunglasses: + Direction value = null; + switch ((String) block.getState(property)) { + case "x": + value = Direction.EAST; + break; + case "y": + value = Direction.UP; + break; + case "z": + value = Direction.NORTH; + break; + } + if (value != null) { + Vector3 newValue = getNewStateValue(Direction.valuesOf(Direction.Flag.UPRIGHT | Direction.Flag.CARDINAL), transform, value.toVector()); + if (newValue != null) { + String axis = null; + Direction newDir = Direction.findClosest(newValue, Direction.Flag.UPRIGHT | Direction.Flag.CARDINAL); + if (newDir == Direction.NORTH || newDir == Direction.SOUTH) { + axis = "z"; + } else if (newDir == Direction.EAST || newDir == Direction.WEST) { + axis = "x"; + } else if (newDir == Direction.UP || newDir == Direction.DOWN) { + axis = "y"; + } + if (axis != null) { + changedBlock = (T) changedBlock.with(property, axis); + } + } + } + } } } @@ -166,19 +198,19 @@ public class BlockTransformExtent extends AbstractDelegateExtent { /** * Get the new value with the transformed direction. * - * @param state the state + * @param allowedStates the allowed states * @param transform the transform * @param oldDirection the old direction to transform * @return a new state or null if none could be found */ @Nullable - private static Vector3 getNewStateValue(DirectionalProperty state, Transform transform, Vector3 oldDirection) { + private static Vector3 getNewStateValue(List allowedStates, Transform transform, Vector3 oldDirection) { Vector3 newDirection = transform.apply(oldDirection).subtract(transform.apply(Vector3.ZERO)).normalize(); Vector3 newValue = null; double closest = -2; boolean found = false; - for (Direction v : state.getValues()) { + for (Direction v : allowedStates) { double dot = v.toVector().normalize().dot(newDirection); if (dot >= closest) { closest = dot; 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 940bbe3e6..59bb6c789 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 @@ -22,6 +22,9 @@ package com.sk89q.worldedit.util; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; +import java.util.ArrayList; +import java.util.List; + import javax.annotation.Nullable; /** @@ -150,6 +153,23 @@ public enum Direction { return closest; } + /** + * Gets all directions with the given flags. + * + * @param flags The flags + * @return The directions that fit the flags + */ + public static List valuesOf(int flags) { + List directions = new ArrayList<>(); + for (Direction direction : values()) { + if ((~flags & direction.flags) == 0) { + directions.add(direction); + } + } + + return directions; + } + /** * Flags to use with {@link #findClosest(Vector3, int)}. */ From e0dcd2e9c2c77308ca64a55027691aca65f4e52f Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 18 Nov 2018 14:28:37 +1000 Subject: [PATCH 045/182] Disable signing task when not signing. --- worldedit-sponge/build.gradle | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index d802993e9..d7deee85b 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -8,7 +8,6 @@ buildscript { } plugins { - id 'signing' id 'org.spongepowered.plugin' version '0.9.0' } @@ -50,8 +49,12 @@ artifacts { archives shadowJar } -signing { - required false - sign shadowJar - artifactoryPublish.skip = true +if (project.hasProperty("signing")) { + apply plugin: 'signing' + + signing { + sign shadowJar + } + + build.dependsOn('signShadowJar') } \ No newline at end of file From ee8602b77beeac093700f7db6aa8312cbbdffcb7 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 18 Nov 2018 15:58:15 +1000 Subject: [PATCH 046/182] Added a Vault resolver to WEPIF. Means any Vault-enabled perm plugin will theoretically work with it --- config/checkstyle/import-control.xml | 1 + worldedit-bukkit/build.gradle | 2 + .../wepif/PermissionsResolverManager.java | 7 +- .../java/com/sk89q/wepif/VaultResolver.java | 116 ++++++++++++++++++ 4 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java diff --git a/config/checkstyle/import-control.xml b/config/checkstyle/import-control.xml index 2fe94d97d..8b40e60d5 100644 --- a/config/checkstyle/import-control.xml +++ b/config/checkstyle/import-control.xml @@ -30,6 +30,7 @@ + diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 680926ac6..050ee45f9 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -6,6 +6,7 @@ repositories { maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } maven { url "https://repo.codemc.org/repository/maven-public" } maven { url 'https://papermc.io/repo/repository/maven-public/' } + maven { url "http://nexus.hc.to/content/repositories/pub_releases" } } dependencies { @@ -14,6 +15,7 @@ dependencies { compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz compile 'org.bstats:bstats-bukkit:1.4' compile "io.papermc:paperlib:1.0.1" + compileOnly "net.milkbowl.vault:VaultAPI:1.7" testCompile 'org.mockito:mockito-core:1.9.0-rc1' } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java index 01f04546b..4775d86c4 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java @@ -95,6 +95,7 @@ public class PermissionsResolverManager implements PermissionsResolver { bPermissionsResolver.class, GroupManagerResolver.class, NijiPermissionsResolver.class, + VaultResolver.class, DinnerPermsResolver.class, FlatFilePermissionsResolver.class }; @@ -283,7 +284,8 @@ public class PermissionsResolverManager implements PermissionsResolver { if (plugin instanceof PermissionsProvider) { setPluginPermissionsResolver(plugin); } else if ("permissions".equalsIgnoreCase(name) || "permissionsex".equalsIgnoreCase(name) - || "bpermissions".equalsIgnoreCase(name) || "groupmanager".equalsIgnoreCase(name)) { + || "bpermissions".equalsIgnoreCase(name) || "groupmanager".equalsIgnoreCase(name) + || "vault".equalsIgnoreCase(name)) { load(); } } @@ -294,7 +296,8 @@ public class PermissionsResolverManager implements PermissionsResolver { if (event.getPlugin() instanceof PermissionsProvider || "permissions".equalsIgnoreCase(name) || "permissionsex".equalsIgnoreCase(name) - || "bpermissions".equalsIgnoreCase(name) || "groupmanager".equalsIgnoreCase(name)) { + || "bpermissions".equalsIgnoreCase(name) || "groupmanager".equalsIgnoreCase(name) + || "vault".equalsIgnoreCase(name)) { load(); } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java new file mode 100644 index 000000000..f20087196 --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java @@ -0,0 +1,116 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.wepif; + +import com.sk89q.util.yaml.YAMLProcessor; +import net.milkbowl.vault.permission.Permission; +import org.bukkit.OfflinePlayer; +import org.bukkit.Server; +import org.bukkit.entity.Player; +import org.bukkit.plugin.RegisteredServiceProvider; + +public class VaultResolver implements PermissionsResolver { + + private static Permission perms = null; + + public static PermissionsResolver factory(Server server, YAMLProcessor config) { + if (server.getPluginManager().getPlugin("Vault") == null) { + return null; + } + RegisteredServiceProvider rsp = server.getServicesManager().getRegistration(Permission.class); + perms = rsp.getProvider(); + if (perms == null) { + return null; + } + + return new VaultResolver(server); + } + + private final Server server; + + public VaultResolver(Server server) { + this.server = server; + } + + @Override + public void load() { + } + + @Override + public String getDetectionMessage() { + return "Vault detected! Using Vault for permissions"; + } + + @Override + public boolean hasPermission(String name, String permission) { + return hasPermission(server.getOfflinePlayer(name), permission); + } + + @Override + public boolean hasPermission(String worldName, String name, String permission) { + return hasPermission(worldName, server.getOfflinePlayer(name), permission); + } + + @Override + public boolean inGroup(String player, String group) { + return inGroup(server.getOfflinePlayer(player), group); + } + + @Override + public String[] getGroups(String player) { + return getGroups(server.getOfflinePlayer(player)); + } + + @Override + public boolean hasPermission(OfflinePlayer player, String permission) { + Player onlinePlayer = player.getPlayer(); + if (onlinePlayer == null) { + return perms.playerHas(null, player, permission); + } else { + return perms.playerHas(onlinePlayer.getWorld().getName(), player, permission); + } + } + + @Override + public boolean hasPermission(String worldName, OfflinePlayer player, String permission) { + return hasPermission(worldName, player.getName(), permission); + } + + @Override + public boolean inGroup(OfflinePlayer player, String group) { + Player onlinePlayer = player.getPlayer(); + if (onlinePlayer == null) { + return perms.playerInGroup(null, player, group); + } else { + return perms.playerInGroup(onlinePlayer, group); + } + } + + @Override + public String[] getGroups(OfflinePlayer player) { + Player onlinePlayer = player.getPlayer(); + if (onlinePlayer == null) { + return perms.getPlayerGroups(null, player); + } else { + return perms.getPlayerGroups(onlinePlayer); + } + } + +} From 7ae310e62536edbf1091ad5307afbb5412227131 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 28 Nov 2018 20:25:14 +1000 Subject: [PATCH 047/182] Bump to beta 2 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6b63f5caf..594a733a8 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ println """ allprojects { group = 'com.sk89q.worldedit' - version = '7.0.0-SNAPSHOT' + version = '7.0.0-beta-02' } if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost" From 7ad181f8a423e8ee342cb01ee2092a47d25b59a8 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 28 Nov 2018 20:31:30 +1000 Subject: [PATCH 048/182] Back to snapshot for continued development --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 594a733a8..6b63f5caf 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ println """ allprojects { group = 'com.sk89q.worldedit' - version = '7.0.0-beta-02' + version = '7.0.0-SNAPSHOT' } if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost" From b192466ce21b2c237587baa8721331f8306f5e17 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Fri, 30 Nov 2018 13:15:05 -0800 Subject: [PATCH 049/182] Remove recursion in VaultResolver Correctly call into `perms` instead of creating an infinite recursion. --- .../src/main/java/com/sk89q/wepif/VaultResolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java index f20087196..a97017ceb 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java @@ -90,7 +90,7 @@ public class VaultResolver implements PermissionsResolver { @Override public boolean hasPermission(String worldName, OfflinePlayer player, String permission) { - return hasPermission(worldName, player.getName(), permission); + return perms.playerHas(worldName, player, permission); } @Override From be0d21e2a93073881573d9a2ebcb3e49516827d8 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 5 Dec 2018 16:32:20 +1000 Subject: [PATCH 050/182] Filter out commands that the player doesn't have permissions for. Workaround for a Spigot issue. --- .../worldedit/bukkit/WorldEditListener.java | 18 ++++++++++++++++++ .../util/command/composition/FlagParser.java | 1 - 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java index 44dd56b44..05774b84c 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java @@ -21,10 +21,13 @@ package com.sk89q.worldedit.bukkit; +import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.world.World; import org.bukkit.block.Block; import org.bukkit.event.Event.Result; @@ -33,10 +36,14 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerCommandSendEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.EquipmentSlot; +import java.util.Set; +import java.util.stream.Collectors; + /** * Handles all events thrown in relation to a Player */ @@ -99,6 +106,17 @@ public class WorldEditListener implements Listener { } } + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void onPlayerCommand(PlayerCommandSendEvent event) { + CommandLocals locals = new CommandLocals(); + locals.put(Actor.class, plugin.wrapCommandSender(event.getPlayer())); + Set toRemove = plugin.getWorldEdit().getPlatformManager().getCommandManager().getDispatcher().getCommands().stream() + .filter(commandMapping -> !commandMapping.getCallable().testPermission(locals)) + .map(CommandMapping::getPrimaryAlias) + .collect(Collectors.toSet()); + event.getCommands().removeIf(toRemove::contains); + } + /** * Called when a player interacts * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/FlagParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/FlagParser.java index 479a62d6f..fd64dd82d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/FlagParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/FlagParser.java @@ -183,7 +183,6 @@ public class FlagParser implements CommandExecutor { return (T) data.get(flag); } - @SuppressWarnings("unchecked") public T get(FlagData data, T fallback) { T value = get(data); if (value == null) { From a73faf0c8b4bd7aee7b5b72f823eb0c230186e48 Mon Sep 17 00:00:00 2001 From: JOO200 Date: Wed, 5 Dec 2018 17:09:06 +0100 Subject: [PATCH 051/182] Check by setting blocks with BlockBagExtend for changed materials. --- .../extent/inventory/BlockBagExtent.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) 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 21b790ee9..c4e563b87 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 @@ -86,25 +86,27 @@ public class BlockBagExtent extends AbstractDelegateExtent { if (blockBag != null) { BlockState existing = getExtent().getBlock(position); - if (!block.getBlockType().getMaterial().isAir()) { - try { - blockBag.fetchPlacedBlock(block.toImmutableState()); - } catch (UnplaceableBlockException e) { - return false; - } catch (BlockBagException e) { - if (!missingBlocks.containsKey(block.getBlockType())) { - missingBlocks.put(block.getBlockType(), 1); - } else { - missingBlocks.put(block.getBlockType(), missingBlocks.get(block.getBlockType()) + 1); + if (!block.getBlockType().equals(existing.getBlockType())) { + if (!block.getBlockType().getMaterial().isAir()) { + try { + blockBag.fetchPlacedBlock(block.toImmutableState()); + } catch (UnplaceableBlockException e) { + return false; + } catch (BlockBagException e) { + if (!missingBlocks.containsKey(block.getBlockType())) { + missingBlocks.put(block.getBlockType(), 1); + } else { + missingBlocks.put(block.getBlockType(), missingBlocks.get(block.getBlockType()) + 1); + } + return false; } - return false; } - } - if (!existing.getBlockType().getMaterial().isAir()) { - try { - blockBag.storeDroppedBlock(existing); - } catch (BlockBagException ignored) { + if (!existing.getBlockType().getMaterial().isAir()) { + try { + blockBag.storeDroppedBlock(existing); + } catch (BlockBagException ignored) { + } } } } From 5acd0d8537b628da66cd7c3e26ecfd3d0ed87018 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 9 Dec 2018 16:08:11 +1000 Subject: [PATCH 052/182] Update adapters for the broken Spigot builds. --- .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 21397 -> 21478 bytes .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 21557 -> 21671 bytes .../adapter/impl/Spigot_v1_13_R2_2.class | Bin 0 -> 21725 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class index 174e1be9a0119d005772a48ffd58f7f67355504f..b4c1e73b500b36c8c8bc3b7e2481d984cecfa0c1 100644 GIT binary patch delta 4184 zcmZ8k2Y6J)7Ct4}+00Ht3Y!LLB!SQj34{QlBtYm@h*&@gMS2oQXi}D90YQovP=Yj- zqJn~p4HX3i5m7u@ND>GrI)ed-=YcduGm=ng9Ri% z@HoD1gKya2n;K8xQH>|@Eok&w0qwfO^4e>*Tr|t8M?fS?DKek2& ze1e~9{0u+0<_p{WQsY;6R^!+Bjlys3^E+$4x8?_He)Ql^__M}e@K+5@@Hd6$G-TuN z8vnpQ75=3m*V3%Tzpe3|S6HL*AG~1AMLVq4PH;&PXec0*BqBF2ktP&amV zV;388DN^?7wkAxG*5o0hp%;Z)6QQXdMcP=DZDJTjQ;Y{@Q+*G4Db_QMQIr_>7xc$&+$y z<3rg;%C+Ivn%YpFhuTtoMfr-_DQfTW!6fS75tFB>fI4cJLPE8(qAoVEFdC4$d8j)T zYwAHgt=CIYZw-|;t&gI<(LmHq!(7|$uV{dV1=bztra@8%G+4tTJmaCOX^4l0Qi-B# zG%TTEVRS8Br|5d0rW<4j#e8qg4;q%ya7`oVMnyMiSWP1pm1=P8mgUkY4~?e!)*GXt zEsa%lv!Zbt*3)Sv4kD z_S>xvQ!MWtns(AdR)(pT_QRSUpDnj6cWZi-9^ooB?XqFr&JT1q;|C|~@c+{V$2V$h8y(&jt(J@7@DLU>{ zdQRZ$PIq%KL@9d1afN>yt`)s02U(7{q7(je;guAAQqfzA-VT)dJN}Bu0~B&fHqW0O zlZ76X<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nK&}QHNjP!eiE)OSQXjqxZ2@eeVZNL1L0Tz~ zMKv4a6UtDFcivmO={6-f4oDO9e21+UA)-IsW;^&F_70+~A+N!|5!M1dTsX$F*Ytp6 zl~`Y^%ibPkbXM&VPqP;vDeqR(drZ|)&0tMr|DcnHil4m)ab(g|e&0XzWNY;Ut$ql? z!;!oE_<>wamGxzmT0`qJoz}r^@lb>fBwPRC^KB=TnwYA(IzFAw#WAs^! zKCkpzkI9H`_1pVt`_>qJ6{D|laMuYtd@sibeUHRiWIsjaaXeOF1}YwON3 z>Q_UFNZTLO#GQKBI~+gB)e;o=sYM+>eOM4gwBT@Ch=bdY^E>ux$G#Z-8l>=|9@>lCRB++VN71ey^lIv~@q$LeMtkz%z8D*qAE% zb8L+MLX>VR;{T$RV_08LH~+&cck!eA7#*$Um4_)C9(@^auYgzfBNPvSS6-tCzfM_r z_To42$@eCm$8XX3{5H;v@6bYim#*RWXc-^Gb@f58p-OK!~n;_m!!95KJ*f&4W%y@AbS9QJ;!z(le>xI2#5tJ%A8zK;6*h;lmZzQk@~> zLGZ>_3|YdPkqe056RCyTGE9jxj$UxZ1>%uj#q14dE%5CADn_tUamRN@L?i| zz};Rv=LokAzJ%mD2{Gm>mcPq6_Y^tFaXF)5wtkxmFuWhnrr?W%*sM1s;2)eO&vfh? jG26_OW;;cs5&H3QB&ql{mL`(s*Sbho=~7$kEnWT(@i{)F diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class new file mode 100644 index 0000000000000000000000000000000000000000..0c0194e0ca3d9352aa8a55162fb365b171204e19 GIT binary patch literal 21725 zcmbt+34B!5_5V5dX7ZAk#}*6{5R8f#!V*D6Ob~?-G?D})2nH7%k|9KrnRGG%u~w~H z-FK~M>jD;BP${hwLTW{;*s8VGwc6TEZEfq)z3%+J=e{>HZ;~Ms|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N_0Qps!y#7vJe-9sv#D44E7pI7kY~Dyky|hW}X>*+Z z5T`$O)7#Rq)fn0q>DU^lce?3aX?@TPe?VFvjMJau^yhARPdXkk9S=*#BXRmmoc`KP zf0K?KrlVRqcEsuZIDLSfgLK5r0*^{ZJWd~W(?`;}%e3}L>#jKcy_^0atxs;GxxJJR zQ~syW{-mUz|8mpGl)oI8^q0S{2tbLDUxU(rFW9nL z>HG!~*Egw)e@*A{Z=g4C(T)6Dx|e^4^33n)G5!NR#eamGc^jF=J8(1aVypWnxS2nr z&h{RUz+aaf#ee0a@z*Bj@%u=1KY*M05SyEikT?9DTkwY`H}F6CLjD(iM*45KjsHR` z|A!xXe$3nXv!oqWB9nN8cfb~kU}KUPE2P&2`~!wx$EcZTy9aHf5UKCwN8w5y#3MBNoK~tg}kL!@%CK&iA!Cp>yIziFX`9y%T%lm cM?VTZYC8VSP)DdE&D$ciSS|A2R;We)2P@`LwEzGB literal 0 HcmV?d00001 From 4e5e9f609edfe12fdf288a6c2c58e75f64821faf Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 15 Oct 2018 16:12:21 +1000 Subject: [PATCH 053/182] Added the multi-staging from the multipass2 branch --- .../com/sk89q/worldedit/blocks/Blocks.java | 22 ++++ .../extent/reorder/MultiStageReorder.java | 112 +++++++++++------- .../history/changeset/ArrayListHistory.java | 16 ++- .../history/changeset/ChangeSet.java | 13 ++ 4 files changed, 119 insertions(+), 44 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java index 09bd50ff2..939fb7e7e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java @@ -36,6 +36,28 @@ public final class Blocks { private Blocks() { } + /** + * HashSet for shouldPlaceLate. + */ + private static final Set shouldPlaceLate = new HashSet<>(); + static { + shouldPlaceLate.add(BlockTypes.WATER); + shouldPlaceLate.add(BlockTypes.LAVA); + shouldPlaceLate.add(BlockTypes.GRAVEL); + shouldPlaceLate.add(BlockTypes.SAND); + } + /** + * Checks to see whether a block should be placed in the final queue. + * + * This applies to blocks that can be attached to other blocks that have an attachment. + * + * @param type the type of the block + * @return whether the block is in the late queue + */ + public static boolean shouldPlaceLate(BlockType type) { + return shouldPlaceLate.contains(type); + } + /** * HashSet for shouldPlaceLast. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index ea6bece5a..f741ff1b3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -19,7 +19,6 @@ package com.sk89q.worldedit.extent.reorder; -import com.google.common.collect.Iterables; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.Blocks; import com.sk89q.worldedit.extent.AbstractDelegateExtent; @@ -37,6 +36,7 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; +import java.util.ArrayList; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; @@ -50,11 +50,21 @@ import java.util.Set; */ public class MultiStageReorder extends AbstractDelegateExtent implements ReorderingExtent { - private LocatedBlockList stage1 = new LocatedBlockList(); - private LocatedBlockList stage2 = new LocatedBlockList(); - private LocatedBlockList stage3 = new LocatedBlockList(); + private static final int STAGE_COUNT = 4; + + private List stages = new ArrayList<>(); + private boolean enabled; + /** + * Create a new instance when the re-ordering is enabled. + * + * @param extent the extent + */ + public MultiStageReorder(Extent extent) { + this(extent, true); + } + /** * Create a new instance. * @@ -64,15 +74,10 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder public MultiStageReorder(Extent extent, boolean enabled) { super(extent); this.enabled = enabled; - } - /** - * Create a new instance when the re-ordering is enabled. - * - * @param extent the extent - */ - public MultiStageReorder(Extent extent) { - this(extent, true); + for (int i = 0; i < STAGE_COUNT; ++i) { + stages.add(new LocatedBlockList()); + } } /** @@ -94,58 +99,76 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } public boolean commitRequired() { - return stage1.size() > 0 || stage2.size() > 0 || stage3.size() > 0; + return stages.stream().anyMatch(stage -> stage.size() > 0); + } + + /** + * Gets the stage priority of the block. + * + * @param block The block + * @return The priority + */ + public int getPlacementPriority(BlockStateHolder block) { + if (Blocks.shouldPlaceLate(block.getBlockType())) { + return 1; + } else if (Blocks.shouldPlaceLast(block.getBlockType())) { + // Place torches, etc. last + return 2; + } else if (Blocks.shouldPlaceFinal(block.getBlockType())) { + // Place signs, reed, etc even later + return 3; + } else { + return 0; + } } @Override public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { - BlockState existing = getBlock(location); - if (!enabled) { return super.setBlock(location, block); } - if (Blocks.shouldPlaceLast(block.getBlockType())) { - // Place torches, etc. last - stage2.add(location, block); - return !existing.equalsFuzzy(block); - } else if (Blocks.shouldPlaceFinal(block.getBlockType())) { - // Place signs, reed, etc even later - stage3.add(location, block); - return !existing.equalsFuzzy(block); - } else if (Blocks.shouldPlaceLast(existing.getBlockType())) { + BlockState existing = getBlock(location); + int priority = getPlacementPriority(block); + int srcPriority = getPlacementPriority(existing); + + if (srcPriority == 1 || srcPriority == 2) { // Destroy torches, etc. first super.setBlock(location, BlockTypes.AIR.getDefaultState()); return super.setBlock(location, block); - } else { - stage1.add(location, block); - return !existing.equalsFuzzy(block); } + + stages.get(priority).add(location, block); + return !existing.equalsFuzzy(block); } @Override public Operation commitBefore() { - return new OperationQueue( - new SetLocatedBlocks( - getExtent(), - Iterables.concat(stage1, stage2)), - new Stage3Committer()); + List operations = new ArrayList<>(); + for (int i = 0; i < stages.size() - 1; ++i) { + operations.add(new SetLocatedBlocks(getExtent(), stages.get(i))); + } + + operations.add(new FinalStageCommitter()); + return new OperationQueue(operations); } - private class Stage3Committer implements Operation { + private class FinalStageCommitter implements Operation { + private Extent extent = getExtent(); - @Override - public Operation resume(RunContext run) throws WorldEditException { - Extent extent = getExtent(); + private final Set blocks = new HashSet<>(); + private final Map blockTypes = new HashMap<>(); - final Set blocks = new HashSet<>(); - final Map blockTypes = new HashMap<>(); - for (LocatedBlock entry : stage3) { + public FinalStageCommitter() { + for (LocatedBlock entry : stages.get(stages.size() - 1)) { final BlockVector3 pt = entry.getLocation(); blocks.add(pt); blockTypes.put(pt, entry.getBlock()); } + } + @Override + public Operation resume(RunContext run) throws WorldEditException { while (!blocks.isEmpty()) { BlockVector3 current = blocks.iterator().next(); if (!blocks.contains(current)) { @@ -201,11 +224,14 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } } - stage1.clear(); - stage2.clear(); - stage3.clear(); + if (blocks.isEmpty()) { + for (LocatedBlockList stage : stages) { + stage.clear(); + } + return null; + } - return null; + return this; } @Override 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 bc13a5755..d014835d3 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 @@ -35,10 +35,24 @@ public class ArrayListHistory implements ChangeSet { private final List changes = new ArrayList<>(); + private boolean recordChanges = true; + @Override public void add(Change change) { checkNotNull(change); - changes.add(change); + if (recordChanges) { + changes.add(change); + } + } + + @Override + public boolean isRecordingChanges() { + return recordChanges; + } + + @Override + public void setRecordChanges(boolean recordChanges) { + this.recordChanges = recordChanges; } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java index 0b018bcb9..fc5adb2e7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java @@ -36,6 +36,19 @@ public interface ChangeSet { */ void add(Change change); + /** + * Whether or not the ChangeSet is recording changes. + * + * @return whether or not the ChangeSet is set to record changes + */ + boolean isRecordingChanges(); + /** + * Tell the change set whether to record changes or not. + * + * @param recordChanges whether to record changes or not + */ + void setRecordChanges(boolean recordChanges); + /** * Get a backward directed iterator that can be used for undo. * From 7d468357e32ec69d9478e8bfd8f2fe8d5a1893ba Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 15 Oct 2018 20:50:09 +1000 Subject: [PATCH 054/182] Added "fast mode corrections" --- .../sk89q/worldedit/bukkit/BukkitWorld.java | 11 ++++++ .../bukkit/adapter/BukkitImplAdapter.java | 10 ++++++ .../java/com/sk89q/worldedit/EditSession.java | 20 ++++++++--- .../extent/world/FastModeExtent.java | 36 ++++++++++++++++++- .../history/changeset/ChangeSet.java | 1 + .../com/sk89q/worldedit/world/NullWorld.java | 5 +++ .../java/com/sk89q/worldedit/world/World.java | 13 +++++++ .../com/sk89q/worldedit/forge/ForgeWorld.java | 6 ++++ .../sk89q/worldedit/sponge/SpongeWorld.java | 7 +++- 9 files changed, 103 insertions(+), 6 deletions(-) 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 afc6c36de..8bffc3a2e 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 @@ -448,6 +448,17 @@ public class BukkitWorld extends AbstractWorld { } } + @Override + public boolean notifyAndLightBlock(BlockVector3 position, com.sk89q.worldedit.world.block.BlockState previousType) throws WorldEditException { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + if (adapter != null) { + adapter.notifyAndLightBlock(BukkitAdapter.adapt(getWorld(), position), previousType); + return true; + } + + return false; + } + @Override public BaseBiome getBiome(BlockVector2 position) { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index 393877581..13631e1d9 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import org.bukkit.Location; @@ -78,6 +79,15 @@ public interface BukkitImplAdapter { */ boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight); + /** + * Notifies the simulation that the block at the given location has + * been changed and it must be re-lighted (and issue other events). + * + * @param position position of the block + * @param previousType the type of the previous block that was there + */ + void notifyAndLightBlock(Location position, BlockState previousType); + /** * Get the state for the given entity. * 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 fabf49f3f..fad8c8850 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -170,6 +170,8 @@ public class EditSession implements Extent, AutoCloseable { private final Extent bypassHistory; private final Extent bypassNone; + private final boolean useFastModeCorrections; + private Mask oldMask; /** @@ -187,12 +189,13 @@ public class EditSession implements Extent, AutoCloseable { checkNotNull(event); this.world = world; + this.useFastModeCorrections = false; if (world != null) { Extent extent; // These extents are ALWAYS used - extent = fastModeExtent = new FastModeExtent(world, false); + extent = fastModeExtent = new FastModeExtent(world, useFastModeCorrections); extent = survivalExtent = new SurvivalModeExtent(extent, world); extent = quirkExtent = new BlockQuirkExtent(extent, world); extent = chunkLoadingExtent = new ChunkLoadingExtent(extent, world); @@ -299,14 +302,16 @@ public class EditSession implements Extent, AutoCloseable { * @return whether the queue is enabled */ public boolean isQueueEnabled() { - return reorderExtent.isEnabled(); + return !useFastModeCorrections && reorderExtent.isEnabled(); } /** * Queue certain types of block for better reproduction of those blocks. */ public void enableQueue() { - reorderExtent.setEnabled(true); + if (!useFastModeCorrections) { + reorderExtent.setEnabled(true); + } } /** @@ -361,7 +366,14 @@ public class EditSession implements Extent, AutoCloseable { */ public void setFastMode(boolean enabled) { if (fastModeExtent != null) { - fastModeExtent.setEnabled(enabled); + // If fast mode corrections are enabled, we're using fast mode for + // multipass support. Thus, we do not actually ever turn the fast mode + // extent off, we instead toggle post edit simulation + if (useFastModeCorrections) { + fastModeExtent.setPostEditSimulationEnabled(!enabled); + } else { + fastModeExtent.setEnabled(enabled); + } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index b75156d3b..37f524ad0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -29,9 +29,12 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; +import java.util.ArrayDeque; import java.util.HashSet; import java.util.List; +import java.util.Queue; import java.util.Set; /** @@ -40,8 +43,10 @@ import java.util.Set; public class FastModeExtent extends AbstractDelegateExtent { private final World world; + private final Queue positions = new ArrayDeque<>(); private final Set dirtyChunks = new HashSet<>(); private boolean enabled = true; + private boolean postEditSimulation; /** * Create a new instance with fast mode enabled. @@ -63,6 +68,9 @@ public class FastModeExtent extends AbstractDelegateExtent { checkNotNull(world); this.world = world; this.enabled = enabled; + if (enabled) { + this.postEditSimulation = true; + } } /** @@ -83,11 +91,27 @@ public class FastModeExtent extends AbstractDelegateExtent { this.enabled = enabled; } + public boolean isPostEditSimulationEnabled() { + return postEditSimulation; + } + + public void setPostEditSimulationEnabled(boolean enabled) { + this.postEditSimulation = enabled; + } + @Override public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { if (enabled) { dirtyChunks.add(BlockVector2.at(location.getBlockX() >> 4, location.getBlockZ() >> 4)); - return world.setBlock(location, block, false); + + if (world.setBlock(location, block, false)) { + if (postEditSimulation) { + positions.offer(location); + } + return true; + } + + return false; } else { return world.setBlock(location, block, true); } @@ -101,6 +125,16 @@ public class FastModeExtent extends AbstractDelegateExtent { if (!dirtyChunks.isEmpty()) { world.fixAfterFastMode(dirtyChunks); } + + if (postEditSimulation) { + while (run.shouldContinue() && !positions.isEmpty()) { + BlockVector3 position = positions.poll(); // Remove from queue + world.notifyAndLightBlock(position, BlockTypes.AIR.getDefaultState()); + } + + return !positions.isEmpty() ? this : null; + } + return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java index fc5adb2e7..003a007b6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java @@ -42,6 +42,7 @@ public interface ChangeSet { * @return whether or not the ChangeSet is set to record changes */ boolean isRecordingChanges(); + /** * Tell the change set whether to record changes or not. * 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 43ee77e39..eec1d47a9 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 @@ -64,6 +64,11 @@ public class NullWorld extends AbstractWorld { return false; } + @Override + public boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException { + return false; + } + @Override public int getBlockLightLevel(BlockVector3 position) { return 0; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java index 3e7bbf88c..d47723a42 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java @@ -33,10 +33,13 @@ import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.TreeGenerator; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.weather.WeatherType; +import java.util.Vector; + /** * Represents a world (dimension). */ @@ -95,6 +98,16 @@ public interface World extends Extent { */ boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException; + /** + * Notifies the simulation that the block at the given location has + * been changed and it must be re-lighted (and issue other events). + * + * @param position position of the block + * @param previousType the type of the previous block that was there + * @return true if the block was successfully notified + */ + boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException; + /** * Get the light level at the given block. * diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index 23ea709ff..d3d84d48a 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -212,6 +212,12 @@ public class ForgeWorld extends AbstractWorld { return successful; } + @Override + public boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException { + // TODO Implement + return false; + } + // Can't get the "Object" to be right for withProperty w/o this @SuppressWarnings({ "rawtypes", "unchecked" }) private IBlockState applyProperties(BlockStateContainer stateContainer, IBlockState newState, Map, Object> states) { diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index 74c2a6a3c..e3401190e 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -41,7 +41,6 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.weather.WeatherType; import com.sk89q.worldedit.world.weather.WeatherTypes; - import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockSnapshot; import org.spongepowered.api.block.BlockState; @@ -163,6 +162,12 @@ public abstract class SpongeWorld extends AbstractWorld { return true; } + @Override + public boolean notifyAndLightBlock(BlockVector3 position, com.sk89q.worldedit.world.block.BlockState previousType) throws WorldEditException { + // TODO Move this to adapter + return false; + } + @Override public boolean regenerate(Region region, EditSession editSession) { return false; From 36430863a16896d4fcaa3dc7be019e97255364a7 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 15 Nov 2018 18:58:21 +1000 Subject: [PATCH 055/182] Update adapters --- .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 21478 -> 22415 bytes .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 21671 -> 22608 bytes .../adapter/impl/Spigot_v1_13_R2_2.class | Bin 21725 -> 22662 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit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XU2S^hJceG_70R)-uz&HB4Vc=xftjSwaO> z6a%<^V~DA;KduI$Z=?6N3(S;U!%Xkxd66c#r^45hV4{y)XLq@#>@>P}h3UI6eIKD8 zjQYK9#~#zMH%vc<>8A+&Y&!P2*1Tdm_J!$}2>ohWUn`;HtZgAszh@`?R;*M7{azTR zKaief{rGQua_ax#lU2N#x8M~cdU!uWSwO|>csc++c>^hU5PWiof_#|LQFrDy@gDRR z4du6Sjvv7V@g15G;&*8_zekJteR_yLpr`mKJ%s2``7`9pBYM|7M|fJ;86U-%Pn z$)_B{pW(~o=lBrt1zzsH#OeGMcjvFcCEsv={uW36N!;GP<5~E#(LDYEwD2Qf`!jFh zU-&uxmCN{#8l-?#8uHWpEYdw5Ffvzp!NoP;dgjGviw6XO#T6TvDj?Eo@cUE0Yw zg`ULt;hJB--;m5F9fK5TXa}9<=(VzT)9Fg^Dj9x=z81S57w~pr4o$N*M!~`tiJ$>r zhN?A~w^P#>TcaUNXJ%H=U;k7z=pse2QAKb&;x1Rg&!A2MPaKhJd6N%+|5BH${H{T@ hTfL(8P*5__k1qhy7{4acRGPU`fm|U4)ly$6_#Zy%{o?=t diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2.class index 0c8ead5c3c9c6a9ebe247d10cc28488a54424ceb..a431d058405ad3d2eaa0de1cddbdd99d6f84073f 100644 GIT binary patch delta 7982 zcmZ{J2Y6J)_x3q6yP3`18%P2P*+81~6haq6?=^seVpNdOYl0AzqAn;RC}J7JtMa8~(({pBnxw znm^|+g!!c~zq0siVIK4GHx?!EacRD__&feynjb9wF~~nzG=NW_%RgIul7F!%oqsj_ zn>>#T<#*xzAq^({$$v%j-~5js%_(XAHGEpgXDmL;=PX5vjZ*T|(s-otN)zQ*M)@oi ztt^Xjl;0@ZqE2zfwGsQHRh%^OM%A!XO_d-`q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ZfJP6yFn5~sM6 zDwbbNmUt$e)5tKEuQPbCAhFypeqYGWimp9lqlF_&-!8f5YAJ zf2jfdEsmJqflR)~Tf+}{Qvb*k@Gq)s`DdPke@89kU%?H(q3(X?_525K;J=PTB??+; z%1`k|)O!YSq~8w&=h`q=F<2VQx?$`QjAi1y`Y1mO!dQ>Hr5pnYi1!`G6ne`bk)Rs= zl9A9GM>LdRPNfE+Bb1Xkf`VNR5ocv&Wo1P(GJM_vW;Xe}llLcPvNA5RT#bKp=|>rb z3N&nKV~D1zJiuS?-AtOtn3Ac_NWDQ^hjzhUMKGooL_ylUPsuTexgVjge)(h0xL Ta;kLkdn09(jI8aQFC+g862TPB diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class index 0c0194e0ca3d9352aa8a55162fb365b171204e19..68d629d18cbdea69d604b75e99c28ec1c9e80fc8 100644 GIT binary patch delta 8071 zcmZ`;37pMU^grj^_uhT)_kP1HX3QIAGh>^@*q0$gb{Z66Dlr&)#xfMDr$~vYevwI` z1x41;dow0Ng;GeRMVpXRmNrF}|2e-m!_@!(=kxCG{_b-2^S$SH=j+#S?q>AAe|6gq z0BEkx8wmKJGzSa_$AbnQ!jC-Y!NVFqHt-YtRECde{LGD?OZN+z{L;Xq_?5=5-S~~h zZ$0=O9+S!MW%9UzCuH)Z8-Fk$8c#{{qk*UKCux2*@E1RxF`y5gx6=m8PDi`UW+ihJFKXqcmyK4a%TQ znQSDlaURN|#$K39O}x~Unn}}KQw!nKQdYGRrCLkVMw)DC+Dg-oO+`0(s6FKf-wu%g z)YYJF)SWFyJq+r}Y#@nxvH8e6#ny$vYD58c#+YIVQ{k?QM zHPJLc(?Cswyl@}oNz>n;JLpaWX3$-l25Y)o)(wdSq+wnfP9qE|ppnuWrD?PQvt-#A zO=Ba0XqW->{4y|J(>(?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;H`wU0+)3G_#yyb2H`7dD6w(0UK&aQ@O2Q*igdHxeUnHx`vdSz z0KN^vchd5j-Lh3$UJJmv0DK>We@Vl3yCF*&wg=#c0Q?w)p3)GoXV@tXfdKpzg!3ZZ zWlJkWx+?%b2jSl$-B%1G`irpEzP@}w@c$Y*$lai=gzL2Rd8U)ogiosM>u*C! zsy?%wJ!G45P;?&(z<&bpdl3E*^+)W6!_sgh02c!AXAmw*!%^EBuQVJDz@;G666x_` zNJ!n`=MBK|I$X|CsvNEi48T=R&(dtXnNMO6{vSeFj$80msH!HEO_0i2`YzucV?sI3 zIru&k$_L=X4_#ZTd7{EVNnKZn=x z3)qieGMRkE`}@~SCTIC6>>DPNZ}}a?cNoQ=ykhZtY|Ed(y5SFe%KVYZ}GVcAP8i{EfsxVC~vgs4VddxZ1`IT}JREg{Br1(HIi zP-d5lfN|cqxH!MpYx53crrhS8ls~y8&O1V51%FeM*ERwb*3gP|$`)*-?m?{JIDimD z=tYVBB7qM!){pvAzv|jB>i1t0 Cd^(Q+ From b3f5bc030ed343fcddefa9406956f2c8604d5e22 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 15 Nov 2018 19:18:22 +1000 Subject: [PATCH 056/182] Few fixes for FastModeExtent. --- .../java/com/sk89q/worldedit/EditSession.java | 3 +++ .../worldedit/extent/world/FastModeExtent.java | 17 +++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) 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 fad8c8850..5088a2bdf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -246,6 +246,9 @@ public class EditSession implements Extent, AutoCloseable { if (isBatchingChunks() && chunkBatchingExtent.commitRequired()) { return true; } + if (hasFastMode() && fastModeExtent.commitRequired()) { + return true; + } return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index 37f524ad0..9ca43b63f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -31,10 +31,9 @@ import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; -import java.util.ArrayDeque; import java.util.HashSet; +import java.util.Iterator; import java.util.List; -import java.util.Queue; import java.util.Set; /** @@ -43,7 +42,7 @@ import java.util.Set; public class FastModeExtent extends AbstractDelegateExtent { private final World world; - private final Queue positions = new ArrayDeque<>(); + private final Set positions = new HashSet<>(); private final Set dirtyChunks = new HashSet<>(); private boolean enabled = true; private boolean postEditSimulation; @@ -106,7 +105,7 @@ public class FastModeExtent extends AbstractDelegateExtent { if (world.setBlock(location, block, false)) { if (postEditSimulation) { - positions.offer(location); + positions.add(location); } return true; } @@ -117,6 +116,10 @@ public class FastModeExtent extends AbstractDelegateExtent { } } + public boolean commitRequired() { + return !dirtyChunks.isEmpty() || !positions.isEmpty(); + } + @Override protected Operation commitBefore() { return new Operation() { @@ -127,9 +130,11 @@ public class FastModeExtent extends AbstractDelegateExtent { } if (postEditSimulation) { - while (run.shouldContinue() && !positions.isEmpty()) { - BlockVector3 position = positions.poll(); // Remove from queue + Iterator positionIterator = positions.iterator(); + while (run.shouldContinue() && positionIterator.hasNext()) { + BlockVector3 position = positionIterator.next(); world.notifyAndLightBlock(position, BlockTypes.AIR.getDefaultState()); + positionIterator.remove(); } return !positions.isEmpty() ? this : null; From 7f11b2800ddb557aa2f3fbedcc057ffbe0657c1d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 4 Dec 2018 20:20:27 +1000 Subject: [PATCH 057/182] Added an option to switch reorder modes --- .../java/com/sk89q/worldedit/EditSession.java | 122 ++++++++++++++---- .../com/sk89q/worldedit/LocalSession.java | 19 +++ .../worldedit/command/GeneralCommands.java | 24 ++++ .../extent/reorder/MultiStageReorder.java | 2 +- .../extent/world/FastModeExtent.java | 9 +- 5 files changed, 145 insertions(+), 31 deletions(-) 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 5088a2bdf..f2155a3e8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -149,6 +149,38 @@ public class EditSession implements Extent, AutoCloseable { BEFORE_CHANGE } + /** + * Reorder mode for {@link EditSession#setReorderMode(ReorderMode)}. + * + * MULTI_STAGE = Multi stage reorder, may not be great with mods. + * FAST = Use the fast mode. Good for mods. + * NONE = Place blocks without worrying about placement order. + */ + public enum ReorderMode { + MULTI_STAGE("multi"), + FAST("fast"), + NONE("none"); + + private String name; + + ReorderMode(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + + public static ReorderMode getFromName(String name) { + for (ReorderMode mode : values()) { + if (mode.getName().equalsIgnoreCase(name)) { + return mode; + } + } + return null; + } + } + @SuppressWarnings("ProtectedField") protected final World world; private final ChangeSet changeSet = new BlockOptimizedHistory(); @@ -170,7 +202,7 @@ public class EditSession implements Extent, AutoCloseable { private final Extent bypassHistory; private final Extent bypassNone; - private final boolean useFastModeCorrections; + private ReorderMode reorderMode = ReorderMode.MULTI_STAGE; private Mask oldMask; @@ -189,13 +221,12 @@ public class EditSession implements Extent, AutoCloseable { checkNotNull(event); this.world = world; - this.useFastModeCorrections = false; if (world != null) { Extent extent; // These extents are ALWAYS used - extent = fastModeExtent = new FastModeExtent(world, useFastModeCorrections); + extent = fastModeExtent = new FastModeExtent(world, false); extent = survivalExtent = new SurvivalModeExtent(extent, world); extent = quirkExtent = new BlockQuirkExtent(extent, world); extent = chunkLoadingExtent = new ChunkLoadingExtent(extent, world); @@ -240,13 +271,13 @@ public class EditSession implements Extent, AutoCloseable { // pkg private for TracedEditSession only, may later become public API boolean commitRequired() { - if (isQueueEnabled() && reorderExtent.commitRequired()) { + if (reorderExtent.commitRequired()) { return true; } if (isBatchingChunks() && chunkBatchingExtent.commitRequired()) { return true; } - if (hasFastMode() && fastModeExtent.commitRequired()) { + if (fastModeExtent != null && fastModeExtent.commitRequired()) { return true; } return false; @@ -254,14 +285,60 @@ public class EditSession implements Extent, AutoCloseable { /** * Turns on specific features for a normal WorldEdit session, such as - * {@link #enableQueue() queuing} and {@link #setBatchingChunks(boolean) + * {@link #setReorderMode(ReorderMode)} reordering} and {@link #setBatchingChunks(boolean) * chunk batching}. */ public void enableStandardMode() { - enableQueue(); + setReorderMode(ReorderMode.MULTI_STAGE); setBatchingChunks(true); } + /** + * Sets the {@link ReorderMode} of this EditSession. + * + * @param reorderMode The reorder mode + */ + public void setReorderMode(ReorderMode reorderMode) { + if (reorderMode == ReorderMode.FAST && fastModeExtent == null) { + throw new IllegalArgumentException("An EditSession without a fast mode tried to use it for reordering!"); + } + if (reorderMode == ReorderMode.MULTI_STAGE && reorderExtent == null) { + throw new IllegalArgumentException("An EditSession without a reorder extent tried to use it for reordering!"); + } + this.reorderMode = reorderMode; + switch (reorderMode) { + case MULTI_STAGE: + if (fastModeExtent != null) { + fastModeExtent.setPostEditSimulationEnabled(false); + } + reorderExtent.setEnabled(true); + break; + case FAST: + fastModeExtent.setPostEditSimulationEnabled(true); + if (reorderExtent != null) { + reorderExtent.setEnabled(false); + } + break; + case NONE: + if (fastModeExtent != null) { + fastModeExtent.setPostEditSimulationEnabled(false); + } + if (reorderExtent != null) { + reorderExtent.setEnabled(false); + } + break; + } + } + + /** + * Get the reorder mode. + * + * @return the reorder mode + */ + public ReorderMode getReorderMode() { + return reorderMode; + } + /** * Get the world. * @@ -305,26 +382,31 @@ public class EditSession implements Extent, AutoCloseable { * @return whether the queue is enabled */ public boolean isQueueEnabled() { - return !useFastModeCorrections && reorderExtent.isEnabled(); + return reorderMode == ReorderMode.MULTI_STAGE && reorderExtent.isEnabled(); } /** * Queue certain types of block for better reproduction of those blocks. + * + * Uses {@link ReorderMode#MULTI_STAGE} + * @deprecated Use {@link EditSession#setReorderMode(ReorderMode)} with MULTI_STAGE instead. */ + @Deprecated public void enableQueue() { - if (!useFastModeCorrections) { - reorderExtent.setEnabled(true); - } + setReorderMode(ReorderMode.MULTI_STAGE); } /** * Disable the queue. This will {@linkplain #flushSession() flush the session}. + * + * @deprecated Use {@link EditSession#setReorderMode(ReorderMode)} with another mode instead. */ + @Deprecated public void disableQueue() { if (isQueueEnabled()) { flushSession(); } - reorderExtent.setEnabled(false); + setReorderMode(ReorderMode.NONE); } /** @@ -369,14 +451,7 @@ public class EditSession implements Extent, AutoCloseable { */ public void setFastMode(boolean enabled) { if (fastModeExtent != null) { - // If fast mode corrections are enabled, we're using fast mode for - // multipass support. Thus, we do not actually ever turn the fast mode - // extent off, we instead toggle post edit simulation - if (useFastModeCorrections) { - fastModeExtent.setPostEditSimulationEnabled(!enabled); - } else { - fastModeExtent.setEnabled(enabled); - } + fastModeExtent.setEnabled(enabled); } } @@ -451,16 +526,15 @@ public class EditSession implements Extent, AutoCloseable { /** * Disable all buffering extents. * - * @see #disableQueue() + * @see #setReorderMode(ReorderMode) * @see #setBatchingChunks(boolean) */ public void disableBuffering() { // We optimize here to avoid repeated calls to flushSession. - boolean needsFlush = isQueueEnabled() || isBatchingChunks(); - if (needsFlush) { + if (commitRequired()) { flushSession(); } - reorderExtent.setEnabled(false); + setReorderMode(ReorderMode.NONE); if (chunkBatchingExtent != null) { chunkBatchingExtent.setEnabled(false); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index ee1c038fe..1133c6e7b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -93,6 +93,7 @@ public class LocalSession { private transient Mask mask; private transient TimeZone timezone = TimeZone.getDefault(); private transient BlockVector3 cuiTemporaryBlock; + private transient EditSession.ReorderMode reorderMode = EditSession.ReorderMode.MULTI_STAGE; // Saved properties private String lastScript; @@ -877,6 +878,24 @@ public class LocalSession { this.fastMode = fastMode; } + /** + * Gets the reorder mode of the session. + * + * @return The reorder mode + */ + public EditSession.ReorderMode getReorderMode() { + return reorderMode; + } + + /** + * Sets the reorder mode of the session. + * + * @param reorderMode The reorder mode + */ + public void setReorderMode(EditSession.ReorderMode reorderMode) { + this.reorderMode = reorderMode; + } + /** * Get the mask. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 862b4398d..a2e051493 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -115,6 +115,30 @@ public class GeneralCommands { } } + @Command( + aliases = { "/reorder" }, + usage = "[multi|fast|none]", + desc = "Sets the reorder mode of WorldEdit", + min = 0, + max = 1 + ) + @CommandPermissions("worldedit.reorder") + public void reorderMode(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + String newState = args.getString(0, null); + if (newState == null) { + player.print("The reorder mode is " + session.getReorderMode().getName()); + } else { + EditSession.ReorderMode reorderMode = EditSession.ReorderMode.getFromName(newState); + if (reorderMode == null) { + player.printError("Unknown reorder mode!"); + return; + } + + session.setReorderMode(reorderMode); + player.print("The reorder mode is now " + session.getReorderMode().getName()); + } + } + @Command( aliases = { "/drawsel" }, usage = "[on|off]", diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index f741ff1b3..2be03cbae 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -99,7 +99,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } public boolean commitRequired() { - return stages.stream().anyMatch(stage -> stage.size() > 0); + return enabled && stages.stream().anyMatch(stage -> stage.size() > 0); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index 9ca43b63f..ad92c6a45 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -67,9 +67,6 @@ public class FastModeExtent extends AbstractDelegateExtent { checkNotNull(world); this.world = world; this.enabled = enabled; - if (enabled) { - this.postEditSimulation = true; - } } /** @@ -100,11 +97,11 @@ public class FastModeExtent extends AbstractDelegateExtent { @Override public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { - if (enabled) { + if (enabled || postEditSimulation) { dirtyChunks.add(BlockVector2.at(location.getBlockX() >> 4, location.getBlockZ() >> 4)); if (world.setBlock(location, block, false)) { - if (postEditSimulation) { + if (!enabled && postEditSimulation) { positions.add(location); } return true; @@ -129,7 +126,7 @@ public class FastModeExtent extends AbstractDelegateExtent { world.fixAfterFastMode(dirtyChunks); } - if (postEditSimulation) { + if (!enabled && postEditSimulation) { Iterator positionIterator = positions.iterator(); while (run.shouldContinue() && positionIterator.hasNext()) { BlockVector3 position = positionIterator.next(); From 59f9864ba3371cb109b48708be37da6b57e19fb4 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 4 Dec 2018 20:20:59 +1000 Subject: [PATCH 058/182] Set fast to the default --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 2 +- .../src/main/java/com/sk89q/worldedit/LocalSession.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 f2155a3e8..31bc0bd07 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -202,7 +202,7 @@ public class EditSession implements Extent, AutoCloseable { private final Extent bypassHistory; private final Extent bypassNone; - private ReorderMode reorderMode = ReorderMode.MULTI_STAGE; + private ReorderMode reorderMode = ReorderMode.FAST; private Mask oldMask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 1133c6e7b..07ea35981 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -93,7 +93,7 @@ public class LocalSession { private transient Mask mask; private transient TimeZone timezone = TimeZone.getDefault(); private transient BlockVector3 cuiTemporaryBlock; - private transient EditSession.ReorderMode reorderMode = EditSession.ReorderMode.MULTI_STAGE; + private transient EditSession.ReorderMode reorderMode = EditSession.ReorderMode.FAST; // Saved properties private String lastScript; From 618cbd2250e89a233e6f7663ef09f812cd766403 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 4 Dec 2018 20:24:50 +1000 Subject: [PATCH 059/182] Few small fixes --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 8 +++++--- .../worldedit/extent/reorder/ChunkBatchingExtent.java | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) 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 31bc0bd07..354121c8d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -271,10 +271,10 @@ public class EditSession implements Extent, AutoCloseable { // pkg private for TracedEditSession only, may later become public API boolean commitRequired() { - if (reorderExtent.commitRequired()) { + if (reorderExtent != null && reorderExtent.commitRequired()) { return true; } - if (isBatchingChunks() && chunkBatchingExtent.commitRequired()) { + if (chunkBatchingExtent != null && chunkBatchingExtent.commitRequired()) { return true; } if (fastModeExtent != null && fastModeExtent.commitRequired()) { @@ -294,7 +294,7 @@ public class EditSession implements Extent, AutoCloseable { } /** - * Sets the {@link ReorderMode} of this EditSession. + * Sets the {@link ReorderMode} of this EditSession, and flushes the session. * * @param reorderMode The reorder mode */ @@ -305,6 +305,8 @@ public class EditSession implements Extent, AutoCloseable { if (reorderMode == ReorderMode.MULTI_STAGE && reorderExtent == null) { throw new IllegalArgumentException("An EditSession without a reorder extent tried to use it for reordering!"); } + flushSession(); + this.reorderMode = reorderMode; switch (reorderMode) { case MULTI_STAGE: diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index 730edefea..4379a0550 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -73,7 +73,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { } public boolean commitRequired() { - return batches.size() > 0; + return enabled && batches.size() > 0; } @Override From 5f2c77b7190b814f8794c9f04ce04a57aca00d84 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 9 Dec 2018 15:11:11 +1000 Subject: [PATCH 060/182] Further work on this. Currently fast mode breaks doors, gotta work out why applying physics to doors breaks them. --- .../java/com/sk89q/worldedit/EditSession.java | 30 +-- .../com/sk89q/worldedit/LocalSession.java | 3 + .../com/sk89q/worldedit/blocks/Blocks.java | 142 -------------- .../worldedit/command/GeneralCommands.java | 9 +- .../extent/reorder/MultiStageReorder.java | 176 ++++++++++++++---- .../extent/world/FastModeExtent.java | 5 +- 6 files changed, 168 insertions(+), 197 deletions(-) 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 354121c8d..b7e2753a3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -120,6 +120,7 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -161,23 +162,23 @@ public class EditSession implements Extent, AutoCloseable { FAST("fast"), NONE("none"); - private String name; + private String displayName; - ReorderMode(String name) { - this.name = name; + ReorderMode(String displayName) { + this.displayName = displayName; } - public String getName() { - return this.name; + public String getDisplayName() { + return this.displayName; } - public static ReorderMode getFromName(String name) { + public static Optional getFromDisplayName(String name) { for (ReorderMode mode : values()) { - if (mode.getName().equalsIgnoreCase(name)) { - return mode; + if (mode.getDisplayName().equalsIgnoreCase(name)) { + return Optional.of(mode); } } - return null; + return Optional.empty(); } } @@ -202,7 +203,7 @@ public class EditSession implements Extent, AutoCloseable { private final Extent bypassHistory; private final Extent bypassNone; - private ReorderMode reorderMode = ReorderMode.FAST; + private ReorderMode reorderMode = ReorderMode.MULTI_STAGE; private Mask oldMask; @@ -260,6 +261,8 @@ public class EditSession implements Extent, AutoCloseable { this.bypassHistory = extent; this.bypassNone = extent; } + + setReorderMode(this.reorderMode); } private Extent wrapExtent(Extent extent, EventBus eventBus, EditSessionEvent event, Stage stage) { @@ -285,11 +288,10 @@ public class EditSession implements Extent, AutoCloseable { /** * Turns on specific features for a normal WorldEdit session, such as - * {@link #setReorderMode(ReorderMode)} reordering} and {@link #setBatchingChunks(boolean) + * {@link #setBatchingChunks(boolean) * chunk batching}. */ public void enableStandardMode() { - setReorderMode(ReorderMode.MULTI_STAGE); setBatchingChunks(true); } @@ -305,7 +307,9 @@ public class EditSession implements Extent, AutoCloseable { if (reorderMode == ReorderMode.MULTI_STAGE && reorderExtent == null) { throw new IllegalArgumentException("An EditSession without a reorder extent tried to use it for reordering!"); } - flushSession(); + if (commitRequired()) { + flushSession(); + } this.reorderMode = reorderMode; switch (reorderMode) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 07ea35981..2dc413932 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -229,6 +229,7 @@ public class LocalSession { EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() .getEditSession(editSession.getWorld(), -1, newBlockBag, player); newEditSession.enableStandardMode(); + newEditSession.setReorderMode(reorderMode); newEditSession.setFastMode(fastMode); editSession.undo(newEditSession); return editSession; @@ -252,6 +253,7 @@ public class LocalSession { EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() .getEditSession(editSession.getWorld(), -1, newBlockBag, player); newEditSession.enableStandardMode(); + newEditSession.setReorderMode(reorderMode); newEditSession.setFastMode(fastMode); editSession.redo(newEditSession); ++historyPointer; @@ -854,6 +856,7 @@ public class LocalSession { .getEditSession(player.isPlayer() ? player.getWorld() : null, getBlockChangeLimit(), blockBag, player); editSession.setFastMode(fastMode); + editSession.setReorderMode(reorderMode); Request.request().setEditSession(editSession); editSession.setMask(mask); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java index 939fb7e7e..c71bd6ef6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java @@ -19,14 +19,9 @@ package com.sk89q.worldedit.blocks; -import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; import java.util.Collection; -import java.util.HashSet; -import java.util.Set; /** * Block-related utility methods. @@ -36,143 +31,6 @@ public final class Blocks { private Blocks() { } - /** - * HashSet for shouldPlaceLate. - */ - private static final Set shouldPlaceLate = new HashSet<>(); - static { - shouldPlaceLate.add(BlockTypes.WATER); - shouldPlaceLate.add(BlockTypes.LAVA); - shouldPlaceLate.add(BlockTypes.GRAVEL); - shouldPlaceLate.add(BlockTypes.SAND); - } - /** - * Checks to see whether a block should be placed in the final queue. - * - * This applies to blocks that can be attached to other blocks that have an attachment. - * - * @param type the type of the block - * @return whether the block is in the late queue - */ - public static boolean shouldPlaceLate(BlockType type) { - return shouldPlaceLate.contains(type); - } - - /** - * HashSet for shouldPlaceLast. - */ - private static final Set shouldPlaceLast = new HashSet<>(); - static { - shouldPlaceLast.addAll(BlockCategories.SAPLINGS.getAll()); - shouldPlaceLast.addAll(BlockCategories.FLOWER_POTS.getAll()); - shouldPlaceLast.addAll(BlockCategories.BUTTONS.getAll()); - shouldPlaceLast.addAll(BlockCategories.ANVIL.getAll()); // becomes relevant with asynchronous placement - shouldPlaceLast.addAll(BlockCategories.WOODEN_PRESSURE_PLATES.getAll()); - shouldPlaceLast.addAll(BlockCategories.CARPETS.getAll()); - shouldPlaceLast.addAll(BlockCategories.RAILS.getAll()); - shouldPlaceLast.add(BlockTypes.BLACK_BED); - shouldPlaceLast.add(BlockTypes.BLUE_BED); - shouldPlaceLast.add(BlockTypes.BROWN_BED); - shouldPlaceLast.add(BlockTypes.CYAN_BED); - shouldPlaceLast.add(BlockTypes.GRAY_BED); - shouldPlaceLast.add(BlockTypes.GREEN_BED); - shouldPlaceLast.add(BlockTypes.LIGHT_BLUE_BED); - shouldPlaceLast.add(BlockTypes.LIGHT_GRAY_BED); - shouldPlaceLast.add(BlockTypes.LIME_BED); - shouldPlaceLast.add(BlockTypes.MAGENTA_BED); - shouldPlaceLast.add(BlockTypes.ORANGE_BED); - shouldPlaceLast.add(BlockTypes.PINK_BED); - shouldPlaceLast.add(BlockTypes.PURPLE_BED); - shouldPlaceLast.add(BlockTypes.RED_BED); - shouldPlaceLast.add(BlockTypes.WHITE_BED); - shouldPlaceLast.add(BlockTypes.YELLOW_BED); - shouldPlaceLast.add(BlockTypes.GRASS); - shouldPlaceLast.add(BlockTypes.TALL_GRASS); - shouldPlaceLast.add(BlockTypes.ROSE_BUSH); - shouldPlaceLast.add(BlockTypes.DANDELION); - shouldPlaceLast.add(BlockTypes.BROWN_MUSHROOM); - shouldPlaceLast.add(BlockTypes.RED_MUSHROOM); - shouldPlaceLast.add(BlockTypes.FERN); - shouldPlaceLast.add(BlockTypes.LARGE_FERN); - shouldPlaceLast.add(BlockTypes.OXEYE_DAISY); - shouldPlaceLast.add(BlockTypes.AZURE_BLUET); - shouldPlaceLast.add(BlockTypes.TORCH); - shouldPlaceLast.add(BlockTypes.WALL_TORCH); - shouldPlaceLast.add(BlockTypes.FIRE); - shouldPlaceLast.add(BlockTypes.REDSTONE_WIRE); - shouldPlaceLast.add(BlockTypes.CARROTS); - shouldPlaceLast.add(BlockTypes.POTATOES); - shouldPlaceLast.add(BlockTypes.WHEAT); - shouldPlaceLast.add(BlockTypes.BEETROOTS); - shouldPlaceLast.add(BlockTypes.COCOA); - shouldPlaceLast.add(BlockTypes.LADDER); - shouldPlaceLast.add(BlockTypes.LEVER); - shouldPlaceLast.add(BlockTypes.REDSTONE_TORCH); - shouldPlaceLast.add(BlockTypes.REDSTONE_WALL_TORCH); - shouldPlaceLast.add(BlockTypes.SNOW); - shouldPlaceLast.add(BlockTypes.NETHER_PORTAL); - shouldPlaceLast.add(BlockTypes.END_PORTAL); - shouldPlaceLast.add(BlockTypes.REPEATER); - shouldPlaceLast.add(BlockTypes.VINE); - shouldPlaceLast.add(BlockTypes.LILY_PAD); - shouldPlaceLast.add(BlockTypes.NETHER_WART); - shouldPlaceLast.add(BlockTypes.PISTON); - shouldPlaceLast.add(BlockTypes.STICKY_PISTON); - shouldPlaceLast.add(BlockTypes.TRIPWIRE_HOOK); - shouldPlaceLast.add(BlockTypes.TRIPWIRE); - shouldPlaceLast.add(BlockTypes.STONE_PRESSURE_PLATE); - shouldPlaceLast.add(BlockTypes.HEAVY_WEIGHTED_PRESSURE_PLATE); - shouldPlaceLast.add(BlockTypes.LIGHT_WEIGHTED_PRESSURE_PLATE); - shouldPlaceLast.add(BlockTypes.COMPARATOR); - shouldPlaceLast.add(BlockTypes.IRON_TRAPDOOR); - shouldPlaceLast.add(BlockTypes.ACACIA_TRAPDOOR); - shouldPlaceLast.add(BlockTypes.BIRCH_TRAPDOOR); - shouldPlaceLast.add(BlockTypes.DARK_OAK_TRAPDOOR); - shouldPlaceLast.add(BlockTypes.JUNGLE_TRAPDOOR); - shouldPlaceLast.add(BlockTypes.OAK_TRAPDOOR); - shouldPlaceLast.add(BlockTypes.SPRUCE_TRAPDOOR); - shouldPlaceLast.add(BlockTypes.DAYLIGHT_DETECTOR); - } - - /** - * Checks to see whether a block should be placed last (when reordering - * blocks that are placed). - * - * @param type the block type - * @return true if the block should be placed last - */ - public static boolean shouldPlaceLast(BlockType type) { - return shouldPlaceLast.contains(type); - } - - /** - * HashSet for shouldPlaceLast. - */ - private static final Set shouldPlaceFinal = new HashSet<>(); - static { - shouldPlaceFinal.addAll(BlockCategories.DOORS.getAll()); - shouldPlaceFinal.addAll(BlockCategories.BANNERS.getAll()); - shouldPlaceFinal.add(BlockTypes.SIGN); - shouldPlaceFinal.add(BlockTypes.WALL_SIGN); - shouldPlaceFinal.add(BlockTypes.CACTUS); - shouldPlaceFinal.add(BlockTypes.SUGAR_CANE); - shouldPlaceFinal.add(BlockTypes.CAKE); - shouldPlaceFinal.add(BlockTypes.PISTON_HEAD); - shouldPlaceFinal.add(BlockTypes.MOVING_PISTON); - } - - /** - * Checks to see whether a block should be placed in the final queue. - * - * This applies to blocks that can be attached to other blocks that have an attachment. - * - * @param type the type of the block - * @return whether the block is in the final queue - */ - public static boolean shouldPlaceFinal(BlockType type) { - return shouldPlaceFinal.contains(type); - } - /** * Checks whether a given block is in a list of base blocks. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index a2e051493..5e4f608ed 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -126,16 +126,17 @@ public class GeneralCommands { public void reorderMode(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { String newState = args.getString(0, null); if (newState == null) { - player.print("The reorder mode is " + session.getReorderMode().getName()); + player.print("The reorder mode is " + session.getReorderMode().getDisplayName()); } else { - EditSession.ReorderMode reorderMode = EditSession.ReorderMode.getFromName(newState); - if (reorderMode == null) { + java.util.Optional reorderModeOptional = EditSession.ReorderMode.getFromDisplayName(newState); + if (!reorderModeOptional.isPresent()) { player.printError("Unknown reorder mode!"); return; } + EditSession.ReorderMode reorderMode = reorderModeOptional.get(); session.setReorderMode(reorderMode); - player.print("The reorder mode is now " + session.getReorderMode().getName()); + player.print("The reorder mode is now " + session.getReorderMode().getDisplayName()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index 2be03cbae..f58161b7c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -20,7 +20,6 @@ package com.sk89q.worldedit.extent.reorder; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.Blocks; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.operation.Operation; @@ -34,6 +33,7 @@ import com.sk89q.worldedit.util.collection.LocatedBlockList; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import java.util.ArrayList; @@ -50,12 +50,112 @@ import java.util.Set; */ public class MultiStageReorder extends AbstractDelegateExtent implements ReorderingExtent { - private static final int STAGE_COUNT = 4; + private static Map priorityMap = new HashMap<>(); - private List stages = new ArrayList<>(); + static { + // Late + priorityMap.put(BlockTypes.WATER, PlacementPriority.LATE); + priorityMap.put(BlockTypes.LAVA, PlacementPriority.LATE); + priorityMap.put(BlockTypes.SAND, PlacementPriority.LATE); + priorityMap.put(BlockTypes.GRAVEL, PlacementPriority.LATE); + + // Late + BlockCategories.SAPLINGS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST)); + BlockCategories.FLOWER_POTS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST)); + BlockCategories.BUTTONS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST)); + BlockCategories.ANVIL.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST)); + BlockCategories.WOODEN_PRESSURE_PLATES.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST)); + BlockCategories.CARPETS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST)); + BlockCategories.RAILS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST)); + priorityMap.put(BlockTypes.BLACK_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.BLUE_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.BROWN_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.CYAN_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.GRAY_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.GREEN_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.LIGHT_BLUE_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.LIGHT_GRAY_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.LIME_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.MAGENTA_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.ORANGE_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.PINK_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.PURPLE_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.RED_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.WHITE_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.YELLOW_BED, PlacementPriority.LAST); + priorityMap.put(BlockTypes.GRASS, PlacementPriority.LAST); + priorityMap.put(BlockTypes.TALL_GRASS, PlacementPriority.LAST); + priorityMap.put(BlockTypes.ROSE_BUSH, PlacementPriority.LAST); + priorityMap.put(BlockTypes.DANDELION, PlacementPriority.LAST); + priorityMap.put(BlockTypes.BROWN_MUSHROOM, PlacementPriority.LAST); + priorityMap.put(BlockTypes.RED_MUSHROOM, PlacementPriority.LAST); + priorityMap.put(BlockTypes.FERN, PlacementPriority.LAST); + priorityMap.put(BlockTypes.LARGE_FERN, PlacementPriority.LAST); + priorityMap.put(BlockTypes.OXEYE_DAISY, PlacementPriority.LAST); + priorityMap.put(BlockTypes.AZURE_BLUET, PlacementPriority.LAST); + priorityMap.put(BlockTypes.TORCH, PlacementPriority.LAST); + priorityMap.put(BlockTypes.WALL_TORCH, PlacementPriority.LAST); + priorityMap.put(BlockTypes.FIRE, PlacementPriority.LAST); + priorityMap.put(BlockTypes.REDSTONE_WIRE, PlacementPriority.LAST); + priorityMap.put(BlockTypes.CARROTS, PlacementPriority.LAST); + priorityMap.put(BlockTypes.POTATOES, PlacementPriority.LAST); + priorityMap.put(BlockTypes.WHEAT, PlacementPriority.LAST); + priorityMap.put(BlockTypes.BEETROOTS, PlacementPriority.LAST); + priorityMap.put(BlockTypes.COCOA, PlacementPriority.LAST); + priorityMap.put(BlockTypes.LADDER, PlacementPriority.LAST); + priorityMap.put(BlockTypes.LEVER, PlacementPriority.LAST); + priorityMap.put(BlockTypes.REDSTONE_TORCH, PlacementPriority.LAST); + priorityMap.put(BlockTypes.REDSTONE_WALL_TORCH, PlacementPriority.LAST); + priorityMap.put(BlockTypes.SNOW, PlacementPriority.LAST); + priorityMap.put(BlockTypes.NETHER_PORTAL, PlacementPriority.LAST); + priorityMap.put(BlockTypes.END_PORTAL, PlacementPriority.LAST); + priorityMap.put(BlockTypes.REPEATER, PlacementPriority.LAST); + priorityMap.put(BlockTypes.VINE, PlacementPriority.LAST); + priorityMap.put(BlockTypes.LILY_PAD, PlacementPriority.LAST); + priorityMap.put(BlockTypes.NETHER_WART, PlacementPriority.LAST); + priorityMap.put(BlockTypes.PISTON, PlacementPriority.LAST); + priorityMap.put(BlockTypes.STICKY_PISTON, PlacementPriority.LAST); + priorityMap.put(BlockTypes.TRIPWIRE_HOOK, PlacementPriority.LAST); + priorityMap.put(BlockTypes.TRIPWIRE, PlacementPriority.LAST); + priorityMap.put(BlockTypes.STONE_PRESSURE_PLATE, PlacementPriority.LAST); + priorityMap.put(BlockTypes.HEAVY_WEIGHTED_PRESSURE_PLATE, PlacementPriority.LAST); + priorityMap.put(BlockTypes.LIGHT_WEIGHTED_PRESSURE_PLATE, PlacementPriority.LAST); + priorityMap.put(BlockTypes.COMPARATOR, PlacementPriority.LAST); + priorityMap.put(BlockTypes.IRON_TRAPDOOR, PlacementPriority.LAST); + priorityMap.put(BlockTypes.ACACIA_TRAPDOOR, PlacementPriority.LAST); + priorityMap.put(BlockTypes.BIRCH_TRAPDOOR, PlacementPriority.LAST); + priorityMap.put(BlockTypes.DARK_OAK_TRAPDOOR, PlacementPriority.LAST); + priorityMap.put(BlockTypes.JUNGLE_TRAPDOOR, PlacementPriority.LAST); + priorityMap.put(BlockTypes.OAK_TRAPDOOR, PlacementPriority.LAST); + priorityMap.put(BlockTypes.SPRUCE_TRAPDOOR, PlacementPriority.LAST); + priorityMap.put(BlockTypes.DAYLIGHT_DETECTOR, PlacementPriority.LAST); + + // Final + BlockCategories.DOORS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL)); + BlockCategories.BANNERS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL)); + priorityMap.put(BlockTypes.SIGN, PlacementPriority.FINAL); + priorityMap.put(BlockTypes.WALL_SIGN, PlacementPriority.FINAL); + priorityMap.put(BlockTypes.CACTUS, PlacementPriority.FINAL); + priorityMap.put(BlockTypes.SUGAR_CANE, PlacementPriority.FINAL); + priorityMap.put(BlockTypes.CAKE, PlacementPriority.FINAL); + priorityMap.put(BlockTypes.PISTON_HEAD, PlacementPriority.FINAL); + priorityMap.put(BlockTypes.MOVING_PISTON, PlacementPriority.FINAL); + } + + private Map stages = new HashMap<>(); private boolean enabled; + public enum PlacementPriority { + CLEAR_FINAL, + CLEAR_LAST, + CLEAR_LATE, + FIRST, + LATE, + LAST, + FINAL + } + /** * Create a new instance when the re-ordering is enabled. * @@ -75,8 +175,8 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder super(extent); this.enabled = enabled; - for (int i = 0; i < STAGE_COUNT; ++i) { - stages.add(new LocatedBlockList()); + for (PlacementPriority priority : PlacementPriority.values()) { + stages.put(priority, new LocatedBlockList()); } } @@ -99,7 +199,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } public boolean commitRequired() { - return enabled && stages.stream().anyMatch(stage -> stage.size() > 0); + return enabled && stages.values().stream().anyMatch(stage -> stage.size() > 0); } /** @@ -108,18 +208,8 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder * @param block The block * @return The priority */ - public int getPlacementPriority(BlockStateHolder block) { - if (Blocks.shouldPlaceLate(block.getBlockType())) { - return 1; - } else if (Blocks.shouldPlaceLast(block.getBlockType())) { - // Place torches, etc. last - return 2; - } else if (Blocks.shouldPlaceFinal(block.getBlockType())) { - // Place signs, reed, etc even later - return 3; - } else { - return 0; - } + private PlacementPriority getPlacementPriority(BlockStateHolder block) { + return priorityMap.getOrDefault(block.getBlockType(), PlacementPriority.FIRST); } @Override @@ -129,13 +219,27 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } BlockState existing = getBlock(location); - int priority = getPlacementPriority(block); - int srcPriority = getPlacementPriority(existing); + PlacementPriority priority = getPlacementPriority(block); + PlacementPriority srcPriority = getPlacementPriority(existing); - if (srcPriority == 1 || srcPriority == 2) { - // Destroy torches, etc. first - super.setBlock(location, BlockTypes.AIR.getDefaultState()); - return super.setBlock(location, block); + if (srcPriority != PlacementPriority.FIRST) { + BlockStateHolder replacement = block.getBlockType().getMaterial().isAir() ? block : BlockTypes.AIR.getDefaultState(); + + switch (srcPriority) { + case FINAL: + stages.get(PlacementPriority.CLEAR_FINAL).add(location, replacement); + break; + case LATE: + stages.get(PlacementPriority.CLEAR_LATE).add(location, replacement); + break; + case LAST: + stages.get(PlacementPriority.CLEAR_LAST).add(location, replacement); + break; + } + + if (block.getBlockType().getMaterial().isAir()) { + return !existing.equalsFuzzy(block); + } } stages.get(priority).add(location, block); @@ -144,9 +248,14 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder @Override public Operation commitBefore() { + if (!enabled) { + return null; + } List operations = new ArrayList<>(); - for (int i = 0; i < stages.size() - 1; ++i) { - operations.add(new SetLocatedBlocks(getExtent(), stages.get(i))); + for (PlacementPriority priority : PlacementPriority.values()) { + if (priority != PlacementPriority.FINAL) { + operations.add(new SetLocatedBlocks(getExtent(), stages.get(priority))); + } } operations.add(new FinalStageCommitter()); @@ -160,7 +269,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder private final Map blockTypes = new HashMap<>(); public FinalStageCommitter() { - for (LocatedBlock entry : stages.get(stages.size() - 1)) { + for (LocatedBlock entry : stages.get(PlacementPriority.FINAL)) { final BlockVector3 pt = entry.getLocation(); blocks.add(pt); blockTypes.put(pt, entry.getBlock()); @@ -171,9 +280,6 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder public Operation resume(RunContext run) throws WorldEditException { while (!blocks.isEmpty()) { BlockVector3 current = blocks.iterator().next(); - if (!blocks.contains(current)) { - continue; - } final Deque walked = new LinkedList<>(); @@ -224,14 +330,10 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } } - if (blocks.isEmpty()) { - for (LocatedBlockList stage : stages) { - stage.clear(); - } - return null; + for (LocatedBlockList stage : stages.values()) { + stage.clear(); } - - return this; + return null; } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index ad92c6a45..08ecaeaf1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -114,11 +114,14 @@ public class FastModeExtent extends AbstractDelegateExtent { } public boolean commitRequired() { - return !dirtyChunks.isEmpty() || !positions.isEmpty(); + return (enabled && !dirtyChunks.isEmpty()) || (postEditSimulation && !positions.isEmpty()); } @Override protected Operation commitBefore() { + if (!enabled && !postEditSimulation) { + return null; + } return new Operation() { @Override public Operation resume(RunContext run) throws WorldEditException { From 6f3016c7f01fb4786a2ce1d3c41718e1b5b17298 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 9 Dec 2018 15:15:34 +1000 Subject: [PATCH 061/182] Fixed up the commitRequired checks. --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 2 ++ .../sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java | 4 ++-- .../com/sk89q/worldedit/extent/reorder/MultiStageReorder.java | 4 ++-- .../java/com/sk89q/worldedit/extent/world/FastModeExtent.java | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) 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 b7e2753a3..4d1bde24d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -386,7 +386,9 @@ public class EditSession implements Extent, AutoCloseable { * Returns queue status. * * @return whether the queue is enabled + * @deprecated Use {@link EditSession#getReorderMode()} with MULTI_STAGE instead. */ + @Deprecated public boolean isQueueEnabled() { return reorderMode == ReorderMode.MULTI_STAGE && reorderExtent.isEnabled(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index 4379a0550..daeb9f0e6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -73,7 +73,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { } public boolean commitRequired() { - return enabled && batches.size() > 0; + return enabled; } @Override @@ -88,7 +88,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { @Override protected Operation commitBefore() { - if (!enabled) { + if (!commitRequired()) { return null; } return new Operation() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index f58161b7c..aa1694740 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -199,7 +199,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } public boolean commitRequired() { - return enabled && stages.values().stream().anyMatch(stage -> stage.size() > 0); + return enabled; } /** @@ -248,7 +248,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder @Override public Operation commitBefore() { - if (!enabled) { + if (!commitRequired()) { return null; } List operations = new ArrayList<>(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index 08ecaeaf1..5b92a8ad3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -114,12 +114,12 @@ public class FastModeExtent extends AbstractDelegateExtent { } public boolean commitRequired() { - return (enabled && !dirtyChunks.isEmpty()) || (postEditSimulation && !positions.isEmpty()); + return enabled || postEditSimulation; } @Override protected Operation commitBefore() { - if (!enabled && !postEditSimulation) { + if (!commitRequired()) { return null; } return new Operation() { From 926f6a6ab868af69731d684104ef6fb06f15d815 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 9 Dec 2018 15:33:35 +1000 Subject: [PATCH 062/182] Flush undo/redo --- .../com/sk89q/worldedit/LocalSession.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 2dc413932..9b117c918 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -93,7 +93,7 @@ public class LocalSession { private transient Mask mask; private transient TimeZone timezone = TimeZone.getDefault(); private transient BlockVector3 cuiTemporaryBlock; - private transient EditSession.ReorderMode reorderMode = EditSession.ReorderMode.FAST; + private transient EditSession.ReorderMode reorderMode = EditSession.ReorderMode.MULTI_STAGE; // Saved properties private String lastScript; @@ -226,12 +226,13 @@ public class LocalSession { --historyPointer; if (historyPointer >= 0) { EditSession editSession = history.get(historyPointer); - EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() - .getEditSession(editSession.getWorld(), -1, newBlockBag, player); - newEditSession.enableStandardMode(); - newEditSession.setReorderMode(reorderMode); - newEditSession.setFastMode(fastMode); - editSession.undo(newEditSession); + try (EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() + .getEditSession(editSession.getWorld(), -1, newBlockBag, player)) { + newEditSession.enableStandardMode(); + newEditSession.setReorderMode(reorderMode); + newEditSession.setFastMode(fastMode); + editSession.undo(newEditSession); + } return editSession; } else { historyPointer = 0; @@ -250,12 +251,13 @@ public class LocalSession { checkNotNull(player); if (historyPointer < history.size()) { EditSession editSession = history.get(historyPointer); - EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() - .getEditSession(editSession.getWorld(), -1, newBlockBag, player); - newEditSession.enableStandardMode(); - newEditSession.setReorderMode(reorderMode); - newEditSession.setFastMode(fastMode); - editSession.redo(newEditSession); + try (EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory() + .getEditSession(editSession.getWorld(), -1, newBlockBag, player)) { + newEditSession.enableStandardMode(); + newEditSession.setReorderMode(reorderMode); + newEditSession.setFastMode(fastMode); + editSession.redo(newEditSession); + } ++historyPointer; return editSession; } From 3ead4995ca3a29df573435a248c15687249ab731 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 11 Dec 2018 11:19:26 +1000 Subject: [PATCH 063/182] Bump to Beta 4 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6b63f5caf..d1b508512 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ println """ allprojects { group = 'com.sk89q.worldedit' - version = '7.0.0-SNAPSHOT' + version = '7.0.0-beta-04' } if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost" From 502cfb338f04f9e906b5f3de3b622015c25eabe7 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 11 Dec 2018 11:19:39 +1000 Subject: [PATCH 064/182] Back to snapshot for continued development --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d1b508512..6b63f5caf 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ println """ allprojects { group = 'com.sk89q.worldedit' - version = '7.0.0-beta-04' + version = '7.0.0-SNAPSHOT' } if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost" From 700e41b706dea8755592140b7586cd1faaeed73d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 13 Dec 2018 20:30:54 +1000 Subject: [PATCH 065/182] Remove the final stage committer from the MultiStageReorder extent, as it caused issues and no longer appears to be entirely necessary. --- .../command/argument/ItemUseParser.java | 2 +- .../command/argument/NumberParser.java | 2 +- .../command/argument/StringParser.java | 2 +- .../extent/reorder/MultiStageReorder.java | 103 +----------------- .../transform/BlockTransformExtentTest.java | 69 ++++++++++++ 5 files changed, 76 insertions(+), 102 deletions(-) create mode 100644 worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java index 816516978..f6da447a1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java @@ -35,7 +35,7 @@ import com.sk89q.worldedit.world.World; public class ItemUseParser extends SimpleCommand> { - private final ItemParser itemParser = addParameter(new ItemParser("item", "minecraft:dye:15")); + private final ItemParser itemParser = addParameter(new ItemParser("item", "minecraft:bone_meal")); @Override public Contextual call(CommandArgs args, CommandLocals locals) throws CommandException { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/NumberParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/NumberParser.java index 9c7f2fed2..349089e50 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/NumberParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/NumberParser.java @@ -62,7 +62,7 @@ public class NumberParser implements CommandExecutor { @Override public List getSuggestions(CommandArgs args, CommandLocals locals) throws MissingArgumentException { String value = args.next(); - return value.isEmpty() && defaultSuggestion != null ? Lists.newArrayList(defaultSuggestion) : Collections.emptyList(); + return value.isEmpty() && defaultSuggestion != null ? Lists.newArrayList(defaultSuggestion) : Collections.emptyList(); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/StringParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/StringParser.java index 518024cd3..298f999e4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/StringParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/StringParser.java @@ -57,7 +57,7 @@ public class StringParser implements CommandExecutor { @Override public List getSuggestions(CommandArgs args, CommandLocals locals) throws MissingArgumentException { String value = args.next(); - return value.isEmpty() && defaultSuggestion != null ? Lists.newArrayList(defaultSuggestion) : Collections.emptyList(); + return value.isEmpty() && defaultSuggestion != null ? Lists.newArrayList(defaultSuggestion) : Collections.emptyList(); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index aa1694740..f4ee0a200 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -24,11 +24,8 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.OperationQueue; -import com.sk89q.worldedit.function.operation.RunContext; import com.sk89q.worldedit.function.operation.SetLocatedBlocks; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.util.LocatedBlock; import com.sk89q.worldedit.util.collection.LocatedBlockList; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; @@ -37,20 +34,16 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import java.util.ArrayList; -import java.util.Deque; import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Set; /** * Re-orders blocks into several stages. */ public class MultiStageReorder extends AbstractDelegateExtent implements ReorderingExtent { - private static Map priorityMap = new HashMap<>(); + private static final Map priorityMap = new HashMap<>(); static { // Late @@ -129,7 +122,8 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder priorityMap.put(BlockTypes.OAK_TRAPDOOR, PlacementPriority.LAST); priorityMap.put(BlockTypes.SPRUCE_TRAPDOOR, PlacementPriority.LAST); priorityMap.put(BlockTypes.DAYLIGHT_DETECTOR, PlacementPriority.LAST); - + priorityMap.put(BlockTypes.CAKE, PlacementPriority.LAST); + // Final BlockCategories.DOORS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL)); BlockCategories.BANNERS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL)); @@ -137,7 +131,6 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder priorityMap.put(BlockTypes.WALL_SIGN, PlacementPriority.FINAL); priorityMap.put(BlockTypes.CACTUS, PlacementPriority.FINAL); priorityMap.put(BlockTypes.SUGAR_CANE, PlacementPriority.FINAL); - priorityMap.put(BlockTypes.CAKE, PlacementPriority.FINAL); priorityMap.put(BlockTypes.PISTON_HEAD, PlacementPriority.FINAL); priorityMap.put(BlockTypes.MOVING_PISTON, PlacementPriority.FINAL); } @@ -253,97 +246,9 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } List operations = new ArrayList<>(); for (PlacementPriority priority : PlacementPriority.values()) { - if (priority != PlacementPriority.FINAL) { - operations.add(new SetLocatedBlocks(getExtent(), stages.get(priority))); - } + operations.add(new SetLocatedBlocks(getExtent(), stages.get(priority))); } - operations.add(new FinalStageCommitter()); return new OperationQueue(operations); } - - private class FinalStageCommitter implements Operation { - private Extent extent = getExtent(); - - private final Set blocks = new HashSet<>(); - private final Map blockTypes = new HashMap<>(); - - public FinalStageCommitter() { - for (LocatedBlock entry : stages.get(PlacementPriority.FINAL)) { - final BlockVector3 pt = entry.getLocation(); - blocks.add(pt); - blockTypes.put(pt, entry.getBlock()); - } - } - - @Override - public Operation resume(RunContext run) throws WorldEditException { - while (!blocks.isEmpty()) { - BlockVector3 current = blocks.iterator().next(); - - final Deque walked = new LinkedList<>(); - - while (true) { - walked.addFirst(current); - - assert (blockTypes.containsKey(current)); - - final BlockStateHolder blockStateHolder = blockTypes.get(current); - - if (BlockCategories.DOORS.contains(blockStateHolder.getBlockType())) { - Property halfProperty = blockStateHolder.getBlockType().getProperty("half"); - if (blockStateHolder.getState(halfProperty).equals("lower")) { - // Deal with lower door halves being attached to the floor AND the upper half - BlockVector3 upperBlock = current.add(0, 1, 0); - if (blocks.contains(upperBlock) && !walked.contains(upperBlock)) { - walked.addFirst(upperBlock); - } - } - } else if (BlockCategories.RAILS.contains(blockStateHolder.getBlockType())) { - BlockVector3 lowerBlock = current.add(0, -1, 0); - if (blocks.contains(lowerBlock) && !walked.contains(lowerBlock)) { - walked.addFirst(lowerBlock); - } - } - - if (!blockStateHolder.getBlockType().getMaterial().isFragileWhenPushed()) { - // Block is not attached to anything => we can place it - break; - } - -// current = current.add(attachment.vector()).toBlockVector(); -// -// if (!blocks.contains(current)) { -// // We ran outside the remaining set => assume we can place blocks on this -// break; -// } -// - if (walked.contains(current)) { - // Cycle detected => This will most likely go wrong, but there's nothing we can do about it. - break; - } - } - - for (BlockVector3 pt : walked) { - extent.setBlock(pt, blockTypes.get(pt)); - blocks.remove(pt); - } - } - - for (LocatedBlockList stage : stages.values()) { - stage.clear(); - } - return null; - } - - @Override - public void cancel() { - } - - @Override - public void addStatusMessages(List messages) { - } - - } - } diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java new file mode 100644 index 000000000..e32b7c6cd --- /dev/null +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java @@ -0,0 +1,69 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent.transform; + +import static org.junit.Assert.assertEquals; + +import com.sk89q.worldedit.math.transform.AffineTransform; +import com.sk89q.worldedit.math.transform.Transform; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +import java.util.HashSet; +import java.util.Set; + +@Ignore("A platform is currently required to get properties, preventing this test.") +public class BlockTransformExtentTest { + + private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90); + private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90); + private final Set ignored = new HashSet<>(); + + @Before + public void setUp() throws Exception { + BlockTypes.register(new BlockType("worldedit:test")); + } + + @Test + public void testTransform() throws Exception { + for (BlockType type : BlockType.REGISTRY.values()) { + if (ignored.contains(type)) { + continue; + } + + BlockState base = type.getDefaultState(); + BlockState rotated = base; + + for (int i = 1; i < 4; i++) { + rotated = BlockTransformExtent.transform(base, ROTATE_90); + } + assertEquals(base, rotated); + rotated = base; + for (int i = 1; i < 4; i++) { + rotated = BlockTransformExtent.transform(base, ROTATE_NEG_90); + } + assertEquals(base, rotated); + } + } +} \ No newline at end of file From 8f236afae9f3187012d0dc0a14c33db2a81dd729 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 18 Dec 2018 17:36:53 +1000 Subject: [PATCH 066/182] Added a display name to Actors --- .../java/com/sk89q/worldedit/bukkit/BukkitPlayer.java | 5 +++++ .../com/sk89q/worldedit/extension/platform/Actor.java | 9 +++++++++ .../sk89q/worldedit/extension/platform/PlayerProxy.java | 5 +++++ .../java/com/sk89q/worldedit/sponge/SpongePlayer.java | 6 +++++- 4 files changed, 24 insertions(+), 1 deletion(-) 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 e08e6b6dc..0ec373f63 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 @@ -83,6 +83,11 @@ public class BukkitPlayer extends AbstractPlayerActor { return player.getName(); } + @Override + public String getDisplayName() { + return player.getDisplayName(); + } + @Override public void giveItem(BaseItemStack itemStack) { player.getInventory().addItem(BukkitAdapter.adapt(itemStack)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java index 43f665423..cf64b5974 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java @@ -38,6 +38,15 @@ public interface Actor extends Identifiable, SessionOwner, Subject { */ String getName(); + /** + * Gets the display name of the actor. This can be a nickname, and is not guaranteed to be unique. + * + * @return The display name + */ + default String getDisplayName() { + return getName(); + } + /** * Print a message. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java index be748c2c7..7d8a1b3da 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java @@ -82,6 +82,11 @@ class PlayerProxy extends AbstractPlayerActor { return basePlayer.getName(); } + @Override + public String getDisplayName() { + return basePlayer.getDisplayName(); + } + @Override public BaseEntity getState() { throw new UnsupportedOperationException("Can't getState() on a player"); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java index fba1c81fc..08f7b47c3 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java @@ -35,7 +35,6 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemTypes; - import org.spongepowered.api.Sponge; import org.spongepowered.api.data.type.HandTypes; import org.spongepowered.api.entity.living.player.Player; @@ -79,6 +78,11 @@ public class SpongePlayer extends AbstractPlayerActor { return this.player.getName(); } + @Override + public String getDisplayName() { + return player.getDisplayNameData().displayName().getDirect().map(TextSerializers.LEGACY_FORMATTING_CODE::serialize).orElse(getName()); + } + @Override public BaseEntity getState() { throw new UnsupportedOperationException("Cannot create a state from this object"); From 5eb9b779d7467ba3c893421a8ed099c47685f01e Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 18 Dec 2018 19:28:55 +1000 Subject: [PATCH 067/182] Move the pasting system over to WorldEdit, and add a /we report command. Currently only reports system status and the config. Need to add a platform reporter system. --- config/checkstyle/import-control.xml | 1 + .../worldedit/bukkit/BukkitConfiguration.java | 3 +- worldedit-core/build.gradle | 1 + .../java/com/sk89q/worldedit/WorldEdit.java | 12 + .../worldedit/command/WorldEditCommands.java | 30 + .../command/util/AsyncCommandHelper.java | 135 +++++ .../command/util/FutureProgressListener.java | 54 ++ .../command/util/MessageFutureCallback.java | 114 ++++ .../command/util/MessageTimerTask.java | 46 ++ .../util/PropertiesConfiguration.java | 561 +++++++++--------- .../worldedit/util/YAMLConfiguration.java | 267 ++++----- .../sk89q/worldedit/util/net/HttpRequest.java | 490 +++++++++++++++ .../util/paste/ActorCallbackPaste.java | 70 +++ .../worldedit/util/paste/EngineHubPaste.java | 78 +++ .../sk89q/worldedit/util/paste/Pastebin.java | 93 +++ .../sk89q/worldedit/util/paste/Paster.java | 30 + .../sk89q/worldedit/util/paste/Pasters.java | 44 ++ .../worldedit/util/report/ConfigReport.java | 32 + .../util/report/HierarchyObjectReport.java | 32 + .../util/report/ShallowObjectReport.java | 5 +- .../worldedit/util/task/AbstractTask.java | 74 +++ .../util/task/FutureForwardingTask.java | 121 ++++ .../worldedit/util/task/SimpleSupervisor.java | 59 ++ .../sk89q/worldedit/util/task/Supervisor.java | 44 ++ .../com/sk89q/worldedit/util/task/Task.java | 97 +++ .../util/task/TaskStateComparator.java | 43 ++ .../util/task/progress/Progress.java | 183 ++++++ .../util/task/progress/ProgressIterator.java | 100 ++++ .../task/progress/ProgressObservable.java | 34 ++ .../config/ConfigurateConfiguration.java | 7 +- 30 files changed, 2441 insertions(+), 419 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandHelper.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageFutureCallback.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Pastebin.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Paster.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Pasters.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ConfigReport.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/report/HierarchyObjectReport.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/task/AbstractTask.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/task/FutureForwardingTask.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/task/SimpleSupervisor.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/task/Supervisor.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/task/Task.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/task/TaskStateComparator.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/Progress.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/ProgressIterator.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/ProgressObservable.java diff --git a/config/checkstyle/import-control.xml b/config/checkstyle/import-control.xml index 8b40e60d5..eedd07857 100644 --- a/config/checkstyle/import-control.xml +++ b/config/checkstyle/import-control.xml @@ -14,6 +14,7 @@ + diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java index 5a20cdfbc..494a464ea 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.worldedit.util.YAMLConfiguration; +import com.sk89q.worldedit.util.report.Unreported; import java.io.File; @@ -30,7 +31,7 @@ import java.io.File; public class BukkitConfiguration extends YAMLConfiguration { public boolean noOpPermissions = false; - private final WorldEditPlugin plugin; + @Unreported private final WorldEditPlugin plugin; public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) { super(config, plugin.getLogger()); diff --git a/worldedit-core/build.gradle b/worldedit-core/build.gradle index 57a5eb2ca..da2c61c44 100644 --- a/worldedit-core/build.gradle +++ b/worldedit-core/build.gradle @@ -11,6 +11,7 @@ dependencies { compile 'com.thoughtworks.paranamer:paranamer:2.6' compile 'com.google.code.gson:gson:2.8.0' compile 'com.sk89q.lib:jlibnoise:1.0.0' + compile 'com.googlecode.json-simple:json-simple:1.1.1' //compile 'net.sf.trove4j:trove4j:3.0.3' testCompile 'org.mockito:mockito-core:1.9.0-rc1' } 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 4952dea8f..3b3130180 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -54,6 +54,8 @@ import com.sk89q.worldedit.util.io.file.FilenameException; import com.sk89q.worldedit.util.io.file.FilenameResolutionException; import com.sk89q.worldedit.util.io.file.InvalidFilenameException; import com.sk89q.worldedit.util.logging.WorldEditPrefixHandler; +import com.sk89q.worldedit.util.task.SimpleSupervisor; +import com.sk89q.worldedit.util.task.Supervisor; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.registry.BundledBlockData; @@ -99,6 +101,7 @@ public class WorldEdit { private final PlatformManager platformManager = new PlatformManager(this); private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus); private final SessionManager sessions = new SessionManager(this); + private final Supervisor supervisor = new SimpleSupervisor(); private final BlockFactory blockFactory = new BlockFactory(this); private final ItemFactory itemFactory = new ItemFactory(this); @@ -148,6 +151,15 @@ public class WorldEdit { return eventBus; } + /** + * Get the supervisor. + * + * @return the supervisor + */ + public Supervisor getSupervisor() { + return supervisor; + } + /** * Get the block factory from which new {@link BlockStateHolder}s can be * constructed. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java index c849d1469..639acd50b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.command; +import com.google.common.io.Files; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; @@ -32,7 +33,14 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.PlatformManager; +import com.sk89q.worldedit.util.paste.ActorCallbackPaste; +import com.sk89q.worldedit.util.report.ConfigReport; +import com.sk89q.worldedit.util.report.ReportList; +import com.sk89q.worldedit.util.report.SystemInfoReport; +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -86,6 +94,28 @@ public class WorldEditCommands { actor.print("Configuration reloaded!"); } + @Command(aliases = {"report"}, desc = "Writes a report on WorldEdit", flags = "p", max = 0) + @CommandPermissions({"worldedit.report"}) + public void report(Actor actor, CommandContext args) throws WorldEditException { + ReportList report = new ReportList("Report"); + report.add(new SystemInfoReport()); + report.add(new ConfigReport()); + String result = report.toString(); + + try { + File dest = new File(we.getWorkingDirectoryFile(we.getConfiguration().saveDir), "report.txt"); + Files.write(result, dest, Charset.forName("UTF-8")); + actor.print("WorldEdit report written to " + dest.getAbsolutePath()); + } catch (IOException e) { + actor.printError("Failed to write report: " + e.getMessage()); + } + + if (args.hasFlag('p')) { + actor.checkPermission("worldedit.report.pastebin"); + ActorCallbackPaste.pastebin(we.getSupervisor(), actor, result, "WorldEdit report: %s.report"); + } + } + @Command( aliases = { "cui" }, usage = "", diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandHelper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandHelper.java new file mode 100644 index 000000000..0f521336d --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandHelper.java @@ -0,0 +1,135 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.command.util; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.util.task.FutureForwardingTask; +import com.sk89q.worldedit.util.task.Supervisor; +import com.sk89q.worldedit.world.World; + +import javax.annotation.Nullable; + +public class AsyncCommandHelper { + + private final ListenableFuture future; + private final Supervisor supervisor; + private final Actor sender; + @Nullable + private Object[] formatArgs; + + private AsyncCommandHelper(ListenableFuture future, Supervisor supervisor, Actor sender) { + checkNotNull(future); + checkNotNull(supervisor); + checkNotNull(sender); + + this.future = future; + this.supervisor = supervisor; + this.sender = sender; + } + + public AsyncCommandHelper formatUsing(Object... args) { + this.formatArgs = args; + return this; + } + + private String format(String message) { + if (formatArgs != null) { + return String.format(message, formatArgs); + } else { + return message; + } + } + + public AsyncCommandHelper registerWithSupervisor(String description) { + supervisor.monitor( + FutureForwardingTask.create( + future, format(description), sender)); + return this; + } + + public AsyncCommandHelper sendMessageAfterDelay(String message) { + FutureProgressListener.addProgressListener(future, sender, format(message)); + return this; + } + + public AsyncCommandHelper thenRespondWith(String success, String failure) { + // Send a response message + Futures.addCallback( + future, + new MessageFutureCallback.Builder(sender) + .onSuccess(format(success)) + .onFailure(format(failure)) + .build()); + return this; + } + + public AsyncCommandHelper thenTellErrorsOnly(String failure) { + // Send a response message + Futures.addCallback( + future, + new MessageFutureCallback.Builder(sender) + .onFailure(format(failure)) + .build()); + return this; + } + + public AsyncCommandHelper forRegionDataLoad(World world, boolean silent) { + checkNotNull(world); + + formatUsing(world.getName()); + registerWithSupervisor("Loading region data for '%s'"); + if (silent) { + thenTellErrorsOnly("Failed to load regions '%s'"); + } else { + sendMessageAfterDelay("(Please wait... loading the region data for '%s')"); + thenRespondWith( + "Loaded region data for '%s'", + "Failed to load regions '%s'"); + } + + return this; + } + + public AsyncCommandHelper forRegionDataSave(World world, boolean silent) { + checkNotNull(world); + + formatUsing(world.getName()); + registerWithSupervisor("Saving region data for '%s'"); + if (silent) { + thenTellErrorsOnly("Failed to save regions '%s'"); + } else { + sendMessageAfterDelay("(Please wait... saving the region data for '%s')"); + thenRespondWith( + "Saved region data for '%s'", + "Failed to load regions '%s'"); + } + + return this; + } + + public static AsyncCommandHelper wrap(ListenableFuture future, Supervisor supervisor, Actor sender) { + return new AsyncCommandHelper(future, supervisor, sender); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java new file mode 100644 index 000000000..54d366ba4 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java @@ -0,0 +1,54 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.command.util; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.MoreExecutors; +import com.sk89q.worldedit.extension.platform.Actor; + +import java.util.Timer; + +public class FutureProgressListener implements Runnable { + + private static final Timer timer = new Timer(); + private static final int MESSAGE_DELAY = 1000; + + private final MessageTimerTask task; + + public FutureProgressListener(Actor sender, String message) { + checkNotNull(sender); + checkNotNull(message); + + task = new MessageTimerTask(sender, message); + timer.schedule(task, MESSAGE_DELAY); + } + + @Override + public void run() { + task.cancel(); + } + + public static void addProgressListener(ListenableFuture future, Actor sender, String message) { + future.addListener(new FutureProgressListener(sender, message), MoreExecutors.directExecutor()); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageFutureCallback.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageFutureCallback.java new file mode 100644 index 000000000..3abb73545 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageFutureCallback.java @@ -0,0 +1,114 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.command.util; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.util.concurrent.FutureCallback; +import com.sk89q.minecraft.util.commands.CommandException; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.util.command.parametric.ExceptionConverter; + +import javax.annotation.Nullable; + +public class MessageFutureCallback implements FutureCallback { + + private final ExceptionConverter exceptionConverter; + private final Actor sender; + @Nullable + private final String success; + @Nullable + private final String failure; + + private MessageFutureCallback(ExceptionConverter exceptionConverter, Actor sender, @Nullable String success, @Nullable String failure) { + this.exceptionConverter = exceptionConverter; + this.sender = sender; + this.success = success; + this.failure = failure; + } + + @Override + public void onSuccess(@Nullable V v) { + if (success != null) { + sender.print(success); + } + } + + @Override + public void onFailure(@Nullable Throwable throwable) { + try { + exceptionConverter.convert(throwable); + } catch (CommandException e) { + String failure = this.failure != null ? this.failure : "An error occurred"; + String message = e.getMessage() != null ? e.getMessage() : "An unknown error occurred. Please see the console!"; + sender.printError(failure + ": " + message); + } + } + + public static class Builder { + private final Actor sender; + @Nullable + private String success; + @Nullable + private String failure; + private ExceptionConverter exceptionConverter; + + public Builder(Actor sender) { + checkNotNull(sender); + + this.sender = sender; + } + + public Builder exceptionConverter(ExceptionConverter exceptionConverter) { + this.exceptionConverter = exceptionConverter; + return this; + } + + public Builder onSuccess(@Nullable String message) { + this.success = message; + return this; + } + + public Builder onFailure(@Nullable String message) { + this.failure = message; + return this; + } + + public MessageFutureCallback build() { + checkNotNull(exceptionConverter); + return new MessageFutureCallback<>(exceptionConverter, sender, success, failure); + } + } + + public static MessageFutureCallback createRegionLoadCallback(ExceptionConverter exceptionConverter, Actor sender) { + return new Builder(sender) + .exceptionConverter(exceptionConverter) + .onSuccess("Successfully load the region data.") + .build(); + } + + public static MessageFutureCallback createRegionSaveCallback(ExceptionConverter exceptionConverter, Actor sender) { + return new Builder(sender) + .exceptionConverter(exceptionConverter) + .onSuccess("Successfully saved the region data.") + .build(); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java new file mode 100644 index 000000000..4a2549318 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java @@ -0,0 +1,46 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.command.util; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.extension.platform.Actor; + +import java.util.TimerTask; + +public class MessageTimerTask extends TimerTask { + + private final Actor sender; + private final String message; + + MessageTimerTask(Actor sender, String message) { + checkNotNull(sender); + checkNotNull(message); + + this.sender = sender; + this.message = message; + } + + @Override + public void run() { + sender.printDebug(message); + } + +} 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 2454581f1..9ec39e35e 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 @@ -1,280 +1,281 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -// $Id$ - -package com.sk89q.worldedit.util; - -import com.sk89q.util.StringUtil; -import com.sk89q.worldedit.LocalConfiguration; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.world.registry.LegacyMapper; -import com.sk89q.worldedit.world.snapshot.SnapshotRepository; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Properties; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Simple LocalConfiguration that loads settings using - * {@code java.util.Properties}. - */ -public class PropertiesConfiguration extends LocalConfiguration { - - private static final Logger log = Logger.getLogger(PropertiesConfiguration.class.getCanonicalName()); - - protected Properties properties; - protected File path; - - /** - * Construct the object. The configuration isn't loaded yet. - * - * @param path the path tot he configuration - */ - public PropertiesConfiguration(File path) { - this.path = path; - - properties = new Properties(); - } - - @Override - public void load() { - try (InputStream stream = new FileInputStream(path)) { - properties.load(stream); - } catch (FileNotFoundException ignored) { - } catch (IOException e) { - log.log(Level.WARNING, "Failed to read configuration", e); - } - - loadExtra(); - - profile = getBool("profile", profile); - traceUnflushedSessions = getBool("trace-unflushed-sessions", traceUnflushedSessions); - disallowedBlocks = getStringSet("disallowed-blocks", defaultDisallowedBlocks); - defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit); - maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); - defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints); - maxPolygonalPoints = getInt("max-polygon-points", maxPolygonalPoints); - defaultMaxPolyhedronPoints = getInt("default-max-polyhedron-points", defaultMaxPolyhedronPoints); - maxPolyhedronPoints = getInt("max-polyhedron-points", maxPolyhedronPoints); - shellSaveType = getString("shell-save-type", shellSaveType); - maxRadius = getInt("max-radius", maxRadius); - maxSuperPickaxeSize = getInt("max-super-pickaxe-size", maxSuperPickaxeSize); - maxBrushRadius = getInt("max-brush-radius", maxBrushRadius); - logCommands = getBool("log-commands", logCommands); - logFile = getString("log-file", logFile); - logFormat = getString("log-format", logFormat); - registerHelp = getBool("register-help", registerHelp); - wandItem = getString("wand-item", wandItem); - try { - wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).getId(); - } catch (Throwable e) { - } - superPickaxeDrop = getBool("super-pickaxe-drop-items", superPickaxeDrop); - superPickaxeManyDrop = getBool("super-pickaxe-many-drop-items", superPickaxeManyDrop); - noDoubleSlash = getBool("no-double-slash", noDoubleSlash); - useInventory = getBool("use-inventory", useInventory); - useInventoryOverride = getBool("use-inventory-override", useInventoryOverride); - useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride); - navigationWand = getString("nav-wand-item", navigationWand); - try { - navigationWand = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(navigationWand)).getId(); - } catch (Throwable e) { - } - navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance); - navigationUseGlass = getBool("nav-use-glass", navigationUseGlass); - scriptTimeout = getInt("scripting-timeout", scriptTimeout); - calculationTimeout = getInt("calculation-timeout", calculationTimeout); - saveDir = getString("schematic-save-dir", saveDir); - scriptsDir = getString("craftscript-dir", scriptsDir); - butcherDefaultRadius = getInt("butcher-default-radius", butcherDefaultRadius); - butcherMaxRadius = getInt("butcher-max-radius", butcherMaxRadius); - allowSymlinks = getBool("allow-symbolic-links", allowSymlinks); - serverSideCUI = getBool("server-side-cui", serverSideCUI); - - LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15)); - - String snapshotsDir = getString("snapshots-dir", ""); - if (!snapshotsDir.isEmpty()) { - snapshotRepo = new SnapshotRepository(snapshotsDir); - } - - path.getParentFile().mkdirs(); - try (OutputStream output = new FileOutputStream(path)) { - properties.store(output, "Don't put comments; they get removed"); - } catch (IOException e) { - log.log(Level.WARNING, "Failed to write configuration", e); - } - } - - /** - * Called to load extra configuration. - */ - protected void loadExtra() { - } - - /** - * Get a string value. - * - * @param key the key - * @param def the default value - * @return the value - */ - protected String getString(String key, String def) { - if (def == null) { - def = ""; - } - String val = properties.getProperty(key); - if (val == null) { - properties.setProperty(key, def); - return def; - } else { - return val; - } - } - - /** - * Get a boolean value. - * - * @param key the key - * @param def the default value - * @return the value - */ - protected boolean getBool(String key, boolean def) { - String val = properties.getProperty(key); - if (val == null) { - properties.setProperty(key, def ? "true" : "false"); - return def; - } else { - return val.equalsIgnoreCase("true") - || val.equals("1"); - } - } - - /** - * Get an integer value. - * - * @param key the key - * @param def the default value - * @return the value - */ - protected int getInt(String key, int def) { - String val = properties.getProperty(key); - if (val == null) { - properties.setProperty(key, String.valueOf(def)); - return def; - } else { - try { - return Integer.parseInt(val); - } catch (NumberFormatException e) { - properties.setProperty(key, String.valueOf(def)); - return def; - } - } - } - - /** - * Get a double value. - * - * @param key the key - * @param def the default value - * @return the value - */ - protected double getDouble(String key, double def) { - String val = properties.getProperty(key); - if (val == null) { - properties.setProperty(key, String.valueOf(def)); - return def; - } else { - try { - return Double.parseDouble(val); - } catch (NumberFormatException e) { - properties.setProperty(key, String.valueOf(def)); - return def; - } - } - } - - /** - * Get a double value. - * - * @param key the key - * @param def the default value - * @return the value - */ - protected Set getIntSet(String key, int[] def) { - String val = properties.getProperty(key); - if (val == null) { - properties.setProperty(key, StringUtil.joinString(def, ",", 0)); - Set set = new HashSet<>(); - for (int i : def) { - set.add(i); - } - return set; - } else { - Set set = new HashSet<>(); - String[] parts = val.split(","); - for (String part : parts) { - try { - int v = Integer.parseInt(part.trim()); - set.add(v); - } catch (NumberFormatException ignored) { - } - } - return set; - } - } - - /** - * Get a String set. - * - * @param key the key - * @param def the default value - * @return the value - */ - protected Set getStringSet(String key, String[] def) { - String val = properties.getProperty(key); - if (val == null) { - properties.setProperty(key, StringUtil.joinString(def, ",", 0)); - return new HashSet<>(Arrays.asList(def)); - } else { - Set set = new HashSet<>(); - String[] parts = val.split(","); - for (String part : parts) { - try { - String v = part.trim(); - set.add(v); - } catch (NumberFormatException ignored) { - } - } - return set; - } - } - -} +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +// $Id$ + +package com.sk89q.worldedit.util; + +import com.sk89q.util.StringUtil; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.util.report.Unreported; +import com.sk89q.worldedit.world.registry.LegacyMapper; +import com.sk89q.worldedit.world.snapshot.SnapshotRepository; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Properties; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Simple LocalConfiguration that loads settings using + * {@code java.util.Properties}. + */ +public class PropertiesConfiguration extends LocalConfiguration { + + @Unreported private static final Logger log = Logger.getLogger(PropertiesConfiguration.class.getCanonicalName()); + + @Unreported protected Properties properties; + @Unreported protected File path; + + /** + * Construct the object. The configuration isn't loaded yet. + * + * @param path the path tot he configuration + */ + public PropertiesConfiguration(File path) { + this.path = path; + + properties = new Properties(); + } + + @Override + public void load() { + try (InputStream stream = new FileInputStream(path)) { + properties.load(stream); + } catch (FileNotFoundException ignored) { + } catch (IOException e) { + log.log(Level.WARNING, "Failed to read configuration", e); + } + + loadExtra(); + + profile = getBool("profile", profile); + traceUnflushedSessions = getBool("trace-unflushed-sessions", traceUnflushedSessions); + disallowedBlocks = getStringSet("disallowed-blocks", defaultDisallowedBlocks); + defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit); + maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); + defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints); + maxPolygonalPoints = getInt("max-polygon-points", maxPolygonalPoints); + defaultMaxPolyhedronPoints = getInt("default-max-polyhedron-points", defaultMaxPolyhedronPoints); + maxPolyhedronPoints = getInt("max-polyhedron-points", maxPolyhedronPoints); + shellSaveType = getString("shell-save-type", shellSaveType); + maxRadius = getInt("max-radius", maxRadius); + maxSuperPickaxeSize = getInt("max-super-pickaxe-size", maxSuperPickaxeSize); + maxBrushRadius = getInt("max-brush-radius", maxBrushRadius); + logCommands = getBool("log-commands", logCommands); + logFile = getString("log-file", logFile); + logFormat = getString("log-format", logFormat); + registerHelp = getBool("register-help", registerHelp); + wandItem = getString("wand-item", wandItem); + try { + wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).getId(); + } catch (Throwable e) { + } + superPickaxeDrop = getBool("super-pickaxe-drop-items", superPickaxeDrop); + superPickaxeManyDrop = getBool("super-pickaxe-many-drop-items", superPickaxeManyDrop); + noDoubleSlash = getBool("no-double-slash", noDoubleSlash); + useInventory = getBool("use-inventory", useInventory); + useInventoryOverride = getBool("use-inventory-override", useInventoryOverride); + useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride); + navigationWand = getString("nav-wand-item", navigationWand); + try { + navigationWand = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(navigationWand)).getId(); + } catch (Throwable e) { + } + navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance); + navigationUseGlass = getBool("nav-use-glass", navigationUseGlass); + scriptTimeout = getInt("scripting-timeout", scriptTimeout); + calculationTimeout = getInt("calculation-timeout", calculationTimeout); + saveDir = getString("schematic-save-dir", saveDir); + scriptsDir = getString("craftscript-dir", scriptsDir); + butcherDefaultRadius = getInt("butcher-default-radius", butcherDefaultRadius); + butcherMaxRadius = getInt("butcher-max-radius", butcherMaxRadius); + allowSymlinks = getBool("allow-symbolic-links", allowSymlinks); + serverSideCUI = getBool("server-side-cui", serverSideCUI); + + LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15)); + + String snapshotsDir = getString("snapshots-dir", ""); + if (!snapshotsDir.isEmpty()) { + snapshotRepo = new SnapshotRepository(snapshotsDir); + } + + path.getParentFile().mkdirs(); + try (OutputStream output = new FileOutputStream(path)) { + properties.store(output, "Don't put comments; they get removed"); + } catch (IOException e) { + log.log(Level.WARNING, "Failed to write configuration", e); + } + } + + /** + * Called to load extra configuration. + */ + protected void loadExtra() { + } + + /** + * Get a string value. + * + * @param key the key + * @param def the default value + * @return the value + */ + protected String getString(String key, String def) { + if (def == null) { + def = ""; + } + String val = properties.getProperty(key); + if (val == null) { + properties.setProperty(key, def); + return def; + } else { + return val; + } + } + + /** + * Get a boolean value. + * + * @param key the key + * @param def the default value + * @return the value + */ + protected boolean getBool(String key, boolean def) { + String val = properties.getProperty(key); + if (val == null) { + properties.setProperty(key, def ? "true" : "false"); + return def; + } else { + return val.equalsIgnoreCase("true") + || val.equals("1"); + } + } + + /** + * Get an integer value. + * + * @param key the key + * @param def the default value + * @return the value + */ + protected int getInt(String key, int def) { + String val = properties.getProperty(key); + if (val == null) { + properties.setProperty(key, String.valueOf(def)); + return def; + } else { + try { + return Integer.parseInt(val); + } catch (NumberFormatException e) { + properties.setProperty(key, String.valueOf(def)); + return def; + } + } + } + + /** + * Get a double value. + * + * @param key the key + * @param def the default value + * @return the value + */ + protected double getDouble(String key, double def) { + String val = properties.getProperty(key); + if (val == null) { + properties.setProperty(key, String.valueOf(def)); + return def; + } else { + try { + return Double.parseDouble(val); + } catch (NumberFormatException e) { + properties.setProperty(key, String.valueOf(def)); + return def; + } + } + } + + /** + * Get a double value. + * + * @param key the key + * @param def the default value + * @return the value + */ + protected Set getIntSet(String key, int[] def) { + String val = properties.getProperty(key); + if (val == null) { + properties.setProperty(key, StringUtil.joinString(def, ",", 0)); + Set set = new HashSet<>(); + for (int i : def) { + set.add(i); + } + return set; + } else { + Set set = new HashSet<>(); + String[] parts = val.split(","); + for (String part : parts) { + try { + int v = Integer.parseInt(part.trim()); + set.add(v); + } catch (NumberFormatException ignored) { + } + } + return set; + } + } + + /** + * Get a String set. + * + * @param key the key + * @param def the default value + * @return the value + */ + protected Set getStringSet(String key, String[] def) { + String val = properties.getProperty(key); + if (val == null) { + properties.setProperty(key, StringUtil.joinString(def, ",", 0)); + return new HashSet<>(Arrays.asList(def)); + } else { + Set set = new HashSet<>(); + String[] parts = val.split(","); + for (String part : parts) { + try { + String v = part.trim(); + set.add(v); + } catch (NumberFormatException ignored) { + } + } + return set; + } + } + +} 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 697e77e56..dfbd586b2 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 @@ -1,133 +1,134 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.util; - -import com.google.common.collect.Lists; -import com.sk89q.util.yaml.YAMLProcessor; -import com.sk89q.worldedit.LocalConfiguration; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.session.SessionManager; -import com.sk89q.worldedit.world.snapshot.SnapshotRepository; - -import java.io.IOException; -import java.util.HashSet; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * A less simple implementation of {@link LocalConfiguration} - * using YAML configuration files. - */ -public class YAMLConfiguration extends LocalConfiguration { - - protected final YAMLProcessor config; - protected final Logger logger; - - public YAMLConfiguration(YAMLProcessor config, Logger logger) { - this.config = config; - this.logger = logger; - } - - @Override - public void load() { - try { - config.load(); - } catch (IOException e) { - logger.log(Level.WARNING, "Error loading WorldEdit configuration", e); - } - - profile = config.getBoolean("debug", profile); - traceUnflushedSessions = config.getBoolean("debugging.trace-unflushed-sessions", traceUnflushedSessions); - wandItem = convertLegacyItem(config.getString("wand-item", wandItem)); - - defaultChangeLimit = Math.max(-1, config.getInt( - "limits.max-blocks-changed.default", defaultChangeLimit)); - maxChangeLimit = Math.max(-1, - config.getInt("limits.max-blocks-changed.maximum", maxChangeLimit)); - - defaultMaxPolygonalPoints = Math.max(-1, - config.getInt("limits.max-polygonal-points.default", defaultMaxPolygonalPoints)); - maxPolygonalPoints = Math.max(-1, - config.getInt("limits.max-polygonal-points.maximum", maxPolygonalPoints)); - - defaultMaxPolyhedronPoints = Math.max(-1, config.getInt("limits.max-polyhedron-points.default", defaultMaxPolyhedronPoints)); - maxPolyhedronPoints = Math.max(-1, config.getInt("limits.max-polyhedron-points.maximum", maxPolyhedronPoints)); - - maxRadius = Math.max(-1, config.getInt("limits.max-radius", maxRadius)); - maxBrushRadius = config.getInt("limits.max-brush-radius", maxBrushRadius); - maxSuperPickaxeSize = Math.max(1, config.getInt( - "limits.max-super-pickaxe-size", maxSuperPickaxeSize)); - - butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius)); - butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius)); - - disallowedBlocks = new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(defaultDisallowedBlocks))); - allowedDataCycleBlocks = new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null)); - - registerHelp = config.getBoolean("register-help", true); - logCommands = config.getBoolean("logging.log-commands", logCommands); - logFile = config.getString("logging.file", logFile); - logFormat = config.getString("logging.format", logFormat); - - superPickaxeDrop = config.getBoolean("super-pickaxe.drop-items", - superPickaxeDrop); - superPickaxeManyDrop = config.getBoolean( - "super-pickaxe.many-drop-items", superPickaxeManyDrop); - - noDoubleSlash = config.getBoolean("no-double-slash", noDoubleSlash); - - useInventory = config.getBoolean("use-inventory.enable", useInventory); - useInventoryOverride = config.getBoolean("use-inventory.allow-override", - useInventoryOverride); - useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides", - useInventoryCreativeOverride); - - navigationWand = convertLegacyItem(config.getString("navigation-wand.item", navigationWand)); - navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance); - navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass); - - scriptTimeout = config.getInt("scripting.timeout", scriptTimeout); - scriptsDir = config.getString("scripting.dir", scriptsDir); - - calculationTimeout = config.getInt("calculation.timeout", calculationTimeout); - - saveDir = config.getString("saving.dir", saveDir); - - allowSymlinks = config.getBoolean("files.allow-symbolic-links", false); - LocalSession.MAX_HISTORY_SIZE = Math.max(0, config.getInt("history.size", 15)); - SessionManager.EXPIRATION_GRACE = config.getInt("history.expiration", 10) * 60 * 1000; - - showHelpInfo = config.getBoolean("show-help-on-first-use", true); - serverSideCUI = config.getBoolean("server-side-cui", true); - - String snapshotsDir = config.getString("snapshots.directory", ""); - if (!snapshotsDir.isEmpty()) { - snapshotRepo = new SnapshotRepository(snapshotsDir); - } - - String type = config.getString("shell-save-type", "").trim(); - shellSaveType = type.isEmpty() ? null : type; - - } - - public void unload() { - } - -} +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util; + +import com.google.common.collect.Lists; +import com.sk89q.util.yaml.YAMLProcessor; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.session.SessionManager; +import com.sk89q.worldedit.util.report.Unreported; +import com.sk89q.worldedit.world.snapshot.SnapshotRepository; + +import java.io.IOException; +import java.util.HashSet; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * A less simple implementation of {@link LocalConfiguration} + * using YAML configuration files. + */ +public class YAMLConfiguration extends LocalConfiguration { + + @Unreported protected final YAMLProcessor config; + @Unreported protected final Logger logger; + + public YAMLConfiguration(YAMLProcessor config, Logger logger) { + this.config = config; + this.logger = logger; + } + + @Override + public void load() { + try { + config.load(); + } catch (IOException e) { + logger.log(Level.WARNING, "Error loading WorldEdit configuration", e); + } + + profile = config.getBoolean("debug", profile); + traceUnflushedSessions = config.getBoolean("debugging.trace-unflushed-sessions", traceUnflushedSessions); + wandItem = convertLegacyItem(config.getString("wand-item", wandItem)); + + defaultChangeLimit = Math.max(-1, config.getInt( + "limits.max-blocks-changed.default", defaultChangeLimit)); + maxChangeLimit = Math.max(-1, + config.getInt("limits.max-blocks-changed.maximum", maxChangeLimit)); + + defaultMaxPolygonalPoints = Math.max(-1, + config.getInt("limits.max-polygonal-points.default", defaultMaxPolygonalPoints)); + maxPolygonalPoints = Math.max(-1, + config.getInt("limits.max-polygonal-points.maximum", maxPolygonalPoints)); + + defaultMaxPolyhedronPoints = Math.max(-1, config.getInt("limits.max-polyhedron-points.default", defaultMaxPolyhedronPoints)); + maxPolyhedronPoints = Math.max(-1, config.getInt("limits.max-polyhedron-points.maximum", maxPolyhedronPoints)); + + maxRadius = Math.max(-1, config.getInt("limits.max-radius", maxRadius)); + maxBrushRadius = config.getInt("limits.max-brush-radius", maxBrushRadius); + maxSuperPickaxeSize = Math.max(1, config.getInt( + "limits.max-super-pickaxe-size", maxSuperPickaxeSize)); + + butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius)); + butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius)); + + disallowedBlocks = new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(defaultDisallowedBlocks))); + allowedDataCycleBlocks = new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null)); + + registerHelp = config.getBoolean("register-help", true); + logCommands = config.getBoolean("logging.log-commands", logCommands); + logFile = config.getString("logging.file", logFile); + logFormat = config.getString("logging.format", logFormat); + + superPickaxeDrop = config.getBoolean("super-pickaxe.drop-items", + superPickaxeDrop); + superPickaxeManyDrop = config.getBoolean( + "super-pickaxe.many-drop-items", superPickaxeManyDrop); + + noDoubleSlash = config.getBoolean("no-double-slash", noDoubleSlash); + + useInventory = config.getBoolean("use-inventory.enable", useInventory); + useInventoryOverride = config.getBoolean("use-inventory.allow-override", + useInventoryOverride); + useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides", + useInventoryCreativeOverride); + + navigationWand = convertLegacyItem(config.getString("navigation-wand.item", navigationWand)); + navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance); + navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass); + + scriptTimeout = config.getInt("scripting.timeout", scriptTimeout); + scriptsDir = config.getString("scripting.dir", scriptsDir); + + calculationTimeout = config.getInt("calculation.timeout", calculationTimeout); + + saveDir = config.getString("saving.dir", saveDir); + + allowSymlinks = config.getBoolean("files.allow-symbolic-links", false); + LocalSession.MAX_HISTORY_SIZE = Math.max(0, config.getInt("history.size", 15)); + SessionManager.EXPIRATION_GRACE = config.getInt("history.expiration", 10) * 60 * 1000; + + showHelpInfo = config.getBoolean("show-help-on-first-use", true); + serverSideCUI = config.getBoolean("server-side-cui", true); + + String snapshotsDir = config.getString("snapshots.directory", ""); + if (!snapshotsDir.isEmpty()) { + snapshotRepo = new SnapshotRepository(snapshotsDir); + } + + String type = config.getString("shell-save-type", "").trim(); + shellSaveType = type.isEmpty() ? null : type; + + } + + public void unload() { + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java new file mode 100644 index 000000000..8421210e4 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java @@ -0,0 +1,490 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.net; + +import com.sk89q.worldedit.util.io.Closer; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.Closeable; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class HttpRequest implements Closeable { + + private static final int CONNECT_TIMEOUT = 1000 * 5; + private static final int READ_TIMEOUT = 1000 * 5; + private static final int READ_BUFFER_SIZE = 1024 * 8; + + private final Map headers = new HashMap<>(); + private final String method; + private final URL url; + private String contentType; + private byte[] body; + private HttpURLConnection conn; + private InputStream inputStream; + + private long contentLength = -1; + private long readBytes = 0; + + /** + * Create a new HTTP request. + * + * @param method the method + * @param url the URL + */ + private HttpRequest(String method, URL url) { + this.method = method; + this.url = url; + } + + /** + * Submit data. + * + * @return this object + */ + public HttpRequest body(String data) { + body = data.getBytes(); + return this; + } + + /** + * Submit form data. + * + * @param form the form + * @return this object + */ + public HttpRequest bodyForm(Form form) { + contentType = "application/x-www-form-urlencoded"; + body = form.toString().getBytes(); + return this; + } + + /** + * Add a header. + * + * @param key the header key + * @param value the header value + * @return this object + */ + public HttpRequest header(String key, String value) { + if (key.equalsIgnoreCase("Content-Type")) { + contentType = value; + } else { + headers.put(key, value); + } + return this; + } + + /** + * Execute the request. + *

    + * After execution, {@link #close()} should be called. + * + * @return this object + * @throws java.io.IOException on I/O error + */ + public HttpRequest execute() throws IOException { + boolean successful = false; + + try { + if (conn != null) { + throw new IllegalArgumentException("Connection already executed"); + } + + conn = (HttpURLConnection) reformat(url).openConnection(); + conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Java)"); + + if (body != null) { + conn.setRequestProperty("Content-Type", contentType); + conn.setRequestProperty("Content-Length", Integer.toString(body.length)); + conn.setDoInput(true); + } + + for (Map.Entry entry : headers.entrySet()) { + conn.setRequestProperty(entry.getKey(), entry.getValue()); + } + + conn.setRequestMethod(method); + conn.setUseCaches(false); + conn.setDoOutput(true); + conn.setConnectTimeout(CONNECT_TIMEOUT); + conn.setReadTimeout(READ_TIMEOUT); + + conn.connect(); + + if (body != null) { + DataOutputStream out = new DataOutputStream(conn.getOutputStream()); + out.write(body); + out.flush(); + out.close(); + } + + inputStream = conn.getResponseCode() == HttpURLConnection.HTTP_OK ? + conn.getInputStream() : conn.getErrorStream(); + + successful = true; + } finally { + if (!successful) { + close(); + } + } + + return this; + } + + /** + * Require that the response code is one of the given response codes. + * + * @param codes a list of codes + * @return this object + * @throws java.io.IOException if there is an I/O error or the response code is not expected + */ + public HttpRequest expectResponseCode(int... codes) throws IOException { + int responseCode = getResponseCode(); + + for (int code : codes) { + if (code == responseCode) { + return this; + } + } + + close(); + throw new IOException("Did not get expected response code, got " + responseCode + " for " + url); + } + + /** + * Get the response code. + * + * @return the response code + * @throws java.io.IOException on I/O error + */ + public int getResponseCode() throws IOException { + if (conn == null) { + throw new IllegalArgumentException("No connection has been made"); + } + + return conn.getResponseCode(); + } + + /** + * Get the input stream. + * + * @return the input stream + */ + public InputStream getInputStream() { + return inputStream; + } + + /** + * Buffer the returned response. + * + * @return the buffered response + * @throws java.io.IOException on I/O error + * @throws InterruptedException on interruption + */ + public BufferedResponse returnContent() throws IOException, InterruptedException { + if (inputStream == null) { + throw new IllegalArgumentException("No input stream available"); + } + + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + int b = 0; + while ((b = inputStream.read()) != -1) { + bos.write(b); + } + return new BufferedResponse(bos.toByteArray()); + } finally { + close(); + } + } + + /** + * Save the result to a file. + * + * @param file the file + * @return this object + * @throws java.io.IOException on I/O error + * @throws InterruptedException on interruption + */ + public HttpRequest saveContent(File file) throws IOException, InterruptedException { + Closer closer = Closer.create(); + + try { + FileOutputStream fos = closer.register(new FileOutputStream(file)); + BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos)); + + saveContent(bos); + } finally { + closer.close(); + } + + return this; + } + + /** + * Save the result to an output stream. + * + * @param out the output stream + * @return this object + * @throws java.io.IOException on I/O error + * @throws InterruptedException on interruption + */ + public HttpRequest saveContent(OutputStream out) throws IOException, InterruptedException { + BufferedInputStream bis; + + try { + String field = conn.getHeaderField("Content-Length"); + if (field != null) { + long len = Long.parseLong(field); + if (len >= 0) { // Let's just not deal with really big numbers + contentLength = len; + } + } + } catch (NumberFormatException ignored) { + } + + try { + bis = new BufferedInputStream(inputStream); + + byte[] data = new byte[READ_BUFFER_SIZE]; + int len = 0; + while ((len = bis.read(data, 0, READ_BUFFER_SIZE)) >= 0) { + out.write(data, 0, len); + readBytes += len; + } + } finally { + close(); + } + + return this; + } + + @Override + public void close() throws IOException { + if (conn != null) conn.disconnect(); + } + + /** + * Perform a GET request. + * + * @param url the URL + * @return a new request object + */ + public static HttpRequest get(URL url) { + return request("GET", url); + } + + /** + * Perform a POST request. + * + * @param url the URL + * @return a new request object + */ + public static HttpRequest post(URL url) { + return request("POST", url); + } + + /** + * Perform a request. + * + * @param method the method + * @param url the URL + * @return a new request object + */ + public static HttpRequest request(String method, URL url) { + return new HttpRequest(method, url); + } + + /** + * Create a new {@link java.net.URL} and throw a {@link RuntimeException} if the URL + * is not valid. + * + * @param url the url + * @return a URL object + * @throws RuntimeException if the URL is invalid + */ + public static URL url(String url) { + try { + return new URL(url); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + /** + * URL may contain spaces and other nasties that will cause a failure. + * + * @param existing the existing URL to transform + * @return the new URL, or old one if there was a failure + */ + private static URL reformat(URL existing) { + try { + URL url = new URL(existing.toString()); + URI uri = new URI( + url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), + url.getPath(), url.getQuery(), url.getRef()); + url = uri.toURL(); + return url; + } catch (MalformedURLException e) { + return existing; + } catch (URISyntaxException e) { + return existing; + } + } + + /** + * Used with {@link #bodyForm(Form)}. + */ + public final static class Form { + public final List elements = new ArrayList<>(); + + private Form() { + } + + /** + * Add a key/value to the form. + * + * @param key the key + * @param value the value + * @return this object + */ + public Form add(String key, String value) { + try { + elements.add(URLEncoder.encode(key, "UTF-8") + + "=" + URLEncoder.encode(value, "UTF-8")); + return this; + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + boolean first = true; + for (String element : elements) { + if (first) { + first = false; + } else { + builder.append("&"); + } + builder.append(element); + } + return builder.toString(); + } + + /** + * Create a new form. + * + * @return a new form + */ + public static Form create() { + return new Form(); + } + } + + /** + * Used to buffer the response in memory. + */ + public class BufferedResponse { + private final byte[] data; + + private BufferedResponse(byte[] data) { + this.data = data; + } + + /** + * Return the result as bytes. + * + * @return the data + */ + public byte[] asBytes() { + return data; + } + + /** + * Return the result as a string. + * + * @param encoding the encoding + * @return the string + * @throws java.io.IOException on I/O error + */ + public String asString(String encoding) throws IOException { + return new String(data, encoding); + } + + /** + * Save the result to a file. + * + * @param file the file + * @return this object + * @throws java.io.IOException on I/O error + * @throws InterruptedException on interruption + */ + public BufferedResponse saveContent(File file) throws IOException, InterruptedException { + Closer closer = Closer.create(); + file.getParentFile().mkdirs(); + + try { + FileOutputStream fos = closer.register(new FileOutputStream(file)); + BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos)); + + saveContent(bos); + } finally { + closer.close(); + } + + return this; + } + + /** + * Save the result to an output stream. + * + * @param out the output stream + * @return this object + * @throws java.io.IOException on I/O error + * @throws InterruptedException on interruption + */ + public BufferedResponse saveContent(OutputStream out) throws IOException, InterruptedException { + out.write(data); + + return this; + } + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java new file mode 100644 index 000000000..2eb306686 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java @@ -0,0 +1,70 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.paste; + +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.sk89q.worldedit.command.util.AsyncCommandHelper; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.util.task.Supervisor; + +import java.net.URL; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class ActorCallbackPaste { + + private static final Logger LOGGER = Logger.getLogger(ActorCallbackPaste.class.getSimpleName()); + + private ActorCallbackPaste() { + } + + /** + * Submit data to a pastebin service and inform the sender of + * success or failure. + * + * @param supervisor The supervisor instance + * @param sender The sender + * @param content The content + * @param successMessage The message, formatted with {@link String#format(String, Object...)} on success + */ + public static void pastebin(Supervisor supervisor, final Actor sender, String content, final String successMessage) { + ListenableFuture future = new EngineHubPaste().paste(content); + + AsyncCommandHelper.wrap(future, supervisor, sender) + .registerWithSupervisor("Submitting content to a pastebin service...") + .sendMessageAfterDelay("(Please wait... sending output to pastebin...)"); + + Futures.addCallback(future, new FutureCallback() { + @Override + public void onSuccess(URL url) { + sender.print(String.format(successMessage, url)); + } + + @Override + public void onFailure(Throwable throwable) { + LOGGER.log(Level.WARNING, "Failed to submit pastebin", throwable); + sender.printError("Failed to submit to a pastebin. Please see console for the error."); + } + }); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java new file mode 100644 index 000000000..da6b701fd --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java @@ -0,0 +1,78 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.paste; + +import com.google.common.util.concurrent.ListenableFuture; +import com.sk89q.worldedit.util.net.HttpRequest; +import org.json.simple.JSONValue; + +import java.io.IOException; +import java.net.URL; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class EngineHubPaste implements Paster { + + private static final Pattern URL_PATTERN = Pattern.compile("https?://.+$"); + + @Override + public ListenableFuture paste(String content) { + return Pasters.getExecutor().submit(new PasteTask(content)); + } + + private final class PasteTask implements Callable { + private final String content; + + private PasteTask(String content) { + this.content = content; + } + + @Override + public URL call() throws IOException, InterruptedException { + HttpRequest.Form form = HttpRequest.Form.create(); + form.add("content", content); + form.add("from", "worldguard"); + + URL url = HttpRequest.url("http://paste.enginehub.org/paste"); + String result = HttpRequest.post(url) + .bodyForm(form) + .execute() + .expectResponseCode(200) + .returnContent() + .asString("UTF-8").trim(); + + Object object = JSONValue.parse(result); + if (object instanceof Map) { + @SuppressWarnings("unchecked") + String urlString = String.valueOf(((Map) object).get("url")); + Matcher m = URL_PATTERN.matcher(urlString); + + if (m.matches()) { + return new URL(urlString); + } + } + + throw new IOException("Failed to save paste; instead, got: " + result); + } + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Pastebin.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Pastebin.java new file mode 100644 index 000000000..dcbef09b0 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Pastebin.java @@ -0,0 +1,93 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.paste; + +import com.google.common.util.concurrent.ListenableFuture; +import com.sk89q.worldedit.util.net.HttpRequest; + +import java.io.IOException; +import java.net.URL; +import java.util.concurrent.Callable; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Pastebin implements Paster { + + private static final Pattern URL_PATTERN = Pattern.compile("https?://pastebin.com/([^/]+)$"); + + private boolean mungingLinks = true; + + public boolean isMungingLinks() { + return mungingLinks; + } + + public void setMungingLinks(boolean mungingLinks) { + this.mungingLinks = mungingLinks; + } + + @Override + public ListenableFuture paste(String content) { + if (mungingLinks) { + content = content.replaceAll("http://", "http_//"); + } + + return Pasters.getExecutor().submit(new PasteTask(content)); + } + + private final class PasteTask implements Callable { + private final String content; + + private PasteTask(String content) { + this.content = content; + } + + @Override + public URL call() throws IOException, InterruptedException { + HttpRequest.Form form = HttpRequest.Form.create(); + form.add("api_option", "paste"); + form.add("api_dev_key", "4867eae74c6990dbdef07c543cf8f805"); + form.add("api_paste_code", content); + form.add("api_paste_private", "0"); + form.add("api_paste_name", ""); + form.add("api_paste_expire_date", "1W"); + form.add("api_paste_format", "text"); + form.add("api_user_key", ""); + + URL url = HttpRequest.url("http://pastebin.com/api/api_post.php"); + String result = HttpRequest.post(url) + .bodyForm(form) + .execute() + .expectResponseCode(200) + .returnContent() + .asString("UTF-8").trim(); + + Matcher m = URL_PATTERN.matcher(result); + + if (m.matches()) { + return new URL("http://pastebin.com/raw.php?i=" + m.group(1)); + } else if (result.matches("^https?://.+")) { + return new URL(result); + } else { + throw new IOException("Failed to save paste; instead, got: " + result); + } + } + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Paster.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Paster.java new file mode 100644 index 000000000..7a7d74cac --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Paster.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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.paste; + +import com.google.common.util.concurrent.ListenableFuture; + +import java.net.URL; + +public interface Paster { + + ListenableFuture paste(String content); + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Pasters.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Pasters.java new file mode 100644 index 000000000..b809f1836 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/Pasters.java @@ -0,0 +1,44 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.paste; + +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; + +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +final class Pasters { + + private static final ListeningExecutorService executor = + MoreExecutors.listeningDecorator( + new ThreadPoolExecutor(0, Integer.MAX_VALUE, + 2L, TimeUnit.SECONDS, + new SynchronousQueue<>())); + + private Pasters() { + } + + static ListeningExecutorService getExecutor() { + return executor; + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ConfigReport.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ConfigReport.java new file mode 100644 index 000000000..1a4b486a0 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ConfigReport.java @@ -0,0 +1,32 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.report; + +import com.sk89q.worldedit.WorldEdit; + +public class ConfigReport extends DataReport { + + public ConfigReport() { + super("WorldEdit Configuration"); + + append("Configuration", new HierarchyObjectReport("Configuration", WorldEdit.getInstance().getConfiguration())); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/HierarchyObjectReport.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/HierarchyObjectReport.java new file mode 100644 index 000000000..522693919 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/HierarchyObjectReport.java @@ -0,0 +1,32 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.report; + +public class HierarchyObjectReport extends ShallowObjectReport { + + public HierarchyObjectReport(String title, Object object) { + super(title, object); + + Class type = object.getClass(); + while ((type = type.getSuperclass()) != null) { + scanClass(object, type); + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ShallowObjectReport.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ShallowObjectReport.java index b94b63e65..bb4abb1f3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ShallowObjectReport.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ShallowObjectReport.java @@ -34,8 +34,10 @@ public class ShallowObjectReport extends DataReport { super(title); checkNotNull(object, "object"); - Class type = object.getClass(); + scanClass(object, object.getClass()); + } + void scanClass(Object object, Class type) { for (Field field : type.getDeclaredFields()) { if (Modifier.isStatic(field.getModifiers())) { continue; @@ -54,5 +56,4 @@ public class ShallowObjectReport extends DataReport { } } } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/AbstractTask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/AbstractTask.java new file mode 100644 index 000000000..e81e2bf22 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/AbstractTask.java @@ -0,0 +1,74 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.task; + +import com.google.common.util.concurrent.AbstractFuture; + +import javax.annotation.Nullable; +import java.util.Date; +import java.util.UUID; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * An abstract task that stores a name and owner. + * + * @param the type returned + */ +public abstract class AbstractTask extends AbstractFuture implements Task { + + private final UUID uniqueId = UUID.randomUUID(); + private final String name; + private final Object owner; + private final Date creationDate = new Date(); + + /** + * Create a new instance. + * + * @param name the name + * @param owner the owner + */ + protected AbstractTask(String name, @Nullable Object owner) { + checkNotNull(name); + this.name = name; + this.owner = owner; + } + + @Override + public UUID getUniqueId() { + return uniqueId; + } + + @Override + public String getName() { + return name; + } + + @Nullable + @Override + public Object getOwner() { + return owner; + } + + @Override + public Date getCreationDate() { + return creationDate; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/FutureForwardingTask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/FutureForwardingTask.java new file mode 100644 index 000000000..61f5d75a9 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/FutureForwardingTask.java @@ -0,0 +1,121 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.task; + +import com.google.common.util.concurrent.ListenableFuture; +import com.sk89q.worldedit.util.task.progress.Progress; + +import javax.annotation.Nullable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * A task that wraps a {@code ListenableFuture}. + * + *

    {@link Task.State#SCHEDULED} is never returned because it is not possible + * to test whether the future has "started," so {@link Task.State#RUNNING} is + * returned in its place.

    + * + *

    Use {@link #create(ListenableFuture, String, Object)} to create a new + * instance.

    + * + * @param the type returned + */ +public class FutureForwardingTask extends AbstractTask { + + private final ListenableFuture future; + + private FutureForwardingTask(ListenableFuture future, String name, @Nullable Object owner) { + super(name, owner); + checkNotNull(future); + this.future = future; + } + + @Override + public void addListener(Runnable listener, Executor executor) { + future.addListener(listener, executor); + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + return future.cancel(mayInterruptIfRunning); + } + + @Override + public boolean isCancelled() { + return future.isCancelled(); + } + + @Override + public boolean isDone() { + return future.isDone(); + } + + @Override + public V get() throws InterruptedException, ExecutionException { + return future.get(); + } + + @Override + public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + return future.get(timeout, unit); + } + + @Override + public State getState() { + if (isCancelled()) { + return State.CANCELLED; + } else if (isDone()) { + try { + get(); + return State.SUCCEEDED; + } catch (InterruptedException e) { + return State.CANCELLED; + } catch (ExecutionException e) { + return State.FAILED; + } + } else { + return State.RUNNING; + } + } + + @Override + public Progress getProgress() { + return Progress.indeterminate(); + } + + /** + * Create a new instance. + * + * @param future the future + * @param name the name of the task + * @param owner the owner of the task, or {@code null} + * @param the type returned by the future + * @return a new instance + */ + public static FutureForwardingTask create(ListenableFuture future, String name, @Nullable Object owner) { + return new FutureForwardingTask<>(future, name, owner); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/SimpleSupervisor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/SimpleSupervisor.java new file mode 100644 index 000000000..0712cc5dd --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/SimpleSupervisor.java @@ -0,0 +1,59 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.task; + +import com.google.common.util.concurrent.MoreExecutors; + +import java.util.ArrayList; +import java.util.List; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * An implementation of a {@code Supervisor}. + */ +public class SimpleSupervisor implements Supervisor { + + private final List> monitored = new ArrayList<>(); + private final Object lock = new Object(); + + @Override + public List> getTasks() { + synchronized (lock) { + return new ArrayList<>(monitored); + } + } + + @Override + public void monitor(final Task task) { + checkNotNull(task); + + synchronized (lock) { + monitored.add(task); + } + + task.addListener(() -> { + synchronized (lock) { + monitored.remove(task); + } + }, MoreExecutors.directExecutor()); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/Supervisor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/Supervisor.java new file mode 100644 index 000000000..9b470700e --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/Supervisor.java @@ -0,0 +1,44 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.task; + +import java.util.List; + +/** + * Manages running tasks and informs users of their progress, but does not + * execute the task. + */ +public interface Supervisor { + + /** + * Get a list of running or queued tasks. + * + * @return a list of tasks + */ + List> getTasks(); + + /** + * Monitor the given task. + * + * @param task the task + */ + void monitor(Task task); + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/Task.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/Task.java new file mode 100644 index 000000000..169cf1718 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/Task.java @@ -0,0 +1,97 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.task; + +import com.google.common.util.concurrent.ListenableFuture; +import com.sk89q.worldedit.util.task.progress.ProgressObservable; + +import javax.annotation.Nullable; +import java.util.Date; +import java.util.UUID; + +/** + * A task is a job that can be scheduled, run, or cancelled. Tasks can report + * on their own status. Tasks have owners. + */ +public interface Task extends ListenableFuture, ProgressObservable { + + /** + * Get the unique ID of this task. + * + * @return this task's unique ID + */ + UUID getUniqueId(); + + /** + * Get the name of the task so it can be printed to the user. + * + * @return the name of the task + */ + String getName(); + + /** + * Get the owner of the task. + * + * @return an owner object, if one is known or valid, otherwise {@code null} + */ + @Nullable + Object getOwner(); + + /** + * Get the state of the task. + * + * @return the state of the task + */ + State getState(); + + /** + * Get the time at which the task was created. + * + * @return a date + */ + Date getCreationDate(); + + /** + * Represents the state of a task. + */ + enum State { + /** + * The task has been scheduled to run but is not running yet. + */ + SCHEDULED, + /** + * The task has been cancelled and may be stopped or will stop. + */ + CANCELLED, + /** + * The task is currently running. + */ + RUNNING, + /** + * The task has failed. + */ + FAILED, + /** + * The task has succeeded. + */ + SUCCEEDED + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/TaskStateComparator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/TaskStateComparator.java new file mode 100644 index 000000000..38b77e73e --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/TaskStateComparator.java @@ -0,0 +1,43 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.task; + +import java.util.Comparator; + +/** + * Compares task states according to the order of the {@link Task.State} + * enumeration. + */ +public class TaskStateComparator implements Comparator> { + + @Override + public int compare(com.sk89q.worldedit.util.task.Task o1, Task o2) { + int ordinal1 = o1.getState().ordinal(); + int ordinal2 = o2.getState().ordinal(); + if (ordinal1 < ordinal2) { + return -1; + } else if (ordinal1 > ordinal2) { + return 1; + } else { + return 0; + } + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/Progress.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/Progress.java new file mode 100644 index 000000000..d3d0571ae --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/Progress.java @@ -0,0 +1,183 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.task.progress; + +import java.util.Arrays; +import java.util.Collection; + +/** + * A progress object describes the progress of an operation, specifying + * either a percentage of completion or a status of indeterminacy. + * + *

    Progress objects are immutable.

    + * + *

    To create a new instance, use one of the static constructors + * on this class.

    + */ +public abstract class Progress { + + /** + * Create a new instance. + */ + private Progress() { + } + + /** + * Return whether the current progress is indeterminate. + * + * @return true if indeterminate + */ + public abstract boolean isIndeterminate(); + + /** + * Get the progress percentage. + * + *

    If {@link #isIndeterminate()} returns {@code true}, the behavior + * of this method is undefined.

    + * + * @return a number in the range [0, 1] + */ + public abstract double getProgress(); + + /** + * Get a static progress object that is indeterminate. + * + * @return a progress object + */ + public static Progress indeterminate() { + return INDETERMINATE; + } + + /** + * Get a static progress object that is complete. + * + * @return a progress object + */ + public static Progress completed() { + return COMPLETED; + } + + /** + * Create a new progress object with the given percentage. + * + * @param value the percentage, which will be clamped to [0, 1] + * @return a progress object + */ + public static Progress of(double value) { + if (value < 0) { + value = 0; + } else if (value > 1) { + value = 1; + } + + final double finalValue = value; + return new Progress() { + @Override + public boolean isIndeterminate() { + return false; + } + + @Override + public double getProgress() { + return finalValue; + } + }; + } + + /** + * Create a new progress object with progress split equally between the + * given progress objects. + * + * @param objects an array of progress objects + * @return a new progress value + */ + public static Progress split(Progress... objects) { + return split(Arrays.asList(objects)); + } + + /** + * Create a new progress object with progress split equally between the + * given progress objects. + * + * @param progress a collection of progress objects + * @return a new progress value + */ + public static Progress split(Collection progress) { + int count = 0; + double total = 0; + + for (Progress p : progress) { + if (p.isIndeterminate()) { + return indeterminate(); + } + total += p.getProgress(); + } + + return of(total / count); + } + + /** + * Create a new progress object with progress split equally between the + * given {@link ProgressObservable}s. + * + * @param observables an array of observables + * @return a new progress value + */ + public static Progress splitObservables(ProgressObservable... observables) { + return splitObservables(Arrays.asList(observables)); + } + + /** + * Create a new progress object with progress split equally between the + * given {@link ProgressObservable}s. + * + * @param observables a collection of observables + * @return a new progress value + */ + public static Progress splitObservables(Collection observables) { + int count = 0; + double total = 0; + + for (ProgressObservable observable : observables) { + Progress p = observable.getProgress(); + if (p.isIndeterminate()) { + return indeterminate(); + } + total += p.getProgress(); + } + + return of(total / count); + } + + private static final Progress COMPLETED = of(1); + + private static final Progress INDETERMINATE = new Progress() { + @Override + public boolean isIndeterminate() { + return true; + } + + @Override + public double getProgress() { + return 0; + } + }; + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/ProgressIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/ProgressIterator.java new file mode 100644 index 000000000..11eb34f32 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/ProgressIterator.java @@ -0,0 +1,100 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.task.progress; + +import java.util.Iterator; +import java.util.List; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * An iterator that keeps track of how many entries have been visited and + * calculates a "percent completed" using a provided total count. + * + *

    The returned progress percentage will always be between 0 or 1 + * (inclusive). If the iterator returns more entries than the total count, + * then 100% will be returned for the progress.

    + * + * @param the type + */ +public class ProgressIterator implements Iterator, ProgressObservable { + + private final Iterator iterator; + private final int count; + private int visited = 0; + + /** + * Create a new instance. + * + * @param iterator the iterator + * @param count the count + */ + private ProgressIterator(Iterator iterator, int count) { + checkNotNull(iterator); + this.iterator = iterator; + this.count = count; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public V next() { + V value = iterator.next(); + visited++; + return value; + } + + @Override + public void remove() { + iterator.remove(); + } + + @Override + public Progress getProgress() { + return Progress.of(count > 0 ? Math.min(1, Math.max(0, (visited / (double) count))) : 1); + } + + /** + * Create a new instance. + * + * @param iterator the iterator + * @param count the number of objects + * @param the type + * @return an instance + */ + public static ProgressIterator create(Iterator iterator, int count) { + return new ProgressIterator(iterator, count); + } + + /** + * Create a new instance from a list. + * + * @param list a list + * @param the type + * @return an instance + */ + public static ProgressIterator create(List list) { + return create(list.iterator(), list.size()); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/ProgressObservable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/ProgressObservable.java new file mode 100644 index 000000000..b109e12a2 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/progress/ProgressObservable.java @@ -0,0 +1,34 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.task.progress; + +/** + * An object that is able to report on its progress. + */ +public interface ProgressObservable { + + /** + * Get the current percentage of completion. + * + * @return a progress object + */ + Progress getProgress(); + +} diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java index ed9f76c5c..eb4c64d50 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java @@ -23,6 +23,7 @@ import com.google.common.reflect.TypeToken; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.session.SessionManager; +import com.sk89q.worldedit.util.report.Unreported; import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.snapshot.SnapshotRepository; import ninja.leaping.configurate.ConfigurationOptions; @@ -36,10 +37,10 @@ import java.util.HashSet; public class ConfigurateConfiguration extends LocalConfiguration { - protected final ConfigurationLoader config; - protected final Logger logger; + @Unreported protected final ConfigurationLoader config; + @Unreported protected final Logger logger; - protected CommentedConfigurationNode node; + @Unreported protected CommentedConfigurationNode node; public ConfigurateConfiguration(ConfigurationLoader config, Logger logger) { this.config = config; From b300c211859d128793a397618c32de9de059b78c Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 20 Dec 2018 13:43:01 +1000 Subject: [PATCH 068/182] Update draw.js and roof.js --- contrib/craftscripts/README.txt | 2 +- contrib/craftscripts/SUBMITTING.txt | 2 +- contrib/craftscripts/draw.js | 46 +++++++++++++------ contrib/craftscripts/quickshot.js | 10 ++-- contrib/craftscripts/roof.js | 14 +++--- .../util/formatting/ColorCodeBuilder.java | 2 +- 6 files changed, 47 insertions(+), 29 deletions(-) diff --git a/contrib/craftscripts/README.txt b/contrib/craftscripts/README.txt index 607196a4e..7638e67ed 100644 --- a/contrib/craftscripts/README.txt +++ b/contrib/craftscripts/README.txt @@ -2,7 +2,7 @@ CraftScripts are script files for WorldEdit that let you write world editing scripts with JavaScript easily. Example usage: -/cs maze.js lightstone 10 10 +/cs maze.js glowstone 10 10 You may or may not install these scripts -- it is optional. If you are, however, place the entire craftscripts/ folder into the respective directory for the platform diff --git a/contrib/craftscripts/SUBMITTING.txt b/contrib/craftscripts/SUBMITTING.txt index d39505cf5..b519effe8 100644 --- a/contrib/craftscripts/SUBMITTING.txt +++ b/contrib/craftscripts/SUBMITTING.txt @@ -7,4 +7,4 @@ Note: Legally you should not release things to the public domain as not all countries have the concept of public domain in their copyright law. You can also post your scripts here: -http://forum.sk89q.com/forums/craftscripts.6/ \ No newline at end of file +https://discord.gg/YKbmj7V or http://forum.sk89q.com/forums/craftscripts.6/ \ No newline at end of file diff --git a/contrib/craftscripts/draw.js b/contrib/craftscripts/draw.js index 0454864f3..bc78843b9 100644 --- a/contrib/craftscripts/draw.js +++ b/contrib/craftscripts/draw.js @@ -43,8 +43,26 @@ var clothColors = [ makeColor(100, 60, 0), // Brown makeColor(48, 80, 0), // Cactus green makeColor(255, 0, 0), // Red - makeColor(0, 0, 0), // Black -] + makeColor(0, 0, 0) // Black +]; +var clothBlocks = [ + context.getBlock("white_wool"), + context.getBlock("orange_wool"), + context.getBlock("magenta_wool"), + context.getBlock("light_blue_wool"), + context.getBlock("yellow_wool"), + context.getBlock("lime_wool"), + context.getBlock("pink_wool"), + context.getBlock("gray_wool"), + context.getBlock("light_gray_wool"), + context.getBlock("cyan_wool"), + context.getBlock("purple_wool"), + context.getBlock("blue_wool"), + context.getBlock("brown_wool"), + context.getBlock("green_wool"), + context.getBlock("red_wool"), + context.getBlock("black_wool") +]; var clothColorsOpt = [ makeColor(178, 178, 178), // White makeColor(187, 102, 44), // Orange @@ -61,8 +79,8 @@ var clothColorsOpt = [ makeColor(68, 41, 22), // Brown makeColor(44, 61, 19), // Cactus green makeColor(131, 36, 32), // Red - makeColor(21, 18, 18), // Black -] + makeColor(21, 18, 18) // Black +]; var clothColorsOptHD = [ makeColor(168, 168, 168), // White makeColor(143, 59, 0), // Orange @@ -79,8 +97,8 @@ var clothColorsOptHD = [ makeColor(52, 25, 0), // Brown makeColor(10, 76, 10), // Cactus green makeColor(127, 9, 9), // Red - makeColor(17, 17, 17), // Black -] + makeColor(17, 17, 17) // Black +]; // http://stackoverflow.com/questions/2103368/color-logic-algorithm/2103608#2103608 function colorDistance(c1, c2) { @@ -90,7 +108,7 @@ function colorDistance(c1, c2) { var b = c1.getBlue() - c2.getBlue(); var weightR = 2 + rmean/256; var weightG = 4.0; - var weightB = 2 + (255-rmean)/256 + var weightB = 2 + (255-rmean)/256; return Math.sqrt(weightR*r*r + weightG*g*g + weightB*b*b); } @@ -113,14 +131,14 @@ function findClosestWoolColor(col, clothColors) { context.checkArgs(1, 3, " "); -var f = context.getSafeFile("drawings", argv[1]); +var f = context.getSafeOpenFile("drawings", argv[1], "png", ["png", "jpg", "jpeg", "bmp"]); var sess = context.remember(); -var upright = argv[2] == "v"; +var upright = argv[2] === "v"; var colors = clothColors; -if(argv[3] == "opt") { +if(argv[3] === "opt") { colors = clothColorsOpt; player.print("Using optimized palette"); -} else if(argv[3] == "optHD") { +} else if(argv[3] === "optHD") { colors = clothColorsOptHD; player.print("Using optimized HD palette"); } @@ -132,7 +150,7 @@ if (!f.exists()) { var width = img.getWidth(); var height = img.getHeight(); - var origin = player.getBlockIn(); + var origin = player.getBlockIn().toVector().toBlockPoint(); for (var x = 0; x < width; x++) { for (var y = 0; y < height; y++) { @@ -141,9 +159,9 @@ if (!f.exists()) { // Added this to enable the user to create images upright // rather than flat on the ground if (!upright) { - sess.setBlock(origin.add(x, 0, y), new BaseBlock(35, data)); + sess.setBlock(origin.add(x, 0, y), clothBlocks[data]); } else { - sess.setBlock(origin.add(x, height - y, 0), new BaseBlock(35, data)); + sess.setBlock(origin.add(x, height - y, 0), clothBlocks[data]); } } } diff --git a/contrib/craftscripts/quickshot.js b/contrib/craftscripts/quickshot.js index e47820ea7..27480e282 100644 --- a/contrib/craftscripts/quickshot.js +++ b/contrib/craftscripts/quickshot.js @@ -20,11 +20,11 @@ importPackage(Packages.com.sk89q.worldedit); importPackage(Packages.com.sk89q.worldedit.blocks); -var torchDirs = {} -torchDirs[PlayerDirection.NORTH] = [2, 4]; -torchDirs[PlayerDirection.SOUTH] = [1, 3]; -torchDirs[PlayerDirection.WEST] = [3, 2]; -torchDirs[PlayerDirection.EAST] = [4, 1]; +var torchDirs = {}; +torchDirs[Direction.NORTH] = [2, 4]; +torchDirs[Direction.SOUTH] = [1, 3]; +torchDirs[Direction.WEST] = [3, 2]; +torchDirs[Direction.EAST] = [4, 1]; var pitches = { "f#": 0, diff --git a/contrib/craftscripts/roof.js b/contrib/craftscripts/roof.js index 35e03c244..b1201ea3a 100644 --- a/contrib/craftscripts/roof.js +++ b/contrib/craftscripts/roof.js @@ -16,20 +16,20 @@ * along with this program. If not, see . */ -importPackage(Packages.java.io); -importPackage(Packages.java.awt); importPackage(Packages.com.sk89q.worldedit); +importPackage(Packages.com.sk89q.worldedit.math); importPackage(Packages.com.sk89q.worldedit.blocks); var blocks = context.remember(); var session = context.getSession(); -var region = session.getRegion(); +var player = context.getPlayer(); +var region = session.getRegionSelector(player.getWorld()).getRegion(); context.checkArgs(1, 1, ""); var blocktype = context.getBlock(argv[1]); -var cycles = region.getLength() +var cycles = region.getLength(); if (region.getWidth() > cycles){ cycles = region.getWidth(); @@ -40,12 +40,12 @@ cycles = cycles / 2; for (var c = 0; c < cycles; c++) { for (var w = 0; w < region.getWidth() - (c * 2); w++) { for (var l = 0; l < region.getLength() - (c * 2); l++) { - if (w == 0 || w == (region.getWidth() - (c * 2)) - 1 || l == 0 || l == (region.getLength() - (c * 2)) - 1) { - var vec = new Vector( + if (w === 0 || w === (region.getWidth() - (c * 2)) - 1 || l === 0 || l === (region.getLength() - (c * 2)) - 1) { + var vec = BlockVector3.at( region.getMinimumPoint().getX() + (w + c), region.getMaximumPoint().getY() + c, region.getMinimumPoint().getZ() + (l + c)); - + blocks.setBlock(vec, blocktype); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java index 0134827f5..dbaa904ce 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java @@ -127,7 +127,7 @@ public class ColorCodeBuilder { } else if (!resetFrom.hasEqualFormatting(resetTo) || (resetFrom.getColor() != null && resetTo.getColor() == null)) { // Have to set reset code and add back all the formatting codes - return String.valueOf(Style.RESET) + getCode(resetTo); + return Style.RESET + getCode(resetTo); } else { if (resetFrom.getColor() != resetTo.getColor()) { return String.valueOf(resetTo.getColor()); From c949b07df12a8ced450e82d62c9f0ed3a8310bf1 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 21 Dec 2018 16:56:10 +1000 Subject: [PATCH 069/182] Added a method to teleport entities across worlds. --- .../sk89q/worldedit/bukkit/BukkitEntity.java | 10 ++ .../sk89q/worldedit/bukkit/BukkitPlayer.java | 5 + .../com/sk89q/worldedit/entity/Entity.java | 8 + .../extension/platform/PlayerProxy.java | 5 + .../worldedit/extent/ChangeSetExtent.java | 6 + .../extent/clipboard/StoredEntity.java | 5 + .../util/gson/BlockVectorAdapter.java | 46 +++++ .../sk89q/worldedit/util/gson/GsonUtil.java | 2 + .../worldedit/util/gson/VectorAdapter.java | 4 +- .../sk89q/worldedit/forge/ForgeEntity.java | 6 + .../sk89q/worldedit/forge/ForgePlayer.java | 6 + .../sk89q/worldedit/sponge/SpongeAdapter.java | 168 ++++++++++++++++++ .../sk89q/worldedit/sponge/SpongeEntity.java | 10 ++ .../sk89q/worldedit/sponge/SpongePlayer.java | 8 + 14 files changed, 287 insertions(+), 2 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/BlockVectorAdapter.java create mode 100644 worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java index 418980ad7..4de42d497 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java @@ -71,6 +71,16 @@ class BukkitEntity implements Entity { } } + @Override + public boolean setLocation(Location location) { + org.bukkit.entity.Entity entity = entityRef.get(); + if (entity != null) { + return entity.teleport(BukkitAdapter.adapt(location)); + } else { + return false; + } + } + @Override public BaseEntity getState() { org.bukkit.entity.Entity entity = entityRef.get(); 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 0ec373f63..712f2b2d6 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 @@ -200,6 +200,11 @@ public class BukkitPlayer extends AbstractPlayerActor { nativeLocation.getPitch()); } + @Override + public boolean setLocation(com.sk89q.worldedit.util.Location location) { + return player.teleport(BukkitAdapter.adapt(location)); + } + @Nullable @Override public T getFacet(Class cls) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java index ef806ce7c..31bff6968 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java @@ -54,6 +54,14 @@ public interface Entity extends Faceted { */ Location getLocation(); + /** + * Sets the location of this entity. + * + * @param location the new location of the entity + * @return if the teleport worked + */ + boolean setLocation(Location location); + /** * Get the extent that this entity is on. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java index 7d8a1b3da..4d241196d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java @@ -97,6 +97,11 @@ class PlayerProxy extends AbstractPlayerActor { return basePlayer.getLocation(); } + @Override + public boolean setLocation(Location location) { + return basePlayer.setLocation(location); + } + @Override public void setPosition(Vector3 pos, float pitch, float yaw) { basePlayer.setPosition(pos, pitch, yaw); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java index 15ccf544b..9d804956a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java @@ -110,6 +110,12 @@ public class ChangeSetExtent extends AbstractDelegateExtent { return entity.getLocation(); } + @Override + public boolean setLocation(Location location) { + // TODO Add a changeset for this. + return entity.setLocation(location); + } + @Override public Extent getExtent() { return entity.getExtent(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java index 4b56e5e06..ebece5abf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java @@ -68,6 +68,11 @@ abstract class StoredEntity implements Entity { return location; } + @Override + public boolean setLocation(Location location) { + throw new IllegalArgumentException("StoredEntities are immutable"); + } + @Override public Extent getExtent() { return location.getExtent(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/BlockVectorAdapter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/BlockVectorAdapter.java new file mode 100644 index 000000000..8b86b7542 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/BlockVectorAdapter.java @@ -0,0 +1,46 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.util.gson; + +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.sk89q.worldedit.math.BlockVector3; + +import java.lang.reflect.Type; + +public class BlockVectorAdapter implements JsonDeserializer { + + @Override + public BlockVector3 deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + JsonArray jsonArray = json.getAsJsonArray(); + if (jsonArray.size() != 3) { + throw new JsonParseException("Expected array of 3 length for BlockVector3"); + } + + double x = jsonArray.get(0).getAsInt(); + double y = jsonArray.get(1).getAsInt(); + double z = jsonArray.get(2).getAsInt(); + + return BlockVector3.at(x, y, z); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/GsonUtil.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/GsonUtil.java index 5d73c68ea..358cd143d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/GsonUtil.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/GsonUtil.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.util.gson; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; /** @@ -39,6 +40,7 @@ public final class GsonUtil { public static GsonBuilder createBuilder() { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter()); + gsonBuilder.registerTypeAdapter(BlockVector3.class, new BlockVectorAdapter()); return gsonBuilder; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java index ec164d045..c76311299 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java @@ -29,7 +29,7 @@ import com.sk89q.worldedit.math.Vector3; import java.lang.reflect.Type; /** - * Deserializes {@code Vector}s for GSON. + * Deserializes {@code Vector3}s for GSON. */ public class VectorAdapter implements JsonDeserializer { @@ -37,7 +37,7 @@ public class VectorAdapter implements JsonDeserializer { public Vector3 deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonArray jsonArray = json.getAsJsonArray(); if (jsonArray.size() != 3) { - throw new JsonParseException("Expected array of 3 length for Vector"); + throw new JsonParseException("Expected array of 3 length for Vector3"); } double x = jsonArray.get(0).getAsDouble(); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java index b5cd5f516..e4b391fe0 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java @@ -76,6 +76,12 @@ class ForgeEntity implements Entity { } } + @Override + public boolean setLocation(Location location) { + // TODO + return false; + } + @Override public Extent getExtent() { net.minecraft.entity.Entity entity = entityRef.get(); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index 5523ad642..3930f4a03 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -92,6 +92,12 @@ public class ForgePlayer extends AbstractPlayerActor { this.player.rotationPitch); } + @Override + public boolean setLocation(Location location) { + // TODO + return false; + } + @Override public com.sk89q.worldedit.world.World getWorld() { return ForgeWorldEdit.inst.getWorld(this.player.world); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java new file mode 100644 index 000000000..f5df77298 --- /dev/null +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java @@ -0,0 +1,168 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.sponge; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.flowpowered.math.vector.Vector3d; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; +import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.World; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.entity.living.player.Player; + +/** + * Adapts between Sponge and WorldEdit equivalent objects. + */ +public class SpongeAdapter { + + private SpongeAdapter() { + } + + /** + * Create a WorldEdit world from a Sponge extent. + * + * @param world the Sponge extent + * @return a WorldEdit world + */ + public static World checkWorld(org.spongepowered.api.world.extent.Extent world) { + checkNotNull(world); + if (world instanceof org.spongepowered.api.world.World) { + return adapt((org.spongepowered.api.world.World) world); + } else { + throw new IllegalArgumentException("Extent type is not a world"); + } + } + + /** + * Create a WorldEdit world from a Sponge world. + * + * @param world the Sponge world + * @return a WorldEdit world + */ + public static World adapt(org.spongepowered.api.world.World world) { + checkNotNull(world); + return SpongeWorldEdit.inst().getWorld(world); + } + + /** + * Create a WorldEdit Player from a Sponge Player. + * + * @param player The Sponge player + * @return The WorldEdit player + */ + public static SpongePlayer adapt(Player player) { + return SpongeWorldEdit.inst().wrapPlayer(player); + } + + /** + * Create a Bukkit Player from a WorldEdit Player. + * + * @param player The WorldEdit player + * @return The Bukkit player + */ + public static Player adapt(com.sk89q.worldedit.entity.Player player) { + return ((SpongePlayer) player).getPlayer(); + } + + /** + * Create a Sponge world from a WorldEdit world. + * + * @param world the WorldEdit world + * @return a Sponge world + */ + public static org.spongepowered.api.world.World adapt(World world) { + checkNotNull(world); + if (world instanceof SpongeWorld) { + return ((SpongeWorld) world).getWorld(); + } else { + org.spongepowered.api.world.World match = Sponge.getServer().getWorld(world.getName()).orElse(null); + if (match != null) { + return match; + } else { + throw new IllegalArgumentException("Can't find a Sponge world for " + world); + } + } + } + + /** + * Create a WorldEdit location from a Sponge location. + * + * @param location the Sponge location + * @return a WorldEdit location + */ + public static Location adapt(org.spongepowered.api.world.Location location, Vector3d rotation) { + checkNotNull(location); + Vector3 position = asVector(location); + return new Location( + adapt(location.getExtent()), + position, + (float) rotation.getX(), + (float) rotation.getY()); + } + + /** + * Create a Sponge location from a WorldEdit location. + * + * @param location the WorldEdit location + * @return a Sponge location + */ + public static org.spongepowered.api.world.Location adapt(Location location) { + checkNotNull(location); + Vector3 position = location.toVector(); + return new org.spongepowered.api.world.Location<>( + adapt((World) location.getExtent()), + position.getX(), position.getY(), position.getZ()); + } + + /** + * Create a Sponge rotation from a WorldEdit location. + * + * @param location the WorldEdit location + * @return a Sponge rotation + */ + public static Vector3d adaptRotation(Location location) { + checkNotNull(location); + return new Vector3d(location.getPitch(), location.getYaw(), 0); + } + + /** + * Create a WorldEdit Vector from a Bukkit location. + * + * @param location The Bukkit location + * @return a WorldEdit vector + */ + public static Vector3 asVector(org.spongepowered.api.world.Location location) { + checkNotNull(location); + return Vector3.at(location.getX(), location.getY(), location.getZ()); + } + + /** + * Create a WorldEdit BlockVector from a Bukkit location. + * + * @param location The Bukkit location + * @return a WorldEdit vector + */ + public static BlockVector3 asBlockVector(org.spongepowered.api.world.Location location) { + checkNotNull(location); + return BlockVector3.at(location.getX(), location.getY(), location.getZ()); + } +} diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java index 9aa728310..db070d9f1 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java @@ -66,6 +66,16 @@ class SpongeEntity implements Entity { } } + @Override + public boolean setLocation(Location location) { + org.spongepowered.api.entity.Entity entity = entityRef.get(); + if (entity != null) { + return entity.setLocation(SpongeAdapter.adapt(location)); + } else { + return false; + } + } + @Override public Extent getExtent() { org.spongepowered.api.entity.Entity entity = entityRef.get(); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java index 08f7b47c3..3a4d74edd 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java @@ -96,6 +96,11 @@ public class SpongePlayer extends AbstractPlayerActor { return SpongeWorldEdit.inst().getAdapter().adapt(entityLoc, entityRot); } + @Override + public boolean setLocation(Location location) { + return player.setLocation(SpongeAdapter.adapt(location)); + } + @Override public com.sk89q.worldedit.world.World getWorld() { return SpongeWorldEdit.inst().getAdapter().getWorld(player.getWorld()); @@ -248,4 +253,7 @@ public class SpongePlayer extends AbstractPlayerActor { } + public Player getPlayer() { + return player; + } } From ea3057878141548b44c6dd269d33b019b7bc1c99 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 21 Dec 2018 17:05:30 +1000 Subject: [PATCH 070/182] Added a way to get the spawn position of a world --- .../main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java | 5 +++++ .../src/main/java/com/sk89q/worldedit/world/NullWorld.java | 5 +++++ .../src/main/java/com/sk89q/worldedit/world/World.java | 7 +++++++ .../main/java/com/sk89q/worldedit/forge/ForgeAdapter.java | 4 ++-- .../main/java/com/sk89q/worldedit/forge/ForgeWorld.java | 5 +++++ .../main/java/com/sk89q/worldedit/sponge/SpongeWorld.java | 5 +++++ 6 files changed, 29 insertions(+), 2 deletions(-) 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 8bffc3a2e..6b5a2ef77 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 @@ -404,6 +404,11 @@ public class BukkitWorld extends AbstractWorld { } } + @Override + public BlockVector3 getSpawnPosition() { + return BukkitAdapter.asBlockVector(getWorld().getSpawnLocation()); + } + @Override public void simulateBlockMine(BlockVector3 pt) { getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally(); 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 eec1d47a9..6ac2ba3a0 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 @@ -125,6 +125,11 @@ public class NullWorld extends AbstractWorld { public void setWeather(WeatherType weatherType, long duration) { } + @Override + public BlockVector3 getSpawnPosition() { + return BlockVector3.ZERO; + } + @Override public BlockState getBlock(BlockVector3 position) { return BlockTypes.AIR.getDefaultState(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java index d47723a42..b335de3cb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java @@ -246,6 +246,13 @@ public interface World extends Extent { */ void setWeather(WeatherType weatherType, long duration); + /** + * Gets the spawn position of this world. + * + * @return The spawn position + */ + BlockVector3 getSpawnPosition(); + @Override boolean equals(Object other); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index 671e2e0f4..e0f319cee 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -54,8 +54,8 @@ final class ForgeAdapter { return Vector3.at(vector.x, vector.y, vector.z); } - public static Vector3 adapt(BlockPos pos) { - return Vector3.at(pos.getX(), pos.getY(), pos.getZ()); + public static BlockVector3 adapt(BlockPos pos) { + return BlockVector3.at(pos.getX(), pos.getY(), pos.getZ()); } public static Vec3d toVec3(BlockVector3 vector) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index d3d84d48a..2a4fe60c0 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -467,6 +467,11 @@ public class ForgeWorld extends AbstractWorld { } } + @Override + public BlockVector3 getSpawnPosition() { + return ForgeAdapter.adapt(getWorld().getSpawnPoint()); + } + @Override public BlockState getBlock(BlockVector3 position) { World world = getWorld(); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index e3401190e..a6631a252 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -320,6 +320,11 @@ public abstract class SpongeWorld extends AbstractWorld { getWorld().setWeather(Sponge.getRegistry().getType(Weather.class, weatherType.getId()).get(), duration); } + @Override + public BlockVector3 getSpawnPosition() { + return SpongeAdapter.asBlockVector(getWorld().getSpawnLocation()); + } + /** * Thrown when the reference to the world is lost. */ From 8d0787746324172f680add66c6c4a62a961ca1c8 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 21 Dec 2018 17:31:27 +1000 Subject: [PATCH 071/182] Pass the exception converter through more. --- .../sk89q/worldedit/command/WorldEditCommands.java | 5 ++++- .../worldedit/command/util/AsyncCommandHelper.java | 12 +++++++++--- .../worldedit/util/paste/ActorCallbackPaste.java | 5 +++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java index 639acd50b..81add21d7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java @@ -112,7 +112,10 @@ public class WorldEditCommands { if (args.hasFlag('p')) { actor.checkPermission("worldedit.report.pastebin"); - ActorCallbackPaste.pastebin(we.getSupervisor(), actor, result, "WorldEdit report: %s.report"); + ActorCallbackPaste.pastebin( + we.getSupervisor(), actor, result, "WorldEdit report: %s.report", + WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter() + ); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandHelper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandHelper.java index 0f521336d..f3b707435 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandHelper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandHelper.java @@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.util.command.parametric.ExceptionConverter; import com.sk89q.worldedit.util.task.FutureForwardingTask; import com.sk89q.worldedit.util.task.Supervisor; import com.sk89q.worldedit.world.World; @@ -35,17 +36,20 @@ public class AsyncCommandHelper { private final ListenableFuture future; private final Supervisor supervisor; private final Actor sender; + private final ExceptionConverter exceptionConverter; @Nullable private Object[] formatArgs; - private AsyncCommandHelper(ListenableFuture future, Supervisor supervisor, Actor sender) { + private AsyncCommandHelper(ListenableFuture future, Supervisor supervisor, Actor sender, ExceptionConverter exceptionConverter) { checkNotNull(future); checkNotNull(supervisor); checkNotNull(sender); + checkNotNull(exceptionConverter); this.future = future; this.supervisor = supervisor; this.sender = sender; + this.exceptionConverter = exceptionConverter; } public AsyncCommandHelper formatUsing(Object... args) { @@ -78,6 +82,7 @@ public class AsyncCommandHelper { Futures.addCallback( future, new MessageFutureCallback.Builder(sender) + .exceptionConverter(exceptionConverter) .onSuccess(format(success)) .onFailure(format(failure)) .build()); @@ -89,6 +94,7 @@ public class AsyncCommandHelper { Futures.addCallback( future, new MessageFutureCallback.Builder(sender) + .exceptionConverter(exceptionConverter) .onFailure(format(failure)) .build()); return this; @@ -128,8 +134,8 @@ public class AsyncCommandHelper { return this; } - public static AsyncCommandHelper wrap(ListenableFuture future, Supervisor supervisor, Actor sender) { - return new AsyncCommandHelper(future, supervisor, sender); + public static AsyncCommandHelper wrap(ListenableFuture future, Supervisor supervisor, Actor sender, ExceptionConverter exceptionConverter) { + return new AsyncCommandHelper(future, supervisor, sender, exceptionConverter); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java index 2eb306686..a643146c7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java @@ -24,6 +24,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.sk89q.worldedit.command.util.AsyncCommandHelper; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.util.command.parametric.ExceptionConverter; import com.sk89q.worldedit.util.task.Supervisor; import java.net.URL; @@ -46,10 +47,10 @@ public class ActorCallbackPaste { * @param content The content * @param successMessage The message, formatted with {@link String#format(String, Object...)} on success */ - public static void pastebin(Supervisor supervisor, final Actor sender, String content, final String successMessage) { + public static void pastebin(Supervisor supervisor, final Actor sender, String content, final String successMessage, final ExceptionConverter exceptionConverter) { ListenableFuture future = new EngineHubPaste().paste(content); - AsyncCommandHelper.wrap(future, supervisor, sender) + AsyncCommandHelper.wrap(future, supervisor, sender, exceptionConverter) .registerWithSupervisor("Submitting content to a pastebin service...") .sendMessageAfterDelay("(Please wait... sending output to pastebin...)"); From d6977aeae4f951c3961c3f58b433487188909d4d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 22 Dec 2018 17:26:02 +1000 Subject: [PATCH 072/182] Allow a pattern for the leave-id of //move --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 10 +++++----- .../com/sk89q/worldedit/command/RegionCommands.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) 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 4d1bde24d..153539a31 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -1222,11 +1222,11 @@ public class EditSession implements Extent, AutoCloseable { * @param dir the direction * @param distance the distance to move * @param copyAir true to copy air blocks - * @param replacement the replacement block to fill in after moving, or null to use air + * @param replacement the replacement pattern to fill in after moving, or null to use air * @return number of blocks moved * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int moveRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, BlockStateHolder replacement) throws MaxChangedBlocksException { + public int moveRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, Pattern replacement) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(dir); checkArgument(distance >= 1, "distance >= 1 required"); @@ -1235,7 +1235,7 @@ public class EditSession implements Extent, AutoCloseable { // Remove the original blocks com.sk89q.worldedit.function.pattern.Pattern pattern = replacement != null ? - new BlockPattern(replacement) : + replacement : new BlockPattern(BlockTypes.AIR.getDefaultState()); BlockReplace remove = new BlockReplace(this, pattern); @@ -1266,11 +1266,11 @@ public class EditSession implements Extent, AutoCloseable { * @param dir the direction * @param distance the distance to move * @param copyAir true to copy air blocks - * @param replacement the replacement block to fill in after moving, or null to use air + * @param replacement the replacement pattern to fill in after moving, or null to use air * @return number of blocks moved * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int moveCuboidRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, BlockStateHolder replacement) throws MaxChangedBlocksException { + public int moveCuboidRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, Pattern replacement) throws MaxChangedBlocksException { return moveRegion(region, dir, distance, copyAir, replacement); } 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 28851dfc1..58568cbef 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 @@ -276,7 +276,7 @@ public class RegionCommands { @Selection Region region, @Optional("1") @Range(min = 1) int count, @Optional(Direction.AIM) @Direction(includeDiagonals = true) BlockVector3 direction, - @Optional("air") BlockStateHolder replace, + @Optional("air") Pattern replace, @Switch('s') boolean moveSelection) throws WorldEditException { int affected = editSession.moveRegion(region, direction, count, true, replace); From c5d9aadab872e6c09600d3326c7bda983cdee8d3 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 23 Dec 2018 18:56:26 +1000 Subject: [PATCH 073/182] Start work on modularising masks and patterns --- .../extension/factory/BlockFactory.java | 3 +- .../extension/factory/ItemFactory.java | 3 +- .../extension/factory/MaskFactory.java | 53 ++++++++++- .../extension/factory/PatternFactory.java | 9 +- .../{ => parser}/DefaultBlockParser.java | 6 +- .../{ => parser}/DefaultItemParser.java | 4 +- .../parser/mask/BlockCategoryMaskParser.java | 55 ++++++++++++ .../{ => parser/mask}/DefaultMaskParser.java | 88 ++----------------- .../parser/mask/ExistingMaskParser.java | 51 +++++++++++ .../parser/mask/LazyRegionMaskParser.java | 48 ++++++++++ .../factory/parser/mask/NegateMaskParser.java | 47 ++++++++++ .../factory/parser/mask/NoiseMaskParser.java | 45 ++++++++++ .../factory/parser/mask/RegionMaskParser.java | 52 +++++++++++ .../factory/parser/mask/SolidMaskParser.java | 51 +++++++++++ .../pattern/ClipboardPatternParser.java} | 42 ++++----- .../pattern}/RandomPatternParser.java | 7 +- .../pattern}/SingleBlockPatternParser.java | 6 +- .../internal/registry/AbstractFactory.java | 25 +++++- .../internal/registry/InputParser.java | 13 ++- .../internal/registry/SimpleInputParser.java | 71 +++++++++++++++ 20 files changed, 557 insertions(+), 122 deletions(-) rename worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/{ => parser}/DefaultBlockParser.java (98%) rename worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/{ => parser}/DefaultItemParser.java (95%) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java rename worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/{ => parser/mask}/DefaultMaskParser.java (53%) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LazyRegionMaskParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/NegateMaskParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/NoiseMaskParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RegionMaskParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java rename worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/{HashTagPatternParser.java => parser/pattern/ClipboardPatternParser.java} (53%) rename worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/{ => parser/pattern}/RandomPatternParser.java (91%) rename worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/{ => parser/pattern}/SingleBlockPatternParser.java (89%) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/SimpleInputParser.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java index aab3504f4..dab0f3741 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.factory.parser.DefaultBlockParser; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; @@ -47,7 +48,7 @@ public class BlockFactory extends AbstractFactory { public BlockFactory(WorldEdit worldEdit) { super(worldEdit); - parsers.add(new DefaultBlockParser(worldEdit)); + register(new DefaultBlockParser(worldEdit)); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/ItemFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/ItemFactory.java index 321fc6280..e2a2bee29 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/ItemFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/ItemFactory.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.blocks.BaseItem; +import com.sk89q.worldedit.extension.factory.parser.DefaultItemParser; import com.sk89q.worldedit.internal.registry.AbstractFactory; public class ItemFactory extends AbstractFactory { @@ -33,7 +34,7 @@ public class ItemFactory extends AbstractFactory { public ItemFactory(WorldEdit worldEdit) { super(worldEdit); - parsers.add(new DefaultItemParser(worldEdit)); + register(new DefaultItemParser(worldEdit)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java index 01fef9803..0f9f04fde 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java @@ -20,8 +20,24 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.factory.parser.mask.BlockCategoryMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.DefaultMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.LazyRegionMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.NegateMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.NoiseMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.NoMatchException; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.MaskIntersection; import com.sk89q.worldedit.internal.registry.AbstractFactory; +import com.sk89q.worldedit.internal.registry.InputParser; + +import java.util.ArrayList; +import java.util.List; /** * A registry of known {@link Mask}s. Provides methods to instantiate @@ -40,7 +56,42 @@ public final class MaskFactory extends AbstractFactory { public MaskFactory(WorldEdit worldEdit) { super(worldEdit); - parsers.add(new DefaultMaskParser(worldEdit)); + register(new ExistingMaskParser(worldEdit)); + register(new SolidMaskParser(worldEdit)); + register(new LazyRegionMaskParser(worldEdit)); + register(new RegionMaskParser(worldEdit)); + register(new BlockCategoryMaskParser(worldEdit)); + register(new NoiseMaskParser(worldEdit)); + register(new NegateMaskParser(worldEdit)); + register(new DefaultMaskParser(worldEdit)); + } + + @Override + public Mask parseFromInput(String input, ParserContext context) throws InputParseException { + List masks = new ArrayList<>(); + + for (String component : input.split(" ")) { + if (component.isEmpty()) { + continue; + } + + for (InputParser parser : getParsers()) { + Mask match = parser.parseFromInput(component, context); + + if (match != null) { + masks.add(match); + } + } + } + + switch (masks.size()) { + case 0: + throw new NoMatchException("No match for '" + input + "'"); + case 1: + return masks.get(0); + default: + return new MaskIntersection(masks); + } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java index 71225e7d1..cab4d8dee 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java @@ -20,6 +20,9 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.factory.parser.pattern.ClipboardPatternParser; +import com.sk89q.worldedit.extension.factory.parser.pattern.RandomPatternParser; +import com.sk89q.worldedit.extension.factory.parser.pattern.SingleBlockPatternParser; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.registry.AbstractFactory; @@ -40,9 +43,9 @@ public final class PatternFactory extends AbstractFactory { public PatternFactory(WorldEdit worldEdit) { super(worldEdit); - parsers.add(new HashTagPatternParser(worldEdit)); - parsers.add(new SingleBlockPatternParser(worldEdit)); - parsers.add(new RandomPatternParser(worldEdit)); + register(new ClipboardPatternParser(worldEdit)); + register(new SingleBlockPatternParser(worldEdit)); + register(new RandomPatternParser(worldEdit)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java similarity index 98% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java index d75b9c739..3b7635c91 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.extension.factory; +package com.sk89q.worldedit.extension.factory.parser; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.NotABlockException; @@ -52,9 +52,9 @@ import java.util.Map; /** * Parses block input strings. */ -class DefaultBlockParser extends InputParser { +public class DefaultBlockParser extends InputParser { - protected DefaultBlockParser(WorldEdit worldEdit) { + public DefaultBlockParser(WorldEdit worldEdit) { super(worldEdit); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultItemParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java similarity index 95% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultItemParser.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java index d2319a609..f25bd86be 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultItemParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.extension.factory; +package com.sk89q.worldedit.extension.factory.parser; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.blocks.BaseItem; @@ -30,7 +30,7 @@ import com.sk89q.worldedit.world.registry.LegacyMapper; public class DefaultItemParser extends InputParser { - protected DefaultItemParser(WorldEdit worldEdit) { + public DefaultItemParser(WorldEdit worldEdit) { super(worldEdit); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java new file mode 100644 index 000000000..478ba22e6 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java @@ -0,0 +1,55 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.BlockCategoryMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.world.block.BlockCategories; +import com.sk89q.worldedit.world.block.BlockCategory; + +public class BlockCategoryMaskParser extends InputParser { + + public BlockCategoryMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public Mask parseFromInput(String input, ParserContext context) throws InputParseException { + if (input.startsWith("##")) { + Extent extent = Request.request().getEditSession(); + + // This means it's a tag mask. + BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase()); + if (category == null) { + throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\''); + } else { + return new BlockCategoryMask(extent, category); + } + } + + return null; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java similarity index 53% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java index 9fe9844ef..f8913a04d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java @@ -17,43 +17,32 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.extension.factory; +package com.sk89q.worldedit.extension.factory.parser.mask; -import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.BiomeMask2D; -import com.sk89q.worldedit.function.mask.BlockCategoryMask; import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.ExpressionMask; 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.NoiseFilter; import com.sk89q.worldedit.function.mask.OffsetMask; -import com.sk89q.worldedit.function.mask.RegionMask; -import com.sk89q.worldedit.function.mask.SolidBlockMask; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.math.noise.RandomNoise; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; import com.sk89q.worldedit.session.request.Request; -import com.sk89q.worldedit.session.request.RequestSelection; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.Biomes; -import com.sk89q.worldedit.world.block.BlockCategories; -import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -61,77 +50,22 @@ import java.util.Set; /** * Parses mask input strings. */ -class DefaultMaskParser extends InputParser { +public class DefaultMaskParser extends InputParser { - protected DefaultMaskParser(WorldEdit worldEdit) { + public DefaultMaskParser(WorldEdit worldEdit) { super(worldEdit); } - @Override - public Mask parseFromInput(String input, ParserContext context) throws InputParseException { - List masks = new ArrayList<>(); - - for (String component : input.split(" ")) { - if (component.isEmpty()) { - continue; - } - - Mask current = getBlockMaskComponent(masks, component, context); - - masks.add(current); - } - - switch (masks.size()) { - case 0: - return null; - - case 1: - return masks.get(0); - - default: - return new MaskIntersection(masks); - } - } - - private Mask getBlockMaskComponent(List masks, String component, ParserContext context) throws InputParseException { + public Mask parseFromInput(String component, ParserContext context) throws InputParseException { Extent extent = Request.request().getEditSession(); final char firstChar = component.charAt(0); switch (firstChar) { - case '#': - if (component.equalsIgnoreCase("#existing")) { - return new ExistingBlockMask(extent); - } else if (component.equalsIgnoreCase("#solid")) { - return new SolidBlockMask(extent); - } else if (component.equalsIgnoreCase("#dregion") - || component.equalsIgnoreCase("#dselection") - || component.equalsIgnoreCase("#dsel")) { - return new RegionMask(new RequestSelection()); - } else if (component.equalsIgnoreCase("#selection") - || component.equalsIgnoreCase("#region") - || component.equalsIgnoreCase("#sel")) { - try { - return new RegionMask(context.requireSession().getSelection(context.requireWorld()).clone()); - } catch (IncompleteRegionException e) { - throw new InputParseException("Please make a selection first."); - } - } else if (component.startsWith("##")) { - // This means it's a tag mask. - BlockCategory category = BlockCategories.get(component.substring(2).toLowerCase()); - if (category == null) { - throw new NoMatchException("Unrecognised tag '" + component.substring(2) + '\''); - } else { - return new BlockCategoryMask(extent, category); - } - } else { - throw new NoMatchException("Unrecognized mask '" + component + '\''); - } - case '>': case '<': Mask submask; if (component.length() > 1) { - submask = getBlockMaskComponent(masks, component.substring(1), context); + submask = worldEdit.getMaskFactory().parseFromInput(component.substring(1), context); } else { submask = new ExistingBlockMask(extent); } @@ -141,8 +75,7 @@ class DefaultMaskParser extends InputParser { case '$': Set biomes = new HashSet<>(); String[] biomesList = component.substring(1).split(","); - BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() - .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); + BiomeRegistry biomeRegistry = worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); List knownBiomes = biomeRegistry.getBiomes(); for (String biomeName : biomesList) { BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry); @@ -154,10 +87,6 @@ class DefaultMaskParser extends InputParser { return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes)); - case '%': - int i = Integer.parseInt(component.substring(1)); - return new NoiseFilter(new RandomNoise(), ((double) i) / 100); - case '=': try { Expression exp = Expression.compile(component.substring(1), "x", "y", "z"); @@ -169,11 +98,6 @@ class DefaultMaskParser extends InputParser { throw new InputParseException("Invalid expression: " + e.getMessage()); } - case '!': - if (component.length() > 1) { - return Masks.negate(getBlockMaskComponent(masks, component.substring(1), context)); - } - default: ParserContext tempContext = new ParserContext(context); tempContext.setRestricted(false); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java new file mode 100644 index 000000000..a1dea6f48 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java @@ -0,0 +1,51 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.google.common.collect.Lists; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.ExistingBlockMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.internal.registry.SimpleInputParser; +import com.sk89q.worldedit.session.request.Request; + +import java.util.List; + +public class ExistingMaskParser extends SimpleInputParser { + + public ExistingMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public List getMatchedAliases() { + return Lists.newArrayList("#existing"); + } + + @Override + public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException { + Extent extent = Request.request().getEditSession(); + + return new ExistingBlockMask(extent); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LazyRegionMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LazyRegionMaskParser.java new file mode 100644 index 000000000..82bc14d2b --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LazyRegionMaskParser.java @@ -0,0 +1,48 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.google.common.collect.Lists; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.RegionMask; +import com.sk89q.worldedit.internal.registry.SimpleInputParser; +import com.sk89q.worldedit.session.request.RequestSelection; + +import java.util.List; + +public class LazyRegionMaskParser extends SimpleInputParser { + + public LazyRegionMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public List getMatchedAliases() { + return Lists.newArrayList("#dregion", "#dselection", "#dsel"); + } + + @Override + public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException { + return new RegionMask(new RequestSelection()); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/NegateMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/NegateMaskParser.java new file mode 100644 index 000000000..9e1c2e9df --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/NegateMaskParser.java @@ -0,0 +1,47 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.Masks; +import com.sk89q.worldedit.internal.registry.InputParser; + +public class NegateMaskParser extends InputParser { + + public NegateMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public Mask parseFromInput(String input, ParserContext context) throws InputParseException { + if (!input.startsWith("!")) { + return null; + } + + if (input.length() > 1) { + return Masks.negate(worldEdit.getMaskFactory().parseFromInput(input.substring(1), context)); + } else { + throw new InputParseException("Can't negate nothing!"); + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/NoiseMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/NoiseMaskParser.java new file mode 100644 index 000000000..0cb1a85e8 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/NoiseMaskParser.java @@ -0,0 +1,45 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.NoiseFilter; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.math.noise.RandomNoise; + +public class NoiseMaskParser extends InputParser { + + public NoiseMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public Mask parseFromInput(String input, ParserContext context) throws InputParseException { + if (!input.startsWith("%")) { + return null; + } + + int i = Integer.parseInt(input.substring(1)); + return new NoiseFilter(new RandomNoise(), ((double) i) / 100); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RegionMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RegionMaskParser.java new file mode 100644 index 000000000..21963835d --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RegionMaskParser.java @@ -0,0 +1,52 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.google.common.collect.Lists; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.RegionMask; +import com.sk89q.worldedit.internal.registry.SimpleInputParser; + +import java.util.List; + +public class RegionMaskParser extends SimpleInputParser { + + public RegionMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public List getMatchedAliases() { + return Lists.newArrayList("#region", "#selection", "#sel"); + } + + @Override + public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException { + try { + return new RegionMask(context.requireSession().getSelection(context.requireWorld()).clone()); + } catch (IncompleteRegionException e) { + throw new InputParseException("Please make a selection first."); + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java new file mode 100644 index 000000000..84df2fec8 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java @@ -0,0 +1,51 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.google.common.collect.Lists; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.SolidBlockMask; +import com.sk89q.worldedit.internal.registry.SimpleInputParser; +import com.sk89q.worldedit.session.request.Request; + +import java.util.List; + +public class SolidMaskParser extends SimpleInputParser { + + public SolidMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public List getMatchedAliases() { + return Lists.newArrayList("#solid"); + } + + @Override + public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException { + Extent extent = Request.request().getEditSession(); + + return new SolidBlockMask(extent); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java similarity index 53% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java index fe28aafe8..9bf102f32 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java @@ -17,8 +17,9 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.extension.factory; +package com.sk89q.worldedit.extension.factory.parser.pattern; +import com.google.common.collect.Lists; import com.sk89q.worldedit.EmptyClipboardException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -27,37 +28,36 @@ import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.pattern.ClipboardPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.internal.registry.SimpleInputParser; import com.sk89q.worldedit.session.ClipboardHolder; -class HashTagPatternParser extends InputParser { +import java.util.List; - HashTagPatternParser(WorldEdit worldEdit) { +public class ClipboardPatternParser extends SimpleInputParser { + + public ClipboardPatternParser(WorldEdit worldEdit) { super(worldEdit); } @Override - public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { - if (input.charAt(0) == '#') { - if (!input.equals("#clipboard") && !input.equals("#copy")) { - throw new InputParseException("#clipboard or #copy is acceptable for patterns starting with #"); - } + public List getMatchedAliases() { + return Lists.newArrayList("#clipboard", "#copy"); + } - LocalSession session = context.requireSession(); + @Override + public Pattern parseFromSimpleInput(String input, ParserContext context) throws InputParseException { + LocalSession session = context.requireSession(); - if (session != null) { - try { - ClipboardHolder holder = session.getClipboard(); - Clipboard clipboard = holder.getClipboard(); - return new ClipboardPattern(clipboard); - } catch (EmptyClipboardException e) { - throw new InputParseException("To use #clipboard, please first copy something to your clipboard"); - } - } else { - throw new InputParseException("No session is available, so no clipboard is available"); + if (session != null) { + try { + ClipboardHolder holder = session.getClipboard(); + Clipboard clipboard = holder.getClipboard(); + return new ClipboardPattern(clipboard); + } catch (EmptyClipboardException e) { + throw new InputParseException("To use #clipboard, please first copy something to your clipboard"); } } else { - return null; + throw new InputParseException("No session is available, so no clipboard is available"); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java similarity index 91% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java index 010a6f01f..0cfdebb42 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java @@ -17,10 +17,11 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.extension.factory; +package com.sk89q.worldedit.extension.factory.parser.pattern; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.factory.BlockFactory; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.pattern.BlockPattern; @@ -29,9 +30,9 @@ import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.world.block.BlockStateHolder; -class RandomPatternParser extends InputParser { +public class RandomPatternParser extends InputParser { - RandomPatternParser(WorldEdit worldEdit) { + public RandomPatternParser(WorldEdit worldEdit) { super(worldEdit); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SingleBlockPatternParser.java similarity index 89% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SingleBlockPatternParser.java index cd3adb5e7..960983780 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SingleBlockPatternParser.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.extension.factory; +package com.sk89q.worldedit.extension.factory.parser.pattern; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; @@ -26,9 +26,9 @@ import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.registry.InputParser; -class SingleBlockPatternParser extends InputParser { +public class SingleBlockPatternParser extends InputParser { - SingleBlockPatternParser(WorldEdit worldEdit) { + public SingleBlockPatternParser(WorldEdit worldEdit) { super(worldEdit); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java index 506663a81..bdd40c104 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java @@ -21,12 +21,14 @@ package com.sk89q.worldedit.internal.registry; import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -38,7 +40,7 @@ import java.util.List; public abstract class AbstractFactory { protected final WorldEdit worldEdit; - protected final List> parsers = new ArrayList<>(); + private final List> parsers = new ArrayList<>(); /** * Create a new factory. @@ -50,6 +52,17 @@ public abstract class AbstractFactory { this.worldEdit = worldEdit; } + /** + * Gets an immutable list of parsers. + * + * To add parsers, use the register method. + * + * @return the parsers + */ + public List> getParsers() { + return Collections.unmodifiableList(parsers); + } + public E parseFromInput(String input, ParserContext context) throws InputParseException { E match; @@ -64,4 +77,14 @@ public abstract class AbstractFactory { throw new NoMatchException("No match for '" + input + "'"); } + /** + * Registers an InputParser to this factory + * + * @param inputParser The input parser + */ + public void register(InputParser inputParser) { + checkNotNull(inputParser); + + parsers.add(inputParser); + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java index 77c05c2e3..ee40fa3b9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java @@ -19,10 +19,13 @@ package com.sk89q.worldedit.internal.registry; +import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; +import java.util.List; + /** * Input parser interface for {@link AbstractFactory}. * @@ -33,10 +36,18 @@ public abstract class InputParser { protected final WorldEdit worldEdit; - protected InputParser(WorldEdit worldEdit) { + public InputParser(WorldEdit worldEdit) { this.worldEdit = worldEdit; } public abstract E parseFromInput(String input, ParserContext context) throws InputParseException; + /** + * Gets a list of suggestions of input to this parser. + * + * @return a list of suggestions + */ + public List getSuggestions() { + return Lists.newArrayList(); + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/SimpleInputParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/SimpleInputParser.java new file mode 100644 index 000000000..d0647f9cc --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/SimpleInputParser.java @@ -0,0 +1,71 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.internal.registry; + +import com.google.common.collect.Lists; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; + +import java.util.List; + +/** + * An input parser that only performs a single function from aliases. + * + * @param the element + */ +public abstract class SimpleInputParser extends InputParser { + + public SimpleInputParser(WorldEdit worldEdit) { + super(worldEdit); + } + + /** + * The strings this parser matches + * + * @return the matching aliases + */ + public abstract List getMatchedAliases(); + + @Override + public E parseFromInput(String input, ParserContext context) throws InputParseException { + if (!getMatchedAliases().contains(input)) { + return null; + } + + return parseFromSimpleInput(input, context); + } + + public abstract E parseFromSimpleInput(String input, ParserContext context) throws InputParseException; + + /** + * Gets the primary name of this matcher + * + * @return the primary match + */ + public String getPrimaryMatcher() { + return getMatchedAliases().get(0); + } + + @Override + public List getSuggestions() { + return Lists.newArrayList(getPrimaryMatcher()); + } +} From 6312bcecf699fc0fcb58dba4df9f6451c6c0df3b Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 23 Dec 2018 19:02:58 +1000 Subject: [PATCH 074/182] Fixed the item parser not using the ItemRegistry --- .../factory/parser/DefaultItemParser.java | 8 +++++--- .../world/registry/BundledItemRegistry.java | 12 ------------ .../worldedit/world/registry/ItemRegistry.java | 13 ------------- .../worldedit/forge/ForgeItemRegistry.java | 17 +---------------- 4 files changed, 6 insertions(+), 44 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java index f25bd86be..f6c396b93 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java @@ -23,9 +23,9 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; public class DefaultItemParser extends InputParser { @@ -53,8 +53,10 @@ public class DefaultItemParser extends InputParser { } if (item == null) { - item = WorldEdit.getInstance().getPlatformManager() - .queryCapability(Capability.GAME_HOOKS).getRegistries().getItemRegistry().createFromId(input.toLowerCase()); + ItemType type = ItemTypes.get(input.toLowerCase()); + if (type != null) { + item = new BaseItem(type); + } } if (item == null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java index 11e723f21..31dc71e5d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java @@ -19,22 +19,10 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.world.item.ItemType; -import com.sk89q.worldedit.world.item.ItemTypes; - -import javax.annotation.Nullable; - /** * A item registry that uses {@link BundledItemRegistry} to serve information * about items. */ public class BundledItemRegistry implements ItemRegistry { - @Nullable - @Override - public BaseItem createFromId(String id) { - ItemType itemType = ItemTypes.get(id); - return itemType == null ? null : new BaseItem(itemType); - } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java index 749aa6a37..9d53db0c1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java @@ -19,19 +19,6 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BaseItem; - -import javax.annotation.Nullable; - public interface ItemRegistry { - /** - * Create a new item using its ID. - * - * @param id the id - * @return the item, which may be null if no item exists - */ - @Nullable - BaseItem createFromId(String id); - } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java index c87033075..49ae97cb0 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java @@ -19,23 +19,8 @@ package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.registry.ItemRegistry; -import net.minecraft.item.Item; -import net.minecraft.util.ResourceLocation; - -import javax.annotation.Nullable; public class ForgeItemRegistry implements ItemRegistry { - @Nullable - @Override - public BaseItem createFromId(String id) { - Item match = Item.REGISTRY.getObject(new ResourceLocation(id)); - if (match != null) { - return new BaseItem(ItemTypes.get(id)); - } else { - return null; - } - } + } From 645fd682b642d243df15c336ce1558247cc77a20 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 23 Dec 2018 19:10:05 +1000 Subject: [PATCH 075/182] Finish porting all the old masks across --- .../extension/factory/MaskFactory.java | 10 +- .../factory/parser/mask/BiomeMaskParser.java | 64 ++++++++++ .../factory/parser/mask/BlocksMaskParser.java | 56 +++++++++ .../parser/mask/DefaultMaskParser.java | 109 ------------------ .../parser/mask/ExpressionMaskParser.java | 56 +++++++++ .../factory/parser/mask/OffsetMaskParser.java | 59 ++++++++++ 6 files changed, 243 insertions(+), 111 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java index 0f9f04fde..b19cd6766 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java @@ -20,12 +20,15 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.factory.parser.mask.BiomeMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.BlockCategoryMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.DefaultMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.BlocksMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.ExpressionMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.LazyRegionMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.NegateMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.NoiseMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.OffsetMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser; import com.sk89q.worldedit.extension.input.InputParseException; @@ -61,9 +64,12 @@ public final class MaskFactory extends AbstractFactory { register(new LazyRegionMaskParser(worldEdit)); register(new RegionMaskParser(worldEdit)); register(new BlockCategoryMaskParser(worldEdit)); + register(new OffsetMaskParser(worldEdit)); + register(new BiomeMaskParser(worldEdit)); register(new NoiseMaskParser(worldEdit)); register(new NegateMaskParser(worldEdit)); - register(new DefaultMaskParser(worldEdit)); + register(new ExpressionMaskParser(worldEdit)); + register(new BlocksMaskParser(worldEdit)); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java new file mode 100644 index 000000000..157d959c9 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java @@ -0,0 +1,64 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.function.mask.BiomeMask2D; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.Masks; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.Biomes; +import com.sk89q.worldedit.world.registry.BiomeRegistry; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class BiomeMaskParser extends InputParser { + + public BiomeMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public Mask parseFromInput(String input, ParserContext context) throws InputParseException { + if (!input.startsWith("$")) { + return null; + } + + Set biomes = new HashSet<>(); + String[] biomesList = input.substring(1).split(","); + BiomeRegistry biomeRegistry = worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); + List knownBiomes = biomeRegistry.getBiomes(); + for (String biomeName : biomesList) { + BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry); + if (biome == null) { + throw new InputParseException("Unknown biome '" + biomeName + '\''); + } + biomes.add(biome); + } + + return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes)); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java new file mode 100644 index 000000000..cd7e82b66 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java @@ -0,0 +1,56 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.world.block.BlockStateHolder; + +import java.util.Set; + +/** + * Parses mask input strings. + */ +public class BlocksMaskParser extends InputParser { + + public BlocksMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + public Mask parseFromInput(String component, ParserContext context) throws InputParseException { + Extent extent = Request.request().getEditSession(); + + ParserContext tempContext = new ParserContext(context); + tempContext.setRestricted(false); + tempContext.setPreferringWildcard(true); + Set holders = worldEdit.getBlockFactory().parseFromListInput(component, tempContext); + if (holders.isEmpty()) { + return null; + } + return new BlockMask(extent, holders); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java deleted file mode 100644 index f8913a04d..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.extension.factory.parser.mask; - -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extension.platform.Capability; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.function.mask.BiomeMask2D; -import com.sk89q.worldedit.function.mask.BlockMask; -import com.sk89q.worldedit.function.mask.ExistingBlockMask; -import com.sk89q.worldedit.function.mask.ExpressionMask; -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.OffsetMask; -import com.sk89q.worldedit.internal.expression.Expression; -import com.sk89q.worldedit.internal.expression.ExpressionException; -import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; -import com.sk89q.worldedit.session.request.Request; -import com.sk89q.worldedit.world.biome.BaseBiome; -import com.sk89q.worldedit.world.biome.Biomes; -import com.sk89q.worldedit.world.registry.BiomeRegistry; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * Parses mask input strings. - */ -public class DefaultMaskParser extends InputParser { - - public DefaultMaskParser(WorldEdit worldEdit) { - super(worldEdit); - } - - public Mask parseFromInput(String component, ParserContext context) throws InputParseException { - Extent extent = Request.request().getEditSession(); - - final char firstChar = component.charAt(0); - switch (firstChar) { - case '>': - case '<': - Mask submask; - if (component.length() > 1) { - submask = worldEdit.getMaskFactory().parseFromInput(component.substring(1), context); - } else { - submask = new ExistingBlockMask(extent); - } - OffsetMask offsetMask = new OffsetMask(submask, BlockVector3.at(0, firstChar == '>' ? -1 : 1, 0)); - return new MaskIntersection(offsetMask, Masks.negate(submask)); - - case '$': - Set biomes = new HashSet<>(); - String[] biomesList = component.substring(1).split(","); - BiomeRegistry biomeRegistry = worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); - List knownBiomes = biomeRegistry.getBiomes(); - for (String biomeName : biomesList) { - BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry); - if (biome == null) { - throw new InputParseException("Unknown biome '" + biomeName + '\''); - } - biomes.add(biome); - } - - return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes)); - - case '=': - try { - Expression exp = Expression.compile(component.substring(1), "x", "y", "z"); - WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment( - Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO); - exp.setEnvironment(env); - return new ExpressionMask(exp); - } catch (ExpressionException e) { - throw new InputParseException("Invalid expression: " + e.getMessage()); - } - - default: - ParserContext tempContext = new ParserContext(context); - tempContext.setRestricted(false); - tempContext.setPreferringWildcard(true); - return new BlockMask(extent, worldEdit.getBlockFactory().parseFromListInput(component, tempContext)); - } - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java new file mode 100644 index 000000000..ba5fac5f1 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java @@ -0,0 +1,56 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.mask.ExpressionMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.internal.expression.Expression; +import com.sk89q.worldedit.internal.expression.ExpressionException; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.math.Vector3; +import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; +import com.sk89q.worldedit.session.request.Request; + +public class ExpressionMaskParser extends InputParser { + + public ExpressionMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public Mask parseFromInput(String input, ParserContext context) throws InputParseException { + if (!input.startsWith("=")) { + return null; + } + + try { + Expression exp = Expression.compile(input.substring(1), "x", "y", "z"); + WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment( + Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO); + exp.setEnvironment(env); + return new ExpressionMask(exp); + } catch (ExpressionException e) { + throw new InputParseException("Invalid expression: " + e.getMessage()); + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java new file mode 100644 index 000000000..74fe7de17 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java @@ -0,0 +1,59 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extent.Extent; +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.OffsetMask; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.session.request.Request; + +public class OffsetMaskParser extends InputParser { + + public OffsetMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public Mask parseFromInput(String input, ParserContext context) throws InputParseException { + final char firstChar = input.charAt(0); + if (firstChar != '>' && firstChar != '<') { + return null; + } + + Extent extent = Request.request().getEditSession(); + + Mask submask; + if (input.length() > 1) { + submask = worldEdit.getMaskFactory().parseFromInput(input.substring(1), context); + } else { + submask = new ExistingBlockMask(extent); + } + OffsetMask offsetMask = new OffsetMask(submask, BlockVector3.at(0, firstChar == '>' ? -1 : 1, 0)); + return new MaskIntersection(offsetMask, Masks.negate(submask)); + } +} From 1d5e9b7d04d3e9db20cc9f22930d993c9bfa350d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 23 Dec 2018 21:24:58 +1000 Subject: [PATCH 076/182] Few fixes --- .../factory/parser/mask/BiomeMaskParser.java | 4 ++-- .../parser/mask/BlockCategoryMaskParser.java | 22 +++++++++---------- .../internal/registry/InputParser.java | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java index 157d959c9..e1ceaca52 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.extension.factory.parser.mask; +import com.google.common.base.Splitter; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; @@ -48,10 +49,9 @@ public class BiomeMaskParser extends InputParser { } Set biomes = new HashSet<>(); - String[] biomesList = input.substring(1).split(","); BiomeRegistry biomeRegistry = worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); List knownBiomes = biomeRegistry.getBiomes(); - for (String biomeName : biomesList) { + for (String biomeName : Splitter.on(",").split(input.substring(1))) { BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry); if (biome == null) { throw new InputParseException("Unknown biome '" + biomeName + '\''); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java index 478ba22e6..0ef1a1730 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java @@ -38,18 +38,18 @@ public class BlockCategoryMaskParser extends InputParser { @Override public Mask parseFromInput(String input, ParserContext context) throws InputParseException { - if (input.startsWith("##")) { - Extent extent = Request.request().getEditSession(); - - // This means it's a tag mask. - BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase()); - if (category == null) { - throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\''); - } else { - return new BlockCategoryMask(extent, category); - } + if (!input.startsWith("##")) { + return null; } - return null; + Extent extent = Request.request().getEditSession(); + + // This means it's a tag mask. + BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase()); + if (category == null) { + throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\''); + } else { + return new BlockCategoryMask(extent, category); + } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java index ee40fa3b9..575bb9550 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.internal.registry; -import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; +import java.util.Collections; import java.util.List; /** @@ -48,6 +48,6 @@ public abstract class InputParser { * @return a list of suggestions */ public List getSuggestions() { - return Lists.newArrayList(); + return Collections.emptyList(); } } From b75d5149ebf66af07ac2ee61be9d2ceab82f2414 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 23 Dec 2018 21:43:20 +1000 Subject: [PATCH 077/182] Fixed the bundle being directly used outside of the registry system. --- .../factory/parser/mask/BlocksMaskParser.java | 11 ++++++++--- .../com/sk89q/worldedit/world/block/BlockType.java | 6 +++--- .../com/sk89q/worldedit/world/item/ItemType.java | 9 +++++---- .../worldedit/world/registry/BlockRegistry.java | 9 +++++++++ .../world/registry/BundledBlockRegistry.java | 7 +++++++ .../world/registry/BundledItemRegistry.java | 10 ++++++++++ .../worldedit/world/registry/ItemRegistry.java | 13 +++++++++++++ .../sk89q/worldedit/forge/ForgeBlockRegistry.java | 9 +++++++++ .../sk89q/worldedit/forge/ForgeItemRegistry.java | 12 ++++++++++-- 9 files changed, 74 insertions(+), 12 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java index cd7e82b66..50907f077 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.extension.factory.parser.mask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.BlockMask; @@ -46,11 +47,15 @@ public class BlocksMaskParser extends InputParser { ParserContext tempContext = new ParserContext(context); tempContext.setRestricted(false); tempContext.setPreferringWildcard(true); - Set holders = worldEdit.getBlockFactory().parseFromListInput(component, tempContext); - if (holders.isEmpty()) { + try { + Set holders = worldEdit.getBlockFactory().parseFromListInput(component, tempContext); + if (holders.isEmpty()) { + return null; + } + return new BlockMask(extent, holders); + } catch (NoMatchException e) { return null; } - return new BlockMask(extent, holders); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index feee8baed..56cf2820e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -101,11 +101,11 @@ public class BlockType { * @return The name, or ID */ public String getName() { - BundledBlockData.BlockEntry entry = BundledBlockData.getInstance().findById(this.id); - if (entry == null) { + String name = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getName(this); + if (name == null) { return getId(); } else { - return entry.localizedName; + return name; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java index 90ccf072d..ab151729f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java @@ -19,10 +19,11 @@ package com.sk89q.worldedit.world.item; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.registry.NamespacedRegistry; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.registry.BundledItemData; import javax.annotation.Nullable; @@ -50,11 +51,11 @@ public class ItemType { * @return The name, or ID */ public String getName() { - BundledItemData.ItemEntry entry = BundledItemData.getInstance().findById(this.id); - if (entry == null) { + String name = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getItemRegistry().getName(this); + if (name == null) { return getId(); } else { - return entry.localizedName; + return name; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java index 0e87b084e..d4f0cd350 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java @@ -31,6 +31,15 @@ import javax.annotation.Nullable; */ public interface BlockRegistry { + /** + * Gets the name for the given block. + * + * @param blockType the block + * @return The name, or null if it's unknown + */ + @Nullable + String getName(BlockType blockType); + /** * Get the material for the given block. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java index 40e123959..1be08da87 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java @@ -33,6 +33,13 @@ import javax.annotation.Nullable; */ public class BundledBlockRegistry implements BlockRegistry { + @Nullable + @Override + public String getName(BlockType blockType) { + BundledBlockData.BlockEntry blockEntry = BundledBlockData.getInstance().findById(blockType.getId()); + return blockEntry != null ? blockEntry.localizedName : null; + } + @Nullable @Override public BlockMaterial getMaterial(BlockType blockType) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java index 31dc71e5d..3e0ae8800 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java @@ -19,10 +19,20 @@ package com.sk89q.worldedit.world.registry; +import com.sk89q.worldedit.world.item.ItemType; + +import javax.annotation.Nullable; + /** * A item registry that uses {@link BundledItemRegistry} to serve information * about items. */ public class BundledItemRegistry implements ItemRegistry { + @Nullable + @Override + public String getName(ItemType itemType) { + BundledItemData.ItemEntry itemEntry = BundledItemData.getInstance().findById(itemType.getId()); + return itemEntry != null ? itemEntry.localizedName : null; + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java index 9d53db0c1..c44be9b8c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java @@ -19,6 +19,19 @@ package com.sk89q.worldedit.world.registry; +import com.sk89q.worldedit.world.item.ItemType; + +import javax.annotation.Nullable; + public interface ItemRegistry { + /** + * Gets the name for the given item. + * + * @param itemType the item + * @return The name, or null if it's unknown + */ + @Nullable + String getName(ItemType itemType); + } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java index a2d59715a..ddf3762bb 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java @@ -27,16 +27,25 @@ import com.sk89q.worldedit.world.registry.BundledBlockRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; +import net.minecraft.util.ResourceLocation; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; +import javax.annotation.Nullable; + public class ForgeBlockRegistry extends BundledBlockRegistry { private Map materialMap = new HashMap<>(); + @Nullable + @Override + public String getName(BlockType blockType) { + return Block.REGISTRY.getObject(new ResourceLocation(blockType.getId())).getLocalizedName(); + } + @Override public BlockMaterial getMaterial(BlockType blockType) { return materialMap.computeIfAbsent(Block.getBlockFromName(blockType.getId()).getDefaultState().getMaterial(), diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java index 49ae97cb0..502c646fc 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java @@ -19,8 +19,16 @@ package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.world.registry.ItemRegistry; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.registry.BundledItemRegistry; -public class ForgeItemRegistry implements ItemRegistry { +import javax.annotation.Nullable; +public class ForgeItemRegistry extends BundledItemRegistry { + + @Nullable + @Override + public String getName(ItemType itemType) { + return super.getName(itemType); // TODO + } } From 53ddc3fac0ebc2fae253cec77ff604c516831c2e Mon Sep 17 00:00:00 2001 From: gamerforEA Date: Mon, 24 Dec 2018 16:02:13 +0400 Subject: [PATCH 078/182] Fix Metrics injection --- .../main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java index ea0d2a36e..825190657 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java @@ -34,7 +34,7 @@ import com.sk89q.worldedit.sponge.adapter.SpongeImplAdapter; import com.sk89q.worldedit.sponge.adapter.SpongeImplLoader; import com.sk89q.worldedit.sponge.config.SpongeConfiguration; import com.sk89q.worldedit.world.item.ItemTypes; -import org.bstats.sponge.Metrics; +import org.bstats.sponge.Metrics2; import org.slf4j.Logger; import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockSnapshot; @@ -77,7 +77,7 @@ public class SpongeWorldEdit { private Logger logger; @Inject - private Metrics metrics; + private Metrics2 metrics; public static final String MOD_ID = "worldedit"; From 2e62389bdc4514de2b128549c4671a6cdab375cb Mon Sep 17 00:00:00 2001 From: gamerforEA Date: Mon, 24 Dec 2018 16:07:09 +0400 Subject: [PATCH 079/182] Update SpongeAPI --- worldedit-sponge/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index d7deee85b..0ef1e5361 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -17,7 +17,7 @@ repositories { dependencies { compile project(':worldedit-core') - compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT' + compile 'org.spongepowered:spongeapi:7.1.0' compile 'org.bstats:bstats-sponge:1.4' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' } From 66415dfa34d59dd02316f6d0615d90405470a1fa Mon Sep 17 00:00:00 2001 From: gamerforEA Date: Mon, 24 Dec 2018 22:19:05 +0400 Subject: [PATCH 080/182] Fix BlockType and ItemType registration for Sponge distributive --- .../com/sk89q/worldedit/sponge/SpongeWorldEdit.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java index 825190657..f9f085c38 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java @@ -139,11 +139,17 @@ public class SpongeWorldEdit { for (BlockType blockType : Sponge.getRegistry().getAllOf(BlockType.class)) { // TODO Handle blockstate stuff - com.sk89q.worldedit.world.block.BlockTypes.register(new com.sk89q.worldedit.world.block.BlockType(blockType.getId())); + String id = blockType.getId(); + if (!com.sk89q.worldedit.world.block.BlockType.REGISTRY.keySet().contains(id)) { + com.sk89q.worldedit.world.block.BlockTypes.register(new com.sk89q.worldedit.world.block.BlockType(id)); + } } for (ItemType itemType : Sponge.getRegistry().getAllOf(ItemType.class)) { - ItemTypes.register(new com.sk89q.worldedit.world.item.ItemType(itemType.getId())); + String id = itemType.getId(); + if (!com.sk89q.worldedit.world.item.ItemType.REGISTRY.keySet().contains(id)) { + ItemTypes.register(new com.sk89q.worldedit.world.item.ItemType(id)); + } } WorldEdit.getInstance().getPlatformManager().register(platform); From a88f6b84308e9edde72385926f4a90fa3977d114 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 26 Dec 2018 18:15:17 +1000 Subject: [PATCH 081/182] Minor improvements to the server side CUI --- .../com/sk89q/worldedit/LocalSession.java | 24 +++++++++---------- .../selector/CuboidRegionSelector.java | 2 ++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 9b117c918..5d1c50806 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -657,23 +657,25 @@ public class LocalSession { return; // If it's not enabled, ignore this. } - // Remove the old block. - if (cuiTemporaryBlock != null) { - player.sendFakeBlock(cuiTemporaryBlock, null); - cuiTemporaryBlock = null; - } - BaseBlock block = ServerCUIHandler.createStructureBlock(player); if (block != null) { // If it's null, we don't need to do anything. The old was already removed. Map tags = block.getNbtData().getValue(); - cuiTemporaryBlock = BlockVector3.at( + BlockVector3 tempCuiTemporaryBlock = BlockVector3.at( ((IntTag) tags.get("x")).getValue(), ((IntTag) tags.get("y")).getValue(), ((IntTag) tags.get("z")).getValue() ); - + if (cuiTemporaryBlock != null && !tempCuiTemporaryBlock.equals(cuiTemporaryBlock)) { + // Update the existing block if it's the same location + player.sendFakeBlock(cuiTemporaryBlock, null); + } + cuiTemporaryBlock = tempCuiTemporaryBlock; player.sendFakeBlock(cuiTemporaryBlock, block); + } else if (cuiTemporaryBlock != null) { + // Remove the old block + player.sendFakeBlock(cuiTemporaryBlock, null); + cuiTemporaryBlock = null; } } @@ -713,10 +715,8 @@ public class LocalSession { public void dispatchCUISelection(Actor actor) { checkNotNull(actor); - if (!hasCUISupport) { - if (useServerCUI) { - updateServerCUI(actor); - } + if (!hasCUISupport && useServerCUI) { + updateServerCUI(actor); return; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java index 9eab91500..c9fd982a9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java @@ -228,6 +228,8 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { public void clear() { position1 = null; position2 = null; + region.setPos1(BlockVector3.ZERO); + region.setPos2(BlockVector3.ZERO); } @Override From 3fefcbf97183cc2cf8fff36baf8d76908c5891f3 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 26 Dec 2018 16:39:10 -0800 Subject: [PATCH 082/182] Remove all raw usages of BSH, improve API generics --- .../sk89q/worldedit/bukkit/BukkitAdapter.java | 2 +- .../worldedit/bukkit/BukkitBlockRegistry.java | 2 +- .../sk89q/worldedit/bukkit/BukkitPlayer.java | 2 +- .../sk89q/worldedit/bukkit/BukkitWorld.java | 4 +- .../bukkit/adapter/BukkitImplAdapter.java | 4 +- .../java/com/sk89q/worldedit/EditSession.java | 34 ++++++++-------- .../com/sk89q/worldedit/blocks/Blocks.java | 4 +- .../worldedit/command/NavigationCommands.java | 1 - .../worldedit/command/RegionCommands.java | 1 - .../worldedit/command/SelectionCommands.java | 15 +++---- .../worldedit/command/UtilityCommands.java | 6 +-- .../command/tool/BlockDataCyler.java | 6 ++- .../worldedit/command/tool/BlockReplacer.java | 4 +- .../command/tool/LongRangeBuildTool.java | 6 +-- .../worldedit/command/tool/QueryTool.java | 4 +- .../command/tool/brush/GravityBrush.java | 6 +-- .../com/sk89q/worldedit/entity/Player.java | 2 +- .../extension/factory/BlockFactory.java | 9 ++--- .../factory/parser/DefaultBlockParser.java | 20 +++++----- .../factory/parser/mask/BlocksMaskParser.java | 4 +- .../parser/pattern/RandomPatternParser.java | 4 +- .../platform/AbstractPlayerActor.java | 6 +-- .../extension/platform/PlayerProxy.java | 2 +- .../extent/AbstractDelegateExtent.java | 2 +- .../worldedit/extent/ChangeSetExtent.java | 2 +- .../sk89q/worldedit/extent/MaskingExtent.java | 2 +- .../sk89q/worldedit/extent/NullExtent.java | 2 +- .../sk89q/worldedit/extent/OutputExtent.java | 2 +- .../extent/buffer/ForgetfulExtentBuffer.java | 13 +++--- .../extent/clipboard/BlockArrayClipboard.java | 14 +++---- .../legacycompat/NBTCompatibilityHandler.java | 4 +- .../SignCompatibilityHandler.java | 5 ++- .../extent/inventory/BlockBagExtent.java | 2 +- .../extent/reorder/ChunkBatchingExtent.java | 2 +- .../extent/reorder/MultiStageReorder.java | 7 ++-- .../transform/BlockTransformExtent.java | 40 +++++++------------ .../extent/validation/BlockChangeLimiter.java | 2 +- .../validation/DataValidatorExtent.java | 2 +- .../extent/world/BlockQuirkExtent.java | 2 +- .../extent/world/ChunkLoadingExtent.java | 2 +- .../extent/world/FastModeExtent.java | 2 +- .../extent/world/SurvivalModeExtent.java | 2 +- .../block/BlockDistributionCounter.java | 21 +++++----- .../function/generator/FloraGenerator.java | 4 +- .../function/generator/ForestGenerator.java | 4 +- .../generator/GardenPatchGenerator.java | 2 +- .../worldedit/function/mask/BlockMask.java | 19 ++++----- .../function/pattern/BlockPattern.java | 12 +++--- .../function/pattern/ClipboardPattern.java | 4 +- .../worldedit/function/pattern/Pattern.java | 3 +- .../function/pattern/RandomPattern.java | 4 +- .../pattern/RepeatingExtentPattern.java | 4 +- .../worldedit/history/change/BlockChange.java | 15 +++---- .../internal/command/WorldEditBinding.java | 15 +------ .../internal/registry/AbstractFactory.java | 1 - .../worldedit/regions/RegionIntersection.java | 2 +- .../selector/EllipsoidRegionSelector.java | 2 +- .../regions/shape/ArbitraryShape.java | 8 ++-- .../worldedit/regions/shape/RegionShape.java | 4 +- .../registry/state/AbstractProperty.java | 2 +- .../scripting/CraftScriptContext.java | 8 ++-- .../sk89q/worldedit/util/LocatedBlock.java | 8 ++-- .../sk89q/worldedit/util/TreeGenerator.java | 4 +- .../util/collection/LocatedBlockList.java | 4 +- .../sk89q/worldedit/world/AbstractWorld.java | 3 +- .../com/sk89q/worldedit/world/NullWorld.java | 2 +- .../java/com/sk89q/worldedit/world/World.java | 4 +- .../worldedit/world/block/BaseBlock.java | 4 +- .../worldedit/world/block/BlockCategory.java | 2 +- .../worldedit/world/block/BlockState.java | 18 ++++----- .../world/block/BlockStateHolder.java | 6 +-- .../worldedit/world/block/BlockType.java | 11 ++--- .../worldedit/world/chunk/AnvilChunk.java | 8 ++-- .../worldedit/world/chunk/AnvilChunk13.java | 6 +-- .../sk89q/worldedit/world/chunk/Chunk.java | 6 +-- .../sk89q/worldedit/world/chunk/OldChunk.java | 8 ++-- .../world/registry/BlockRegistry.java | 2 +- .../world/registry/BundledBlockRegistry.java | 2 +- .../world/registry/LegacyMapper.java | 2 +- .../sk89q/worldedit/forge/ForgePlayer.java | 2 +- .../com/sk89q/worldedit/forge/ForgeWorld.java | 3 +- .../sk89q/worldedit/sponge/SpongePlayer.java | 3 +- .../sk89q/worldedit/sponge/SpongeWorld.java | 2 +- 83 files changed, 242 insertions(+), 259 deletions(-) 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 aec800ef3..44095bea9 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 @@ -381,7 +381,7 @@ public class BukkitAdapter { * @param block The WorldEdit BlockStateHolder * @return The Bukkit BlockData */ - public static BlockData adapt(BlockStateHolder block) { + public static > BlockData adapt(B block) { checkNotNull(block); return blockDataCache.computeIfAbsent(block.getAsString(), new Function() { @Nullable diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java index 31db0f83d..3400fd59f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java @@ -47,7 +47,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry { @Nullable @Override - public Map getProperties(BlockType blockType) { + public Map> getProperties(BlockType blockType) { if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) { return WorldEditPlugin.getInstance().getBukkitImplAdapter().getProperties(blockType); } 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 712f2b2d6..3e2b5cd3f 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 @@ -255,7 +255,7 @@ public class BukkitPlayer extends AbstractPlayerActor { } @Override - public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { + public > void sendFakeBlock(BlockVector3 pos, B block) { Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ()); if (block == null) { player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData()); 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 6b5a2ef77..5b7caad66 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 @@ -166,7 +166,7 @@ public class BukkitWorld extends AbstractWorld { @Override public boolean regenerate(Region region, EditSession editSession) { - BlockStateHolder[] history = new BlockStateHolder[16 * 16 * (getMaxY() + 1)]; + BaseBlock[] history = new BaseBlock[16 * 16 * (getMaxY() + 1)]; for (BlockVector2 chunk : region.getChunks()) { BlockVector3 min = BlockVector3.at(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16); @@ -421,7 +421,7 @@ public class BukkitWorld extends AbstractWorld { } @Override - public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { + public > boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { try { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index 13631e1d9..789e60f82 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -77,7 +77,7 @@ public interface BukkitImplAdapter { * @param notifyAndLight notify and light if set * @return true if a block was likely changed */ - boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight); + boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight); /** * Notifies the simulation that the block at the given location has @@ -113,7 +113,7 @@ public interface BukkitImplAdapter { * @param blockType The block type * @return The properties map */ - Map getProperties(BlockType blockType); + Map> getProperties(BlockType blockType); /** * Send the given NBT data to the player. 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 153539a31..f490af6c2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -609,7 +609,7 @@ public class EditSession implements Extent, AutoCloseable { * @return whether the block changed * @throws WorldEditException thrown on a set error */ - public boolean setBlock(BlockVector3 position, BlockStateHolder block, Stage stage) throws WorldEditException { + public > boolean setBlock(BlockVector3 position, B block, Stage stage) throws WorldEditException { switch (stage) { case BEFORE_HISTORY: return bypassNone.setBlock(position, block); @@ -629,7 +629,7 @@ public class EditSession implements Extent, AutoCloseable { * @param block the block * @return whether the block changed */ - public boolean rawSetBlock(BlockVector3 position, BlockStateHolder block) { + public > boolean rawSetBlock(BlockVector3 position, B block) { try { return setBlock(position, block, Stage.BEFORE_CHANGE); } catch (WorldEditException e) { @@ -644,7 +644,7 @@ public class EditSession implements Extent, AutoCloseable { * @param block the block * @return whether the block changed */ - public boolean smartSetBlock(BlockVector3 position, BlockStateHolder block) { + public > boolean smartSetBlock(BlockVector3 position, B block) { try { return setBlock(position, block, Stage.BEFORE_REORDER); } catch (WorldEditException e) { @@ -653,7 +653,7 @@ public class EditSession implements Extent, AutoCloseable { } @Override - public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws MaxChangedBlocksException { + public > boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException { try { return setBlock(position, block, Stage.BEFORE_HISTORY); } catch (MaxChangedBlocksException e) { @@ -779,7 +779,7 @@ public class EditSession implements Extent, AutoCloseable { * @param searchBlocks the list of blocks to search * @return the number of blocks that matched the pattern */ - public int countBlocks(Region region, Set searchBlocks) { + public int countBlocks(Region region, Set searchBlocks) { BlockMask mask = new BlockMask(this, searchBlocks); Counter count = new Counter(); RegionMaskingFilter filter = new RegionMaskingFilter(mask, count); @@ -799,7 +799,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int fillXZ(BlockVector3 origin, BlockStateHolder block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { + public > int fillXZ(BlockVector3 origin, B block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { return fillXZ(origin, new BlockPattern(block), radius, depth, recursive); } @@ -922,7 +922,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int setBlocks(Region region, BlockStateHolder block) throws MaxChangedBlocksException { + public > int setBlocks(Region region, B block) throws MaxChangedBlocksException { return setBlocks(region, new BlockPattern(block)); } @@ -954,7 +954,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int replaceBlocks(Region region, Set filter, BlockStateHolder replacement) throws MaxChangedBlocksException { + public > int replaceBlocks(Region region, Set filter, B replacement) throws MaxChangedBlocksException { return replaceBlocks(region, filter, new BlockPattern(replacement)); } @@ -968,7 +968,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int replaceBlocks(Region region, Set filter, Pattern pattern) throws MaxChangedBlocksException { + public int replaceBlocks(Region region, Set filter, Pattern pattern) throws MaxChangedBlocksException { Mask mask = filter == null ? new ExistingBlockMask(this) : new BlockMask(this, filter); return replaceBlocks(region, mask, pattern); } @@ -1026,7 +1026,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makeCuboidFaces(Region region, BlockStateHolder block) throws MaxChangedBlocksException { + public > int makeCuboidFaces(Region region, B block) throws MaxChangedBlocksException { return makeCuboidFaces(region, new BlockPattern(block)); } @@ -1078,7 +1078,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makeCuboidWalls(Region region, BlockStateHolder block) throws MaxChangedBlocksException { + public > int makeCuboidWalls(Region region, B block) throws MaxChangedBlocksException { return makeCuboidWalls(region, new BlockPattern(block)); } @@ -1121,7 +1121,7 @@ public class EditSession implements Extent, AutoCloseable { final int maxY = region.getMaximumPoint().getBlockY(); final ArbitraryShape shape = new RegionShape(region) { @Override - protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { + protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) { if (y > maxY || y < minY) { // Put holes into the floor and ceiling by telling ArbitraryShape that the shape goes on outside the region return defaultMaterial; @@ -1143,7 +1143,7 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int overlayCuboidBlocks(Region region, BlockStateHolder block) throws MaxChangedBlocksException { + public > int overlayCuboidBlocks(Region region, B block) throws MaxChangedBlocksException { checkNotNull(block); return overlayCuboidBlocks(region, new BlockPattern(block)); @@ -1831,8 +1831,8 @@ public class EditSession implements Extent, AutoCloseable { * @param region a region * @return the results */ - public List> getBlockDistribution(Region region, boolean fuzzy) { - BlockDistributionCounter count = new BlockDistributionCounter(this, fuzzy); + public List> getBlockDistribution(Region region, boolean separateStates) { + BlockDistributionCounter count = new BlockDistributionCounter(this, separateStates); RegionVisitor visitor = new RegionVisitor(region, count); Operations.completeBlindly(visitor); return count.getDistribution(); @@ -1850,7 +1850,7 @@ public class EditSession implements Extent, AutoCloseable { final ArbitraryShape shape = new ArbitraryShape(region) { @Override - protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { + protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) { final Vector3 current = Vector3.at(x, y, z); environment.setCurrentBlock(current); final Vector3 scaled = current.subtract(zero).divide(unit); @@ -1861,7 +1861,7 @@ public class EditSession implements Extent, AutoCloseable { return null; } - return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()); + return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()).toBaseBlock(); } catch (Exception e) { log.log(Level.WARNING, "Failed to create shape", e); return null; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java index c71bd6ef6..2e8366c24 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java @@ -38,9 +38,9 @@ public final class Blocks { * @param o the block * @return true if the collection contains the given block */ - public static boolean containsFuzzy(Collection collection, BlockStateHolder o) { + public static > boolean containsFuzzy(Collection> collection, B o) { // Allow masked data in the searchBlocks to match various types - for (BlockStateHolder b : collection) { + for (BlockStateHolder b : collection) { if (b.equalsFuzzy(o)) { return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java index 082b29c6e..a4b09eb18 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java @@ -40,7 +40,6 @@ import com.sk89q.worldedit.util.command.parametric.Optional; */ public class NavigationCommands { - @SuppressWarnings("unused") private final WorldEdit worldEdit; /** 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 58568cbef..c12d897b8 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 @@ -62,7 +62,6 @@ import com.sk89q.worldedit.util.command.binding.Range; import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.binding.Text; import com.sk89q.worldedit.util.command.parametric.Optional; -import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.ArrayList; import java.util.List; 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 4db29ef67..86e39dfd3 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 @@ -57,7 +57,8 @@ import com.sk89q.worldedit.util.formatting.Style; import com.sk89q.worldedit.util.formatting.StyledFragment; import com.sk89q.worldedit.util.formatting.component.CommandListBox; import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.storage.ChunkStore; @@ -638,7 +639,7 @@ public class SelectionCommands { context.setSession(session); context.setRestricted(false); - Set searchBlocks = we.getBlockFactory().parseFromListInput(args.getString(0), context); + Set searchBlocks = we.getBlockFactory().parseFromListInput(args.getString(0), context); int count = editSession.countBlocks(session.getSelection(player.getWorld()), searchBlocks); player.print("Counted: " + count); } @@ -659,14 +660,14 @@ public class SelectionCommands { public void distr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException, CommandException { int size; - boolean useData = args.hasFlag('d'); - List> distribution; + boolean separateStates = args.hasFlag('d'); + List> distribution; if (args.hasFlag('c')) { // TODO: Update for new clipboard throw new CommandException("Needs to be re-written again"); } else { - distribution = editSession.getBlockDistribution(session.getSelection(player.getWorld()), !useData); + distribution = editSession.getBlockDistribution(session.getSelection(player.getWorld()), separateStates); size = session.getSelection(player.getWorld()).getArea(); } @@ -677,10 +678,10 @@ public class SelectionCommands { player.print("# total blocks: " + size); - for (Countable c : distribution) { + for (Countable c : distribution) { String name = c.getID().getBlockType().getName(); String str; - if (useData) { + if (separateStates) { str = String.format("%-7s (%.3f%%) %s #%s", String.valueOf(c.getAmount()), c.getAmount() / (double) size * 100, 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 c87da1110..86867a786 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 @@ -64,7 +64,7 @@ import com.sk89q.worldedit.util.formatting.component.Code; import com.sk89q.worldedit.util.formatting.component.CommandListBox; import com.sk89q.worldedit.util.formatting.component.CommandUsageBox; import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockTypes; import java.util.ArrayList; @@ -250,7 +250,7 @@ public class UtilityCommands { context.setRestricted(false); context.setPreferringWildcard(false); - BlockStateHolder block = we.getBlockFactory().parseFromInput(args.getString(0), context); + BaseBlock block = we.getBlockFactory().parseFromInput(args.getString(0), context); int size = Math.max(1, args.getInteger(1, 50)); we.checkMaxRadius(size); @@ -272,7 +272,7 @@ public class UtilityCommands { int size = Math.max(1, args.getInteger(0)); int affected; - Set from; + Set from; Pattern to; ParserContext context = new ParserContext(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java index 2cc5e6e87..5440a687f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java @@ -68,7 +68,7 @@ public class BlockDataCyler implements DoubleActionBlockTool { if (block.getStates().keySet().isEmpty()) { player.printError("That block's data cannot be cycled!"); } else { - Property currentProperty = selectedProperties.get(player.getUniqueId()); + Property currentProperty = selectedProperties.get(player.getUniqueId()); if (currentProperty == null || (forward && block.getState(currentProperty) == null)) { currentProperty = block.getStates().keySet().stream().findFirst().get(); @@ -79,7 +79,9 @@ public class BlockDataCyler implements DoubleActionBlockTool { block.getState(currentProperty); int index = currentProperty.getValues().indexOf(block.getState(currentProperty)); index = (index + 1) % currentProperty.getValues().size(); - BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index)); + @SuppressWarnings("unchecked") + Property objProp = (Property) currentProperty; + BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index)); try (EditSession editSession = session.createEditSession(player)) { editSession.disableBuffering(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java index 4b5ecd79e..9fcdf6754 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java @@ -30,7 +30,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockState; /** * A mode that replaces one block. @@ -73,7 +73,7 @@ public class BlockReplacer implements DoubleActionBlockTool { @Override public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { - BlockStateHolder targetBlock = player.getWorld().getBlock(clicked.toVector().toBlockPoint()); + BlockState targetBlock = player.getWorld().getBlock(clicked.toVector().toBlockPoint()); if (targetBlock != null) { pattern = new BlockPattern(targetBlock); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java index 046a53749..f374746ac 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java @@ -29,7 +29,7 @@ import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.Location; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; /** * A tool that can place (or remove) blocks at a distance. @@ -57,7 +57,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo try (EditSession eS = session.createEditSession(player)) { eS.disableBuffering(); BlockVector3 blockPoint = pos.toVector().toBlockPoint(); - BlockStateHolder applied = secondary.apply(blockPoint); + BaseBlock applied = secondary.apply(blockPoint); if (applied.getBlockType().getMaterial().isAir()) { eS.setBlock(blockPoint, secondary); } else { @@ -78,7 +78,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo try (EditSession eS = session.createEditSession(player)) { eS.disableBuffering(); BlockVector3 blockPoint = pos.toVector().toBlockPoint(); - BlockStateHolder applied = primary.apply(blockPoint); + BaseBlock applied = primary.apply(blockPoint); if (applied.getBlockType().getMaterial().isAir()) { eS.setBlock(blockPoint, primary); } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java index 59e21bfde..ef71569f4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java @@ -28,7 +28,7 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; /** * Looks up information about a block. @@ -46,7 +46,7 @@ public class QueryTool implements BlockTool { World world = (World) clicked.getExtent(); EditSession editSession = session.createEditSession(player); BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); - BlockStateHolder block = editSession.getFullBlock(blockPoint); + BaseBlock block = editSession.getFullBlock(blockPoint); player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e" + block.getBlockType().getName() + "\u00A77" + " (" 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 d94f182f0..aedcb578c 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 @@ -23,7 +23,7 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; import java.util.ArrayList; @@ -44,10 +44,10 @@ public class GravityBrush implements Brush { for (double x = position.getBlockX() + size; x > position.getBlockX() - size; --x) { for (double z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) { double y = startY; - final List blockTypes = new ArrayList<>(); + final List blockTypes = new ArrayList<>(); for (; y > position.getBlockY() - size; --y) { final BlockVector3 pt = BlockVector3.at(x, y, z); - final BlockStateHolder block = editSession.getBlock(pt); + final BlockState block = editSession.getBlock(pt); if (!block.getBlockType().getMaterial().isAir()) { blockTypes.add(block); editSession.setBlock(pt, BlockTypes.AIR.getDefaultState()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java index 4000d655f..d5be2e40d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -276,5 +276,5 @@ public interface Player extends Entity, Actor { * @param pos The position of the block * @param block The block to send, null to reset */ - void sendFakeBlock(BlockVector3 pos, @Nullable BlockStateHolder block); + > void sendFakeBlock(BlockVector3 pos, @Nullable B block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java index dab0f3741..235f0ae3e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java @@ -22,11 +22,10 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.factory.parser.DefaultBlockParser; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.internal.registry.AbstractFactory; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; import java.util.HashSet; import java.util.Set; @@ -38,7 +37,7 @@ import java.util.Set; *

    Instances of this class can be taken from * {@link WorldEdit#getBlockFactory()}.

    */ -public class BlockFactory extends AbstractFactory { +public class BlockFactory extends AbstractFactory { /** * Create a new instance. @@ -59,8 +58,8 @@ public class BlockFactory extends AbstractFactory { * @return a set of blocks * @throws InputParseException thrown in error with the input */ - public Set parseFromListInput(String input, ParserContext context) throws InputParseException { - Set blocks = new HashSet<>(); + public Set parseFromListInput(String input, ParserContext context) throws InputParseException { + Set blocks = new HashSet<>(); String[] splits = input.split(","); for (String token : StringUtil.parseListInQuotes(splits, ',', '[', ']')) { blocks.add(parseFromInput(token, context)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java index 3b7635c91..e2093ff13 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java @@ -23,7 +23,6 @@ import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.NotABlockException; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.MobSpawnerBlock; import com.sk89q.worldedit.blocks.SignBlock; import com.sk89q.worldedit.blocks.SkullBlock; @@ -40,8 +39,8 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; @@ -52,7 +51,7 @@ import java.util.Map; /** * Parses block input strings. */ -public class DefaultBlockParser extends InputParser { +public class DefaultBlockParser extends InputParser { public DefaultBlockParser(WorldEdit worldEdit) { super(worldEdit); @@ -73,13 +72,13 @@ public class DefaultBlockParser extends InputParser { } @Override - public BlockStateHolder parseFromInput(String input, ParserContext context) + public BaseBlock parseFromInput(String input, ParserContext context) throws InputParseException { String originalInput = input; input = input.replace(";", "|"); Exception suppressed = null; try { - BlockStateHolder modified = parseLogic(input, context); + BaseBlock modified = parseLogic(input, context); if (modified != null) { return modified; } @@ -158,7 +157,8 @@ public class DefaultBlockParser extends InputParser { throw new NoMatchException("Bad state format in " + parseableData); } - Property propertyKey = state.getBlockType().getPropertyMap().get(parts[0]); + @SuppressWarnings("unchecked") + Property propertyKey = (Property) state.getBlockType().getPropertyMap().get(parts[0]); if (propertyKey == null) { throw new NoMatchException("Unknown state " + parts[0] + " for block " + state.getBlockType().getName()); } @@ -182,7 +182,7 @@ public class DefaultBlockParser extends InputParser { return state; } - private BlockStateHolder parseLogic(String input, ParserContext context) throws InputParseException { + private BaseBlock parseLogic(String input, ParserContext context) throws InputParseException { BlockType blockType = null; Map, Object> blockStates = new HashMap<>(); String[] blockAndExtraData = input.trim().split("\\|"); @@ -270,7 +270,9 @@ public class DefaultBlockParser extends InputParser { } else { state = blockType.getDefaultState().toFuzzy(); for (Map.Entry, Object> blockState : blockStates.entrySet()) { - state = state.with((Property) blockState.getKey(), blockState.getValue()); + @SuppressWarnings("unchecked") + Property objProp = (Property) blockState.getKey(); + state = state.with(objProp, blockState.getValue()); } } @@ -321,7 +323,7 @@ public class DefaultBlockParser extends InputParser { return new SkullBlock(state, type.replace(" ", "_")); // valid MC usernames } else { - return state; + return state.toBaseBlock(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java index 50907f077..006b0d27f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java @@ -28,7 +28,7 @@ import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.session.request.Request; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; import java.util.Set; @@ -48,7 +48,7 @@ public class BlocksMaskParser extends InputParser { tempContext.setRestricted(false); tempContext.setPreferringWildcard(true); try { - Set holders = worldEdit.getBlockFactory().parseFromListInput(component, tempContext); + Set holders = worldEdit.getBlockFactory().parseFromListInput(component, tempContext); if (holders.isEmpty()) { return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java index 0cfdebb42..400e6efd7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java @@ -28,7 +28,7 @@ import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; public class RandomPatternParser extends InputParser { @@ -43,7 +43,7 @@ public class RandomPatternParser extends InputParser { String[] splits = input.split(","); for (String token : StringUtil.parseListInQuotes(splits, ',', '[', ']')) { - BlockStateHolder block; + BaseBlock block; double chance; 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 51e8b2190..e7aeac997 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 @@ -170,7 +170,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { ++spots; if (spots == 2) { final BlockVector3 platform = BlockVector3.at(x, y - 2, z); - final BlockStateHolder block = world.getBlock(platform); + final BlockState block = world.getBlock(platform); final com.sk89q.worldedit.world.block.BlockType type = block.getBlockType(); // Don't get put in lava! @@ -212,7 +212,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { // stand upon while (y >= 0) { final BlockVector3 platform = BlockVector3.at(x, y, z); - final BlockStateHolder block = world.getBlock(platform); + final BlockState block = world.getBlock(platform); final BlockType type = block.getBlockType(); // Don't want to end up in lava @@ -500,7 +500,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { } @Override - public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { + public > void sendFakeBlock(BlockVector3 pos, B block) { } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java index 4d241196d..48173abbc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java @@ -169,7 +169,7 @@ class PlayerProxy extends AbstractPlayerActor { } @Override - public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { + public > void sendFakeBlock(BlockVector3 pos, B block) { basePlayer.sendFakeBlock(pos, block); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index 94c346ff6..1a11899ca 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -76,7 +76,7 @@ public abstract class AbstractDelegateExtent implements Extent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, T block) throws WorldEditException { return extent.setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java index 9d804956a..5f447269e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java @@ -59,7 +59,7 @@ public class ChangeSetExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { BaseBlock previous = getFullBlock(location); changeSet.add(new BlockChange(location, previous, block)); return super.setBlock(location, block); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java index 6f27d0dae..5044177fb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java @@ -65,7 +65,7 @@ public class MaskingExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { return mask.test(location) && super.setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java index 832ecd489..056e7fade 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java @@ -87,7 +87,7 @@ public class NullExtent implements Extent { } @Override - public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 position, B block) throws WorldEditException { return false; } 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 002ed755b..63bf8c951 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 @@ -50,7 +50,7 @@ public interface OutputExtent { * @return true if the block was successfully set (return value may not be accurate) * @throws WorldEditException thrown on an error */ - boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException; + > boolean setBlock(BlockVector3 position, T block) throws WorldEditException; /** * Set the biome. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java index e3451655a..30f1b7b85 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java @@ -31,6 +31,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.AbstractRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; @@ -47,7 +48,7 @@ import java.util.Map; */ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pattern { - private final Map buffer = new LinkedHashMap<>(); + private final Map buffer = new LinkedHashMap<>(); private final Mask mask; private BlockVector3 min = null; private BlockVector3 max = null; @@ -76,7 +77,7 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { // Update minimum if (min == null) { min = location; @@ -93,7 +94,7 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat BlockVector3 blockVector = location; if (mask.test(blockVector)) { - buffer.put(blockVector, block); + buffer.put(blockVector, block.toBaseBlock()); return true; } else { return getExtent().setBlock(location, block); @@ -101,12 +102,12 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat } @Override - public BlockStateHolder apply(BlockVector3 pos) { - BlockStateHolder block = buffer.get(pos); + public BaseBlock apply(BlockVector3 pos) { + BaseBlock block = buffer.get(pos); if (block != null) { return block; } else { - return BlockTypes.AIR.getDefaultState(); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } } 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 32e4a17d8..2ccc168f9 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 @@ -49,7 +49,7 @@ public class BlockArrayClipboard implements Clipboard { private final Region region; private BlockVector3 origin; - private final BlockStateHolder[][][] blocks; + private final BaseBlock[][][] blocks; private final List entities = new ArrayList<>(); /** @@ -65,7 +65,7 @@ public class BlockArrayClipboard implements Clipboard { this.origin = region.getMinimumPoint(); BlockVector3 dimensions = getDimensions(); - blocks = new BlockStateHolder[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()]; + blocks = new BaseBlock[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()]; } @Override @@ -126,7 +126,7 @@ public class BlockArrayClipboard implements Clipboard { public BlockState getBlock(BlockVector3 position) { if (region.contains(position)) { BlockVector3 v = position.subtract(region.getMinimumPoint()); - BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; + BaseBlock block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; if (block != null) { return block.toImmutableState(); } @@ -139,9 +139,9 @@ public class BlockArrayClipboard implements Clipboard { public BaseBlock getFullBlock(BlockVector3 position) { if (region.contains(position)) { BlockVector3 v = position.subtract(region.getMinimumPoint()); - BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; + BaseBlock block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; if (block != null) { - return block.toBaseBlock(); + return block; } } @@ -149,10 +149,10 @@ public class BlockArrayClipboard implements Clipboard { } @Override - public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 position, B block) throws WorldEditException { if (region.contains(position)) { BlockVector3 v = position.subtract(region.getMinimumPoint()); - blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()] = block; + blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()] = block.toBaseBlock(); return true; } else { return false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/NBTCompatibilityHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/NBTCompatibilityHandler.java index 16a60c80d..88c344566 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/NBTCompatibilityHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/NBTCompatibilityHandler.java @@ -25,6 +25,6 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.Map; public interface NBTCompatibilityHandler { - boolean isAffectedBlock(BlockStateHolder block); - void updateNBT(BlockStateHolder block, Map values); + > boolean isAffectedBlock(B block); + > void updateNBT(B block, Map values); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java index ae2d5f055..ad75ed911 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java @@ -32,13 +32,14 @@ import com.sk89q.worldedit.world.block.BlockTypes; import java.util.Map; public class SignCompatibilityHandler implements NBTCompatibilityHandler { + @Override - public boolean isAffectedBlock(BlockStateHolder block) { + public > boolean isAffectedBlock(B block) { return block.getBlockType() == BlockTypes.SIGN || block.getBlockType() == BlockTypes.WALL_SIGN; } @Override - public void updateNBT(BlockStateHolder block, Map values) { + public > void updateNBT(B block, Map values) { for (int i = 0; i < 4; ++i) { String key = "Text" + (i + 1); Tag value = values.get(key); 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 c4e563b87..7ac970009 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 @@ -82,7 +82,7 @@ public class BlockBagExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 position, B block) throws WorldEditException { if (blockBag != null) { BlockState existing = getExtent().getBlock(position); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index daeb9f0e6..b8f6082c4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -77,7 +77,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { if (!enabled) { return getExtent().setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index f4ee0a200..3e1a7d4fa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.function.operation.OperationQueue; import com.sk89q.worldedit.function.operation.SetLocatedBlocks; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.collection.LocatedBlockList; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -201,12 +202,12 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder * @param block The block * @return The priority */ - private PlacementPriority getPlacementPriority(BlockStateHolder block) { + private > PlacementPriority getPlacementPriority(B block) { return priorityMap.getOrDefault(block.getBlockType(), PlacementPriority.FIRST); } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { if (!enabled) { return super.setBlock(location, block); } @@ -216,7 +217,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder PlacementPriority srcPriority = getPlacementPriority(existing); if (srcPriority != PlacementPriority.FIRST) { - BlockStateHolder replacement = block.getBlockType().getMaterial().isAir() ? block : BlockTypes.AIR.getDefaultState(); + BaseBlock replacement = (block.getBlockType().getMaterial().isAir() ? block : BlockTypes.AIR.getDefaultState()).toBaseBlock(); switch (srcPriority) { case FINAL: 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 ac6858cc5..535f32436 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 @@ -79,7 +79,7 @@ public class BlockTransformExtent extends AbstractDelegateExtent { * @param reverse true to transform in the opposite direction * @return the same block */ - private T transformBlock(T block, boolean reverse) { + private > T transformBlock(T block, boolean reverse) { return transform(block, reverse ? transform.inverse() : transform); } @@ -94,50 +94,40 @@ public class BlockTransformExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { return super.setBlock(location, transformBlock(block, true)); } - - /** - * Transform the given block using the given transform. - * - *

    The provided block is modified.

    - * - * @param block the block - * @param transform the transform - * @return the same block - */ - public static T transform(T block, Transform transform) { - return transform(block, transform, block); - } - private static final Set directionNames = Sets.newHashSet("north", "south", "east", "west"); /** * Transform the given block using the given transform. * + *

    The provided block is not modified.

    + * * @param block the block * @param transform the transform - * @param changedBlock the block to change - * @return the changed block + * @return the same block */ - private static T transform(T block, Transform transform, T changedBlock) { + public static > B transform(B block, Transform transform) { checkNotNull(block); checkNotNull(transform); - List properties = block.getBlockType().getProperties(); + B result = block; + List> properties = block.getBlockType().getProperties(); for (Property property : properties) { if (property instanceof DirectionalProperty) { + DirectionalProperty dirProp = (DirectionalProperty) property; Direction value = (Direction) block.getState(property); if (value != null) { - Vector3 newValue = getNewStateValue((List) property.getValues(), transform, value.toVector()); + Vector3 newValue = getNewStateValue(dirProp.getValues(), transform, value.toVector()); if (newValue != null) { - changedBlock = (T) changedBlock.with(property, Direction.findClosest(newValue, Direction.Flag.ALL)); + result = result.with(dirProp, Direction.findClosest(newValue, Direction.Flag.ALL)); } } } else if (property instanceof EnumProperty) { + EnumProperty enumProp = (EnumProperty) property; if (property.getName().equals("axis")) { // We have an axis - this is something we can do the rotations to :sunglasses: Direction value = null; @@ -165,7 +155,7 @@ public class BlockTransformExtent extends AbstractDelegateExtent { axis = "y"; } if (axis != null) { - changedBlock = (T) changedBlock.with(property, axis); + result = result.with(enumProp, axis); } } } @@ -188,11 +178,11 @@ public class BlockTransformExtent extends AbstractDelegateExtent { if (directionalProperties.size() > 0) { for (String directionName : directionNames) { - changedBlock = (T) changedBlock.with(block.getBlockType().getProperty(directionName), directionalProperties.contains(directionName)); + result = result.with(block.getBlockType().getProperty(directionName), directionalProperties.contains(directionName)); } } - return changedBlock; + return result; } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java index 48267a7be..7e89fa721 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java @@ -77,7 +77,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { if (limit >= 0) { if (count >= limit) { throw new MaxChangedBlocksException(limit); 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 64d27cd97..63ca586e6 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 @@ -49,7 +49,7 @@ public class DataValidatorExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { final int y = location.getBlockY(); final BlockType type = block.getBlockType(); if (y < 0 || y > world.getMaxY()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java index 85ba63585..50f2a9a30 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java @@ -51,7 +51,7 @@ public class BlockQuirkExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 position, B block) throws WorldEditException { BlockType existing = getExtent().getBlock(position).getBlockType(); if (existing.getMaterial().hasContainer()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java index c20177927..006ac9a2c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java @@ -61,7 +61,7 @@ public class ChunkLoadingExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { world.checkLoadedChunk(location); return super.setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index 5b92a8ad3..4c43f06f9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -96,7 +96,7 @@ public class FastModeExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { if (enabled || postEditSimulation) { dirtyChunks.add(BlockVector2.at(location.getBlockX() >> 4, location.getBlockZ() >> 4)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java index efb5a208f..56f136c39 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java @@ -79,7 +79,7 @@ public class SurvivalModeExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException { + public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { if (toolUse && block.getBlockType().getMaterial().isAir()) { world.simulateBlockMine(location); return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java index 258e02871..cf5b47f48 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java @@ -25,7 +25,6 @@ import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.ArrayList; import java.util.Collections; @@ -36,27 +35,27 @@ import java.util.Map; public class BlockDistributionCounter implements RegionFunction { private Extent extent; - private boolean fuzzy; + private boolean separateStates; - private List> distribution = new ArrayList<>(); - private Map> map = new HashMap<>(); + private List> distribution = new ArrayList<>(); + private Map> map = new HashMap<>(); - public BlockDistributionCounter(Extent extent, boolean fuzzy) { + public BlockDistributionCounter(Extent extent, boolean separateStates) { this.extent = extent; - this.fuzzy = fuzzy; + this.separateStates = separateStates; } @Override public boolean apply(BlockVector3 position) throws WorldEditException { - BlockStateHolder blk = extent.getBlock(position); - if (fuzzy) { - blk = ((BlockState) blk).toFuzzy(); + BlockState blk = extent.getBlock(position); + if (!separateStates) { + blk = blk.getBlockType().getDefaultState(); } if (map.containsKey(blk)) { map.get(blk).increment(); } else { - Countable c = new Countable<>(blk, 1); + Countable c = new Countable<>(blk, 1); map.put(blk, c); distribution.add(c); } @@ -69,7 +68,7 @@ public class BlockDistributionCounter implements RegionFunction { * * @return The distribution */ - public List> getDistribution() { + public List> getDistribution() { Collections.sort(distribution); Collections.reverse(distribution); return this.distribution; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java index 506dc218f..039d1a7fd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java @@ -26,7 +26,7 @@ import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; /** @@ -104,7 +104,7 @@ public class FloraGenerator implements RegionFunction { @Override public boolean apply(BlockVector3 position) throws WorldEditException { - BlockStateHolder block = editSession.getBlock(position); + BlockState block = editSession.getBlock(position); if (block.getBlockType() == BlockTypes.GRASS_BLOCK) { editSession.setBlock(position.add(0, 1, 0), temperatePattern.apply(position)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java index 3e63aa83a..231cfc79e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java @@ -24,7 +24,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.util.TreeGenerator; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; @@ -50,7 +50,7 @@ public class ForestGenerator implements RegionFunction { @Override public boolean apply(BlockVector3 position) throws WorldEditException { - BlockStateHolder block = editSession.getBlock(position); + BlockState block = editSession.getBlock(position); BlockType t = block.getBlockType(); if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java index a8d154955..0d31760af 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java @@ -198,7 +198,7 @@ public class GardenPatchGenerator implements RegionFunction { * @return if block was changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - private static boolean setBlockIfAir(EditSession session, BlockVector3 position, BlockStateHolder block) throws MaxChangedBlocksException { + private static > boolean setBlockIfAir(EditSession session, BlockVector3 position, B block) throws MaxChangedBlocksException { return session.getBlock(position).getBlockType().getMaterial().isAir() && session.setBlock(position, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java index 839f377ef..26e4e1f80 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java @@ -23,7 +23,8 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import java.util.Arrays; import java.util.Collection; @@ -41,7 +42,7 @@ import javax.annotation.Nullable; */ public class BlockMask extends AbstractExtentMask { - private final Set blocks = new HashSet<>(); + private final Set blocks = new HashSet<>(); /** * Create a new block mask. @@ -49,7 +50,7 @@ public class BlockMask extends AbstractExtentMask { * @param extent the extent * @param blocks a list of blocks to match */ - public BlockMask(Extent extent, Collection blocks) { + public BlockMask(Extent extent, Collection blocks) { super(extent); checkNotNull(blocks); this.blocks.addAll(blocks); @@ -61,7 +62,7 @@ public class BlockMask extends AbstractExtentMask { * @param extent the extent * @param block an array of blocks to match */ - public BlockMask(Extent extent, BlockStateHolder... block) { + public BlockMask(Extent extent, BaseBlock... block) { this(extent, Arrays.asList(checkNotNull(block))); } @@ -70,7 +71,7 @@ public class BlockMask extends AbstractExtentMask { * * @param blocks a list of blocks */ - public void add(Collection blocks) { + public void add(Collection blocks) { checkNotNull(blocks); this.blocks.addAll(blocks); } @@ -80,7 +81,7 @@ public class BlockMask extends AbstractExtentMask { * * @param block an array of blocks */ - public void add(BlockStateHolder... block) { + public void add(BaseBlock... block) { add(Arrays.asList(checkNotNull(block))); } @@ -89,14 +90,14 @@ public class BlockMask extends AbstractExtentMask { * * @return a list of blocks */ - public Collection getBlocks() { + public Collection getBlocks() { return blocks; } @Override public boolean test(BlockVector3 vector) { - BlockStateHolder block = getExtent().getBlock(vector); - for (BlockStateHolder testBlock : blocks) { + BlockState block = getExtent().getBlock(vector); + for (BaseBlock testBlock : blocks) { if (testBlock.equalsFuzzy(block)) { return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java index 2a0edba8c..fa49f5108 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java @@ -30,14 +30,14 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; */ public class BlockPattern extends AbstractPattern { - private BlockStateHolder block; + private BaseBlock block; /** * Create a new pattern with the given block. * * @param block the block */ - public BlockPattern(BlockStateHolder block) { + public BlockPattern(BlockStateHolder block) { setBlock(block); } @@ -46,7 +46,7 @@ public class BlockPattern extends AbstractPattern { * * @return the block that is always returned */ - public BlockStateHolder getBlock() { + public BaseBlock getBlock() { return block; } @@ -55,13 +55,13 @@ public class BlockPattern extends AbstractPattern { * * @param block the block */ - public void setBlock(BlockStateHolder block) { + public void setBlock(BlockStateHolder block) { checkNotNull(block); - this.block = block; + this.block = block.toBaseBlock(); } @Override - public BlockStateHolder apply(BlockVector3 position) { + public BaseBlock apply(BlockVector3 position) { return block; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java index 7159d13e2..f62328d0e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java @@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; /** * A pattern that reads from {@link Clipboard}. @@ -45,7 +45,7 @@ public class ClipboardPattern extends AbstractPattern { } @Override - public BlockStateHolder apply(BlockVector3 position) { + public BaseBlock apply(BlockVector3 position) { int xp = Math.abs(position.getBlockX()) % size.getBlockX(); int yp = Math.abs(position.getBlockY()) % size.getBlockY(); int zp = Math.abs(position.getBlockZ()) % size.getBlockZ(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java index 75c5cf20b..119b10938 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.function.pattern; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; /** @@ -33,6 +34,6 @@ public interface Pattern { * @param position the position * @return a block */ - BlockStateHolder apply(BlockVector3 position); + BaseBlock apply(BlockVector3 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 acdcdd662..a55634713 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 @@ -22,7 +22,7 @@ package com.sk89q.worldedit.function.pattern; import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; import java.util.ArrayList; import java.util.List; @@ -53,7 +53,7 @@ public class RandomPattern extends AbstractPattern { } @Override - public BlockStateHolder apply(BlockVector3 position) { + public BaseBlock apply(BlockVector3 position) { double r = random.nextDouble(); double offset = 0; 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 439f2923c..101771ab1 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 @@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; /** * Returns the blocks from {@link Extent}, repeating when out of bounds. @@ -83,7 +83,7 @@ public class RepeatingExtentPattern extends AbstractPattern { } @Override - public BlockStateHolder apply(BlockVector3 position) { + public BaseBlock apply(BlockVector3 position) { BlockVector3 base = position.add(offset); BlockVector3 size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1); int x = base.getBlockX() % size.getBlockX(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java index 1bbef8ab0..ce7c26926 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.history.UndoContext; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; /** @@ -37,8 +38,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; public class BlockChange implements Change { private final BlockVector3 position; - private final BlockStateHolder previous; - private final BlockStateHolder current; + private final BaseBlock previous; + private final BaseBlock current; /** * Create a new block change. @@ -47,13 +48,13 @@ public class BlockChange implements Change { * @param previous the previous block * @param current the current block */ - public BlockChange(BlockVector3 position, BlockStateHolder previous, BlockStateHolder current) { + public , BC extends BlockStateHolder> BlockChange(BlockVector3 position, BP previous, BC current) { checkNotNull(position); checkNotNull(previous); checkNotNull(current); this.position = position; - this.previous = previous; - this.current = current; + this.previous = previous.toBaseBlock(); + this.current = current.toBaseBlock(); } /** @@ -70,7 +71,7 @@ public class BlockChange implements Change { * * @return the previous block */ - public BlockStateHolder getPrevious() { + public BaseBlock getPrevious() { return previous; } @@ -79,7 +80,7 @@ public class BlockChange implements Change { * * @return the current block */ - public BlockStateHolder getCurrent() { + public BaseBlock getCurrent() { return current; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index 86c550f9f..691eb35ba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -172,7 +172,7 @@ public class WorldEditBinding extends BindingHelper { @BindingMatch(type = {BaseBlock.class, BlockState.class, BlockStateHolder.class}, behavior = BindingBehavior.CONSUMES, consumedCount = 1) - public BlockStateHolder getBaseBlock(ArgumentStack context) throws ParameterException, WorldEditException { + public BaseBlock getBaseBlock(ArgumentStack context) throws ParameterException, WorldEditException { Actor actor = context.getContext().getLocals().get(Actor.class); ParserContext parserContext = new ParserContext(); parserContext.setActor(context.getContext().getLocals().get(Actor.class)); @@ -311,19 +311,6 @@ public class WorldEditBinding extends BindingHelper { public BaseBiome getBiomeType(ArgumentStack context) throws ParameterException, WorldEditException { String input = context.next(); if (input != null) { - Actor actor = context.getContext().getLocals().get(Actor.class); - World world; - if (actor instanceof Entity) { - Extent extent = ((Entity) actor).getExtent(); - if (extent instanceof World) { - world = (World) extent; - } else { - throw new ParameterException("A world is required."); - } - } else { - throw new ParameterException("An entity is required."); - } - BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); List knownBiomes = biomeRegistry.getBiomes(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java index bdd40c104..fcee6abcc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java @@ -21,7 +21,6 @@ package com.sk89q.worldedit.internal.registry; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; 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 5b26672cb..9442deaca 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 @@ -131,7 +131,7 @@ public class RegionIntersection extends AbstractRegion { return false; } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({"unchecked"}) @Override public Iterator iterator() { Iterator[] iterators = (Iterator[]) new Iterator[regions.size()]; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java index 8274a6e7b..d31b35afb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java @@ -119,7 +119,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { @Override public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) { - if (position.equals(region.getCenter()) && region.getRadius().lengthSq() == 0) { + if (position.equals(region.getCenter().toBlockPoint()) && region.getRadius().lengthSq() == 0) { return false; } 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 a361b528f..142fbb481 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 @@ -24,7 +24,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; /** * Generates solid and hollow shapes according to materials returned by the @@ -51,7 +51,7 @@ public abstract class ArbitraryShape { * @param defaultMaterial The material returned by the pattern for the current block. * @return material to place or null to not place anything. */ - protected abstract BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial); + protected abstract BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial); /** * Generates the shape. @@ -71,7 +71,7 @@ public abstract class ArbitraryShape { int z = position.getBlockZ(); if (!hollow) { - final BlockStateHolder material = getMaterial(x, y, z, pattern.apply(position)); + BaseBlock material = getMaterial(x, y, z, pattern.apply(position)); if (material != null && editSession.setBlock(position, material)) { ++affected; } @@ -79,7 +79,7 @@ public abstract class ArbitraryShape { continue; } - final BlockStateHolder material = getMaterial(x, y, z, pattern.apply(position)); + BaseBlock material = getMaterial(x, y, z, pattern.apply(position)); if (material == null) { continue; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java index 95c542c6f..b066b1d4b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.regions.shape; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; /** * Generates solid and hollow shapes according to materials returned by the @@ -34,7 +34,7 @@ public class RegionShape extends ArbitraryShape { } @Override - protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { + protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) { if (!this.extent.contains(BlockVector3.at(x, y, z))) { return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java index 594361c4c..4dbebe6aa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java @@ -66,6 +66,6 @@ public abstract class AbstractProperty implements Property { if (!(obj instanceof Property)) { return false; } - return getName().equals(((Property) obj).getName()); + return getName().equals(((Property) obj).getName()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java index 543a28e4f..b01185c38 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java @@ -32,7 +32,7 @@ import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.io.file.FilenameException; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; import java.io.File; import java.util.ArrayList; @@ -157,7 +157,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws UnknownItemException * @throws DisallowedItemException */ - public BlockStateHolder getBlock(String input, boolean allAllowed) throws WorldEditException { + public BaseBlock getBlock(String input, boolean allAllowed) throws WorldEditException { ParserContext context = new ParserContext(); context.setActor(player); context.setWorld(player.getWorld()); @@ -176,7 +176,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws UnknownItemException * @throws DisallowedItemException */ - public BlockStateHolder getBlock(String id) throws WorldEditException { + public BaseBlock getBlock(String id) throws WorldEditException { return getBlock(id, false); } @@ -205,7 +205,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws UnknownItemException * @throws DisallowedItemException */ - public Set getBlocks(String list, boolean allBlocksAllowed) throws WorldEditException { + public Set getBlocks(String list, boolean allBlocksAllowed) throws WorldEditException { ParserContext context = new ParserContext(); context.setActor(player); context.setWorld(player.getWorld()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java index 35552b8d9..e2b3235f6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.util; import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; import java.util.Objects; @@ -32,9 +32,9 @@ import java.util.Objects; public final class LocatedBlock { private final BlockVector3 location; - private final BlockStateHolder block; + private final BaseBlock block; - public LocatedBlock(BlockVector3 location, BlockStateHolder block) { + public LocatedBlock(BlockVector3 location, BaseBlock block) { this.location = checkNotNull(location); this.block = checkNotNull(block); } @@ -43,7 +43,7 @@ public final class LocatedBlock { return location; } - public BlockStateHolder getBlock() { + public BaseBlock getBlock() { return block; } 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 7532f947f..60e5f12f3 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 @@ -250,7 +250,7 @@ public class TreeGenerator { * @return whether a block was changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - private static boolean setChanceBlockIfAir(EditSession session, BlockVector3 position, BlockStateHolder block, double probability) + private static > boolean setChanceBlockIfAir(EditSession session, BlockVector3 position, B block, double probability) throws MaxChangedBlocksException { return Math.random() <= probability && setBlockIfAir(session, position, block); } @@ -263,7 +263,7 @@ public class TreeGenerator { * @return if block was changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - private static boolean setBlockIfAir(EditSession session, BlockVector3 position, BlockStateHolder block) throws MaxChangedBlocksException { + private static > boolean setBlockIfAir(EditSession session, BlockVector3 position, B block) throws MaxChangedBlocksException { return session.getBlock(position).getBlockType().getMaterial().isAir() && session.setBlock(position, block); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java index 4f303acd6..67280031d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java @@ -51,8 +51,8 @@ public class LocatedBlockList implements Iterable { list.add(setBlockCall); } - public void add(BlockVector3 location, BlockStateHolder block) { - add(new LocatedBlock(location, block)); + public > void add(BlockVector3 location, B block) { + add(new LocatedBlock(location, block.toBaseBlock())); } public int size() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java index 060518fb5..5fb92af03 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java @@ -52,7 +52,7 @@ public abstract class AbstractWorld implements World { } @Override - public final boolean setBlock(BlockVector3 pt, BlockStateHolder block) throws WorldEditException { + public final > boolean setBlock(BlockVector3 pt, B block) throws WorldEditException { return setBlock(pt, block, true); } @@ -138,6 +138,7 @@ public abstract class AbstractWorld implements World { this.priority = priority; } + @SuppressWarnings("deprecation") public void play() { playEffect(position, 2001, blockType.getLegacyId()); } 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 6ac2ba3a0..3a9153bd7 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 @@ -60,7 +60,7 @@ public class NullWorld extends AbstractWorld { } @Override - public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { + public > boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException { return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java index b335de3cb..cad0be0f5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java @@ -38,8 +38,6 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.weather.WeatherType; -import java.util.Vector; - /** * Represents a world (dimension). */ @@ -96,7 +94,7 @@ public interface World extends Extent { * @param notifyAndLight true to to notify and light * @return true if the block was successfully set (return value may not be accurate) */ - boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException; + > boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException; /** * Notifies the simulation that the block at the given location has diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java index d92979155..1810f9178 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java @@ -135,7 +135,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { public boolean equals(Object o) { if (!(o instanceof BaseBlock)) { if (!hasNbtData() && o instanceof BlockStateHolder) { - return Objects.equals(toImmutableState(), ((BlockStateHolder) o).toImmutableState()); + return Objects.equals(toImmutableState(), ((BlockStateHolder) o).toImmutableState()); } return false; } @@ -152,7 +152,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { * @return true if equal */ @Override - public boolean equalsFuzzy(BlockStateHolder o) { + public boolean equalsFuzzy(BlockStateHolder o) { return this.toImmutableState().equalsFuzzy(o); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java index 8debc2c47..161b1c304 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java @@ -52,7 +52,7 @@ public class BlockCategory extends Category { * @param blockStateHolder The blockstateholder * @return If it's a part of this category */ - public boolean contains(BlockStateHolder blockStateHolder) { + public > boolean contains(B blockStateHolder) { return this.getAll().contains(blockStateHolder.getBlockType()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index ef2a9c281..565b208a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -74,11 +74,11 @@ public class BlockState implements BlockStateHolder { static Map, Object>, BlockState> generateStateMap(BlockType blockType) { Map, Object>, BlockState> stateMap = new LinkedHashMap<>(); - List properties = blockType.getProperties(); + List> properties = blockType.getProperties(); if (!properties.isEmpty()) { List> separatedValues = Lists.newArrayList(); - for (Property prop : properties) { + for (Property prop : properties) { List vals = Lists.newArrayList(); vals.addAll(prop.getValues()); separatedValues.add(vals); @@ -113,7 +113,7 @@ public class BlockState implements BlockStateHolder { final Table, Object, BlockState> states = HashBasedTable.create(); for(final Map.Entry, Object> entry : this.values.entrySet()) { - final Property property = entry.getKey(); + final Property property = (Property) entry.getKey(); property.getValues().forEach(value -> { if(value != entry.getValue()) { @@ -167,7 +167,7 @@ public class BlockState implements BlockStateHolder { } @Override - public boolean equalsFuzzy(BlockStateHolder o) { + public boolean equalsFuzzy(BlockStateHolder o) { if (this == o) { // Added a reference equality check for return true; @@ -176,19 +176,19 @@ public class BlockState implements BlockStateHolder { return false; } - Set differingProperties = new HashSet<>(); + Set> differingProperties = new HashSet<>(); for (Object state : o.getStates().keySet()) { - if (getState((Property) state) == null) { - differingProperties.add((Property) state); + if (getState((Property) state) == null) { + differingProperties.add((Property) state); } } - for (Property property : getStates().keySet()) { + for (Property property : getStates().keySet()) { if (o.getState(property) == null) { differingProperties.add(property); } } - for (Property property : getStates().keySet()) { + for (Property property : getStates().keySet()) { if (differingProperties.contains(property)) { continue; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java index fe90a3c49..74ea9760f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java @@ -25,7 +25,7 @@ import com.sk89q.worldedit.registry.state.Property; import java.util.Map; import java.util.stream.Collectors; -public interface BlockStateHolder { +public interface BlockStateHolder> { /** * Get the block type @@ -41,7 +41,7 @@ public interface BlockStateHolder { * @param value The value * @return The modified state, or same if could not be applied */ - T with(final Property property, final V value); + B with(final Property property, final V value); /** * Gets the value at the given state @@ -64,7 +64,7 @@ public interface BlockStateHolder { * @param o other block * @return true if equal */ - boolean equalsFuzzy(BlockStateHolder o); + boolean equalsFuzzy(BlockStateHolder o); /** * Returns an immutable {@link BlockState} from this BlockStateHolder. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 56cf2820e..13840aae6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -30,7 +30,6 @@ import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.registry.BlockMaterial; -import com.sk89q.worldedit.world.registry.BundledBlockData; import com.sk89q.worldedit.world.registry.LegacyMapper; import java.util.ArrayList; @@ -49,7 +48,7 @@ public class BlockType { private final String id; private final Function values; private final AtomicReference defaultState = new AtomicReference<>(); - private final AtomicReference> properties = new AtomicReference<>(); + private final AtomicReference>> properties = new AtomicReference<>(); private final AtomicReference blockMaterial = new AtomicReference<>(); private final AtomicReference, Object>, BlockState>> blockStatesMap = new AtomicReference<>(); @@ -114,7 +113,7 @@ public class BlockType { * * @return The properties map */ - public Map getPropertyMap() { + public Map> getPropertyMap() { return updateField(properties, () -> ImmutableMap.copyOf(WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getProperties(this))); } @@ -124,7 +123,7 @@ public class BlockType { * * @return the properties */ - public List getProperties() { + public List> getProperties() { return ImmutableList.copyOf(this.getPropertyMap().values()); } @@ -135,7 +134,9 @@ public class BlockType { * @return The property */ public Property getProperty(String name) { - Property property = getPropertyMap().get(name); + // Assume it works, CCE later at runtime if not. + @SuppressWarnings("unchecked") + Property property = (Property) getPropertyMap().get(name); checkArgument(property != null, "%s has no property named %s", this, name); return property; } 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 39d9a04cd..1d4b92c90 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 @@ -30,8 +30,8 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.storage.InvalidFormatException; @@ -253,14 +253,14 @@ public class AnvilChunk implements Chunk { } @Override - public BlockStateHolder getBlock(BlockVector3 position) throws DataException { + public BaseBlock getBlock(BlockVector3 position) throws DataException { int id = getBlockID(position); int data = getBlockData(position); BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data); if (state == null) { WorldEdit.logger.warning("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk."); - return BlockTypes.AIR.getDefaultState(); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } CompoundTag tileEntity = getBlockTileEntity(position); @@ -268,7 +268,7 @@ public class AnvilChunk implements Chunk { return state.toBaseBlock(tileEntity); } - return state; + return state.toBaseBlock(); } } 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 a07bbf177..2c9cd41b6 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 @@ -29,8 +29,8 @@ import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.DataException; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.storage.InvalidFormatException; @@ -229,7 +229,7 @@ public class AnvilChunk13 implements Chunk { } @Override - public BlockStateHolder getBlock(BlockVector3 position) throws DataException { + public BaseBlock getBlock(BlockVector3 position) throws DataException { int x = position.getX() - rootX * 16; int y = position.getY(); int z = position.getZ() - rootZ * 16; @@ -250,7 +250,7 @@ public class AnvilChunk13 implements Chunk { return state.toBaseBlock(tileEntity); } - return state; + return state.toBaseBlock(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java index 7a1ef7612..01c721bc2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java @@ -21,13 +21,13 @@ package com.sk89q.worldedit.world.chunk; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BaseBlock; /** * A 16 by 16 block chunk. */ public interface Chunk { - + /** * Get a block; * @@ -35,6 +35,6 @@ public interface Chunk { * @return block the block * @throws DataException thrown on data error */ - BlockStateHolder getBlock(BlockVector3 position) throws DataException; + BaseBlock getBlock(BlockVector3 position) throws DataException; } 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 db6d4b0ed..89bad5678 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 @@ -29,8 +29,8 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.storage.InvalidFormatException; @@ -153,7 +153,7 @@ public class OldChunk implements Chunk { } @Override - public BlockStateHolder getBlock(BlockVector3 position) throws DataException { + public BaseBlock getBlock(BlockVector3 position) throws DataException { if(position.getY() >= 128) return BlockTypes.VOID_AIR.getDefaultState().toBaseBlock(); int id, dataVal; @@ -183,7 +183,7 @@ public class OldChunk implements Chunk { BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal); if (state == null) { WorldEdit.logger.warning("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk."); - return BlockTypes.AIR.getDefaultState(); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } CompoundTag tileEntity = getBlockTileEntity(position); @@ -192,7 +192,7 @@ public class OldChunk implements Chunk { return state.toBaseBlock(tileEntity); } - return state; + return state.toBaseBlock(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java index d4f0cd350..e33998a12 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java @@ -55,6 +55,6 @@ public interface BlockRegistry { * @param blockType the block * @return a map of states where the key is the state's ID */ - Map getProperties(BlockType blockType); + Map> getProperties(BlockType blockType); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java index 1be08da87..62c8b5c3a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java @@ -48,7 +48,7 @@ public class BundledBlockRegistry implements BlockRegistry { @Nullable @Override - public Map getProperties(BlockType blockType) { + public Map> getProperties(BlockType blockType) { return Collections.emptyMap(); // Oof } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java index 5ea6044f3..e59cd762a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java @@ -155,7 +155,7 @@ public class LegacyMapper { return INSTANCE; } - @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection", "unused"}) + @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"}) private static class LegacyDataFile { private Map blocks; private Map items; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index 3930f4a03..a20abd100 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -178,7 +178,7 @@ public class ForgePlayer extends AbstractPlayerActor { } @Override - public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { + public > void sendFakeBlock(BlockVector3 pos, B block) { BlockPos loc = ForgeAdapter.toBlockPos(pos); if (block == null) { // TODO diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index 2a4fe60c0..d63d8673a 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -169,7 +169,7 @@ public class ForgeWorld extends AbstractWorld { } @Override - public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { + public > boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException { checkNotNull(position); checkNotNull(block); @@ -184,7 +184,6 @@ public class ForgeWorld extends AbstractWorld { IBlockState old = chunk.getBlockState(pos); Block mcBlock = Block.getBlockFromName(block.getBlockType().getId()); IBlockState newState = mcBlock.getDefaultState(); - @SuppressWarnings("unchecked") Map, Object> states = block.getStates(); newState = applyProperties(mcBlock.getBlockState(), newState, states); IBlockState successState = chunk.setBlockState(pos, newState); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java index 3a4d74edd..3793ffb87 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java @@ -35,6 +35,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemTypes; + import org.spongepowered.api.Sponge; import org.spongepowered.api.data.type.HandTypes; import org.spongepowered.api.entity.living.player.Player; @@ -196,7 +197,7 @@ public class SpongePlayer extends AbstractPlayerActor { } @Override - public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) { + public > void sendFakeBlock(BlockVector3 pos, B block) { org.spongepowered.api.world.Location loc = player.getWorld().getLocation(pos.getX(), pos.getY(), pos.getZ()); if (block == null) { player.sendBlockChange(loc.getBlockPosition(), loc.getBlock()); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index a6631a252..293f5f604 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -135,7 +135,7 @@ public abstract class SpongeWorld extends AbstractWorld { private static final BlockSnapshot.Builder builder = BlockSnapshot.builder(); @Override - public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { + public > boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException { checkNotNull(position); checkNotNull(block); From de7d9421b173f38f7455826a64e79c409366c4b7 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 26 Dec 2018 16:45:46 -0800 Subject: [PATCH 083/182] Add generics to other rawtypes --- .../com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java | 2 +- .../com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java index 40a94baf1..ab0825e3b 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java @@ -87,7 +87,7 @@ public class BukkitImplLoader { Closer closer = Closer.create(); JarFile jar = closer.register(new JarFile(file)); try { - Enumeration entries = jar.entries(); + Enumeration entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry jarEntry = (JarEntry) entries.nextElement(); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java index 17c9800ce..dac72425e 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java @@ -85,7 +85,7 @@ public class SpongeImplLoader { Closer closer = Closer.create(); JarFile jar = closer.register(new JarFile(file)); try { - Enumeration entries = jar.entries(); + Enumeration entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry jarEntry = (JarEntry) entries.nextElement(); From 386668d2212d247c406aae90bc45ff3b31d68dc6 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 26 Dec 2018 16:50:24 -0800 Subject: [PATCH 084/182] Clean up other compiler warnings --- .../worldedit/bukkit/WorldEditPlugin.java | 43 +++++++------------ .../java/com/sk89q/jnbt/ListTagBuilder.java | 2 +- .../sk89q/worldedit/util/FileDialogUtil.java | 2 +- .../worldedit/world/snapshot/Snapshot.java | 7 +-- 4 files changed, 21 insertions(+), 33 deletions(-) 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 4e74d4814..3899db50f 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 @@ -37,6 +37,7 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; + import org.bstats.bukkit.Metrics; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -181,41 +182,27 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { protected void createDefaultConfiguration(String name) { File actual = new File(getDataFolder(), name); if (!actual.exists()) { - InputStream input = null; - try { - JarFile file = new JarFile(getFile()); + try (JarFile file = new JarFile(getFile())) { ZipEntry copy = file.getEntry("defaults/" + name); if (copy == null) throw new FileNotFoundException(); - input = file.getInputStream(copy); + copyDefaultConfig(file.getInputStream(copy), actual, name); } catch (IOException e) { getLogger().severe("Unable to read default configuration: " + name); } - if (input != null) { - FileOutputStream output = null; + } + } - try { - output = new FileOutputStream(actual); - byte[] buf = new byte[8192]; - int length; - while ((length = input.read(buf)) > 0) { - output.write(buf, 0, length); - } - - getLogger().info("Default configuration file written: " + name); - } catch (IOException e) { - getLogger().log(Level.WARNING, "Failed to write default config file", e); - } finally { - try { - input.close(); - } catch (IOException ignored) {} - - try { - if (output != null) { - output.close(); - } - } catch (IOException ignored) {} - } + private void copyDefaultConfig(InputStream input, File actual, String name) { + try (FileOutputStream output = new FileOutputStream(actual)) { + byte[] buf = new byte[8192]; + int length; + while ((length = input.read(buf)) > 0) { + output.write(buf, 0, length); } + + getLogger().info("Default configuration file written: " + name); + } catch (IOException e) { + getLogger().log(Level.WARNING, "Failed to write default config file", e); } } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java index c410ec3ae..ab2b41399 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java @@ -97,7 +97,7 @@ public class ListTagBuilder { * * @return a new builder */ - public static ListTagBuilder createWith(T ... entries) { + public static ListTagBuilder createWith(Tag... entries) { checkNotNull(entries); if (entries.length == 0) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/FileDialogUtil.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/FileDialogUtil.java index b44850ca7..ff3924558 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/FileDialogUtil.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/FileDialogUtil.java @@ -85,7 +85,7 @@ public final class FileDialogUtil { if (index == -1 || index == path.length() - 1) { return false; } else { - return exts.contains(path.indexOf(index + 1)); + return exts.contains(path.substring(index + 1)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java index d3ca0c251..58525a7d2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java @@ -133,9 +133,10 @@ public class Snapshot implements Comparable { public boolean containsWorld(String worldname) { try { if (file.getName().toLowerCase().endsWith(".zip")) { - ZipFile entry = new ZipFile(file); - return (entry.getEntry(worldname) != null - || entry.getEntry(worldname + "/level.dat") != null); + try (ZipFile entry = new ZipFile(file)) { + return (entry.getEntry(worldname) != null + || entry.getEntry(worldname + "/level.dat") != null); + } } else if (file.getName().toLowerCase().endsWith(".tar.bz2") || file.getName().toLowerCase().endsWith(".tar.gz") || file.getName().toLowerCase().endsWith(".tar")) { From 8da984d9f9ca57c2ffc562345eb38bc00cbfbbad Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 27 Dec 2018 15:19:58 +1000 Subject: [PATCH 085/182] Fuzzier fuzzies --- .../factory/parser/DefaultBlockParser.java | 7 +- .../worldedit/world/block/BaseBlock.java | 4 +- .../worldedit/world/block/BlockState.java | 36 +---- .../world/block/FuzzyBlockState.java | 131 ++++++++++++++++++ 4 files changed, 143 insertions(+), 35 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java index e2093ff13..1088c3695 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java @@ -43,6 +43,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.block.FuzzyBlockState; import com.sk89q.worldedit.world.registry.LegacyMapper; import java.util.HashMap; @@ -268,12 +269,14 @@ public class DefaultBlockParser extends InputParser { // No wildcards allowed => eliminate them. (Start with default state) state = blockType.getDefaultState(); } else { - state = blockType.getDefaultState().toFuzzy(); + FuzzyBlockState.Builder fuzzyBuilder = FuzzyBlockState.builder(); + fuzzyBuilder.type(blockType); for (Map.Entry, Object> blockState : blockStates.entrySet()) { @SuppressWarnings("unchecked") Property objProp = (Property) blockState.getKey(); - state = state.with(objProp, blockState.getValue()); + fuzzyBuilder.withProperty(objProp, blockState.getValue()); } + state = fuzzyBuilder.build(); } state = applyProperties(state, stateProperties); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java index 1810f9178..bc913f2d7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java @@ -142,7 +142,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { final BaseBlock otherBlock = (BaseBlock) o; - return this.toImmutableState().equalsFuzzy(otherBlock.toImmutableState()) && Objects.equals(getNbtData(), otherBlock.getNbtData()); + return this.blockState.equalsFuzzy(otherBlock.blockState) && Objects.equals(getNbtData(), otherBlock.getNbtData()); } /** @@ -153,7 +153,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { */ @Override public boolean equalsFuzzy(BlockStateHolder o) { - return this.toImmutableState().equalsFuzzy(o); + return this.blockState.equalsFuzzy(o); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index 565b208a0..a67235d0c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -30,7 +30,6 @@ import com.sk89q.worldedit.registry.state.Property; import java.util.Collections; import java.util.Comparator; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -46,30 +45,16 @@ public class BlockState implements BlockStateHolder { private final BlockType blockType; private final Map, Object> values; - private final boolean fuzzy; private BaseBlock emptyBaseBlock; // Neighbouring state table. private Table, Object, BlockState> states; - private BlockState(BlockType blockType) { + BlockState(BlockType blockType) { this.blockType = blockType; this.values = new LinkedHashMap<>(); this.emptyBaseBlock = new BaseBlock(this); - this.fuzzy = false; - } - - /** - * Creates a fuzzy BlockState. This can be used for partial matching. - * - * @param blockType The block type - * @param values The block state values - */ - private BlockState(BlockType blockType, Map, Object> values) { - this.blockType = blockType; - this.values = values; - this.fuzzy = true; } static Map, Object>, BlockState> generateStateMap(BlockType blockType) { @@ -144,12 +129,8 @@ public class BlockState implements BlockStateHolder { @Override public BlockState with(final Property property, final V value) { - if (fuzzy) { - return setState(property, value); - } else { - BlockState result = states.get(property, value); - return result == null ? this : result; - } + BlockState result = states.get(property, value); + return result == null ? this : result; } @Override @@ -162,10 +143,6 @@ public class BlockState implements BlockStateHolder { return Collections.unmodifiableMap(this.values); } - public BlockState toFuzzy() { - return new BlockState(this.getBlockType(), new HashMap<>()); - } - @Override public boolean equalsFuzzy(BlockStateHolder o) { if (this == o) { @@ -207,9 +184,6 @@ public class BlockState implements BlockStateHolder { @Override public BaseBlock toBaseBlock() { - if (this.fuzzy) { - throw new IllegalArgumentException("Can't create a BaseBlock from a fuzzy BlockState!"); - } return this.emptyBaseBlock; } @@ -230,7 +204,7 @@ public class BlockState implements BlockStateHolder { * @param value The value * @return The blockstate, for chaining */ - private BlockState setState(final Property property, final Object value) { + BlockState setState(final Property property, final Object value) { this.values.put(property, value); return this; } @@ -251,6 +225,6 @@ public class BlockState implements BlockStateHolder { @Override public int hashCode() { - return Objects.hash(blockType, values, fuzzy); + return Objects.hash(blockType, values); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java new file mode 100644 index 000000000..a2082270e --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java @@ -0,0 +1,131 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.block; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.registry.state.Property; + +import java.util.HashMap; +import java.util.Map; + +/** + * A Fuzzy BlockState. Used for partial matching. + * + * Immutable, construct with {@link FuzzyBlockState.Builder}. + */ +public class FuzzyBlockState extends BlockState { + + FuzzyBlockState(BlockType blockType) { + super(blockType); + } + + @SuppressWarnings("unchecked") + @Override + public BlockState toImmutableState() { + BlockState state = getBlockType().getDefaultState(); + for (Map.Entry, Object> entry : getStates().entrySet()) { + state = state.with((Property) entry.getKey(), entry.getValue()); + } + return getBlockType().getDefaultState(); + } + + /** + * Gets an instance of a builder. + * + * @return The builder + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for FuzzyBlockState + */ + public static class Builder { + private BlockState internalState; + private Map, Object> values = new HashMap<>(); + + /** + * The type of the Fuzzy BlockState + * + * @param type The type + * @return The builder, for chaining + */ + public Builder type(BlockType type) { + checkNotNull(type); + internalState = type.getDefaultState(); + return this; + } + + /** + * The type of the Fuzzy BlockState + * + * @param state The state + * @return The builder, for chaining + */ + public Builder type(BlockState state) { + checkNotNull(state); + internalState = state; + return this; + } + + /** + * Adds a property to the fuzzy BlockState + * + * @param property The property + * @param value The value + * @param The property type + * @return The builder, for chaining + */ + public Builder withProperty(Property property, V value) { + checkNotNull(property); + checkNotNull(value); + checkNotNull(internalState, "The type must be set before the properties!"); + values.put(property, value); + return this; + } + + /** + * Builds a FuzzyBlockState from this builder. + * + * @return The fuzzy BlockState + */ + public FuzzyBlockState build() { + checkNotNull(internalState); + FuzzyBlockState blockState = new FuzzyBlockState(internalState.getBlockType()); + for (Map.Entry, Object> entry : values.entrySet()) { + blockState.setState(entry.getKey(), entry.getValue()); + } + return blockState; + } + + /** + * Resets the builder. + * + * @return The builder, for chaining + */ + public Builder reset() { + this.internalState = null; + this.values.clear(); + return this; + } + } +} From b544782f3b653b3998d52c02cd12695ab5c03882 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 27 Dec 2018 15:33:19 +1000 Subject: [PATCH 086/182] Make the base fuzzy cached per block type --- .../com/sk89q/worldedit/world/block/BlockType.java | 5 +++++ .../worldedit/world/block/FuzzyBlockState.java | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 13840aae6..633f00a3f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -48,6 +48,7 @@ public class BlockType { private final String id; private final Function values; private final AtomicReference defaultState = new AtomicReference<>(); + private final AtomicReference emptyFuzzy = new AtomicReference<>(); private final AtomicReference>> properties = new AtomicReference<>(); private final AtomicReference blockMaterial = new AtomicReference<>(); private final AtomicReference, Object>, BlockState>> blockStatesMap = new AtomicReference<>(); @@ -156,6 +157,10 @@ public class BlockType { }); } + public FuzzyBlockState getFuzzyMatcher() { + return updateField(emptyFuzzy, () -> new FuzzyBlockState(this)); + } + /** * Gets a list of all possible states for this BlockType. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java index a2082270e..708c50f3c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java @@ -37,11 +37,16 @@ public class FuzzyBlockState extends BlockState { super(blockType); } - @SuppressWarnings("unchecked") - @Override - public BlockState toImmutableState() { + /** + * Gets a full BlockState from this fuzzy one, filling in + * properties with default values where necessary. + * + * @return The full BlockState + */ + public BlockState getFullState() { BlockState state = getBlockType().getDefaultState(); for (Map.Entry, Object> entry : getStates().entrySet()) { + //noinspection unchecked state = state.with((Property) entry.getKey(), entry.getValue()); } return getBlockType().getDefaultState(); @@ -110,6 +115,9 @@ public class FuzzyBlockState extends BlockState { */ public FuzzyBlockState build() { checkNotNull(internalState); + if (values.isEmpty()) { + return internalState.getBlockType().getFuzzyMatcher(); + } FuzzyBlockState blockState = new FuzzyBlockState(internalState.getBlockType()); for (Map.Entry, Object> entry : values.entrySet()) { blockState.setState(entry.getKey(), entry.getValue()); From 54b6e571866a07f037b7f427c456777c2e0c373b Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 28 Dec 2018 15:05:05 +1000 Subject: [PATCH 087/182] Few minor improvements to the fuzzy system. --- .../worldedit/world/block/BlockState.java | 3 +- .../world/block/FuzzyBlockState.java | 33 +++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index a67235d0c..d441e98d7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -129,8 +129,7 @@ public class BlockState implements BlockStateHolder { @Override public BlockState with(final Property property, final V value) { - BlockState result = states.get(property, value); - return result == null ? this : result; + return states.row(property).getOrDefault(value, this); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java index 708c50f3c..b9c557fd4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java @@ -37,6 +37,13 @@ public class FuzzyBlockState extends BlockState { super(blockType); } + private FuzzyBlockState(BlockType blockType, Map, Object> values) { + this(blockType); + for (Map.Entry, Object> entry : values.entrySet()) { + setState(entry.getKey(), entry.getValue()); + } + } + /** * Gets a full BlockState from this fuzzy one, filling in * properties with default values where necessary. @@ -46,8 +53,9 @@ public class FuzzyBlockState extends BlockState { public BlockState getFullState() { BlockState state = getBlockType().getDefaultState(); for (Map.Entry, Object> entry : getStates().entrySet()) { - //noinspection unchecked - state = state.with((Property) entry.getKey(), entry.getValue()); + @SuppressWarnings("unchecked") + Property objKey = (Property) entry.getKey(); + state = state.with(objKey, entry.getValue()); } return getBlockType().getDefaultState(); } @@ -65,7 +73,7 @@ public class FuzzyBlockState extends BlockState { * Builder for FuzzyBlockState */ public static class Builder { - private BlockState internalState; + private BlockType type; private Map, Object> values = new HashMap<>(); /** @@ -76,7 +84,7 @@ public class FuzzyBlockState extends BlockState { */ public Builder type(BlockType type) { checkNotNull(type); - internalState = type.getDefaultState(); + this.type = type; return this; } @@ -88,7 +96,7 @@ public class FuzzyBlockState extends BlockState { */ public Builder type(BlockState state) { checkNotNull(state); - internalState = state; + this.type = state.getBlockType(); return this; } @@ -103,7 +111,8 @@ public class FuzzyBlockState extends BlockState { public Builder withProperty(Property property, V value) { checkNotNull(property); checkNotNull(value); - checkNotNull(internalState, "The type must be set before the properties!"); + checkNotNull(type, "The type must be set before the properties!"); + type.getProperty(property.getName()); // Verify the property is valid for this type values.put(property, value); return this; } @@ -114,15 +123,11 @@ public class FuzzyBlockState extends BlockState { * @return The fuzzy BlockState */ public FuzzyBlockState build() { - checkNotNull(internalState); + checkNotNull(type); if (values.isEmpty()) { - return internalState.getBlockType().getFuzzyMatcher(); + return type.getFuzzyMatcher(); } - FuzzyBlockState blockState = new FuzzyBlockState(internalState.getBlockType()); - for (Map.Entry, Object> entry : values.entrySet()) { - blockState.setState(entry.getKey(), entry.getValue()); - } - return blockState; + return new FuzzyBlockState(type, values); } /** @@ -131,7 +136,7 @@ public class FuzzyBlockState extends BlockState { * @return The builder, for chaining */ public Builder reset() { - this.internalState = null; + this.type = null; this.values.clear(); return this; } From 862b63d43a3f7711b394b49cf5af2883369db012 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 28 Dec 2018 18:06:41 +1000 Subject: [PATCH 088/182] Can't query the row directly --- .../main/java/com/sk89q/worldedit/world/block/BlockState.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index d441e98d7..a67235d0c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -129,7 +129,8 @@ public class BlockState implements BlockStateHolder { @Override public BlockState with(final Property property, final V value) { - return states.row(property).getOrDefault(value, this); + BlockState result = states.get(property, value); + return result == null ? this : result; } @Override From 2f8bdccf650bdf5e9c94a6d7633ab272fd839096 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Fri, 28 Dec 2018 22:20:12 -0800 Subject: [PATCH 089/182] Clarify state when asking for caps with no platforms --- .../worldedit/extension/platform/PlatformManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index 6ff415d4b..af45b642f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -167,7 +167,12 @@ public class PlatformManager { return platform; } else { if (preferences.isEmpty()) { - return platforms.get(0); // Use the first available if preferences have not been decided yet. + // Use the first available if preferences have not been decided yet. + if (platforms.isEmpty()) { + // No platforms registered, this is being called too early! + throw new NoCapablePlatformException("No platforms have been registered yet! Please wait until WorldEdit is initialized."); + } + return platforms.get(0); } throw new NoCapablePlatformException("No platform was found supporting " + capability.name()); } From 871541d8c09ec1c35c85297cfa8635f075528f8b Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 29 Dec 2018 19:21:33 +1000 Subject: [PATCH 090/182] Tweak the last access extent cache to provide better caching --- .../extent/buffer/ForgetfulExtentBuffer.java | 5 +-- .../extent/cache/LastAccessExtentCache.java | 45 ++++++++++++++++--- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java index 30f1b7b85..0aa410916 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java @@ -92,9 +92,8 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat max = max.getMaximum(location); } - BlockVector3 blockVector = location; - if (mask.test(blockVector)) { - buffer.put(blockVector, block.toBaseBlock()); + if (mask.test(location)) { + buffer.put(location, block.toBaseBlock()); return true; } else { return getExtent().setBlock(location, block); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java index 8a582db16..d6da35e10 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java @@ -19,10 +19,13 @@ package com.sk89q.worldedit.extent.cache; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; /** * Returns the same cached {@link BlockState} for repeated calls to @@ -30,7 +33,8 @@ import com.sk89q.worldedit.world.block.BlockState; */ public class LastAccessExtentCache extends AbstractDelegateExtent { - private CachedBlock lastBlock; + private CachedBlock lastBlock; + private CachedBlock lastFullBlock; /** * Create a new instance. @@ -43,21 +47,48 @@ public class LastAccessExtentCache extends AbstractDelegateExtent { @Override public BlockState getBlock(BlockVector3 position) { - CachedBlock lastBlock = this.lastBlock; + CachedBlock lastBlock = this.lastBlock; if (lastBlock != null && lastBlock.position.equals(position)) { return lastBlock.block; } else { BlockState block = super.getBlock(position); - this.lastBlock = new CachedBlock(position, block); + this.lastBlock = new CachedBlock<>(position, block); return block; } } - private static class CachedBlock { - private final BlockVector3 position; - private final BlockState block; + @Override + public BaseBlock getFullBlock(BlockVector3 position) { + CachedBlock lastFullBlock = this.lastFullBlock; + if (lastFullBlock != null && lastFullBlock.position.equals(position)) { + return lastFullBlock.block; + } else { + BaseBlock block = super.getFullBlock(position); + this.lastFullBlock = new CachedBlock<>(position, block); + return block; + } + } - private CachedBlock(BlockVector3 position, BlockState block) { + @Override + public > boolean setBlock(BlockVector3 location, T block) throws WorldEditException { + if (super.setBlock(location, block)) { + if (lastFullBlock != null && lastFullBlock.position.equals(location)) { + this.lastFullBlock = new CachedBlock<>(location, block.toBaseBlock()); + } + if (lastBlock != null && lastBlock.position.equals(location)) { + this.lastBlock = new CachedBlock<>(location, block.toImmutableState()); + } + + return true; + } + return false; + } + + private static class CachedBlock> { + private final BlockVector3 position; + private final B block; + + private CachedBlock(BlockVector3 position, B block) { this.position = position; this.block = block; } From c6ef09380ec5f26a9279824f7899ced9732013c6 Mon Sep 17 00:00:00 2001 From: orthoplex64 Date: Mon, 31 Dec 2018 19:04:32 -0600 Subject: [PATCH 091/182] Update maze.js --- contrib/craftscripts/maze.js | 109 +++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 44 deletions(-) diff --git a/contrib/craftscripts/maze.js b/contrib/craftscripts/maze.js index dd5ca6a52..10c131af8 100644 --- a/contrib/craftscripts/maze.js +++ b/contrib/craftscripts/maze.js @@ -19,6 +19,7 @@ importPackage(Packages.com.sk89q.worldedit); importPackage(Packages.com.sk89q.worldedit.blocks); +importPackage(Packages.com.sk89q.worldedit.math); usage = " [width] [length] [height] [size] [thickness] flags\n"; usage += "\n"; @@ -40,10 +41,30 @@ usage += "• b places blue wool if unvisited"; context.checkArgs(1, -1, usage); sess = context.remember(); -origin = player.getBlockIn(); +origin = player.getBlockIn().toVector().toBlockPoint(); // This may throw an exception that is caught by the script processor block = context.getBlock(argv[1]); +airBlock = context.getBlock("air"); +glassBlock = context.getBlock("glass"); +clothBlocks = [ + context.getBlock("white_wool"), + context.getBlock("orange_wool"), + context.getBlock("magenta_wool"), + context.getBlock("light_blue_wool"), + context.getBlock("yellow_wool"), + context.getBlock("lime_wool"), + context.getBlock("pink_wool"), + context.getBlock("gray_wool"), + context.getBlock("light_gray_wool"), + context.getBlock("cyan_wool"), + context.getBlock("purple_wool"), + context.getBlock("blue_wool"), + context.getBlock("brown_wool"), + context.getBlock("green_wool"), + context.getBlock("red_wool"), + context.getBlock("black_wool") +]; if (argv.length > 7) flags = String(argv[7]); else flags = false; @@ -74,20 +95,20 @@ if (argv.length > 2) { } else w = 5; if (flags) { - ee = flags.search("i") != -1 ? true : false; - r = flags.search("y") != -1 ? true : false; + ee = flags.search("i") != -1; + r = flags.search("y") != -1; if (r) ee = true; - f = flags.search("f") != -1 ? true : false; - c = flags.search("c") != -1 ? true : false; - e = flags.search("e") != -1 ? true : false; - ao = flags.search("a") != -1 ? true : false; + f = flags.search("f") != -1; + c = flags.search("c") != -1; + e = flags.search("e") != -1; + ao = flags.search("a") != -1; if (ao) f = c = false, e = true; - v = flags.search("v") != -1 ? true : false; - so = flags.search("s") != -1 ? true : false; + v = flags.search("v") != -1; + so = flags.search("s") != -1; if (so) ee = true; - g = flags.search("g") != -1 ? true : false; - re = flags.search("r") != -1 ? true : false; - bl = flags.search("b") != -1 ? true : false; + g = flags.search("g") != -1; + re = flags.search("r") != -1; + bl = flags.search("b") != -1; if (g || re || bl) so = ee = true; } else ee = r = f = c = e = ao = v = so = g = re = bl = false; @@ -208,8 +229,8 @@ for (y = 0; y <= l; y++) for (x = 0; x <= w; x++) { } } else if (e && cell != id(x, l)) { for (z = 0; z < h; z++) for (yi = 0; yi < s; yi++) for (xi = 1; xi <= wa; xi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), BaseBlock(0)); - else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), BaseBlock(0)); + if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), airBlock); + else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), airBlock); } } @@ -222,8 +243,8 @@ for (y = 0; y <= l; y++) for (x = 0; x <= w; x++) { } } else if (e && cell != id(w, y)) { for (z = 0; z < h; z++) for (yi = 1; yi <= wa; yi++) for (xi = 0; xi < s; xi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), BaseBlock(0)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), BaseBlock(0)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), airBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), airBlock); } } @@ -236,8 +257,8 @@ for (y = 0; y <= l; y++) for (x = 0; x <= w; x++) { if (e && cell != id(x, l) && cell != id(w, y)) { for (z = 0; z < h; z++) for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) + yi), BaseBlock(0)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, -z), BaseBlock(0)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) + yi), airBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, -z), airBlock); } } } @@ -281,51 +302,51 @@ if (so) { if (visited[cell] && !wrong[cell]) { for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), BaseBlock(35, 5)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), BaseBlock(35, 5)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), clothBlocks[5]); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), clothBlocks[5]); } } if ((visited[cell] && !wrong[cell] && visited[id(x - 1, y)] && !wrong[id(x - 1, y)] && noWallLeft[cell]) || cell == start || id(x - 1, y) == end) { for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), BaseBlock(35, 5)); - else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), BaseBlock(35, 5)); + if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), clothBlocks[5]); + else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), clothBlocks[5]); } } if (visited[cell] && !wrong[cell] && visited[id(x, y - 1)] && !wrong[id(x, y - 1)] && noWallAbove[cell]) { for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), BaseBlock(35, 5)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), BaseBlock(35, 5)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), clothBlocks[5]); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), clothBlocks[5]); } } if (g) { if (visited[cell] && !wrong[cell] && (!visited[id(x - 1, y)] || wrong[id(x - 1, y)]) && noWallLeft[cell] && cell != start) { for (z = 0; z < h; z++) for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), BaseBlock(20)); - else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), BaseBlock(20)); + if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), glassBlock); + else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), glassBlock); } } if ((!visited[cell] || wrong[cell]) && visited[id(x - 1, y)] && !wrong[id(x - 1, y)] && noWallLeft[cell] && id(x - 1, y) != end) { for (z = 0; z < h; z++) for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), BaseBlock(20)); - else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), BaseBlock(20)); + if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, z, y * (s + wa) + yi), glassBlock); + else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, -z), glassBlock); } } if (visited[cell] && !wrong[cell] && (!visited[id(x, y - 1)] || wrong[id(x, y - 1)]) && noWallAbove[cell]) { for (z = 0; z < h; z++) for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), BaseBlock(20)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), BaseBlock(20)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), glassBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), glassBlock); } } if ((!visited[cell] || wrong[cell]) && visited[id(x, y - 1)] && !wrong[id(x, y - 1)] && noWallAbove[cell]) { for (z = 0; z < h; z++) for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), BaseBlock(20)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), BaseBlock(20)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, z, y * (s + wa) - yi), glassBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, -z), glassBlock); } } } @@ -333,22 +354,22 @@ if (so) { if (re) { if (wrong[cell]) { for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), BaseBlock(35, 14)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), BaseBlock(35, 14)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), clothBlocks[14]); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), clothBlocks[14]); } } if ((wrong[cell] || wrong[id(x - 1, y)]) && noWallLeft[cell]) { for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), BaseBlock(35, 14)); - else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), BaseBlock(35, 14)); + if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), clothBlocks[14]); + else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), clothBlocks[14]); } } if ((wrong[cell] || wrong[id(x, y - 1)]) && noWallAbove[cell]) { for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), BaseBlock(35, 14)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), BaseBlock(35, 14)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), clothBlocks[14]); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), clothBlocks[14]); } } } @@ -356,22 +377,22 @@ if (so) { if (bl) { if (!visited[cell] && y < l && x < w) { for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), BaseBlock(35, 11)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), BaseBlock(35, 11)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), clothBlocks[11]); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), clothBlocks[11]); } } if ((!visited[cell] || !visited[id(x - 1, y)]) && noWallLeft[cell] && x > 0 && x < w) { for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), BaseBlock(35, 11)); - else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), BaseBlock(35, 11)); + if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), clothBlocks[11]); + else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), clothBlocks[11]); } } if ((!visited[cell] || !visited[id(x, y - 1)]) && noWallAbove[cell]) { for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), BaseBlock(35, 11)); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), BaseBlock(35, 11)); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), clothBlocks[11]); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), clothBlocks[11]); } } } From 4b004b65310f69af8ceb5d4fa08b22e752c784f9 Mon Sep 17 00:00:00 2001 From: orthoplex64 Date: Mon, 31 Dec 2018 19:36:41 -0600 Subject: [PATCH 092/182] Use 3 wool block variables instead of array --- contrib/craftscripts/maze.js | 57 +++++++++++++----------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/contrib/craftscripts/maze.js b/contrib/craftscripts/maze.js index 10c131af8..ea97ea042 100644 --- a/contrib/craftscripts/maze.js +++ b/contrib/craftscripts/maze.js @@ -47,24 +47,9 @@ origin = player.getBlockIn().toVector().toBlockPoint(); block = context.getBlock(argv[1]); airBlock = context.getBlock("air"); glassBlock = context.getBlock("glass"); -clothBlocks = [ - context.getBlock("white_wool"), - context.getBlock("orange_wool"), - context.getBlock("magenta_wool"), - context.getBlock("light_blue_wool"), - context.getBlock("yellow_wool"), - context.getBlock("lime_wool"), - context.getBlock("pink_wool"), - context.getBlock("gray_wool"), - context.getBlock("light_gray_wool"), - context.getBlock("cyan_wool"), - context.getBlock("purple_wool"), - context.getBlock("blue_wool"), - context.getBlock("brown_wool"), - context.getBlock("green_wool"), - context.getBlock("red_wool"), - context.getBlock("black_wool") -]; +limeWoolBlock = context.getBlock("lime_wool"); +redWoolBlock = context.getBlock("red_wool"); +blueWoolBlock = context.getBlock("blue_wool"); if (argv.length > 7) flags = String(argv[7]); else flags = false; @@ -302,22 +287,22 @@ if (so) { if (visited[cell] && !wrong[cell]) { for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), clothBlocks[5]); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), clothBlocks[5]); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), limeWoolBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), limeWoolBlock); } } if ((visited[cell] && !wrong[cell] && visited[id(x - 1, y)] && !wrong[id(x - 1, y)] && noWallLeft[cell]) || cell == start || id(x - 1, y) == end) { for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), clothBlocks[5]); - else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), clothBlocks[5]); + if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), limeWoolBlock); + else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), limeWoolBlock); } } if (visited[cell] && !wrong[cell] && visited[id(x, y - 1)] && !wrong[id(x, y - 1)] && noWallAbove[cell]) { for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), clothBlocks[5]); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), clothBlocks[5]); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), limeWoolBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), limeWoolBlock); } } @@ -354,22 +339,22 @@ if (so) { if (re) { if (wrong[cell]) { for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), clothBlocks[14]); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), clothBlocks[14]); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), redWoolBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), redWoolBlock); } } if ((wrong[cell] || wrong[id(x - 1, y)]) && noWallLeft[cell]) { for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), clothBlocks[14]); - else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), clothBlocks[14]); + if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), redWoolBlock); + else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), redWoolBlock); } } if ((wrong[cell] || wrong[id(x, y - 1)]) && noWallAbove[cell]) { for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), clothBlocks[14]); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), clothBlocks[14]); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), redWoolBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), redWoolBlock); } } } @@ -377,22 +362,22 @@ if (so) { if (bl) { if (!visited[cell] && y < l && x < w) { for (yi = 0; yi < s; yi++) for (xi = 0; xi < s; xi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), clothBlocks[11]); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), clothBlocks[11]); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) + yi), blueWoolBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) + yi, +1), blueWoolBlock); } } if ((!visited[cell] || !visited[id(x - 1, y)]) && noWallLeft[cell] && x > 0 && x < w) { for (xi = 1; xi <= wa; xi++) for (yi = 0; yi < s; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), clothBlocks[11]); - else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), clothBlocks[11]); + if (!v) sess.setBlock(origin.add(x * (s + wa) - xi, -1, y * (s + wa) + yi), blueWoolBlock); + else sess.setBlock(origin.add(x * (s + wa) - xi, y * (s + wa) + yi, +1), blueWoolBlock); } } if ((!visited[cell] || !visited[id(x, y - 1)]) && noWallAbove[cell]) { for (xi = 0; xi < s; xi++) for (yi = 1; yi <= wa; yi++) { - if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), clothBlocks[11]); - else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), clothBlocks[11]); + if (!v) sess.setBlock(origin.add(x * (s + wa) + xi, -1, y * (s + wa) - yi), blueWoolBlock); + else sess.setBlock(origin.add(x * (s + wa) + xi, y * (s + wa) - yi, +1), blueWoolBlock); } } } From 432a201266b96d3a48bf59eee945dd9883f1126f Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Mon, 21 Jan 2019 19:07:29 +0100 Subject: [PATCH 093/182] Make biome changes undoable --- .../worldedit/extent/ChangeSetExtent.java | 10 ++ .../worldedit/history/change/BiomeChange.java | 96 +++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java index 5f447269e..2516b4252 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java @@ -24,13 +24,16 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; +import com.sk89q.worldedit.history.change.BiomeChange; import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.history.change.EntityCreate; import com.sk89q.worldedit.history.change.EntityRemove; import com.sk89q.worldedit.history.changeset.ChangeSet; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -65,6 +68,13 @@ public class ChangeSetExtent extends AbstractDelegateExtent { return super.setBlock(location, block); } + @Override + public boolean setBiome(BlockVector2 position, BaseBiome biome) { + BaseBiome previous = getBiome(position); + changeSet.add(new BiomeChange(position, previous, new BaseBiome(biome))); + return super.setBiome(position, biome); + } + @Nullable @Override public Entity createEntity(Location location, BaseEntity state) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java new file mode 100644 index 000000000..133f38f7f --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java @@ -0,0 +1,96 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.history.change; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.history.UndoContext; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.world.biome.BaseBiome; + +/** + * Represents a biome change that may be undone or replayed. + * + *

    This biome change does not have an {@link Extent} assigned to it because + * one will be taken from the passed {@link UndoContext}. If the context + * does not have an extent (it is null), cryptic errors may occur.

    + */ +public class BiomeChange implements Change { + + private final BlockVector2 position; + private final BaseBiome previous; + private final BaseBiome current; + + /** + * Create a new biome change. + * + * @param position the position + * @param previous the previous biome + * @param current the current biome + */ + public BiomeChange(BlockVector2 position, BaseBiome previous, BaseBiome current) { + checkNotNull(position); + checkNotNull(previous); + checkNotNull(current); + this.position = position; + this.previous = previous; + this.current = current; + } + + /** + * Get the position. + * + * @return the position + */ + public BlockVector2 getPosition() { + return position; + } + + /** + * Get the previous biome. + * + * @return the previous biome + */ + public BaseBiome getPrevious() { + return previous; + } + + /** + * Get the current biome. + * + * @return the current biome + */ + public BaseBiome getCurrent() { + return current; + } + + @Override + public void undo(UndoContext context) throws WorldEditException { + checkNotNull(context.getExtent()).setBiome(position, previous); + } + + @Override + public void redo(UndoContext context) throws WorldEditException { + checkNotNull(context.getExtent()).setBiome(position, current); + } + +} From 2e0fa300b7465d0112fee7b3ef6251c4bfe91432 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 22 Jan 2019 21:34:14 +1000 Subject: [PATCH 094/182] Actually support disabling chunk loading extent --- .../com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java index 006ac9a2c..de5ae4378 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java @@ -62,7 +62,9 @@ public class ChunkLoadingExtent extends AbstractDelegateExtent { @Override public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { - world.checkLoadedChunk(location); + if (enabled) { + world.checkLoadedChunk(location); + } return super.setBlock(location, block); } } From 2f9c7f19f504d861f0b24477bb5e2fdeb82abcbd Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 22 Jan 2019 21:59:20 +1000 Subject: [PATCH 095/182] Added support for 'rotation' BlockState values. --- .../transform/BlockTransformExtent.java | 20 +++++ .../com/sk89q/worldedit/util/Direction.java | 89 +++++++++++++++++++ 2 files changed, 109 insertions(+) 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 535f32436..2f5db2bef 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 @@ -31,6 +31,7 @@ import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.registry.state.BooleanProperty; import com.sk89q.worldedit.registry.state.DirectionalProperty; import com.sk89q.worldedit.registry.state.EnumProperty; +import com.sk89q.worldedit.registry.state.IntegerProperty; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.block.BaseBlock; @@ -39,6 +40,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.List; import java.util.Objects; +import java.util.Optional; +import java.util.OptionalInt; import java.util.Set; import java.util.stream.Collectors; @@ -160,6 +163,23 @@ public class BlockTransformExtent extends AbstractDelegateExtent { } } } + } else if (property instanceof IntegerProperty) { + IntegerProperty intProp = (IntegerProperty) property; + if (property.getName().equals("rotation")) { + if (intProp.getValues().size() == 16) { + Optional direction = Direction.fromRotationIndex(block.getState(intProp)); + int horizontalFlags = Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL; + if (direction.isPresent()) { + Vector3 vec = getNewStateValue(Direction.valuesOf(horizontalFlags), transform, direction.get().toVector()); + if (vec != null) { + OptionalInt newRotation = Direction.findClosest(vec, horizontalFlags).toRotationIndex(); + if (newRotation.isPresent()) { + result = result.with(intProp, newRotation.getAsInt()); + } + } + } + } + } } } 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 59bb6c789..dea0528d0 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 @@ -24,6 +24,8 @@ import com.sk89q.worldedit.math.Vector3; import java.util.ArrayList; import java.util.List; +import java.util.Optional; +import java.util.OptionalInt; import javax.annotation.Nullable; @@ -170,6 +172,93 @@ public enum Direction { return directions; } + /** + * Converts a rotation index into a Direction. + * + *

    + * Rotation indexes are used in BlockStates, such as sign posts. + *

    + * + * @param rotation The rotation index + * @return The direction, if applicable + */ + public static Optional fromRotationIndex(int rotation) { + switch (rotation) { + case 0: + return Optional.of(SOUTH); + case 1: + return Optional.of(SOUTH_SOUTHWEST); + case 2: + return Optional.of(SOUTHWEST); + case 3: + return Optional.of(WEST_SOUTHWEST); + case 4: + return Optional.of(WEST); + case 5: + return Optional.of(WEST_NORTHWEST); + case 6: + return Optional.of(NORTHWEST); + case 7: + return Optional.of(NORTH_NORTHWEST); + case 8: + return Optional.of(NORTH); + case 9: + return Optional.of(NORTH_NORTHEAST); + case 10: + return Optional.of(NORTHEAST); + case 11: + return Optional.of(EAST_NORTHEAST); + case 12: + return Optional.of(EAST); + case 13: + return Optional.of(EAST_SOUTHEAST); + case 14: + return Optional.of(SOUTHEAST); + case 15: + return Optional.of(SOUTH_SOUTHEAST); + } + + return Optional.empty(); + } + + public OptionalInt toRotationIndex() { + switch (this) { + case SOUTH: + return OptionalInt.of(0); + case SOUTH_SOUTHWEST: + return OptionalInt.of(1); + case SOUTHWEST: + return OptionalInt.of(2); + case WEST_SOUTHWEST: + return OptionalInt.of(3); + case WEST: + return OptionalInt.of(4); + case WEST_NORTHWEST: + return OptionalInt.of(5); + case NORTHWEST: + return OptionalInt.of(6); + case NORTH_NORTHWEST: + return OptionalInt.of(7); + case NORTH: + return OptionalInt.of(8); + case NORTH_NORTHEAST: + return OptionalInt.of(9); + case NORTHEAST: + return OptionalInt.of(10); + case EAST_NORTHEAST: + return OptionalInt.of(11); + case EAST: + return OptionalInt.of(12); + case EAST_SOUTHEAST: + return OptionalInt.of(13); + case SOUTHEAST: + return OptionalInt.of(14); + case SOUTH_SOUTHEAST: + return OptionalInt.of(15); + } + return OptionalInt.empty(); + } + /** * Flags to use with {@link #findClosest(Vector3, int)}. */ From 6bbf29b40ee72fe7b6ff0daa2f96200551beb8f4 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 22 Jan 2019 22:01:15 +1000 Subject: [PATCH 096/182] Bump to Beta 5 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6b63f5caf..4ef344e64 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ println """ allprojects { group = 'com.sk89q.worldedit' - version = '7.0.0-SNAPSHOT' + version = '7.0.0-beta-05' } if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost" From eb0223803aaccc0968cd52a60bf1851f991c2ae6 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 22 Jan 2019 22:08:33 +1000 Subject: [PATCH 097/182] Back to SNAPSHOT for continued development --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4ef344e64..6b63f5caf 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ println """ allprojects { group = 'com.sk89q.worldedit' - version = '7.0.0-beta-05' + version = '7.0.0-SNAPSHOT' } if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost" From fadcf1a1db9e2eecff791fb737930c520a6cb160 Mon Sep 17 00:00:00 2001 From: Wizjany Date: Wed, 23 Jan 2019 16:21:37 -0500 Subject: [PATCH 098/182] Change CI link to enginehub. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3cbea9496..2cfef0034 100644 --- a/README.md +++ b/README.md @@ -31,5 +31,5 @@ Links * [Discord](https://discord.gg/wvneRVm) * [IRC channel](http://skq.me/irc/irc.esper.net/sk89q/) (#sk89q on irc.esper.net) * [Issue tracker](http://youtrack.sk89q.com/issues/WORLDEDIT) -* [Continuous integration](http://builds.enginehub.org) [![Build Status](https://travis-ci.org/sk89q/WorldEdit.svg?branch=master)](https://travis-ci.org/sk89q/WorldEdit) +* [Continuous integration](http://builds.enginehub.org) [![Build Status](https://travis-ci.org/EngineHub/WorldEdit.svg?branch=master)](https://travis-ci.org/EngineHub/WorldEdit) * [End-user documentation](http://wiki.sk89q.com/wiki/WorldEdit) From f3ec5bbdde5c0f3b31a4704d2deaa91b6c3131ea Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 31 Jan 2019 22:27:41 +1000 Subject: [PATCH 099/182] Added a ##tag parser Pattern. gives a random combination using the blocks from the tag with an equal distribution. --- .../extension/factory/PatternFactory.java | 2 + .../pattern/BlockCategoryPatternParser.java | 63 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java index cab4d8dee..838194538 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.factory.parser.pattern.BlockCategoryPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.ClipboardPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.RandomPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.SingleBlockPatternParser; @@ -44,6 +45,7 @@ public final class PatternFactory extends AbstractFactory { super(worldEdit); register(new ClipboardPatternParser(worldEdit)); + register(new BlockCategoryPatternParser(worldEdit)); register(new SingleBlockPatternParser(worldEdit)); register(new RandomPatternParser(worldEdit)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java new file mode 100644 index 000000000..40b715ffc --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java @@ -0,0 +1,63 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.pattern; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.pattern.RandomPattern; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.world.block.BlockCategory; +import com.sk89q.worldedit.world.block.BlockType; + +import java.util.List; +import java.util.stream.Collectors; + +public class BlockCategoryPatternParser extends InputParser { + + public BlockCategoryPatternParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public List getSuggestions() { + return BlockCategory.REGISTRY.keySet().stream().map(str -> "##" + str).collect(Collectors.toList()); + } + + @Override + public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { + if(!input.startsWith("##")) { + return null; + } + BlockCategory category = BlockCategory.REGISTRY.get(input.substring(2).toLowerCase()); + if (category == null) { + throw new InputParseException("Unknown block tag: " + input.substring(2)); + } + RandomPattern randomPattern = new RandomPattern(); + + for (BlockType blockType : category.getAll()) { + randomPattern.add(new BlockPattern(blockType.getDefaultState()), 1.0 / category.getAll().size()); + } + + return randomPattern; + } +} From dddf2b963a8a959dba11b985648118ecb5f25bfa Mon Sep 17 00:00:00 2001 From: wizjany Date: Sun, 3 Feb 2019 19:27:30 -0500 Subject: [PATCH 100/182] Fix long-range build tool. Blocks were always placed around 0,0,0 since the trace direction was being used as a position. Also the message was backwards. --- .../main/java/com/sk89q/worldedit/command/ToolCommands.java | 4 ++-- .../com/sk89q/worldedit/command/tool/LongRangeBuildTool.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 0391e0bf2..fdf5337aa 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 @@ -205,7 +205,7 @@ public class ToolCommands { if (secondary instanceof BlockPattern) { secondaryName = ((BlockPattern) secondary).getBlock().getBlockType().getName(); } - player.print("Left-click set to " + secondaryName + "; right-click set to " - + primaryName + "."); + player.print("Left-click set to " + primaryName + "; right-click set to " + + secondaryName + "."); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java index f374746ac..155beb4e8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java @@ -61,7 +61,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo if (applied.getBlockType().getMaterial().isAir()) { eS.setBlock(blockPoint, secondary); } else { - eS.setBlock(pos.getDirection().toBlockPoint(), secondary); + eS.setBlock(pos.toVector().subtract(pos.getDirection()).toBlockPoint(), secondary); } return true; } catch (MaxChangedBlocksException e) { @@ -82,7 +82,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo if (applied.getBlockType().getMaterial().isAir()) { eS.setBlock(blockPoint, primary); } else { - eS.setBlock(pos.getDirection().toBlockPoint(), primary); + eS.setBlock(pos.toVector().subtract(pos.getDirection()).toBlockPoint(), primary); } return true; } catch (MaxChangedBlocksException e) { From cdd71178f5b052492851753e4bd9a2ead1d10b8f Mon Sep 17 00:00:00 2001 From: wizjany Date: Mon, 4 Feb 2019 22:34:25 -0500 Subject: [PATCH 101/182] Ensure BlockCategories are initialized. We should probably have a way to initialize all these catalog classes ahead of time. --- .../factory/parser/pattern/BlockCategoryPatternParser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java index 40b715ffc..3b89b3cef 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java @@ -26,6 +26,7 @@ import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockType; @@ -48,7 +49,7 @@ public class BlockCategoryPatternParser extends InputParser { if(!input.startsWith("##")) { return null; } - BlockCategory category = BlockCategory.REGISTRY.get(input.substring(2).toLowerCase()); + BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase()); if (category == null) { throw new InputParseException("Unknown block tag: " + input.substring(2)); } From 6708e8292f83c161fd4d3a8d72db2e98a70433ad Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 9 Feb 2019 20:28:07 -0500 Subject: [PATCH 102/182] Restore generation of hollow shapes. Unfortunately this is a bit slower than before since we can't cache block id & data values. However, applying patterns generally isn't too expensive, and hollow regions were entirely broken before. --- .../regions/shape/ArbitraryShape.java | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) 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 142fbb481..b9eed1bee 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 @@ -34,8 +34,36 @@ public abstract class ArbitraryShape { protected final Region extent; + private int cacheOffsetX; + private int cacheOffsetY; + private int cacheOffsetZ; + private int cacheSizeX; + private int cacheSizeY; + private int cacheSizeZ; + + /** + * Cache entires: + * 0 = unknown + * -1 = outside + * 1 = inside + */ + private final byte[] cache; + public ArbitraryShape(Region extent) { this.extent = extent; + + BlockVector3 min = extent.getMinimumPoint(); + BlockVector3 max = extent.getMaximumPoint(); + + cacheOffsetX = min.getBlockX() - 1; + cacheOffsetY = min.getBlockY() - 1; + cacheOffsetZ = min.getBlockZ() - 1; + + cacheSizeX = max.getX() - cacheOffsetX + 2; + cacheSizeY = max.getY() - cacheOffsetY + 2; + cacheSizeZ = max.getZ() - cacheOffsetZ + 2; + + cache = new byte[cacheSizeX * cacheSizeY * cacheSizeZ]; } protected Region getExtent() { @@ -81,6 +109,40 @@ public abstract class ArbitraryShape { BaseBlock material = getMaterial(x, y, z, pattern.apply(position)); if (material == null) { + final int index = (y - cacheOffsetY) + (z - cacheOffsetZ) * cacheSizeY + (x - cacheOffsetX) * cacheSizeY * cacheSizeZ; + cache[index] = -1; + continue; + } + + boolean draw = false; + do { + if (!isInsideCached(x + 1, y, z, pattern)) { + draw = true; + break; + } + if (!isInsideCached(x - 1, y, z, pattern)) { + draw = true; + break; + } + if (!isInsideCached(x, y, z + 1, pattern)) { + draw = true; + break; + } + if (!isInsideCached(x, y, z - 1, pattern)) { + draw = true; + break; + } + if (!isInsideCached(x, y + 1, z, pattern)) { + draw = true; + break; + } + if (!isInsideCached(x, y - 1, z, pattern)) { + draw = true; + break; + } + } while (false); + + if (!draw) { continue; } @@ -92,4 +154,27 @@ public abstract class ArbitraryShape { return affected; } + private boolean isInsideCached(int x, int y, int z, Pattern pattern) { + final int index = (y - cacheOffsetY) + (z - cacheOffsetZ) * cacheSizeY + (x - cacheOffsetX) * cacheSizeY * cacheSizeZ; + + switch (cache[index]) { + case 0: + BaseBlock mat = getMaterial(x, y, z, pattern.apply(BlockVector3.at(x, y, z))); + if (mat == null) { + cache[index] = -1; + return false; + } + cache[index] = 1; + return true; + + case -1: + // outside + return false; + + default: + // inside + return true; + } + } + } From c53a40b5771904579081d1756172eb0135ddde9b Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 11 Feb 2019 20:17:36 +1000 Subject: [PATCH 103/182] Bypass the Spigot API for block setting for speed boosts on non-Paper platforms. --- .../adapter/impl/Spigot_v1_13_R1$1.class | Bin 0 -> 959 bytes .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 22415 -> 26260 bytes .../adapter/impl/Spigot_v1_13_R2$1.class | Bin 0 -> 959 bytes .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 22608 -> 26252 bytes .../adapter/impl/Spigot_v1_13_R2_2$1.class | Bin 0 -> 965 bytes .../adapter/impl/Spigot_v1_13_R2_2.class | Bin 22662 -> 26318 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class create mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class create mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2$1.class diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class new file mode 100644 index 0000000000000000000000000000000000000000..3e9eb5d6c2705eea72afefc0bba87bf6c9b9b94b GIT binary patch literal 959 zcmbVK?QRlL5IvW#1-i9Z(boEf?OH&kE4Eb|jY(5zY~-Wq((zx*zKd}#8ZoAc#^l~}=G@H8oy^RaZ=cQpY+y5qC0t8j2GhOl-`Zk^DNF%O6+%9`TeRTB{#4UNC6?=B{|YC0y=IrcP@RHR^{lJkl&14Wjb) zgi7^hjTYr_Kb4_l=QO=X;{ zf=L|4Je3!dMY23DksYF&rkjDQDE7+4e}R4jBDhMpN;gT_W{8oBe+P6E B+S334 literal 0 HcmV?d00001 diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class index 855eaaa082bd0e81a71a6349f9c1351fe7b6cf5f..a9f6ff71bf7dc74adfa8f3a55f7f31b6e0359414 100644 GIT binary patch literal 26260 zcmcIt34B!5)j#Lnm%QZV0U;1%Krl+gkOTsVpb07v5($QYgvGewkPHw>W@0h{v5U2} zo3)#@RTIcfS9*@6F7cFfif!`sr`pyt&J{ zXJ78SFWmpZ9d{AYEGz8r7-h?)z@cJQ=qN`O74jtI+G?1ihN}_MTx_e61*$}DM@i>s zN0q8EwmPCfjkQ&%P>oaLrSnMXoZzU5YK)_fQe|>E+EK@-Ne=a?a=AO!QIpki4jri~ zY&Au`E2X7M`l{uE@l(|_N7bn5a+x7NXFBS5HOo;asM)rfBi|>=J)XVL&vFkwwmuyjauNSdbQA24Gzr|DkrH%xtwOJMUHAxi{)~j^VHHJ zwM?DisO73vkXzxXm1>o(Ry*iBQ~KKE?koXwwoE$5R_8j@sLqp?H3i&ZtMeUNtirP7 z+5(Og@H**gmt{KS5-H?k)jEgPsr7|wgX)ya1#;OamoB+<%OzT*VydS|U8s7CRG*5= zrQcSYis(GG*;W@7(fMkNqb^n-l9mtK>La%LsI4xM)jnpcOKtUWhc>8Bln|-UI_h%u zxgv_HD{S?7;nNpv^+ktz)RzRMFWc%$nf4XATxF}TI_hfmHHS8-Yvi)kQP+YU=(|pS zo>!>8uC6bl8&$6m`3>p#r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}%nX1c)T%8%GlyxWYJ=cjC`%yI?-tC|5(0?h3~W zfWPio6XOH#mg5r)@d=<1yl{_8Y3R5paXcf;g^c&zqf@e=#|P5=5D1Eoh|TAZrAkt) zD<)qBt(E*)7o?AZ^l^wjk%5hFVr`ItjY0Y}M4t(DlRNz>p>D#d>hmC-2+J99x0~A$-4t6H(`6} zbdJ_#bY^6b{z9mh4B>x(%ik`z{4cgVgoNHfXKS!!8{u|=-^1H+V9N)H#}9!mACaFw zre=6%@+bIy{glS>XE-~2jzj4Qnj7FR=vMxc?%}U+aq~4j$=}e^d=dwVZ|Noe4#0AX zKH~3zD?iXL{3CGXCywBsIR<}zug|}57yPNc7yrh6`FG&TA2`qciLa8=ICh-Dso*bO z%x6&_{|26%=N*dp8O2=YztbI+DwI4+1@gI)kbRHKgEWL5Ls3u_40bfkLTzbT>moC}~igHJSHTwI(l z;Bz4e`LoZ3pcbbw66c#>_yzo>U#{e;vj+K%dko2{MQ6kAq(P-CvK? oSNHVmck~DPUGl5TF^(%5)fvAos;lbe_O4PR)m1gU3F@l<1K$-`ssI20 diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class new file mode 100644 index 0000000000000000000000000000000000000000..9013c9a0b3e3abe766aeccb36ede23be9ad99957 GIT binary patch literal 959 zcmbVK>uwTJ5dKcNEYPjRini7pwrc^EuJocd8k45b*vO^n((zx*zKd}V8Zo9xjmbIRH{Z$3oXO05{r>q3zy>xGSj3Gurg1Y))-5S-E4U*? zTEblkOA?kPXbSEr$S~wJ<5UD@r^5T1>GiZh_vzLf?bP!f%eF+I4Fln5Md90KAUv00 z>UfVK_S|%YD}omcp=|DmA-v;RHp6ULxOR2eYuSFCw;XzzD|;q)j<_$R{`ELx1l;V> zk7G?$G9(Od=$rPgkU=SIoll%3g9!#~TQ@U9p3XXDP@k$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^Keum}C zVF-{un=ac3w$&t!9_<-bR4GeoPkqxuU5?cdxL&$oojo$>5x8KOq*ScXR$C8JJM z+8NVctx=_QIX+CKX)9IQQkGhjLy{Kam_ds8DygpslLgox!7e^0-y`%+p6~}mBDFV& zyd29I$>>BXBx4g9C#g(if@FLmlO$6=yx$^*1m>`SC>F7TRpJb7!6xw&>|l?$ghLp_ zb-aQ}9L6k_7n4P@Jg$))qB}=74Yi@*Ix3eyRlZT|{Mdhiegh)7LAXjcN!g}|k&1r@ Dwwm0N literal 0 HcmV?d00001 diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class index 68d629d18cbdea69d604b75e99c28ec1c9e80fc8..bb965546fd3afbb504dbdff772efb093eac371c9 100644 GIT binary patch literal 26318 zcmcIt3w#vS)j#LnNhX;LuRxFm!6*Sk2m}-n6GS0AjD~;&#Q4G`Ss;?^rpX3GZM9Zy zwLaR~s%UMkT4}Ad6mZ zJ@=e*&->mnk9~gcFNtWHb(X^+<;bPTp~1>^)BrWGkjJY*wi@iHA*xuKhuUgbfhv*P z;qveRM~zS+Ta7GGqil6xp&G5m$isu=VX31ImWPKFsId-}s4}^XbJTcss9ee&H9=K4 zv_VajyGln*Qj;AjRaLf{BHv}wGF6@(CKvQSTum!fN2uvVxEv{$8MZn~nyVdEqh>nl zXf?}L$H@1wa+xicIdZ8jQghWjN6l9Y9Gaw#vsIl#N2uc+b%Lt5)k2462=(JtgIpHb zYO$kER7>R2D1DYXYMDAoCSP8pPF78hIz^o-NS-EWoNlW#9Gb6I$g?x$E-YYH%AjUj zwK!C-BGR&|fLGgUwL^>58kw@SfY%got2{bOrdcbOwn8pf?GCl6XrYR!4!L|mE}e4e zl1p4J-9>7hT3@8jRvU`cIqF=woM)>q7Ez1(lC91!qE+ewM}1jcC@o*H)kU_t*jAUw zY+t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$1 zs;`nVGeGi%Y5Rsk0i})fa{Ma@fmds2XL0to4o$Wzrlu|P4fF2)BytEc1n&3*d+x?BL}SEwQem$+4-m|+-{@uF;G7@ zN_X`5rQ(0`B&7tR{HQgbNFt7>-hd(Aq}KcvPJ4TB{CN}S*|({X_q#^B1fbL&v(~sqYl?4&weFV%1U+LG z^q%2$z!5JEfg#t!9I^QB*noMO5~=HWIA%SxE2J2>rwUnp21X+bHeo?z?D^V~pGfL7 zOd9Q;bVG*2IO&FgQ&QjMyWc{T1$Z+~%+;_S?yChmoX%rXgI`qB0Y{HzE2qOowD(wVPtA zWMFlOz6;a$LS64pUnkV{NcA5=^kbNQl94KRWTT8!h3MxH9S+kkG7xeH3S=M@q9Y+X zifKMZLPws^O-|xYH za{(U*nEbg>%OSUxL%p*cLO7LgX77I)jX#f3 zy$B Date: Mon, 11 Feb 2019 20:30:42 +1000 Subject: [PATCH 104/182] Fixed parsing fuzzy blocks failing. --- .../factory/parser/DefaultBlockParser.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java index 1088c3695..d6c62b4d1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java @@ -148,7 +148,9 @@ public class DefaultBlockParser extends InputParser { } } - private static BlockState applyProperties(BlockState state, String[] stateProperties) throws NoMatchException { + private static Map, Object> parseProperties(BlockType type, String[] stateProperties) throws NoMatchException { + Map, Object> blockStates = new HashMap<>(); + if (stateProperties.length > 0) { // Block data not yet detected // Parse the block data (optional) for (String parseableData : stateProperties) { @@ -159,9 +161,12 @@ public class DefaultBlockParser extends InputParser { } @SuppressWarnings("unchecked") - Property propertyKey = (Property) state.getBlockType().getPropertyMap().get(parts[0]); + Property propertyKey = (Property) type.getPropertyMap().get(parts[0]); if (propertyKey == null) { - throw new NoMatchException("Unknown state " + parts[0] + " for block " + state.getBlockType().getName()); + throw new NoMatchException("Unknown property " + parts[0] + " for block " + type.getName()); + } + if (blockStates.containsKey(propertyKey)) { + throw new NoMatchException("Duplicate property " + parts[0]); } Object value; try { @@ -170,7 +175,7 @@ public class DefaultBlockParser extends InputParser { throw new NoMatchException("Unknown value " + parts[1] + " for state " + parts[0]); } - state = state.with(propertyKey, value); + blockStates.put(propertyKey, value); } catch (NoMatchException e) { throw e; // Pass-through } catch (Exception e) { @@ -180,7 +185,7 @@ public class DefaultBlockParser extends InputParser { } } - return state; + return blockStates; } private BaseBlock parseLogic(String input, ParserContext context) throws InputParseException { @@ -265,9 +270,16 @@ public class DefaultBlockParser extends InputParser { } } + blockStates.putAll(parseProperties(blockType, stateProperties)); + if (!context.isPreferringWildcard()) { // No wildcards allowed => eliminate them. (Start with default state) state = blockType.getDefaultState(); + for (Map.Entry, Object> blockState : blockStates.entrySet()) { + @SuppressWarnings("unchecked") + Property objProp = (Property) blockState.getKey(); + state = state.with(objProp, blockState.getValue()); + } } else { FuzzyBlockState.Builder fuzzyBuilder = FuzzyBlockState.builder(); fuzzyBuilder.type(blockType); @@ -278,8 +290,6 @@ public class DefaultBlockParser extends InputParser { } state = fuzzyBuilder.build(); } - - state = applyProperties(state, stateProperties); } // Check if the item is allowed From 76400e533dc9e073ed68bb3c062434ee880c024a Mon Sep 17 00:00:00 2001 From: Wizjany Date: Mon, 11 Feb 2019 12:50:51 -0500 Subject: [PATCH 105/182] Add missing flags to clipboard brush usage. --- .../src/main/java/com/sk89q/worldedit/command/BrushCommands.java | 1 + 1 file changed, 1 insertion(+) 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 2ce7a07ea..d1547b27e 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 @@ -130,6 +130,7 @@ public class BrushCommands { @Command( aliases = { "clipboard", "copy" }, usage = "", + flags = "ap", desc = "Choose the clipboard brush", help = "Chooses the clipboard brush.\n" + From 19796aa3beae72d3751bd941c671f6345b0e0e18 Mon Sep 17 00:00:00 2001 From: wizjany Date: Mon, 11 Feb 2019 17:40:30 -0500 Subject: [PATCH 106/182] Added offset to ClipboardPattern. Takes input like '//set #clipboard@-1,0,1' which shifts the pattern over. It also now extends RepeatingExtentPattern, which was previously unused. --- .../pattern/ClipboardPatternParser.java | 32 ++++++++++++++--- .../function/pattern/ClipboardPattern.java | 28 ++++++--------- .../pattern/RepeatingExtentPattern.java | 34 +++++++++++++++---- 3 files changed, 65 insertions(+), 29 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java index 9bf102f32..1d88aefa6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java @@ -28,31 +28,53 @@ import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.pattern.ClipboardPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.internal.registry.SimpleInputParser; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.session.ClipboardHolder; import java.util.List; -public class ClipboardPatternParser extends SimpleInputParser { +public class ClipboardPatternParser extends InputParser { public ClipboardPatternParser(WorldEdit worldEdit) { super(worldEdit); } @Override - public List getMatchedAliases() { + public List getSuggestions() { return Lists.newArrayList("#clipboard", "#copy"); } @Override - public Pattern parseFromSimpleInput(String input, ParserContext context) throws InputParseException { + public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { + if (!input.startsWith("#clipboard") && !input.startsWith("#copy")) { + return null; + } LocalSession session = context.requireSession(); + int offsetPart; + BlockVector3 offset = BlockVector3.ZERO; + if ((offsetPart = input.indexOf('@')) >= 0) { + if (input.length() <= offsetPart + 1) { + throw new InputParseException("Clipboard offset coordinates not specified!"); + } + String offsetString = input.substring(offsetPart + 1); + String[] offsetCoords = offsetString.split(","); + if (offsetCoords.length != 3) { + throw new InputParseException("Clipboard offset needs x,y,z coordinates."); + } + offset = BlockVector3.at( + Integer.valueOf(offsetCoords[0]), + Integer.valueOf(offsetCoords[1]), + Integer.valueOf(offsetCoords[2]) + ); + } + if (session != null) { try { ClipboardHolder holder = session.getClipboard(); Clipboard clipboard = holder.getClipboard(); - return new ClipboardPattern(clipboard); + return new ClipboardPattern(clipboard, offset); } catch (EmptyClipboardException e) { throw new InputParseException("To use #clipboard, please first copy something to your clipboard"); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java index f62328d0e..9f226a1ab 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java @@ -19,19 +19,13 @@ package com.sk89q.worldedit.function.pattern; -import static com.google.common.base.Preconditions.checkNotNull; - import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BaseBlock; /** * A pattern that reads from {@link Clipboard}. */ -public class ClipboardPattern extends AbstractPattern { - - private final Clipboard clipboard; - private final BlockVector3 size; +public class ClipboardPattern extends RepeatingExtentPattern { /** * Create a new clipboard pattern. @@ -39,18 +33,16 @@ public class ClipboardPattern extends AbstractPattern { * @param clipboard the clipboard */ public ClipboardPattern(Clipboard clipboard) { - checkNotNull(clipboard); - this.clipboard = clipboard; - this.size = clipboard.getMaximumPoint().subtract(clipboard.getMinimumPoint()).add(1, 1, 1); + this(clipboard, BlockVector3.ZERO); } - @Override - public BaseBlock apply(BlockVector3 position) { - int xp = Math.abs(position.getBlockX()) % size.getBlockX(); - int yp = Math.abs(position.getBlockY()) % size.getBlockY(); - int zp = Math.abs(position.getBlockZ()) % size.getBlockZ(); - - return clipboard.getFullBlock(clipboard.getMinimumPoint().add(xp, yp, zp)); + /** + * Create a new clipboard pattern. + * + * @param clipboard the clipboard + * @param offset the offset + */ + public ClipboardPattern(Clipboard clipboard, BlockVector3 offset) { + super(clipboard, clipboard.getMinimumPoint(), offset); } - } 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 101771ab1..9b16fd439 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 @@ -30,7 +30,9 @@ import com.sk89q.worldedit.world.block.BaseBlock; */ public class RepeatingExtentPattern extends AbstractPattern { + private final BlockVector3 size; private Extent extent; + private BlockVector3 origin; private BlockVector3 offset; /** @@ -39,9 +41,11 @@ public class RepeatingExtentPattern extends AbstractPattern { * @param extent the extent * @param offset the offset */ - public RepeatingExtentPattern(Extent extent, BlockVector3 offset) { + public RepeatingExtentPattern(Extent extent, BlockVector3 origin, BlockVector3 offset) { setExtent(extent); + setOrigin(origin); setOffset(offset); + size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1); } /** @@ -82,14 +86,32 @@ public class RepeatingExtentPattern extends AbstractPattern { this.offset = offset; } + /** + * Get the origin. + * + * @return the origin + */ + public BlockVector3 getOrigin() { + return origin; + } + + /** + * Set the origin. + * + * @param origin the origin + */ + public void setOrigin(BlockVector3 origin) { + checkNotNull(origin); + this.origin = origin; + } + @Override public BaseBlock apply(BlockVector3 position) { BlockVector3 base = position.add(offset); - BlockVector3 size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1); - int x = base.getBlockX() % size.getBlockX(); - int y = base.getBlockY() % size.getBlockY(); - int z = base.getBlockZ() % size.getBlockZ(); - return extent.getFullBlock(BlockVector3.at(x, y, z)); + int x = Math.abs(base.getBlockX()) % size.getBlockX(); + int y = Math.abs(base.getBlockY()) % size.getBlockY(); + int z = Math.abs(base.getBlockZ()) % size.getBlockZ(); + return extent.getFullBlock(BlockVector3.at(x, y, z).add(origin)); } } From 287be0209c0f1ca4c3cd13dff46c58f674283fe7 Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 12 Feb 2019 08:46:31 -0500 Subject: [PATCH 107/182] Slight readability and usability improvements. Also no longer allows trailing strings (e.g. //set #clipboardasdf). --- .../pattern/ClipboardPatternParser.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java index 1d88aefa6..1df80b8d1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java @@ -47,26 +47,22 @@ public class ClipboardPatternParser extends InputParser { @Override public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { - if (!input.startsWith("#clipboard") && !input.startsWith("#copy")) { + String[] offsetParts = input.split("@", 2); + if (!offsetParts[0].equalsIgnoreCase("#clipboard") && !offsetParts[0].equalsIgnoreCase("#copy")) { return null; } LocalSession session = context.requireSession(); - int offsetPart; BlockVector3 offset = BlockVector3.ZERO; - if ((offsetPart = input.indexOf('@')) >= 0) { - if (input.length() <= offsetPart + 1) { - throw new InputParseException("Clipboard offset coordinates not specified!"); - } - String offsetString = input.substring(offsetPart + 1); - String[] offsetCoords = offsetString.split(","); - if (offsetCoords.length != 3) { + if (offsetParts.length == 2) { + String[] offsetSplit = offsetParts[1].split(","); + if (offsetSplit.length != 3) { throw new InputParseException("Clipboard offset needs x,y,z coordinates."); } offset = BlockVector3.at( - Integer.valueOf(offsetCoords[0]), - Integer.valueOf(offsetCoords[1]), - Integer.valueOf(offsetCoords[2]) + Integer.valueOf(offsetSplit[0]), + Integer.valueOf(offsetSplit[1]), + Integer.valueOf(offsetSplit[2]) ); } From 1ae0e88b63834fdcdcdb93e74f15e6c9e8604720 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 13 Feb 2019 21:06:15 +1000 Subject: [PATCH 108/182] Remove synthetic classes from adapters. --- .../adapter/impl/Spigot_v1_13_R1$1.class | Bin 959 -> 0 bytes .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 26260 -> 26194 bytes .../adapter/impl/Spigot_v1_13_R2$1.class | Bin 959 -> 0 bytes .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 26252 -> 26186 bytes .../adapter/impl/Spigot_v1_13_R2_2$1.class | Bin 965 -> 0 bytes .../adapter/impl/Spigot_v1_13_R2_2.class | Bin 26318 -> 26250 bytes 6 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class delete mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class delete mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2$1.class diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class deleted file mode 100644 index 3e9eb5d6c2705eea72afefc0bba87bf6c9b9b94b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 959 zcmbVK?QRlL5IvW#1-i9Z(boEf?OH&kE4Eb|jY(5zY~-Wq((zx*zKd}#8ZoAc#^l~}=G@H8oy^RaZ=cQpY+y5qC0t8j2GhOl-`Zk^DNF%O6+%9`TeRTB{#4UNC6?=B{|YC0y=IrcP@RHR^{lJkl&14Wjb) zgi7^hjTYr_Kb4_l=QO=X;{ zf=L|4Je3!dMY23DksYF&rkjDQDE7+4e}R4jBDhMpN;gT_W{8oBe+P6E B+S334 diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class index a9f6ff71bf7dc74adfa8f3a55f7f31b6e0359414..dc8eb4bb1e3393f66e956978b8d688d6d4bd92a3 100644 GIT binary patch delta 8413 zcmZu$30zdw_dn;JH*<$K4`dN_6c7bP1`x#^TtJOX!QGJ56qVe_m9%}@_vKfwjmq}2 z#frqjal4rK4a-_4j zG&~_!^)Xdnl_yO<`P$!91JpoM4N`-(8Y0hpX$qtnD$Ovz8m>l|s!$b~kfBCuHOhos zHQH3CsA8>7H6c&J?5V~`6FN<+v8EcQN~9^3LE}v|K~0Q;LN&>+CaWo?nyRLWcc+`G zOikCS+~mG9q;G~uGsVs(QU#(Va{OVkFo;2rcb%7r$ z)P-7IyT&pW&^((cyN~^0)SfZ|p4*{r~Om(yRj~`a3TeP}W zGG}Xbn+dDb?c(DdTHPu0?vkcPtGi8gkGj`{^VC{t?laZ>oFDFcK)%k2QV*(!{P2ic zBT+vr9goPqJSxp&(yWu_acQ0~L%hvTMyaRNdRgk}ctG`>sWzxO$?Qh0o;TrU73EWo zJj2oi1(@{`TZ3P1Qfsto)anJTUi8DA>LqC!O!cyAGNDFo)@q9kd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XyyNEIjeFQT zR?gRiy==CO-sf8h@#Y`kzGf5Vas`Vlv8@TA!sfTg&LOBhy&KPqmVIzNJ5&vw_%i`F zba#)Jrdxets{x741}OQ7NH(+YnG+wZ<7U`Yz}oX1sGq<`?th=Q*{!E-37@t+OAz9f zd~bHZlNsmhif zIxDypw!7>d!rtz{n<02hChv5)yM(*bfwx2Oj&R4i+;@dL)`9mzuv@r$T<%`s?s4G# z5PTrqeJ*#uaQ8XzVF*4FZdfH`Wil%)1RqxyWCj@#Ho&LRpK)40uZIJL(GB%*kYn;i z2)>m0hg>a(Mav-vz6!zD!ad@0zY*>c2fhu#cfvhd2~qWMtT3w%zDEeb55oMh68!b> z6RZ50Yw2{;{o>+Jf;1hSZaU73LKFS)iQF#iQS%;cJr_sw?eHV~n44xGC;AhHVh^7r zTe2Ms; zc?KUje*6J{!2*dyUQELGvxvaGT7%#g=4BzqxnUzZqN{7+=-6 zJ6p=Ap%P;1VY5_Rg99fV_)iENMk=oe5qFd@gmpw)CyIemvuXhoI3^F3Sue8n2$VEBxx#)Gc2hh0++iSEM= zMmX3mgps2D8&_~d1m8Fqd+g-)eNuV`va`HIw}_ayHp?bsXI zd;fvtrVG#s$m4dzxR|)OxR@BXOSumJkuHT4*1_C48c(T6Q+{cZ@?#BsSf`viX66=* zuj8+--_;QqbRaf z5&ss}tY{twi?ss(5SY|*`Dl;H9QaK44#k7^*rh2Caw!X8*M@)DI_&B;XIqy0HHl|H zmiyHS`QN7=S)jbwoj<#B5W9&u(#QXOUV;yK`Cq(rkiHxiFba*i#<>tsH?WwGYIP&8 cy-D4yZgEG?sAtu4?x;a+Q4P(bw^YOb0o4%w(f|Me diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class deleted file mode 100644 index 9013c9a0b3e3abe766aeccb36ede23be9ad99957..0000000000000000000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impl/Spigot_v1_13_R2_2$1.class deleted file mode 100644 index bc7274567d2c0f3e07c1344aaccce3bcc8d6d9f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 965 zcmbVK?M@R>5IwhF+m=NtA|QTMSZS-4wFQg>V?v-rVm}C5=nsC>+ucoj>2|knx8;%i zttQ48!vpvVzKd~gHP%EDjmf>|%(V9-(H-u#^{QtK&Cb5C9joN~p0DDubSp?GN?4b$fjq-D^*|r@ zK>yVPy*2E1MWAzw_XFG4MX&GZf0U>d7}NvTwf$X(4+i#tAvGzX);gmOGHm^Keum}C zVF-{un=ac3w$&t!9_<-bR4GeoPkqxuU5?cdxL&$oojo$>5x8KOq*ScXR$C8JJM z+8NVctx=_QIX+CKX)9IQQkGhjLy{Kam_ds8DygpslLgox!7e^0-y`%+p6~}mBDFV& zyd29I$>>BXBx4g9C#g(if@FLmlO$6=yx$^*1m>`SC>F7TRpJb7!6xw&>|l?$ghLp_ zb-aQ}9L6k_7n4P@Jg$))qB}=74Yi@*Ix3eyRlZT|{Mdhiegh)7LAXjcN!g}|k&1r@ Dwwm0N diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class index bb965546fd3afbb504dbdff772efb093eac371c9..45b39070aa8051498e8971632bddda8323cebe23 100644 GIT binary patch delta 8415 zcmZu$2Ygh;^PkyycYAsFQb;nvK zKeOQt0O(}QG_kp|q=_~mPQ{oiR>ehOrfQ^Byr~jYV^Jq+mE=?BiP%Is1Ey-KnrYSC zr;@cwiBc_8OX*CN&Q_*Mlg@OXYHdQIY9mcsQ)Q@3X|hZe45@4ru2nfKs&=NzRp*<~ zQnlBrgFM@arla(Al7=T-pgKpXE-KH@O;>61wJH#GH&b<2JxtY8_0psVWE0Jt8&TQgIYag!XovsxcG=xkIJ;iq zRL^jJxNnVoof@T{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$O6gfyEt);?|J=H|xc2 zeDB0TOcQamhyP){93OP^KZWTi{V>#T%rO=ibHT4}VKJZJ>Q Date: Tue, 12 Feb 2019 16:39:09 -0500 Subject: [PATCH 109/182] Added a few new things using block states. * `//set ##*tag` sets all states in the tag (not just default state per type) * `//set ^type` is a pattern changing block type but copying all valid existing states * `//set ^[prop=val,...]` sets the property `prop` to `val` wherever the existing block has that property * `//set ^type[prop=val,...]` does both of the above Those work anywhere a pattern is taken, of course. * The mask syntax `^[prop=val]` matches blocks with the property `prop` set to `val`, or blocks that don't have the property at all. * The mask syntax `^=[prop=val]` only matches blocks that have the property. Those work anywhere a mask is taken, of course. (`//mask`, `//gmask`, `//replace`, etc) The `//drain` command now takes `-w` flag that removes the waterlogged state from blocks (in addition to removing water, as before). --- .../java/com/sk89q/worldedit/EditSession.java | 35 ++++++- .../com/sk89q/worldedit/blocks/Blocks.java | 28 ++++++ .../worldedit/command/UtilityCommands.java | 6 +- .../extension/factory/MaskFactory.java | 2 + .../extension/factory/PatternFactory.java | 13 ++- .../parser/mask/BlockStateMaskParser.java | 60 ++++++++++++ .../pattern/BlockCategoryPatternParser.java | 29 +++++- .../parser/pattern/RandomPatternParser.java | 21 ++-- .../TypeOrStateApplyingPatternParser.java | 79 +++++++++++++++ .../worldedit/extent/buffer/ExtentBuffer.java | 97 +++++++++++++++++++ .../function/mask/BlockStateMask.java | 70 +++++++++++++ .../pattern/AbstractExtentPattern.java | 39 ++++++++ .../ExtentBufferedCompositePattern.java | 66 +++++++++++++ .../function/pattern/ExtentPattern.java | 32 ++++++ .../pattern/RepeatingExtentPattern.java | 26 +---- .../pattern/StateApplyingPattern.java | 54 +++++++++++ .../function/pattern/TypeApplyingPattern.java | 52 ++++++++++ .../function/pattern/WaterloggedRemover.java | 47 +++++++++ .../world/block/BlockCategories.java | 4 +- 19 files changed, 711 insertions(+), 49 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/TypeOrStateApplyingPatternParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ExtentBuffer.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/AbstractExtentPattern.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ExtentBufferedCompositePattern.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ExtentPattern.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/StateApplyingPattern.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/TypeApplyingPattern.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java 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 f490af6c2..f44a217ac 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -53,6 +53,7 @@ import com.sk89q.worldedit.function.block.Naturalizer; import com.sk89q.worldedit.function.generator.GardenPatchGenerator; import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.mask.BlockTypeMask; +import com.sk89q.worldedit.function.mask.BlockStateMask; import com.sk89q.worldedit.function.mask.BoundedHeightMask; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; @@ -68,6 +69,7 @@ import com.sk89q.worldedit.function.operation.OperationQueue; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.pattern.WaterloggedRemover; import com.sk89q.worldedit.function.util.RegionOffset; import com.sk89q.worldedit.function.visitor.DownwardVisitor; import com.sk89q.worldedit.function.visitor.LayerVisitor; @@ -115,7 +117,9 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; +import javax.annotation.Nullable; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; @@ -125,8 +129,6 @@ import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import javax.annotation.Nullable; - /** * An {@link Extent} that handles history, {@link BlockBag}s, change limits, * block re-ordering, and much more. Most operations in WorldEdit use this class. @@ -1283,15 +1285,38 @@ public class EditSession implements Extent, AutoCloseable { * @throws MaxChangedBlocksException thrown if too many blocks are changed */ public int drainArea(BlockVector3 origin, double radius) throws MaxChangedBlocksException { + return drainArea(origin, radius, false); + } + + /** + * Drain nearby pools of water or lava, optionally removed waterlogged states from blocks. + * + * @param origin the origin to drain from, which will search a 3x3 area + * @param radius the radius of the removal, where a value should be 0 or greater + * @param waterlogged true to make waterlogged blocks non-waterlogged as well + * @return number of blocks affected + * @throws MaxChangedBlocksException thrown if too many blocks are changed + */ + public int drainArea(BlockVector3 origin, double radius, boolean waterlogged) throws MaxChangedBlocksException { checkNotNull(origin); checkArgument(radius >= 0, "radius >= 0 required"); MaskIntersection mask = new MaskIntersection( new BoundedHeightMask(0, getWorld().getMaxY()), new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), - getWorld().createLiquidMask()); + waterlogged ? new MaskUnion( + getWorld().createLiquidMask(), + new BlockStateMask(this, new HashMap() {{ + put("waterlogged", "true"); + }}, true)) + : getWorld().createLiquidMask()); - BlockReplace replace = new BlockReplace(this, new BlockPattern(BlockTypes.AIR.getDefaultState())); + BlockReplace replace; + if (waterlogged) { + replace = new BlockReplace(this, new WaterloggedRemover(this)); + } else { + replace = new BlockReplace(this, new BlockPattern(BlockTypes.AIR.getDefaultState())); + } RecursiveVisitor visitor = new RecursiveVisitor(mask, replace); // Around the origin in a 3x3 block @@ -2197,7 +2222,7 @@ public class EditSession implements Extent, AutoCloseable { try { if (expression.evaluate(scaled.getX(), scaled.getZ()) <= 0) { - return null; // TODO should return OUTSIDE? seems to cause issues otherwise, workedaround for now + return null; } // TODO: Allow biome setting via a script variable (needs BiomeType<->int mapping) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java index 2e8366c24..1f65c6a19 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java @@ -19,9 +19,13 @@ package com.sk89q.worldedit.blocks; +import com.google.common.collect.Maps; +import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; import java.util.Collection; +import java.util.Map; /** * Block-related utility methods. @@ -48,4 +52,28 @@ public final class Blocks { return false; } + /** + * Parses a string->string map to find the matching Property and values for the given BlockType. + * + * @param states the desired states and values + * @param type the block type to get properties and values for + * @return a property->value map + */ + public static Map, Object> resolveProperties(Map states, BlockType type) { + Map> existing = type.getPropertyMap(); + Map, Object> newMap = Maps.newHashMap(); + states.forEach((key, value) -> { + @SuppressWarnings("unchecked") + Property prop = (Property) existing.get(key); + if (prop == null) return; + Object val = null; + try { + val = prop.getValueFor(value); + } catch (IllegalArgumentException ignored) { + } + if (val == null) return; + newMap.put(prop, val); + }); + return newMap; + } } 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 86867a786..3a4425f88 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 @@ -142,7 +142,10 @@ public class UtilityCommands { @Command( aliases = { "/drain" }, usage = "", + flags = "w", desc = "Drain a pool", + help = "Removes all connected water sources.\n" + + " If -w is specified, also makes waterlogged blocks non-waterlogged.", min = 1, max = 1 ) @@ -151,9 +154,10 @@ public class UtilityCommands { public void drain(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { double radius = Math.max(0, args.getDouble(0)); + boolean waterlogged = args.hasFlag('w'); we.checkMaxRadius(radius); int affected = editSession.drainArea( - session.getPlacementPosition(player), radius); + session.getPlacementPosition(player), radius, waterlogged); player.print(affected + " block(s) have been changed."); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java index b19cd6766..29bb9eb25 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.factory.parser.mask.BiomeMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.BlockCategoryMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.BlockStateMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.BlocksMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.ExpressionMaskParser; @@ -67,6 +68,7 @@ public final class MaskFactory extends AbstractFactory { register(new OffsetMaskParser(worldEdit)); register(new BiomeMaskParser(worldEdit)); register(new NoiseMaskParser(worldEdit)); + register(new BlockStateMaskParser(worldEdit)); register(new NegateMaskParser(worldEdit)); register(new ExpressionMaskParser(worldEdit)); register(new BlocksMaskParser(worldEdit)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java index 838194538..8c23c4ef8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.extension.factory.parser.pattern.BlockCategoryPattern import com.sk89q.worldedit.extension.factory.parser.pattern.ClipboardPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.RandomPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.SingleBlockPatternParser; +import com.sk89q.worldedit.extension.factory.parser.pattern.TypeOrStateApplyingPatternParser; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.registry.AbstractFactory; @@ -44,10 +45,16 @@ public final class PatternFactory extends AbstractFactory { public PatternFactory(WorldEdit worldEdit) { super(worldEdit); - register(new ClipboardPatternParser(worldEdit)); - register(new BlockCategoryPatternParser(worldEdit)); - register(new SingleBlockPatternParser(worldEdit)); + // split and parse each sub-pattern register(new RandomPatternParser(worldEdit)); + + // individual patterns + register(new BlockCategoryPatternParser(worldEdit)); + register(new ClipboardPatternParser(worldEdit)); + register(new TypeOrStateApplyingPatternParser(worldEdit)); + + // inner-most pattern: just one block + register(new SingleBlockPatternParser(worldEdit)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java new file mode 100644 index 000000000..f76346f27 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java @@ -0,0 +1,60 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.mask; + +import com.google.common.base.Splitter; +import com.google.common.collect.Maps; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.BlockStateMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.NoiseFilter; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.math.noise.RandomNoise; +import com.sk89q.worldedit.session.request.Request; + +import java.util.Arrays; +import java.util.stream.Collectors; + +public class BlockStateMaskParser extends InputParser { + + public BlockStateMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public Mask parseFromInput(String input, ParserContext context) throws InputParseException { + if (!(input.startsWith("^[") || input.startsWith("^=[")) || !input.endsWith("]")) { + return null; + } + Extent extent = Request.request().getEditSession(); + boolean strict = input.charAt(1) == '='; + String states = input.substring(2 + (strict ? 1 : 0), input.length() - 1); + try { + return new BlockStateMask(extent, + Splitter.on(',').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(states), + strict); + } catch (Exception e) { + throw new InputParseException("Invalid states.", e); + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java index 3b89b3cef..5b08053b0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java @@ -28,9 +28,11 @@ import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockCategory; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; public class BlockCategoryPatternParser extends InputParser { @@ -46,17 +48,34 @@ public class BlockCategoryPatternParser extends InputParser { @Override public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { - if(!input.startsWith("##")) { + if (!input.startsWith("##")) { return null; } - BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase()); + String tag = input.substring(2).toLowerCase(); + boolean anyState = false; + if (tag.startsWith("*")) { + tag = tag.substring(1); + anyState = true; + } + + BlockCategory category = BlockCategories.get(tag); if (category == null) { - throw new InputParseException("Unknown block tag: " + input.substring(2)); + throw new InputParseException("Unknown block tag: " + tag); } RandomPattern randomPattern = new RandomPattern(); - for (BlockType blockType : category.getAll()) { - randomPattern.add(new BlockPattern(blockType.getDefaultState()), 1.0 / category.getAll().size()); + Set blocks = category.getAll(); + if (blocks.isEmpty()) { + throw new InputParseException("Block tag " + category.getId() + " had no blocks!"); + } + + if (anyState) { + blocks.stream().flatMap(blockType -> blockType.getAllStates().stream()).forEach(state -> + randomPattern.add(new BlockPattern(state), 1.0)); + } else { + for (BlockType blockType : blocks) { + randomPattern.add(new BlockPattern(blockType.getDefaultState()), 1.0); + } } return randomPattern; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java index 400e6efd7..68c768954 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java @@ -21,14 +21,13 @@ package com.sk89q.worldedit.extension.factory.parser.pattern; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.factory.BlockFactory; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.world.block.BaseBlock; + +import java.util.List; public class RandomPatternParser extends InputParser { @@ -38,14 +37,16 @@ public class RandomPatternParser extends InputParser { @Override public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { - BlockFactory blockRegistry = worldEdit.getBlockFactory(); RandomPattern randomPattern = new RandomPattern(); String[] splits = input.split(","); - for (String token : StringUtil.parseListInQuotes(splits, ',', '[', ']')) { - BaseBlock block; - + List patterns = StringUtil.parseListInQuotes(splits, ',', '[', ']'); + if (patterns.size() == 1) { + return null; // let a 'single'-pattern parser handle it + } + for (String token : patterns) { double chance; + Pattern innerPattern; // Parse special percentage syntax if (token.matches("[0-9]+(\\.[0-9]*)?%.*")) { @@ -55,14 +56,14 @@ public class RandomPatternParser extends InputParser { throw new InputParseException("Missing the type after the % symbol for '" + input + "'"); } else { chance = Double.parseDouble(p[0]); - block = blockRegistry.parseFromInput(p[1], context); + innerPattern = worldEdit.getPatternFactory().parseFromInput(p[1], context); } } else { chance = 1; - block = blockRegistry.parseFromInput(token, context); + innerPattern = worldEdit.getPatternFactory().parseFromInput(token, context); } - randomPattern.add(new BlockPattern(block), chance); + randomPattern.add(innerPattern, chance); } return randomPattern; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/TypeOrStateApplyingPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/TypeOrStateApplyingPatternParser.java new file mode 100644 index 000000000..db0ee8c38 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/TypeOrStateApplyingPatternParser.java @@ -0,0 +1,79 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.pattern; + +import com.google.common.base.Splitter; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.extent.buffer.ExtentBuffer; +import com.sk89q.worldedit.function.pattern.ExtentBufferedCompositePattern; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.pattern.StateApplyingPattern; +import com.sk89q.worldedit.function.pattern.TypeApplyingPattern; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.world.block.BlockState; + +import java.util.Map; +import java.util.Set; + + +public class TypeOrStateApplyingPatternParser extends InputParser { + + public TypeOrStateApplyingPatternParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { + if (!input.startsWith("^")) { + return null; + } + Extent extent = context.requireExtent(); + input = input.substring(1); + + String[] parts = input.split("\\[", 2); + String type = parts[0]; + + if (parts.length == 1) { + return new TypeApplyingPattern(extent, + worldEdit.getBlockFactory().parseFromInput(type, context).getBlockType().getDefaultState()); + } else { + // states given + if (!parts[1].endsWith("]")) throw new InputParseException("Invalid state format."); + Map statesToSet = Splitter.on(',') + .omitEmptyStrings().trimResults().withKeyValueSeparator('=') + .split(parts[1].substring(0, parts[1].length() - 1)); + if (type.isEmpty()) { + return new StateApplyingPattern(extent, statesToSet); + } else { + Extent buffer = new ExtentBuffer(extent); + Pattern typeApplier = new TypeApplyingPattern(buffer, + worldEdit.getBlockFactory().parseFromInput(type, context).getBlockType().getDefaultState()); + Pattern stateApplier = new StateApplyingPattern(buffer, statesToSet); + return new ExtentBufferedCompositePattern(buffer, typeApplier, stateApplier); + } + } + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ExtentBuffer.java new file mode 100644 index 000000000..562f094e5 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ExtentBuffer.java @@ -0,0 +1,97 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent.buffer; + +import com.google.common.collect.Maps; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.extent.AbstractDelegateExtent; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.Masks; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; + +import java.util.Map; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * Buffers changes to an {@link Extent} and allows retrieval of the changed blocks, + * without modifying the underlying extent. + */ +public class ExtentBuffer extends AbstractDelegateExtent { + + private final Map buffer = Maps.newHashMap(); + private final Mask mask; + + /** + * Create a new extent buffer that will buffer every change. + * + * @param delegate the delegate extent for {@link Extent#getBlock(BlockVector3)}, etc. calls + */ + public ExtentBuffer(Extent delegate) { + this(delegate, Masks.alwaysTrue()); + } + + /** + * Create a new extent buffer that will buffer changes that meet the criteria + * of the given mask. + * + * @param delegate the delegate extent for {@link Extent#getBlock(BlockVector3)}, etc. calls + * @param mask the mask + */ + public ExtentBuffer(Extent delegate, Mask mask) { + super(delegate); + checkNotNull(delegate); + checkNotNull(mask); + this.mask = mask; + } + + @Override + public BlockState getBlock(BlockVector3 position) { + if (mask.test(position)) { + return getOrDefault(position).toImmutableState(); + } + return super.getBlock(position); + } + + @Override + public BaseBlock getFullBlock(BlockVector3 position) { + if (mask.test(position)) { + return getOrDefault(position); + } + return super.getFullBlock(position); + } + + private BaseBlock getOrDefault(BlockVector3 position) { + return buffer.computeIfAbsent(position, (pos -> getExtent().getFullBlock(pos))); + } + + @Override + public > boolean setBlock(BlockVector3 location, T block) throws WorldEditException { + if (mask.test(location)) { + buffer.put(location, block.toBaseBlock()); + return true; + } + return false; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java new file mode 100644 index 000000000..69e47039d --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java @@ -0,0 +1,70 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.mask; + +import com.google.common.collect.Maps; +import com.sk89q.worldedit.blocks.Blocks; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; + +import javax.annotation.Nullable; +import java.util.Map; + +public class BlockStateMask extends AbstractExtentMask { + + private final Map states; + private final boolean strict; + private Map, Object>> cache = Maps.newHashMap(); + + /** + * Creates a mask that checks if a given block has the desired properties set to the desired value. + * + * @param extent the extent to get blocks from + * @param states the desired states (property -> value) that a block should have to match the mask + * @param strict true to only match blocks that have all properties and values, false to also match blocks that + * do not have the properties (but only fail blocks with the properties but wrong values) + */ + public BlockStateMask(Extent extent, Map states, boolean strict) { + super(extent); + this.states = states; + this.strict = strict; + } + + @Override + public boolean test(BlockVector3 vector) { + BlockState block = getExtent().getBlock(vector); + final Map, Object> checkProps = cache + .computeIfAbsent(block.getBlockType(), (b -> Blocks.resolveProperties(states, b))); + if (strict && checkProps.isEmpty()) { + return false; + } + return checkProps.entrySet().stream() + .allMatch(entry -> block.getState(entry.getKey()) == entry.getValue()); + } + + @Nullable + @Override + public Mask2D toMask2D() { + return null; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/AbstractExtentPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/AbstractExtentPattern.java new file mode 100644 index 000000000..de18b4802 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/AbstractExtentPattern.java @@ -0,0 +1,39 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.pattern; + +import com.sk89q.worldedit.extent.Extent; + +import static com.google.common.base.Preconditions.checkNotNull; + +public abstract class AbstractExtentPattern extends AbstractPattern implements ExtentPattern { + + private final Extent extent; + + public AbstractExtentPattern(Extent extent) { + this.extent = extent; + checkNotNull(extent); + } + + @Override + public Extent getExtent() { + return extent; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ExtentBufferedCompositePattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ExtentBufferedCompositePattern.java new file mode 100644 index 000000000..b95351e3f --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ExtentBufferedCompositePattern.java @@ -0,0 +1,66 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.pattern; + +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.extent.buffer.ExtentBuffer; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BaseBlock; + +import static com.google.common.base.Preconditions.checkArgument; + +/** + * A pattern that composes multiple patterns consecutively, ensuring that changes from one + * pattern are realized by the subsequent one(s). For best results, use an {@link ExtentBuffer} + * to avoid changing blocks in an underlying extent (e.g. the world). + */ +public class ExtentBufferedCompositePattern extends AbstractExtentPattern { + + private final Pattern[] patterns; + + /** + * Construct a new instance of this pattern. + * + *

    Note that all patterns passed which are ExtentPatterns should use the same extent as the one + * passed to this constructor, or block changes may not be realized by those patterns.

    + * + * @param extent the extent to buffer changes to + * @param patterns the patterns to apply, in order + */ + public ExtentBufferedCompositePattern(Extent extent, Pattern... patterns) { + super(extent); + checkArgument(patterns.length != 0, "patterns cannot be empty"); + this.patterns = patterns; + } + + @Override + public BaseBlock apply(BlockVector3 position) { + BaseBlock lastBlock = null; + for (Pattern pattern : patterns) { + lastBlock = pattern.apply(position); + try { + getExtent().setBlock(position, lastBlock); + } catch (WorldEditException ignored) { // buffer doesn't throw + } + } + return lastBlock; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ExtentPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ExtentPattern.java new file mode 100644 index 000000000..c0dec41ee --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ExtentPattern.java @@ -0,0 +1,32 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.pattern; + +import com.sk89q.worldedit.extent.Extent; + +public interface ExtentPattern extends Pattern { + + /** + * Get the extent associated with this pattern. + * + * @return the extent for this pattern + */ + public Extent getExtent(); +} 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 9b16fd439..53e53648b 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 @@ -28,10 +28,9 @@ import com.sk89q.worldedit.world.block.BaseBlock; /** * Returns the blocks from {@link Extent}, repeating when out of bounds. */ -public class RepeatingExtentPattern extends AbstractPattern { +public class RepeatingExtentPattern extends AbstractExtentPattern { private final BlockVector3 size; - private Extent extent; private BlockVector3 origin; private BlockVector3 offset; @@ -42,31 +41,12 @@ public class RepeatingExtentPattern extends AbstractPattern { * @param offset the offset */ public RepeatingExtentPattern(Extent extent, BlockVector3 origin, BlockVector3 offset) { - setExtent(extent); + super(extent); setOrigin(origin); setOffset(offset); size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1); } - /** - * Get the extent. - * - * @return the extent - */ - public Extent getExtent() { - return extent; - } - - /** - * Set the extent. - * - * @param extent the extent - */ - public void setExtent(Extent extent) { - checkNotNull(extent); - this.extent = extent; - } - /** * Get the offset. * @@ -111,7 +91,7 @@ public class RepeatingExtentPattern extends AbstractPattern { int x = Math.abs(base.getBlockX()) % size.getBlockX(); int y = Math.abs(base.getBlockY()) % size.getBlockY(); int z = Math.abs(base.getBlockZ()) % size.getBlockZ(); - return extent.getFullBlock(BlockVector3.at(x, y, z).add(origin)); + return getExtent().getFullBlock(BlockVector3.at(x, y, z).add(origin)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/StateApplyingPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/StateApplyingPattern.java new file mode 100644 index 000000000..1ed40bffb --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/StateApplyingPattern.java @@ -0,0 +1,54 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.pattern; + +import com.google.common.collect.Maps; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; + +import java.util.Map; +import java.util.Map.Entry; + +import static com.sk89q.worldedit.blocks.Blocks.resolveProperties; + +public class StateApplyingPattern extends AbstractExtentPattern { + + private final Map states; + private Map, Object>> cache = Maps.newHashMap(); + + public StateApplyingPattern(Extent extent, Map statesToSet) { + super(extent); + this.states = statesToSet; + } + + @Override + public BaseBlock apply(BlockVector3 position) { + BlockState block = getExtent().getBlock(position); + for (Entry, Object> entry : cache + .computeIfAbsent(block.getBlockType(), (b -> resolveProperties(states, b))).entrySet()) { + block = block.with(entry.getKey(), entry.getValue()); + } + return block.toBaseBlock(); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/TypeApplyingPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/TypeApplyingPattern.java new file mode 100644 index 000000000..dc9951805 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/TypeApplyingPattern.java @@ -0,0 +1,52 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.pattern; + +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; + +import java.util.Map.Entry; + +/** + * Applies a block type while retaining all possible states. + */ +public class TypeApplyingPattern extends AbstractExtentPattern { + private final BlockState blockState; + + public TypeApplyingPattern(Extent extent, BlockState blockState) { + super(extent); + this.blockState = blockState; + } + + @Override + public BaseBlock apply(BlockVector3 position) { + BlockState oldBlock = getExtent().getBlock(position); + BlockState newBlock = blockState; + for (Entry, Object> entry : oldBlock.getStates().entrySet()) { + @SuppressWarnings("unchecked") + Property prop = (Property) entry.getKey(); + newBlock = newBlock.with(prop, entry.getValue()); + } + return newBlock.toBaseBlock(); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java new file mode 100644 index 000000000..51f8c0f67 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java @@ -0,0 +1,47 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.pattern; + +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockTypes; + +/** + * Removes the waterlogged state from blocks if possible. If not possible, returns air. + */ +public class WaterloggedRemover extends AbstractExtentPattern { + + public WaterloggedRemover(Extent extent) { + super(extent); + } + + @Override + public BaseBlock apply(BlockVector3 position) { + BaseBlock block = getExtent().getFullBlock(position); + @SuppressWarnings("unchecked") + Property prop = (Property) block.getBlockType().getPropertyMap().getOrDefault("waterlogged", null); + if (prop != null) { + return block.with(prop, false); + } + return BlockTypes.AIR.getDefaultState().toBaseBlock(); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java index d60c96985..b9e08aab8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java @@ -32,8 +32,8 @@ public final class BlockCategories { public static final BlockCategory BIRCH_LOGS = register("minecraft:birch_logs"); public static final BlockCategory BUTTONS = register("minecraft:buttons"); public static final BlockCategory CARPETS = register("minecraft:carpets"); - public static final BlockCategory CORAL = register("minecraft:coral"); - public static final BlockCategory CORAL_PLANTS = register("minecraft:coral_plants"); + public static final BlockCategory CORALS = register("minecraft:corals"); + public static final BlockCategory CORAL_BLOCKS = register("minecraft:coral_blocks"); public static final BlockCategory DARK_OAK_LOGS = register("minecraft:dark_oak_logs"); public static final BlockCategory DOORS = register("minecraft:doors"); public static final BlockCategory ENDERMAN_HOLDABLE = register("minecraft:enderman_holdable"); From 313cd20b14da0ae1abcabe15dfd6fde00acb2b46 Mon Sep 17 00:00:00 2001 From: wizjany Date: Thu, 14 Feb 2019 17:53:30 -0500 Subject: [PATCH 110/182] Make legacy compat layer return straight stairs. --- .../worldedit/world/registry/legacy.json | 208 +++++++++--------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json index de49e6443..4bc2907a2 100644 --- a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json @@ -435,14 +435,14 @@ "66:7": "minecraft:rail[shape=south_west]", "66:8": "minecraft:rail[shape=north_west]", "66:9": "minecraft:rail[shape=north_east]", - "67:0": "minecraft:cobblestone_stairs[half=bottom,shape=outer_right,facing=east]", - "67:1": "minecraft:cobblestone_stairs[half=bottom,shape=outer_right,facing=west]", - "67:2": "minecraft:cobblestone_stairs[half=bottom,shape=outer_right,facing=south]", - "67:3": "minecraft:cobblestone_stairs[half=bottom,shape=outer_right,facing=north]", - "67:4": "minecraft:cobblestone_stairs[half=top,shape=outer_right,facing=east]", - "67:5": "minecraft:cobblestone_stairs[half=top,shape=outer_right,facing=west]", - "67:6": "minecraft:cobblestone_stairs[half=top,shape=outer_right,facing=south]", - "67:7": "minecraft:cobblestone_stairs[half=top,shape=outer_right,facing=north]", + "67:0": "minecraft:cobblestone_stairs[half=bottom,shape=straight,facing=east]", + "67:1": "minecraft:cobblestone_stairs[half=bottom,shape=straight,facing=west]", + "67:2": "minecraft:cobblestone_stairs[half=bottom,shape=straight,facing=south]", + "67:3": "minecraft:cobblestone_stairs[half=bottom,shape=straight,facing=north]", + "67:4": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=east]", + "67:5": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=west]", + "67:6": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=south]", + "67:7": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=north]", "68:2": "minecraft:wall_sign[facing=north]", "68:3": "minecraft:wall_sign[facing=south]", "68:4": "minecraft:wall_sign[facing=west]", @@ -720,34 +720,34 @@ "107:13": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=west,open=true]", "107:14": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=north,open=true]", "107:15": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=east,open=true]", - "108:0": "minecraft:brick_stairs[half=bottom,shape=outer_right,facing=east]", - "108:1": "minecraft:brick_stairs[half=bottom,shape=outer_right,facing=west]", - "108:2": "minecraft:brick_stairs[half=bottom,shape=outer_right,facing=south]", - "108:3": "minecraft:brick_stairs[half=bottom,shape=outer_right,facing=north]", - "108:4": "minecraft:brick_stairs[half=top,shape=outer_right,facing=east]", - "108:5": "minecraft:brick_stairs[half=top,shape=outer_right,facing=west]", - "108:6": "minecraft:brick_stairs[half=top,shape=outer_right,facing=south]", - "108:7": "minecraft:brick_stairs[half=top,shape=outer_right,facing=north]", - "109:0": "minecraft:stone_brick_stairs[half=bottom,shape=outer_right,facing=east]", - "109:1": "minecraft:stone_brick_stairs[half=bottom,shape=outer_right,facing=west]", - "109:2": "minecraft:stone_brick_stairs[half=bottom,shape=outer_right,facing=south]", - "109:3": "minecraft:stone_brick_stairs[half=bottom,shape=outer_right,facing=north]", - "109:4": "minecraft:stone_brick_stairs[half=top,shape=outer_right,facing=east]", - "109:5": "minecraft:stone_brick_stairs[half=top,shape=outer_right,facing=west]", - "109:6": "minecraft:stone_brick_stairs[half=top,shape=outer_right,facing=south]", - "109:7": "minecraft:stone_brick_stairs[half=top,shape=outer_right,facing=north]", + "108:0": "minecraft:brick_stairs[half=bottom,shape=straight,facing=east]", + "108:1": "minecraft:brick_stairs[half=bottom,shape=straight,facing=west]", + "108:2": "minecraft:brick_stairs[half=bottom,shape=straight,facing=south]", + "108:3": "minecraft:brick_stairs[half=bottom,shape=straight,facing=north]", + "108:4": "minecraft:brick_stairs[half=top,shape=straight,facing=east]", + "108:5": "minecraft:brick_stairs[half=top,shape=straight,facing=west]", + "108:6": "minecraft:brick_stairs[half=top,shape=straight,facing=south]", + "108:7": "minecraft:brick_stairs[half=top,shape=straight,facing=north]", + "109:0": "minecraft:stone_brick_stairs[half=bottom,shape=straight,facing=east]", + "109:1": "minecraft:stone_brick_stairs[half=bottom,shape=straight,facing=west]", + "109:2": "minecraft:stone_brick_stairs[half=bottom,shape=straight,facing=south]", + "109:3": "minecraft:stone_brick_stairs[half=bottom,shape=straight,facing=north]", + "109:4": "minecraft:stone_brick_stairs[half=top,shape=straight,facing=east]", + "109:5": "minecraft:stone_brick_stairs[half=top,shape=straight,facing=west]", + "109:6": "minecraft:stone_brick_stairs[half=top,shape=straight,facing=south]", + "109:7": "minecraft:stone_brick_stairs[half=top,shape=straight,facing=north]", "110:0": "minecraft:mycelium[snowy=false]", "111:0": "minecraft:lily_pad", "112:0": "minecraft:nether_bricks", "113:0": "minecraft:nether_brick_fence[east=false,south=false,north=false,west=false]", - "114:0": "minecraft:nether_brick_stairs[half=bottom,shape=outer_right,facing=east]", - "114:1": "minecraft:nether_brick_stairs[half=bottom,shape=outer_right,facing=west]", - "114:2": "minecraft:nether_brick_stairs[half=bottom,shape=outer_right,facing=south]", - "114:3": "minecraft:nether_brick_stairs[half=bottom,shape=outer_right,facing=north]", - "114:4": "minecraft:nether_brick_stairs[half=top,shape=outer_right,facing=east]", - "114:5": "minecraft:nether_brick_stairs[half=top,shape=outer_right,facing=west]", - "114:6": "minecraft:nether_brick_stairs[half=top,shape=outer_right,facing=south]", - "114:7": "minecraft:nether_brick_stairs[half=top,shape=outer_right,facing=north]", + "114:0": "minecraft:nether_brick_stairs[half=bottom,shape=straight,facing=east]", + "114:1": "minecraft:nether_brick_stairs[half=bottom,shape=straight,facing=west]", + "114:2": "minecraft:nether_brick_stairs[half=bottom,shape=straight,facing=south]", + "114:3": "minecraft:nether_brick_stairs[half=bottom,shape=straight,facing=north]", + "114:4": "minecraft:nether_brick_stairs[half=top,shape=straight,facing=east]", + "114:5": "minecraft:nether_brick_stairs[half=top,shape=straight,facing=west]", + "114:6": "minecraft:nether_brick_stairs[half=top,shape=straight,facing=south]", + "114:7": "minecraft:nether_brick_stairs[half=top,shape=straight,facing=north]", "115:0": "minecraft:nether_wart[age=0]", "115:1": "minecraft:nether_wart[age=1]", "115:2": "minecraft:nether_wart[age=2]", @@ -808,14 +808,14 @@ "127:9": "minecraft:cocoa[facing=west,age=2]", "127:10": "minecraft:cocoa[facing=north,age=2]", "127:11": "minecraft:cocoa[facing=east,age=2]", - "128:0": "minecraft:sandstone_stairs[half=bottom,shape=outer_right,facing=east]", - "128:1": "minecraft:sandstone_stairs[half=bottom,shape=outer_right,facing=west]", - "128:2": "minecraft:sandstone_stairs[half=bottom,shape=outer_right,facing=south]", - "128:3": "minecraft:sandstone_stairs[half=bottom,shape=outer_right,facing=north]", - "128:4": "minecraft:sandstone_stairs[half=top,shape=outer_right,facing=east]", - "128:5": "minecraft:sandstone_stairs[half=top,shape=outer_right,facing=west]", - "128:6": "minecraft:sandstone_stairs[half=top,shape=outer_right,facing=south]", - "128:7": "minecraft:sandstone_stairs[half=top,shape=outer_right,facing=north]", + "128:0": "minecraft:sandstone_stairs[half=bottom,shape=straight,facing=east]", + "128:1": "minecraft:sandstone_stairs[half=bottom,shape=straight,facing=west]", + "128:2": "minecraft:sandstone_stairs[half=bottom,shape=straight,facing=south]", + "128:3": "minecraft:sandstone_stairs[half=bottom,shape=straight,facing=north]", + "128:4": "minecraft:sandstone_stairs[half=top,shape=straight,facing=east]", + "128:5": "minecraft:sandstone_stairs[half=top,shape=straight,facing=west]", + "128:6": "minecraft:sandstone_stairs[half=top,shape=straight,facing=south]", + "128:7": "minecraft:sandstone_stairs[half=top,shape=straight,facing=north]", "129:0": "minecraft:emerald_ore", "130:2": "minecraft:ender_chest[facing=north]", "130:3": "minecraft:ender_chest[facing=south]", @@ -846,30 +846,30 @@ "132:12": "minecraft:tripwire[disarmed=true,east=false,powered=false,south=false,north=false,west=false,attached=true]", "132:13": "minecraft:tripwire[disarmed=true,east=false,powered=true,south=false,north=false,west=false,attached=true]", "133:0": "minecraft:emerald_block", - "134:0": "minecraft:spruce_stairs[half=bottom,shape=outer_right,facing=east]", - "134:1": "minecraft:spruce_stairs[half=bottom,shape=outer_right,facing=west]", - "134:2": "minecraft:spruce_stairs[half=bottom,shape=outer_right,facing=south]", - "134:3": "minecraft:spruce_stairs[half=bottom,shape=outer_right,facing=north]", - "134:4": "minecraft:spruce_stairs[half=top,shape=outer_right,facing=east]", - "134:5": "minecraft:spruce_stairs[half=top,shape=outer_right,facing=west]", - "134:6": "minecraft:spruce_stairs[half=top,shape=outer_right,facing=south]", - "134:7": "minecraft:spruce_stairs[half=top,shape=outer_right,facing=north]", - "135:0": "minecraft:birch_stairs[half=bottom,shape=outer_right,facing=east]", - "135:1": "minecraft:birch_stairs[half=bottom,shape=outer_right,facing=west]", - "135:2": "minecraft:birch_stairs[half=bottom,shape=outer_right,facing=south]", - "135:3": "minecraft:birch_stairs[half=bottom,shape=outer_right,facing=north]", - "135:4": "minecraft:birch_stairs[half=top,shape=outer_right,facing=east]", - "135:5": "minecraft:birch_stairs[half=top,shape=outer_right,facing=west]", - "135:6": "minecraft:birch_stairs[half=top,shape=outer_right,facing=south]", - "135:7": "minecraft:birch_stairs[half=top,shape=outer_right,facing=north]", - "136:0": "minecraft:jungle_stairs[half=bottom,shape=outer_right,facing=east]", - "136:1": "minecraft:jungle_stairs[half=bottom,shape=outer_right,facing=west]", - "136:2": "minecraft:jungle_stairs[half=bottom,shape=outer_right,facing=south]", - "136:3": "minecraft:jungle_stairs[half=bottom,shape=outer_right,facing=north]", - "136:4": "minecraft:jungle_stairs[half=top,shape=outer_right,facing=east]", - "136:5": "minecraft:jungle_stairs[half=top,shape=outer_right,facing=west]", - "136:6": "minecraft:jungle_stairs[half=top,shape=outer_right,facing=south]", - "136:7": "minecraft:jungle_stairs[half=top,shape=outer_right,facing=north]", + "134:0": "minecraft:spruce_stairs[half=bottom,shape=straight,facing=east]", + "134:1": "minecraft:spruce_stairs[half=bottom,shape=straight,facing=west]", + "134:2": "minecraft:spruce_stairs[half=bottom,shape=straight,facing=south]", + "134:3": "minecraft:spruce_stairs[half=bottom,shape=straight,facing=north]", + "134:4": "minecraft:spruce_stairs[half=top,shape=straight,facing=east]", + "134:5": "minecraft:spruce_stairs[half=top,shape=straight,facing=west]", + "134:6": "minecraft:spruce_stairs[half=top,shape=straight,facing=south]", + "134:7": "minecraft:spruce_stairs[half=top,shape=straight,facing=north]", + "135:0": "minecraft:birch_stairs[half=bottom,shape=straight,facing=east]", + "135:1": "minecraft:birch_stairs[half=bottom,shape=straight,facing=west]", + "135:2": "minecraft:birch_stairs[half=bottom,shape=straight,facing=south]", + "135:3": "minecraft:birch_stairs[half=bottom,shape=straight,facing=north]", + "135:4": "minecraft:birch_stairs[half=top,shape=straight,facing=east]", + "135:5": "minecraft:birch_stairs[half=top,shape=straight,facing=west]", + "135:6": "minecraft:birch_stairs[half=top,shape=straight,facing=south]", + "135:7": "minecraft:birch_stairs[half=top,shape=straight,facing=north]", + "136:0": "minecraft:jungle_stairs[half=bottom,shape=straight,facing=east]", + "136:1": "minecraft:jungle_stairs[half=bottom,shape=straight,facing=west]", + "136:2": "minecraft:jungle_stairs[half=bottom,shape=straight,facing=south]", + "136:3": "minecraft:jungle_stairs[half=bottom,shape=straight,facing=north]", + "136:4": "minecraft:jungle_stairs[half=top,shape=straight,facing=east]", + "136:5": "minecraft:jungle_stairs[half=top,shape=straight,facing=west]", + "136:6": "minecraft:jungle_stairs[half=top,shape=straight,facing=south]", + "136:7": "minecraft:jungle_stairs[half=top,shape=straight,facing=north]", "137:0": "minecraft:command_block[conditional=false,facing=down]", "137:1": "minecraft:command_block[conditional=false,facing=up]", "137:2": "minecraft:command_block[conditional=false,facing=north]", @@ -1056,14 +1056,14 @@ "155:4": "minecraft:quartz_pillar[axis=z]", "155:6": "minecraft:quartz_pillar[axis=x]", "155:10": "minecraft:quartz_pillar[axis=z]", - "156:0": "minecraft:quartz_stairs[half=bottom,shape=outer_right,facing=east]", - "156:1": "minecraft:quartz_stairs[half=bottom,shape=outer_right,facing=west]", - "156:2": "minecraft:quartz_stairs[half=bottom,shape=outer_right,facing=south]", - "156:3": "minecraft:quartz_stairs[half=bottom,shape=outer_right,facing=north]", - "156:4": "minecraft:quartz_stairs[half=top,shape=outer_right,facing=east]", - "156:5": "minecraft:quartz_stairs[half=top,shape=outer_right,facing=west]", - "156:6": "minecraft:quartz_stairs[half=top,shape=outer_right,facing=south]", - "156:7": "minecraft:quartz_stairs[half=top,shape=outer_right,facing=north]", + "156:0": "minecraft:quartz_stairs[half=bottom,shape=straight,facing=east]", + "156:1": "minecraft:quartz_stairs[half=bottom,shape=straight,facing=west]", + "156:2": "minecraft:quartz_stairs[half=bottom,shape=straight,facing=south]", + "156:3": "minecraft:quartz_stairs[half=bottom,shape=straight,facing=north]", + "156:4": "minecraft:quartz_stairs[half=top,shape=straight,facing=east]", + "156:5": "minecraft:quartz_stairs[half=top,shape=straight,facing=west]", + "156:6": "minecraft:quartz_stairs[half=top,shape=straight,facing=south]", + "156:7": "minecraft:quartz_stairs[half=top,shape=straight,facing=north]", "157:0": "minecraft:activator_rail[shape=north_south,powered=false]", "157:1": "minecraft:activator_rail[shape=east_west,powered=false]", "157:2": "minecraft:activator_rail[shape=ascending_east,powered=false]", @@ -1136,22 +1136,22 @@ "162:9": "minecraft:dark_oak_log[axis=z]", "162:12": "minecraft:acacia_wood", "162:13": "minecraft:dark_oak_wood", - "163:0": "minecraft:acacia_stairs[half=bottom,shape=outer_right,facing=east]", - "163:1": "minecraft:acacia_stairs[half=bottom,shape=outer_right,facing=west]", - "163:2": "minecraft:acacia_stairs[half=bottom,shape=outer_right,facing=south]", - "163:3": "minecraft:acacia_stairs[half=bottom,shape=outer_right,facing=north]", - "163:4": "minecraft:acacia_stairs[half=top,shape=outer_right,facing=east]", - "163:5": "minecraft:acacia_stairs[half=top,shape=outer_right,facing=west]", - "163:6": "minecraft:acacia_stairs[half=top,shape=outer_right,facing=south]", - "163:7": "minecraft:acacia_stairs[half=top,shape=outer_right,facing=north]", - "164:0": "minecraft:dark_oak_stairs[half=bottom,shape=outer_right,facing=east]", - "164:1": "minecraft:dark_oak_stairs[half=bottom,shape=outer_right,facing=west]", - "164:2": "minecraft:dark_oak_stairs[half=bottom,shape=outer_right,facing=south]", - "164:3": "minecraft:dark_oak_stairs[half=bottom,shape=outer_right,facing=north]", - "164:4": "minecraft:dark_oak_stairs[half=top,shape=outer_right,facing=east]", - "164:5": "minecraft:dark_oak_stairs[half=top,shape=outer_right,facing=west]", - "164:6": "minecraft:dark_oak_stairs[half=top,shape=outer_right,facing=south]", - "164:7": "minecraft:dark_oak_stairs[half=top,shape=outer_right,facing=north]", + "163:0": "minecraft:acacia_stairs[half=bottom,shape=straight,facing=east]", + "163:1": "minecraft:acacia_stairs[half=bottom,shape=straight,facing=west]", + "163:2": "minecraft:acacia_stairs[half=bottom,shape=straight,facing=south]", + "163:3": "minecraft:acacia_stairs[half=bottom,shape=straight,facing=north]", + "163:4": "minecraft:acacia_stairs[half=top,shape=straight,facing=east]", + "163:5": "minecraft:acacia_stairs[half=top,shape=straight,facing=west]", + "163:6": "minecraft:acacia_stairs[half=top,shape=straight,facing=south]", + "163:7": "minecraft:acacia_stairs[half=top,shape=straight,facing=north]", + "164:0": "minecraft:dark_oak_stairs[half=bottom,shape=straight,facing=east]", + "164:1": "minecraft:dark_oak_stairs[half=bottom,shape=straight,facing=west]", + "164:2": "minecraft:dark_oak_stairs[half=bottom,shape=straight,facing=south]", + "164:3": "minecraft:dark_oak_stairs[half=bottom,shape=straight,facing=north]", + "164:4": "minecraft:dark_oak_stairs[half=top,shape=straight,facing=east]", + "164:5": "minecraft:dark_oak_stairs[half=top,shape=straight,facing=west]", + "164:6": "minecraft:dark_oak_stairs[half=top,shape=straight,facing=south]", + "164:7": "minecraft:dark_oak_stairs[half=top,shape=straight,facing=north]", "165:0": "minecraft:slime_block", "166:0": "minecraft:barrier", "167:0": "minecraft:iron_trapdoor[half=bottom,facing=north,open=false]", @@ -1247,14 +1247,14 @@ "179:0": "minecraft:red_sandstone", "179:1": "minecraft:chiseled_red_sandstone", "179:2": "minecraft:cut_red_sandstone", - "180:0": "minecraft:red_sandstone_stairs[half=bottom,shape=outer_right,facing=east]", - "180:1": "minecraft:red_sandstone_stairs[half=bottom,shape=outer_right,facing=west]", - "180:2": "minecraft:red_sandstone_stairs[half=bottom,shape=outer_right,facing=south]", - "180:3": "minecraft:red_sandstone_stairs[half=bottom,shape=outer_right,facing=north]", - "180:4": "minecraft:red_sandstone_stairs[half=top,shape=outer_right,facing=east]", - "180:5": "minecraft:red_sandstone_stairs[half=top,shape=outer_right,facing=west]", - "180:6": "minecraft:red_sandstone_stairs[half=top,shape=outer_right,facing=south]", - "180:7": "minecraft:red_sandstone_stairs[half=top,shape=outer_right,facing=north]", + "180:0": "minecraft:red_sandstone_stairs[half=bottom,shape=straight,facing=east]", + "180:1": "minecraft:red_sandstone_stairs[half=bottom,shape=straight,facing=west]", + "180:2": "minecraft:red_sandstone_stairs[half=bottom,shape=straight,facing=south]", + "180:3": "minecraft:red_sandstone_stairs[half=bottom,shape=straight,facing=north]", + "180:4": "minecraft:red_sandstone_stairs[half=top,shape=straight,facing=east]", + "180:5": "minecraft:red_sandstone_stairs[half=top,shape=straight,facing=west]", + "180:6": "minecraft:red_sandstone_stairs[half=top,shape=straight,facing=south]", + "180:7": "minecraft:red_sandstone_stairs[half=top,shape=straight,facing=north]", "181:0": "minecraft:red_sandstone_slab[type=double]", "181:8": "minecraft:smooth_red_sandstone", "182:0": "minecraft:red_sandstone_slab[type=bottom]", @@ -1421,14 +1421,14 @@ "202:0": "minecraft:purpur_pillar[axis=y]", "202:4": "minecraft:purpur_pillar[axis=x]", "202:8": "minecraft:purpur_pillar[axis=z]", - "203:0": "minecraft:purpur_stairs[half=bottom,shape=outer_right,facing=east]", - "203:1": "minecraft:purpur_stairs[half=bottom,shape=outer_right,facing=west]", - "203:2": "minecraft:purpur_stairs[half=bottom,shape=outer_right,facing=south]", - "203:3": "minecraft:purpur_stairs[half=bottom,shape=outer_right,facing=north]", - "203:4": "minecraft:purpur_stairs[half=top,shape=outer_right,facing=east]", - "203:5": "minecraft:purpur_stairs[half=top,shape=outer_right,facing=west]", - "203:6": "minecraft:purpur_stairs[half=top,shape=outer_right,facing=south]", - "203:7": "minecraft:purpur_stairs[half=top,shape=outer_right,facing=north]", + "203:0": "minecraft:purpur_stairs[half=bottom,shape=straight,facing=east]", + "203:1": "minecraft:purpur_stairs[half=bottom,shape=straight,facing=west]", + "203:2": "minecraft:purpur_stairs[half=bottom,shape=straight,facing=south]", + "203:3": "minecraft:purpur_stairs[half=bottom,shape=straight,facing=north]", + "203:4": "minecraft:purpur_stairs[half=top,shape=straight,facing=east]", + "203:5": "minecraft:purpur_stairs[half=top,shape=straight,facing=west]", + "203:6": "minecraft:purpur_stairs[half=top,shape=straight,facing=south]", + "203:7": "minecraft:purpur_stairs[half=top,shape=straight,facing=north]", "204:0": "minecraft:purpur_slab[type=double]", "205:0": "minecraft:purpur_slab[type=bottom]", "205:8": "minecraft:purpur_slab[type=top]", From 39131eb1e5367e2b827ccef868b28ba810d2958a Mon Sep 17 00:00:00 2001 From: wizjany Date: Thu, 14 Feb 2019 17:56:48 -0500 Subject: [PATCH 111/182] Revert "Remove synthetic classes from adapters." This reverts commit 1ae0e88b --- .../adapter/impl/Spigot_v1_13_R1$1.class | Bin 0 -> 959 bytes .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 26194 -> 26260 bytes .../adapter/impl/Spigot_v1_13_R2$1.class | Bin 0 -> 959 bytes .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 26186 -> 26252 bytes .../adapter/impl/Spigot_v1_13_R2_2$1.class | Bin 0 -> 965 bytes .../adapter/impl/Spigot_v1_13_R2_2.class | Bin 26250 -> 26318 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class create mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class create mode 100644 worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2$1.class diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class new file mode 100644 index 0000000000000000000000000000000000000000..3e9eb5d6c2705eea72afefc0bba87bf6c9b9b94b GIT binary patch literal 959 zcmbVK?QRlL5IvW#1-i9Z(boEf?OH&kE4Eb|jY(5zY~-Wq((zx*zKd}#8ZoAc#^l~}=G@H8oy^RaZ=cQpY+y5qC0t8j2GhOl-`Zk^DNF%O6+%9`TeRTB{#4UNC6?=B{|YC0y=IrcP@RHR^{lJkl&14Wjb) zgi7^hjTYr_Kb4_l=QO=X;{ zf=L|4Je3!dMY23DksYF&rkjDQDE7+4e}R4jBDhMpN;gT_W{8oBe+P6E B+S334 literal 0 HcmV?d00001 diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class index dc8eb4bb1e3393f66e956978b8d688d6d4bd92a3..a9f6ff71bf7dc74adfa8f3a55f7f31b6e0359414 100644 GIT binary patch delta 8351 zcmZu$30zdw_dn;JH*<$K4+IosL>2{Q7sWN)bIDZPQ^^&T3L`Yc%C>3WH+!~_S=vUs zB=!cRM6I;6MJ;XD(z4QaTm6~*&v`8J>;L2Pd1vlB=iYPA`n`9Cy>H{HcQCl~)TYe< z(8nk;F;;0IJ`*BUn5j(V55p8?X%%j&2-Qy5ky=IhRJ07+i?D;KVpObF9epZJt3a6Q zq~b-`S%e9uN>s6?N>a%}x|ph~N-<%XN|jMJQ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7bX@GFg>ylasvxvkAE*wwAx)Ga<*l;??Y@5vfOthN=ity}Ci&=t|G1XH~5$y{cYQueL}#)T{po D(l-ZR diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class new file mode 100644 index 0000000000000000000000000000000000000000..9013c9a0b3e3abe766aeccb36ede23be9ad99957 GIT binary patch literal 959 zcmbVK>uwTJ5dKcNEYPjRini7pwrc^EuJocd8k45b*vO^n((zx*zKd}V8Zo9xjmbIRH{Z$3oXO05{r>q3zy>xGSj3Gurg1Y))-5S-E4U*? zTEblkOA?kPXbSEr$S~wJ<5UD@r^5T1>GiZh_vzLf?bP!f%eF+I4Fln5Md90KAUv00 z>UfVK_S|%YD}omcp=|DmA-v;RHp6ULxOR2eYuSFCw;XzzD|;q)j<_$R{`ELx1l;V> zk7G?$G9(Od=$rPgkU=SIoll%3g9!#~TQ@U9p3XXDP@k$f>xG z2P$T8NyS6tRjfj1Sd<~U!`-%C^^Bp}*%h{9m3-gxRXmbz1qo{s)+KBp&#*-u(8nFn ze|JD{4ZB?t=-lG{!1i^~>pS{i1!@HbbKj620rn@bvoDDcn0hZy=p(}6+FOKQ zjb)T%WFi%k(TR+aR3j4}-Xl z*D#4gn4|KdvPhQ46|$%3rs$@jHWXY%A_RyOV}cYB+hJGit}TLs zSg;@>!979{f`Fi)fDHv3VnIQ{E(qj5vljyXKL7iCcJ}Sed-G=IeP`a=y?6KEz3*Z0 z-E$i^13*Wk#KeFyh4@W~R+gz6sK^LRRZ&_+o2sFT5q7LrjeIIjn(-oRY^o+IpjA_! zYNl252$i4`Mc6`wElrgq!d5<&Y(kt$5z^XJsVYrKx~bX(RfY+RR3LK@@LV5|gR7h{X z>ZAIas-Nm_Lbe*9)j$(E1=S!^4OT<68frqW_@Al@g$&bbxT!{{kwQjEpV6ioqb`%# z$NJSc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|8oIJhxs1%5wU}Oyrz1!ug;*L|tt4u$`4$<8T1F5zbzzHz6jh4{Fa|4d9j(Effw<3eMyaS;U7 i-7M#uTiwHJ?p3zB&!t{djtaZfX0=6aZlXR?oBt0Q;29AB diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2$1.class new file mode 100644 index 0000000000000000000000000000000000000000..bc7274567d2c0f3e07c1344aaccce3bcc8d6d9f6 GIT binary patch literal 965 zcmbVK?M@R>5IwhF+m=NtA|QTMSZS-4wFQg>V?v-rVm}C5=nsC>+ucoj>2|knx8;%i zttQ48!vpvVzKd~gHP%EDjmf>|%(V9-(H-u#^{QtK&Cb5C9joN~p0DDubSp?GN?4b$fjq-D^*|r@ zK>yVPy*2E1MWAzw_XFG4MX&GZf0U>d7}NvTwf$X(4+i#tAvGzX);gmOGHm^Keum}C zVF-{un=ac3w$&t!9_<-bR4GeoPkqxuU5?cdxL&$oojo$>5x8KOq*ScXR$C8JJM z+8NVctx=_QIX+CKX)9IQQkGhjLy{Kam_ds8DygpslLgox!7e^0-y`%+p6~}mBDFV& zyd29I$>>BXBx4g9C#g(if@FLmlO$6=yx$^*1m>`SC>F7TRpJb7!6xw&>|l?$ghLp_ zb-aQ}9L6k_7n4P@Jg$))qB}=74Yi@*Ix3eyRlZT|{Mdhiegh)7LAXjcN!g}|k&1r@ Dwwm0N literal 0 HcmV?d00001 diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2.class index 45b39070aa8051498e8971632bddda8323cebe23..bb965546fd3afbb504dbdff772efb093eac371c9 100644 GIT binary patch delta 8426 zcmZu$2YeLO^PhRMckga*(@Dqy2_*qS3WOd)=)E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Yy_QIcZ7kE#0SMO ze%U2_nZJF@RVjtJyB?=3ea|x@g(>e&u3d$^o|I!pNbvpxEhE>XQ_z9S5t}47Y0@My z(XCSci=C1xg|w60(Ij!4R;1!g`3Xzl#}+!VO*xFrtQt(M!d3`UP3Qcy!tWk(@r}H< znd~7S;cS6_39GY^UuPjsEQDMW4yILN`hN|TpJOPl!4UtxR%d8DCreJeU^TX`zo;Z& z8%}(dd*Nas0oz9QK`wA%%=qsTeXnxYh#YxA_XUa#LePDw;u{M8F_ME*ete9dP5H!~ zsuts;UjEZB{X~a*1&m3?G~;pzsFmE$C%0O~bM98Qy2q7XQ;rI|(suQp+FmDpthWCj Dki! Date: Thu, 14 Feb 2019 18:07:07 -0500 Subject: [PATCH 112/182] Ignore synthetic classes when loading BukkitImplAdapter. --- .../com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java index ab0825e3b..891106eca 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java @@ -89,7 +89,7 @@ public class BukkitImplLoader { try { Enumeration entries = jar.entries(); while (entries.hasMoreElements()) { - JarEntry jarEntry = (JarEntry) entries.nextElement(); + JarEntry jarEntry = entries.nextElement(); String className = jarEntry.getName().replaceAll("[/\\\\]+", "."); @@ -153,6 +153,7 @@ public class BukkitImplLoader { for (String className : adapterCandidates) { try { Class cls = Class.forName(className); + if (cls.isSynthetic()) continue; if (BukkitImplAdapter.class.isAssignableFrom(cls)) { return (BukkitImplAdapter) cls.newInstance(); } else { From de9d20268130bd6ee6b26886dc73952f0e9c5af2 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 15 Feb 2019 14:51:26 -0500 Subject: [PATCH 113/182] Clear shaped brush material on command. The initial material is held in the factory, but if a brush was previously bound, that pattern is used. Now, using `//br set` will clear the previous material, allowing the OperationFactory's material to work. This can be changed later with `/mat`, which will once again set the fill on the tool, overriding the factory's context. --- .../sk89q/worldedit/command/composition/ShapedBrushCommand.java | 1 + 1 file changed, 1 insertion(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java index e2bc2f14f..2fa613db4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java @@ -74,6 +74,7 @@ public class ShapedBrushCommand extends SimpleCommand { WorldEdit.getInstance().checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); + tool.setFill(null); tool.setBrush(new OperationFactoryBrush(factory, regionFactory), permission); } catch (MaxBrushRadiusException | InvalidToolBindException e) { WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter().convert(e); From d6bc85ccbe1cba25a516e2cefdbe7fdd16773683 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 16 Feb 2019 12:46:10 +1000 Subject: [PATCH 114/182] Speed up the BlockState hashCode method by caching (As it's Immutable). Allows some better optimisations in the future by using them as map keys --- .../java/com/sk89q/worldedit/world/block/BlockState.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index a67235d0c..6e4c5e721 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -146,7 +146,7 @@ public class BlockState implements BlockStateHolder { @Override public boolean equalsFuzzy(BlockStateHolder o) { if (this == o) { - // Added a reference equality check for + // Added a reference equality check for speediness return true; } if (!getBlockType().equals(o.getBlockType())) { @@ -223,8 +223,13 @@ public class BlockState implements BlockStateHolder { return equalsFuzzy((BlockState) obj); } + private Integer hashCodeCache = null; + @Override public int hashCode() { - return Objects.hash(blockType, values); + if (hashCodeCache == null) { + hashCodeCache = Objects.hash(blockType, values); + } + return hashCodeCache; } } From 1b101740feadd10f425677b9da02ee511f26d3c4 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 16 Feb 2019 17:27:00 +1000 Subject: [PATCH 115/182] Use a proper registry for biomes --- .../sk89q/worldedit/bukkit/BukkitAdapter.java | 27 +++- .../worldedit/bukkit/BukkitBiomeRegistry.java | 39 +----- .../sk89q/worldedit/bukkit/BukkitWorld.java | 26 +--- .../bukkit/adapter/BukkitImplAdapter.java | 23 +--- .../java/com/sk89q/worldedit/EditSession.java | 15 +-- .../worldedit/command/BiomeCommands.java | 18 +-- .../worldedit/command/GenerationCommands.java | 4 +- .../factory/parser/mask/BiomeMaskParser.java | 10 +- .../extent/AbstractDelegateExtent.java | 6 +- .../worldedit/extent/ChangeSetExtent.java | 8 +- .../sk89q/worldedit/extent/InputExtent.java | 4 +- .../sk89q/worldedit/extent/NullExtent.java | 10 +- .../sk89q/worldedit/extent/OutputExtent.java | 4 +- .../extent/clipboard/BlockArrayClipboard.java | 9 +- .../function/biome/BiomeReplace.java | 6 +- .../worldedit/function/mask/BiomeMask2D.java | 16 +-- .../worldedit/history/change/BiomeChange.java | 12 +- .../internal/command/WorldEditBinding.java | 14 +-- .../regions/shape/ArbitraryBiomeShape.java | 49 +++----- .../com/sk89q/worldedit/world/NullWorld.java | 12 +- .../worldedit/world/biome/BiomeName.java | 4 +- .../biome/{BaseBiome.java => BiomeType.java} | 60 +++------ .../worldedit/world/biome/BiomeTypes.java | 117 ++++++++++++++++++ .../sk89q/worldedit/world/biome/Biomes.java | 8 +- .../world/registry/BiomeRegistry.java | 22 +--- .../world/registry/NullBiomeRegistry.java | 18 +-- .../sk89q/worldedit/forge/ForgeAdapter.java | 12 ++ .../worldedit/forge/ForgeBiomeRegistry.java | 22 +--- .../com/sk89q/worldedit/forge/ForgeWorld.java | 11 +- .../sk89q/worldedit/sponge/SpongeAdapter.java | 10 ++ .../worldedit/sponge/SpongeBiomeRegistry.java | 24 +--- .../sk89q/worldedit/sponge/SpongeWorld.java | 10 +- .../sponge/adapter/SpongeImplAdapter.java | 10 -- 33 files changed, 314 insertions(+), 326 deletions(-) rename worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/{BaseBiome.java => BiomeType.java} (50%) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java 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 44095bea9..e6b290125 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 @@ -33,6 +33,8 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -43,9 +45,9 @@ import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; - import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.block.Biome; import org.bukkit.block.data.BlockData; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -304,6 +306,27 @@ public class BukkitAdapter { return GameModes.get(gameMode.name().toLowerCase()); } + /** + * Create a WorldEdit BiomeType from a Bukkit one. + * + * @param biome Bukkit Biome + * @return WorldEdit BiomeType + */ + public static BiomeType adapt(Biome biome) { + return BiomeTypes.get(biome.name().toLowerCase()); + } + + public static Biome adapt(BiomeType biomeType) { + if (!biomeType.getId().startsWith("minecraft:")) { + throw new IllegalArgumentException("Bukkit only supports vanilla biomes"); + } + try { + return Biome.valueOf(biomeType.getId().substring(10).toUpperCase()); + } catch (IllegalArgumentException e) { + return null; + } + } + /** * Create a WorldEdit EntityType from a Bukkit one. * @@ -318,7 +341,7 @@ public class BukkitAdapter { if (!entityType.getId().startsWith("minecraft:")) { throw new IllegalArgumentException("Bukkit only supports vanilla entities"); } - return org.bukkit.entity.EntityType.fromName(entityType.getId().substring(10).toLowerCase()); + return org.bukkit.entity.EntityType.fromName(entityType.getId().substring(10)); } /** diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java index cb0fea4de..27474678f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java @@ -19,16 +19,11 @@ package com.sk89q.worldedit.bukkit; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.registry.BiomeRegistry; import org.bukkit.block.Biome; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import javax.annotation.Nullable; /** @@ -41,35 +36,9 @@ class BukkitBiomeRegistry implements BiomeRegistry { @Nullable @Override - public BaseBiome createFromId(int id) { - return new BaseBiome(id); - } - - @Override - public List getBiomes() { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - if (adapter != null) { - List biomes = new ArrayList<>(); - for (Biome biome : Biome.values()) { - int biomeId = adapter.getBiomeId(biome); - biomes.add(new BaseBiome(biomeId)); - } - return biomes; - } else { - return Collections.emptyList(); - } - } - - @Nullable - @Override - public BiomeData getData(BaseBiome biome) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - if (adapter != null) { - final Biome bukkitBiome = adapter.getBiome(biome.getId()); - return bukkitBiome::name; - } else { - return null; - } + public BiomeData getData(BiomeType biome) { + final Biome bukkitBiome = BukkitAdapter.adapt(biome); + return bukkitBiome == null ? null : bukkitBiome::name; } } 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 5b7caad66..8490c891e 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 @@ -34,16 +34,14 @@ import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.world.AbstractWorld; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.weather.WeatherType; import com.sk89q.worldedit.world.weather.WeatherTypes; - import org.bukkit.Effect; import org.bukkit.TreeType; import org.bukkit.World; -import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.Chest; @@ -465,25 +463,13 @@ public class BukkitWorld extends AbstractWorld { } @Override - public BaseBiome getBiome(BlockVector2 position) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - if (adapter != null) { - int id = adapter.getBiomeId(getWorld().getBiome(position.getBlockX(), position.getBlockZ())); - return new BaseBiome(id); - } else { - return new BaseBiome(0); - } + public BiomeType getBiome(BlockVector2 position) { + return BukkitAdapter.adapt(getWorld().getBiome(position.getBlockX(), position.getBlockZ())); } @Override - public boolean setBiome(BlockVector2 position, BaseBiome biome) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - if (adapter != null) { - Biome bukkitBiome = adapter.getBiome(biome.getId()); - getWorld().setBiome(position.getBlockX(), position.getBlockZ(), bukkitBiome); - return true; - } else { - return false; - } + public boolean setBiome(BlockVector2 position, BiomeType biome) { + getWorld().setBiome(position.getBlockX(), position.getBlockZ(), BukkitAdapter.adapt(biome)); + return true; } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index 789e60f82..1a4329a4f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -20,15 +20,14 @@ package com.sk89q.worldedit.bukkit.adapter; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import org.bukkit.Location; -import org.bukkit.block.Biome; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -41,26 +40,6 @@ import javax.annotation.Nullable; */ public interface BukkitImplAdapter { - /** - * Get the biome ID for the given biome. - * - *

    Returns 0 if it is not known or it doesn't exist.

    - * - * @param biome biome - * @return the biome ID - */ - int getBiomeId(Biome biome); - - /** - * Get the biome ID for the given biome ID.. - * - *

    Returns {@link Biome#OCEAN} if it is not known or it doesn't exist.

    - * - * @param id the biome ID - * @return the biome - */ - Biome getBiome(int id); - /** * Get the block at the given location. * 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 f44a217ac..c36f2625f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -52,8 +52,8 @@ import com.sk89q.worldedit.function.block.Counter; import com.sk89q.worldedit.function.block.Naturalizer; import com.sk89q.worldedit.function.generator.GardenPatchGenerator; import com.sk89q.worldedit.function.mask.BlockMask; -import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.BlockStateMask; +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; @@ -108,7 +108,7 @@ import com.sk89q.worldedit.util.collection.DoubleArrayList; import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.world.NullWorld; import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; @@ -117,7 +117,6 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -129,6 +128,8 @@ import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; +import javax.annotation.Nullable; + /** * An {@link Extent} that handles history, {@link BlockBag}s, change limits, * block re-ordering, and much more. Most operations in WorldEdit use this class. @@ -562,12 +563,12 @@ public class EditSession implements Extent, AutoCloseable { } @Override - public BaseBiome getBiome(BlockVector2 position) { + public BiomeType getBiome(BlockVector2 position) { return bypassNone.getBiome(position); } @Override - public boolean setBiome(BlockVector2 position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BiomeType biome) { return bypassNone.setBiome(position, biome); } @@ -2202,7 +2203,7 @@ public class EditSession implements Extent, AutoCloseable { } } - public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BaseBiome biomeType, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException { + public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException { final Vector2 zero2D = zero.toVector2(); final Vector2 unit2D = unit.toVector2(); @@ -2215,7 +2216,7 @@ public class EditSession implements Extent, AutoCloseable { final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) { @Override - protected BaseBiome getBiome(int x, int z, BaseBiome defaultBiomeType) { + protected BiomeType getBiome(int x, int z, BiomeType defaultBiomeType) { final Vector2 current = Vector2.at(x, z); environment.setCurrentBlock(current.toVector3(0)); final Vector2 scaled = current.subtract(zero2D).divide(unit2D); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java index 8d94ae739..f3d9e9694 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java @@ -48,12 +48,12 @@ import com.sk89q.worldedit.regions.Regions; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.registry.BiomeRegistry; +import java.util.Collection; import java.util.HashSet; -import java.util.List; import java.util.Set; /** @@ -94,10 +94,10 @@ public class BiomeCommands { BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); - List biomes = biomeRegistry.getBiomes(); + Collection biomes = BiomeType.REGISTRY.values(); int totalPages = biomes.size() / 19 + 1; player.print("Available Biomes (page " + page + "/" + totalPages + ") :"); - for (BaseBiome biome : biomes) { + for (BiomeType biome : biomes) { if (offset > 0) { offset--; } else { @@ -129,7 +129,7 @@ public class BiomeCommands { public void biomeInfo(Player player, LocalSession session, CommandContext args) throws WorldEditException { BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); - Set biomes = new HashSet<>(); + Set biomes = new HashSet<>(); String qualifier; if (args.hasFlag('t')) { @@ -139,12 +139,12 @@ public class BiomeCommands { return; } - BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2()); + BiomeType biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2()); biomes.add(biome); qualifier = "at line of sight point"; } else if (args.hasFlag('p')) { - BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2()); + BiomeType biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2()); biomes.add(biome); qualifier = "at your position"; @@ -166,7 +166,7 @@ public class BiomeCommands { } player.print(biomes.size() != 1 ? "Biomes " + qualifier + ":" : "Biome " + qualifier + ":"); - for (BaseBiome biome : biomes) { + for (BiomeType biome : biomes) { BiomeData data = biomeRegistry.getData(biome); if (data != null) { player.print(" " + data.getName()); @@ -188,7 +188,7 @@ public class BiomeCommands { ) @Logging(REGION) @CommandPermissions("worldedit.biome.set") - public void setBiome(Player player, LocalSession session, EditSession editSession, BaseBiome target, @Switch('p') boolean atPosition) throws WorldEditException { + public void setBiome(Player player, LocalSession session, EditSession editSession, BiomeType target, @Switch('p') boolean atPosition) throws WorldEditException { World world = player.getWorld(); Region region; Mask mask = editSession.getMask(); 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 5e0a6139c..5d48ac3d9 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 @@ -43,7 +43,7 @@ import com.sk89q.worldedit.util.command.binding.Range; import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.binding.Text; import com.sk89q.worldedit.util.command.parametric.Optional; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; /** * Commands for the generation of shapes and other objects. @@ -337,7 +337,7 @@ public class GenerationCommands { @Logging(ALL) public void generateBiome(Player player, LocalSession session, EditSession editSession, @Selection Region region, - BaseBiome target, + BiomeType target, @Text String expression, @Switch('h') boolean hollow, @Switch('r') boolean useRawCoords, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java index e1ceaca52..bc4f81455 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java @@ -28,12 +28,12 @@ import com.sk89q.worldedit.function.mask.BiomeMask2D; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.Biomes; import com.sk89q.worldedit.world.registry.BiomeRegistry; +import java.util.Collection; import java.util.HashSet; -import java.util.List; import java.util.Set; public class BiomeMaskParser extends InputParser { @@ -48,11 +48,11 @@ public class BiomeMaskParser extends InputParser { return null; } - Set biomes = new HashSet<>(); + Set biomes = new HashSet<>(); BiomeRegistry biomeRegistry = worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); - List knownBiomes = biomeRegistry.getBiomes(); + Collection knownBiomes = BiomeType.REGISTRY.values(); for (String biomeName : Splitter.on(",").split(input.substring(1))) { - BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry); + BiomeType biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry); if (biome == null) { throw new InputParseException("Unknown biome '" + biomeName + '\''); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index 1a11899ca..91310b9a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -30,7 +30,7 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -97,12 +97,12 @@ public abstract class AbstractDelegateExtent implements Extent { } @Override - public BaseBiome getBiome(BlockVector2 position) { + public BiomeType getBiome(BlockVector2 position) { return extent.getBiome(position); } @Override - public boolean setBiome(BlockVector2 position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BiomeType biome) { return extent.setBiome(position, biome); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java index 2516b4252..ba6fd0abd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java @@ -33,7 +33,7 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -69,9 +69,9 @@ public class ChangeSetExtent extends AbstractDelegateExtent { } @Override - public boolean setBiome(BlockVector2 position, BaseBiome biome) { - BaseBiome previous = getBiome(position); - changeSet.add(new BiomeChange(position, previous, new BaseBiome(biome))); + public boolean setBiome(BlockVector2 position, BiomeType biome) { + BiomeType previous = getBiome(position); + changeSet.add(new BiomeChange(position, previous, biome)); return super.setBiome(position, biome); } 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 8b0fd2d48..2c2e91467 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 @@ -22,7 +22,7 @@ package com.sk89q.worldedit.extent; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -64,6 +64,6 @@ public interface InputExtent { * @param position the (x, z) location to check the biome at * @return the biome at the location */ - BaseBiome getBiome(BlockVector2 position); + BiomeType getBiome(BlockVector2 position); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java index 056e7fade..52a3d854c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java @@ -27,7 +27,8 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -80,10 +81,9 @@ public class NullExtent implements Extent { return getBlock(position).toBaseBlock(); } - @Nullable @Override - public BaseBiome getBiome(BlockVector2 position) { - return null; + public BiomeType getBiome(BlockVector2 position) { + return BiomeTypes.THE_VOID; } @Override @@ -92,7 +92,7 @@ public class NullExtent implements Extent { } @Override - public boolean setBiome(BlockVector2 position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BiomeType biome) { return false; } 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 63bf8c951..53351e0b0 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 @@ -23,7 +23,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; import javax.annotation.Nullable; @@ -59,7 +59,7 @@ public interface OutputExtent { * @param biome the biome to set to * @return true if the biome was successfully set (return value may not be accurate) */ - boolean setBiome(BlockVector2 position, BaseBiome biome); + boolean setBiome(BlockVector2 position, BiomeType biome); /** * Return an {@link Operation} that should be called to tie up loose ends 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 2ccc168f9..d4ecc26b3 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 @@ -29,7 +29,8 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -160,12 +161,12 @@ public class BlockArrayClipboard implements Clipboard { } @Override - public BaseBiome getBiome(BlockVector2 position) { - return new BaseBiome(0); + public BiomeType getBiome(BlockVector2 position) { + return BiomeTypes.OCEAN; } @Override - public boolean setBiome(BlockVector2 position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BiomeType biome) { return false; } 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 444f0e4e1..efa53f45a 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 @@ -25,7 +25,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.FlatRegionFunction; import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; /** * Replaces the biome at the locations that this function is applied to. @@ -33,7 +33,7 @@ import com.sk89q.worldedit.world.biome.BaseBiome; public class BiomeReplace implements FlatRegionFunction { private final Extent extent; - private BaseBiome biome; + private BiomeType biome; /** * Create a new instance. @@ -41,7 +41,7 @@ public class BiomeReplace implements FlatRegionFunction { * @param extent an extent * @param biome a biome */ - public BiomeReplace(Extent extent, BaseBiome biome) { + public BiomeReplace(Extent extent, BiomeType biome) { checkNotNull(extent); checkNotNull(biome); this.extent = extent; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java index 9b04d871d..633159acb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java @@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import java.util.Arrays; import java.util.Collection; @@ -36,7 +36,7 @@ import java.util.Set; public class BiomeMask2D extends AbstractMask2D { private final Extent extent; - private final Set biomes = new HashSet<>(); + private final Set biomes = new HashSet<>(); /** * Create a new biome mask. @@ -44,7 +44,7 @@ public class BiomeMask2D extends AbstractMask2D { * @param extent the extent * @param biomes a list of biomes to match */ - public BiomeMask2D(Extent extent, Collection biomes) { + public BiomeMask2D(Extent extent, Collection biomes) { checkNotNull(extent); checkNotNull(biomes); this.extent = extent; @@ -57,7 +57,7 @@ public class BiomeMask2D extends AbstractMask2D { * @param extent the extent * @param biome an array of biomes to match */ - public BiomeMask2D(Extent extent, BaseBiome... biome) { + public BiomeMask2D(Extent extent, BiomeType... biome) { this(extent, Arrays.asList(checkNotNull(biome))); } @@ -66,7 +66,7 @@ public class BiomeMask2D extends AbstractMask2D { * * @param biomes a list of biomes */ - public void add(Collection biomes) { + public void add(Collection biomes) { checkNotNull(biomes); this.biomes.addAll(biomes); } @@ -76,7 +76,7 @@ public class BiomeMask2D extends AbstractMask2D { * * @param biome an array of biomes */ - public void add(BaseBiome... biome) { + public void add(BiomeType... biome) { add(Arrays.asList(checkNotNull(biome))); } @@ -85,13 +85,13 @@ public class BiomeMask2D extends AbstractMask2D { * * @return a list of biomes */ - public Collection getBiomes() { + public Collection getBiomes() { return biomes; } @Override public boolean test(BlockVector2 vector) { - BaseBiome biome = extent.getBiome(vector); + BiomeType biome = extent.getBiome(vector); return biomes.contains(biome); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java index 133f38f7f..f8c0ef597 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BiomeChange.java @@ -25,7 +25,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.history.UndoContext; import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; /** * Represents a biome change that may be undone or replayed. @@ -37,8 +37,8 @@ import com.sk89q.worldedit.world.biome.BaseBiome; public class BiomeChange implements Change { private final BlockVector2 position; - private final BaseBiome previous; - private final BaseBiome current; + private final BiomeType previous; + private final BiomeType current; /** * Create a new biome change. @@ -47,7 +47,7 @@ public class BiomeChange implements Change { * @param previous the previous biome * @param current the current biome */ - public BiomeChange(BlockVector2 position, BaseBiome previous, BaseBiome current) { + public BiomeChange(BlockVector2 position, BiomeType previous, BiomeType current) { checkNotNull(position); checkNotNull(previous); checkNotNull(current); @@ -70,7 +70,7 @@ public class BiomeChange implements Change { * * @return the previous biome */ - public BaseBiome getPrevious() { + public BiomeType getPrevious() { return previous; } @@ -79,7 +79,7 @@ public class BiomeChange implements Change { * * @return the current biome */ - public BaseBiome getCurrent() { + public BiomeType getCurrent() { return current; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index 691eb35ba..267dfb7bf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -46,7 +46,7 @@ import com.sk89q.worldedit.util.command.parametric.BindingHelper; import com.sk89q.worldedit.util.command.parametric.BindingMatch; import com.sk89q.worldedit.util.command.parametric.ParameterException; import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.Biomes; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -54,7 +54,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.registry.BiomeRegistry; import java.util.Arrays; -import java.util.List; +import java.util.Collection; /** * Binds standard WorldEdit classes such as {@link Player} and {@link LocalSession}. @@ -298,23 +298,23 @@ public class WorldEditBinding extends BindingHelper { } /** - * Gets an {@link BaseBiome} from a {@link ArgumentStack}. + * Gets an {@link BiomeType} from a {@link ArgumentStack}. * * @param context the context * @return a pattern * @throws ParameterException on error * @throws WorldEditException on error */ - @BindingMatch(type = BaseBiome.class, + @BindingMatch(type = BiomeType.class, behavior = BindingBehavior.CONSUMES, consumedCount = 1) - public BaseBiome getBiomeType(ArgumentStack context) throws ParameterException, WorldEditException { + public BiomeType getBiomeType(ArgumentStack context) throws ParameterException, WorldEditException { String input = context.next(); if (input != null) { BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); - List knownBiomes = biomeRegistry.getBiomes(); - BaseBiome biome = Biomes.findBiomeByName(knownBiomes, input, biomeRegistry); + Collection knownBiomes = BiomeType.REGISTRY.values(); + BiomeType biome = Biomes.findBiomeByName(knownBiomes, input, biomeRegistry); if (biome != null) { return biome; } else { 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 0ebdc7393..de1324852 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 @@ -24,7 +24,8 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.FlatRegion; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; /** * Generates solid and hollow shapes according to materials returned by the @@ -54,10 +55,10 @@ public abstract class ArbitraryBiomeShape { cacheOffsetX = min.getBlockX() - 1; cacheOffsetZ = min.getBlockZ() - 1; - cacheSizeX = (int) (max.getX() - cacheOffsetX + 2); - cacheSizeZ = (int) (max.getZ() - cacheOffsetZ + 2); + cacheSizeX = max.getX() - cacheOffsetX + 2; + cacheSizeZ = max.getZ() - cacheOffsetZ + 2; - cache = new BaseBiome[cacheSizeX * cacheSizeZ]; + cache = new BiomeType[cacheSizeX * cacheSizeZ]; } protected Iterable getExtent() { @@ -71,7 +72,7 @@ public abstract class ArbitraryBiomeShape { * OUTSIDE = outside * else = inside */ - private final BaseBiome[] cache; + private final BiomeType[] cache; /** * Override this function to specify the shape to generate. @@ -81,17 +82,17 @@ public abstract class ArbitraryBiomeShape { * @param defaultBaseBiome The default biome for the current column. * @return material to place or null to not place anything. */ - protected abstract BaseBiome getBiome(int x, int z, BaseBiome defaultBaseBiome); + protected abstract BiomeType getBiome(int x, int z, BiomeType defaultBaseBiome); - private BaseBiome getBiomeCached(int x, int z, BaseBiome baseBiome) { + private BiomeType getBiomeCached(int x, int z, BiomeType baseBiome) { final int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ; - final BaseBiome cacheEntry = cache[index]; + final BiomeType cacheEntry = cache[index]; if (cacheEntry == null) {// unknown, fetch material - final BaseBiome material = getBiome(x, z, baseBiome); + final BiomeType material = getBiome(x, z, baseBiome); if (material == null) { // outside - cache[index] = OUTSIDE; + cache[index] = BiomeTypes.THE_VOID; return null; } @@ -99,7 +100,7 @@ public abstract class ArbitraryBiomeShape { return material; } - if (cacheEntry == OUTSIDE) { + if (cacheEntry == BiomeTypes.THE_VOID) { // outside return null; } @@ -107,16 +108,16 @@ public abstract class ArbitraryBiomeShape { return cacheEntry; } - private boolean isInsideCached(int x, int z, BaseBiome baseBiome) { + private boolean isInsideCached(int x, int z, BiomeType baseBiome) { final int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ; - final BaseBiome cacheEntry = cache[index]; + final BiomeType cacheEntry = cache[index]; if (cacheEntry == null) { // unknown block, meaning they must be outside the extent at this stage, but might still be inside the shape return getBiomeCached(x, z, baseBiome) != null; } - return cacheEntry != OUTSIDE; + return cacheEntry != BiomeTypes.THE_VOID; } /** @@ -127,7 +128,7 @@ public abstract class ArbitraryBiomeShape { * @param hollow Specifies whether to generate a hollow shape. * @return number of affected blocks. */ - public int generate(EditSession editSession, BaseBiome baseBiome, boolean hollow) { + public int generate(EditSession editSession, BiomeType baseBiome, boolean hollow) { int affected = 0; for (BlockVector2 position : getExtent()) { @@ -135,8 +136,8 @@ public abstract class ArbitraryBiomeShape { int z = position.getBlockZ(); if (!hollow) { - final BaseBiome material = getBiome(x, z, baseBiome); - if (material != null && material != OUTSIDE) { + final BiomeType material = getBiome(x, z, baseBiome); + if (material != null && material != BiomeTypes.THE_VOID) { editSession.getWorld().setBiome(position, material); ++affected; } @@ -144,7 +145,7 @@ public abstract class ArbitraryBiomeShape { continue; } - final BaseBiome material = getBiomeCached(x, z, baseBiome); + final BiomeType material = getBiomeCached(x, z, baseBiome); if (material == null) { continue; } @@ -180,16 +181,4 @@ public abstract class ArbitraryBiomeShape { return affected; } - private static final BaseBiome OUTSIDE = new BaseBiome(0) { - @Override - public int hashCode() { - return 0; - } - - @Override - public boolean equals(Object o) { - return this == o; - } - }; - } 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 3a9153bd7..f8a286dfd 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 @@ -31,12 +31,14 @@ import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TreeGenerator.TreeType; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.weather.WeatherType; +import com.sk89q.worldedit.world.weather.WeatherTypes; import java.util.Collections; import java.util.List; @@ -80,12 +82,12 @@ public class NullWorld extends AbstractWorld { } @Override - public BaseBiome getBiome(BlockVector2 position) { - return null; + public BiomeType getBiome(BlockVector2 position) { + return BiomeTypes.THE_VOID; } @Override - public boolean setBiome(BlockVector2 position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BiomeType biome) { return false; } @@ -109,7 +111,7 @@ public class NullWorld extends AbstractWorld { @Override public WeatherType getWeather() { - return null; + return WeatherTypes.CLEAR; } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java index 45018ed41..83c3faa58 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java @@ -29,7 +29,7 @@ import javax.annotation.Nullable; /** * Returns the name of a biome using a given {@code BiomeRegistry}. */ -class BiomeName implements Function { +class BiomeName implements Function { private final BiomeRegistry registry; @@ -45,7 +45,7 @@ class BiomeName implements Function { @Nullable @Override - public String apply(BaseBiome input) { + public String apply(BiomeType input) { BiomeData data = registry.getData(input); if (data != null) { return data.getName(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BaseBiome.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java similarity index 50% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BaseBiome.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java index f60299f66..7dc155253 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BaseBiome.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java @@ -19,64 +19,42 @@ package com.sk89q.worldedit.world.biome; -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.registry.NamespacedRegistry; /** - * Basic storage object to represent a given biome. + * All the types of biomes in the game. */ -public class BaseBiome { +public class BiomeType { - private int id; + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("biome type"); - /** - * Create a new biome with the given biome ID. - * - * @param id the biome ID - */ - public BaseBiome(int id) { + private String id; + + public BiomeType(String id) { this.id = id; } /** - * Create a clone of the given biome. + * Gets the ID of this biome. * - * @param biome the biome to clone + * @return The id */ - public BaseBiome(BaseBiome biome) { - checkNotNull(biome); - this.id = biome.getId(); - } - - /** - * Get the biome ID. - * - * @return the biome ID - */ - public int getId() { - return id; - } - - /** - * Set the biome id. - * - * @param id the biome ID - */ - public void setId(int id) { - this.id = id; + public String getId() { + return this.id; } @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - BaseBiome baseBiome = (BaseBiome) o; - - return id == baseBiome.id; + public String toString() { + return getId(); } @Override public int hashCode() { - return id; + return this.id.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof BiomeType && this.id.equals(((BiomeType) obj).id); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java new file mode 100644 index 000000000..732c4926e --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java @@ -0,0 +1,117 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.biome; + +import javax.annotation.Nullable; + +/** + * Stores a list of common Biome String IDs. + */ +public class BiomeTypes { + + public static final BiomeType BADLANDS = register("minecraft:badlands"); + public static final BiomeType BADLANDS_PLATEAU = register("minecraft:badlands_plateau"); + public static final BiomeType BEACH = register("minecraft:beach"); + public static final BiomeType BIRCH_FOREST = register("minecraft:birch_forest"); + public static final BiomeType BIRCH_FOREST_HILLS = register("minecraft:birch_forest_hills"); + public static final BiomeType COLD_OCEAN = register("minecraft:cold_ocean"); + public static final BiomeType DARK_FOREST = register("minecraft:dark_forest"); + public static final BiomeType DARK_FOREST_HILLS = register("minecraft:dark_forest_hills"); + public static final BiomeType DEEP_COLD_OCEAN = register("minecraft:deep_cold_ocean"); + public static final BiomeType DEEP_FROZEN_OCEAN = register("minecraft:deep_frozen_ocean"); + public static final BiomeType DEEP_LUKEWARM_OCEAN = register("minecraft:deep_lukewarm_ocean"); + public static final BiomeType DEEP_OCEAN = register("minecraft:deep_ocean"); + public static final BiomeType DEEP_WARM_OCEAN = register("minecraft:deep_warm_ocean"); + public static final BiomeType DESERT = register("minecraft:desert"); + public static final BiomeType DESERT_HILLS = register("minecraft:desert_hills"); + public static final BiomeType DESERT_LAKES = register("minecraft:desert_lakes"); + public static final BiomeType END_BARRENS = register("minecraft:end_barrens"); + public static final BiomeType END_HIGHLANDS = register("minecraft:end_highlands"); + public static final BiomeType END_MIDLANDS = register("minecraft:end_midlands"); + public static final BiomeType ERODED_BADLANDS = register("minecraft:eroded_badlands"); + public static final BiomeType FLOWER_FOREST = register("minecraft:flower_forest"); + public static final BiomeType FOREST = register("minecraft:forest"); + public static final BiomeType FROZEN_OCEAN = register("minecraft:frozen_ocean"); + public static final BiomeType FROZEN_RIVER = register("minecraft:frozen_river"); + public static final BiomeType GIANT_SPRUCE_TAIGA = register("minecraft:giant_spruce_taiga"); + public static final BiomeType GIANT_SPRUCE_TAIGA_HILLS = register("minecraft:giant_spruce_taiga_hills"); + public static final BiomeType GIANT_TREE_TAIGA = register("minecraft:giant_tree_taiga"); + public static final BiomeType GIANT_TREE_TAIGA_HILLS = register("minecraft:giant_tree_taiga_hills"); + public static final BiomeType GRAVELLY_MOUNTAINS = register("minecraft:gravelly_mountains"); + public static final BiomeType ICE_SPIKES = register("minecraft:ice_spikes"); + public static final BiomeType JUNGLE = register("minecraft:jungle"); + public static final BiomeType JUNGLE_EDGE = register("minecraft:jungle_edge"); + public static final BiomeType JUNGLE_HILLS = register("minecraft:jungle_hills"); + public static final BiomeType LUKEWARM_OCEAN = register("minecraft:lukewarm_ocean"); + public static final BiomeType MODIFIED_BADLANDS_PLATEAU = register("minecraft:modified_badlands_plateau"); + public static final BiomeType MODIFIED_GRAVELLY_MOUNTAINS = register("minecraft:modified_gravelly_mountains"); + public static final BiomeType MODIFIED_JUNGLE = register("minecraft:modified_jungle"); + public static final BiomeType MODIFIED_JUNGLE_EDGE = register("minecraft:modified_jungle_edge"); + public static final BiomeType MODIFIED_WOODED_BADLANDS_PLATEAU = register("minecraft:modified_wooded_badlands_plateau"); + public static final BiomeType MOUNTAIN_EDGE = register("minecraft:mountain_edge"); + public static final BiomeType MOUNTAINS = register("minecraft:mountains"); + public static final BiomeType MUSHROOM_FIELD_SHORE = register("minecraft:mushroom_field_shore"); + public static final BiomeType MUSHROOM_FIELDS = register("minecraft:mushroom_fields"); + public static final BiomeType NETHER = register("minecraft:nether"); + public static final BiomeType OCEAN = register("minecraft:ocean"); + public static final BiomeType PLAINS = register("minecraft:plains"); + public static final BiomeType RIVER = register("minecraft:river"); + public static final BiomeType SAVANNA = register("minecraft:savanna"); + public static final BiomeType SAVANNA_PLATEAU = register("minecraft:savanna_plateau"); + public static final BiomeType SHATTERED_SAVANNA = register("minecraft:shattered_savanna"); + public static final BiomeType SHATTERED_SAVANNA_PLATEAU = register("minecraft:shattered_savanna_plateau"); + public static final BiomeType SMALL_END_ISLANDS = register("minecraft:small_end_islands"); + public static final BiomeType SNOWY_BEACH = register("minecraft:snowy_beach"); + public static final BiomeType SNOWY_MOUNTAINS = register("minecraft:snowy_mountains"); + public static final BiomeType SNOWY_TAIGA = register("minecraft:snowy_taiga"); + public static final BiomeType SNOWY_TAIGA_HILLS = register("minecraft:snowy_taiga_hills"); + public static final BiomeType SNOWY_TAIGA_MOUNTAINS = register("minecraft:snowy_taiga_mountains"); + public static final BiomeType SNOWY_TUNDRA = register("minecraft:snowy_tundra"); + public static final BiomeType STONE_SHORE = register("minecraft:stone_shore"); + public static final BiomeType SUNFLOWER_PLAINS = register("minecraft:sunflower_plains"); + public static final BiomeType SWAMP = register("minecraft:swamp"); + public static final BiomeType SWAMP_HILLS = register("minecraft:swamp_hills"); + public static final BiomeType TAIGA = register("minecraft:taiga"); + public static final BiomeType TAIGA_HILLS = register("minecraft:taiga_hills"); + public static final BiomeType TAIGA_MOUNTAINS = register("minecraft:taiga_mountains"); + public static final BiomeType TALL_BIRCH_FOREST = register("minecraft:tall_birch_forest"); + public static final BiomeType TALL_BIRCH_HILLS = register("minecraft:tall_birch_hills"); + public static final BiomeType THE_END = register("minecraft:the_end"); + public static final BiomeType THE_VOID = register("minecraft:the_void"); + public static final BiomeType WARM_OCEAN = register("minecraft:warm_ocean"); + public static final BiomeType WOODED_BADLANDS_PLATEAU = register("minecraft:wooded_badlands_plateau"); + public static final BiomeType WOODED_HILLS = register("minecraft:wooded_hills"); + public static final BiomeType WOODED_MOUNTAINS = register("minecraft:wooded_mountains"); + + private BiomeTypes() { + } + + private static BiomeType register(final String id) { + return register(new BiomeType(id)); + } + + public static BiomeType register(final BiomeType biome) { + return BiomeType.REGISTRY.register(biome.getId(), biome); + } + + public static @Nullable BiomeType get(final String id) { + return BiomeType.REGISTRY.get(id); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java index 0282227db..8c73ddf01 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java @@ -50,17 +50,17 @@ public final class Biomes { * @return a biome or null */ @Nullable - public static BaseBiome findBiomeByName(Collection biomes, String name, BiomeRegistry registry) { + public static BiomeType findBiomeByName(Collection biomes, String name, BiomeRegistry registry) { checkNotNull(biomes); checkNotNull(name); checkNotNull(registry); Function compare = new LevenshteinDistance(name, false, LevenshteinDistance.STANDARD_CHARS); - WeightedChoice chooser = new WeightedChoice<>(Functions.compose(compare::apply, new BiomeName(registry)), 0); - for (BaseBiome biome : biomes) { + WeightedChoice chooser = new WeightedChoice<>(Functions.compose(compare::apply, new BiomeName(registry)), 0); + for (BiomeType biome : biomes) { chooser.consider(biome); } - Optional> choice = chooser.getChoice(); + Optional> choice = chooser.getChoice(); if (choice.isPresent() && choice.get().getScore() <= 1) { return choice.get().getValue(); } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java index 8a581b7a6..52874d034 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java @@ -19,10 +19,8 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; - -import java.util.List; +import com.sk89q.worldedit.world.biome.BiomeType; import javax.annotation.Nullable; @@ -31,22 +29,6 @@ import javax.annotation.Nullable; */ public interface BiomeRegistry { - /** - * Create a new biome given its biome ID. - * - * @param id its biome ID - * @return a new biome or null if it can't be created - */ - @Nullable - BaseBiome createFromId(int id); - - /** - * Get a list of available biomes. - * - * @return a list of biomes - */ - List getBiomes(); - /** * Get data about a biome. * @@ -54,6 +36,6 @@ public interface BiomeRegistry { * @return a data object or null if information is not known */ @Nullable - BiomeData getData(BaseBiome biome); + BiomeData getData(BiomeType biome); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java index 551cbc039..ac0d95240 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java @@ -19,11 +19,8 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; - -import java.util.Collections; -import java.util.List; +import com.sk89q.worldedit.world.biome.BiomeType; import javax.annotation.Nullable; @@ -40,18 +37,7 @@ public class NullBiomeRegistry implements BiomeRegistry { @Nullable @Override - public BaseBiome createFromId(int id) { - return null; - } - - @Override - public List getBiomes() { - return Collections.emptyList(); - } - - @Nullable - @Override - public BiomeData getData(BaseBiome biome) { + public BiomeData getData(BiomeType biome) { return null; } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index e0f319cee..f28e35a0b 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -30,14 +30,18 @@ import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +import net.minecraft.world.biome.Biome; import java.util.stream.Collectors; @@ -50,6 +54,14 @@ final class ForgeAdapter { return new ForgeWorld(world); } + public static Biome adapt(BiomeType biomeType) { + return Biome.REGISTRY.getObject(new ResourceLocation(biomeType.getId())); + } + + public static BiomeType adapt(Biome biome) { + return BiomeTypes.get(biome.getRegistryName().toString()); + } + public static Vector3 adapt(Vec3d vector) { return Vector3.at(vector.x, vector.y, vector.z); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java index 06a11ea76..986a3afc2 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java @@ -19,36 +19,20 @@ package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.registry.BiomeRegistry; import net.minecraft.world.biome.Biome; -import java.util.ArrayList; -import java.util.List; - /** * Provides access to biome data in Forge. */ class ForgeBiomeRegistry implements BiomeRegistry { - @Override - public BaseBiome createFromId(int id) { - return new BaseBiome(id); - } @Override - public List getBiomes() { - List list = new ArrayList<>(); - for (Biome biome : Biome.REGISTRY) { - list.add(new BaseBiome(Biome.getIdForBiome(biome))); - } - return list; - } - - @Override - public BiomeData getData(BaseBiome biome) { - return new ForgeBiomeData(Biome.getBiome(biome.getId())); + public BiomeData getData(BiomeType biome) { + return new ForgeBiomeData(ForgeAdapter.adapt(biome)); } /** diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index d63d8673a..09fcc4241 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -41,7 +41,7 @@ import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.world.AbstractWorld; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -49,7 +49,6 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.weather.WeatherType; import com.sk89q.worldedit.world.weather.WeatherTypes; - import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockOldLeaf; @@ -262,19 +261,19 @@ public class ForgeWorld extends AbstractWorld { } @Override - public BaseBiome getBiome(BlockVector2 position) { + public BiomeType getBiome(BlockVector2 position) { checkNotNull(position); - return new BaseBiome(Biome.getIdForBiome(getWorld().getBiomeForCoordsBody(new BlockPos(position.getBlockX(), 0, position.getBlockZ())))); + return ForgeAdapter.adapt(getWorld().getBiomeForCoordsBody(new BlockPos(position.getBlockX(), 0, position.getBlockZ()))); } @Override - public boolean setBiome(BlockVector2 position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BiomeType biome) { checkNotNull(position); checkNotNull(biome); Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())); if (chunk.isLoaded()) { - chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId(); + chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) Biome.getIdForBiome(ForgeAdapter.adapt(biome)); return true; } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java index f5df77298..d8dc2760f 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java @@ -26,6 +26,8 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.living.player.Player; @@ -103,6 +105,14 @@ public class SpongeAdapter { } } + public static BiomeType adapt(org.spongepowered.api.world.biome.BiomeType biomeType) { + return BiomeTypes.get(biomeType.getId()); + } + + public static org.spongepowered.api.world.biome.BiomeType adapt(BiomeType biomeType) { + return Sponge.getRegistry().getType(org.spongepowered.api.world.biome.BiomeType.class, biomeType.getId()).orElse(null); + } + /** * Create a WorldEdit location from a Sponge location. * diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java index 1b1955bdb..b44d13aae 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java @@ -19,15 +19,10 @@ package com.sk89q.worldedit.sponge; -import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import org.spongepowered.api.Sponge; import org.spongepowered.api.world.biome.BiomeType; -import java.util.ArrayList; -import java.util.List; - import javax.annotation.Nullable; /** @@ -37,23 +32,8 @@ class SpongeBiomeRegistry implements BiomeRegistry { @Nullable @Override - public BaseBiome createFromId(int id) { - return new BaseBiome(id); - } - - @Override - public List getBiomes() { - List list = new ArrayList<>(); - for (BiomeType biome : Sponge.getGame().getRegistry().getAllOf(BiomeType.class)) { - list.add(new BaseBiome(SpongeWorldEdit.inst().getAdapter().resolve(biome))); - } - return list; - } - - @Nullable - @Override - public BiomeData getData(BaseBiome biome) { - return new SpongeBiomeData(SpongeWorldEdit.inst().getAdapter().resolveBiome(biome.getId())); + public BiomeData getData(com.sk89q.worldedit.world.biome.BiomeType biome) { + return new SpongeBiomeData(SpongeAdapter.adapt(biome)); } private static class SpongeBiomeData implements BiomeData { diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index 293f5f604..743bf7198 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -35,7 +35,7 @@ import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.AbstractWorld; -import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.item.ItemTypes; @@ -192,17 +192,17 @@ public abstract class SpongeWorld extends AbstractWorld { } @Override - public BaseBiome getBiome(BlockVector2 position) { + public BiomeType getBiome(BlockVector2 position) { checkNotNull(position); - return new BaseBiome(SpongeWorldEdit.inst().getAdapter().resolve(getWorld().getBiome(position.getBlockX(), 0, position.getBlockZ()))); + return SpongeAdapter.adapt(getWorld().getBiome(position.getBlockX(), 0, position.getBlockZ())); } @Override - public boolean setBiome(BlockVector2 position, BaseBiome biome) { + public boolean setBiome(BlockVector2 position, BiomeType biome) { checkNotNull(position); checkNotNull(biome); - getWorld().setBiome(position.getBlockX(), 0, position.getBlockZ(), SpongeWorldEdit.inst().getAdapter().resolveBiome(biome.getId())); + getWorld().setBiome(position.getBlockX(), 0, position.getBlockZ(), SpongeAdapter.adapt(biome)); return true; } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java index d6cb96f8e..d2ddf99e5 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java @@ -36,16 +36,6 @@ import org.spongepowered.api.world.biome.BiomeType; */ public interface SpongeImplAdapter { - /** - * Resolves the numerical ID from this {@link BiomeType} - * - * @param type The biometype - * @return The numerical ID - */ - int resolve(BiomeType type); - - BiomeType resolveBiome(int intID); - BaseEntity createBaseEntity(Entity entity); ItemStack makeSpongeStack(BaseItemStack itemStack); From db1315e04319130ac5082b23972c95c83f5d2e2d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 16 Feb 2019 19:35:13 +1000 Subject: [PATCH 116/182] Refactor registries to entirely use the platform --- .../worldedit/bukkit/WorldEditPlugin.java | 53 +- .../sk89q/worldedit/LocalConfiguration.java | 142 +- .../util/PropertiesConfiguration.java | 2 +- .../worldedit/util/YAMLConfiguration.java | 2 +- .../worldedit/world/biome/BiomeTypes.java | 146 +- .../worldedit/world/block/BlockTypes.java | 1212 +++++++------ .../world/block/FuzzyBlockState.java | 7 +- .../worldedit/world/entity/EntityTypes.java | 198 +- .../sk89q/worldedit/world/item/ItemTypes.java | 1588 ++++++++--------- .../transform/BlockTransformExtentTest.java | 2 +- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 4 +- .../worldedit/sponge/SpongeWorldEdit.java | 5 +- 12 files changed, 1695 insertions(+), 1666 deletions(-) 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 3899db50f..2a05d9c2d 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 @@ -33,12 +33,22 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader; import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; - +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.FuzzyBlockState; +import com.sk89q.worldedit.world.entity.EntityType; +import com.sk89q.worldedit.world.item.ItemType; import org.bstats.bukkit.Metrics; +import org.bukkit.Material; +import org.bukkit.block.Biome; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; @@ -51,6 +61,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.List; +import java.util.Map; import java.util.jar.JarFile; import java.util.logging.Level; import java.util.logging.Logger; @@ -88,6 +99,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { server = new BukkitServerInterface(this, getServer()); worldEdit.getPlatformManager().register(server); loadAdapter(); // Need an adapter to work with special blocks with NBT data + setupRegistries(); worldEdit.loadMappings(); loadConfig(); // Load configuration @@ -109,6 +121,45 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { new Metrics(this); } + public void setupRegistries() { + // Biome + for (Biome biome : Biome.values()) { + BiomeType.REGISTRY.register("minecraft:" + biome.name().toLowerCase(), new BiomeType("minecraft:" + biome.name().toLowerCase())); + } + // Block & Item + for (Material material : Material.values()) { + if (material.isBlock()) { + BlockType.REGISTRY.register(material.getKey().toString(), new BlockType(material.getKey().toString(), blockState -> { + // TODO Use something way less hacky than this. + ParserContext context = new ParserContext(); + context.setPreferringWildcard(true); + context.setTryLegacy(false); + context.setRestricted(false); + try { + FuzzyBlockState state = (FuzzyBlockState) WorldEdit.getInstance().getBlockFactory().parseFromInput( + BukkitAdapter.adapt(blockState.getBlockType()).createBlockData().getAsString(), context + ).toImmutableState(); + BlockState defaultState = blockState.getBlockType().getAllStates().get(0); + for (Map.Entry, Object> propertyObjectEntry : state.getStates().entrySet()) { + defaultState = defaultState.with((Property) propertyObjectEntry.getKey(), propertyObjectEntry.getValue()); + } + return defaultState; + } catch (InputParseException e) { + e.printStackTrace(); + return blockState; + } + })); + } + if (material.isItem()) { + ItemType.REGISTRY.register(material.getKey().toString(), new ItemType(material.getKey().toString())); + } + } + // Entity + for (org.bukkit.entity.EntityType entityType : org.bukkit.entity.EntityType.values()) { + EntityType.REGISTRY.register("minecraft:" + entityType.name().toLowerCase(), new EntityType("minecraft:" + entityType.name().toLowerCase())); + } + } + private void loadConfig() { createDefaultConfiguration("config.yml"); // Create the default configuration file 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 a56e2f06e..120d4ddb4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -19,86 +19,25 @@ package com.sk89q.worldedit; +import com.google.common.collect.Lists; import com.sk89q.worldedit.util.logging.LogFormat; +import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.snapshot.SnapshotRepository; import java.io.File; import java.util.HashSet; +import java.util.List; +import java.util.Objects; import java.util.Set; +import java.util.function.IntFunction; /** * Represents WorldEdit's configuration. */ public abstract class LocalConfiguration { - protected static final String[] defaultDisallowedBlocks = new String[] { - // dangerous stuff (physics/drops items) - BlockTypes.OAK_SAPLING.getId(), - BlockTypes.JUNGLE_SAPLING.getId(), - BlockTypes.DARK_OAK_SAPLING.getId(), - BlockTypes.SPRUCE_SAPLING.getId(), - BlockTypes.BIRCH_SAPLING.getId(), - BlockTypes.ACACIA_SAPLING.getId(), - BlockTypes.BLACK_BED.getId(), - BlockTypes.BLUE_BED.getId(), - BlockTypes.BROWN_BED.getId(), - BlockTypes.CYAN_BED.getId(), - BlockTypes.GRAY_BED.getId(), - BlockTypes.GREEN_BED.getId(), - BlockTypes.LIGHT_BLUE_BED.getId(), - BlockTypes.LIGHT_GRAY_BED.getId(), - BlockTypes.LIME_BED.getId(), - BlockTypes.MAGENTA_BED.getId(), - BlockTypes.ORANGE_BED.getId(), - BlockTypes.PINK_BED.getId(), - BlockTypes.PURPLE_BED.getId(), - BlockTypes.RED_BED.getId(), - BlockTypes.WHITE_BED.getId(), - BlockTypes.YELLOW_BED.getId(), - BlockTypes.POWERED_RAIL.getId(), - BlockTypes.DETECTOR_RAIL.getId(), - BlockTypes.GRASS.getId(), - BlockTypes.DEAD_BUSH.getId(), - BlockTypes.MOVING_PISTON.getId(), - BlockTypes.PISTON_HEAD.getId(), - BlockTypes.SUNFLOWER.getId(), - BlockTypes.ROSE_BUSH.getId(), - BlockTypes.DANDELION.getId(), - BlockTypes.POPPY.getId(), - BlockTypes.BROWN_MUSHROOM.getId(), - BlockTypes.RED_MUSHROOM.getId(), - BlockTypes.TNT.getId(), - BlockTypes.TORCH.getId(), - BlockTypes.FIRE.getId(), - BlockTypes.REDSTONE_WIRE.getId(), - BlockTypes.WHEAT.getId(), - BlockTypes.POTATOES.getId(), - BlockTypes.CARROTS.getId(), - BlockTypes.MELON_STEM.getId(), - BlockTypes.PUMPKIN_STEM.getId(), - BlockTypes.BEETROOTS.getId(), - BlockTypes.RAIL.getId(), - BlockTypes.LEVER.getId(), - BlockTypes.REDSTONE_TORCH.getId(), - BlockTypes.REDSTONE_WALL_TORCH.getId(), - BlockTypes.REPEATER.getId(), - BlockTypes.COMPARATOR.getId(), - BlockTypes.STONE_BUTTON.getId(), - BlockTypes.BIRCH_BUTTON.getId(), - BlockTypes.ACACIA_BUTTON.getId(), - BlockTypes.DARK_OAK_BUTTON.getId(), - BlockTypes.JUNGLE_BUTTON.getId(), - BlockTypes.OAK_BUTTON.getId(), - BlockTypes.SPRUCE_BUTTON.getId(), - BlockTypes.CACTUS.getId(), - BlockTypes.SUGAR_CANE.getId(), - // ores and stuff - BlockTypes.BEDROCK.getId(), - }; - public boolean profile = false; public boolean traceUnflushedSessions = false; public Set disallowedBlocks = new HashSet<>(); @@ -117,7 +56,7 @@ public abstract class LocalConfiguration { public String logFile = ""; public String logFormat = LogFormat.DEFAULT_FORMAT; public boolean registerHelp = true; // what is the point of this, it's not even used - public String wandItem = ItemTypes.WOODEN_AXE.getId(); + public String wandItem = "minecraft:wooden_axe"; public boolean superPickaxeDrop = true; public boolean superPickaxeManyDrop = true; public boolean noDoubleSlash = false; @@ -125,7 +64,7 @@ public abstract class LocalConfiguration { public boolean useInventoryOverride = false; public boolean useInventoryCreativeOverride = false; public boolean navigationUseGlass = true; - public String navigationWand = ItemTypes.COMPASS.getId(); + public String navigationWand = "minecraft:compass"; public int navigationWandMaxDistance = 50; public int scriptTimeout = 3000; public int calculationTimeout = 100; @@ -138,6 +77,73 @@ public abstract class LocalConfiguration { public boolean allowSymlinks = false; public boolean serverSideCUI = true; + protected String[] getDefaultDisallowedBlocks() { + List blockTypes = Lists.newArrayList( + BlockTypes.OAK_SAPLING, + BlockTypes.JUNGLE_SAPLING, + BlockTypes.DARK_OAK_SAPLING, + BlockTypes.SPRUCE_SAPLING, + BlockTypes.BIRCH_SAPLING, + BlockTypes.ACACIA_SAPLING, + BlockTypes.BLACK_BED, + BlockTypes.BLUE_BED, + BlockTypes.BROWN_BED, + BlockTypes.CYAN_BED, + BlockTypes.GRAY_BED, + BlockTypes.GREEN_BED, + BlockTypes.LIGHT_BLUE_BED, + BlockTypes.LIGHT_GRAY_BED, + BlockTypes.LIME_BED, + BlockTypes.MAGENTA_BED, + BlockTypes.ORANGE_BED, + BlockTypes.PINK_BED, + BlockTypes.PURPLE_BED, + BlockTypes.RED_BED, + BlockTypes.WHITE_BED, + BlockTypes.YELLOW_BED, + BlockTypes.POWERED_RAIL, + BlockTypes.DETECTOR_RAIL, + BlockTypes.GRASS, + BlockTypes.DEAD_BUSH, + BlockTypes.MOVING_PISTON, + BlockTypes.PISTON_HEAD, + BlockTypes.SUNFLOWER, + BlockTypes.ROSE_BUSH, + BlockTypes.DANDELION, + BlockTypes.POPPY, + BlockTypes.BROWN_MUSHROOM, + BlockTypes.RED_MUSHROOM, + BlockTypes.TNT, + BlockTypes.TORCH, + BlockTypes.FIRE, + BlockTypes.REDSTONE_WIRE, + BlockTypes.WHEAT, + BlockTypes.POTATOES, + BlockTypes.CARROTS, + BlockTypes.MELON_STEM, + BlockTypes.PUMPKIN_STEM, + BlockTypes.BEETROOTS, + BlockTypes.RAIL, + BlockTypes.LEVER, + BlockTypes.REDSTONE_TORCH, + BlockTypes.REDSTONE_WALL_TORCH, + BlockTypes.REPEATER, + BlockTypes.COMPARATOR, + BlockTypes.STONE_BUTTON, + BlockTypes.BIRCH_BUTTON, + BlockTypes.ACACIA_BUTTON, + BlockTypes.DARK_OAK_BUTTON, + BlockTypes.JUNGLE_BUTTON, + BlockTypes.OAK_BUTTON, + BlockTypes.SPRUCE_BUTTON, + BlockTypes.CACTUS, + BlockTypes.SUGAR_CANE, + // ores and stuff + BlockTypes.BEDROCK + ); + return blockTypes.stream().filter(type -> !Objects.isNull(type)).map(BlockType::getId).toArray(String[]::new); + } + /** * Load the configuration. */ 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 9ec39e35e..b9dc1cece 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 @@ -77,7 +77,7 @@ public class PropertiesConfiguration extends LocalConfiguration { profile = getBool("profile", profile); traceUnflushedSessions = getBool("trace-unflushed-sessions", traceUnflushedSessions); - disallowedBlocks = getStringSet("disallowed-blocks", defaultDisallowedBlocks); + disallowedBlocks = getStringSet("disallowed-blocks", getDefaultDisallowedBlocks()); defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit); maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints); 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 dfbd586b2..fcfa35fd6 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 @@ -79,7 +79,7 @@ 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)); - disallowedBlocks = new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(defaultDisallowedBlocks))); + disallowedBlocks = new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(getDefaultDisallowedBlocks()))); allowedDataCycleBlocks = new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null)); registerHelp = config.getBoolean("register-help", true); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java index 732c4926e..a9d07a5fc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java @@ -26,79 +26,79 @@ import javax.annotation.Nullable; */ public class BiomeTypes { - public static final BiomeType BADLANDS = register("minecraft:badlands"); - public static final BiomeType BADLANDS_PLATEAU = register("minecraft:badlands_plateau"); - public static final BiomeType BEACH = register("minecraft:beach"); - public static final BiomeType BIRCH_FOREST = register("minecraft:birch_forest"); - public static final BiomeType BIRCH_FOREST_HILLS = register("minecraft:birch_forest_hills"); - public static final BiomeType COLD_OCEAN = register("minecraft:cold_ocean"); - public static final BiomeType DARK_FOREST = register("minecraft:dark_forest"); - public static final BiomeType DARK_FOREST_HILLS = register("minecraft:dark_forest_hills"); - public static final BiomeType DEEP_COLD_OCEAN = register("minecraft:deep_cold_ocean"); - public static final BiomeType DEEP_FROZEN_OCEAN = register("minecraft:deep_frozen_ocean"); - public static final BiomeType DEEP_LUKEWARM_OCEAN = register("minecraft:deep_lukewarm_ocean"); - public static final BiomeType DEEP_OCEAN = register("minecraft:deep_ocean"); - public static final BiomeType DEEP_WARM_OCEAN = register("minecraft:deep_warm_ocean"); - public static final BiomeType DESERT = register("minecraft:desert"); - public static final BiomeType DESERT_HILLS = register("minecraft:desert_hills"); - public static final BiomeType DESERT_LAKES = register("minecraft:desert_lakes"); - public static final BiomeType END_BARRENS = register("minecraft:end_barrens"); - public static final BiomeType END_HIGHLANDS = register("minecraft:end_highlands"); - public static final BiomeType END_MIDLANDS = register("minecraft:end_midlands"); - public static final BiomeType ERODED_BADLANDS = register("minecraft:eroded_badlands"); - public static final BiomeType FLOWER_FOREST = register("minecraft:flower_forest"); - public static final BiomeType FOREST = register("minecraft:forest"); - public static final BiomeType FROZEN_OCEAN = register("minecraft:frozen_ocean"); - public static final BiomeType FROZEN_RIVER = register("minecraft:frozen_river"); - public static final BiomeType GIANT_SPRUCE_TAIGA = register("minecraft:giant_spruce_taiga"); - public static final BiomeType GIANT_SPRUCE_TAIGA_HILLS = register("minecraft:giant_spruce_taiga_hills"); - public static final BiomeType GIANT_TREE_TAIGA = register("minecraft:giant_tree_taiga"); - public static final BiomeType GIANT_TREE_TAIGA_HILLS = register("minecraft:giant_tree_taiga_hills"); - public static final BiomeType GRAVELLY_MOUNTAINS = register("minecraft:gravelly_mountains"); - public static final BiomeType ICE_SPIKES = register("minecraft:ice_spikes"); - public static final BiomeType JUNGLE = register("minecraft:jungle"); - public static final BiomeType JUNGLE_EDGE = register("minecraft:jungle_edge"); - public static final BiomeType JUNGLE_HILLS = register("minecraft:jungle_hills"); - public static final BiomeType LUKEWARM_OCEAN = register("minecraft:lukewarm_ocean"); - public static final BiomeType MODIFIED_BADLANDS_PLATEAU = register("minecraft:modified_badlands_plateau"); - public static final BiomeType MODIFIED_GRAVELLY_MOUNTAINS = register("minecraft:modified_gravelly_mountains"); - public static final BiomeType MODIFIED_JUNGLE = register("minecraft:modified_jungle"); - public static final BiomeType MODIFIED_JUNGLE_EDGE = register("minecraft:modified_jungle_edge"); - public static final BiomeType MODIFIED_WOODED_BADLANDS_PLATEAU = register("minecraft:modified_wooded_badlands_plateau"); - public static final BiomeType MOUNTAIN_EDGE = register("minecraft:mountain_edge"); - public static final BiomeType MOUNTAINS = register("minecraft:mountains"); - public static final BiomeType MUSHROOM_FIELD_SHORE = register("minecraft:mushroom_field_shore"); - public static final BiomeType MUSHROOM_FIELDS = register("minecraft:mushroom_fields"); - public static final BiomeType NETHER = register("minecraft:nether"); - public static final BiomeType OCEAN = register("minecraft:ocean"); - public static final BiomeType PLAINS = register("minecraft:plains"); - public static final BiomeType RIVER = register("minecraft:river"); - public static final BiomeType SAVANNA = register("minecraft:savanna"); - public static final BiomeType SAVANNA_PLATEAU = register("minecraft:savanna_plateau"); - public static final BiomeType SHATTERED_SAVANNA = register("minecraft:shattered_savanna"); - public static final BiomeType SHATTERED_SAVANNA_PLATEAU = register("minecraft:shattered_savanna_plateau"); - public static final BiomeType SMALL_END_ISLANDS = register("minecraft:small_end_islands"); - public static final BiomeType SNOWY_BEACH = register("minecraft:snowy_beach"); - public static final BiomeType SNOWY_MOUNTAINS = register("minecraft:snowy_mountains"); - public static final BiomeType SNOWY_TAIGA = register("minecraft:snowy_taiga"); - public static final BiomeType SNOWY_TAIGA_HILLS = register("minecraft:snowy_taiga_hills"); - public static final BiomeType SNOWY_TAIGA_MOUNTAINS = register("minecraft:snowy_taiga_mountains"); - public static final BiomeType SNOWY_TUNDRA = register("minecraft:snowy_tundra"); - public static final BiomeType STONE_SHORE = register("minecraft:stone_shore"); - public static final BiomeType SUNFLOWER_PLAINS = register("minecraft:sunflower_plains"); - public static final BiomeType SWAMP = register("minecraft:swamp"); - public static final BiomeType SWAMP_HILLS = register("minecraft:swamp_hills"); - public static final BiomeType TAIGA = register("minecraft:taiga"); - public static final BiomeType TAIGA_HILLS = register("minecraft:taiga_hills"); - public static final BiomeType TAIGA_MOUNTAINS = register("minecraft:taiga_mountains"); - public static final BiomeType TALL_BIRCH_FOREST = register("minecraft:tall_birch_forest"); - public static final BiomeType TALL_BIRCH_HILLS = register("minecraft:tall_birch_hills"); - public static final BiomeType THE_END = register("minecraft:the_end"); - public static final BiomeType THE_VOID = register("minecraft:the_void"); - public static final BiomeType WARM_OCEAN = register("minecraft:warm_ocean"); - public static final BiomeType WOODED_BADLANDS_PLATEAU = register("minecraft:wooded_badlands_plateau"); - public static final BiomeType WOODED_HILLS = register("minecraft:wooded_hills"); - public static final BiomeType WOODED_MOUNTAINS = register("minecraft:wooded_mountains"); + @Nullable public static final BiomeType BADLANDS = get("minecraft:badlands"); + @Nullable public static final BiomeType BADLANDS_PLATEAU = get("minecraft:badlands_plateau"); + @Nullable public static final BiomeType BEACH = get("minecraft:beach"); + @Nullable public static final BiomeType BIRCH_FOREST = get("minecraft:birch_forest"); + @Nullable public static final BiomeType BIRCH_FOREST_HILLS = get("minecraft:birch_forest_hills"); + @Nullable public static final BiomeType COLD_OCEAN = get("minecraft:cold_ocean"); + @Nullable public static final BiomeType DARK_FOREST = get("minecraft:dark_forest"); + @Nullable public static final BiomeType DARK_FOREST_HILLS = get("minecraft:dark_forest_hills"); + @Nullable public static final BiomeType DEEP_COLD_OCEAN = get("minecraft:deep_cold_ocean"); + @Nullable public static final BiomeType DEEP_FROZEN_OCEAN = get("minecraft:deep_frozen_ocean"); + @Nullable public static final BiomeType DEEP_LUKEWARM_OCEAN = get("minecraft:deep_lukewarm_ocean"); + @Nullable public static final BiomeType DEEP_OCEAN = get("minecraft:deep_ocean"); + @Nullable public static final BiomeType DEEP_WARM_OCEAN = get("minecraft:deep_warm_ocean"); + @Nullable public static final BiomeType DESERT = get("minecraft:desert"); + @Nullable public static final BiomeType DESERT_HILLS = get("minecraft:desert_hills"); + @Nullable public static final BiomeType DESERT_LAKES = get("minecraft:desert_lakes"); + @Nullable public static final BiomeType END_BARRENS = get("minecraft:end_barrens"); + @Nullable public static final BiomeType END_HIGHLANDS = get("minecraft:end_highlands"); + @Nullable public static final BiomeType END_MIDLANDS = get("minecraft:end_midlands"); + @Nullable public static final BiomeType ERODED_BADLANDS = get("minecraft:eroded_badlands"); + @Nullable public static final BiomeType FLOWER_FOREST = get("minecraft:flower_forest"); + @Nullable public static final BiomeType FOREST = get("minecraft:forest"); + @Nullable public static final BiomeType FROZEN_OCEAN = get("minecraft:frozen_ocean"); + @Nullable public static final BiomeType FROZEN_RIVER = get("minecraft:frozen_river"); + @Nullable public static final BiomeType GIANT_SPRUCE_TAIGA = get("minecraft:giant_spruce_taiga"); + @Nullable public static final BiomeType GIANT_SPRUCE_TAIGA_HILLS = get("minecraft:giant_spruce_taiga_hills"); + @Nullable public static final BiomeType GIANT_TREE_TAIGA = get("minecraft:giant_tree_taiga"); + @Nullable public static final BiomeType GIANT_TREE_TAIGA_HILLS = get("minecraft:giant_tree_taiga_hills"); + @Nullable public static final BiomeType GRAVELLY_MOUNTAINS = get("minecraft:gravelly_mountains"); + @Nullable public static final BiomeType ICE_SPIKES = get("minecraft:ice_spikes"); + @Nullable public static final BiomeType JUNGLE = get("minecraft:jungle"); + @Nullable public static final BiomeType JUNGLE_EDGE = get("minecraft:jungle_edge"); + @Nullable public static final BiomeType JUNGLE_HILLS = get("minecraft:jungle_hills"); + @Nullable public static final BiomeType LUKEWARM_OCEAN = get("minecraft:lukewarm_ocean"); + @Nullable public static final BiomeType MODIFIED_BADLANDS_PLATEAU = get("minecraft:modified_badlands_plateau"); + @Nullable public static final BiomeType MODIFIED_GRAVELLY_MOUNTAINS = get("minecraft:modified_gravelly_mountains"); + @Nullable public static final BiomeType MODIFIED_JUNGLE = get("minecraft:modified_jungle"); + @Nullable public static final BiomeType MODIFIED_JUNGLE_EDGE = get("minecraft:modified_jungle_edge"); + @Nullable public static final BiomeType MODIFIED_WOODED_BADLANDS_PLATEAU = get("minecraft:modified_wooded_badlands_plateau"); + @Nullable public static final BiomeType MOUNTAIN_EDGE = get("minecraft:mountain_edge"); + @Nullable public static final BiomeType MOUNTAINS = get("minecraft:mountains"); + @Nullable public static final BiomeType MUSHROOM_FIELD_SHORE = get("minecraft:mushroom_field_shore"); + @Nullable public static final BiomeType MUSHROOM_FIELDS = get("minecraft:mushroom_fields"); + @Nullable public static final BiomeType NETHER = get("minecraft:nether"); + @Nullable public static final BiomeType OCEAN = get("minecraft:ocean"); + @Nullable public static final BiomeType PLAINS = get("minecraft:plains"); + @Nullable public static final BiomeType RIVER = get("minecraft:river"); + @Nullable public static final BiomeType SAVANNA = get("minecraft:savanna"); + @Nullable public static final BiomeType SAVANNA_PLATEAU = get("minecraft:savanna_plateau"); + @Nullable public static final BiomeType SHATTERED_SAVANNA = get("minecraft:shattered_savanna"); + @Nullable public static final BiomeType SHATTERED_SAVANNA_PLATEAU = get("minecraft:shattered_savanna_plateau"); + @Nullable public static final BiomeType SMALL_END_ISLANDS = get("minecraft:small_end_islands"); + @Nullable public static final BiomeType SNOWY_BEACH = get("minecraft:snowy_beach"); + @Nullable public static final BiomeType SNOWY_MOUNTAINS = get("minecraft:snowy_mountains"); + @Nullable public static final BiomeType SNOWY_TAIGA = get("minecraft:snowy_taiga"); + @Nullable public static final BiomeType SNOWY_TAIGA_HILLS = get("minecraft:snowy_taiga_hills"); + @Nullable public static final BiomeType SNOWY_TAIGA_MOUNTAINS = get("minecraft:snowy_taiga_mountains"); + @Nullable public static final BiomeType SNOWY_TUNDRA = get("minecraft:snowy_tundra"); + @Nullable public static final BiomeType STONE_SHORE = get("minecraft:stone_shore"); + @Nullable public static final BiomeType SUNFLOWER_PLAINS = get("minecraft:sunflower_plains"); + @Nullable public static final BiomeType SWAMP = get("minecraft:swamp"); + @Nullable public static final BiomeType SWAMP_HILLS = get("minecraft:swamp_hills"); + @Nullable public static final BiomeType TAIGA = get("minecraft:taiga"); + @Nullable public static final BiomeType TAIGA_HILLS = get("minecraft:taiga_hills"); + @Nullable public static final BiomeType TAIGA_MOUNTAINS = get("minecraft:taiga_mountains"); + @Nullable public static final BiomeType TALL_BIRCH_FOREST = get("minecraft:tall_birch_forest"); + @Nullable public static final BiomeType TALL_BIRCH_HILLS = get("minecraft:tall_birch_hills"); + @Nullable public static final BiomeType THE_END = get("minecraft:the_end"); + @Nullable public static final BiomeType THE_VOID = get("minecraft:the_void"); + @Nullable public static final BiomeType WARM_OCEAN = get("minecraft:warm_ocean"); + @Nullable public static final BiomeType WOODED_BADLANDS_PLATEAU = get("minecraft:wooded_badlands_plateau"); + @Nullable public static final BiomeType WOODED_HILLS = get("minecraft:wooded_hills"); + @Nullable public static final BiomeType WOODED_MOUNTAINS = get("minecraft:wooded_mountains"); private BiomeTypes() { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java index aec13e4aa..2d9f1a4ba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java @@ -19,10 +19,6 @@ package com.sk89q.worldedit.world.block; -import com.sk89q.worldedit.util.Direction; - -import java.util.function.Function; - import javax.annotation.Nullable; /** @@ -30,620 +26,608 @@ import javax.annotation.Nullable; */ public final class BlockTypes { - public static final BlockType ACACIA_BUTTON = register("minecraft:acacia_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType ACACIA_DOOR = register("minecraft:acacia_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType ACACIA_FENCE = register("minecraft:acacia_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType ACACIA_FENCE_GATE = register("minecraft:acacia_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType ACACIA_LEAVES = register("minecraft:acacia_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); - public static final BlockType ACACIA_LOG = register("minecraft:acacia_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType ACACIA_PLANKS = register("minecraft:acacia_planks"); - public static final BlockType ACACIA_PRESSURE_PLATE = register("minecraft:acacia_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType ACACIA_SAPLING = register("minecraft:acacia_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); - public static final BlockType ACACIA_SLAB = register("minecraft:acacia_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType ACACIA_STAIRS = register("minecraft:acacia_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType ACACIA_TRAPDOOR = register("minecraft:acacia_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType ACACIA_WOOD = register("minecraft:acacia_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType ACTIVATOR_RAIL = register("minecraft:activator_rail", state -> state.with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("shape"), "north_south")); - public static final BlockType AIR = register("minecraft:air"); - public static final BlockType ALLIUM = register("minecraft:allium"); - public static final BlockType ANDESITE = register("minecraft:andesite"); - public static final BlockType ANVIL = register("minecraft:anvil", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType ATTACHED_MELON_STEM = register("minecraft:attached_melon_stem", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType ATTACHED_PUMPKIN_STEM = register("minecraft:attached_pumpkin_stem", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType AZURE_BLUET = register("minecraft:azure_bluet"); - public static final BlockType BARRIER = register("minecraft:barrier"); - public static final BlockType BEACON = register("minecraft:beacon"); - public static final BlockType BEDROCK = register("minecraft:bedrock"); - public static final BlockType BEETROOTS = register("minecraft:beetroots", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType BIRCH_BUTTON = register("minecraft:birch_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType BIRCH_DOOR = register("minecraft:birch_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType BIRCH_FENCE = register("minecraft:birch_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType BIRCH_FENCE_GATE = register("minecraft:birch_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType BIRCH_LEAVES = register("minecraft:birch_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); - public static final BlockType BIRCH_LOG = register("minecraft:birch_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType BIRCH_PLANKS = register("minecraft:birch_planks"); - public static final BlockType BIRCH_PRESSURE_PLATE = register("minecraft:birch_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType BIRCH_SAPLING = register("minecraft:birch_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); - public static final BlockType BIRCH_SLAB = register("minecraft:birch_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType BIRCH_STAIRS = register("minecraft:birch_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType BIRCH_TRAPDOOR = register("minecraft:birch_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType BIRCH_WOOD = register("minecraft:birch_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType BLACK_BANNER = register("minecraft:black_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType BLACK_BED = register("minecraft:black_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType BLACK_CARPET = register("minecraft:black_carpet"); - public static final BlockType BLACK_CONCRETE = register("minecraft:black_concrete"); - public static final BlockType BLACK_CONCRETE_POWDER = register("minecraft:black_concrete_powder"); - public static final BlockType BLACK_GLAZED_TERRACOTTA = register("minecraft:black_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType BLACK_SHULKER_BOX = register("minecraft:black_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType BLACK_STAINED_GLASS = register("minecraft:black_stained_glass"); - public static final BlockType BLACK_STAINED_GLASS_PANE = register("minecraft:black_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType BLACK_TERRACOTTA = register("minecraft:black_terracotta"); - public static final BlockType BLACK_WALL_BANNER = register("minecraft:black_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType BLACK_WOOL = register("minecraft:black_wool"); - public static final BlockType BLUE_BANNER = register("minecraft:blue_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType BLUE_BED = register("minecraft:blue_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType BLUE_CARPET = register("minecraft:blue_carpet"); - public static final BlockType BLUE_CONCRETE = register("minecraft:blue_concrete"); - public static final BlockType BLUE_CONCRETE_POWDER = register("minecraft:blue_concrete_powder"); - public static final BlockType BLUE_GLAZED_TERRACOTTA = register("minecraft:blue_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType BLUE_ICE = register("minecraft:blue_ice"); - public static final BlockType BLUE_ORCHID = register("minecraft:blue_orchid"); - public static final BlockType BLUE_SHULKER_BOX = register("minecraft:blue_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType BLUE_STAINED_GLASS = register("minecraft:blue_stained_glass"); - public static final BlockType BLUE_STAINED_GLASS_PANE = register("minecraft:blue_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType BLUE_TERRACOTTA = register("minecraft:blue_terracotta"); - public static final BlockType BLUE_WALL_BANNER = register("minecraft:blue_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType BLUE_WOOL = register("minecraft:blue_wool"); - public static final BlockType BONE_BLOCK = register("minecraft:bone_block", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType BOOKSHELF = register("minecraft:bookshelf"); - public static final BlockType BRAIN_CORAL = register("minecraft:brain_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType BRAIN_CORAL_BLOCK = register("minecraft:brain_coral_block"); - public static final BlockType BRAIN_CORAL_FAN = register("minecraft:brain_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType BRAIN_CORAL_WALL_FAN = register("minecraft:brain_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType BREWING_STAND = register("minecraft:brewing_stand", state -> state.with(state.getBlockType().getProperty("has_bottle_0"), false).with(state.getBlockType().getProperty("has_bottle_1"), false).with(state.getBlockType().getProperty("has_bottle_2"), false)); - public static final BlockType BRICK_SLAB = register("minecraft:brick_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType BRICK_STAIRS = register("minecraft:brick_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType BRICKS = register("minecraft:bricks"); - public static final BlockType BROWN_BANNER = register("minecraft:brown_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType BROWN_BED = register("minecraft:brown_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType BROWN_CARPET = register("minecraft:brown_carpet"); - public static final BlockType BROWN_CONCRETE = register("minecraft:brown_concrete"); - public static final BlockType BROWN_CONCRETE_POWDER = register("minecraft:brown_concrete_powder"); - public static final BlockType BROWN_GLAZED_TERRACOTTA = register("minecraft:brown_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType BROWN_MUSHROOM = register("minecraft:brown_mushroom"); - public static final BlockType BROWN_MUSHROOM_BLOCK = register("minecraft:brown_mushroom_block", state -> state.with(state.getBlockType().getProperty("down"), true).with(state.getBlockType().getProperty("east"), true).with(state.getBlockType().getProperty("north"), true).with(state.getBlockType().getProperty("south"), true).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("west"), true)); - public static final BlockType BROWN_SHULKER_BOX = register("minecraft:brown_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType BROWN_STAINED_GLASS = register("minecraft:brown_stained_glass"); - public static final BlockType BROWN_STAINED_GLASS_PANE = register("minecraft:brown_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType BROWN_TERRACOTTA = register("minecraft:brown_terracotta"); - public static final BlockType BROWN_WALL_BANNER = register("minecraft:brown_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType BROWN_WOOL = register("minecraft:brown_wool"); - public static final BlockType BUBBLE_COLUMN = register("minecraft:bubble_column", state -> state.with(state.getBlockType().getProperty("drag"), true)); - public static final BlockType BUBBLE_CORAL = register("minecraft:bubble_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType BUBBLE_CORAL_BLOCK = register("minecraft:bubble_coral_block"); - public static final BlockType BUBBLE_CORAL_FAN = register("minecraft:bubble_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType BUBBLE_CORAL_WALL_FAN = register("minecraft:bubble_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType CACTUS = register("minecraft:cactus", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType CAKE = register("minecraft:cake", state -> state.with(state.getBlockType().getProperty("bites"), 0)); - public static final BlockType CARROTS = register("minecraft:carrots", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType CARVED_PUMPKIN = register("minecraft:carved_pumpkin", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType CAULDRON = register("minecraft:cauldron", state -> state.with(state.getBlockType().getProperty("level"), 0)); - public static final BlockType CAVE_AIR = register("minecraft:cave_air"); - public static final BlockType CHAIN_COMMAND_BLOCK = register("minecraft:chain_command_block", state -> state.with(state.getBlockType().getProperty("conditional"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType CHEST = register("minecraft:chest", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("type"), "SINGLE").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType CHIPPED_ANVIL = register("minecraft:chipped_anvil", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType CHISELED_QUARTZ_BLOCK = register("minecraft:chiseled_quartz_block"); - public static final BlockType CHISELED_RED_SANDSTONE = register("minecraft:chiseled_red_sandstone"); - public static final BlockType CHISELED_SANDSTONE = register("minecraft:chiseled_sandstone"); - public static final BlockType CHISELED_STONE_BRICKS = register("minecraft:chiseled_stone_bricks"); - public static final BlockType CHORUS_FLOWER = register("minecraft:chorus_flower", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType CHORUS_PLANT = register("minecraft:chorus_plant", state -> state.with(state.getBlockType().getProperty("down"), false).with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType CLAY = register("minecraft:clay"); - public static final BlockType COAL_BLOCK = register("minecraft:coal_block"); - public static final BlockType COAL_ORE = register("minecraft:coal_ore"); - public static final BlockType COARSE_DIRT = register("minecraft:coarse_dirt"); - public static final BlockType COBBLESTONE = register("minecraft:cobblestone"); - public static final BlockType COBBLESTONE_SLAB = register("minecraft:cobblestone_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType COBBLESTONE_STAIRS = register("minecraft:cobblestone_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType COBBLESTONE_WALL = register("minecraft:cobblestone_wall", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType COBWEB = register("minecraft:cobweb"); - public static final BlockType COCOA = register("minecraft:cocoa", state -> state.with(state.getBlockType().getProperty("age"), 0).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType COMMAND_BLOCK = register("minecraft:command_block", state -> state.with(state.getBlockType().getProperty("conditional"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType COMPARATOR = register("minecraft:comparator", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("mode"), "compare").with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType CONDUIT = register("minecraft:conduit", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType CRACKED_STONE_BRICKS = register("minecraft:cracked_stone_bricks"); - public static final BlockType CRAFTING_TABLE = register("minecraft:crafting_table"); - public static final BlockType CREEPER_HEAD = register("minecraft:creeper_head", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType CREEPER_WALL_HEAD = register("minecraft:creeper_wall_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType CUT_RED_SANDSTONE = register("minecraft:cut_red_sandstone"); - public static final BlockType CUT_SANDSTONE = register("minecraft:cut_sandstone"); - public static final BlockType CYAN_BANNER = register("minecraft:cyan_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType CYAN_BED = register("minecraft:cyan_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType CYAN_CARPET = register("minecraft:cyan_carpet"); - public static final BlockType CYAN_CONCRETE = register("minecraft:cyan_concrete"); - public static final BlockType CYAN_CONCRETE_POWDER = register("minecraft:cyan_concrete_powder"); - public static final BlockType CYAN_GLAZED_TERRACOTTA = register("minecraft:cyan_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType CYAN_SHULKER_BOX = register("minecraft:cyan_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType CYAN_STAINED_GLASS = register("minecraft:cyan_stained_glass"); - public static final BlockType CYAN_STAINED_GLASS_PANE = register("minecraft:cyan_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType CYAN_TERRACOTTA = register("minecraft:cyan_terracotta"); - public static final BlockType CYAN_WALL_BANNER = register("minecraft:cyan_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType CYAN_WOOL = register("minecraft:cyan_wool"); - public static final BlockType DAMAGED_ANVIL = register("minecraft:damaged_anvil", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType DANDELION = register("minecraft:dandelion"); - public static final BlockType DARK_OAK_BUTTON = register("minecraft:dark_oak_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType DARK_OAK_DOOR = register("minecraft:dark_oak_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType DARK_OAK_FENCE = register("minecraft:dark_oak_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType DARK_OAK_FENCE_GATE = register("minecraft:dark_oak_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType DARK_OAK_LEAVES = register("minecraft:dark_oak_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); - public static final BlockType DARK_OAK_LOG = register("minecraft:dark_oak_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType DARK_OAK_PLANKS = register("minecraft:dark_oak_planks"); - public static final BlockType DARK_OAK_PRESSURE_PLATE = register("minecraft:dark_oak_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType DARK_OAK_SAPLING = register("minecraft:dark_oak_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); - public static final BlockType DARK_OAK_SLAB = register("minecraft:dark_oak_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType DARK_OAK_STAIRS = register("minecraft:dark_oak_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType DARK_OAK_TRAPDOOR = register("minecraft:dark_oak_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType DARK_OAK_WOOD = register("minecraft:dark_oak_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType DARK_PRISMARINE = register("minecraft:dark_prismarine"); - public static final BlockType DARK_PRISMARINE_SLAB = register("minecraft:dark_prismarine_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType DARK_PRISMARINE_STAIRS = register("minecraft:dark_prismarine_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType DAYLIGHT_DETECTOR = register("minecraft:daylight_detector", state -> state.with(state.getBlockType().getProperty("inverted"), false).with(state.getBlockType().getProperty("power"), 0)); - public static final BlockType DEAD_BRAIN_CORAL = register("minecraft:dead_brain_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_BRAIN_CORAL_BLOCK = register("minecraft:dead_brain_coral_block"); - public static final BlockType DEAD_BRAIN_CORAL_FAN = register("minecraft:dead_brain_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_BRAIN_CORAL_WALL_FAN = register("minecraft:dead_brain_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_BUBBLE_CORAL = register("minecraft:dead_bubble_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_BUBBLE_CORAL_BLOCK = register("minecraft:dead_bubble_coral_block"); - public static final BlockType DEAD_BUBBLE_CORAL_FAN = register("minecraft:dead_bubble_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_BUBBLE_CORAL_WALL_FAN = register("minecraft:dead_bubble_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_BUSH = register("minecraft:dead_bush"); - public static final BlockType DEAD_FIRE_CORAL = register("minecraft:dead_fire_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_FIRE_CORAL_BLOCK = register("minecraft:dead_fire_coral_block"); - public static final BlockType DEAD_FIRE_CORAL_FAN = register("minecraft:dead_fire_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_FIRE_CORAL_WALL_FAN = register("minecraft:dead_fire_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_HORN_CORAL = register("minecraft:dead_horn_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_HORN_CORAL_BLOCK = register("minecraft:dead_horn_coral_block"); - public static final BlockType DEAD_HORN_CORAL_FAN = register("minecraft:dead_horn_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_HORN_CORAL_WALL_FAN = register("minecraft:dead_horn_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_TUBE_CORAL = register("minecraft:dead_tube_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_TUBE_CORAL_BLOCK = register("minecraft:dead_tube_coral_block"); - public static final BlockType DEAD_TUBE_CORAL_FAN = register("minecraft:dead_tube_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DEAD_TUBE_CORAL_WALL_FAN = register("minecraft:dead_tube_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType DETECTOR_RAIL = register("minecraft:detector_rail", state -> state.with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("shape"), "north_south")); - public static final BlockType DIAMOND_BLOCK = register("minecraft:diamond_block"); - public static final BlockType DIAMOND_ORE = register("minecraft:diamond_ore"); - public static final BlockType DIORITE = register("minecraft:diorite"); - public static final BlockType DIRT = register("minecraft:dirt"); - public static final BlockType DISPENSER = register("minecraft:dispenser", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("triggered"), false)); - public static final BlockType DRAGON_EGG = register("minecraft:dragon_egg"); - public static final BlockType DRAGON_HEAD = register("minecraft:dragon_head", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType DRAGON_WALL_HEAD = register("minecraft:dragon_wall_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType DRIED_KELP_BLOCK = register("minecraft:dried_kelp_block"); - public static final BlockType DROPPER = register("minecraft:dropper", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("triggered"), false)); - public static final BlockType EMERALD_BLOCK = register("minecraft:emerald_block"); - public static final BlockType EMERALD_ORE = register("minecraft:emerald_ore"); - public static final BlockType ENCHANTING_TABLE = register("minecraft:enchanting_table"); - public static final BlockType END_GATEWAY = register("minecraft:end_gateway"); - public static final BlockType END_PORTAL = register("minecraft:end_portal"); - public static final BlockType END_PORTAL_FRAME = register("minecraft:end_portal_frame", state -> state.with(state.getBlockType().getProperty("eye"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType END_ROD = register("minecraft:end_rod", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType END_STONE = register("minecraft:end_stone"); - public static final BlockType END_STONE_BRICKS = register("minecraft:end_stone_bricks"); - public static final BlockType ENDER_CHEST = register("minecraft:ender_chest", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType FARMLAND = register("minecraft:farmland", state -> state.with(state.getBlockType().getProperty("moisture"), 0)); - public static final BlockType FERN = register("minecraft:fern"); - public static final BlockType FIRE = register("minecraft:fire", state -> state.with(state.getBlockType().getProperty("age"), 0).with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType FIRE_CORAL = register("minecraft:fire_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType FIRE_CORAL_BLOCK = register("minecraft:fire_coral_block"); - public static final BlockType FIRE_CORAL_FAN = register("minecraft:fire_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType FIRE_CORAL_WALL_FAN = register("minecraft:fire_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType FLOWER_POT = register("minecraft:flower_pot"); - public static final BlockType FROSTED_ICE = register("minecraft:frosted_ice", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType FURNACE = register("minecraft:furnace", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("lit"), false)); - public static final BlockType GLASS = register("minecraft:glass"); - public static final BlockType GLASS_PANE = register("minecraft:glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType GLOWSTONE = register("minecraft:glowstone"); - public static final BlockType GOLD_BLOCK = register("minecraft:gold_block"); - public static final BlockType GOLD_ORE = register("minecraft:gold_ore"); - public static final BlockType GRANITE = register("minecraft:granite"); - public static final BlockType GRASS = register("minecraft:grass"); - public static final BlockType GRASS_BLOCK = register("minecraft:grass_block", state -> state.with(state.getBlockType().getProperty("snowy"), false)); - public static final BlockType GRASS_PATH = register("minecraft:grass_path"); - public static final BlockType GRAVEL = register("minecraft:gravel"); - public static final BlockType GRAY_BANNER = register("minecraft:gray_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType GRAY_BED = register("minecraft:gray_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType GRAY_CARPET = register("minecraft:gray_carpet"); - public static final BlockType GRAY_CONCRETE = register("minecraft:gray_concrete"); - public static final BlockType GRAY_CONCRETE_POWDER = register("minecraft:gray_concrete_powder"); - public static final BlockType GRAY_GLAZED_TERRACOTTA = register("minecraft:gray_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType GRAY_SHULKER_BOX = register("minecraft:gray_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType GRAY_STAINED_GLASS = register("minecraft:gray_stained_glass"); - public static final BlockType GRAY_STAINED_GLASS_PANE = register("minecraft:gray_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType GRAY_TERRACOTTA = register("minecraft:gray_terracotta"); - public static final BlockType GRAY_WALL_BANNER = register("minecraft:gray_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType GRAY_WOOL = register("minecraft:gray_wool"); - public static final BlockType GREEN_BANNER = register("minecraft:green_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType GREEN_BED = register("minecraft:green_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType GREEN_CARPET = register("minecraft:green_carpet"); - public static final BlockType GREEN_CONCRETE = register("minecraft:green_concrete"); - public static final BlockType GREEN_CONCRETE_POWDER = register("minecraft:green_concrete_powder"); - public static final BlockType GREEN_GLAZED_TERRACOTTA = register("minecraft:green_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType GREEN_SHULKER_BOX = register("minecraft:green_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType GREEN_STAINED_GLASS = register("minecraft:green_stained_glass"); - public static final BlockType GREEN_STAINED_GLASS_PANE = register("minecraft:green_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType GREEN_TERRACOTTA = register("minecraft:green_terracotta"); - public static final BlockType GREEN_WALL_BANNER = register("minecraft:green_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType GREEN_WOOL = register("minecraft:green_wool"); - public static final BlockType HAY_BLOCK = register("minecraft:hay_block", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType HEAVY_WEIGHTED_PRESSURE_PLATE = register("minecraft:heavy_weighted_pressure_plate", state -> state.with(state.getBlockType().getProperty("power"), 0)); - public static final BlockType HOPPER = register("minecraft:hopper", state -> state.with(state.getBlockType().getProperty("enabled"), true).with(state.getBlockType().getProperty("facing"), Direction.DOWN)); - public static final BlockType HORN_CORAL = register("minecraft:horn_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType HORN_CORAL_BLOCK = register("minecraft:horn_coral_block"); - public static final BlockType HORN_CORAL_FAN = register("minecraft:horn_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType HORN_CORAL_WALL_FAN = register("minecraft:horn_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType ICE = register("minecraft:ice"); - public static final BlockType INFESTED_CHISELED_STONE_BRICKS = register("minecraft:infested_chiseled_stone_bricks"); - public static final BlockType INFESTED_COBBLESTONE = register("minecraft:infested_cobblestone"); - public static final BlockType INFESTED_CRACKED_STONE_BRICKS = register("minecraft:infested_cracked_stone_bricks"); - public static final BlockType INFESTED_MOSSY_STONE_BRICKS = register("minecraft:infested_mossy_stone_bricks"); - public static final BlockType INFESTED_STONE = register("minecraft:infested_stone"); - public static final BlockType INFESTED_STONE_BRICKS = register("minecraft:infested_stone_bricks"); - public static final BlockType IRON_BARS = register("minecraft:iron_bars", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType IRON_BLOCK = register("minecraft:iron_block"); - public static final BlockType IRON_DOOR = register("minecraft:iron_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType IRON_ORE = register("minecraft:iron_ore"); - public static final BlockType IRON_TRAPDOOR = register("minecraft:iron_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType JACK_O_LANTERN = register("minecraft:jack_o_lantern", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType JUKEBOX = register("minecraft:jukebox", state -> state.with(state.getBlockType().getProperty("has_record"), false)); - public static final BlockType JUNGLE_BUTTON = register("minecraft:jungle_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType JUNGLE_DOOR = register("minecraft:jungle_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType JUNGLE_FENCE = register("minecraft:jungle_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType JUNGLE_FENCE_GATE = register("minecraft:jungle_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType JUNGLE_LEAVES = register("minecraft:jungle_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); - public static final BlockType JUNGLE_LOG = register("minecraft:jungle_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType JUNGLE_PLANKS = register("minecraft:jungle_planks"); - public static final BlockType JUNGLE_PRESSURE_PLATE = register("minecraft:jungle_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType JUNGLE_SAPLING = register("minecraft:jungle_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); - public static final BlockType JUNGLE_SLAB = register("minecraft:jungle_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType JUNGLE_STAIRS = register("minecraft:jungle_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType JUNGLE_TRAPDOOR = register("minecraft:jungle_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType JUNGLE_WOOD = register("minecraft:jungle_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType KELP = register("minecraft:kelp", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType KELP_PLANT = register("minecraft:kelp_plant"); - public static final BlockType LADDER = register("minecraft:ladder", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType LAPIS_BLOCK = register("minecraft:lapis_block"); - public static final BlockType LAPIS_ORE = register("minecraft:lapis_ore"); - public static final BlockType LARGE_FERN = register("minecraft:large_fern", state -> state.with(state.getBlockType().getProperty("half"), "lower")); - public static final BlockType LAVA = register("minecraft:lava", state -> state.with(state.getBlockType().getProperty("level"), 0)); - public static final BlockType LEVER = register("minecraft:lever", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType LIGHT_BLUE_BANNER = register("minecraft:light_blue_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType LIGHT_BLUE_BED = register("minecraft:light_blue_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType LIGHT_BLUE_CARPET = register("minecraft:light_blue_carpet"); - public static final BlockType LIGHT_BLUE_CONCRETE = register("minecraft:light_blue_concrete"); - public static final BlockType LIGHT_BLUE_CONCRETE_POWDER = register("minecraft:light_blue_concrete_powder"); - public static final BlockType LIGHT_BLUE_GLAZED_TERRACOTTA = register("minecraft:light_blue_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType LIGHT_BLUE_SHULKER_BOX = register("minecraft:light_blue_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType LIGHT_BLUE_STAINED_GLASS = register("minecraft:light_blue_stained_glass"); - public static final BlockType LIGHT_BLUE_STAINED_GLASS_PANE = register("minecraft:light_blue_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType LIGHT_BLUE_TERRACOTTA = register("minecraft:light_blue_terracotta"); - public static final BlockType LIGHT_BLUE_WALL_BANNER = register("minecraft:light_blue_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType LIGHT_BLUE_WOOL = register("minecraft:light_blue_wool"); - public static final BlockType LIGHT_GRAY_BANNER = register("minecraft:light_gray_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType LIGHT_GRAY_BED = register("minecraft:light_gray_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType LIGHT_GRAY_CARPET = register("minecraft:light_gray_carpet"); - public static final BlockType LIGHT_GRAY_CONCRETE = register("minecraft:light_gray_concrete"); - public static final BlockType LIGHT_GRAY_CONCRETE_POWDER = register("minecraft:light_gray_concrete_powder"); - public static final BlockType LIGHT_GRAY_GLAZED_TERRACOTTA = register("minecraft:light_gray_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType LIGHT_GRAY_SHULKER_BOX = register("minecraft:light_gray_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType LIGHT_GRAY_STAINED_GLASS = register("minecraft:light_gray_stained_glass"); - public static final BlockType LIGHT_GRAY_STAINED_GLASS_PANE = register("minecraft:light_gray_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType LIGHT_GRAY_TERRACOTTA = register("minecraft:light_gray_terracotta"); - public static final BlockType LIGHT_GRAY_WALL_BANNER = register("minecraft:light_gray_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType LIGHT_GRAY_WOOL = register("minecraft:light_gray_wool"); - public static final BlockType LIGHT_WEIGHTED_PRESSURE_PLATE = register("minecraft:light_weighted_pressure_plate", state -> state.with(state.getBlockType().getProperty("power"), 0)); - public static final BlockType LILAC = register("minecraft:lilac", state -> state.with(state.getBlockType().getProperty("half"), "lower")); - public static final BlockType LILY_PAD = register("minecraft:lily_pad"); - public static final BlockType LIME_BANNER = register("minecraft:lime_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType LIME_BED = register("minecraft:lime_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType LIME_CARPET = register("minecraft:lime_carpet"); - public static final BlockType LIME_CONCRETE = register("minecraft:lime_concrete"); - public static final BlockType LIME_CONCRETE_POWDER = register("minecraft:lime_concrete_powder"); - public static final BlockType LIME_GLAZED_TERRACOTTA = register("minecraft:lime_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType LIME_SHULKER_BOX = register("minecraft:lime_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType LIME_STAINED_GLASS = register("minecraft:lime_stained_glass"); - public static final BlockType LIME_STAINED_GLASS_PANE = register("minecraft:lime_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType LIME_TERRACOTTA = register("minecraft:lime_terracotta"); - public static final BlockType LIME_WALL_BANNER = register("minecraft:lime_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType LIME_WOOL = register("minecraft:lime_wool"); - public static final BlockType MAGENTA_BANNER = register("minecraft:magenta_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType MAGENTA_BED = register("minecraft:magenta_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType MAGENTA_CARPET = register("minecraft:magenta_carpet"); - public static final BlockType MAGENTA_CONCRETE = register("minecraft:magenta_concrete"); - public static final BlockType MAGENTA_CONCRETE_POWDER = register("minecraft:magenta_concrete_powder"); - public static final BlockType MAGENTA_GLAZED_TERRACOTTA = register("minecraft:magenta_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType MAGENTA_SHULKER_BOX = register("minecraft:magenta_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType MAGENTA_STAINED_GLASS = register("minecraft:magenta_stained_glass"); - public static final BlockType MAGENTA_STAINED_GLASS_PANE = register("minecraft:magenta_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType MAGENTA_TERRACOTTA = register("minecraft:magenta_terracotta"); - public static final BlockType MAGENTA_WALL_BANNER = register("minecraft:magenta_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType MAGENTA_WOOL = register("minecraft:magenta_wool"); - public static final BlockType MAGMA_BLOCK = register("minecraft:magma_block"); - public static final BlockType MELON = register("minecraft:melon"); - public static final BlockType MELON_STEM = register("minecraft:melon_stem", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType MOSSY_COBBLESTONE = register("minecraft:mossy_cobblestone"); - public static final BlockType MOSSY_COBBLESTONE_WALL = register("minecraft:mossy_cobblestone_wall", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType MOSSY_STONE_BRICKS = register("minecraft:mossy_stone_bricks"); - public static final BlockType MOVING_PISTON = register("minecraft:moving_piston", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("type"), "normal")); - public static final BlockType MUSHROOM_STEM = register("minecraft:mushroom_stem", state -> state.with(state.getBlockType().getProperty("down"), true).with(state.getBlockType().getProperty("east"), true).with(state.getBlockType().getProperty("north"), true).with(state.getBlockType().getProperty("south"), true).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("west"), true)); - public static final BlockType MYCELIUM = register("minecraft:mycelium", state -> state.with(state.getBlockType().getProperty("snowy"), false)); - public static final BlockType NETHER_BRICK_FENCE = register("minecraft:nether_brick_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType NETHER_BRICK_SLAB = register("minecraft:nether_brick_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType NETHER_BRICK_STAIRS = register("minecraft:nether_brick_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType NETHER_BRICKS = register("minecraft:nether_bricks"); - public static final BlockType NETHER_PORTAL = register("minecraft:nether_portal", state -> state.with(state.getBlockType().getProperty("axis"), "x")); - public static final BlockType NETHER_QUARTZ_ORE = register("minecraft:nether_quartz_ore"); - public static final BlockType NETHER_WART = register("minecraft:nether_wart", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType NETHER_WART_BLOCK = register("minecraft:nether_wart_block"); - public static final BlockType NETHERRACK = register("minecraft:netherrack"); - public static final BlockType NOTE_BLOCK = register("minecraft:note_block", state -> state.with(state.getBlockType().getProperty("instrument"), "HARP").with(state.getBlockType().getProperty("note"), 0).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType OAK_BUTTON = register("minecraft:oak_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType OAK_DOOR = register("minecraft:oak_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType OAK_FENCE = register("minecraft:oak_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType OAK_FENCE_GATE = register("minecraft:oak_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType OAK_LEAVES = register("minecraft:oak_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); - public static final BlockType OAK_LOG = register("minecraft:oak_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType OAK_PLANKS = register("minecraft:oak_planks"); - public static final BlockType OAK_PRESSURE_PLATE = register("minecraft:oak_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType OAK_SAPLING = register("minecraft:oak_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); - public static final BlockType OAK_SLAB = register("minecraft:oak_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType OAK_STAIRS = register("minecraft:oak_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType OAK_TRAPDOOR = register("minecraft:oak_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType OAK_WOOD = register("minecraft:oak_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType OBSERVER = register("minecraft:observer", state -> state.with(state.getBlockType().getProperty("facing"), Direction.SOUTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType OBSIDIAN = register("minecraft:obsidian"); - public static final BlockType ORANGE_BANNER = register("minecraft:orange_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType ORANGE_BED = register("minecraft:orange_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType ORANGE_CARPET = register("minecraft:orange_carpet"); - public static final BlockType ORANGE_CONCRETE = register("minecraft:orange_concrete"); - public static final BlockType ORANGE_CONCRETE_POWDER = register("minecraft:orange_concrete_powder"); - public static final BlockType ORANGE_GLAZED_TERRACOTTA = register("minecraft:orange_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType ORANGE_SHULKER_BOX = register("minecraft:orange_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType ORANGE_STAINED_GLASS = register("minecraft:orange_stained_glass"); - public static final BlockType ORANGE_STAINED_GLASS_PANE = register("minecraft:orange_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType ORANGE_TERRACOTTA = register("minecraft:orange_terracotta"); - public static final BlockType ORANGE_TULIP = register("minecraft:orange_tulip"); - public static final BlockType ORANGE_WALL_BANNER = register("minecraft:orange_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType ORANGE_WOOL = register("minecraft:orange_wool"); - public static final BlockType OXEYE_DAISY = register("minecraft:oxeye_daisy"); - public static final BlockType PACKED_ICE = register("minecraft:packed_ice"); - public static final BlockType PEONY = register("minecraft:peony", state -> state.with(state.getBlockType().getProperty("half"), "lower")); - public static final BlockType PETRIFIED_OAK_SLAB = register("minecraft:petrified_oak_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType PINK_BANNER = register("minecraft:pink_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType PINK_BED = register("minecraft:pink_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType PINK_CARPET = register("minecraft:pink_carpet"); - public static final BlockType PINK_CONCRETE = register("minecraft:pink_concrete"); - public static final BlockType PINK_CONCRETE_POWDER = register("minecraft:pink_concrete_powder"); - public static final BlockType PINK_GLAZED_TERRACOTTA = register("minecraft:pink_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType PINK_SHULKER_BOX = register("minecraft:pink_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType PINK_STAINED_GLASS = register("minecraft:pink_stained_glass"); - public static final BlockType PINK_STAINED_GLASS_PANE = register("minecraft:pink_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType PINK_TERRACOTTA = register("minecraft:pink_terracotta"); - public static final BlockType PINK_TULIP = register("minecraft:pink_tulip"); - public static final BlockType PINK_WALL_BANNER = register("minecraft:pink_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType PINK_WOOL = register("minecraft:pink_wool"); - public static final BlockType PISTON = register("minecraft:piston", state -> state.with(state.getBlockType().getProperty("extended"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType PISTON_HEAD = register("minecraft:piston_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("short"), false).with(state.getBlockType().getProperty("type"), "normal")); - public static final BlockType PLAYER_HEAD = register("minecraft:player_head", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType PLAYER_WALL_HEAD = register("minecraft:player_wall_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType PODZOL = register("minecraft:podzol", state -> state.with(state.getBlockType().getProperty("snowy"), false)); - public static final BlockType POLISHED_ANDESITE = register("minecraft:polished_andesite"); - public static final BlockType POLISHED_DIORITE = register("minecraft:polished_diorite"); - public static final BlockType POLISHED_GRANITE = register("minecraft:polished_granite"); - public static final BlockType POPPY = register("minecraft:poppy"); - public static final BlockType POTATOES = register("minecraft:potatoes", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType POTTED_ACACIA_SAPLING = register("minecraft:potted_acacia_sapling"); - public static final BlockType POTTED_ALLIUM = register("minecraft:potted_allium"); - public static final BlockType POTTED_AZURE_BLUET = register("minecraft:potted_azure_bluet"); - public static final BlockType POTTED_BIRCH_SAPLING = register("minecraft:potted_birch_sapling"); - public static final BlockType POTTED_BLUE_ORCHID = register("minecraft:potted_blue_orchid"); - public static final BlockType POTTED_BROWN_MUSHROOM = register("minecraft:potted_brown_mushroom"); - public static final BlockType POTTED_CACTUS = register("minecraft:potted_cactus"); - public static final BlockType POTTED_DANDELION = register("minecraft:potted_dandelion"); - public static final BlockType POTTED_DARK_OAK_SAPLING = register("minecraft:potted_dark_oak_sapling"); - public static final BlockType POTTED_DEAD_BUSH = register("minecraft:potted_dead_bush"); - public static final BlockType POTTED_FERN = register("minecraft:potted_fern"); - public static final BlockType POTTED_JUNGLE_SAPLING = register("minecraft:potted_jungle_sapling"); - public static final BlockType POTTED_OAK_SAPLING = register("minecraft:potted_oak_sapling"); - public static final BlockType POTTED_ORANGE_TULIP = register("minecraft:potted_orange_tulip"); - public static final BlockType POTTED_OXEYE_DAISY = register("minecraft:potted_oxeye_daisy"); - public static final BlockType POTTED_PINK_TULIP = register("minecraft:potted_pink_tulip"); - public static final BlockType POTTED_POPPY = register("minecraft:potted_poppy"); - public static final BlockType POTTED_RED_MUSHROOM = register("minecraft:potted_red_mushroom"); - public static final BlockType POTTED_RED_TULIP = register("minecraft:potted_red_tulip"); - public static final BlockType POTTED_SPRUCE_SAPLING = register("minecraft:potted_spruce_sapling"); - public static final BlockType POTTED_WHITE_TULIP = register("minecraft:potted_white_tulip"); - public static final BlockType POWERED_RAIL = register("minecraft:powered_rail", state -> state.with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("shape"), "north_south")); - public static final BlockType PRISMARINE = register("minecraft:prismarine"); - public static final BlockType PRISMARINE_BRICK_SLAB = register("minecraft:prismarine_brick_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType PRISMARINE_BRICK_STAIRS = register("minecraft:prismarine_brick_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType PRISMARINE_BRICKS = register("minecraft:prismarine_bricks"); - public static final BlockType PRISMARINE_SLAB = register("minecraft:prismarine_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType PRISMARINE_STAIRS = register("minecraft:prismarine_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType PUMPKIN = register("minecraft:pumpkin"); - public static final BlockType PUMPKIN_STEM = register("minecraft:pumpkin_stem", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType PURPLE_BANNER = register("minecraft:purple_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType PURPLE_BED = register("minecraft:purple_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType PURPLE_CARPET = register("minecraft:purple_carpet"); - public static final BlockType PURPLE_CONCRETE = register("minecraft:purple_concrete"); - public static final BlockType PURPLE_CONCRETE_POWDER = register("minecraft:purple_concrete_powder"); - public static final BlockType PURPLE_GLAZED_TERRACOTTA = register("minecraft:purple_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType PURPLE_SHULKER_BOX = register("minecraft:purple_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType PURPLE_STAINED_GLASS = register("minecraft:purple_stained_glass"); - public static final BlockType PURPLE_STAINED_GLASS_PANE = register("minecraft:purple_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType PURPLE_TERRACOTTA = register("minecraft:purple_terracotta"); - public static final BlockType PURPLE_WALL_BANNER = register("minecraft:purple_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType PURPLE_WOOL = register("minecraft:purple_wool"); - public static final BlockType PURPUR_BLOCK = register("minecraft:purpur_block"); - public static final BlockType PURPUR_PILLAR = register("minecraft:purpur_pillar", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType PURPUR_SLAB = register("minecraft:purpur_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType PURPUR_STAIRS = register("minecraft:purpur_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType QUARTZ_BLOCK = register("minecraft:quartz_block"); - public static final BlockType QUARTZ_PILLAR = register("minecraft:quartz_pillar", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType QUARTZ_SLAB = register("minecraft:quartz_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType QUARTZ_STAIRS = register("minecraft:quartz_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType RAIL = register("minecraft:rail", state -> state.with(state.getBlockType().getProperty("shape"), "north_south")); - public static final BlockType RED_BANNER = register("minecraft:red_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType RED_BED = register("minecraft:red_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType RED_CARPET = register("minecraft:red_carpet"); - public static final BlockType RED_CONCRETE = register("minecraft:red_concrete"); - public static final BlockType RED_CONCRETE_POWDER = register("minecraft:red_concrete_powder"); - public static final BlockType RED_GLAZED_TERRACOTTA = register("minecraft:red_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType RED_MUSHROOM = register("minecraft:red_mushroom"); - public static final BlockType RED_MUSHROOM_BLOCK = register("minecraft:red_mushroom_block", state -> state.with(state.getBlockType().getProperty("down"), true).with(state.getBlockType().getProperty("east"), true).with(state.getBlockType().getProperty("north"), true).with(state.getBlockType().getProperty("south"), true).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("west"), true)); - public static final BlockType RED_NETHER_BRICKS = register("minecraft:red_nether_bricks"); - public static final BlockType RED_SAND = register("minecraft:red_sand"); - public static final BlockType RED_SANDSTONE = register("minecraft:red_sandstone"); - public static final BlockType RED_SANDSTONE_SLAB = register("minecraft:red_sandstone_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType RED_SANDSTONE_STAIRS = register("minecraft:red_sandstone_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType RED_SHULKER_BOX = register("minecraft:red_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType RED_STAINED_GLASS = register("minecraft:red_stained_glass"); - public static final BlockType RED_STAINED_GLASS_PANE = register("minecraft:red_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType RED_TERRACOTTA = register("minecraft:red_terracotta"); - public static final BlockType RED_TULIP = register("minecraft:red_tulip"); - public static final BlockType RED_WALL_BANNER = register("minecraft:red_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType RED_WOOL = register("minecraft:red_wool"); - public static final BlockType REDSTONE_BLOCK = register("minecraft:redstone_block"); - public static final BlockType REDSTONE_LAMP = register("minecraft:redstone_lamp", state -> state.with(state.getBlockType().getProperty("lit"), false)); - public static final BlockType REDSTONE_ORE = register("minecraft:redstone_ore", state -> state.with(state.getBlockType().getProperty("lit"), false)); - public static final BlockType REDSTONE_TORCH = register("minecraft:redstone_torch", state -> state.with(state.getBlockType().getProperty("lit"), true)); - public static final BlockType REDSTONE_WALL_TORCH = register("minecraft:redstone_wall_torch", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("lit"), true)); - public static final BlockType REDSTONE_WIRE = register("minecraft:redstone_wire", state -> state.with(state.getBlockType().getProperty("east"), "none").with(state.getBlockType().getProperty("north"), "none").with(state.getBlockType().getProperty("power"), 0).with(state.getBlockType().getProperty("south"), "none").with(state.getBlockType().getProperty("west"), "none")); - public static final BlockType REPEATER = register("minecraft:repeater", state -> state.with(state.getBlockType().getProperty("delay"), 1).with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("locked"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType REPEATING_COMMAND_BLOCK = register("minecraft:repeating_command_block", state -> state.with(state.getBlockType().getProperty("conditional"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType ROSE_BUSH = register("minecraft:rose_bush", state -> state.with(state.getBlockType().getProperty("half"), "lower")); - public static final BlockType SAND = register("minecraft:sand"); - public static final BlockType SANDSTONE = register("minecraft:sandstone"); - public static final BlockType SANDSTONE_SLAB = register("minecraft:sandstone_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType SANDSTONE_STAIRS = register("minecraft:sandstone_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType SEA_LANTERN = register("minecraft:sea_lantern"); - public static final BlockType SEA_PICKLE = register("minecraft:sea_pickle", state -> state.with(state.getBlockType().getProperty("pickles"), 1).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType SEAGRASS = register("minecraft:seagrass"); - public static final BlockType SHULKER_BOX = register("minecraft:shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType SIGN = register("minecraft:sign", state -> state.with(state.getBlockType().getProperty("rotation"), 0).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType SKELETON_SKULL = register("minecraft:skeleton_skull", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType SKELETON_WALL_SKULL = register("minecraft:skeleton_wall_skull", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType SLIME_BLOCK = register("minecraft:slime_block"); - public static final BlockType SMOOTH_QUARTZ = register("minecraft:smooth_quartz"); - public static final BlockType SMOOTH_RED_SANDSTONE = register("minecraft:smooth_red_sandstone"); - public static final BlockType SMOOTH_SANDSTONE = register("minecraft:smooth_sandstone"); - public static final BlockType SMOOTH_STONE = register("minecraft:smooth_stone"); - public static final BlockType SNOW = register("minecraft:snow", state -> state.with(state.getBlockType().getProperty("layers"), 1)); - public static final BlockType SNOW_BLOCK = register("minecraft:snow_block"); - public static final BlockType SOUL_SAND = register("minecraft:soul_sand"); - public static final BlockType SPAWNER = register("minecraft:spawner"); - public static final BlockType SPONGE = register("minecraft:sponge"); - public static final BlockType SPRUCE_BUTTON = register("minecraft:spruce_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType SPRUCE_DOOR = register("minecraft:spruce_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType SPRUCE_FENCE = register("minecraft:spruce_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType SPRUCE_FENCE_GATE = register("minecraft:spruce_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType SPRUCE_LEAVES = register("minecraft:spruce_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); - public static final BlockType SPRUCE_LOG = register("minecraft:spruce_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType SPRUCE_PLANKS = register("minecraft:spruce_planks"); - public static final BlockType SPRUCE_PRESSURE_PLATE = register("minecraft:spruce_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType SPRUCE_SAPLING = register("minecraft:spruce_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); - public static final BlockType SPRUCE_SLAB = register("minecraft:spruce_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType SPRUCE_STAIRS = register("minecraft:spruce_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType SPRUCE_TRAPDOOR = register("minecraft:spruce_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType SPRUCE_WOOD = register("minecraft:spruce_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STICKY_PISTON = register("minecraft:sticky_piston", state -> state.with(state.getBlockType().getProperty("extended"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType STONE = register("minecraft:stone"); - public static final BlockType STONE_BRICK_SLAB = register("minecraft:stone_brick_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType STONE_BRICK_STAIRS = register("minecraft:stone_brick_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType STONE_BRICKS = register("minecraft:stone_bricks"); - public static final BlockType STONE_BUTTON = register("minecraft:stone_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType STONE_PRESSURE_PLATE = register("minecraft:stone_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType STONE_SLAB = register("minecraft:stone_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType STRIPPED_ACACIA_LOG = register("minecraft:stripped_acacia_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_ACACIA_WOOD = register("minecraft:stripped_acacia_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_BIRCH_LOG = register("minecraft:stripped_birch_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_BIRCH_WOOD = register("minecraft:stripped_birch_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_DARK_OAK_LOG = register("minecraft:stripped_dark_oak_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_DARK_OAK_WOOD = register("minecraft:stripped_dark_oak_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_JUNGLE_LOG = register("minecraft:stripped_jungle_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_JUNGLE_WOOD = register("minecraft:stripped_jungle_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_OAK_LOG = register("minecraft:stripped_oak_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_OAK_WOOD = register("minecraft:stripped_oak_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_SPRUCE_LOG = register("minecraft:stripped_spruce_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRIPPED_SPRUCE_WOOD = register("minecraft:stripped_spruce_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); - public static final BlockType STRUCTURE_BLOCK = register("minecraft:structure_block", state -> state.with(state.getBlockType().getProperty("mode"), "SAVE")); - public static final BlockType STRUCTURE_VOID = register("minecraft:structure_void"); - public static final BlockType SUGAR_CANE = register("minecraft:sugar_cane", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType SUNFLOWER = register("minecraft:sunflower", state -> state.with(state.getBlockType().getProperty("half"), "lower")); - public static final BlockType TALL_GRASS = register("minecraft:tall_grass", state -> state.with(state.getBlockType().getProperty("half"), "lower")); - public static final BlockType TALL_SEAGRASS = register("minecraft:tall_seagrass", state -> state.with(state.getBlockType().getProperty("half"), "lower")); - public static final BlockType TERRACOTTA = register("minecraft:terracotta"); - public static final BlockType TNT = register("minecraft:tnt", state -> state.with(state.getBlockType().getProperty("unstable"), false)); - public static final BlockType TORCH = register("minecraft:torch"); - public static final BlockType TRAPPED_CHEST = register("minecraft:trapped_chest", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("type"), "SINGLE").with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType TRIPWIRE = register("minecraft:tripwire", state -> state.with(state.getBlockType().getProperty("attached"), false).with(state.getBlockType().getProperty("disarmed"), false).with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType TRIPWIRE_HOOK = register("minecraft:tripwire_hook", state -> state.with(state.getBlockType().getProperty("attached"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType TUBE_CORAL = register("minecraft:tube_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType TUBE_CORAL_BLOCK = register("minecraft:tube_coral_block"); - public static final BlockType TUBE_CORAL_FAN = register("minecraft:tube_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType TUBE_CORAL_WALL_FAN = register("minecraft:tube_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); - public static final BlockType TURTLE_EGG = register("minecraft:turtle_egg", state -> state.with(state.getBlockType().getProperty("eggs"), 1).with(state.getBlockType().getProperty("hatch"), 0)); - public static final BlockType VINE = register("minecraft:vine", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType VOID_AIR = register("minecraft:void_air"); - public static final BlockType WALL_SIGN = register("minecraft:wall_sign", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), false)); - public static final BlockType WALL_TORCH = register("minecraft:wall_torch", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType WATER = register("minecraft:water", state -> state.with(state.getBlockType().getProperty("level"), 0)); - public static final BlockType WET_SPONGE = register("minecraft:wet_sponge"); - public static final BlockType WHEAT = register("minecraft:wheat", state -> state.with(state.getBlockType().getProperty("age"), 0)); - public static final BlockType WHITE_BANNER = register("minecraft:white_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType WHITE_BED = register("minecraft:white_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType WHITE_CARPET = register("minecraft:white_carpet"); - public static final BlockType WHITE_CONCRETE = register("minecraft:white_concrete"); - public static final BlockType WHITE_CONCRETE_POWDER = register("minecraft:white_concrete_powder"); - public static final BlockType WHITE_GLAZED_TERRACOTTA = register("minecraft:white_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType WHITE_SHULKER_BOX = register("minecraft:white_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType WHITE_STAINED_GLASS = register("minecraft:white_stained_glass"); - public static final BlockType WHITE_STAINED_GLASS_PANE = register("minecraft:white_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType WHITE_TERRACOTTA = register("minecraft:white_terracotta"); - public static final BlockType WHITE_TULIP = register("minecraft:white_tulip"); - public static final BlockType WHITE_WALL_BANNER = register("minecraft:white_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType WHITE_WOOL = register("minecraft:white_wool"); - public static final BlockType WITHER_SKELETON_SKULL = register("minecraft:wither_skeleton_skull", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType WITHER_SKELETON_WALL_SKULL = register("minecraft:wither_skeleton_wall_skull", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType YELLOW_BANNER = register("minecraft:yellow_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType YELLOW_BED = register("minecraft:yellow_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); - public static final BlockType YELLOW_CARPET = register("minecraft:yellow_carpet"); - public static final BlockType YELLOW_CONCRETE = register("minecraft:yellow_concrete"); - public static final BlockType YELLOW_CONCRETE_POWDER = register("minecraft:yellow_concrete_powder"); - public static final BlockType YELLOW_GLAZED_TERRACOTTA = register("minecraft:yellow_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType YELLOW_SHULKER_BOX = register("minecraft:yellow_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); - public static final BlockType YELLOW_STAINED_GLASS = register("minecraft:yellow_stained_glass"); - public static final BlockType YELLOW_STAINED_GLASS_PANE = register("minecraft:yellow_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType YELLOW_TERRACOTTA = register("minecraft:yellow_terracotta"); - public static final BlockType YELLOW_WALL_BANNER = register("minecraft:yellow_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); - public static final BlockType YELLOW_WOOL = register("minecraft:yellow_wool"); - public static final BlockType ZOMBIE_HEAD = register("minecraft:zombie_head", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); - public static final BlockType ZOMBIE_WALL_HEAD = register("minecraft:zombie_wall_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + @Nullable public static final BlockType ACACIA_BUTTON = get("minecraft:acacia_button"); + @Nullable public static final BlockType ACACIA_DOOR = get("minecraft:acacia_door"); + @Nullable public static final BlockType ACACIA_FENCE = get("minecraft:acacia_fence"); + @Nullable public static final BlockType ACACIA_FENCE_GATE = get("minecraft:acacia_fence_gate"); + @Nullable public static final BlockType ACACIA_LEAVES = get("minecraft:acacia_leaves"); + @Nullable public static final BlockType ACACIA_LOG = get("minecraft:acacia_log"); + @Nullable public static final BlockType ACACIA_PLANKS = get("minecraft:acacia_planks"); + @Nullable public static final BlockType ACACIA_PRESSURE_PLATE = get("minecraft:acacia_pressure_plate"); + @Nullable public static final BlockType ACACIA_SAPLING = get("minecraft:acacia_sapling"); + @Nullable public static final BlockType ACACIA_SLAB = get("minecraft:acacia_slab"); + @Nullable public static final BlockType ACACIA_STAIRS = get("minecraft:acacia_stairs"); + @Nullable public static final BlockType ACACIA_TRAPDOOR = get("minecraft:acacia_trapdoor"); + @Nullable public static final BlockType ACACIA_WOOD = get("minecraft:acacia_wood"); + @Nullable public static final BlockType ACTIVATOR_RAIL = get("minecraft:activator_rail"); + @Nullable public static final BlockType AIR = get("minecraft:air"); + @Nullable public static final BlockType ALLIUM = get("minecraft:allium"); + @Nullable public static final BlockType ANDESITE = get("minecraft:andesite"); + @Nullable public static final BlockType ANVIL = get("minecraft:anvil"); + @Nullable public static final BlockType ATTACHED_MELON_STEM = get("minecraft:attached_melon_stem"); + @Nullable public static final BlockType ATTACHED_PUMPKIN_STEM = get("minecraft:attached_pumpkin_stem"); + @Nullable public static final BlockType AZURE_BLUET = get("minecraft:azure_bluet"); + @Nullable public static final BlockType BARRIER = get("minecraft:barrier"); + @Nullable public static final BlockType BEACON = get("minecraft:beacon"); + @Nullable public static final BlockType BEDROCK = get("minecraft:bedrock"); + @Nullable public static final BlockType BEETROOTS = get("minecraft:beetroots"); + @Nullable public static final BlockType BIRCH_BUTTON = get("minecraft:birch_button"); + @Nullable public static final BlockType BIRCH_DOOR = get("minecraft:birch_door"); + @Nullable public static final BlockType BIRCH_FENCE = get("minecraft:birch_fence"); + @Nullable public static final BlockType BIRCH_FENCE_GATE = get("minecraft:birch_fence_gate"); + @Nullable public static final BlockType BIRCH_LEAVES = get("minecraft:birch_leaves"); + @Nullable public static final BlockType BIRCH_LOG = get("minecraft:birch_log"); + @Nullable public static final BlockType BIRCH_PLANKS = get("minecraft:birch_planks"); + @Nullable public static final BlockType BIRCH_PRESSURE_PLATE = get("minecraft:birch_pressure_plate"); + @Nullable public static final BlockType BIRCH_SAPLING = get("minecraft:birch_sapling"); + @Nullable public static final BlockType BIRCH_SLAB = get("minecraft:birch_slab"); + @Nullable public static final BlockType BIRCH_STAIRS = get("minecraft:birch_stairs"); + @Nullable public static final BlockType BIRCH_TRAPDOOR = get("minecraft:birch_trapdoor"); + @Nullable public static final BlockType BIRCH_WOOD = get("minecraft:birch_wood"); + @Nullable public static final BlockType BLACK_BANNER = get("minecraft:black_banner"); + @Nullable public static final BlockType BLACK_BED = get("minecraft:black_bed"); + @Nullable public static final BlockType BLACK_CARPET = get("minecraft:black_carpet"); + @Nullable public static final BlockType BLACK_CONCRETE = get("minecraft:black_concrete"); + @Nullable public static final BlockType BLACK_CONCRETE_POWDER = get("minecraft:black_concrete_powder"); + @Nullable public static final BlockType BLACK_GLAZED_TERRACOTTA = get("minecraft:black_glazed_terracotta"); + @Nullable public static final BlockType BLACK_SHULKER_BOX = get("minecraft:black_shulker_box"); + @Nullable public static final BlockType BLACK_STAINED_GLASS = get("minecraft:black_stained_glass"); + @Nullable public static final BlockType BLACK_STAINED_GLASS_PANE = get("minecraft:black_stained_glass_pane"); + @Nullable public static final BlockType BLACK_TERRACOTTA = get("minecraft:black_terracotta"); + @Nullable public static final BlockType BLACK_WALL_BANNER = get("minecraft:black_wall_banner"); + @Nullable public static final BlockType BLACK_WOOL = get("minecraft:black_wool"); + @Nullable public static final BlockType BLUE_BANNER = get("minecraft:blue_banner"); + @Nullable public static final BlockType BLUE_BED = get("minecraft:blue_bed"); + @Nullable public static final BlockType BLUE_CARPET = get("minecraft:blue_carpet"); + @Nullable public static final BlockType BLUE_CONCRETE = get("minecraft:blue_concrete"); + @Nullable public static final BlockType BLUE_CONCRETE_POWDER = get("minecraft:blue_concrete_powder"); + @Nullable public static final BlockType BLUE_GLAZED_TERRACOTTA = get("minecraft:blue_glazed_terracotta"); + @Nullable public static final BlockType BLUE_ICE = get("minecraft:blue_ice"); + @Nullable public static final BlockType BLUE_ORCHID = get("minecraft:blue_orchid"); + @Nullable public static final BlockType BLUE_SHULKER_BOX = get("minecraft:blue_shulker_box"); + @Nullable public static final BlockType BLUE_STAINED_GLASS = get("minecraft:blue_stained_glass"); + @Nullable public static final BlockType BLUE_STAINED_GLASS_PANE = get("minecraft:blue_stained_glass_pane"); + @Nullable public static final BlockType BLUE_TERRACOTTA = get("minecraft:blue_terracotta"); + @Nullable public static final BlockType BLUE_WALL_BANNER = get("minecraft:blue_wall_banner"); + @Nullable public static final BlockType BLUE_WOOL = get("minecraft:blue_wool"); + @Nullable public static final BlockType BONE_BLOCK = get("minecraft:bone_block"); + @Nullable public static final BlockType BOOKSHELF = get("minecraft:bookshelf"); + @Nullable public static final BlockType BRAIN_CORAL = get("minecraft:brain_coral"); + @Nullable public static final BlockType BRAIN_CORAL_BLOCK = get("minecraft:brain_coral_block"); + @Nullable public static final BlockType BRAIN_CORAL_FAN = get("minecraft:brain_coral_fan"); + @Nullable public static final BlockType BRAIN_CORAL_WALL_FAN = get("minecraft:brain_coral_wall_fan"); + @Nullable public static final BlockType BREWING_STAND = get("minecraft:brewing_stand"); + @Nullable public static final BlockType BRICK_SLAB = get("minecraft:brick_slab"); + @Nullable public static final BlockType BRICK_STAIRS = get("minecraft:brick_stairs"); + @Nullable public static final BlockType BRICKS = get("minecraft:bricks"); + @Nullable public static final BlockType BROWN_BANNER = get("minecraft:brown_banner"); + @Nullable public static final BlockType BROWN_BED = get("minecraft:brown_bed"); + @Nullable public static final BlockType BROWN_CARPET = get("minecraft:brown_carpet"); + @Nullable public static final BlockType BROWN_CONCRETE = get("minecraft:brown_concrete"); + @Nullable public static final BlockType BROWN_CONCRETE_POWDER = get("minecraft:brown_concrete_powder"); + @Nullable public static final BlockType BROWN_GLAZED_TERRACOTTA = get("minecraft:brown_glazed_terracotta"); + @Nullable public static final BlockType BROWN_MUSHROOM = get("minecraft:brown_mushroom"); + @Nullable public static final BlockType BROWN_MUSHROOM_BLOCK = get("minecraft:brown_mushroom_block"); + @Nullable public static final BlockType BROWN_SHULKER_BOX = get("minecraft:brown_shulker_box"); + @Nullable public static final BlockType BROWN_STAINED_GLASS = get("minecraft:brown_stained_glass"); + @Nullable public static final BlockType BROWN_STAINED_GLASS_PANE = get("minecraft:brown_stained_glass_pane"); + @Nullable public static final BlockType BROWN_TERRACOTTA = get("minecraft:brown_terracotta"); + @Nullable public static final BlockType BROWN_WALL_BANNER = get("minecraft:brown_wall_banner"); + @Nullable public static final BlockType BROWN_WOOL = get("minecraft:brown_wool"); + @Nullable public static final BlockType BUBBLE_COLUMN = get("minecraft:bubble_column"); + @Nullable public static final BlockType BUBBLE_CORAL = get("minecraft:bubble_coral"); + @Nullable public static final BlockType BUBBLE_CORAL_BLOCK = get("minecraft:bubble_coral_block"); + @Nullable public static final BlockType BUBBLE_CORAL_FAN = get("minecraft:bubble_coral_fan"); + @Nullable public static final BlockType BUBBLE_CORAL_WALL_FAN = get("minecraft:bubble_coral_wall_fan"); + @Nullable public static final BlockType CACTUS = get("minecraft:cactus"); + @Nullable public static final BlockType CAKE = get("minecraft:cake"); + @Nullable public static final BlockType CARROTS = get("minecraft:carrots"); + @Nullable public static final BlockType CARVED_PUMPKIN = get("minecraft:carved_pumpkin"); + @Nullable public static final BlockType CAULDRON = get("minecraft:cauldron"); + @Nullable public static final BlockType CAVE_AIR = get("minecraft:cave_air"); + @Nullable public static final BlockType CHAIN_COMMAND_BLOCK = get("minecraft:chain_command_block"); + @Nullable public static final BlockType CHEST = get("minecraft:chest"); + @Nullable public static final BlockType CHIPPED_ANVIL = get("minecraft:chipped_anvil"); + @Nullable public static final BlockType CHISELED_QUARTZ_BLOCK = get("minecraft:chiseled_quartz_block"); + @Nullable public static final BlockType CHISELED_RED_SANDSTONE = get("minecraft:chiseled_red_sandstone"); + @Nullable public static final BlockType CHISELED_SANDSTONE = get("minecraft:chiseled_sandstone"); + @Nullable public static final BlockType CHISELED_STONE_BRICKS = get("minecraft:chiseled_stone_bricks"); + @Nullable public static final BlockType CHORUS_FLOWER = get("minecraft:chorus_flower"); + @Nullable public static final BlockType CHORUS_PLANT = get("minecraft:chorus_plant"); + @Nullable public static final BlockType CLAY = get("minecraft:clay"); + @Nullable public static final BlockType COAL_BLOCK = get("minecraft:coal_block"); + @Nullable public static final BlockType COAL_ORE = get("minecraft:coal_ore"); + @Nullable public static final BlockType COARSE_DIRT = get("minecraft:coarse_dirt"); + @Nullable public static final BlockType COBBLESTONE = get("minecraft:cobblestone"); + @Nullable public static final BlockType COBBLESTONE_SLAB = get("minecraft:cobblestone_slab"); + @Nullable public static final BlockType COBBLESTONE_STAIRS = get("minecraft:cobblestone_stairs"); + @Nullable public static final BlockType COBBLESTONE_WALL = get("minecraft:cobblestone_wall"); + @Nullable public static final BlockType COBWEB = get("minecraft:cobweb"); + @Nullable public static final BlockType COCOA = get("minecraft:cocoa"); + @Nullable public static final BlockType COMMAND_BLOCK = get("minecraft:command_block"); + @Nullable public static final BlockType COMPARATOR = get("minecraft:comparator"); + @Nullable public static final BlockType CONDUIT = get("minecraft:conduit"); + @Nullable public static final BlockType CRACKED_STONE_BRICKS = get("minecraft:cracked_stone_bricks"); + @Nullable public static final BlockType CRAFTING_TABLE = get("minecraft:crafting_table"); + @Nullable public static final BlockType CREEPER_HEAD = get("minecraft:creeper_head"); + @Nullable public static final BlockType CREEPER_WALL_HEAD = get("minecraft:creeper_wall_head"); + @Nullable public static final BlockType CUT_RED_SANDSTONE = get("minecraft:cut_red_sandstone"); + @Nullable public static final BlockType CUT_SANDSTONE = get("minecraft:cut_sandstone"); + @Nullable public static final BlockType CYAN_BANNER = get("minecraft:cyan_banner"); + @Nullable public static final BlockType CYAN_BED = get("minecraft:cyan_bed"); + @Nullable public static final BlockType CYAN_CARPET = get("minecraft:cyan_carpet"); + @Nullable public static final BlockType CYAN_CONCRETE = get("minecraft:cyan_concrete"); + @Nullable public static final BlockType CYAN_CONCRETE_POWDER = get("minecraft:cyan_concrete_powder"); + @Nullable public static final BlockType CYAN_GLAZED_TERRACOTTA = get("minecraft:cyan_glazed_terracotta"); + @Nullable public static final BlockType CYAN_SHULKER_BOX = get("minecraft:cyan_shulker_box"); + @Nullable public static final BlockType CYAN_STAINED_GLASS = get("minecraft:cyan_stained_glass"); + @Nullable public static final BlockType CYAN_STAINED_GLASS_PANE = get("minecraft:cyan_stained_glass_pane"); + @Nullable public static final BlockType CYAN_TERRACOTTA = get("minecraft:cyan_terracotta"); + @Nullable public static final BlockType CYAN_WALL_BANNER = get("minecraft:cyan_wall_banner"); + @Nullable public static final BlockType CYAN_WOOL = get("minecraft:cyan_wool"); + @Nullable public static final BlockType DAMAGED_ANVIL = get("minecraft:damaged_anvil"); + @Nullable public static final BlockType DANDELION = get("minecraft:dandelion"); + @Nullable public static final BlockType DARK_OAK_BUTTON = get("minecraft:dark_oak_button"); + @Nullable public static final BlockType DARK_OAK_DOOR = get("minecraft:dark_oak_door"); + @Nullable public static final BlockType DARK_OAK_FENCE = get("minecraft:dark_oak_fence"); + @Nullable public static final BlockType DARK_OAK_FENCE_GATE = get("minecraft:dark_oak_fence_gate"); + @Nullable public static final BlockType DARK_OAK_LEAVES = get("minecraft:dark_oak_leaves"); + @Nullable public static final BlockType DARK_OAK_LOG = get("minecraft:dark_oak_log"); + @Nullable public static final BlockType DARK_OAK_PLANKS = get("minecraft:dark_oak_planks"); + @Nullable public static final BlockType DARK_OAK_PRESSURE_PLATE = get("minecraft:dark_oak_pressure_plate"); + @Nullable public static final BlockType DARK_OAK_SAPLING = get("minecraft:dark_oak_sapling"); + @Nullable public static final BlockType DARK_OAK_SLAB = get("minecraft:dark_oak_slab"); + @Nullable public static final BlockType DARK_OAK_STAIRS = get("minecraft:dark_oak_stairs"); + @Nullable public static final BlockType DARK_OAK_TRAPDOOR = get("minecraft:dark_oak_trapdoor"); + @Nullable public static final BlockType DARK_OAK_WOOD = get("minecraft:dark_oak_wood"); + @Nullable public static final BlockType DARK_PRISMARINE = get("minecraft:dark_prismarine"); + @Nullable public static final BlockType DARK_PRISMARINE_SLAB = get("minecraft:dark_prismarine_slab"); + @Nullable public static final BlockType DARK_PRISMARINE_STAIRS = get("minecraft:dark_prismarine_stairs"); + @Nullable public static final BlockType DAYLIGHT_DETECTOR = get("minecraft:daylight_detector"); + @Nullable public static final BlockType DEAD_BRAIN_CORAL = get("minecraft:dead_brain_coral"); + @Nullable public static final BlockType DEAD_BRAIN_CORAL_BLOCK = get("minecraft:dead_brain_coral_block"); + @Nullable public static final BlockType DEAD_BRAIN_CORAL_FAN = get("minecraft:dead_brain_coral_fan"); + @Nullable public static final BlockType DEAD_BRAIN_CORAL_WALL_FAN = get("minecraft:dead_brain_coral_wall_fan"); + @Nullable public static final BlockType DEAD_BUBBLE_CORAL = get("minecraft:dead_bubble_coral"); + @Nullable public static final BlockType DEAD_BUBBLE_CORAL_BLOCK = get("minecraft:dead_bubble_coral_block"); + @Nullable public static final BlockType DEAD_BUBBLE_CORAL_FAN = get("minecraft:dead_bubble_coral_fan"); + @Nullable public static final BlockType DEAD_BUBBLE_CORAL_WALL_FAN = get("minecraft:dead_bubble_coral_wall_fan"); + @Nullable public static final BlockType DEAD_BUSH = get("minecraft:dead_bush"); + @Nullable public static final BlockType DEAD_FIRE_CORAL = get("minecraft:dead_fire_coral"); + @Nullable public static final BlockType DEAD_FIRE_CORAL_BLOCK = get("minecraft:dead_fire_coral_block"); + @Nullable public static final BlockType DEAD_FIRE_CORAL_FAN = get("minecraft:dead_fire_coral_fan"); + @Nullable public static final BlockType DEAD_FIRE_CORAL_WALL_FAN = get("minecraft:dead_fire_coral_wall_fan"); + @Nullable public static final BlockType DEAD_HORN_CORAL = get("minecraft:dead_horn_coral"); + @Nullable public static final BlockType DEAD_HORN_CORAL_BLOCK = get("minecraft:dead_horn_coral_block"); + @Nullable public static final BlockType DEAD_HORN_CORAL_FAN = get("minecraft:dead_horn_coral_fan"); + @Nullable public static final BlockType DEAD_HORN_CORAL_WALL_FAN = get("minecraft:dead_horn_coral_wall_fan"); + @Nullable public static final BlockType DEAD_TUBE_CORAL = get("minecraft:dead_tube_coral"); + @Nullable public static final BlockType DEAD_TUBE_CORAL_BLOCK = get("minecraft:dead_tube_coral_block"); + @Nullable public static final BlockType DEAD_TUBE_CORAL_FAN = get("minecraft:dead_tube_coral_fan"); + @Nullable public static final BlockType DEAD_TUBE_CORAL_WALL_FAN = get("minecraft:dead_tube_coral_wall_fan"); + @Nullable public static final BlockType DETECTOR_RAIL = get("minecraft:detector_rail"); + @Nullable public static final BlockType DIAMOND_BLOCK = get("minecraft:diamond_block"); + @Nullable public static final BlockType DIAMOND_ORE = get("minecraft:diamond_ore"); + @Nullable public static final BlockType DIORITE = get("minecraft:diorite"); + @Nullable public static final BlockType DIRT = get("minecraft:dirt"); + @Nullable public static final BlockType DISPENSER = get("minecraft:dispenser"); + @Nullable public static final BlockType DRAGON_EGG = get("minecraft:dragon_egg"); + @Nullable public static final BlockType DRAGON_HEAD = get("minecraft:dragon_head"); + @Nullable public static final BlockType DRAGON_WALL_HEAD = get("minecraft:dragon_wall_head"); + @Nullable public static final BlockType DRIED_KELP_BLOCK = get("minecraft:dried_kelp_block"); + @Nullable public static final BlockType DROPPER = get("minecraft:dropper"); + @Nullable public static final BlockType EMERALD_BLOCK = get("minecraft:emerald_block"); + @Nullable public static final BlockType EMERALD_ORE = get("minecraft:emerald_ore"); + @Nullable public static final BlockType ENCHANTING_TABLE = get("minecraft:enchanting_table"); + @Nullable public static final BlockType END_GATEWAY = get("minecraft:end_gateway"); + @Nullable public static final BlockType END_PORTAL = get("minecraft:end_portal"); + @Nullable public static final BlockType END_PORTAL_FRAME = get("minecraft:end_portal_frame"); + @Nullable public static final BlockType END_ROD = get("minecraft:end_rod"); + @Nullable public static final BlockType END_STONE = get("minecraft:end_stone"); + @Nullable public static final BlockType END_STONE_BRICKS = get("minecraft:end_stone_bricks"); + @Nullable public static final BlockType ENDER_CHEST = get("minecraft:ender_chest"); + @Nullable public static final BlockType FARMLAND = get("minecraft:farmland"); + @Nullable public static final BlockType FERN = get("minecraft:fern"); + @Nullable public static final BlockType FIRE = get("minecraft:fire"); + @Nullable public static final BlockType FIRE_CORAL = get("minecraft:fire_coral"); + @Nullable public static final BlockType FIRE_CORAL_BLOCK = get("minecraft:fire_coral_block"); + @Nullable public static final BlockType FIRE_CORAL_FAN = get("minecraft:fire_coral_fan"); + @Nullable public static final BlockType FIRE_CORAL_WALL_FAN = get("minecraft:fire_coral_wall_fan"); + @Nullable public static final BlockType FLOWER_POT = get("minecraft:flower_pot"); + @Nullable public static final BlockType FROSTED_ICE = get("minecraft:frosted_ice"); + @Nullable public static final BlockType FURNACE = get("minecraft:furnace"); + @Nullable public static final BlockType GLASS = get("minecraft:glass"); + @Nullable public static final BlockType GLASS_PANE = get("minecraft:glass_pane"); + @Nullable public static final BlockType GLOWSTONE = get("minecraft:glowstone"); + @Nullable public static final BlockType GOLD_BLOCK = get("minecraft:gold_block"); + @Nullable public static final BlockType GOLD_ORE = get("minecraft:gold_ore"); + @Nullable public static final BlockType GRANITE = get("minecraft:granite"); + @Nullable public static final BlockType GRASS = get("minecraft:grass"); + @Nullable public static final BlockType GRASS_BLOCK = get("minecraft:grass_block"); + @Nullable public static final BlockType GRASS_PATH = get("minecraft:grass_path"); + @Nullable public static final BlockType GRAVEL = get("minecraft:gravel"); + @Nullable public static final BlockType GRAY_BANNER = get("minecraft:gray_banner"); + @Nullable public static final BlockType GRAY_BED = get("minecraft:gray_bed"); + @Nullable public static final BlockType GRAY_CARPET = get("minecraft:gray_carpet"); + @Nullable public static final BlockType GRAY_CONCRETE = get("minecraft:gray_concrete"); + @Nullable public static final BlockType GRAY_CONCRETE_POWDER = get("minecraft:gray_concrete_powder"); + @Nullable public static final BlockType GRAY_GLAZED_TERRACOTTA = get("minecraft:gray_glazed_terracotta"); + @Nullable public static final BlockType GRAY_SHULKER_BOX = get("minecraft:gray_shulker_box"); + @Nullable public static final BlockType GRAY_STAINED_GLASS = get("minecraft:gray_stained_glass"); + @Nullable public static final BlockType GRAY_STAINED_GLASS_PANE = get("minecraft:gray_stained_glass_pane"); + @Nullable public static final BlockType GRAY_TERRACOTTA = get("minecraft:gray_terracotta"); + @Nullable public static final BlockType GRAY_WALL_BANNER = get("minecraft:gray_wall_banner"); + @Nullable public static final BlockType GRAY_WOOL = get("minecraft:gray_wool"); + @Nullable public static final BlockType GREEN_BANNER = get("minecraft:green_banner"); + @Nullable public static final BlockType GREEN_BED = get("minecraft:green_bed"); + @Nullable public static final BlockType GREEN_CARPET = get("minecraft:green_carpet"); + @Nullable public static final BlockType GREEN_CONCRETE = get("minecraft:green_concrete"); + @Nullable public static final BlockType GREEN_CONCRETE_POWDER = get("minecraft:green_concrete_powder"); + @Nullable public static final BlockType GREEN_GLAZED_TERRACOTTA = get("minecraft:green_glazed_terracotta"); + @Nullable public static final BlockType GREEN_SHULKER_BOX = get("minecraft:green_shulker_box"); + @Nullable public static final BlockType GREEN_STAINED_GLASS = get("minecraft:green_stained_glass"); + @Nullable public static final BlockType GREEN_STAINED_GLASS_PANE = get("minecraft:green_stained_glass_pane"); + @Nullable public static final BlockType GREEN_TERRACOTTA = get("minecraft:green_terracotta"); + @Nullable public static final BlockType GREEN_WALL_BANNER = get("minecraft:green_wall_banner"); + @Nullable public static final BlockType GREEN_WOOL = get("minecraft:green_wool"); + @Nullable public static final BlockType HAY_BLOCK = get("minecraft:hay_block"); + @Nullable public static final BlockType HEAVY_WEIGHTED_PRESSURE_PLATE = get("minecraft:heavy_weighted_pressure_plate"); + @Nullable public static final BlockType HOPPER = get("minecraft:hopper"); + @Nullable public static final BlockType HORN_CORAL = get("minecraft:horn_coral"); + @Nullable public static final BlockType HORN_CORAL_BLOCK = get("minecraft:horn_coral_block"); + @Nullable public static final BlockType HORN_CORAL_FAN = get("minecraft:horn_coral_fan"); + @Nullable public static final BlockType HORN_CORAL_WALL_FAN = get("minecraft:horn_coral_wall_fan"); + @Nullable public static final BlockType ICE = get("minecraft:ice"); + @Nullable public static final BlockType INFESTED_CHISELED_STONE_BRICKS = get("minecraft:infested_chiseled_stone_bricks"); + @Nullable public static final BlockType INFESTED_COBBLESTONE = get("minecraft:infested_cobblestone"); + @Nullable public static final BlockType INFESTED_CRACKED_STONE_BRICKS = get("minecraft:infested_cracked_stone_bricks"); + @Nullable public static final BlockType INFESTED_MOSSY_STONE_BRICKS = get("minecraft:infested_mossy_stone_bricks"); + @Nullable public static final BlockType INFESTED_STONE = get("minecraft:infested_stone"); + @Nullable public static final BlockType INFESTED_STONE_BRICKS = get("minecraft:infested_stone_bricks"); + @Nullable public static final BlockType IRON_BARS = get("minecraft:iron_bars"); + @Nullable public static final BlockType IRON_BLOCK = get("minecraft:iron_block"); + @Nullable public static final BlockType IRON_DOOR = get("minecraft:iron_door"); + @Nullable public static final BlockType IRON_ORE = get("minecraft:iron_ore"); + @Nullable public static final BlockType IRON_TRAPDOOR = get("minecraft:iron_trapdoor"); + @Nullable public static final BlockType JACK_O_LANTERN = get("minecraft:jack_o_lantern"); + @Nullable public static final BlockType JUKEBOX = get("minecraft:jukebox"); + @Nullable public static final BlockType JUNGLE_BUTTON = get("minecraft:jungle_button"); + @Nullable public static final BlockType JUNGLE_DOOR = get("minecraft:jungle_door"); + @Nullable public static final BlockType JUNGLE_FENCE = get("minecraft:jungle_fence"); + @Nullable public static final BlockType JUNGLE_FENCE_GATE = get("minecraft:jungle_fence_gate"); + @Nullable public static final BlockType JUNGLE_LEAVES = get("minecraft:jungle_leaves"); + @Nullable public static final BlockType JUNGLE_LOG = get("minecraft:jungle_log"); + @Nullable public static final BlockType JUNGLE_PLANKS = get("minecraft:jungle_planks"); + @Nullable public static final BlockType JUNGLE_PRESSURE_PLATE = get("minecraft:jungle_pressure_plate"); + @Nullable public static final BlockType JUNGLE_SAPLING = get("minecraft:jungle_sapling"); + @Nullable public static final BlockType JUNGLE_SLAB = get("minecraft:jungle_slab"); + @Nullable public static final BlockType JUNGLE_STAIRS = get("minecraft:jungle_stairs"); + @Nullable public static final BlockType JUNGLE_TRAPDOOR = get("minecraft:jungle_trapdoor"); + @Nullable public static final BlockType JUNGLE_WOOD = get("minecraft:jungle_wood"); + @Nullable public static final BlockType KELP = get("minecraft:kelp"); + @Nullable public static final BlockType KELP_PLANT = get("minecraft:kelp_plant"); + @Nullable public static final BlockType LADDER = get("minecraft:ladder"); + @Nullable public static final BlockType LAPIS_BLOCK = get("minecraft:lapis_block"); + @Nullable public static final BlockType LAPIS_ORE = get("minecraft:lapis_ore"); + @Nullable public static final BlockType LARGE_FERN = get("minecraft:large_fern"); + @Nullable public static final BlockType LAVA = get("minecraft:lava"); + @Nullable public static final BlockType LEVER = get("minecraft:lever"); + @Nullable public static final BlockType LIGHT_BLUE_BANNER = get("minecraft:light_blue_banner"); + @Nullable public static final BlockType LIGHT_BLUE_BED = get("minecraft:light_blue_bed"); + @Nullable public static final BlockType LIGHT_BLUE_CARPET = get("minecraft:light_blue_carpet"); + @Nullable public static final BlockType LIGHT_BLUE_CONCRETE = get("minecraft:light_blue_concrete"); + @Nullable public static final BlockType LIGHT_BLUE_CONCRETE_POWDER = get("minecraft:light_blue_concrete_powder"); + @Nullable public static final BlockType LIGHT_BLUE_GLAZED_TERRACOTTA = get("minecraft:light_blue_glazed_terracotta"); + @Nullable public static final BlockType LIGHT_BLUE_SHULKER_BOX = get("minecraft:light_blue_shulker_box"); + @Nullable public static final BlockType LIGHT_BLUE_STAINED_GLASS = get("minecraft:light_blue_stained_glass"); + @Nullable public static final BlockType LIGHT_BLUE_STAINED_GLASS_PANE = get("minecraft:light_blue_stained_glass_pane"); + @Nullable public static final BlockType LIGHT_BLUE_TERRACOTTA = get("minecraft:light_blue_terracotta"); + @Nullable public static final BlockType LIGHT_BLUE_WALL_BANNER = get("minecraft:light_blue_wall_banner"); + @Nullable public static final BlockType LIGHT_BLUE_WOOL = get("minecraft:light_blue_wool"); + @Nullable public static final BlockType LIGHT_GRAY_BANNER = get("minecraft:light_gray_banner"); + @Nullable public static final BlockType LIGHT_GRAY_BED = get("minecraft:light_gray_bed"); + @Nullable public static final BlockType LIGHT_GRAY_CARPET = get("minecraft:light_gray_carpet"); + @Nullable public static final BlockType LIGHT_GRAY_CONCRETE = get("minecraft:light_gray_concrete"); + @Nullable public static final BlockType LIGHT_GRAY_CONCRETE_POWDER = get("minecraft:light_gray_concrete_powder"); + @Nullable public static final BlockType LIGHT_GRAY_GLAZED_TERRACOTTA = get("minecraft:light_gray_glazed_terracotta"); + @Nullable public static final BlockType LIGHT_GRAY_SHULKER_BOX = get("minecraft:light_gray_shulker_box"); + @Nullable public static final BlockType LIGHT_GRAY_STAINED_GLASS = get("minecraft:light_gray_stained_glass"); + @Nullable public static final BlockType LIGHT_GRAY_STAINED_GLASS_PANE = get("minecraft:light_gray_stained_glass_pane"); + @Nullable public static final BlockType LIGHT_GRAY_TERRACOTTA = get("minecraft:light_gray_terracotta"); + @Nullable public static final BlockType LIGHT_GRAY_WALL_BANNER = get("minecraft:light_gray_wall_banner"); + @Nullable public static final BlockType LIGHT_GRAY_WOOL = get("minecraft:light_gray_wool"); + @Nullable public static final BlockType LIGHT_WEIGHTED_PRESSURE_PLATE = get("minecraft:light_weighted_pressure_plate"); + @Nullable public static final BlockType LILAC = get("minecraft:lilac"); + @Nullable public static final BlockType LILY_PAD = get("minecraft:lily_pad"); + @Nullable public static final BlockType LIME_BANNER = get("minecraft:lime_banner"); + @Nullable public static final BlockType LIME_BED = get("minecraft:lime_bed"); + @Nullable public static final BlockType LIME_CARPET = get("minecraft:lime_carpet"); + @Nullable public static final BlockType LIME_CONCRETE = get("minecraft:lime_concrete"); + @Nullable public static final BlockType LIME_CONCRETE_POWDER = get("minecraft:lime_concrete_powder"); + @Nullable public static final BlockType LIME_GLAZED_TERRACOTTA = get("minecraft:lime_glazed_terracotta"); + @Nullable public static final BlockType LIME_SHULKER_BOX = get("minecraft:lime_shulker_box"); + @Nullable public static final BlockType LIME_STAINED_GLASS = get("minecraft:lime_stained_glass"); + @Nullable public static final BlockType LIME_STAINED_GLASS_PANE = get("minecraft:lime_stained_glass_pane"); + @Nullable public static final BlockType LIME_TERRACOTTA = get("minecraft:lime_terracotta"); + @Nullable public static final BlockType LIME_WALL_BANNER = get("minecraft:lime_wall_banner"); + @Nullable public static final BlockType LIME_WOOL = get("minecraft:lime_wool"); + @Nullable public static final BlockType MAGENTA_BANNER = get("minecraft:magenta_banner"); + @Nullable public static final BlockType MAGENTA_BED = get("minecraft:magenta_bed"); + @Nullable public static final BlockType MAGENTA_CARPET = get("minecraft:magenta_carpet"); + @Nullable public static final BlockType MAGENTA_CONCRETE = get("minecraft:magenta_concrete"); + @Nullable public static final BlockType MAGENTA_CONCRETE_POWDER = get("minecraft:magenta_concrete_powder"); + @Nullable public static final BlockType MAGENTA_GLAZED_TERRACOTTA = get("minecraft:magenta_glazed_terracotta"); + @Nullable public static final BlockType MAGENTA_SHULKER_BOX = get("minecraft:magenta_shulker_box"); + @Nullable public static final BlockType MAGENTA_STAINED_GLASS = get("minecraft:magenta_stained_glass"); + @Nullable public static final BlockType MAGENTA_STAINED_GLASS_PANE = get("minecraft:magenta_stained_glass_pane"); + @Nullable public static final BlockType MAGENTA_TERRACOTTA = get("minecraft:magenta_terracotta"); + @Nullable public static final BlockType MAGENTA_WALL_BANNER = get("minecraft:magenta_wall_banner"); + @Nullable public static final BlockType MAGENTA_WOOL = get("minecraft:magenta_wool"); + @Nullable public static final BlockType MAGMA_BLOCK = get("minecraft:magma_block"); + @Nullable public static final BlockType MELON = get("minecraft:melon"); + @Nullable public static final BlockType MELON_STEM = get("minecraft:melon_stem"); + @Nullable public static final BlockType MOSSY_COBBLESTONE = get("minecraft:mossy_cobblestone"); + @Nullable public static final BlockType MOSSY_COBBLESTONE_WALL = get("minecraft:mossy_cobblestone_wall"); + @Nullable public static final BlockType MOSSY_STONE_BRICKS = get("minecraft:mossy_stone_bricks"); + @Nullable public static final BlockType MOVING_PISTON = get("minecraft:moving_piston"); + @Nullable public static final BlockType MUSHROOM_STEM = get("minecraft:mushroom_stem"); + @Nullable public static final BlockType MYCELIUM = get("minecraft:mycelium"); + @Nullable public static final BlockType NETHER_BRICK_FENCE = get("minecraft:nether_brick_fence"); + @Nullable public static final BlockType NETHER_BRICK_SLAB = get("minecraft:nether_brick_slab"); + @Nullable public static final BlockType NETHER_BRICK_STAIRS = get("minecraft:nether_brick_stairs"); + @Nullable public static final BlockType NETHER_BRICKS = get("minecraft:nether_bricks"); + @Nullable public static final BlockType NETHER_PORTAL = get("minecraft:nether_portal"); + @Nullable public static final BlockType NETHER_QUARTZ_ORE = get("minecraft:nether_quartz_ore"); + @Nullable public static final BlockType NETHER_WART = get("minecraft:nether_wart"); + @Nullable public static final BlockType NETHER_WART_BLOCK = get("minecraft:nether_wart_block"); + @Nullable public static final BlockType NETHERRACK = get("minecraft:netherrack"); + @Nullable public static final BlockType NOTE_BLOCK = get("minecraft:note_block"); + @Nullable public static final BlockType OAK_BUTTON = get("minecraft:oak_button"); + @Nullable public static final BlockType OAK_DOOR = get("minecraft:oak_door"); + @Nullable public static final BlockType OAK_FENCE = get("minecraft:oak_fence"); + @Nullable public static final BlockType OAK_FENCE_GATE = get("minecraft:oak_fence_gate"); + @Nullable public static final BlockType OAK_LEAVES = get("minecraft:oak_leaves"); + @Nullable public static final BlockType OAK_LOG = get("minecraft:oak_log"); + @Nullable public static final BlockType OAK_PLANKS = get("minecraft:oak_planks"); + @Nullable public static final BlockType OAK_PRESSURE_PLATE = get("minecraft:oak_pressure_plate"); + @Nullable public static final BlockType OAK_SAPLING = get("minecraft:oak_sapling"); + @Nullable public static final BlockType OAK_SLAB = get("minecraft:oak_slab"); + @Nullable public static final BlockType OAK_STAIRS = get("minecraft:oak_stairs"); + @Nullable public static final BlockType OAK_TRAPDOOR = get("minecraft:oak_trapdoor"); + @Nullable public static final BlockType OAK_WOOD = get("minecraft:oak_wood"); + @Nullable public static final BlockType OBSERVER = get("minecraft:observer"); + @Nullable public static final BlockType OBSIDIAN = get("minecraft:obsidian"); + @Nullable public static final BlockType ORANGE_BANNER = get("minecraft:orange_banner"); + @Nullable public static final BlockType ORANGE_BED = get("minecraft:orange_bed"); + @Nullable public static final BlockType ORANGE_CARPET = get("minecraft:orange_carpet"); + @Nullable public static final BlockType ORANGE_CONCRETE = get("minecraft:orange_concrete"); + @Nullable public static final BlockType ORANGE_CONCRETE_POWDER = get("minecraft:orange_concrete_powder"); + @Nullable public static final BlockType ORANGE_GLAZED_TERRACOTTA = get("minecraft:orange_glazed_terracotta"); + @Nullable public static final BlockType ORANGE_SHULKER_BOX = get("minecraft:orange_shulker_box"); + @Nullable public static final BlockType ORANGE_STAINED_GLASS = get("minecraft:orange_stained_glass"); + @Nullable public static final BlockType ORANGE_STAINED_GLASS_PANE = get("minecraft:orange_stained_glass_pane"); + @Nullable public static final BlockType ORANGE_TERRACOTTA = get("minecraft:orange_terracotta"); + @Nullable public static final BlockType ORANGE_TULIP = get("minecraft:orange_tulip"); + @Nullable public static final BlockType ORANGE_WALL_BANNER = get("minecraft:orange_wall_banner"); + @Nullable public static final BlockType ORANGE_WOOL = get("minecraft:orange_wool"); + @Nullable public static final BlockType OXEYE_DAISY = get("minecraft:oxeye_daisy"); + @Nullable public static final BlockType PACKED_ICE = get("minecraft:packed_ice"); + @Nullable public static final BlockType PEONY = get("minecraft:peony"); + @Nullable public static final BlockType PETRIFIED_OAK_SLAB = get("minecraft:petrified_oak_slab"); + @Nullable public static final BlockType PINK_BANNER = get("minecraft:pink_banner"); + @Nullable public static final BlockType PINK_BED = get("minecraft:pink_bed"); + @Nullable public static final BlockType PINK_CARPET = get("minecraft:pink_carpet"); + @Nullable public static final BlockType PINK_CONCRETE = get("minecraft:pink_concrete"); + @Nullable public static final BlockType PINK_CONCRETE_POWDER = get("minecraft:pink_concrete_powder"); + @Nullable public static final BlockType PINK_GLAZED_TERRACOTTA = get("minecraft:pink_glazed_terracotta"); + @Nullable public static final BlockType PINK_SHULKER_BOX = get("minecraft:pink_shulker_box"); + @Nullable public static final BlockType PINK_STAINED_GLASS = get("minecraft:pink_stained_glass"); + @Nullable public static final BlockType PINK_STAINED_GLASS_PANE = get("minecraft:pink_stained_glass_pane"); + @Nullable public static final BlockType PINK_TERRACOTTA = get("minecraft:pink_terracotta"); + @Nullable public static final BlockType PINK_TULIP = get("minecraft:pink_tulip"); + @Nullable public static final BlockType PINK_WALL_BANNER = get("minecraft:pink_wall_banner"); + @Nullable public static final BlockType PINK_WOOL = get("minecraft:pink_wool"); + @Nullable public static final BlockType PISTON = get("minecraft:piston"); + @Nullable public static final BlockType PISTON_HEAD = get("minecraft:piston_head"); + @Nullable public static final BlockType PLAYER_HEAD = get("minecraft:player_head"); + @Nullable public static final BlockType PLAYER_WALL_HEAD = get("minecraft:player_wall_head"); + @Nullable public static final BlockType PODZOL = get("minecraft:podzol"); + @Nullable public static final BlockType POLISHED_ANDESITE = get("minecraft:polished_andesite"); + @Nullable public static final BlockType POLISHED_DIORITE = get("minecraft:polished_diorite"); + @Nullable public static final BlockType POLISHED_GRANITE = get("minecraft:polished_granite"); + @Nullable public static final BlockType POPPY = get("minecraft:poppy"); + @Nullable public static final BlockType POTATOES = get("minecraft:potatoes"); + @Nullable public static final BlockType POTTED_ACACIA_SAPLING = get("minecraft:potted_acacia_sapling"); + @Nullable public static final BlockType POTTED_ALLIUM = get("minecraft:potted_allium"); + @Nullable public static final BlockType POTTED_AZURE_BLUET = get("minecraft:potted_azure_bluet"); + @Nullable public static final BlockType POTTED_BIRCH_SAPLING = get("minecraft:potted_birch_sapling"); + @Nullable public static final BlockType POTTED_BLUE_ORCHID = get("minecraft:potted_blue_orchid"); + @Nullable public static final BlockType POTTED_BROWN_MUSHROOM = get("minecraft:potted_brown_mushroom"); + @Nullable public static final BlockType POTTED_CACTUS = get("minecraft:potted_cactus"); + @Nullable public static final BlockType POTTED_DANDELION = get("minecraft:potted_dandelion"); + @Nullable public static final BlockType POTTED_DARK_OAK_SAPLING = get("minecraft:potted_dark_oak_sapling"); + @Nullable public static final BlockType POTTED_DEAD_BUSH = get("minecraft:potted_dead_bush"); + @Nullable public static final BlockType POTTED_FERN = get("minecraft:potted_fern"); + @Nullable public static final BlockType POTTED_JUNGLE_SAPLING = get("minecraft:potted_jungle_sapling"); + @Nullable public static final BlockType POTTED_OAK_SAPLING = get("minecraft:potted_oak_sapling"); + @Nullable public static final BlockType POTTED_ORANGE_TULIP = get("minecraft:potted_orange_tulip"); + @Nullable public static final BlockType POTTED_OXEYE_DAISY = get("minecraft:potted_oxeye_daisy"); + @Nullable public static final BlockType POTTED_PINK_TULIP = get("minecraft:potted_pink_tulip"); + @Nullable public static final BlockType POTTED_POPPY = get("minecraft:potted_poppy"); + @Nullable public static final BlockType POTTED_RED_MUSHROOM = get("minecraft:potted_red_mushroom"); + @Nullable public static final BlockType POTTED_RED_TULIP = get("minecraft:potted_red_tulip"); + @Nullable public static final BlockType POTTED_SPRUCE_SAPLING = get("minecraft:potted_spruce_sapling"); + @Nullable public static final BlockType POTTED_WHITE_TULIP = get("minecraft:potted_white_tulip"); + @Nullable public static final BlockType POWERED_RAIL = get("minecraft:powered_rail"); + @Nullable public static final BlockType PRISMARINE = get("minecraft:prismarine"); + @Nullable public static final BlockType PRISMARINE_BRICK_SLAB = get("minecraft:prismarine_brick_slab"); + @Nullable public static final BlockType PRISMARINE_BRICK_STAIRS = get("minecraft:prismarine_brick_stairs"); + @Nullable public static final BlockType PRISMARINE_BRICKS = get("minecraft:prismarine_bricks"); + @Nullable public static final BlockType PRISMARINE_SLAB = get("minecraft:prismarine_slab"); + @Nullable public static final BlockType PRISMARINE_STAIRS = get("minecraft:prismarine_stairs"); + @Nullable public static final BlockType PUMPKIN = get("minecraft:pumpkin"); + @Nullable public static final BlockType PUMPKIN_STEM = get("minecraft:pumpkin_stem"); + @Nullable public static final BlockType PURPLE_BANNER = get("minecraft:purple_banner"); + @Nullable public static final BlockType PURPLE_BED = get("minecraft:purple_bed"); + @Nullable public static final BlockType PURPLE_CARPET = get("minecraft:purple_carpet"); + @Nullable public static final BlockType PURPLE_CONCRETE = get("minecraft:purple_concrete"); + @Nullable public static final BlockType PURPLE_CONCRETE_POWDER = get("minecraft:purple_concrete_powder"); + @Nullable public static final BlockType PURPLE_GLAZED_TERRACOTTA = get("minecraft:purple_glazed_terracotta"); + @Nullable public static final BlockType PURPLE_SHULKER_BOX = get("minecraft:purple_shulker_box"); + @Nullable public static final BlockType PURPLE_STAINED_GLASS = get("minecraft:purple_stained_glass"); + @Nullable public static final BlockType PURPLE_STAINED_GLASS_PANE = get("minecraft:purple_stained_glass_pane"); + @Nullable public static final BlockType PURPLE_TERRACOTTA = get("minecraft:purple_terracotta"); + @Nullable public static final BlockType PURPLE_WALL_BANNER = get("minecraft:purple_wall_banner"); + @Nullable public static final BlockType PURPLE_WOOL = get("minecraft:purple_wool"); + @Nullable public static final BlockType PURPUR_BLOCK = get("minecraft:purpur_block"); + @Nullable public static final BlockType PURPUR_PILLAR = get("minecraft:purpur_pillar"); + @Nullable public static final BlockType PURPUR_SLAB = get("minecraft:purpur_slab"); + @Nullable public static final BlockType PURPUR_STAIRS = get("minecraft:purpur_stairs"); + @Nullable public static final BlockType QUARTZ_BLOCK = get("minecraft:quartz_block"); + @Nullable public static final BlockType QUARTZ_PILLAR = get("minecraft:quartz_pillar"); + @Nullable public static final BlockType QUARTZ_SLAB = get("minecraft:quartz_slab"); + @Nullable public static final BlockType QUARTZ_STAIRS = get("minecraft:quartz_stairs"); + @Nullable public static final BlockType RAIL = get("minecraft:rail"); + @Nullable public static final BlockType RED_BANNER = get("minecraft:red_banner"); + @Nullable public static final BlockType RED_BED = get("minecraft:red_bed"); + @Nullable public static final BlockType RED_CARPET = get("minecraft:red_carpet"); + @Nullable public static final BlockType RED_CONCRETE = get("minecraft:red_concrete"); + @Nullable public static final BlockType RED_CONCRETE_POWDER = get("minecraft:red_concrete_powder"); + @Nullable public static final BlockType RED_GLAZED_TERRACOTTA = get("minecraft:red_glazed_terracotta"); + @Nullable public static final BlockType RED_MUSHROOM = get("minecraft:red_mushroom"); + @Nullable public static final BlockType RED_MUSHROOM_BLOCK = get("minecraft:red_mushroom_block"); + @Nullable public static final BlockType RED_NETHER_BRICKS = get("minecraft:red_nether_bricks"); + @Nullable public static final BlockType RED_SAND = get("minecraft:red_sand"); + @Nullable public static final BlockType RED_SANDSTONE = get("minecraft:red_sandstone"); + @Nullable public static final BlockType RED_SANDSTONE_SLAB = get("minecraft:red_sandstone_slab"); + @Nullable public static final BlockType RED_SANDSTONE_STAIRS = get("minecraft:red_sandstone_stairs"); + @Nullable public static final BlockType RED_SHULKER_BOX = get("minecraft:red_shulker_box"); + @Nullable public static final BlockType RED_STAINED_GLASS = get("minecraft:red_stained_glass"); + @Nullable public static final BlockType RED_STAINED_GLASS_PANE = get("minecraft:red_stained_glass_pane"); + @Nullable public static final BlockType RED_TERRACOTTA = get("minecraft:red_terracotta"); + @Nullable public static final BlockType RED_TULIP = get("minecraft:red_tulip"); + @Nullable public static final BlockType RED_WALL_BANNER = get("minecraft:red_wall_banner"); + @Nullable public static final BlockType RED_WOOL = get("minecraft:red_wool"); + @Nullable public static final BlockType REDSTONE_BLOCK = get("minecraft:redstone_block"); + @Nullable public static final BlockType REDSTONE_LAMP = get("minecraft:redstone_lamp"); + @Nullable public static final BlockType REDSTONE_ORE = get("minecraft:redstone_ore"); + @Nullable public static final BlockType REDSTONE_TORCH = get("minecraft:redstone_torch"); + @Nullable public static final BlockType REDSTONE_WALL_TORCH = get("minecraft:redstone_wall_torch"); + @Nullable public static final BlockType REDSTONE_WIRE = get("minecraft:redstone_wire"); + @Nullable public static final BlockType REPEATER = get("minecraft:repeater"); + @Nullable public static final BlockType REPEATING_COMMAND_BLOCK = get("minecraft:repeating_command_block"); + @Nullable public static final BlockType ROSE_BUSH = get("minecraft:rose_bush"); + @Nullable public static final BlockType SAND = get("minecraft:sand"); + @Nullable public static final BlockType SANDSTONE = get("minecraft:sandstone"); + @Nullable public static final BlockType SANDSTONE_SLAB = get("minecraft:sandstone_slab"); + @Nullable public static final BlockType SANDSTONE_STAIRS = get("minecraft:sandstone_stairs"); + @Nullable public static final BlockType SEA_LANTERN = get("minecraft:sea_lantern"); + @Nullable public static final BlockType SEA_PICKLE = get("minecraft:sea_pickle"); + @Nullable public static final BlockType SEAGRASS = get("minecraft:seagrass"); + @Nullable public static final BlockType SHULKER_BOX = get("minecraft:shulker_box"); + @Nullable public static final BlockType SIGN = get("minecraft:sign"); + @Nullable public static final BlockType SKELETON_SKULL = get("minecraft:skeleton_skull"); + @Nullable public static final BlockType SKELETON_WALL_SKULL = get("minecraft:skeleton_wall_skull"); + @Nullable public static final BlockType SLIME_BLOCK = get("minecraft:slime_block"); + @Nullable public static final BlockType SMOOTH_QUARTZ = get("minecraft:smooth_quartz"); + @Nullable public static final BlockType SMOOTH_RED_SANDSTONE = get("minecraft:smooth_red_sandstone"); + @Nullable public static final BlockType SMOOTH_SANDSTONE = get("minecraft:smooth_sandstone"); + @Nullable public static final BlockType SMOOTH_STONE = get("minecraft:smooth_stone"); + @Nullable public static final BlockType SNOW = get("minecraft:snow"); + @Nullable public static final BlockType SNOW_BLOCK = get("minecraft:snow_block"); + @Nullable public static final BlockType SOUL_SAND = get("minecraft:soul_sand"); + @Nullable public static final BlockType SPAWNER = get("minecraft:spawner"); + @Nullable public static final BlockType SPONGE = get("minecraft:sponge"); + @Nullable public static final BlockType SPRUCE_BUTTON = get("minecraft:spruce_button"); + @Nullable public static final BlockType SPRUCE_DOOR = get("minecraft:spruce_door"); + @Nullable public static final BlockType SPRUCE_FENCE = get("minecraft:spruce_fence"); + @Nullable public static final BlockType SPRUCE_FENCE_GATE = get("minecraft:spruce_fence_gate"); + @Nullable public static final BlockType SPRUCE_LEAVES = get("minecraft:spruce_leaves"); + @Nullable public static final BlockType SPRUCE_LOG = get("minecraft:spruce_log"); + @Nullable public static final BlockType SPRUCE_PLANKS = get("minecraft:spruce_planks"); + @Nullable public static final BlockType SPRUCE_PRESSURE_PLATE = get("minecraft:spruce_pressure_plate"); + @Nullable public static final BlockType SPRUCE_SAPLING = get("minecraft:spruce_sapling"); + @Nullable public static final BlockType SPRUCE_SLAB = get("minecraft:spruce_slab"); + @Nullable public static final BlockType SPRUCE_STAIRS = get("minecraft:spruce_stairs"); + @Nullable public static final BlockType SPRUCE_TRAPDOOR = get("minecraft:spruce_trapdoor"); + @Nullable public static final BlockType SPRUCE_WOOD = get("minecraft:spruce_wood"); + @Nullable public static final BlockType STICKY_PISTON = get("minecraft:sticky_piston"); + @Nullable public static final BlockType STONE = get("minecraft:stone"); + @Nullable public static final BlockType STONE_BRICK_SLAB = get("minecraft:stone_brick_slab"); + @Nullable public static final BlockType STONE_BRICK_STAIRS = get("minecraft:stone_brick_stairs"); + @Nullable public static final BlockType STONE_BRICKS = get("minecraft:stone_bricks"); + @Nullable public static final BlockType STONE_BUTTON = get("minecraft:stone_button"); + @Nullable public static final BlockType STONE_PRESSURE_PLATE = get("minecraft:stone_pressure_plate"); + @Nullable public static final BlockType STONE_SLAB = get("minecraft:stone_slab"); + @Nullable public static final BlockType STRIPPED_ACACIA_LOG = get("minecraft:stripped_acacia_log"); + @Nullable public static final BlockType STRIPPED_ACACIA_WOOD = get("minecraft:stripped_acacia_wood"); + @Nullable public static final BlockType STRIPPED_BIRCH_LOG = get("minecraft:stripped_birch_log"); + @Nullable public static final BlockType STRIPPED_BIRCH_WOOD = get("minecraft:stripped_birch_wood"); + @Nullable public static final BlockType STRIPPED_DARK_OAK_LOG = get("minecraft:stripped_dark_oak_log"); + @Nullable public static final BlockType STRIPPED_DARK_OAK_WOOD = get("minecraft:stripped_dark_oak_wood"); + @Nullable public static final BlockType STRIPPED_JUNGLE_LOG = get("minecraft:stripped_jungle_log"); + @Nullable public static final BlockType STRIPPED_JUNGLE_WOOD = get("minecraft:stripped_jungle_wood"); + @Nullable public static final BlockType STRIPPED_OAK_LOG = get("minecraft:stripped_oak_log"); + @Nullable public static final BlockType STRIPPED_OAK_WOOD = get("minecraft:stripped_oak_wood"); + @Nullable public static final BlockType STRIPPED_SPRUCE_LOG = get("minecraft:stripped_spruce_log"); + @Nullable public static final BlockType STRIPPED_SPRUCE_WOOD = get("minecraft:stripped_spruce_wood"); + @Nullable public static final BlockType STRUCTURE_BLOCK = get("minecraft:structure_block"); + @Nullable public static final BlockType STRUCTURE_VOID = get("minecraft:structure_void"); + @Nullable public static final BlockType SUGAR_CANE = get("minecraft:sugar_cane"); + @Nullable public static final BlockType SUNFLOWER = get("minecraft:sunflower"); + @Nullable public static final BlockType TALL_GRASS = get("minecraft:tall_grass"); + @Nullable public static final BlockType TALL_SEAGRASS = get("minecraft:tall_seagrass"); + @Nullable public static final BlockType TERRACOTTA = get("minecraft:terracotta"); + @Nullable public static final BlockType TNT = get("minecraft:tnt"); + @Nullable public static final BlockType TORCH = get("minecraft:torch"); + @Nullable public static final BlockType TRAPPED_CHEST = get("minecraft:trapped_chest"); + @Nullable public static final BlockType TRIPWIRE = get("minecraft:tripwire"); + @Nullable public static final BlockType TRIPWIRE_HOOK = get("minecraft:tripwire_hook"); + @Nullable public static final BlockType TUBE_CORAL = get("minecraft:tube_coral"); + @Nullable public static final BlockType TUBE_CORAL_BLOCK = get("minecraft:tube_coral_block"); + @Nullable public static final BlockType TUBE_CORAL_FAN = get("minecraft:tube_coral_fan"); + @Nullable public static final BlockType TUBE_CORAL_WALL_FAN = get("minecraft:tube_coral_wall_fan"); + @Nullable public static final BlockType TURTLE_EGG = get("minecraft:turtle_egg"); + @Nullable public static final BlockType VINE = get("minecraft:vine"); + @Nullable public static final BlockType VOID_AIR = get("minecraft:void_air"); + @Nullable public static final BlockType WALL_SIGN = get("minecraft:wall_sign"); + @Nullable public static final BlockType WALL_TORCH = get("minecraft:wall_torch"); + @Nullable public static final BlockType WATER = get("minecraft:water"); + @Nullable public static final BlockType WET_SPONGE = get("minecraft:wet_sponge"); + @Nullable public static final BlockType WHEAT = get("minecraft:wheat"); + @Nullable public static final BlockType WHITE_BANNER = get("minecraft:white_banner"); + @Nullable public static final BlockType WHITE_BED = get("minecraft:white_bed"); + @Nullable public static final BlockType WHITE_CARPET = get("minecraft:white_carpet"); + @Nullable public static final BlockType WHITE_CONCRETE = get("minecraft:white_concrete"); + @Nullable public static final BlockType WHITE_CONCRETE_POWDER = get("minecraft:white_concrete_powder"); + @Nullable public static final BlockType WHITE_GLAZED_TERRACOTTA = get("minecraft:white_glazed_terracotta"); + @Nullable public static final BlockType WHITE_SHULKER_BOX = get("minecraft:white_shulker_box"); + @Nullable public static final BlockType WHITE_STAINED_GLASS = get("minecraft:white_stained_glass"); + @Nullable public static final BlockType WHITE_STAINED_GLASS_PANE = get("minecraft:white_stained_glass_pane"); + @Nullable public static final BlockType WHITE_TERRACOTTA = get("minecraft:white_terracotta"); + @Nullable public static final BlockType WHITE_TULIP = get("minecraft:white_tulip"); + @Nullable public static final BlockType WHITE_WALL_BANNER = get("minecraft:white_wall_banner"); + @Nullable public static final BlockType WHITE_WOOL = get("minecraft:white_wool"); + @Nullable public static final BlockType WITHER_SKELETON_SKULL = get("minecraft:wither_skeleton_skull"); + @Nullable public static final BlockType WITHER_SKELETON_WALL_SKULL = get("minecraft:wither_skeleton_wall_skull"); + @Nullable public static final BlockType YELLOW_BANNER = get("minecraft:yellow_banner"); + @Nullable public static final BlockType YELLOW_BED = get("minecraft:yellow_bed"); + @Nullable public static final BlockType YELLOW_CARPET = get("minecraft:yellow_carpet"); + @Nullable public static final BlockType YELLOW_CONCRETE = get("minecraft:yellow_concrete"); + @Nullable public static final BlockType YELLOW_CONCRETE_POWDER = get("minecraft:yellow_concrete_powder"); + @Nullable public static final BlockType YELLOW_GLAZED_TERRACOTTA = get("minecraft:yellow_glazed_terracotta"); + @Nullable public static final BlockType YELLOW_SHULKER_BOX = get("minecraft:yellow_shulker_box"); + @Nullable public static final BlockType YELLOW_STAINED_GLASS = get("minecraft:yellow_stained_glass"); + @Nullable public static final BlockType YELLOW_STAINED_GLASS_PANE = get("minecraft:yellow_stained_glass_pane"); + @Nullable public static final BlockType YELLOW_TERRACOTTA = get("minecraft:yellow_terracotta"); + @Nullable public static final BlockType YELLOW_WALL_BANNER = get("minecraft:yellow_wall_banner"); + @Nullable public static final BlockType YELLOW_WOOL = get("minecraft:yellow_wool"); + @Nullable public static final BlockType ZOMBIE_HEAD = get("minecraft:zombie_head"); + @Nullable public static final BlockType ZOMBIE_WALL_HEAD = get("minecraft:zombie_wall_head"); private BlockTypes() { } - private static BlockType register(final String id) { - return register(new BlockType(id)); - } - - private static BlockType register(final String id, Function values) { - return register(new BlockType(id, values)); - } - - public static BlockType register(final BlockType block) { - return BlockType.REGISTRY.register(block.getId(), block); - } - public static @Nullable BlockType get(final String id) { return BlockType.REGISTRY.get(id); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java index b9c557fd4..580bf8c1a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java @@ -57,7 +57,12 @@ public class FuzzyBlockState extends BlockState { Property objKey = (Property) entry.getKey(); state = state.with(objKey, entry.getValue()); } - return getBlockType().getDefaultState(); + return state; + } + + @Override + public BlockState toImmutableState() { + return getFullState(); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java index 9c8d44210..f98fd96c2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java @@ -23,113 +23,105 @@ import javax.annotation.Nullable; public class EntityTypes { - public static final EntityType AREA_EFFECT_CLOUD = register("minecraft:area_effect_cloud"); - public static final EntityType ARMOR_STAND = register("minecraft:armor_stand"); - public static final EntityType ARROW = register("minecraft:arrow"); - public static final EntityType BAT = register("minecraft:bat"); - public static final EntityType BLAZE = register("minecraft:blaze"); - public static final EntityType BOAT = register("minecraft:boat"); - public static final EntityType CAVE_SPIDER = register("minecraft:cave_spider"); - public static final EntityType CHEST_MINECART = register("minecraft:chest_minecart"); - public static final EntityType CHICKEN = register("minecraft:chicken"); - public static final EntityType COD = register("minecraft:cod"); - public static final EntityType COMMAND_BLOCK_MINECART = register("minecraft:command_block_minecart"); - public static final EntityType COW = register("minecraft:cow"); - public static final EntityType CREEPER = register("minecraft:creeper"); - public static final EntityType DOLPHIN = register("minecraft:dolphin"); - public static final EntityType DONKEY = register("minecraft:donkey"); - public static final EntityType DRAGON_FIREBALL = register("minecraft:dragon_fireball"); - public static final EntityType DROWNED = register("minecraft:drowned"); - public static final EntityType EGG = register("minecraft:egg"); - public static final EntityType ELDER_GUARDIAN = register("minecraft:elder_guardian"); - public static final EntityType END_CRYSTAL = register("minecraft:end_crystal"); - public static final EntityType ENDER_DRAGON = register("minecraft:ender_dragon"); - public static final EntityType ENDER_PEARL = register("minecraft:ender_pearl"); - public static final EntityType ENDERMAN = register("minecraft:enderman"); - public static final EntityType ENDERMITE = register("minecraft:endermite"); - public static final EntityType EVOKER = register("minecraft:evoker"); - public static final EntityType EVOKER_FANGS = register("minecraft:evoker_fangs"); - public static final EntityType EXPERIENCE_BOTTLE = register("minecraft:experience_bottle"); - public static final EntityType EXPERIENCE_ORB = register("minecraft:experience_orb"); - public static final EntityType EYE_OF_ENDER = register("minecraft:eye_of_ender"); - public static final EntityType FALLING_BLOCK = register("minecraft:falling_block"); - public static final EntityType FIREBALL = register("minecraft:fireball"); - public static final EntityType FIREWORK_ROCKET = register("minecraft:firework_rocket"); - public static final EntityType FISHING_BOBBER = register("minecraft:fishing_bobber"); - public static final EntityType FURNACE_MINECART = register("minecraft:furnace_minecart"); - public static final EntityType GHAST = register("minecraft:ghast"); - public static final EntityType GIANT = register("minecraft:giant"); - public static final EntityType GUARDIAN = register("minecraft:guardian"); - public static final EntityType HOPPER_MINECART = register("minecraft:hopper_minecart"); - public static final EntityType HORSE = register("minecraft:horse"); - public static final EntityType HUSK = register("minecraft:husk"); - public static final EntityType ILLUSIONER = register("minecraft:illusioner"); - public static final EntityType IRON_GOLEM = register("minecraft:iron_golem"); - public static final EntityType ITEM = register("minecraft:item"); - public static final EntityType ITEM_FRAME = register("minecraft:item_frame"); - public static final EntityType LEASH_KNOT = register("minecraft:leash_knot"); - public static final EntityType LIGHTNING_BOLT = register("minecraft:lightning_bolt"); - public static final EntityType LLAMA = register("minecraft:llama"); - public static final EntityType LLAMA_SPIT = register("minecraft:llama_spit"); - public static final EntityType MAGMA_CUBE = register("minecraft:magma_cube"); - public static final EntityType MINECART = register("minecraft:minecart"); - public static final EntityType MOOSHROOM = register("minecraft:mooshroom"); - public static final EntityType MULE = register("minecraft:mule"); - public static final EntityType OCELOT = register("minecraft:ocelot"); - public static final EntityType PAINTING = register("minecraft:painting"); - public static final EntityType PARROT = register("minecraft:parrot"); - public static final EntityType PHANTOM = register("minecraft:phantom"); - public static final EntityType PIG = register("minecraft:pig"); - public static final EntityType PLAYER = register("minecraft:player"); - public static final EntityType POLAR_BEAR = register("minecraft:polar_bear"); - public static final EntityType POTION = register("minecraft:potion"); - public static final EntityType PUFFERFISH = register("minecraft:pufferfish"); - public static final EntityType RABBIT = register("minecraft:rabbit"); - public static final EntityType SALMON = register("minecraft:salmon"); - public static final EntityType SHEEP = register("minecraft:sheep"); - public static final EntityType SHULKER = register("minecraft:shulker"); - public static final EntityType SHULKER_BULLET = register("minecraft:shulker_bullet"); - public static final EntityType SILVERFISH = register("minecraft:silverfish"); - public static final EntityType SKELETON = register("minecraft:skeleton"); - public static final EntityType SKELETON_HORSE = register("minecraft:skeleton_horse"); - public static final EntityType SLIME = register("minecraft:slime"); - public static final EntityType SMALL_FIREBALL = register("minecraft:small_fireball"); - public static final EntityType SNOW_GOLEM = register("minecraft:snow_golem"); - public static final EntityType SNOWBALL = register("minecraft:snowball"); - public static final EntityType SPAWNER_MINECART = register("minecraft:spawner_minecart"); - public static final EntityType SPECTRAL_ARROW = register("minecraft:spectral_arrow"); - public static final EntityType SPIDER = register("minecraft:spider"); - public static final EntityType SQUID = register("minecraft:squid"); - public static final EntityType STRAY = register("minecraft:stray"); - public static final EntityType TNT = register("minecraft:tnt"); - public static final EntityType TNT_MINECART = register("minecraft:tnt_minecart"); - public static final EntityType TRIDENT = register("minecraft:trident"); - public static final EntityType TROPICAL_FISH = register("minecraft:tropical_fish"); - public static final EntityType TURTLE = register("minecraft:turtle"); - public static final EntityType VEX = register("minecraft:vex"); - public static final EntityType VILLAGER = register("minecraft:villager"); - public static final EntityType VINDICATOR = register("minecraft:vindicator"); - public static final EntityType WITCH = register("minecraft:witch"); - public static final EntityType WITHER = register("minecraft:wither"); - public static final EntityType WITHER_SKELETON = register("minecraft:wither_skeleton"); - public static final EntityType WITHER_SKULL = register("minecraft:wither_skull"); - public static final EntityType WOLF = register("minecraft:wolf"); - public static final EntityType ZOMBIE = register("minecraft:zombie"); - public static final EntityType ZOMBIE_HORSE = register("minecraft:zombie_horse"); - public static final EntityType ZOMBIE_PIGMAN = register("minecraft:zombie_pigman"); - public static final EntityType ZOMBIE_VILLAGER = register("minecraft:zombie_villager"); + @Nullable public static final EntityType AREA_EFFECT_CLOUD = get("minecraft:area_effect_cloud"); + @Nullable public static final EntityType ARMOR_STAND = get("minecraft:armor_stand"); + @Nullable public static final EntityType ARROW = get("minecraft:arrow"); + @Nullable public static final EntityType BAT = get("minecraft:bat"); + @Nullable public static final EntityType BLAZE = get("minecraft:blaze"); + @Nullable public static final EntityType BOAT = get("minecraft:boat"); + @Nullable public static final EntityType CAVE_SPIDER = get("minecraft:cave_spider"); + @Nullable public static final EntityType CHEST_MINECART = get("minecraft:chest_minecart"); + @Nullable public static final EntityType CHICKEN = get("minecraft:chicken"); + @Nullable public static final EntityType COD = get("minecraft:cod"); + @Nullable public static final EntityType COMMAND_BLOCK_MINECART = get("minecraft:command_block_minecart"); + @Nullable public static final EntityType COW = get("minecraft:cow"); + @Nullable public static final EntityType CREEPER = get("minecraft:creeper"); + @Nullable public static final EntityType DOLPHIN = get("minecraft:dolphin"); + @Nullable public static final EntityType DONKEY = get("minecraft:donkey"); + @Nullable public static final EntityType DRAGON_FIREBALL = get("minecraft:dragon_fireball"); + @Nullable public static final EntityType DROWNED = get("minecraft:drowned"); + @Nullable public static final EntityType EGG = get("minecraft:egg"); + @Nullable public static final EntityType ELDER_GUARDIAN = get("minecraft:elder_guardian"); + @Nullable public static final EntityType END_CRYSTAL = get("minecraft:end_crystal"); + @Nullable public static final EntityType ENDER_DRAGON = get("minecraft:ender_dragon"); + @Nullable public static final EntityType ENDER_PEARL = get("minecraft:ender_pearl"); + @Nullable public static final EntityType ENDERMAN = get("minecraft:enderman"); + @Nullable public static final EntityType ENDERMITE = get("minecraft:endermite"); + @Nullable public static final EntityType EVOKER = get("minecraft:evoker"); + @Nullable public static final EntityType EVOKER_FANGS = get("minecraft:evoker_fangs"); + @Nullable public static final EntityType EXPERIENCE_BOTTLE = get("minecraft:experience_bottle"); + @Nullable public static final EntityType EXPERIENCE_ORB = get("minecraft:experience_orb"); + @Nullable public static final EntityType EYE_OF_ENDER = get("minecraft:eye_of_ender"); + @Nullable public static final EntityType FALLING_BLOCK = get("minecraft:falling_block"); + @Nullable public static final EntityType FIREBALL = get("minecraft:fireball"); + @Nullable public static final EntityType FIREWORK_ROCKET = get("minecraft:firework_rocket"); + @Nullable public static final EntityType FISHING_BOBBER = get("minecraft:fishing_bobber"); + @Nullable public static final EntityType FURNACE_MINECART = get("minecraft:furnace_minecart"); + @Nullable public static final EntityType GHAST = get("minecraft:ghast"); + @Nullable public static final EntityType GIANT = get("minecraft:giant"); + @Nullable public static final EntityType GUARDIAN = get("minecraft:guardian"); + @Nullable public static final EntityType HOPPER_MINECART = get("minecraft:hopper_minecart"); + @Nullable public static final EntityType HORSE = get("minecraft:horse"); + @Nullable public static final EntityType HUSK = get("minecraft:husk"); + @Nullable public static final EntityType ILLUSIONER = get("minecraft:illusioner"); + @Nullable public static final EntityType IRON_GOLEM = get("minecraft:iron_golem"); + @Nullable public static final EntityType ITEM = get("minecraft:item"); + @Nullable public static final EntityType ITEM_FRAME = get("minecraft:item_frame"); + @Nullable public static final EntityType LEASH_KNOT = get("minecraft:leash_knot"); + @Nullable public static final EntityType LIGHTNING_BOLT = get("minecraft:lightning_bolt"); + @Nullable public static final EntityType LLAMA = get("minecraft:llama"); + @Nullable public static final EntityType LLAMA_SPIT = get("minecraft:llama_spit"); + @Nullable public static final EntityType MAGMA_CUBE = get("minecraft:magma_cube"); + @Nullable public static final EntityType MINECART = get("minecraft:minecart"); + @Nullable public static final EntityType MOOSHROOM = get("minecraft:mooshroom"); + @Nullable public static final EntityType MULE = get("minecraft:mule"); + @Nullable public static final EntityType OCELOT = get("minecraft:ocelot"); + @Nullable public static final EntityType PAINTING = get("minecraft:painting"); + @Nullable public static final EntityType PARROT = get("minecraft:parrot"); + @Nullable public static final EntityType PHANTOM = get("minecraft:phantom"); + @Nullable public static final EntityType PIG = get("minecraft:pig"); + @Nullable public static final EntityType PLAYER = get("minecraft:player"); + @Nullable public static final EntityType POLAR_BEAR = get("minecraft:polar_bear"); + @Nullable public static final EntityType POTION = get("minecraft:potion"); + @Nullable public static final EntityType PUFFERFISH = get("minecraft:pufferfish"); + @Nullable public static final EntityType RABBIT = get("minecraft:rabbit"); + @Nullable public static final EntityType SALMON = get("minecraft:salmon"); + @Nullable public static final EntityType SHEEP = get("minecraft:sheep"); + @Nullable public static final EntityType SHULKER = get("minecraft:shulker"); + @Nullable public static final EntityType SHULKER_BULLET = get("minecraft:shulker_bullet"); + @Nullable public static final EntityType SILVERFISH = get("minecraft:silverfish"); + @Nullable public static final EntityType SKELETON = get("minecraft:skeleton"); + @Nullable public static final EntityType SKELETON_HORSE = get("minecraft:skeleton_horse"); + @Nullable public static final EntityType SLIME = get("minecraft:slime"); + @Nullable public static final EntityType SMALL_FIREBALL = get("minecraft:small_fireball"); + @Nullable public static final EntityType SNOW_GOLEM = get("minecraft:snow_golem"); + @Nullable public static final EntityType SNOWBALL = get("minecraft:snowball"); + @Nullable public static final EntityType SPAWNER_MINECART = get("minecraft:spawner_minecart"); + @Nullable public static final EntityType SPECTRAL_ARROW = get("minecraft:spectral_arrow"); + @Nullable public static final EntityType SPIDER = get("minecraft:spider"); + @Nullable public static final EntityType SQUID = get("minecraft:squid"); + @Nullable public static final EntityType STRAY = get("minecraft:stray"); + @Nullable public static final EntityType TNT = get("minecraft:tnt"); + @Nullable public static final EntityType TNT_MINECART = get("minecraft:tnt_minecart"); + @Nullable public static final EntityType TRIDENT = get("minecraft:trident"); + @Nullable public static final EntityType TROPICAL_FISH = get("minecraft:tropical_fish"); + @Nullable public static final EntityType TURTLE = get("minecraft:turtle"); + @Nullable public static final EntityType VEX = get("minecraft:vex"); + @Nullable public static final EntityType VILLAGER = get("minecraft:villager"); + @Nullable public static final EntityType VINDICATOR = get("minecraft:vindicator"); + @Nullable public static final EntityType WITCH = get("minecraft:witch"); + @Nullable public static final EntityType WITHER = get("minecraft:wither"); + @Nullable public static final EntityType WITHER_SKELETON = get("minecraft:wither_skeleton"); + @Nullable public static final EntityType WITHER_SKULL = get("minecraft:wither_skull"); + @Nullable public static final EntityType WOLF = get("minecraft:wolf"); + @Nullable public static final EntityType ZOMBIE = get("minecraft:zombie"); + @Nullable public static final EntityType ZOMBIE_HORSE = get("minecraft:zombie_horse"); + @Nullable public static final EntityType ZOMBIE_PIGMAN = get("minecraft:zombie_pigman"); + @Nullable public static final EntityType ZOMBIE_VILLAGER = get("minecraft:zombie_villager"); private EntityTypes() { } - private static EntityType register(final String id) { - return register(new EntityType(id)); - } - - public static EntityType register(final EntityType entityType) { - return EntityType.REGISTRY.register(entityType.getId(), entityType); - } - public static @Nullable EntityType get(final String id) { return EntityType.REGISTRY.get(id); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java index 96ff8897f..677ed2a8e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java @@ -23,808 +23,800 @@ import javax.annotation.Nullable; public final class ItemTypes { - public static final ItemType ACACIA_BOAT = register("minecraft:acacia_boat"); - public static final ItemType ACACIA_BUTTON = register("minecraft:acacia_button"); - public static final ItemType ACACIA_DOOR = register("minecraft:acacia_door"); - public static final ItemType ACACIA_FENCE = register("minecraft:acacia_fence"); - public static final ItemType ACACIA_FENCE_GATE = register("minecraft:acacia_fence_gate"); - public static final ItemType ACACIA_LEAVES = register("minecraft:acacia_leaves"); - public static final ItemType ACACIA_LOG = register("minecraft:acacia_log"); - public static final ItemType ACACIA_PLANKS = register("minecraft:acacia_planks"); - public static final ItemType ACACIA_PRESSURE_PLATE = register("minecraft:acacia_pressure_plate"); - public static final ItemType ACACIA_SAPLING = register("minecraft:acacia_sapling"); - public static final ItemType ACACIA_SLAB = register("minecraft:acacia_slab"); - public static final ItemType ACACIA_STAIRS = register("minecraft:acacia_stairs"); - public static final ItemType ACACIA_TRAPDOOR = register("minecraft:acacia_trapdoor"); - public static final ItemType ACACIA_WOOD = register("minecraft:acacia_wood"); - public static final ItemType ACTIVATOR_RAIL = register("minecraft:activator_rail"); - public static final ItemType AIR = register("minecraft:air"); - public static final ItemType ALLIUM = register("minecraft:allium"); - public static final ItemType ANDESITE = register("minecraft:andesite"); - public static final ItemType ANVIL = register("minecraft:anvil"); - public static final ItemType APPLE = register("minecraft:apple"); - public static final ItemType ARMOR_STAND = register("minecraft:armor_stand"); - public static final ItemType ARROW = register("minecraft:arrow"); - public static final ItemType AZURE_BLUET = register("minecraft:azure_bluet"); - public static final ItemType BAKED_POTATO = register("minecraft:baked_potato"); - public static final ItemType BARRIER = register("minecraft:barrier"); - public static final ItemType BAT_SPAWN_EGG = register("minecraft:bat_spawn_egg"); - public static final ItemType BEACON = register("minecraft:beacon"); - public static final ItemType BEDROCK = register("minecraft:bedrock"); - public static final ItemType BEEF = register("minecraft:beef"); - public static final ItemType BEETROOT = register("minecraft:beetroot"); - public static final ItemType BEETROOT_SEEDS = register("minecraft:beetroot_seeds"); - public static final ItemType BEETROOT_SOUP = register("minecraft:beetroot_soup"); - public static final ItemType BIRCH_BOAT = register("minecraft:birch_boat"); - public static final ItemType BIRCH_BUTTON = register("minecraft:birch_button"); - public static final ItemType BIRCH_DOOR = register("minecraft:birch_door"); - public static final ItemType BIRCH_FENCE = register("minecraft:birch_fence"); - public static final ItemType BIRCH_FENCE_GATE = register("minecraft:birch_fence_gate"); - public static final ItemType BIRCH_LEAVES = register("minecraft:birch_leaves"); - public static final ItemType BIRCH_LOG = register("minecraft:birch_log"); - public static final ItemType BIRCH_PLANKS = register("minecraft:birch_planks"); - public static final ItemType BIRCH_PRESSURE_PLATE = register("minecraft:birch_pressure_plate"); - public static final ItemType BIRCH_SAPLING = register("minecraft:birch_sapling"); - public static final ItemType BIRCH_SLAB = register("minecraft:birch_slab"); - public static final ItemType BIRCH_STAIRS = register("minecraft:birch_stairs"); - public static final ItemType BIRCH_TRAPDOOR = register("minecraft:birch_trapdoor"); - public static final ItemType BIRCH_WOOD = register("minecraft:birch_wood"); - public static final ItemType BLACK_BANNER = register("minecraft:black_banner"); - public static final ItemType BLACK_BED = register("minecraft:black_bed"); - public static final ItemType BLACK_CARPET = register("minecraft:black_carpet"); - public static final ItemType BLACK_CONCRETE = register("minecraft:black_concrete"); - public static final ItemType BLACK_CONCRETE_POWDER = register("minecraft:black_concrete_powder"); - public static final ItemType BLACK_GLAZED_TERRACOTTA = register("minecraft:black_glazed_terracotta"); - public static final ItemType BLACK_SHULKER_BOX = register("minecraft:black_shulker_box"); - public static final ItemType BLACK_STAINED_GLASS = register("minecraft:black_stained_glass"); - public static final ItemType BLACK_STAINED_GLASS_PANE = register("minecraft:black_stained_glass_pane"); - public static final ItemType BLACK_TERRACOTTA = register("minecraft:black_terracotta"); - public static final ItemType BLACK_WOOL = register("minecraft:black_wool"); - public static final ItemType BLAZE_POWDER = register("minecraft:blaze_powder"); - public static final ItemType BLAZE_ROD = register("minecraft:blaze_rod"); - public static final ItemType BLAZE_SPAWN_EGG = register("minecraft:blaze_spawn_egg"); - public static final ItemType BLUE_BANNER = register("minecraft:blue_banner"); - public static final ItemType BLUE_BED = register("minecraft:blue_bed"); - public static final ItemType BLUE_CARPET = register("minecraft:blue_carpet"); - public static final ItemType BLUE_CONCRETE = register("minecraft:blue_concrete"); - public static final ItemType BLUE_CONCRETE_POWDER = register("minecraft:blue_concrete_powder"); - public static final ItemType BLUE_GLAZED_TERRACOTTA = register("minecraft:blue_glazed_terracotta"); - public static final ItemType BLUE_ICE = register("minecraft:blue_ice"); - public static final ItemType BLUE_ORCHID = register("minecraft:blue_orchid"); - public static final ItemType BLUE_SHULKER_BOX = register("minecraft:blue_shulker_box"); - public static final ItemType BLUE_STAINED_GLASS = register("minecraft:blue_stained_glass"); - public static final ItemType BLUE_STAINED_GLASS_PANE = register("minecraft:blue_stained_glass_pane"); - public static final ItemType BLUE_TERRACOTTA = register("minecraft:blue_terracotta"); - public static final ItemType BLUE_WOOL = register("minecraft:blue_wool"); - public static final ItemType BONE = register("minecraft:bone"); - public static final ItemType BONE_BLOCK = register("minecraft:bone_block"); - public static final ItemType BONE_MEAL = register("minecraft:bone_meal"); - public static final ItemType BOOK = register("minecraft:book"); - public static final ItemType BOOKSHELF = register("minecraft:bookshelf"); - public static final ItemType BOW = register("minecraft:bow"); - public static final ItemType BOWL = register("minecraft:bowl"); - public static final ItemType BRAIN_CORAL = register("minecraft:brain_coral"); - public static final ItemType BRAIN_CORAL_BLOCK = register("minecraft:brain_coral_block"); - public static final ItemType BRAIN_CORAL_FAN = register("minecraft:brain_coral_fan"); - public static final ItemType BREAD = register("minecraft:bread"); - public static final ItemType BREWING_STAND = register("minecraft:brewing_stand"); - public static final ItemType BRICK = register("minecraft:brick"); - public static final ItemType BRICK_SLAB = register("minecraft:brick_slab"); - public static final ItemType BRICK_STAIRS = register("minecraft:brick_stairs"); - public static final ItemType BRICKS = register("minecraft:bricks"); - public static final ItemType BROWN_BANNER = register("minecraft:brown_banner"); - public static final ItemType BROWN_BED = register("minecraft:brown_bed"); - public static final ItemType BROWN_CARPET = register("minecraft:brown_carpet"); - public static final ItemType BROWN_CONCRETE = register("minecraft:brown_concrete"); - public static final ItemType BROWN_CONCRETE_POWDER = register("minecraft:brown_concrete_powder"); - public static final ItemType BROWN_GLAZED_TERRACOTTA = register("minecraft:brown_glazed_terracotta"); - public static final ItemType BROWN_MUSHROOM = register("minecraft:brown_mushroom"); - public static final ItemType BROWN_MUSHROOM_BLOCK = register("minecraft:brown_mushroom_block"); - public static final ItemType BROWN_SHULKER_BOX = register("minecraft:brown_shulker_box"); - public static final ItemType BROWN_STAINED_GLASS = register("minecraft:brown_stained_glass"); - public static final ItemType BROWN_STAINED_GLASS_PANE = register("minecraft:brown_stained_glass_pane"); - public static final ItemType BROWN_TERRACOTTA = register("minecraft:brown_terracotta"); - public static final ItemType BROWN_WOOL = register("minecraft:brown_wool"); - public static final ItemType BUBBLE_CORAL = register("minecraft:bubble_coral"); - public static final ItemType BUBBLE_CORAL_BLOCK = register("minecraft:bubble_coral_block"); - public static final ItemType BUBBLE_CORAL_FAN = register("minecraft:bubble_coral_fan"); - public static final ItemType BUCKET = register("minecraft:bucket"); - public static final ItemType CACTUS = register("minecraft:cactus"); - public static final ItemType CACTUS_GREEN = register("minecraft:cactus_green"); - public static final ItemType CAKE = register("minecraft:cake"); - public static final ItemType CARROT = register("minecraft:carrot"); - public static final ItemType CARROT_ON_A_STICK = register("minecraft:carrot_on_a_stick"); - public static final ItemType CARVED_PUMPKIN = register("minecraft:carved_pumpkin"); - public static final ItemType CAULDRON = register("minecraft:cauldron"); - public static final ItemType CAVE_SPIDER_SPAWN_EGG = register("minecraft:cave_spider_spawn_egg"); - public static final ItemType CHAIN_COMMAND_BLOCK = register("minecraft:chain_command_block"); - public static final ItemType CHAINMAIL_BOOTS = register("minecraft:chainmail_boots"); - public static final ItemType CHAINMAIL_CHESTPLATE = register("minecraft:chainmail_chestplate"); - public static final ItemType CHAINMAIL_HELMET = register("minecraft:chainmail_helmet"); - public static final ItemType CHAINMAIL_LEGGINGS = register("minecraft:chainmail_leggings"); - public static final ItemType CHARCOAL = register("minecraft:charcoal"); - public static final ItemType CHEST = register("minecraft:chest"); - public static final ItemType CHEST_MINECART = register("minecraft:chest_minecart"); - public static final ItemType CHICKEN = register("minecraft:chicken"); - public static final ItemType CHICKEN_SPAWN_EGG = register("minecraft:chicken_spawn_egg"); - public static final ItemType CHIPPED_ANVIL = register("minecraft:chipped_anvil"); - public static final ItemType CHISELED_QUARTZ_BLOCK = register("minecraft:chiseled_quartz_block"); - public static final ItemType CHISELED_RED_SANDSTONE = register("minecraft:chiseled_red_sandstone"); - public static final ItemType CHISELED_SANDSTONE = register("minecraft:chiseled_sandstone"); - public static final ItemType CHISELED_STONE_BRICKS = register("minecraft:chiseled_stone_bricks"); - public static final ItemType CHORUS_FLOWER = register("minecraft:chorus_flower"); - public static final ItemType CHORUS_FRUIT = register("minecraft:chorus_fruit"); - public static final ItemType CHORUS_PLANT = register("minecraft:chorus_plant"); - public static final ItemType CLAY = register("minecraft:clay"); - public static final ItemType CLAY_BALL = register("minecraft:clay_ball"); - public static final ItemType CLOCK = register("minecraft:clock"); - public static final ItemType COAL = register("minecraft:coal"); - public static final ItemType COAL_BLOCK = register("minecraft:coal_block"); - public static final ItemType COAL_ORE = register("minecraft:coal_ore"); - public static final ItemType COARSE_DIRT = register("minecraft:coarse_dirt"); - public static final ItemType COBBLESTONE = register("minecraft:cobblestone"); - public static final ItemType COBBLESTONE_SLAB = register("minecraft:cobblestone_slab"); - public static final ItemType COBBLESTONE_STAIRS = register("minecraft:cobblestone_stairs"); - public static final ItemType COBBLESTONE_WALL = register("minecraft:cobblestone_wall"); - public static final ItemType COBWEB = register("minecraft:cobweb"); - public static final ItemType COCOA_BEANS = register("minecraft:cocoa_beans"); - public static final ItemType COD = register("minecraft:cod"); - public static final ItemType COD_BUCKET = register("minecraft:cod_bucket"); - public static final ItemType COD_SPAWN_EGG = register("minecraft:cod_spawn_egg"); - public static final ItemType COMMAND_BLOCK = register("minecraft:command_block"); - public static final ItemType COMMAND_BLOCK_MINECART = register("minecraft:command_block_minecart"); - public static final ItemType COMPARATOR = register("minecraft:comparator"); - public static final ItemType COMPASS = register("minecraft:compass"); - public static final ItemType CONDUIT = register("minecraft:conduit"); - public static final ItemType COOKED_BEEF = register("minecraft:cooked_beef"); - public static final ItemType COOKED_CHICKEN = register("minecraft:cooked_chicken"); - public static final ItemType COOKED_COD = register("minecraft:cooked_cod"); - public static final ItemType COOKED_MUTTON = register("minecraft:cooked_mutton"); - public static final ItemType COOKED_PORKCHOP = register("minecraft:cooked_porkchop"); - public static final ItemType COOKED_RABBIT = register("minecraft:cooked_rabbit"); - public static final ItemType COOKED_SALMON = register("minecraft:cooked_salmon"); - public static final ItemType COOKIE = register("minecraft:cookie"); - public static final ItemType COW_SPAWN_EGG = register("minecraft:cow_spawn_egg"); - public static final ItemType CRACKED_STONE_BRICKS = register("minecraft:cracked_stone_bricks"); - public static final ItemType CRAFTING_TABLE = register("minecraft:crafting_table"); - public static final ItemType CREEPER_HEAD = register("minecraft:creeper_head"); - public static final ItemType CREEPER_SPAWN_EGG = register("minecraft:creeper_spawn_egg"); - public static final ItemType CUT_RED_SANDSTONE = register("minecraft:cut_red_sandstone"); - public static final ItemType CUT_SANDSTONE = register("minecraft:cut_sandstone"); - public static final ItemType CYAN_BANNER = register("minecraft:cyan_banner"); - public static final ItemType CYAN_BED = register("minecraft:cyan_bed"); - public static final ItemType CYAN_CARPET = register("minecraft:cyan_carpet"); - public static final ItemType CYAN_CONCRETE = register("minecraft:cyan_concrete"); - public static final ItemType CYAN_CONCRETE_POWDER = register("minecraft:cyan_concrete_powder"); - public static final ItemType CYAN_DYE = register("minecraft:cyan_dye"); - public static final ItemType CYAN_GLAZED_TERRACOTTA = register("minecraft:cyan_glazed_terracotta"); - public static final ItemType CYAN_SHULKER_BOX = register("minecraft:cyan_shulker_box"); - public static final ItemType CYAN_STAINED_GLASS = register("minecraft:cyan_stained_glass"); - public static final ItemType CYAN_STAINED_GLASS_PANE = register("minecraft:cyan_stained_glass_pane"); - public static final ItemType CYAN_TERRACOTTA = register("minecraft:cyan_terracotta"); - public static final ItemType CYAN_WOOL = register("minecraft:cyan_wool"); - public static final ItemType DAMAGED_ANVIL = register("minecraft:damaged_anvil"); - public static final ItemType DANDELION = register("minecraft:dandelion"); - public static final ItemType DANDELION_YELLOW = register("minecraft:dandelion_yellow"); - public static final ItemType DARK_OAK_BOAT = register("minecraft:dark_oak_boat"); - public static final ItemType DARK_OAK_BUTTON = register("minecraft:dark_oak_button"); - public static final ItemType DARK_OAK_DOOR = register("minecraft:dark_oak_door"); - public static final ItemType DARK_OAK_FENCE = register("minecraft:dark_oak_fence"); - public static final ItemType DARK_OAK_FENCE_GATE = register("minecraft:dark_oak_fence_gate"); - public static final ItemType DARK_OAK_LEAVES = register("minecraft:dark_oak_leaves"); - public static final ItemType DARK_OAK_LOG = register("minecraft:dark_oak_log"); - public static final ItemType DARK_OAK_PLANKS = register("minecraft:dark_oak_planks"); - public static final ItemType DARK_OAK_PRESSURE_PLATE = register("minecraft:dark_oak_pressure_plate"); - public static final ItemType DARK_OAK_SAPLING = register("minecraft:dark_oak_sapling"); - public static final ItemType DARK_OAK_SLAB = register("minecraft:dark_oak_slab"); - public static final ItemType DARK_OAK_STAIRS = register("minecraft:dark_oak_stairs"); - public static final ItemType DARK_OAK_TRAPDOOR = register("minecraft:dark_oak_trapdoor"); - public static final ItemType DARK_OAK_WOOD = register("minecraft:dark_oak_wood"); - public static final ItemType DARK_PRISMARINE = register("minecraft:dark_prismarine"); - public static final ItemType DARK_PRISMARINE_SLAB = register("minecraft:dark_prismarine_slab"); - public static final ItemType DARK_PRISMARINE_STAIRS = register("minecraft:dark_prismarine_stairs"); - public static final ItemType DAYLIGHT_DETECTOR = register("minecraft:daylight_detector"); - public static final ItemType DEAD_BRAIN_CORAL = register("minecraft:dead_brain_coral"); - public static final ItemType DEAD_BRAIN_CORAL_BLOCK = register("minecraft:dead_brain_coral_block"); - public static final ItemType DEAD_BRAIN_CORAL_FAN = register("minecraft:dead_brain_coral_fan"); - public static final ItemType DEAD_BUBBLE_CORAL = register("minecraft:dead_bubble_coral"); - public static final ItemType DEAD_BUBBLE_CORAL_BLOCK = register("minecraft:dead_bubble_coral_block"); - public static final ItemType DEAD_BUBBLE_CORAL_FAN = register("minecraft:dead_bubble_coral_fan"); - public static final ItemType DEAD_BUSH = register("minecraft:dead_bush"); - public static final ItemType DEAD_FIRE_CORAL = register("minecraft:dead_fire_coral"); - public static final ItemType DEAD_FIRE_CORAL_BLOCK = register("minecraft:dead_fire_coral_block"); - public static final ItemType DEAD_FIRE_CORAL_FAN = register("minecraft:dead_fire_coral_fan"); - public static final ItemType DEAD_HORN_CORAL = register("minecraft:dead_horn_coral"); - public static final ItemType DEAD_HORN_CORAL_BLOCK = register("minecraft:dead_horn_coral_block"); - public static final ItemType DEAD_HORN_CORAL_FAN = register("minecraft:dead_horn_coral_fan"); - public static final ItemType DEAD_TUBE_CORAL = register("minecraft:dead_tube_coral"); - public static final ItemType DEAD_TUBE_CORAL_BLOCK = register("minecraft:dead_tube_coral_block"); - public static final ItemType DEAD_TUBE_CORAL_FAN = register("minecraft:dead_tube_coral_fan"); - public static final ItemType DEBUG_STICK = register("minecraft:debug_stick"); - public static final ItemType DETECTOR_RAIL = register("minecraft:detector_rail"); - public static final ItemType DIAMOND = register("minecraft:diamond"); - public static final ItemType DIAMOND_AXE = register("minecraft:diamond_axe"); - public static final ItemType DIAMOND_BLOCK = register("minecraft:diamond_block"); - public static final ItemType DIAMOND_BOOTS = register("minecraft:diamond_boots"); - public static final ItemType DIAMOND_CHESTPLATE = register("minecraft:diamond_chestplate"); - public static final ItemType DIAMOND_HELMET = register("minecraft:diamond_helmet"); - public static final ItemType DIAMOND_HOE = register("minecraft:diamond_hoe"); - public static final ItemType DIAMOND_HORSE_ARMOR = register("minecraft:diamond_horse_armor"); - public static final ItemType DIAMOND_LEGGINGS = register("minecraft:diamond_leggings"); - public static final ItemType DIAMOND_ORE = register("minecraft:diamond_ore"); - public static final ItemType DIAMOND_PICKAXE = register("minecraft:diamond_pickaxe"); - public static final ItemType DIAMOND_SHOVEL = register("minecraft:diamond_shovel"); - public static final ItemType DIAMOND_SWORD = register("minecraft:diamond_sword"); - public static final ItemType DIORITE = register("minecraft:diorite"); - public static final ItemType DIRT = register("minecraft:dirt"); - public static final ItemType DISPENSER = register("minecraft:dispenser"); - public static final ItemType DOLPHIN_SPAWN_EGG = register("minecraft:dolphin_spawn_egg"); - public static final ItemType DONKEY_SPAWN_EGG = register("minecraft:donkey_spawn_egg"); - public static final ItemType DRAGON_BREATH = register("minecraft:dragon_breath"); - public static final ItemType DRAGON_EGG = register("minecraft:dragon_egg"); - public static final ItemType DRAGON_HEAD = register("minecraft:dragon_head"); - public static final ItemType DRIED_KELP = register("minecraft:dried_kelp"); - public static final ItemType DRIED_KELP_BLOCK = register("minecraft:dried_kelp_block"); - public static final ItemType DROPPER = register("minecraft:dropper"); - public static final ItemType DROWNED_SPAWN_EGG = register("minecraft:drowned_spawn_egg"); - public static final ItemType EGG = register("minecraft:egg"); - public static final ItemType ELDER_GUARDIAN_SPAWN_EGG = register("minecraft:elder_guardian_spawn_egg"); - public static final ItemType ELYTRA = register("minecraft:elytra"); - public static final ItemType EMERALD = register("minecraft:emerald"); - public static final ItemType EMERALD_BLOCK = register("minecraft:emerald_block"); - public static final ItemType EMERALD_ORE = register("minecraft:emerald_ore"); - public static final ItemType ENCHANTED_BOOK = register("minecraft:enchanted_book"); - public static final ItemType ENCHANTED_GOLDEN_APPLE = register("minecraft:enchanted_golden_apple"); - public static final ItemType ENCHANTING_TABLE = register("minecraft:enchanting_table"); - public static final ItemType END_CRYSTAL = register("minecraft:end_crystal"); - public static final ItemType END_PORTAL_FRAME = register("minecraft:end_portal_frame"); - public static final ItemType END_ROD = register("minecraft:end_rod"); - public static final ItemType END_STONE = register("minecraft:end_stone"); - public static final ItemType END_STONE_BRICKS = register("minecraft:end_stone_bricks"); - public static final ItemType ENDER_CHEST = register("minecraft:ender_chest"); - public static final ItemType ENDER_EYE = register("minecraft:ender_eye"); - public static final ItemType ENDER_PEARL = register("minecraft:ender_pearl"); - public static final ItemType ENDERMAN_SPAWN_EGG = register("minecraft:enderman_spawn_egg"); - public static final ItemType ENDERMITE_SPAWN_EGG = register("minecraft:endermite_spawn_egg"); - public static final ItemType EVOKER_SPAWN_EGG = register("minecraft:evoker_spawn_egg"); - public static final ItemType EXPERIENCE_BOTTLE = register("minecraft:experience_bottle"); - public static final ItemType FARMLAND = register("minecraft:farmland"); - public static final ItemType FEATHER = register("minecraft:feather"); - public static final ItemType FERMENTED_SPIDER_EYE = register("minecraft:fermented_spider_eye"); - public static final ItemType FERN = register("minecraft:fern"); - public static final ItemType FILLED_MAP = register("minecraft:filled_map"); - public static final ItemType FIRE_CHARGE = register("minecraft:fire_charge"); - public static final ItemType FIRE_CORAL = register("minecraft:fire_coral"); - public static final ItemType FIRE_CORAL_BLOCK = register("minecraft:fire_coral_block"); - public static final ItemType FIRE_CORAL_FAN = register("minecraft:fire_coral_fan"); - public static final ItemType FIREWORK_ROCKET = register("minecraft:firework_rocket"); - public static final ItemType FIREWORK_STAR = register("minecraft:firework_star"); - public static final ItemType FISHING_ROD = register("minecraft:fishing_rod"); - public static final ItemType FLINT = register("minecraft:flint"); - public static final ItemType FLINT_AND_STEEL = register("minecraft:flint_and_steel"); - public static final ItemType FLOWER_POT = register("minecraft:flower_pot"); - public static final ItemType FURNACE = register("minecraft:furnace"); - public static final ItemType FURNACE_MINECART = register("minecraft:furnace_minecart"); - public static final ItemType GHAST_SPAWN_EGG = register("minecraft:ghast_spawn_egg"); - public static final ItemType GHAST_TEAR = register("minecraft:ghast_tear"); - public static final ItemType GLASS = register("minecraft:glass"); - public static final ItemType GLASS_BOTTLE = register("minecraft:glass_bottle"); - public static final ItemType GLASS_PANE = register("minecraft:glass_pane"); - public static final ItemType GLISTERING_MELON_SLICE = register("minecraft:glistering_melon_slice"); - public static final ItemType GLOWSTONE = register("minecraft:glowstone"); - public static final ItemType GLOWSTONE_DUST = register("minecraft:glowstone_dust"); - public static final ItemType GOLD_BLOCK = register("minecraft:gold_block"); - public static final ItemType GOLD_INGOT = register("minecraft:gold_ingot"); - public static final ItemType GOLD_NUGGET = register("minecraft:gold_nugget"); - public static final ItemType GOLD_ORE = register("minecraft:gold_ore"); - public static final ItemType GOLDEN_APPLE = register("minecraft:golden_apple"); - public static final ItemType GOLDEN_AXE = register("minecraft:golden_axe"); - public static final ItemType GOLDEN_BOOTS = register("minecraft:golden_boots"); - public static final ItemType GOLDEN_CARROT = register("minecraft:golden_carrot"); - public static final ItemType GOLDEN_CHESTPLATE = register("minecraft:golden_chestplate"); - public static final ItemType GOLDEN_HELMET = register("minecraft:golden_helmet"); - public static final ItemType GOLDEN_HOE = register("minecraft:golden_hoe"); - public static final ItemType GOLDEN_HORSE_ARMOR = register("minecraft:golden_horse_armor"); - public static final ItemType GOLDEN_LEGGINGS = register("minecraft:golden_leggings"); - public static final ItemType GOLDEN_PICKAXE = register("minecraft:golden_pickaxe"); - public static final ItemType GOLDEN_SHOVEL = register("minecraft:golden_shovel"); - public static final ItemType GOLDEN_SWORD = register("minecraft:golden_sword"); - public static final ItemType GRANITE = register("minecraft:granite"); - public static final ItemType GRASS = register("minecraft:grass"); - public static final ItemType GRASS_BLOCK = register("minecraft:grass_block"); - public static final ItemType GRASS_PATH = register("minecraft:grass_path"); - public static final ItemType GRAVEL = register("minecraft:gravel"); - public static final ItemType GRAY_BANNER = register("minecraft:gray_banner"); - public static final ItemType GRAY_BED = register("minecraft:gray_bed"); - public static final ItemType GRAY_CARPET = register("minecraft:gray_carpet"); - public static final ItemType GRAY_CONCRETE = register("minecraft:gray_concrete"); - public static final ItemType GRAY_CONCRETE_POWDER = register("minecraft:gray_concrete_powder"); - public static final ItemType GRAY_DYE = register("minecraft:gray_dye"); - public static final ItemType GRAY_GLAZED_TERRACOTTA = register("minecraft:gray_glazed_terracotta"); - public static final ItemType GRAY_SHULKER_BOX = register("minecraft:gray_shulker_box"); - public static final ItemType GRAY_STAINED_GLASS = register("minecraft:gray_stained_glass"); - public static final ItemType GRAY_STAINED_GLASS_PANE = register("minecraft:gray_stained_glass_pane"); - public static final ItemType GRAY_TERRACOTTA = register("minecraft:gray_terracotta"); - public static final ItemType GRAY_WOOL = register("minecraft:gray_wool"); - public static final ItemType GREEN_BANNER = register("minecraft:green_banner"); - public static final ItemType GREEN_BED = register("minecraft:green_bed"); - public static final ItemType GREEN_CARPET = register("minecraft:green_carpet"); - public static final ItemType GREEN_CONCRETE = register("minecraft:green_concrete"); - public static final ItemType GREEN_CONCRETE_POWDER = register("minecraft:green_concrete_powder"); - public static final ItemType GREEN_GLAZED_TERRACOTTA = register("minecraft:green_glazed_terracotta"); - public static final ItemType GREEN_SHULKER_BOX = register("minecraft:green_shulker_box"); - public static final ItemType GREEN_STAINED_GLASS = register("minecraft:green_stained_glass"); - public static final ItemType GREEN_STAINED_GLASS_PANE = register("minecraft:green_stained_glass_pane"); - public static final ItemType GREEN_TERRACOTTA = register("minecraft:green_terracotta"); - public static final ItemType GREEN_WOOL = register("minecraft:green_wool"); - public static final ItemType GUARDIAN_SPAWN_EGG = register("minecraft:guardian_spawn_egg"); - public static final ItemType GUNPOWDER = register("minecraft:gunpowder"); - public static final ItemType HAY_BLOCK = register("minecraft:hay_block"); - public static final ItemType HEART_OF_THE_SEA = register("minecraft:heart_of_the_sea"); - public static final ItemType HEAVY_WEIGHTED_PRESSURE_PLATE = register("minecraft:heavy_weighted_pressure_plate"); - public static final ItemType HOPPER = register("minecraft:hopper"); - public static final ItemType HOPPER_MINECART = register("minecraft:hopper_minecart"); - public static final ItemType HORN_CORAL = register("minecraft:horn_coral"); - public static final ItemType HORN_CORAL_BLOCK = register("minecraft:horn_coral_block"); - public static final ItemType HORN_CORAL_FAN = register("minecraft:horn_coral_fan"); - public static final ItemType HORSE_SPAWN_EGG = register("minecraft:horse_spawn_egg"); - public static final ItemType HUSK_SPAWN_EGG = register("minecraft:husk_spawn_egg"); - public static final ItemType ICE = register("minecraft:ice"); - public static final ItemType INFESTED_CHISELED_STONE_BRICKS = register("minecraft:infested_chiseled_stone_bricks"); - public static final ItemType INFESTED_COBBLESTONE = register("minecraft:infested_cobblestone"); - public static final ItemType INFESTED_CRACKED_STONE_BRICKS = register("minecraft:infested_cracked_stone_bricks"); - public static final ItemType INFESTED_MOSSY_STONE_BRICKS = register("minecraft:infested_mossy_stone_bricks"); - public static final ItemType INFESTED_STONE = register("minecraft:infested_stone"); - public static final ItemType INFESTED_STONE_BRICKS = register("minecraft:infested_stone_bricks"); - public static final ItemType INK_SAC = register("minecraft:ink_sac"); - public static final ItemType IRON_AXE = register("minecraft:iron_axe"); - public static final ItemType IRON_BARS = register("minecraft:iron_bars"); - public static final ItemType IRON_BLOCK = register("minecraft:iron_block"); - public static final ItemType IRON_BOOTS = register("minecraft:iron_boots"); - public static final ItemType IRON_CHESTPLATE = register("minecraft:iron_chestplate"); - public static final ItemType IRON_DOOR = register("minecraft:iron_door"); - public static final ItemType IRON_HELMET = register("minecraft:iron_helmet"); - public static final ItemType IRON_HOE = register("minecraft:iron_hoe"); - public static final ItemType IRON_HORSE_ARMOR = register("minecraft:iron_horse_armor"); - public static final ItemType IRON_INGOT = register("minecraft:iron_ingot"); - public static final ItemType IRON_LEGGINGS = register("minecraft:iron_leggings"); - public static final ItemType IRON_NUGGET = register("minecraft:iron_nugget"); - public static final ItemType IRON_ORE = register("minecraft:iron_ore"); - public static final ItemType IRON_PICKAXE = register("minecraft:iron_pickaxe"); - public static final ItemType IRON_SHOVEL = register("minecraft:iron_shovel"); - public static final ItemType IRON_SWORD = register("minecraft:iron_sword"); - public static final ItemType IRON_TRAPDOOR = register("minecraft:iron_trapdoor"); - public static final ItemType ITEM_FRAME = register("minecraft:item_frame"); - public static final ItemType JACK_O_LANTERN = register("minecraft:jack_o_lantern"); - public static final ItemType JUKEBOX = register("minecraft:jukebox"); - public static final ItemType JUNGLE_BOAT = register("minecraft:jungle_boat"); - public static final ItemType JUNGLE_BUTTON = register("minecraft:jungle_button"); - public static final ItemType JUNGLE_DOOR = register("minecraft:jungle_door"); - public static final ItemType JUNGLE_FENCE = register("minecraft:jungle_fence"); - public static final ItemType JUNGLE_FENCE_GATE = register("minecraft:jungle_fence_gate"); - public static final ItemType JUNGLE_LEAVES = register("minecraft:jungle_leaves"); - public static final ItemType JUNGLE_LOG = register("minecraft:jungle_log"); - public static final ItemType JUNGLE_PLANKS = register("minecraft:jungle_planks"); - public static final ItemType JUNGLE_PRESSURE_PLATE = register("minecraft:jungle_pressure_plate"); - public static final ItemType JUNGLE_SAPLING = register("minecraft:jungle_sapling"); - public static final ItemType JUNGLE_SLAB = register("minecraft:jungle_slab"); - public static final ItemType JUNGLE_STAIRS = register("minecraft:jungle_stairs"); - public static final ItemType JUNGLE_TRAPDOOR = register("minecraft:jungle_trapdoor"); - public static final ItemType JUNGLE_WOOD = register("minecraft:jungle_wood"); - public static final ItemType KELP = register("minecraft:kelp"); - public static final ItemType KNOWLEDGE_BOOK = register("minecraft:knowledge_book"); - public static final ItemType LADDER = register("minecraft:ladder"); - public static final ItemType LAPIS_BLOCK = register("minecraft:lapis_block"); - public static final ItemType LAPIS_LAZULI = register("minecraft:lapis_lazuli"); - public static final ItemType LAPIS_ORE = register("minecraft:lapis_ore"); - public static final ItemType LARGE_FERN = register("minecraft:large_fern"); - public static final ItemType LAVA_BUCKET = register("minecraft:lava_bucket"); - public static final ItemType LEAD = register("minecraft:lead"); - public static final ItemType LEATHER = register("minecraft:leather"); - public static final ItemType LEATHER_BOOTS = register("minecraft:leather_boots"); - public static final ItemType LEATHER_CHESTPLATE = register("minecraft:leather_chestplate"); - public static final ItemType LEATHER_HELMET = register("minecraft:leather_helmet"); - public static final ItemType LEATHER_LEGGINGS = register("minecraft:leather_leggings"); - public static final ItemType LEVER = register("minecraft:lever"); - public static final ItemType LIGHT_BLUE_BANNER = register("minecraft:light_blue_banner"); - public static final ItemType LIGHT_BLUE_BED = register("minecraft:light_blue_bed"); - public static final ItemType LIGHT_BLUE_CARPET = register("minecraft:light_blue_carpet"); - public static final ItemType LIGHT_BLUE_CONCRETE = register("minecraft:light_blue_concrete"); - public static final ItemType LIGHT_BLUE_CONCRETE_POWDER = register("minecraft:light_blue_concrete_powder"); - public static final ItemType LIGHT_BLUE_DYE = register("minecraft:light_blue_dye"); - public static final ItemType LIGHT_BLUE_GLAZED_TERRACOTTA = register("minecraft:light_blue_glazed_terracotta"); - public static final ItemType LIGHT_BLUE_SHULKER_BOX = register("minecraft:light_blue_shulker_box"); - public static final ItemType LIGHT_BLUE_STAINED_GLASS = register("minecraft:light_blue_stained_glass"); - public static final ItemType LIGHT_BLUE_STAINED_GLASS_PANE = register("minecraft:light_blue_stained_glass_pane"); - public static final ItemType LIGHT_BLUE_TERRACOTTA = register("minecraft:light_blue_terracotta"); - public static final ItemType LIGHT_BLUE_WOOL = register("minecraft:light_blue_wool"); - public static final ItemType LIGHT_GRAY_BANNER = register("minecraft:light_gray_banner"); - public static final ItemType LIGHT_GRAY_BED = register("minecraft:light_gray_bed"); - public static final ItemType LIGHT_GRAY_CARPET = register("minecraft:light_gray_carpet"); - public static final ItemType LIGHT_GRAY_CONCRETE = register("minecraft:light_gray_concrete"); - public static final ItemType LIGHT_GRAY_CONCRETE_POWDER = register("minecraft:light_gray_concrete_powder"); - public static final ItemType LIGHT_GRAY_DYE = register("minecraft:light_gray_dye"); - public static final ItemType LIGHT_GRAY_GLAZED_TERRACOTTA = register("minecraft:light_gray_glazed_terracotta"); - public static final ItemType LIGHT_GRAY_SHULKER_BOX = register("minecraft:light_gray_shulker_box"); - public static final ItemType LIGHT_GRAY_STAINED_GLASS = register("minecraft:light_gray_stained_glass"); - public static final ItemType LIGHT_GRAY_STAINED_GLASS_PANE = register("minecraft:light_gray_stained_glass_pane"); - public static final ItemType LIGHT_GRAY_TERRACOTTA = register("minecraft:light_gray_terracotta"); - public static final ItemType LIGHT_GRAY_WOOL = register("minecraft:light_gray_wool"); - public static final ItemType LIGHT_WEIGHTED_PRESSURE_PLATE = register("minecraft:light_weighted_pressure_plate"); - public static final ItemType LILAC = register("minecraft:lilac"); - public static final ItemType LILY_PAD = register("minecraft:lily_pad"); - public static final ItemType LIME_BANNER = register("minecraft:lime_banner"); - public static final ItemType LIME_BED = register("minecraft:lime_bed"); - public static final ItemType LIME_CARPET = register("minecraft:lime_carpet"); - public static final ItemType LIME_CONCRETE = register("minecraft:lime_concrete"); - public static final ItemType LIME_CONCRETE_POWDER = register("minecraft:lime_concrete_powder"); - public static final ItemType LIME_DYE = register("minecraft:lime_dye"); - public static final ItemType LIME_GLAZED_TERRACOTTA = register("minecraft:lime_glazed_terracotta"); - public static final ItemType LIME_SHULKER_BOX = register("minecraft:lime_shulker_box"); - public static final ItemType LIME_STAINED_GLASS = register("minecraft:lime_stained_glass"); - public static final ItemType LIME_STAINED_GLASS_PANE = register("minecraft:lime_stained_glass_pane"); - public static final ItemType LIME_TERRACOTTA = register("minecraft:lime_terracotta"); - public static final ItemType LIME_WOOL = register("minecraft:lime_wool"); - public static final ItemType LINGERING_POTION = register("minecraft:lingering_potion"); - public static final ItemType LLAMA_SPAWN_EGG = register("minecraft:llama_spawn_egg"); - public static final ItemType MAGENTA_BANNER = register("minecraft:magenta_banner"); - public static final ItemType MAGENTA_BED = register("minecraft:magenta_bed"); - public static final ItemType MAGENTA_CARPET = register("minecraft:magenta_carpet"); - public static final ItemType MAGENTA_CONCRETE = register("minecraft:magenta_concrete"); - public static final ItemType MAGENTA_CONCRETE_POWDER = register("minecraft:magenta_concrete_powder"); - public static final ItemType MAGENTA_DYE = register("minecraft:magenta_dye"); - public static final ItemType MAGENTA_GLAZED_TERRACOTTA = register("minecraft:magenta_glazed_terracotta"); - public static final ItemType MAGENTA_SHULKER_BOX = register("minecraft:magenta_shulker_box"); - public static final ItemType MAGENTA_STAINED_GLASS = register("minecraft:magenta_stained_glass"); - public static final ItemType MAGENTA_STAINED_GLASS_PANE = register("minecraft:magenta_stained_glass_pane"); - public static final ItemType MAGENTA_TERRACOTTA = register("minecraft:magenta_terracotta"); - public static final ItemType MAGENTA_WOOL = register("minecraft:magenta_wool"); - public static final ItemType MAGMA_BLOCK = register("minecraft:magma_block"); - public static final ItemType MAGMA_CREAM = register("minecraft:magma_cream"); - public static final ItemType MAGMA_CUBE_SPAWN_EGG = register("minecraft:magma_cube_spawn_egg"); - public static final ItemType MAP = register("minecraft:map"); - public static final ItemType MELON = register("minecraft:melon"); - public static final ItemType MELON_SEEDS = register("minecraft:melon_seeds"); - public static final ItemType MELON_SLICE = register("minecraft:melon_slice"); - public static final ItemType MILK_BUCKET = register("minecraft:milk_bucket"); - public static final ItemType MINECART = register("minecraft:minecart"); - public static final ItemType MOOSHROOM_SPAWN_EGG = register("minecraft:mooshroom_spawn_egg"); - public static final ItemType MOSSY_COBBLESTONE = register("minecraft:mossy_cobblestone"); - public static final ItemType MOSSY_COBBLESTONE_WALL = register("minecraft:mossy_cobblestone_wall"); - public static final ItemType MOSSY_STONE_BRICKS = register("minecraft:mossy_stone_bricks"); - public static final ItemType MULE_SPAWN_EGG = register("minecraft:mule_spawn_egg"); - public static final ItemType MUSHROOM_STEM = register("minecraft:mushroom_stem"); - public static final ItemType MUSHROOM_STEW = register("minecraft:mushroom_stew"); - public static final ItemType MUSIC_DISC_11 = register("minecraft:music_disc_11"); - public static final ItemType MUSIC_DISC_13 = register("minecraft:music_disc_13"); - public static final ItemType MUSIC_DISC_BLOCKS = register("minecraft:music_disc_blocks"); - public static final ItemType MUSIC_DISC_CAT = register("minecraft:music_disc_cat"); - public static final ItemType MUSIC_DISC_CHIRP = register("minecraft:music_disc_chirp"); - public static final ItemType MUSIC_DISC_FAR = register("minecraft:music_disc_far"); - public static final ItemType MUSIC_DISC_MALL = register("minecraft:music_disc_mall"); - public static final ItemType MUSIC_DISC_MELLOHI = register("minecraft:music_disc_mellohi"); - public static final ItemType MUSIC_DISC_STAL = register("minecraft:music_disc_stal"); - public static final ItemType MUSIC_DISC_STRAD = register("minecraft:music_disc_strad"); - public static final ItemType MUSIC_DISC_WAIT = register("minecraft:music_disc_wait"); - public static final ItemType MUSIC_DISC_WARD = register("minecraft:music_disc_ward"); - public static final ItemType MUTTON = register("minecraft:mutton"); - public static final ItemType MYCELIUM = register("minecraft:mycelium"); - public static final ItemType NAME_TAG = register("minecraft:name_tag"); - public static final ItemType NAUTILUS_SHELL = register("minecraft:nautilus_shell"); - public static final ItemType NETHER_BRICK = register("minecraft:nether_brick"); - public static final ItemType NETHER_BRICK_FENCE = register("minecraft:nether_brick_fence"); - public static final ItemType NETHER_BRICK_SLAB = register("minecraft:nether_brick_slab"); - public static final ItemType NETHER_BRICK_STAIRS = register("minecraft:nether_brick_stairs"); - public static final ItemType NETHER_BRICKS = register("minecraft:nether_bricks"); - public static final ItemType NETHER_QUARTZ_ORE = register("minecraft:nether_quartz_ore"); - public static final ItemType NETHER_STAR = register("minecraft:nether_star"); - public static final ItemType NETHER_WART = register("minecraft:nether_wart"); - public static final ItemType NETHER_WART_BLOCK = register("minecraft:nether_wart_block"); - public static final ItemType NETHERRACK = register("minecraft:netherrack"); - public static final ItemType NOTE_BLOCK = register("minecraft:note_block"); - public static final ItemType OAK_BOAT = register("minecraft:oak_boat"); - public static final ItemType OAK_BUTTON = register("minecraft:oak_button"); - public static final ItemType OAK_DOOR = register("minecraft:oak_door"); - public static final ItemType OAK_FENCE = register("minecraft:oak_fence"); - public static final ItemType OAK_FENCE_GATE = register("minecraft:oak_fence_gate"); - public static final ItemType OAK_LEAVES = register("minecraft:oak_leaves"); - public static final ItemType OAK_LOG = register("minecraft:oak_log"); - public static final ItemType OAK_PLANKS = register("minecraft:oak_planks"); - public static final ItemType OAK_PRESSURE_PLATE = register("minecraft:oak_pressure_plate"); - public static final ItemType OAK_SAPLING = register("minecraft:oak_sapling"); - public static final ItemType OAK_SLAB = register("minecraft:oak_slab"); - public static final ItemType OAK_STAIRS = register("minecraft:oak_stairs"); - public static final ItemType OAK_TRAPDOOR = register("minecraft:oak_trapdoor"); - public static final ItemType OAK_WOOD = register("minecraft:oak_wood"); - public static final ItemType OBSERVER = register("minecraft:observer"); - public static final ItemType OBSIDIAN = register("minecraft:obsidian"); - public static final ItemType OCELOT_SPAWN_EGG = register("minecraft:ocelot_spawn_egg"); - public static final ItemType ORANGE_BANNER = register("minecraft:orange_banner"); - public static final ItemType ORANGE_BED = register("minecraft:orange_bed"); - public static final ItemType ORANGE_CARPET = register("minecraft:orange_carpet"); - public static final ItemType ORANGE_CONCRETE = register("minecraft:orange_concrete"); - public static final ItemType ORANGE_CONCRETE_POWDER = register("minecraft:orange_concrete_powder"); - public static final ItemType ORANGE_DYE = register("minecraft:orange_dye"); - public static final ItemType ORANGE_GLAZED_TERRACOTTA = register("minecraft:orange_glazed_terracotta"); - public static final ItemType ORANGE_SHULKER_BOX = register("minecraft:orange_shulker_box"); - public static final ItemType ORANGE_STAINED_GLASS = register("minecraft:orange_stained_glass"); - public static final ItemType ORANGE_STAINED_GLASS_PANE = register("minecraft:orange_stained_glass_pane"); - public static final ItemType ORANGE_TERRACOTTA = register("minecraft:orange_terracotta"); - public static final ItemType ORANGE_TULIP = register("minecraft:orange_tulip"); - public static final ItemType ORANGE_WOOL = register("minecraft:orange_wool"); - public static final ItemType OXEYE_DAISY = register("minecraft:oxeye_daisy"); - public static final ItemType PACKED_ICE = register("minecraft:packed_ice"); - public static final ItemType PAINTING = register("minecraft:painting"); - public static final ItemType PAPER = register("minecraft:paper"); - public static final ItemType PARROT_SPAWN_EGG = register("minecraft:parrot_spawn_egg"); - public static final ItemType PEONY = register("minecraft:peony"); - public static final ItemType PETRIFIED_OAK_SLAB = register("minecraft:petrified_oak_slab"); - public static final ItemType PHANTOM_MEMBRANE = register("minecraft:phantom_membrane"); - public static final ItemType PHANTOM_SPAWN_EGG = register("minecraft:phantom_spawn_egg"); - public static final ItemType PIG_SPAWN_EGG = register("minecraft:pig_spawn_egg"); - public static final ItemType PINK_BANNER = register("minecraft:pink_banner"); - public static final ItemType PINK_BED = register("minecraft:pink_bed"); - public static final ItemType PINK_CARPET = register("minecraft:pink_carpet"); - public static final ItemType PINK_CONCRETE = register("minecraft:pink_concrete"); - public static final ItemType PINK_CONCRETE_POWDER = register("minecraft:pink_concrete_powder"); - public static final ItemType PINK_DYE = register("minecraft:pink_dye"); - public static final ItemType PINK_GLAZED_TERRACOTTA = register("minecraft:pink_glazed_terracotta"); - public static final ItemType PINK_SHULKER_BOX = register("minecraft:pink_shulker_box"); - public static final ItemType PINK_STAINED_GLASS = register("minecraft:pink_stained_glass"); - public static final ItemType PINK_STAINED_GLASS_PANE = register("minecraft:pink_stained_glass_pane"); - public static final ItemType PINK_TERRACOTTA = register("minecraft:pink_terracotta"); - public static final ItemType PINK_TULIP = register("minecraft:pink_tulip"); - public static final ItemType PINK_WOOL = register("minecraft:pink_wool"); - public static final ItemType PISTON = register("minecraft:piston"); - public static final ItemType PLAYER_HEAD = register("minecraft:player_head"); - public static final ItemType PODZOL = register("minecraft:podzol"); - public static final ItemType POISONOUS_POTATO = register("minecraft:poisonous_potato"); - public static final ItemType POLAR_BEAR_SPAWN_EGG = register("minecraft:polar_bear_spawn_egg"); - public static final ItemType POLISHED_ANDESITE = register("minecraft:polished_andesite"); - public static final ItemType POLISHED_DIORITE = register("minecraft:polished_diorite"); - public static final ItemType POLISHED_GRANITE = register("minecraft:polished_granite"); - public static final ItemType POPPED_CHORUS_FRUIT = register("minecraft:popped_chorus_fruit"); - public static final ItemType POPPY = register("minecraft:poppy"); - public static final ItemType PORKCHOP = register("minecraft:porkchop"); - public static final ItemType POTATO = register("minecraft:potato"); - public static final ItemType POTION = register("minecraft:potion"); - public static final ItemType POWERED_RAIL = register("minecraft:powered_rail"); - public static final ItemType PRISMARINE = register("minecraft:prismarine"); - public static final ItemType PRISMARINE_BRICK_SLAB = register("minecraft:prismarine_brick_slab"); - public static final ItemType PRISMARINE_BRICK_STAIRS = register("minecraft:prismarine_brick_stairs"); - public static final ItemType PRISMARINE_BRICKS = register("minecraft:prismarine_bricks"); - public static final ItemType PRISMARINE_CRYSTALS = register("minecraft:prismarine_crystals"); - public static final ItemType PRISMARINE_SHARD = register("minecraft:prismarine_shard"); - public static final ItemType PRISMARINE_SLAB = register("minecraft:prismarine_slab"); - public static final ItemType PRISMARINE_STAIRS = register("minecraft:prismarine_stairs"); - public static final ItemType PUFFERFISH = register("minecraft:pufferfish"); - public static final ItemType PUFFERFISH_BUCKET = register("minecraft:pufferfish_bucket"); - public static final ItemType PUFFERFISH_SPAWN_EGG = register("minecraft:pufferfish_spawn_egg"); - public static final ItemType PUMPKIN = register("minecraft:pumpkin"); - public static final ItemType PUMPKIN_PIE = register("minecraft:pumpkin_pie"); - public static final ItemType PUMPKIN_SEEDS = register("minecraft:pumpkin_seeds"); - public static final ItemType PURPLE_BANNER = register("minecraft:purple_banner"); - public static final ItemType PURPLE_BED = register("minecraft:purple_bed"); - public static final ItemType PURPLE_CARPET = register("minecraft:purple_carpet"); - public static final ItemType PURPLE_CONCRETE = register("minecraft:purple_concrete"); - public static final ItemType PURPLE_CONCRETE_POWDER = register("minecraft:purple_concrete_powder"); - public static final ItemType PURPLE_DYE = register("minecraft:purple_dye"); - public static final ItemType PURPLE_GLAZED_TERRACOTTA = register("minecraft:purple_glazed_terracotta"); - public static final ItemType PURPLE_SHULKER_BOX = register("minecraft:purple_shulker_box"); - public static final ItemType PURPLE_STAINED_GLASS = register("minecraft:purple_stained_glass"); - public static final ItemType PURPLE_STAINED_GLASS_PANE = register("minecraft:purple_stained_glass_pane"); - public static final ItemType PURPLE_TERRACOTTA = register("minecraft:purple_terracotta"); - public static final ItemType PURPLE_WOOL = register("minecraft:purple_wool"); - public static final ItemType PURPUR_BLOCK = register("minecraft:purpur_block"); - public static final ItemType PURPUR_PILLAR = register("minecraft:purpur_pillar"); - public static final ItemType PURPUR_SLAB = register("minecraft:purpur_slab"); - public static final ItemType PURPUR_STAIRS = register("minecraft:purpur_stairs"); - public static final ItemType QUARTZ = register("minecraft:quartz"); - public static final ItemType QUARTZ_BLOCK = register("minecraft:quartz_block"); - public static final ItemType QUARTZ_PILLAR = register("minecraft:quartz_pillar"); - public static final ItemType QUARTZ_SLAB = register("minecraft:quartz_slab"); - public static final ItemType QUARTZ_STAIRS = register("minecraft:quartz_stairs"); - public static final ItemType RABBIT = register("minecraft:rabbit"); - public static final ItemType RABBIT_FOOT = register("minecraft:rabbit_foot"); - public static final ItemType RABBIT_HIDE = register("minecraft:rabbit_hide"); - public static final ItemType RABBIT_SPAWN_EGG = register("minecraft:rabbit_spawn_egg"); - public static final ItemType RABBIT_STEW = register("minecraft:rabbit_stew"); - public static final ItemType RAIL = register("minecraft:rail"); - public static final ItemType RED_BANNER = register("minecraft:red_banner"); - public static final ItemType RED_BED = register("minecraft:red_bed"); - public static final ItemType RED_CARPET = register("minecraft:red_carpet"); - public static final ItemType RED_CONCRETE = register("minecraft:red_concrete"); - public static final ItemType RED_CONCRETE_POWDER = register("minecraft:red_concrete_powder"); - public static final ItemType RED_GLAZED_TERRACOTTA = register("minecraft:red_glazed_terracotta"); - public static final ItemType RED_MUSHROOM = register("minecraft:red_mushroom"); - public static final ItemType RED_MUSHROOM_BLOCK = register("minecraft:red_mushroom_block"); - public static final ItemType RED_NETHER_BRICKS = register("minecraft:red_nether_bricks"); - public static final ItemType RED_SAND = register("minecraft:red_sand"); - public static final ItemType RED_SANDSTONE = register("minecraft:red_sandstone"); - public static final ItemType RED_SANDSTONE_SLAB = register("minecraft:red_sandstone_slab"); - public static final ItemType RED_SANDSTONE_STAIRS = register("minecraft:red_sandstone_stairs"); - public static final ItemType RED_SHULKER_BOX = register("minecraft:red_shulker_box"); - public static final ItemType RED_STAINED_GLASS = register("minecraft:red_stained_glass"); - public static final ItemType RED_STAINED_GLASS_PANE = register("minecraft:red_stained_glass_pane"); - public static final ItemType RED_TERRACOTTA = register("minecraft:red_terracotta"); - public static final ItemType RED_TULIP = register("minecraft:red_tulip"); - public static final ItemType RED_WOOL = register("minecraft:red_wool"); - public static final ItemType REDSTONE = register("minecraft:redstone"); - public static final ItemType REDSTONE_BLOCK = register("minecraft:redstone_block"); - public static final ItemType REDSTONE_LAMP = register("minecraft:redstone_lamp"); - public static final ItemType REDSTONE_ORE = register("minecraft:redstone_ore"); - public static final ItemType REDSTONE_TORCH = register("minecraft:redstone_torch"); - public static final ItemType REPEATER = register("minecraft:repeater"); - public static final ItemType REPEATING_COMMAND_BLOCK = register("minecraft:repeating_command_block"); - public static final ItemType ROSE_BUSH = register("minecraft:rose_bush"); - public static final ItemType ROSE_RED = register("minecraft:rose_red"); - public static final ItemType ROTTEN_FLESH = register("minecraft:rotten_flesh"); - public static final ItemType SADDLE = register("minecraft:saddle"); - public static final ItemType SALMON = register("minecraft:salmon"); - public static final ItemType SALMON_BUCKET = register("minecraft:salmon_bucket"); - public static final ItemType SALMON_SPAWN_EGG = register("minecraft:salmon_spawn_egg"); - public static final ItemType SAND = register("minecraft:sand"); - public static final ItemType SANDSTONE = register("minecraft:sandstone"); - public static final ItemType SANDSTONE_SLAB = register("minecraft:sandstone_slab"); - public static final ItemType SANDSTONE_STAIRS = register("minecraft:sandstone_stairs"); - public static final ItemType SCUTE = register("minecraft:scute"); - public static final ItemType SEA_LANTERN = register("minecraft:sea_lantern"); - public static final ItemType SEA_PICKLE = register("minecraft:sea_pickle"); - public static final ItemType SEAGRASS = register("minecraft:seagrass"); - public static final ItemType SHEARS = register("minecraft:shears"); - public static final ItemType SHEEP_SPAWN_EGG = register("minecraft:sheep_spawn_egg"); - public static final ItemType SHIELD = register("minecraft:shield"); - public static final ItemType SHULKER_BOX = register("minecraft:shulker_box"); - public static final ItemType SHULKER_SHELL = register("minecraft:shulker_shell"); - public static final ItemType SHULKER_SPAWN_EGG = register("minecraft:shulker_spawn_egg"); - public static final ItemType SIGN = register("minecraft:sign"); - public static final ItemType SILVERFISH_SPAWN_EGG = register("minecraft:silverfish_spawn_egg"); - public static final ItemType SKELETON_HORSE_SPAWN_EGG = register("minecraft:skeleton_horse_spawn_egg"); - public static final ItemType SKELETON_SKULL = register("minecraft:skeleton_skull"); - public static final ItemType SKELETON_SPAWN_EGG = register("minecraft:skeleton_spawn_egg"); - public static final ItemType SLIME_BALL = register("minecraft:slime_ball"); - public static final ItemType SLIME_BLOCK = register("minecraft:slime_block"); - public static final ItemType SLIME_SPAWN_EGG = register("minecraft:slime_spawn_egg"); - public static final ItemType SMOOTH_QUARTZ = register("minecraft:smooth_quartz"); - public static final ItemType SMOOTH_RED_SANDSTONE = register("minecraft:smooth_red_sandstone"); - public static final ItemType SMOOTH_SANDSTONE = register("minecraft:smooth_sandstone"); - public static final ItemType SMOOTH_STONE = register("minecraft:smooth_stone"); - public static final ItemType SNOW = register("minecraft:snow"); - public static final ItemType SNOW_BLOCK = register("minecraft:snow_block"); - public static final ItemType SNOWBALL = register("minecraft:snowball"); - public static final ItemType SOUL_SAND = register("minecraft:soul_sand"); - public static final ItemType SPAWNER = register("minecraft:spawner"); - public static final ItemType SPECTRAL_ARROW = register("minecraft:spectral_arrow"); - public static final ItemType SPIDER_EYE = register("minecraft:spider_eye"); - public static final ItemType SPIDER_SPAWN_EGG = register("minecraft:spider_spawn_egg"); - public static final ItemType SPLASH_POTION = register("minecraft:splash_potion"); - public static final ItemType SPONGE = register("minecraft:sponge"); - public static final ItemType SPRUCE_BOAT = register("minecraft:spruce_boat"); - public static final ItemType SPRUCE_BUTTON = register("minecraft:spruce_button"); - public static final ItemType SPRUCE_DOOR = register("minecraft:spruce_door"); - public static final ItemType SPRUCE_FENCE = register("minecraft:spruce_fence"); - public static final ItemType SPRUCE_FENCE_GATE = register("minecraft:spruce_fence_gate"); - public static final ItemType SPRUCE_LEAVES = register("minecraft:spruce_leaves"); - public static final ItemType SPRUCE_LOG = register("minecraft:spruce_log"); - public static final ItemType SPRUCE_PLANKS = register("minecraft:spruce_planks"); - public static final ItemType SPRUCE_PRESSURE_PLATE = register("minecraft:spruce_pressure_plate"); - public static final ItemType SPRUCE_SAPLING = register("minecraft:spruce_sapling"); - public static final ItemType SPRUCE_SLAB = register("minecraft:spruce_slab"); - public static final ItemType SPRUCE_STAIRS = register("minecraft:spruce_stairs"); - public static final ItemType SPRUCE_TRAPDOOR = register("minecraft:spruce_trapdoor"); - public static final ItemType SPRUCE_WOOD = register("minecraft:spruce_wood"); - public static final ItemType SQUID_SPAWN_EGG = register("minecraft:squid_spawn_egg"); - public static final ItemType STICK = register("minecraft:stick"); - public static final ItemType STICKY_PISTON = register("minecraft:sticky_piston"); - public static final ItemType STONE = register("minecraft:stone"); - public static final ItemType STONE_AXE = register("minecraft:stone_axe"); - public static final ItemType STONE_BRICK_SLAB = register("minecraft:stone_brick_slab"); - public static final ItemType STONE_BRICK_STAIRS = register("minecraft:stone_brick_stairs"); - public static final ItemType STONE_BRICKS = register("minecraft:stone_bricks"); - public static final ItemType STONE_BUTTON = register("minecraft:stone_button"); - public static final ItemType STONE_HOE = register("minecraft:stone_hoe"); - public static final ItemType STONE_PICKAXE = register("minecraft:stone_pickaxe"); - public static final ItemType STONE_PRESSURE_PLATE = register("minecraft:stone_pressure_plate"); - public static final ItemType STONE_SHOVEL = register("minecraft:stone_shovel"); - public static final ItemType STONE_SLAB = register("minecraft:stone_slab"); - public static final ItemType STONE_SWORD = register("minecraft:stone_sword"); - public static final ItemType STRAY_SPAWN_EGG = register("minecraft:stray_spawn_egg"); - public static final ItemType STRING = register("minecraft:string"); - public static final ItemType STRIPPED_ACACIA_LOG = register("minecraft:stripped_acacia_log"); - public static final ItemType STRIPPED_ACACIA_WOOD = register("minecraft:stripped_acacia_wood"); - public static final ItemType STRIPPED_BIRCH_LOG = register("minecraft:stripped_birch_log"); - public static final ItemType STRIPPED_BIRCH_WOOD = register("minecraft:stripped_birch_wood"); - public static final ItemType STRIPPED_DARK_OAK_LOG = register("minecraft:stripped_dark_oak_log"); - public static final ItemType STRIPPED_DARK_OAK_WOOD = register("minecraft:stripped_dark_oak_wood"); - public static final ItemType STRIPPED_JUNGLE_LOG = register("minecraft:stripped_jungle_log"); - public static final ItemType STRIPPED_JUNGLE_WOOD = register("minecraft:stripped_jungle_wood"); - public static final ItemType STRIPPED_OAK_LOG = register("minecraft:stripped_oak_log"); - public static final ItemType STRIPPED_OAK_WOOD = register("minecraft:stripped_oak_wood"); - public static final ItemType STRIPPED_SPRUCE_LOG = register("minecraft:stripped_spruce_log"); - public static final ItemType STRIPPED_SPRUCE_WOOD = register("minecraft:stripped_spruce_wood"); - public static final ItemType STRUCTURE_BLOCK = register("minecraft:structure_block"); - public static final ItemType STRUCTURE_VOID = register("minecraft:structure_void"); - public static final ItemType SUGAR = register("minecraft:sugar"); - public static final ItemType SUGAR_CANE = register("minecraft:sugar_cane"); - public static final ItemType SUNFLOWER = register("minecraft:sunflower"); - public static final ItemType TALL_GRASS = register("minecraft:tall_grass"); - public static final ItemType TERRACOTTA = register("minecraft:terracotta"); - public static final ItemType TIPPED_ARROW = register("minecraft:tipped_arrow"); - public static final ItemType TNT = register("minecraft:tnt"); - public static final ItemType TNT_MINECART = register("minecraft:tnt_minecart"); - public static final ItemType TORCH = register("minecraft:torch"); - public static final ItemType TOTEM_OF_UNDYING = register("minecraft:totem_of_undying"); - public static final ItemType TRAPPED_CHEST = register("minecraft:trapped_chest"); - public static final ItemType TRIDENT = register("minecraft:trident"); - public static final ItemType TRIPWIRE_HOOK = register("minecraft:tripwire_hook"); - public static final ItemType TROPICAL_FISH = register("minecraft:tropical_fish"); - public static final ItemType TROPICAL_FISH_BUCKET = register("minecraft:tropical_fish_bucket"); - public static final ItemType TROPICAL_FISH_SPAWN_EGG = register("minecraft:tropical_fish_spawn_egg"); - public static final ItemType TUBE_CORAL = register("minecraft:tube_coral"); - public static final ItemType TUBE_CORAL_BLOCK = register("minecraft:tube_coral_block"); - public static final ItemType TUBE_CORAL_FAN = register("minecraft:tube_coral_fan"); - public static final ItemType TURTLE_EGG = register("minecraft:turtle_egg"); - public static final ItemType TURTLE_HELMET = register("minecraft:turtle_helmet"); - public static final ItemType TURTLE_SPAWN_EGG = register("minecraft:turtle_spawn_egg"); - public static final ItemType VEX_SPAWN_EGG = register("minecraft:vex_spawn_egg"); - public static final ItemType VILLAGER_SPAWN_EGG = register("minecraft:villager_spawn_egg"); - public static final ItemType VINDICATOR_SPAWN_EGG = register("minecraft:vindicator_spawn_egg"); - public static final ItemType VINE = register("minecraft:vine"); - public static final ItemType WATER_BUCKET = register("minecraft:water_bucket"); - public static final ItemType WET_SPONGE = register("minecraft:wet_sponge"); - public static final ItemType WHEAT = register("minecraft:wheat"); - public static final ItemType WHEAT_SEEDS = register("minecraft:wheat_seeds"); - public static final ItemType WHITE_BANNER = register("minecraft:white_banner"); - public static final ItemType WHITE_BED = register("minecraft:white_bed"); - public static final ItemType WHITE_CARPET = register("minecraft:white_carpet"); - public static final ItemType WHITE_CONCRETE = register("minecraft:white_concrete"); - public static final ItemType WHITE_CONCRETE_POWDER = register("minecraft:white_concrete_powder"); - public static final ItemType WHITE_GLAZED_TERRACOTTA = register("minecraft:white_glazed_terracotta"); - public static final ItemType WHITE_SHULKER_BOX = register("minecraft:white_shulker_box"); - public static final ItemType WHITE_STAINED_GLASS = register("minecraft:white_stained_glass"); - public static final ItemType WHITE_STAINED_GLASS_PANE = register("minecraft:white_stained_glass_pane"); - public static final ItemType WHITE_TERRACOTTA = register("minecraft:white_terracotta"); - public static final ItemType WHITE_TULIP = register("minecraft:white_tulip"); - public static final ItemType WHITE_WOOL = register("minecraft:white_wool"); - public static final ItemType WITCH_SPAWN_EGG = register("minecraft:witch_spawn_egg"); - public static final ItemType WITHER_SKELETON_SKULL = register("minecraft:wither_skeleton_skull"); - public static final ItemType WITHER_SKELETON_SPAWN_EGG = register("minecraft:wither_skeleton_spawn_egg"); - public static final ItemType WOLF_SPAWN_EGG = register("minecraft:wolf_spawn_egg"); - public static final ItemType WOODEN_AXE = register("minecraft:wooden_axe"); - public static final ItemType WOODEN_HOE = register("minecraft:wooden_hoe"); - public static final ItemType WOODEN_PICKAXE = register("minecraft:wooden_pickaxe"); - public static final ItemType WOODEN_SHOVEL = register("minecraft:wooden_shovel"); - public static final ItemType WOODEN_SWORD = register("minecraft:wooden_sword"); - public static final ItemType WRITABLE_BOOK = register("minecraft:writable_book"); - public static final ItemType WRITTEN_BOOK = register("minecraft:written_book"); - public static final ItemType YELLOW_BANNER = register("minecraft:yellow_banner"); - public static final ItemType YELLOW_BED = register("minecraft:yellow_bed"); - public static final ItemType YELLOW_CARPET = register("minecraft:yellow_carpet"); - public static final ItemType YELLOW_CONCRETE = register("minecraft:yellow_concrete"); - public static final ItemType YELLOW_CONCRETE_POWDER = register("minecraft:yellow_concrete_powder"); - public static final ItemType YELLOW_GLAZED_TERRACOTTA = register("minecraft:yellow_glazed_terracotta"); - public static final ItemType YELLOW_SHULKER_BOX = register("minecraft:yellow_shulker_box"); - public static final ItemType YELLOW_STAINED_GLASS = register("minecraft:yellow_stained_glass"); - public static final ItemType YELLOW_STAINED_GLASS_PANE = register("minecraft:yellow_stained_glass_pane"); - public static final ItemType YELLOW_TERRACOTTA = register("minecraft:yellow_terracotta"); - public static final ItemType YELLOW_WOOL = register("minecraft:yellow_wool"); - public static final ItemType ZOMBIE_HEAD = register("minecraft:zombie_head"); - public static final ItemType ZOMBIE_HORSE_SPAWN_EGG = register("minecraft:zombie_horse_spawn_egg"); - public static final ItemType ZOMBIE_PIGMAN_SPAWN_EGG = register("minecraft:zombie_pigman_spawn_egg"); - public static final ItemType ZOMBIE_SPAWN_EGG = register("minecraft:zombie_spawn_egg"); - public static final ItemType ZOMBIE_VILLAGER_SPAWN_EGG = register("minecraft:zombie_villager_spawn_egg"); + @Nullable public static final ItemType ACACIA_BOAT = get("minecraft:acacia_boat"); + @Nullable public static final ItemType ACACIA_BUTTON = get("minecraft:acacia_button"); + @Nullable public static final ItemType ACACIA_DOOR = get("minecraft:acacia_door"); + @Nullable public static final ItemType ACACIA_FENCE = get("minecraft:acacia_fence"); + @Nullable public static final ItemType ACACIA_FENCE_GATE = get("minecraft:acacia_fence_gate"); + @Nullable public static final ItemType ACACIA_LEAVES = get("minecraft:acacia_leaves"); + @Nullable public static final ItemType ACACIA_LOG = get("minecraft:acacia_log"); + @Nullable public static final ItemType ACACIA_PLANKS = get("minecraft:acacia_planks"); + @Nullable public static final ItemType ACACIA_PRESSURE_PLATE = get("minecraft:acacia_pressure_plate"); + @Nullable public static final ItemType ACACIA_SAPLING = get("minecraft:acacia_sapling"); + @Nullable public static final ItemType ACACIA_SLAB = get("minecraft:acacia_slab"); + @Nullable public static final ItemType ACACIA_STAIRS = get("minecraft:acacia_stairs"); + @Nullable public static final ItemType ACACIA_TRAPDOOR = get("minecraft:acacia_trapdoor"); + @Nullable public static final ItemType ACACIA_WOOD = get("minecraft:acacia_wood"); + @Nullable public static final ItemType ACTIVATOR_RAIL = get("minecraft:activator_rail"); + @Nullable public static final ItemType AIR = get("minecraft:air"); + @Nullable public static final ItemType ALLIUM = get("minecraft:allium"); + @Nullable public static final ItemType ANDESITE = get("minecraft:andesite"); + @Nullable public static final ItemType ANVIL = get("minecraft:anvil"); + @Nullable public static final ItemType APPLE = get("minecraft:apple"); + @Nullable public static final ItemType ARMOR_STAND = get("minecraft:armor_stand"); + @Nullable public static final ItemType ARROW = get("minecraft:arrow"); + @Nullable public static final ItemType AZURE_BLUET = get("minecraft:azure_bluet"); + @Nullable public static final ItemType BAKED_POTATO = get("minecraft:baked_potato"); + @Nullable public static final ItemType BARRIER = get("minecraft:barrier"); + @Nullable public static final ItemType BAT_SPAWN_EGG = get("minecraft:bat_spawn_egg"); + @Nullable public static final ItemType BEACON = get("minecraft:beacon"); + @Nullable public static final ItemType BEDROCK = get("minecraft:bedrock"); + @Nullable public static final ItemType BEEF = get("minecraft:beef"); + @Nullable public static final ItemType BEETROOT = get("minecraft:beetroot"); + @Nullable public static final ItemType BEETROOT_SEEDS = get("minecraft:beetroot_seeds"); + @Nullable public static final ItemType BEETROOT_SOUP = get("minecraft:beetroot_soup"); + @Nullable public static final ItemType BIRCH_BOAT = get("minecraft:birch_boat"); + @Nullable public static final ItemType BIRCH_BUTTON = get("minecraft:birch_button"); + @Nullable public static final ItemType BIRCH_DOOR = get("minecraft:birch_door"); + @Nullable public static final ItemType BIRCH_FENCE = get("minecraft:birch_fence"); + @Nullable public static final ItemType BIRCH_FENCE_GATE = get("minecraft:birch_fence_gate"); + @Nullable public static final ItemType BIRCH_LEAVES = get("minecraft:birch_leaves"); + @Nullable public static final ItemType BIRCH_LOG = get("minecraft:birch_log"); + @Nullable public static final ItemType BIRCH_PLANKS = get("minecraft:birch_planks"); + @Nullable public static final ItemType BIRCH_PRESSURE_PLATE = get("minecraft:birch_pressure_plate"); + @Nullable public static final ItemType BIRCH_SAPLING = get("minecraft:birch_sapling"); + @Nullable public static final ItemType BIRCH_SLAB = get("minecraft:birch_slab"); + @Nullable public static final ItemType BIRCH_STAIRS = get("minecraft:birch_stairs"); + @Nullable public static final ItemType BIRCH_TRAPDOOR = get("minecraft:birch_trapdoor"); + @Nullable public static final ItemType BIRCH_WOOD = get("minecraft:birch_wood"); + @Nullable public static final ItemType BLACK_BANNER = get("minecraft:black_banner"); + @Nullable public static final ItemType BLACK_BED = get("minecraft:black_bed"); + @Nullable public static final ItemType BLACK_CARPET = get("minecraft:black_carpet"); + @Nullable public static final ItemType BLACK_CONCRETE = get("minecraft:black_concrete"); + @Nullable public static final ItemType BLACK_CONCRETE_POWDER = get("minecraft:black_concrete_powder"); + @Nullable public static final ItemType BLACK_GLAZED_TERRACOTTA = get("minecraft:black_glazed_terracotta"); + @Nullable public static final ItemType BLACK_SHULKER_BOX = get("minecraft:black_shulker_box"); + @Nullable public static final ItemType BLACK_STAINED_GLASS = get("minecraft:black_stained_glass"); + @Nullable public static final ItemType BLACK_STAINED_GLASS_PANE = get("minecraft:black_stained_glass_pane"); + @Nullable public static final ItemType BLACK_TERRACOTTA = get("minecraft:black_terracotta"); + @Nullable public static final ItemType BLACK_WOOL = get("minecraft:black_wool"); + @Nullable public static final ItemType BLAZE_POWDER = get("minecraft:blaze_powder"); + @Nullable public static final ItemType BLAZE_ROD = get("minecraft:blaze_rod"); + @Nullable public static final ItemType BLAZE_SPAWN_EGG = get("minecraft:blaze_spawn_egg"); + @Nullable public static final ItemType BLUE_BANNER = get("minecraft:blue_banner"); + @Nullable public static final ItemType BLUE_BED = get("minecraft:blue_bed"); + @Nullable public static final ItemType BLUE_CARPET = get("minecraft:blue_carpet"); + @Nullable public static final ItemType BLUE_CONCRETE = get("minecraft:blue_concrete"); + @Nullable public static final ItemType BLUE_CONCRETE_POWDER = get("minecraft:blue_concrete_powder"); + @Nullable public static final ItemType BLUE_GLAZED_TERRACOTTA = get("minecraft:blue_glazed_terracotta"); + @Nullable public static final ItemType BLUE_ICE = get("minecraft:blue_ice"); + @Nullable public static final ItemType BLUE_ORCHID = get("minecraft:blue_orchid"); + @Nullable public static final ItemType BLUE_SHULKER_BOX = get("minecraft:blue_shulker_box"); + @Nullable public static final ItemType BLUE_STAINED_GLASS = get("minecraft:blue_stained_glass"); + @Nullable public static final ItemType BLUE_STAINED_GLASS_PANE = get("minecraft:blue_stained_glass_pane"); + @Nullable public static final ItemType BLUE_TERRACOTTA = get("minecraft:blue_terracotta"); + @Nullable public static final ItemType BLUE_WOOL = get("minecraft:blue_wool"); + @Nullable public static final ItemType BONE = get("minecraft:bone"); + @Nullable public static final ItemType BONE_BLOCK = get("minecraft:bone_block"); + @Nullable public static final ItemType BONE_MEAL = get("minecraft:bone_meal"); + @Nullable public static final ItemType BOOK = get("minecraft:book"); + @Nullable public static final ItemType BOOKSHELF = get("minecraft:bookshelf"); + @Nullable public static final ItemType BOW = get("minecraft:bow"); + @Nullable public static final ItemType BOWL = get("minecraft:bowl"); + @Nullable public static final ItemType BRAIN_CORAL = get("minecraft:brain_coral"); + @Nullable public static final ItemType BRAIN_CORAL_BLOCK = get("minecraft:brain_coral_block"); + @Nullable public static final ItemType BRAIN_CORAL_FAN = get("minecraft:brain_coral_fan"); + @Nullable public static final ItemType BREAD = get("minecraft:bread"); + @Nullable public static final ItemType BREWING_STAND = get("minecraft:brewing_stand"); + @Nullable public static final ItemType BRICK = get("minecraft:brick"); + @Nullable public static final ItemType BRICK_SLAB = get("minecraft:brick_slab"); + @Nullable public static final ItemType BRICK_STAIRS = get("minecraft:brick_stairs"); + @Nullable public static final ItemType BRICKS = get("minecraft:bricks"); + @Nullable public static final ItemType BROWN_BANNER = get("minecraft:brown_banner"); + @Nullable public static final ItemType BROWN_BED = get("minecraft:brown_bed"); + @Nullable public static final ItemType BROWN_CARPET = get("minecraft:brown_carpet"); + @Nullable public static final ItemType BROWN_CONCRETE = get("minecraft:brown_concrete"); + @Nullable public static final ItemType BROWN_CONCRETE_POWDER = get("minecraft:brown_concrete_powder"); + @Nullable public static final ItemType BROWN_GLAZED_TERRACOTTA = get("minecraft:brown_glazed_terracotta"); + @Nullable public static final ItemType BROWN_MUSHROOM = get("minecraft:brown_mushroom"); + @Nullable public static final ItemType BROWN_MUSHROOM_BLOCK = get("minecraft:brown_mushroom_block"); + @Nullable public static final ItemType BROWN_SHULKER_BOX = get("minecraft:brown_shulker_box"); + @Nullable public static final ItemType BROWN_STAINED_GLASS = get("minecraft:brown_stained_glass"); + @Nullable public static final ItemType BROWN_STAINED_GLASS_PANE = get("minecraft:brown_stained_glass_pane"); + @Nullable public static final ItemType BROWN_TERRACOTTA = get("minecraft:brown_terracotta"); + @Nullable public static final ItemType BROWN_WOOL = get("minecraft:brown_wool"); + @Nullable public static final ItemType BUBBLE_CORAL = get("minecraft:bubble_coral"); + @Nullable public static final ItemType BUBBLE_CORAL_BLOCK = get("minecraft:bubble_coral_block"); + @Nullable public static final ItemType BUBBLE_CORAL_FAN = get("minecraft:bubble_coral_fan"); + @Nullable public static final ItemType BUCKET = get("minecraft:bucket"); + @Nullable public static final ItemType CACTUS = get("minecraft:cactus"); + @Nullable public static final ItemType CACTUS_GREEN = get("minecraft:cactus_green"); + @Nullable public static final ItemType CAKE = get("minecraft:cake"); + @Nullable public static final ItemType CARROT = get("minecraft:carrot"); + @Nullable public static final ItemType CARROT_ON_A_STICK = get("minecraft:carrot_on_a_stick"); + @Nullable public static final ItemType CARVED_PUMPKIN = get("minecraft:carved_pumpkin"); + @Nullable public static final ItemType CAULDRON = get("minecraft:cauldron"); + @Nullable public static final ItemType CAVE_SPIDER_SPAWN_EGG = get("minecraft:cave_spider_spawn_egg"); + @Nullable public static final ItemType CHAIN_COMMAND_BLOCK = get("minecraft:chain_command_block"); + @Nullable public static final ItemType CHAINMAIL_BOOTS = get("minecraft:chainmail_boots"); + @Nullable public static final ItemType CHAINMAIL_CHESTPLATE = get("minecraft:chainmail_chestplate"); + @Nullable public static final ItemType CHAINMAIL_HELMET = get("minecraft:chainmail_helmet"); + @Nullable public static final ItemType CHAINMAIL_LEGGINGS = get("minecraft:chainmail_leggings"); + @Nullable public static final ItemType CHARCOAL = get("minecraft:charcoal"); + @Nullable public static final ItemType CHEST = get("minecraft:chest"); + @Nullable public static final ItemType CHEST_MINECART = get("minecraft:chest_minecart"); + @Nullable public static final ItemType CHICKEN = get("minecraft:chicken"); + @Nullable public static final ItemType CHICKEN_SPAWN_EGG = get("minecraft:chicken_spawn_egg"); + @Nullable public static final ItemType CHIPPED_ANVIL = get("minecraft:chipped_anvil"); + @Nullable public static final ItemType CHISELED_QUARTZ_BLOCK = get("minecraft:chiseled_quartz_block"); + @Nullable public static final ItemType CHISELED_RED_SANDSTONE = get("minecraft:chiseled_red_sandstone"); + @Nullable public static final ItemType CHISELED_SANDSTONE = get("minecraft:chiseled_sandstone"); + @Nullable public static final ItemType CHISELED_STONE_BRICKS = get("minecraft:chiseled_stone_bricks"); + @Nullable public static final ItemType CHORUS_FLOWER = get("minecraft:chorus_flower"); + @Nullable public static final ItemType CHORUS_FRUIT = get("minecraft:chorus_fruit"); + @Nullable public static final ItemType CHORUS_PLANT = get("minecraft:chorus_plant"); + @Nullable public static final ItemType CLAY = get("minecraft:clay"); + @Nullable public static final ItemType CLAY_BALL = get("minecraft:clay_ball"); + @Nullable public static final ItemType CLOCK = get("minecraft:clock"); + @Nullable public static final ItemType COAL = get("minecraft:coal"); + @Nullable public static final ItemType COAL_BLOCK = get("minecraft:coal_block"); + @Nullable public static final ItemType COAL_ORE = get("minecraft:coal_ore"); + @Nullable public static final ItemType COARSE_DIRT = get("minecraft:coarse_dirt"); + @Nullable public static final ItemType COBBLESTONE = get("minecraft:cobblestone"); + @Nullable public static final ItemType COBBLESTONE_SLAB = get("minecraft:cobblestone_slab"); + @Nullable public static final ItemType COBBLESTONE_STAIRS = get("minecraft:cobblestone_stairs"); + @Nullable public static final ItemType COBBLESTONE_WALL = get("minecraft:cobblestone_wall"); + @Nullable public static final ItemType COBWEB = get("minecraft:cobweb"); + @Nullable public static final ItemType COCOA_BEANS = get("minecraft:cocoa_beans"); + @Nullable public static final ItemType COD = get("minecraft:cod"); + @Nullable public static final ItemType COD_BUCKET = get("minecraft:cod_bucket"); + @Nullable public static final ItemType COD_SPAWN_EGG = get("minecraft:cod_spawn_egg"); + @Nullable public static final ItemType COMMAND_BLOCK = get("minecraft:command_block"); + @Nullable public static final ItemType COMMAND_BLOCK_MINECART = get("minecraft:command_block_minecart"); + @Nullable public static final ItemType COMPARATOR = get("minecraft:comparator"); + @Nullable public static final ItemType COMPASS = get("minecraft:compass"); + @Nullable public static final ItemType CONDUIT = get("minecraft:conduit"); + @Nullable public static final ItemType COOKED_BEEF = get("minecraft:cooked_beef"); + @Nullable public static final ItemType COOKED_CHICKEN = get("minecraft:cooked_chicken"); + @Nullable public static final ItemType COOKED_COD = get("minecraft:cooked_cod"); + @Nullable public static final ItemType COOKED_MUTTON = get("minecraft:cooked_mutton"); + @Nullable public static final ItemType COOKED_PORKCHOP = get("minecraft:cooked_porkchop"); + @Nullable public static final ItemType COOKED_RABBIT = get("minecraft:cooked_rabbit"); + @Nullable public static final ItemType COOKED_SALMON = get("minecraft:cooked_salmon"); + @Nullable public static final ItemType COOKIE = get("minecraft:cookie"); + @Nullable public static final ItemType COW_SPAWN_EGG = get("minecraft:cow_spawn_egg"); + @Nullable public static final ItemType CRACKED_STONE_BRICKS = get("minecraft:cracked_stone_bricks"); + @Nullable public static final ItemType CRAFTING_TABLE = get("minecraft:crafting_table"); + @Nullable public static final ItemType CREEPER_HEAD = get("minecraft:creeper_head"); + @Nullable public static final ItemType CREEPER_SPAWN_EGG = get("minecraft:creeper_spawn_egg"); + @Nullable public static final ItemType CUT_RED_SANDSTONE = get("minecraft:cut_red_sandstone"); + @Nullable public static final ItemType CUT_SANDSTONE = get("minecraft:cut_sandstone"); + @Nullable public static final ItemType CYAN_BANNER = get("minecraft:cyan_banner"); + @Nullable public static final ItemType CYAN_BED = get("minecraft:cyan_bed"); + @Nullable public static final ItemType CYAN_CARPET = get("minecraft:cyan_carpet"); + @Nullable public static final ItemType CYAN_CONCRETE = get("minecraft:cyan_concrete"); + @Nullable public static final ItemType CYAN_CONCRETE_POWDER = get("minecraft:cyan_concrete_powder"); + @Nullable public static final ItemType CYAN_DYE = get("minecraft:cyan_dye"); + @Nullable public static final ItemType CYAN_GLAZED_TERRACOTTA = get("minecraft:cyan_glazed_terracotta"); + @Nullable public static final ItemType CYAN_SHULKER_BOX = get("minecraft:cyan_shulker_box"); + @Nullable public static final ItemType CYAN_STAINED_GLASS = get("minecraft:cyan_stained_glass"); + @Nullable public static final ItemType CYAN_STAINED_GLASS_PANE = get("minecraft:cyan_stained_glass_pane"); + @Nullable public static final ItemType CYAN_TERRACOTTA = get("minecraft:cyan_terracotta"); + @Nullable public static final ItemType CYAN_WOOL = get("minecraft:cyan_wool"); + @Nullable public static final ItemType DAMAGED_ANVIL = get("minecraft:damaged_anvil"); + @Nullable public static final ItemType DANDELION = get("minecraft:dandelion"); + @Nullable public static final ItemType DANDELION_YELLOW = get("minecraft:dandelion_yellow"); + @Nullable public static final ItemType DARK_OAK_BOAT = get("minecraft:dark_oak_boat"); + @Nullable public static final ItemType DARK_OAK_BUTTON = get("minecraft:dark_oak_button"); + @Nullable public static final ItemType DARK_OAK_DOOR = get("minecraft:dark_oak_door"); + @Nullable public static final ItemType DARK_OAK_FENCE = get("minecraft:dark_oak_fence"); + @Nullable public static final ItemType DARK_OAK_FENCE_GATE = get("minecraft:dark_oak_fence_gate"); + @Nullable public static final ItemType DARK_OAK_LEAVES = get("minecraft:dark_oak_leaves"); + @Nullable public static final ItemType DARK_OAK_LOG = get("minecraft:dark_oak_log"); + @Nullable public static final ItemType DARK_OAK_PLANKS = get("minecraft:dark_oak_planks"); + @Nullable public static final ItemType DARK_OAK_PRESSURE_PLATE = get("minecraft:dark_oak_pressure_plate"); + @Nullable public static final ItemType DARK_OAK_SAPLING = get("minecraft:dark_oak_sapling"); + @Nullable public static final ItemType DARK_OAK_SLAB = get("minecraft:dark_oak_slab"); + @Nullable public static final ItemType DARK_OAK_STAIRS = get("minecraft:dark_oak_stairs"); + @Nullable public static final ItemType DARK_OAK_TRAPDOOR = get("minecraft:dark_oak_trapdoor"); + @Nullable public static final ItemType DARK_OAK_WOOD = get("minecraft:dark_oak_wood"); + @Nullable public static final ItemType DARK_PRISMARINE = get("minecraft:dark_prismarine"); + @Nullable public static final ItemType DARK_PRISMARINE_SLAB = get("minecraft:dark_prismarine_slab"); + @Nullable public static final ItemType DARK_PRISMARINE_STAIRS = get("minecraft:dark_prismarine_stairs"); + @Nullable public static final ItemType DAYLIGHT_DETECTOR = get("minecraft:daylight_detector"); + @Nullable public static final ItemType DEAD_BRAIN_CORAL = get("minecraft:dead_brain_coral"); + @Nullable public static final ItemType DEAD_BRAIN_CORAL_BLOCK = get("minecraft:dead_brain_coral_block"); + @Nullable public static final ItemType DEAD_BRAIN_CORAL_FAN = get("minecraft:dead_brain_coral_fan"); + @Nullable public static final ItemType DEAD_BUBBLE_CORAL = get("minecraft:dead_bubble_coral"); + @Nullable public static final ItemType DEAD_BUBBLE_CORAL_BLOCK = get("minecraft:dead_bubble_coral_block"); + @Nullable public static final ItemType DEAD_BUBBLE_CORAL_FAN = get("minecraft:dead_bubble_coral_fan"); + @Nullable public static final ItemType DEAD_BUSH = get("minecraft:dead_bush"); + @Nullable public static final ItemType DEAD_FIRE_CORAL = get("minecraft:dead_fire_coral"); + @Nullable public static final ItemType DEAD_FIRE_CORAL_BLOCK = get("minecraft:dead_fire_coral_block"); + @Nullable public static final ItemType DEAD_FIRE_CORAL_FAN = get("minecraft:dead_fire_coral_fan"); + @Nullable public static final ItemType DEAD_HORN_CORAL = get("minecraft:dead_horn_coral"); + @Nullable public static final ItemType DEAD_HORN_CORAL_BLOCK = get("minecraft:dead_horn_coral_block"); + @Nullable public static final ItemType DEAD_HORN_CORAL_FAN = get("minecraft:dead_horn_coral_fan"); + @Nullable public static final ItemType DEAD_TUBE_CORAL = get("minecraft:dead_tube_coral"); + @Nullable public static final ItemType DEAD_TUBE_CORAL_BLOCK = get("minecraft:dead_tube_coral_block"); + @Nullable public static final ItemType DEAD_TUBE_CORAL_FAN = get("minecraft:dead_tube_coral_fan"); + @Nullable public static final ItemType DEBUG_STICK = get("minecraft:debug_stick"); + @Nullable public static final ItemType DETECTOR_RAIL = get("minecraft:detector_rail"); + @Nullable public static final ItemType DIAMOND = get("minecraft:diamond"); + @Nullable public static final ItemType DIAMOND_AXE = get("minecraft:diamond_axe"); + @Nullable public static final ItemType DIAMOND_BLOCK = get("minecraft:diamond_block"); + @Nullable public static final ItemType DIAMOND_BOOTS = get("minecraft:diamond_boots"); + @Nullable public static final ItemType DIAMOND_CHESTPLATE = get("minecraft:diamond_chestplate"); + @Nullable public static final ItemType DIAMOND_HELMET = get("minecraft:diamond_helmet"); + @Nullable public static final ItemType DIAMOND_HOE = get("minecraft:diamond_hoe"); + @Nullable public static final ItemType DIAMOND_HORSE_ARMOR = get("minecraft:diamond_horse_armor"); + @Nullable public static final ItemType DIAMOND_LEGGINGS = get("minecraft:diamond_leggings"); + @Nullable public static final ItemType DIAMOND_ORE = get("minecraft:diamond_ore"); + @Nullable public static final ItemType DIAMOND_PICKAXE = get("minecraft:diamond_pickaxe"); + @Nullable public static final ItemType DIAMOND_SHOVEL = get("minecraft:diamond_shovel"); + @Nullable public static final ItemType DIAMOND_SWORD = get("minecraft:diamond_sword"); + @Nullable public static final ItemType DIORITE = get("minecraft:diorite"); + @Nullable public static final ItemType DIRT = get("minecraft:dirt"); + @Nullable public static final ItemType DISPENSER = get("minecraft:dispenser"); + @Nullable public static final ItemType DOLPHIN_SPAWN_EGG = get("minecraft:dolphin_spawn_egg"); + @Nullable public static final ItemType DONKEY_SPAWN_EGG = get("minecraft:donkey_spawn_egg"); + @Nullable public static final ItemType DRAGON_BREATH = get("minecraft:dragon_breath"); + @Nullable public static final ItemType DRAGON_EGG = get("minecraft:dragon_egg"); + @Nullable public static final ItemType DRAGON_HEAD = get("minecraft:dragon_head"); + @Nullable public static final ItemType DRIED_KELP = get("minecraft:dried_kelp"); + @Nullable public static final ItemType DRIED_KELP_BLOCK = get("minecraft:dried_kelp_block"); + @Nullable public static final ItemType DROPPER = get("minecraft:dropper"); + @Nullable public static final ItemType DROWNED_SPAWN_EGG = get("minecraft:drowned_spawn_egg"); + @Nullable public static final ItemType EGG = get("minecraft:egg"); + @Nullable public static final ItemType ELDER_GUARDIAN_SPAWN_EGG = get("minecraft:elder_guardian_spawn_egg"); + @Nullable public static final ItemType ELYTRA = get("minecraft:elytra"); + @Nullable public static final ItemType EMERALD = get("minecraft:emerald"); + @Nullable public static final ItemType EMERALD_BLOCK = get("minecraft:emerald_block"); + @Nullable public static final ItemType EMERALD_ORE = get("minecraft:emerald_ore"); + @Nullable public static final ItemType ENCHANTED_BOOK = get("minecraft:enchanted_book"); + @Nullable public static final ItemType ENCHANTED_GOLDEN_APPLE = get("minecraft:enchanted_golden_apple"); + @Nullable public static final ItemType ENCHANTING_TABLE = get("minecraft:enchanting_table"); + @Nullable public static final ItemType END_CRYSTAL = get("minecraft:end_crystal"); + @Nullable public static final ItemType END_PORTAL_FRAME = get("minecraft:end_portal_frame"); + @Nullable public static final ItemType END_ROD = get("minecraft:end_rod"); + @Nullable public static final ItemType END_STONE = get("minecraft:end_stone"); + @Nullable public static final ItemType END_STONE_BRICKS = get("minecraft:end_stone_bricks"); + @Nullable public static final ItemType ENDER_CHEST = get("minecraft:ender_chest"); + @Nullable public static final ItemType ENDER_EYE = get("minecraft:ender_eye"); + @Nullable public static final ItemType ENDER_PEARL = get("minecraft:ender_pearl"); + @Nullable public static final ItemType ENDERMAN_SPAWN_EGG = get("minecraft:enderman_spawn_egg"); + @Nullable public static final ItemType ENDERMITE_SPAWN_EGG = get("minecraft:endermite_spawn_egg"); + @Nullable public static final ItemType EVOKER_SPAWN_EGG = get("minecraft:evoker_spawn_egg"); + @Nullable public static final ItemType EXPERIENCE_BOTTLE = get("minecraft:experience_bottle"); + @Nullable public static final ItemType FARMLAND = get("minecraft:farmland"); + @Nullable public static final ItemType FEATHER = get("minecraft:feather"); + @Nullable public static final ItemType FERMENTED_SPIDER_EYE = get("minecraft:fermented_spider_eye"); + @Nullable public static final ItemType FERN = get("minecraft:fern"); + @Nullable public static final ItemType FILLED_MAP = get("minecraft:filled_map"); + @Nullable public static final ItemType FIRE_CHARGE = get("minecraft:fire_charge"); + @Nullable public static final ItemType FIRE_CORAL = get("minecraft:fire_coral"); + @Nullable public static final ItemType FIRE_CORAL_BLOCK = get("minecraft:fire_coral_block"); + @Nullable public static final ItemType FIRE_CORAL_FAN = get("minecraft:fire_coral_fan"); + @Nullable public static final ItemType FIREWORK_ROCKET = get("minecraft:firework_rocket"); + @Nullable public static final ItemType FIREWORK_STAR = get("minecraft:firework_star"); + @Nullable public static final ItemType FISHING_ROD = get("minecraft:fishing_rod"); + @Nullable public static final ItemType FLINT = get("minecraft:flint"); + @Nullable public static final ItemType FLINT_AND_STEEL = get("minecraft:flint_and_steel"); + @Nullable public static final ItemType FLOWER_POT = get("minecraft:flower_pot"); + @Nullable public static final ItemType FURNACE = get("minecraft:furnace"); + @Nullable public static final ItemType FURNACE_MINECART = get("minecraft:furnace_minecart"); + @Nullable public static final ItemType GHAST_SPAWN_EGG = get("minecraft:ghast_spawn_egg"); + @Nullable public static final ItemType GHAST_TEAR = get("minecraft:ghast_tear"); + @Nullable public static final ItemType GLASS = get("minecraft:glass"); + @Nullable public static final ItemType GLASS_BOTTLE = get("minecraft:glass_bottle"); + @Nullable public static final ItemType GLASS_PANE = get("minecraft:glass_pane"); + @Nullable public static final ItemType GLISTERING_MELON_SLICE = get("minecraft:glistering_melon_slice"); + @Nullable public static final ItemType GLOWSTONE = get("minecraft:glowstone"); + @Nullable public static final ItemType GLOWSTONE_DUST = get("minecraft:glowstone_dust"); + @Nullable public static final ItemType GOLD_BLOCK = get("minecraft:gold_block"); + @Nullable public static final ItemType GOLD_INGOT = get("minecraft:gold_ingot"); + @Nullable public static final ItemType GOLD_NUGGET = get("minecraft:gold_nugget"); + @Nullable public static final ItemType GOLD_ORE = get("minecraft:gold_ore"); + @Nullable public static final ItemType GOLDEN_APPLE = get("minecraft:golden_apple"); + @Nullable public static final ItemType GOLDEN_AXE = get("minecraft:golden_axe"); + @Nullable public static final ItemType GOLDEN_BOOTS = get("minecraft:golden_boots"); + @Nullable public static final ItemType GOLDEN_CARROT = get("minecraft:golden_carrot"); + @Nullable public static final ItemType GOLDEN_CHESTPLATE = get("minecraft:golden_chestplate"); + @Nullable public static final ItemType GOLDEN_HELMET = get("minecraft:golden_helmet"); + @Nullable public static final ItemType GOLDEN_HOE = get("minecraft:golden_hoe"); + @Nullable public static final ItemType GOLDEN_HORSE_ARMOR = get("minecraft:golden_horse_armor"); + @Nullable public static final ItemType GOLDEN_LEGGINGS = get("minecraft:golden_leggings"); + @Nullable public static final ItemType GOLDEN_PICKAXE = get("minecraft:golden_pickaxe"); + @Nullable public static final ItemType GOLDEN_SHOVEL = get("minecraft:golden_shovel"); + @Nullable public static final ItemType GOLDEN_SWORD = get("minecraft:golden_sword"); + @Nullable public static final ItemType GRANITE = get("minecraft:granite"); + @Nullable public static final ItemType GRASS = get("minecraft:grass"); + @Nullable public static final ItemType GRASS_BLOCK = get("minecraft:grass_block"); + @Nullable public static final ItemType GRASS_PATH = get("minecraft:grass_path"); + @Nullable public static final ItemType GRAVEL = get("minecraft:gravel"); + @Nullable public static final ItemType GRAY_BANNER = get("minecraft:gray_banner"); + @Nullable public static final ItemType GRAY_BED = get("minecraft:gray_bed"); + @Nullable public static final ItemType GRAY_CARPET = get("minecraft:gray_carpet"); + @Nullable public static final ItemType GRAY_CONCRETE = get("minecraft:gray_concrete"); + @Nullable public static final ItemType GRAY_CONCRETE_POWDER = get("minecraft:gray_concrete_powder"); + @Nullable public static final ItemType GRAY_DYE = get("minecraft:gray_dye"); + @Nullable public static final ItemType GRAY_GLAZED_TERRACOTTA = get("minecraft:gray_glazed_terracotta"); + @Nullable public static final ItemType GRAY_SHULKER_BOX = get("minecraft:gray_shulker_box"); + @Nullable public static final ItemType GRAY_STAINED_GLASS = get("minecraft:gray_stained_glass"); + @Nullable public static final ItemType GRAY_STAINED_GLASS_PANE = get("minecraft:gray_stained_glass_pane"); + @Nullable public static final ItemType GRAY_TERRACOTTA = get("minecraft:gray_terracotta"); + @Nullable public static final ItemType GRAY_WOOL = get("minecraft:gray_wool"); + @Nullable public static final ItemType GREEN_BANNER = get("minecraft:green_banner"); + @Nullable public static final ItemType GREEN_BED = get("minecraft:green_bed"); + @Nullable public static final ItemType GREEN_CARPET = get("minecraft:green_carpet"); + @Nullable public static final ItemType GREEN_CONCRETE = get("minecraft:green_concrete"); + @Nullable public static final ItemType GREEN_CONCRETE_POWDER = get("minecraft:green_concrete_powder"); + @Nullable public static final ItemType GREEN_GLAZED_TERRACOTTA = get("minecraft:green_glazed_terracotta"); + @Nullable public static final ItemType GREEN_SHULKER_BOX = get("minecraft:green_shulker_box"); + @Nullable public static final ItemType GREEN_STAINED_GLASS = get("minecraft:green_stained_glass"); + @Nullable public static final ItemType GREEN_STAINED_GLASS_PANE = get("minecraft:green_stained_glass_pane"); + @Nullable public static final ItemType GREEN_TERRACOTTA = get("minecraft:green_terracotta"); + @Nullable public static final ItemType GREEN_WOOL = get("minecraft:green_wool"); + @Nullable public static final ItemType GUARDIAN_SPAWN_EGG = get("minecraft:guardian_spawn_egg"); + @Nullable public static final ItemType GUNPOWDER = get("minecraft:gunpowder"); + @Nullable public static final ItemType HAY_BLOCK = get("minecraft:hay_block"); + @Nullable public static final ItemType HEART_OF_THE_SEA = get("minecraft:heart_of_the_sea"); + @Nullable public static final ItemType HEAVY_WEIGHTED_PRESSURE_PLATE = get("minecraft:heavy_weighted_pressure_plate"); + @Nullable public static final ItemType HOPPER = get("minecraft:hopper"); + @Nullable public static final ItemType HOPPER_MINECART = get("minecraft:hopper_minecart"); + @Nullable public static final ItemType HORN_CORAL = get("minecraft:horn_coral"); + @Nullable public static final ItemType HORN_CORAL_BLOCK = get("minecraft:horn_coral_block"); + @Nullable public static final ItemType HORN_CORAL_FAN = get("minecraft:horn_coral_fan"); + @Nullable public static final ItemType HORSE_SPAWN_EGG = get("minecraft:horse_spawn_egg"); + @Nullable public static final ItemType HUSK_SPAWN_EGG = get("minecraft:husk_spawn_egg"); + @Nullable public static final ItemType ICE = get("minecraft:ice"); + @Nullable public static final ItemType INFESTED_CHISELED_STONE_BRICKS = get("minecraft:infested_chiseled_stone_bricks"); + @Nullable public static final ItemType INFESTED_COBBLESTONE = get("minecraft:infested_cobblestone"); + @Nullable public static final ItemType INFESTED_CRACKED_STONE_BRICKS = get("minecraft:infested_cracked_stone_bricks"); + @Nullable public static final ItemType INFESTED_MOSSY_STONE_BRICKS = get("minecraft:infested_mossy_stone_bricks"); + @Nullable public static final ItemType INFESTED_STONE = get("minecraft:infested_stone"); + @Nullable public static final ItemType INFESTED_STONE_BRICKS = get("minecraft:infested_stone_bricks"); + @Nullable public static final ItemType INK_SAC = get("minecraft:ink_sac"); + @Nullable public static final ItemType IRON_AXE = get("minecraft:iron_axe"); + @Nullable public static final ItemType IRON_BARS = get("minecraft:iron_bars"); + @Nullable public static final ItemType IRON_BLOCK = get("minecraft:iron_block"); + @Nullable public static final ItemType IRON_BOOTS = get("minecraft:iron_boots"); + @Nullable public static final ItemType IRON_CHESTPLATE = get("minecraft:iron_chestplate"); + @Nullable public static final ItemType IRON_DOOR = get("minecraft:iron_door"); + @Nullable public static final ItemType IRON_HELMET = get("minecraft:iron_helmet"); + @Nullable public static final ItemType IRON_HOE = get("minecraft:iron_hoe"); + @Nullable public static final ItemType IRON_HORSE_ARMOR = get("minecraft:iron_horse_armor"); + @Nullable public static final ItemType IRON_INGOT = get("minecraft:iron_ingot"); + @Nullable public static final ItemType IRON_LEGGINGS = get("minecraft:iron_leggings"); + @Nullable public static final ItemType IRON_NUGGET = get("minecraft:iron_nugget"); + @Nullable public static final ItemType IRON_ORE = get("minecraft:iron_ore"); + @Nullable public static final ItemType IRON_PICKAXE = get("minecraft:iron_pickaxe"); + @Nullable public static final ItemType IRON_SHOVEL = get("minecraft:iron_shovel"); + @Nullable public static final ItemType IRON_SWORD = get("minecraft:iron_sword"); + @Nullable public static final ItemType IRON_TRAPDOOR = get("minecraft:iron_trapdoor"); + @Nullable public static final ItemType ITEM_FRAME = get("minecraft:item_frame"); + @Nullable public static final ItemType JACK_O_LANTERN = get("minecraft:jack_o_lantern"); + @Nullable public static final ItemType JUKEBOX = get("minecraft:jukebox"); + @Nullable public static final ItemType JUNGLE_BOAT = get("minecraft:jungle_boat"); + @Nullable public static final ItemType JUNGLE_BUTTON = get("minecraft:jungle_button"); + @Nullable public static final ItemType JUNGLE_DOOR = get("minecraft:jungle_door"); + @Nullable public static final ItemType JUNGLE_FENCE = get("minecraft:jungle_fence"); + @Nullable public static final ItemType JUNGLE_FENCE_GATE = get("minecraft:jungle_fence_gate"); + @Nullable public static final ItemType JUNGLE_LEAVES = get("minecraft:jungle_leaves"); + @Nullable public static final ItemType JUNGLE_LOG = get("minecraft:jungle_log"); + @Nullable public static final ItemType JUNGLE_PLANKS = get("minecraft:jungle_planks"); + @Nullable public static final ItemType JUNGLE_PRESSURE_PLATE = get("minecraft:jungle_pressure_plate"); + @Nullable public static final ItemType JUNGLE_SAPLING = get("minecraft:jungle_sapling"); + @Nullable public static final ItemType JUNGLE_SLAB = get("minecraft:jungle_slab"); + @Nullable public static final ItemType JUNGLE_STAIRS = get("minecraft:jungle_stairs"); + @Nullable public static final ItemType JUNGLE_TRAPDOOR = get("minecraft:jungle_trapdoor"); + @Nullable public static final ItemType JUNGLE_WOOD = get("minecraft:jungle_wood"); + @Nullable public static final ItemType KELP = get("minecraft:kelp"); + @Nullable public static final ItemType KNOWLEDGE_BOOK = get("minecraft:knowledge_book"); + @Nullable public static final ItemType LADDER = get("minecraft:ladder"); + @Nullable public static final ItemType LAPIS_BLOCK = get("minecraft:lapis_block"); + @Nullable public static final ItemType LAPIS_LAZULI = get("minecraft:lapis_lazuli"); + @Nullable public static final ItemType LAPIS_ORE = get("minecraft:lapis_ore"); + @Nullable public static final ItemType LARGE_FERN = get("minecraft:large_fern"); + @Nullable public static final ItemType LAVA_BUCKET = get("minecraft:lava_bucket"); + @Nullable public static final ItemType LEAD = get("minecraft:lead"); + @Nullable public static final ItemType LEATHER = get("minecraft:leather"); + @Nullable public static final ItemType LEATHER_BOOTS = get("minecraft:leather_boots"); + @Nullable public static final ItemType LEATHER_CHESTPLATE = get("minecraft:leather_chestplate"); + @Nullable public static final ItemType LEATHER_HELMET = get("minecraft:leather_helmet"); + @Nullable public static final ItemType LEATHER_LEGGINGS = get("minecraft:leather_leggings"); + @Nullable public static final ItemType LEVER = get("minecraft:lever"); + @Nullable public static final ItemType LIGHT_BLUE_BANNER = get("minecraft:light_blue_banner"); + @Nullable public static final ItemType LIGHT_BLUE_BED = get("minecraft:light_blue_bed"); + @Nullable public static final ItemType LIGHT_BLUE_CARPET = get("minecraft:light_blue_carpet"); + @Nullable public static final ItemType LIGHT_BLUE_CONCRETE = get("minecraft:light_blue_concrete"); + @Nullable public static final ItemType LIGHT_BLUE_CONCRETE_POWDER = get("minecraft:light_blue_concrete_powder"); + @Nullable public static final ItemType LIGHT_BLUE_DYE = get("minecraft:light_blue_dye"); + @Nullable public static final ItemType LIGHT_BLUE_GLAZED_TERRACOTTA = get("minecraft:light_blue_glazed_terracotta"); + @Nullable public static final ItemType LIGHT_BLUE_SHULKER_BOX = get("minecraft:light_blue_shulker_box"); + @Nullable public static final ItemType LIGHT_BLUE_STAINED_GLASS = get("minecraft:light_blue_stained_glass"); + @Nullable public static final ItemType LIGHT_BLUE_STAINED_GLASS_PANE = get("minecraft:light_blue_stained_glass_pane"); + @Nullable public static final ItemType LIGHT_BLUE_TERRACOTTA = get("minecraft:light_blue_terracotta"); + @Nullable public static final ItemType LIGHT_BLUE_WOOL = get("minecraft:light_blue_wool"); + @Nullable public static final ItemType LIGHT_GRAY_BANNER = get("minecraft:light_gray_banner"); + @Nullable public static final ItemType LIGHT_GRAY_BED = get("minecraft:light_gray_bed"); + @Nullable public static final ItemType LIGHT_GRAY_CARPET = get("minecraft:light_gray_carpet"); + @Nullable public static final ItemType LIGHT_GRAY_CONCRETE = get("minecraft:light_gray_concrete"); + @Nullable public static final ItemType LIGHT_GRAY_CONCRETE_POWDER = get("minecraft:light_gray_concrete_powder"); + @Nullable public static final ItemType LIGHT_GRAY_DYE = get("minecraft:light_gray_dye"); + @Nullable public static final ItemType LIGHT_GRAY_GLAZED_TERRACOTTA = get("minecraft:light_gray_glazed_terracotta"); + @Nullable public static final ItemType LIGHT_GRAY_SHULKER_BOX = get("minecraft:light_gray_shulker_box"); + @Nullable public static final ItemType LIGHT_GRAY_STAINED_GLASS = get("minecraft:light_gray_stained_glass"); + @Nullable public static final ItemType LIGHT_GRAY_STAINED_GLASS_PANE = get("minecraft:light_gray_stained_glass_pane"); + @Nullable public static final ItemType LIGHT_GRAY_TERRACOTTA = get("minecraft:light_gray_terracotta"); + @Nullable public static final ItemType LIGHT_GRAY_WOOL = get("minecraft:light_gray_wool"); + @Nullable public static final ItemType LIGHT_WEIGHTED_PRESSURE_PLATE = get("minecraft:light_weighted_pressure_plate"); + @Nullable public static final ItemType LILAC = get("minecraft:lilac"); + @Nullable public static final ItemType LILY_PAD = get("minecraft:lily_pad"); + @Nullable public static final ItemType LIME_BANNER = get("minecraft:lime_banner"); + @Nullable public static final ItemType LIME_BED = get("minecraft:lime_bed"); + @Nullable public static final ItemType LIME_CARPET = get("minecraft:lime_carpet"); + @Nullable public static final ItemType LIME_CONCRETE = get("minecraft:lime_concrete"); + @Nullable public static final ItemType LIME_CONCRETE_POWDER = get("minecraft:lime_concrete_powder"); + @Nullable public static final ItemType LIME_DYE = get("minecraft:lime_dye"); + @Nullable public static final ItemType LIME_GLAZED_TERRACOTTA = get("minecraft:lime_glazed_terracotta"); + @Nullable public static final ItemType LIME_SHULKER_BOX = get("minecraft:lime_shulker_box"); + @Nullable public static final ItemType LIME_STAINED_GLASS = get("minecraft:lime_stained_glass"); + @Nullable public static final ItemType LIME_STAINED_GLASS_PANE = get("minecraft:lime_stained_glass_pane"); + @Nullable public static final ItemType LIME_TERRACOTTA = get("minecraft:lime_terracotta"); + @Nullable public static final ItemType LIME_WOOL = get("minecraft:lime_wool"); + @Nullable public static final ItemType LINGERING_POTION = get("minecraft:lingering_potion"); + @Nullable public static final ItemType LLAMA_SPAWN_EGG = get("minecraft:llama_spawn_egg"); + @Nullable public static final ItemType MAGENTA_BANNER = get("minecraft:magenta_banner"); + @Nullable public static final ItemType MAGENTA_BED = get("minecraft:magenta_bed"); + @Nullable public static final ItemType MAGENTA_CARPET = get("minecraft:magenta_carpet"); + @Nullable public static final ItemType MAGENTA_CONCRETE = get("minecraft:magenta_concrete"); + @Nullable public static final ItemType MAGENTA_CONCRETE_POWDER = get("minecraft:magenta_concrete_powder"); + @Nullable public static final ItemType MAGENTA_DYE = get("minecraft:magenta_dye"); + @Nullable public static final ItemType MAGENTA_GLAZED_TERRACOTTA = get("minecraft:magenta_glazed_terracotta"); + @Nullable public static final ItemType MAGENTA_SHULKER_BOX = get("minecraft:magenta_shulker_box"); + @Nullable public static final ItemType MAGENTA_STAINED_GLASS = get("minecraft:magenta_stained_glass"); + @Nullable public static final ItemType MAGENTA_STAINED_GLASS_PANE = get("minecraft:magenta_stained_glass_pane"); + @Nullable public static final ItemType MAGENTA_TERRACOTTA = get("minecraft:magenta_terracotta"); + @Nullable public static final ItemType MAGENTA_WOOL = get("minecraft:magenta_wool"); + @Nullable public static final ItemType MAGMA_BLOCK = get("minecraft:magma_block"); + @Nullable public static final ItemType MAGMA_CREAM = get("minecraft:magma_cream"); + @Nullable public static final ItemType MAGMA_CUBE_SPAWN_EGG = get("minecraft:magma_cube_spawn_egg"); + @Nullable public static final ItemType MAP = get("minecraft:map"); + @Nullable public static final ItemType MELON = get("minecraft:melon"); + @Nullable public static final ItemType MELON_SEEDS = get("minecraft:melon_seeds"); + @Nullable public static final ItemType MELON_SLICE = get("minecraft:melon_slice"); + @Nullable public static final ItemType MILK_BUCKET = get("minecraft:milk_bucket"); + @Nullable public static final ItemType MINECART = get("minecraft:minecart"); + @Nullable public static final ItemType MOOSHROOM_SPAWN_EGG = get("minecraft:mooshroom_spawn_egg"); + @Nullable public static final ItemType MOSSY_COBBLESTONE = get("minecraft:mossy_cobblestone"); + @Nullable public static final ItemType MOSSY_COBBLESTONE_WALL = get("minecraft:mossy_cobblestone_wall"); + @Nullable public static final ItemType MOSSY_STONE_BRICKS = get("minecraft:mossy_stone_bricks"); + @Nullable public static final ItemType MULE_SPAWN_EGG = get("minecraft:mule_spawn_egg"); + @Nullable public static final ItemType MUSHROOM_STEM = get("minecraft:mushroom_stem"); + @Nullable public static final ItemType MUSHROOM_STEW = get("minecraft:mushroom_stew"); + @Nullable public static final ItemType MUSIC_DISC_11 = get("minecraft:music_disc_11"); + @Nullable public static final ItemType MUSIC_DISC_13 = get("minecraft:music_disc_13"); + @Nullable public static final ItemType MUSIC_DISC_BLOCKS = get("minecraft:music_disc_blocks"); + @Nullable public static final ItemType MUSIC_DISC_CAT = get("minecraft:music_disc_cat"); + @Nullable public static final ItemType MUSIC_DISC_CHIRP = get("minecraft:music_disc_chirp"); + @Nullable public static final ItemType MUSIC_DISC_FAR = get("minecraft:music_disc_far"); + @Nullable public static final ItemType MUSIC_DISC_MALL = get("minecraft:music_disc_mall"); + @Nullable public static final ItemType MUSIC_DISC_MELLOHI = get("minecraft:music_disc_mellohi"); + @Nullable public static final ItemType MUSIC_DISC_STAL = get("minecraft:music_disc_stal"); + @Nullable public static final ItemType MUSIC_DISC_STRAD = get("minecraft:music_disc_strad"); + @Nullable public static final ItemType MUSIC_DISC_WAIT = get("minecraft:music_disc_wait"); + @Nullable public static final ItemType MUSIC_DISC_WARD = get("minecraft:music_disc_ward"); + @Nullable public static final ItemType MUTTON = get("minecraft:mutton"); + @Nullable public static final ItemType MYCELIUM = get("minecraft:mycelium"); + @Nullable public static final ItemType NAME_TAG = get("minecraft:name_tag"); + @Nullable public static final ItemType NAUTILUS_SHELL = get("minecraft:nautilus_shell"); + @Nullable public static final ItemType NETHER_BRICK = get("minecraft:nether_brick"); + @Nullable public static final ItemType NETHER_BRICK_FENCE = get("minecraft:nether_brick_fence"); + @Nullable public static final ItemType NETHER_BRICK_SLAB = get("minecraft:nether_brick_slab"); + @Nullable public static final ItemType NETHER_BRICK_STAIRS = get("minecraft:nether_brick_stairs"); + @Nullable public static final ItemType NETHER_BRICKS = get("minecraft:nether_bricks"); + @Nullable public static final ItemType NETHER_QUARTZ_ORE = get("minecraft:nether_quartz_ore"); + @Nullable public static final ItemType NETHER_STAR = get("minecraft:nether_star"); + @Nullable public static final ItemType NETHER_WART = get("minecraft:nether_wart"); + @Nullable public static final ItemType NETHER_WART_BLOCK = get("minecraft:nether_wart_block"); + @Nullable public static final ItemType NETHERRACK = get("minecraft:netherrack"); + @Nullable public static final ItemType NOTE_BLOCK = get("minecraft:note_block"); + @Nullable public static final ItemType OAK_BOAT = get("minecraft:oak_boat"); + @Nullable public static final ItemType OAK_BUTTON = get("minecraft:oak_button"); + @Nullable public static final ItemType OAK_DOOR = get("minecraft:oak_door"); + @Nullable public static final ItemType OAK_FENCE = get("minecraft:oak_fence"); + @Nullable public static final ItemType OAK_FENCE_GATE = get("minecraft:oak_fence_gate"); + @Nullable public static final ItemType OAK_LEAVES = get("minecraft:oak_leaves"); + @Nullable public static final ItemType OAK_LOG = get("minecraft:oak_log"); + @Nullable public static final ItemType OAK_PLANKS = get("minecraft:oak_planks"); + @Nullable public static final ItemType OAK_PRESSURE_PLATE = get("minecraft:oak_pressure_plate"); + @Nullable public static final ItemType OAK_SAPLING = get("minecraft:oak_sapling"); + @Nullable public static final ItemType OAK_SLAB = get("minecraft:oak_slab"); + @Nullable public static final ItemType OAK_STAIRS = get("minecraft:oak_stairs"); + @Nullable public static final ItemType OAK_TRAPDOOR = get("minecraft:oak_trapdoor"); + @Nullable public static final ItemType OAK_WOOD = get("minecraft:oak_wood"); + @Nullable public static final ItemType OBSERVER = get("minecraft:observer"); + @Nullable public static final ItemType OBSIDIAN = get("minecraft:obsidian"); + @Nullable public static final ItemType OCELOT_SPAWN_EGG = get("minecraft:ocelot_spawn_egg"); + @Nullable public static final ItemType ORANGE_BANNER = get("minecraft:orange_banner"); + @Nullable public static final ItemType ORANGE_BED = get("minecraft:orange_bed"); + @Nullable public static final ItemType ORANGE_CARPET = get("minecraft:orange_carpet"); + @Nullable public static final ItemType ORANGE_CONCRETE = get("minecraft:orange_concrete"); + @Nullable public static final ItemType ORANGE_CONCRETE_POWDER = get("minecraft:orange_concrete_powder"); + @Nullable public static final ItemType ORANGE_DYE = get("minecraft:orange_dye"); + @Nullable public static final ItemType ORANGE_GLAZED_TERRACOTTA = get("minecraft:orange_glazed_terracotta"); + @Nullable public static final ItemType ORANGE_SHULKER_BOX = get("minecraft:orange_shulker_box"); + @Nullable public static final ItemType ORANGE_STAINED_GLASS = get("minecraft:orange_stained_glass"); + @Nullable public static final ItemType ORANGE_STAINED_GLASS_PANE = get("minecraft:orange_stained_glass_pane"); + @Nullable public static final ItemType ORANGE_TERRACOTTA = get("minecraft:orange_terracotta"); + @Nullable public static final ItemType ORANGE_TULIP = get("minecraft:orange_tulip"); + @Nullable public static final ItemType ORANGE_WOOL = get("minecraft:orange_wool"); + @Nullable public static final ItemType OXEYE_DAISY = get("minecraft:oxeye_daisy"); + @Nullable public static final ItemType PACKED_ICE = get("minecraft:packed_ice"); + @Nullable public static final ItemType PAINTING = get("minecraft:painting"); + @Nullable public static final ItemType PAPER = get("minecraft:paper"); + @Nullable public static final ItemType PARROT_SPAWN_EGG = get("minecraft:parrot_spawn_egg"); + @Nullable public static final ItemType PEONY = get("minecraft:peony"); + @Nullable public static final ItemType PETRIFIED_OAK_SLAB = get("minecraft:petrified_oak_slab"); + @Nullable public static final ItemType PHANTOM_MEMBRANE = get("minecraft:phantom_membrane"); + @Nullable public static final ItemType PHANTOM_SPAWN_EGG = get("minecraft:phantom_spawn_egg"); + @Nullable public static final ItemType PIG_SPAWN_EGG = get("minecraft:pig_spawn_egg"); + @Nullable public static final ItemType PINK_BANNER = get("minecraft:pink_banner"); + @Nullable public static final ItemType PINK_BED = get("minecraft:pink_bed"); + @Nullable public static final ItemType PINK_CARPET = get("minecraft:pink_carpet"); + @Nullable public static final ItemType PINK_CONCRETE = get("minecraft:pink_concrete"); + @Nullable public static final ItemType PINK_CONCRETE_POWDER = get("minecraft:pink_concrete_powder"); + @Nullable public static final ItemType PINK_DYE = get("minecraft:pink_dye"); + @Nullable public static final ItemType PINK_GLAZED_TERRACOTTA = get("minecraft:pink_glazed_terracotta"); + @Nullable public static final ItemType PINK_SHULKER_BOX = get("minecraft:pink_shulker_box"); + @Nullable public static final ItemType PINK_STAINED_GLASS = get("minecraft:pink_stained_glass"); + @Nullable public static final ItemType PINK_STAINED_GLASS_PANE = get("minecraft:pink_stained_glass_pane"); + @Nullable public static final ItemType PINK_TERRACOTTA = get("minecraft:pink_terracotta"); + @Nullable public static final ItemType PINK_TULIP = get("minecraft:pink_tulip"); + @Nullable public static final ItemType PINK_WOOL = get("minecraft:pink_wool"); + @Nullable public static final ItemType PISTON = get("minecraft:piston"); + @Nullable public static final ItemType PLAYER_HEAD = get("minecraft:player_head"); + @Nullable public static final ItemType PODZOL = get("minecraft:podzol"); + @Nullable public static final ItemType POISONOUS_POTATO = get("minecraft:poisonous_potato"); + @Nullable public static final ItemType POLAR_BEAR_SPAWN_EGG = get("minecraft:polar_bear_spawn_egg"); + @Nullable public static final ItemType POLISHED_ANDESITE = get("minecraft:polished_andesite"); + @Nullable public static final ItemType POLISHED_DIORITE = get("minecraft:polished_diorite"); + @Nullable public static final ItemType POLISHED_GRANITE = get("minecraft:polished_granite"); + @Nullable public static final ItemType POPPED_CHORUS_FRUIT = get("minecraft:popped_chorus_fruit"); + @Nullable public static final ItemType POPPY = get("minecraft:poppy"); + @Nullable public static final ItemType PORKCHOP = get("minecraft:porkchop"); + @Nullable public static final ItemType POTATO = get("minecraft:potato"); + @Nullable public static final ItemType POTION = get("minecraft:potion"); + @Nullable public static final ItemType POWERED_RAIL = get("minecraft:powered_rail"); + @Nullable public static final ItemType PRISMARINE = get("minecraft:prismarine"); + @Nullable public static final ItemType PRISMARINE_BRICK_SLAB = get("minecraft:prismarine_brick_slab"); + @Nullable public static final ItemType PRISMARINE_BRICK_STAIRS = get("minecraft:prismarine_brick_stairs"); + @Nullable public static final ItemType PRISMARINE_BRICKS = get("minecraft:prismarine_bricks"); + @Nullable public static final ItemType PRISMARINE_CRYSTALS = get("minecraft:prismarine_crystals"); + @Nullable public static final ItemType PRISMARINE_SHARD = get("minecraft:prismarine_shard"); + @Nullable public static final ItemType PRISMARINE_SLAB = get("minecraft:prismarine_slab"); + @Nullable public static final ItemType PRISMARINE_STAIRS = get("minecraft:prismarine_stairs"); + @Nullable public static final ItemType PUFFERFISH = get("minecraft:pufferfish"); + @Nullable public static final ItemType PUFFERFISH_BUCKET = get("minecraft:pufferfish_bucket"); + @Nullable public static final ItemType PUFFERFISH_SPAWN_EGG = get("minecraft:pufferfish_spawn_egg"); + @Nullable public static final ItemType PUMPKIN = get("minecraft:pumpkin"); + @Nullable public static final ItemType PUMPKIN_PIE = get("minecraft:pumpkin_pie"); + @Nullable public static final ItemType PUMPKIN_SEEDS = get("minecraft:pumpkin_seeds"); + @Nullable public static final ItemType PURPLE_BANNER = get("minecraft:purple_banner"); + @Nullable public static final ItemType PURPLE_BED = get("minecraft:purple_bed"); + @Nullable public static final ItemType PURPLE_CARPET = get("minecraft:purple_carpet"); + @Nullable public static final ItemType PURPLE_CONCRETE = get("minecraft:purple_concrete"); + @Nullable public static final ItemType PURPLE_CONCRETE_POWDER = get("minecraft:purple_concrete_powder"); + @Nullable public static final ItemType PURPLE_DYE = get("minecraft:purple_dye"); + @Nullable public static final ItemType PURPLE_GLAZED_TERRACOTTA = get("minecraft:purple_glazed_terracotta"); + @Nullable public static final ItemType PURPLE_SHULKER_BOX = get("minecraft:purple_shulker_box"); + @Nullable public static final ItemType PURPLE_STAINED_GLASS = get("minecraft:purple_stained_glass"); + @Nullable public static final ItemType PURPLE_STAINED_GLASS_PANE = get("minecraft:purple_stained_glass_pane"); + @Nullable public static final ItemType PURPLE_TERRACOTTA = get("minecraft:purple_terracotta"); + @Nullable public static final ItemType PURPLE_WOOL = get("minecraft:purple_wool"); + @Nullable public static final ItemType PURPUR_BLOCK = get("minecraft:purpur_block"); + @Nullable public static final ItemType PURPUR_PILLAR = get("minecraft:purpur_pillar"); + @Nullable public static final ItemType PURPUR_SLAB = get("minecraft:purpur_slab"); + @Nullable public static final ItemType PURPUR_STAIRS = get("minecraft:purpur_stairs"); + @Nullable public static final ItemType QUARTZ = get("minecraft:quartz"); + @Nullable public static final ItemType QUARTZ_BLOCK = get("minecraft:quartz_block"); + @Nullable public static final ItemType QUARTZ_PILLAR = get("minecraft:quartz_pillar"); + @Nullable public static final ItemType QUARTZ_SLAB = get("minecraft:quartz_slab"); + @Nullable public static final ItemType QUARTZ_STAIRS = get("minecraft:quartz_stairs"); + @Nullable public static final ItemType RABBIT = get("minecraft:rabbit"); + @Nullable public static final ItemType RABBIT_FOOT = get("minecraft:rabbit_foot"); + @Nullable public static final ItemType RABBIT_HIDE = get("minecraft:rabbit_hide"); + @Nullable public static final ItemType RABBIT_SPAWN_EGG = get("minecraft:rabbit_spawn_egg"); + @Nullable public static final ItemType RABBIT_STEW = get("minecraft:rabbit_stew"); + @Nullable public static final ItemType RAIL = get("minecraft:rail"); + @Nullable public static final ItemType RED_BANNER = get("minecraft:red_banner"); + @Nullable public static final ItemType RED_BED = get("minecraft:red_bed"); + @Nullable public static final ItemType RED_CARPET = get("minecraft:red_carpet"); + @Nullable public static final ItemType RED_CONCRETE = get("minecraft:red_concrete"); + @Nullable public static final ItemType RED_CONCRETE_POWDER = get("minecraft:red_concrete_powder"); + @Nullable public static final ItemType RED_GLAZED_TERRACOTTA = get("minecraft:red_glazed_terracotta"); + @Nullable public static final ItemType RED_MUSHROOM = get("minecraft:red_mushroom"); + @Nullable public static final ItemType RED_MUSHROOM_BLOCK = get("minecraft:red_mushroom_block"); + @Nullable public static final ItemType RED_NETHER_BRICKS = get("minecraft:red_nether_bricks"); + @Nullable public static final ItemType RED_SAND = get("minecraft:red_sand"); + @Nullable public static final ItemType RED_SANDSTONE = get("minecraft:red_sandstone"); + @Nullable public static final ItemType RED_SANDSTONE_SLAB = get("minecraft:red_sandstone_slab"); + @Nullable public static final ItemType RED_SANDSTONE_STAIRS = get("minecraft:red_sandstone_stairs"); + @Nullable public static final ItemType RED_SHULKER_BOX = get("minecraft:red_shulker_box"); + @Nullable public static final ItemType RED_STAINED_GLASS = get("minecraft:red_stained_glass"); + @Nullable public static final ItemType RED_STAINED_GLASS_PANE = get("minecraft:red_stained_glass_pane"); + @Nullable public static final ItemType RED_TERRACOTTA = get("minecraft:red_terracotta"); + @Nullable public static final ItemType RED_TULIP = get("minecraft:red_tulip"); + @Nullable public static final ItemType RED_WOOL = get("minecraft:red_wool"); + @Nullable public static final ItemType REDSTONE = get("minecraft:redstone"); + @Nullable public static final ItemType REDSTONE_BLOCK = get("minecraft:redstone_block"); + @Nullable public static final ItemType REDSTONE_LAMP = get("minecraft:redstone_lamp"); + @Nullable public static final ItemType REDSTONE_ORE = get("minecraft:redstone_ore"); + @Nullable public static final ItemType REDSTONE_TORCH = get("minecraft:redstone_torch"); + @Nullable public static final ItemType REPEATER = get("minecraft:repeater"); + @Nullable public static final ItemType REPEATING_COMMAND_BLOCK = get("minecraft:repeating_command_block"); + @Nullable public static final ItemType ROSE_BUSH = get("minecraft:rose_bush"); + @Nullable public static final ItemType ROSE_RED = get("minecraft:rose_red"); + @Nullable public static final ItemType ROTTEN_FLESH = get("minecraft:rotten_flesh"); + @Nullable public static final ItemType SADDLE = get("minecraft:saddle"); + @Nullable public static final ItemType SALMON = get("minecraft:salmon"); + @Nullable public static final ItemType SALMON_BUCKET = get("minecraft:salmon_bucket"); + @Nullable public static final ItemType SALMON_SPAWN_EGG = get("minecraft:salmon_spawn_egg"); + @Nullable public static final ItemType SAND = get("minecraft:sand"); + @Nullable public static final ItemType SANDSTONE = get("minecraft:sandstone"); + @Nullable public static final ItemType SANDSTONE_SLAB = get("minecraft:sandstone_slab"); + @Nullable public static final ItemType SANDSTONE_STAIRS = get("minecraft:sandstone_stairs"); + @Nullable public static final ItemType SCUTE = get("minecraft:scute"); + @Nullable public static final ItemType SEA_LANTERN = get("minecraft:sea_lantern"); + @Nullable public static final ItemType SEA_PICKLE = get("minecraft:sea_pickle"); + @Nullable public static final ItemType SEAGRASS = get("minecraft:seagrass"); + @Nullable public static final ItemType SHEARS = get("minecraft:shears"); + @Nullable public static final ItemType SHEEP_SPAWN_EGG = get("minecraft:sheep_spawn_egg"); + @Nullable public static final ItemType SHIELD = get("minecraft:shield"); + @Nullable public static final ItemType SHULKER_BOX = get("minecraft:shulker_box"); + @Nullable public static final ItemType SHULKER_SHELL = get("minecraft:shulker_shell"); + @Nullable public static final ItemType SHULKER_SPAWN_EGG = get("minecraft:shulker_spawn_egg"); + @Nullable public static final ItemType SIGN = get("minecraft:sign"); + @Nullable public static final ItemType SILVERFISH_SPAWN_EGG = get("minecraft:silverfish_spawn_egg"); + @Nullable public static final ItemType SKELETON_HORSE_SPAWN_EGG = get("minecraft:skeleton_horse_spawn_egg"); + @Nullable public static final ItemType SKELETON_SKULL = get("minecraft:skeleton_skull"); + @Nullable public static final ItemType SKELETON_SPAWN_EGG = get("minecraft:skeleton_spawn_egg"); + @Nullable public static final ItemType SLIME_BALL = get("minecraft:slime_ball"); + @Nullable public static final ItemType SLIME_BLOCK = get("minecraft:slime_block"); + @Nullable public static final ItemType SLIME_SPAWN_EGG = get("minecraft:slime_spawn_egg"); + @Nullable public static final ItemType SMOOTH_QUARTZ = get("minecraft:smooth_quartz"); + @Nullable public static final ItemType SMOOTH_RED_SANDSTONE = get("minecraft:smooth_red_sandstone"); + @Nullable public static final ItemType SMOOTH_SANDSTONE = get("minecraft:smooth_sandstone"); + @Nullable public static final ItemType SMOOTH_STONE = get("minecraft:smooth_stone"); + @Nullable public static final ItemType SNOW = get("minecraft:snow"); + @Nullable public static final ItemType SNOW_BLOCK = get("minecraft:snow_block"); + @Nullable public static final ItemType SNOWBALL = get("minecraft:snowball"); + @Nullable public static final ItemType SOUL_SAND = get("minecraft:soul_sand"); + @Nullable public static final ItemType SPAWNER = get("minecraft:spawner"); + @Nullable public static final ItemType SPECTRAL_ARROW = get("minecraft:spectral_arrow"); + @Nullable public static final ItemType SPIDER_EYE = get("minecraft:spider_eye"); + @Nullable public static final ItemType SPIDER_SPAWN_EGG = get("minecraft:spider_spawn_egg"); + @Nullable public static final ItemType SPLASH_POTION = get("minecraft:splash_potion"); + @Nullable public static final ItemType SPONGE = get("minecraft:sponge"); + @Nullable public static final ItemType SPRUCE_BOAT = get("minecraft:spruce_boat"); + @Nullable public static final ItemType SPRUCE_BUTTON = get("minecraft:spruce_button"); + @Nullable public static final ItemType SPRUCE_DOOR = get("minecraft:spruce_door"); + @Nullable public static final ItemType SPRUCE_FENCE = get("minecraft:spruce_fence"); + @Nullable public static final ItemType SPRUCE_FENCE_GATE = get("minecraft:spruce_fence_gate"); + @Nullable public static final ItemType SPRUCE_LEAVES = get("minecraft:spruce_leaves"); + @Nullable public static final ItemType SPRUCE_LOG = get("minecraft:spruce_log"); + @Nullable public static final ItemType SPRUCE_PLANKS = get("minecraft:spruce_planks"); + @Nullable public static final ItemType SPRUCE_PRESSURE_PLATE = get("minecraft:spruce_pressure_plate"); + @Nullable public static final ItemType SPRUCE_SAPLING = get("minecraft:spruce_sapling"); + @Nullable public static final ItemType SPRUCE_SLAB = get("minecraft:spruce_slab"); + @Nullable public static final ItemType SPRUCE_STAIRS = get("minecraft:spruce_stairs"); + @Nullable public static final ItemType SPRUCE_TRAPDOOR = get("minecraft:spruce_trapdoor"); + @Nullable public static final ItemType SPRUCE_WOOD = get("minecraft:spruce_wood"); + @Nullable public static final ItemType SQUID_SPAWN_EGG = get("minecraft:squid_spawn_egg"); + @Nullable public static final ItemType STICK = get("minecraft:stick"); + @Nullable public static final ItemType STICKY_PISTON = get("minecraft:sticky_piston"); + @Nullable public static final ItemType STONE = get("minecraft:stone"); + @Nullable public static final ItemType STONE_AXE = get("minecraft:stone_axe"); + @Nullable public static final ItemType STONE_BRICK_SLAB = get("minecraft:stone_brick_slab"); + @Nullable public static final ItemType STONE_BRICK_STAIRS = get("minecraft:stone_brick_stairs"); + @Nullable public static final ItemType STONE_BRICKS = get("minecraft:stone_bricks"); + @Nullable public static final ItemType STONE_BUTTON = get("minecraft:stone_button"); + @Nullable public static final ItemType STONE_HOE = get("minecraft:stone_hoe"); + @Nullable public static final ItemType STONE_PICKAXE = get("minecraft:stone_pickaxe"); + @Nullable public static final ItemType STONE_PRESSURE_PLATE = get("minecraft:stone_pressure_plate"); + @Nullable public static final ItemType STONE_SHOVEL = get("minecraft:stone_shovel"); + @Nullable public static final ItemType STONE_SLAB = get("minecraft:stone_slab"); + @Nullable public static final ItemType STONE_SWORD = get("minecraft:stone_sword"); + @Nullable public static final ItemType STRAY_SPAWN_EGG = get("minecraft:stray_spawn_egg"); + @Nullable public static final ItemType STRING = get("minecraft:string"); + @Nullable public static final ItemType STRIPPED_ACACIA_LOG = get("minecraft:stripped_acacia_log"); + @Nullable public static final ItemType STRIPPED_ACACIA_WOOD = get("minecraft:stripped_acacia_wood"); + @Nullable public static final ItemType STRIPPED_BIRCH_LOG = get("minecraft:stripped_birch_log"); + @Nullable public static final ItemType STRIPPED_BIRCH_WOOD = get("minecraft:stripped_birch_wood"); + @Nullable public static final ItemType STRIPPED_DARK_OAK_LOG = get("minecraft:stripped_dark_oak_log"); + @Nullable public static final ItemType STRIPPED_DARK_OAK_WOOD = get("minecraft:stripped_dark_oak_wood"); + @Nullable public static final ItemType STRIPPED_JUNGLE_LOG = get("minecraft:stripped_jungle_log"); + @Nullable public static final ItemType STRIPPED_JUNGLE_WOOD = get("minecraft:stripped_jungle_wood"); + @Nullable public static final ItemType STRIPPED_OAK_LOG = get("minecraft:stripped_oak_log"); + @Nullable public static final ItemType STRIPPED_OAK_WOOD = get("minecraft:stripped_oak_wood"); + @Nullable public static final ItemType STRIPPED_SPRUCE_LOG = get("minecraft:stripped_spruce_log"); + @Nullable public static final ItemType STRIPPED_SPRUCE_WOOD = get("minecraft:stripped_spruce_wood"); + @Nullable public static final ItemType STRUCTURE_BLOCK = get("minecraft:structure_block"); + @Nullable public static final ItemType STRUCTURE_VOID = get("minecraft:structure_void"); + @Nullable public static final ItemType SUGAR = get("minecraft:sugar"); + @Nullable public static final ItemType SUGAR_CANE = get("minecraft:sugar_cane"); + @Nullable public static final ItemType SUNFLOWER = get("minecraft:sunflower"); + @Nullable public static final ItemType TALL_GRASS = get("minecraft:tall_grass"); + @Nullable public static final ItemType TERRACOTTA = get("minecraft:terracotta"); + @Nullable public static final ItemType TIPPED_ARROW = get("minecraft:tipped_arrow"); + @Nullable public static final ItemType TNT = get("minecraft:tnt"); + @Nullable public static final ItemType TNT_MINECART = get("minecraft:tnt_minecart"); + @Nullable public static final ItemType TORCH = get("minecraft:torch"); + @Nullable public static final ItemType TOTEM_OF_UNDYING = get("minecraft:totem_of_undying"); + @Nullable public static final ItemType TRAPPED_CHEST = get("minecraft:trapped_chest"); + @Nullable public static final ItemType TRIDENT = get("minecraft:trident"); + @Nullable public static final ItemType TRIPWIRE_HOOK = get("minecraft:tripwire_hook"); + @Nullable public static final ItemType TROPICAL_FISH = get("minecraft:tropical_fish"); + @Nullable public static final ItemType TROPICAL_FISH_BUCKET = get("minecraft:tropical_fish_bucket"); + @Nullable public static final ItemType TROPICAL_FISH_SPAWN_EGG = get("minecraft:tropical_fish_spawn_egg"); + @Nullable public static final ItemType TUBE_CORAL = get("minecraft:tube_coral"); + @Nullable public static final ItemType TUBE_CORAL_BLOCK = get("minecraft:tube_coral_block"); + @Nullable public static final ItemType TUBE_CORAL_FAN = get("minecraft:tube_coral_fan"); + @Nullable public static final ItemType TURTLE_EGG = get("minecraft:turtle_egg"); + @Nullable public static final ItemType TURTLE_HELMET = get("minecraft:turtle_helmet"); + @Nullable public static final ItemType TURTLE_SPAWN_EGG = get("minecraft:turtle_spawn_egg"); + @Nullable public static final ItemType VEX_SPAWN_EGG = get("minecraft:vex_spawn_egg"); + @Nullable public static final ItemType VILLAGER_SPAWN_EGG = get("minecraft:villager_spawn_egg"); + @Nullable public static final ItemType VINDICATOR_SPAWN_EGG = get("minecraft:vindicator_spawn_egg"); + @Nullable public static final ItemType VINE = get("minecraft:vine"); + @Nullable public static final ItemType WATER_BUCKET = get("minecraft:water_bucket"); + @Nullable public static final ItemType WET_SPONGE = get("minecraft:wet_sponge"); + @Nullable public static final ItemType WHEAT = get("minecraft:wheat"); + @Nullable public static final ItemType WHEAT_SEEDS = get("minecraft:wheat_seeds"); + @Nullable public static final ItemType WHITE_BANNER = get("minecraft:white_banner"); + @Nullable public static final ItemType WHITE_BED = get("minecraft:white_bed"); + @Nullable public static final ItemType WHITE_CARPET = get("minecraft:white_carpet"); + @Nullable public static final ItemType WHITE_CONCRETE = get("minecraft:white_concrete"); + @Nullable public static final ItemType WHITE_CONCRETE_POWDER = get("minecraft:white_concrete_powder"); + @Nullable public static final ItemType WHITE_GLAZED_TERRACOTTA = get("minecraft:white_glazed_terracotta"); + @Nullable public static final ItemType WHITE_SHULKER_BOX = get("minecraft:white_shulker_box"); + @Nullable public static final ItemType WHITE_STAINED_GLASS = get("minecraft:white_stained_glass"); + @Nullable public static final ItemType WHITE_STAINED_GLASS_PANE = get("minecraft:white_stained_glass_pane"); + @Nullable public static final ItemType WHITE_TERRACOTTA = get("minecraft:white_terracotta"); + @Nullable public static final ItemType WHITE_TULIP = get("minecraft:white_tulip"); + @Nullable public static final ItemType WHITE_WOOL = get("minecraft:white_wool"); + @Nullable public static final ItemType WITCH_SPAWN_EGG = get("minecraft:witch_spawn_egg"); + @Nullable public static final ItemType WITHER_SKELETON_SKULL = get("minecraft:wither_skeleton_skull"); + @Nullable public static final ItemType WITHER_SKELETON_SPAWN_EGG = get("minecraft:wither_skeleton_spawn_egg"); + @Nullable public static final ItemType WOLF_SPAWN_EGG = get("minecraft:wolf_spawn_egg"); + @Nullable public static final ItemType WOODEN_AXE = get("minecraft:wooden_axe"); + @Nullable public static final ItemType WOODEN_HOE = get("minecraft:wooden_hoe"); + @Nullable public static final ItemType WOODEN_PICKAXE = get("minecraft:wooden_pickaxe"); + @Nullable public static final ItemType WOODEN_SHOVEL = get("minecraft:wooden_shovel"); + @Nullable public static final ItemType WOODEN_SWORD = get("minecraft:wooden_sword"); + @Nullable public static final ItemType WRITABLE_BOOK = get("minecraft:writable_book"); + @Nullable public static final ItemType WRITTEN_BOOK = get("minecraft:written_book"); + @Nullable public static final ItemType YELLOW_BANNER = get("minecraft:yellow_banner"); + @Nullable public static final ItemType YELLOW_BED = get("minecraft:yellow_bed"); + @Nullable public static final ItemType YELLOW_CARPET = get("minecraft:yellow_carpet"); + @Nullable public static final ItemType YELLOW_CONCRETE = get("minecraft:yellow_concrete"); + @Nullable public static final ItemType YELLOW_CONCRETE_POWDER = get("minecraft:yellow_concrete_powder"); + @Nullable public static final ItemType YELLOW_GLAZED_TERRACOTTA = get("minecraft:yellow_glazed_terracotta"); + @Nullable public static final ItemType YELLOW_SHULKER_BOX = get("minecraft:yellow_shulker_box"); + @Nullable public static final ItemType YELLOW_STAINED_GLASS = get("minecraft:yellow_stained_glass"); + @Nullable public static final ItemType YELLOW_STAINED_GLASS_PANE = get("minecraft:yellow_stained_glass_pane"); + @Nullable public static final ItemType YELLOW_TERRACOTTA = get("minecraft:yellow_terracotta"); + @Nullable public static final ItemType YELLOW_WOOL = get("minecraft:yellow_wool"); + @Nullable public static final ItemType ZOMBIE_HEAD = get("minecraft:zombie_head"); + @Nullable public static final ItemType ZOMBIE_HORSE_SPAWN_EGG = get("minecraft:zombie_horse_spawn_egg"); + @Nullable public static final ItemType ZOMBIE_PIGMAN_SPAWN_EGG = get("minecraft:zombie_pigman_spawn_egg"); + @Nullable public static final ItemType ZOMBIE_SPAWN_EGG = get("minecraft:zombie_spawn_egg"); + @Nullable public static final ItemType ZOMBIE_VILLAGER_SPAWN_EGG = get("minecraft:zombie_villager_spawn_egg"); private ItemTypes() { } - private static ItemType register(final String id) { - return register(new ItemType(id)); - } - - public static ItemType register(final ItemType item) { - return ItemType.REGISTRY.register(item.getId(), item); - } - public static @Nullable ItemType get(final String id) { return ItemType.REGISTRY.get(id); } diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java index e32b7c6cd..c90f312fe 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java @@ -42,7 +42,7 @@ public class BlockTransformExtentTest { @Before public void setUp() throws Exception { - BlockTypes.register(new BlockType("worldedit:test")); + BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test")); } @Test diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index d37b60f4e..5a5a217ad 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -129,14 +129,14 @@ public class ForgeWorldEdit { for (ResourceLocation name : Block.REGISTRY.getKeys()) { String nameStr = name.toString(); if (!BlockType.REGISTRY.keySet().contains(nameStr)) { - BlockTypes.register(new BlockType(nameStr)); + BlockType.REGISTRY.register(nameStr, new BlockType(nameStr)); } } for (ResourceLocation name : Item.REGISTRY.getKeys()) { String nameStr = name.toString(); if (!ItemType.REGISTRY.keySet().contains(nameStr)) { - ItemTypes.register(new ItemType(nameStr)); + ItemType.REGISTRY.register(nameStr, new ItemType(nameStr)); } } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java index f9f085c38..f3133fb13 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java @@ -33,7 +33,6 @@ import com.sk89q.worldedit.sponge.adapter.AdapterLoadException; import com.sk89q.worldedit.sponge.adapter.SpongeImplAdapter; import com.sk89q.worldedit.sponge.adapter.SpongeImplLoader; import com.sk89q.worldedit.sponge.config.SpongeConfiguration; -import com.sk89q.worldedit.world.item.ItemTypes; import org.bstats.sponge.Metrics2; import org.slf4j.Logger; import org.spongepowered.api.Sponge; @@ -141,14 +140,14 @@ public class SpongeWorldEdit { // TODO Handle blockstate stuff String id = blockType.getId(); if (!com.sk89q.worldedit.world.block.BlockType.REGISTRY.keySet().contains(id)) { - com.sk89q.worldedit.world.block.BlockTypes.register(new com.sk89q.worldedit.world.block.BlockType(id)); + com.sk89q.worldedit.world.block.BlockType.REGISTRY.register(id, new com.sk89q.worldedit.world.block.BlockType(id)); } } for (ItemType itemType : Sponge.getRegistry().getAllOf(ItemType.class)) { String id = itemType.getId(); if (!com.sk89q.worldedit.world.item.ItemType.REGISTRY.keySet().contains(id)) { - ItemTypes.register(new com.sk89q.worldedit.world.item.ItemType(id)); + com.sk89q.worldedit.world.item.ItemType.REGISTRY.register(id, new com.sk89q.worldedit.world.item.ItemType(id)); } } From 3683a0438a559f20326c25cf951173baf2396e0d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 16 Feb 2019 19:58:06 +1000 Subject: [PATCH 117/182] Use nonNull rather than !isNull --- .../sk89q/worldedit/LocalConfiguration.java | 359 +++++++++--------- 1 file changed, 179 insertions(+), 180 deletions(-) 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 120d4ddb4..1e9d19660 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -1,180 +1,179 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.google.common.collect.Lists; -import com.sk89q.worldedit.util.logging.LogFormat; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.registry.LegacyMapper; -import com.sk89q.worldedit.world.snapshot.SnapshotRepository; - -import java.io.File; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.function.IntFunction; - -/** - * Represents WorldEdit's configuration. - */ -public abstract class LocalConfiguration { - - public boolean profile = false; - public boolean traceUnflushedSessions = false; - public Set disallowedBlocks = new HashSet<>(); - public int defaultChangeLimit = -1; - public int maxChangeLimit = -1; - public int defaultMaxPolygonalPoints = -1; - public int maxPolygonalPoints = 20; - public int defaultMaxPolyhedronPoints = -1; - public int maxPolyhedronPoints = 20; - public String shellSaveType = ""; - public SnapshotRepository snapshotRepo = null; - public int maxRadius = -1; - public int maxSuperPickaxeSize = 5; - public int maxBrushRadius = 6; - public boolean logCommands = false; - public String logFile = ""; - public String logFormat = LogFormat.DEFAULT_FORMAT; - public boolean registerHelp = true; // what is the point of this, it's not even used - public String wandItem = "minecraft:wooden_axe"; - public boolean superPickaxeDrop = true; - public boolean superPickaxeManyDrop = true; - public boolean noDoubleSlash = false; - public boolean useInventory = false; - public boolean useInventoryOverride = false; - public boolean useInventoryCreativeOverride = false; - public boolean navigationUseGlass = true; - public String navigationWand = "minecraft:compass"; - public int navigationWandMaxDistance = 50; - public int scriptTimeout = 3000; - public int calculationTimeout = 100; - public Set allowedDataCycleBlocks = new HashSet<>(); - public String saveDir = "schematics"; - public String scriptsDir = "craftscripts"; - public boolean showHelpInfo = true; - public int butcherDefaultRadius = -1; - public int butcherMaxRadius = -1; - public boolean allowSymlinks = false; - public boolean serverSideCUI = true; - - protected String[] getDefaultDisallowedBlocks() { - List blockTypes = Lists.newArrayList( - BlockTypes.OAK_SAPLING, - BlockTypes.JUNGLE_SAPLING, - BlockTypes.DARK_OAK_SAPLING, - BlockTypes.SPRUCE_SAPLING, - BlockTypes.BIRCH_SAPLING, - BlockTypes.ACACIA_SAPLING, - BlockTypes.BLACK_BED, - BlockTypes.BLUE_BED, - BlockTypes.BROWN_BED, - BlockTypes.CYAN_BED, - BlockTypes.GRAY_BED, - BlockTypes.GREEN_BED, - BlockTypes.LIGHT_BLUE_BED, - BlockTypes.LIGHT_GRAY_BED, - BlockTypes.LIME_BED, - BlockTypes.MAGENTA_BED, - BlockTypes.ORANGE_BED, - BlockTypes.PINK_BED, - BlockTypes.PURPLE_BED, - BlockTypes.RED_BED, - BlockTypes.WHITE_BED, - BlockTypes.YELLOW_BED, - BlockTypes.POWERED_RAIL, - BlockTypes.DETECTOR_RAIL, - BlockTypes.GRASS, - BlockTypes.DEAD_BUSH, - BlockTypes.MOVING_PISTON, - BlockTypes.PISTON_HEAD, - BlockTypes.SUNFLOWER, - BlockTypes.ROSE_BUSH, - BlockTypes.DANDELION, - BlockTypes.POPPY, - BlockTypes.BROWN_MUSHROOM, - BlockTypes.RED_MUSHROOM, - BlockTypes.TNT, - BlockTypes.TORCH, - BlockTypes.FIRE, - BlockTypes.REDSTONE_WIRE, - BlockTypes.WHEAT, - BlockTypes.POTATOES, - BlockTypes.CARROTS, - BlockTypes.MELON_STEM, - BlockTypes.PUMPKIN_STEM, - BlockTypes.BEETROOTS, - BlockTypes.RAIL, - BlockTypes.LEVER, - BlockTypes.REDSTONE_TORCH, - BlockTypes.REDSTONE_WALL_TORCH, - BlockTypes.REPEATER, - BlockTypes.COMPARATOR, - BlockTypes.STONE_BUTTON, - BlockTypes.BIRCH_BUTTON, - BlockTypes.ACACIA_BUTTON, - BlockTypes.DARK_OAK_BUTTON, - BlockTypes.JUNGLE_BUTTON, - BlockTypes.OAK_BUTTON, - BlockTypes.SPRUCE_BUTTON, - BlockTypes.CACTUS, - BlockTypes.SUGAR_CANE, - // ores and stuff - BlockTypes.BEDROCK - ); - return blockTypes.stream().filter(type -> !Objects.isNull(type)).map(BlockType::getId).toArray(String[]::new); - } - - /** - * Load the configuration. - */ - public abstract void load(); - - /** - * Get the working directory to work from. - * - * @return a working directory - */ - public File getWorkingDirectory() { - return new File("."); - } - - public String convertLegacyItem(String legacy) { - String item = legacy; - try { - String[] splitter = item.split(":", 2); - int id = 0; - byte data = 0; - if (splitter.length == 1) { - id = Integer.parseInt(item); - } else { - id = Integer.parseInt(splitter[0]); - data = Byte.parseByte(splitter[1]); - } - item = LegacyMapper.getInstance().getItemFromLegacy(id, data).getId(); - } catch (Throwable e) { - } - - return item; - } - -} +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit; + +import com.google.common.collect.Lists; +import com.sk89q.worldedit.util.logging.LogFormat; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; +import com.sk89q.worldedit.world.snapshot.SnapshotRepository; + +import java.io.File; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +/** + * Represents WorldEdit's configuration. + */ +public abstract class LocalConfiguration { + + public boolean profile = false; + public boolean traceUnflushedSessions = false; + public Set disallowedBlocks = new HashSet<>(); + public int defaultChangeLimit = -1; + public int maxChangeLimit = -1; + public int defaultMaxPolygonalPoints = -1; + public int maxPolygonalPoints = 20; + public int defaultMaxPolyhedronPoints = -1; + public int maxPolyhedronPoints = 20; + public String shellSaveType = ""; + public SnapshotRepository snapshotRepo = null; + public int maxRadius = -1; + public int maxSuperPickaxeSize = 5; + public int maxBrushRadius = 6; + public boolean logCommands = false; + public String logFile = ""; + public String logFormat = LogFormat.DEFAULT_FORMAT; + public boolean registerHelp = true; // what is the point of this, it's not even used + public String wandItem = "minecraft:wooden_axe"; + public boolean superPickaxeDrop = true; + public boolean superPickaxeManyDrop = true; + public boolean noDoubleSlash = false; + public boolean useInventory = false; + public boolean useInventoryOverride = false; + public boolean useInventoryCreativeOverride = false; + public boolean navigationUseGlass = true; + public String navigationWand = "minecraft:compass"; + public int navigationWandMaxDistance = 50; + public int scriptTimeout = 3000; + public int calculationTimeout = 100; + public Set allowedDataCycleBlocks = new HashSet<>(); + public String saveDir = "schematics"; + public String scriptsDir = "craftscripts"; + public boolean showHelpInfo = true; + public int butcherDefaultRadius = -1; + public int butcherMaxRadius = -1; + public boolean allowSymlinks = false; + public boolean serverSideCUI = true; + + protected String[] getDefaultDisallowedBlocks() { + List blockTypes = Lists.newArrayList( + BlockTypes.OAK_SAPLING, + BlockTypes.JUNGLE_SAPLING, + BlockTypes.DARK_OAK_SAPLING, + BlockTypes.SPRUCE_SAPLING, + BlockTypes.BIRCH_SAPLING, + BlockTypes.ACACIA_SAPLING, + BlockTypes.BLACK_BED, + BlockTypes.BLUE_BED, + BlockTypes.BROWN_BED, + BlockTypes.CYAN_BED, + BlockTypes.GRAY_BED, + BlockTypes.GREEN_BED, + BlockTypes.LIGHT_BLUE_BED, + BlockTypes.LIGHT_GRAY_BED, + BlockTypes.LIME_BED, + BlockTypes.MAGENTA_BED, + BlockTypes.ORANGE_BED, + BlockTypes.PINK_BED, + BlockTypes.PURPLE_BED, + BlockTypes.RED_BED, + BlockTypes.WHITE_BED, + BlockTypes.YELLOW_BED, + BlockTypes.POWERED_RAIL, + BlockTypes.DETECTOR_RAIL, + BlockTypes.GRASS, + BlockTypes.DEAD_BUSH, + BlockTypes.MOVING_PISTON, + BlockTypes.PISTON_HEAD, + BlockTypes.SUNFLOWER, + BlockTypes.ROSE_BUSH, + BlockTypes.DANDELION, + BlockTypes.POPPY, + BlockTypes.BROWN_MUSHROOM, + BlockTypes.RED_MUSHROOM, + BlockTypes.TNT, + BlockTypes.TORCH, + BlockTypes.FIRE, + BlockTypes.REDSTONE_WIRE, + BlockTypes.WHEAT, + BlockTypes.POTATOES, + BlockTypes.CARROTS, + BlockTypes.MELON_STEM, + BlockTypes.PUMPKIN_STEM, + BlockTypes.BEETROOTS, + BlockTypes.RAIL, + BlockTypes.LEVER, + BlockTypes.REDSTONE_TORCH, + BlockTypes.REDSTONE_WALL_TORCH, + BlockTypes.REPEATER, + BlockTypes.COMPARATOR, + BlockTypes.STONE_BUTTON, + BlockTypes.BIRCH_BUTTON, + BlockTypes.ACACIA_BUTTON, + BlockTypes.DARK_OAK_BUTTON, + BlockTypes.JUNGLE_BUTTON, + BlockTypes.OAK_BUTTON, + BlockTypes.SPRUCE_BUTTON, + BlockTypes.CACTUS, + BlockTypes.SUGAR_CANE, + // ores and stuff + BlockTypes.BEDROCK + ); + return blockTypes.stream().filter(Objects::nonNull).map(BlockType::getId).toArray(String[]::new); + } + + /** + * Load the configuration. + */ + public abstract void load(); + + /** + * Get the working directory to work from. + * + * @return a working directory + */ + public File getWorkingDirectory() { + return new File("."); + } + + public String convertLegacyItem(String legacy) { + String item = legacy; + try { + String[] splitter = item.split(":", 2); + int id = 0; + byte data = 0; + if (splitter.length == 1) { + id = Integer.parseInt(item); + } else { + id = Integer.parseInt(splitter[0]); + data = Byte.parseByte(splitter[1]); + } + item = LegacyMapper.getInstance().getItemFromLegacy(id, data).getId(); + } catch (Throwable e) { + } + + return item; + } + +} From a09489a9af837296929350913d9c2414502f1020 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 16 Feb 2019 20:51:39 +1000 Subject: [PATCH 118/182] Updated the adapters --- .../adapter/impl/Spigot_v1_13_R1$1.class | Bin 959 -> 959 bytes .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 26260 -> 25469 bytes .../adapter/impl/Spigot_v1_13_R2$1.class | Bin 959 -> 959 bytes .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 26252 -> 25491 bytes .../adapter/impl/Spigot_v1_13_R2_2$1.class | Bin 965 -> 965 bytes .../adapter/impl/Spigot_v1_13_R2_2.class | Bin 26318 -> 25557 bytes 6 files changed, 0 insertions(+), 0 deletions(-) diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class index 3e9eb5d6c2705eea72afefc0bba87bf6c9b9b94b..1be36a1548ae79e29a8f2658a12ac417d786ced7 100644 GIT binary patch delta 13 UcmdnbzMp+V4l|?ZAov2@wdW;D<`HgUV+w*s&s#_dj=&h`#sWx3hDnoH_M>&fM(E*ZHqq9Nu$s%QhnF zVhyo5g^x?~r%g$G!sfsDWE{8TI-|%|tQ3ZoHp=oTk9575RK`|56=#&~Q+}hII2ErF zWHM1ElWdi&;%t?oQl)8PtAI+gX})SIy>wdzRk)c=EmU)(TF7^X3}wn>OKGqnOSQ69 zYn5$Oj(q1z(?*)M(zNrdJe6;&0##^Jwkk5Jy-fwGgRMHMPDT~m)LuktsX9y3#i-M4 z)m3$qrn{`^VTV;n^^Buls+V8&R()*MSM?K4`rB%N8ferY8*_tYZiw_w7dk_2Y&yfJ zGi@56hRMiqAD?T~2%CnekvLP0^6_{dm&nv;Ip-{C&W__&YK%=&)z~<7jyhMGabao4 zOH(4v1ZmFmtBLA-znY{b`_&XxD$P`*ruk`tnr>8?pC+mcY&Ap8l#y9R%{FR|QFGS9}6qAvB*Y;~DYOGQ(c8+Cz zH8w3&*GhApt*(bcFn5DI4vSMas+;_@T1^%)ZVCCKH2Hv0t8Ka=%*TD|L3GqZ(lm$HsfR_jHGcJonrzggMy)k!ouBSd zk4d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&47JA9PYP22&?(~7$j9#y7HvaC#MI{5PX} zn=p!RWQ6|{)HAvm#sXK$tKrOsk}!!|!%1@8q7{uK&Wieso1wT(ZG)^*`irmw+&!X2 zK%RR)#|+AI@9cPitWdh(hc8}68pD4LEN&;m@jm<{Xc<4?#qVzPC;HO?0jtECVO<0l nyB@=+Y19o^d!xEZ-R!oWQd`y2ZmU++samw~OOaaj4^{g=_#5{+ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class index 9013c9a0b3e3abe766aeccb36ede23be9ad99957..fe6e8015a0812e54e0750abb1ba049e53a05a4cd 100644 GIT binary patch delta 13 UcmdnbzMp+V4l|?VGq3&M+r8Yjl_PI(c+0W1 z>xrm~HPGe^{#%-(Hl^}EHXq}<1kP1t6x&KE4YIO~^7xcjx<&?lwn|X8QHeg~7?qTu zl2wWfrpjQNt1bAZAJFs-NmFCmE0k+CZZQ+0;v& zA!CE3H$?ahl|`jS4YO&08ZMMGeLTvjvuqly&c>c zYKBlQF>0n!vy7T8+g)nZWk$`hX{stuCsJ40>S}dOBF$9S8g-qm!o@0V)b%#aR`cah z3yfMQ>u!+dMxz$l>LzuwO_!@%q*-jMTcHq)-6oI26V&bMjzn6fCW@GM%D`P>h`Xh^ zN1BK<_eyi0m~csgx?epYJ5{6;t4E;!N7YiJmf3VG|Ls$c;jSK+CKnESgIgjf&aypv2Y~jYgCO*;isklichT*uU&7`3gs7dziL#iP0yKKaM!juQ72FGoct@J8HkGJ%je5_hZ8oh_+ihB}b{O@(Q9Etg zpmy1`QH4J+>O-S;+q6l2WYcD~$Ec5u`oyNU)Lxsms85ahO#J9`o3^U6jrziUTG0#6XC8%Q(^L6NH zg6TC&qin6U1&OuCXu!jIZETgSeIob{2&xlAolDX>2!w3`4!~SK#!dejuKo6G;kzA<8=FU6I*BMfQa%NP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iyXwwsR1Xe5t9tTts+2dVvZinqH-jVRv+=teN88>M;w3Q|_ILIwaGCvKVE zvSrKkbQhZNs}I!eK&JMH9#HYiBbHxi;g1i|XhPWIrL06-em!T_a$9&fo=$tYjrvT= z3fUX8_%px;fdl@A5#taD##kgbu?TZk4QKzIQPpXTlA9ReFC#HV7eQGNo(k%?U1LF- z#_i!G`EFf}P8xTJ`iz^QxZ|sG)}Z?W&3zM(YEBLtEkO$07X^5v0{7(sN=Ajd0e;#O z$DQ!q4ob|E;bb3v?{qmo=*4e}^dbFqU%xfUnqplD7rO<+sHoJfSi4Hyrfzq88`KMG Squbl6wyF57vF>iQ_5T3m5=F=W diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2_2$1.class index bc7274567d2c0f3e07c1344aaccce3bcc8d6d9f6..686d09a33c7e1a3ac66ae427aec9fe24a348dd65 100644 GIT binary patch delta 13 UcmX@gew2Mf5i_IY@a8_exGuT zN={NKDpeZOq%qxA8Pb^PQ_XA&sDKn%wrZ}jr3l(8C!$)|G*7ieRpr_$PqnfsU*#KB zAn$-sT1#6SDKMa|YG#^#6!@)TpI4-O7LY)MI$7$EC=J0jeiNtS9~I z-)gc^PZ_n$sHgoDRm-J#(pJx?XKlJqJ!jPO(&>c^QtBnYTB&Mm^|E?JYB8hYHa#eP zYBNZymuz}mK2{l3Z&TzcslVz|tHo;9*z~jth`QGr)nL=}YF(0Aul{4yYqr`T*0w>c zZ3C>0R;Z1(dR@I?)Fzu^YO_&q+Efekf+F6MVv9|cYO7Ii8@0`*)oQy$>R2^14jL9 z)Gs!Dst(!_+NXXs>Nlf)w`srn!=^9PpGF<>QwltlzE%OF{xS-X@V#u$-!>(wBjWQ% zQPYI2*DQsywbm9S)*hn)4{NlsRf_hB;5#6wP7;ydg@oF+wO>0T@CVTUW}R&76b;bW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m`Gfai+YdRGKLRX#%t8JHH;K=<3-8DKq|bRce}T93U-DEw!1M9)Hnf<( z!j3hP)AV<{sA)`hayf;79{Pi7zNS^8m=rVRX$H? zX9ASEW7gN6($Xjw%9OVTIOs{Wptqk714jZh9*X=1>WITTg>Nx$zDD8MkB@)|mK4k1 z@%M;oxrGT9L>K&kUUclo#+08*>I978_X_5p4F8O`4L<{?B)`iWNgG~P%)j79`zy4E zKTZjDxcx6k3H7a}GaCy^!3w-~Idbe-oSVncqhy;VYcz=KnC`DJM58xyBMbgyTi}{is1XAzD(Nx(B8;A?2SXJ~$4l?6F}^oU-o3$DXhUy`vlu z-Uq{+6z1dzHy8GYy@5kAa5&5-+f2^i7_-`^>FL1C- z>sn5o80OY+*bSw8I>ID#+W&xQ$d=pQfaAbji0Hsp&L{h-LBHdtFaPvl$Gi`T1S-k|z4MNc185=U_ZwE#53z4BPWiDUT>yhQNfl}u024#SOGAWt9R zKLH`@@$@O;Qo!f!lTn7=eyoUskG#T&@;w3F2;_95WdENOY8Netfj38qTcxyW)hZ>$ zLn8c$1Z6sar~`rpRQ!;M Date: Sun, 17 Feb 2019 13:30:40 +1000 Subject: [PATCH 119/182] Update the block/item category registries - this won't build until a Spigot PR is merged though. --- .../worldedit/bukkit/WorldEditPlugin.java | 15 ++++ .../world/block/BlockCategories.java | 72 +++++++++---------- .../worldedit/world/item/ItemCategories.java | 68 ++++++++---------- .../worldedit/world/weather/WeatherTypes.java | 21 +++--- 4 files changed, 87 insertions(+), 89 deletions(-) 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 2a05d9c2d..6509db543 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 @@ -41,13 +41,17 @@ import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.FuzzyBlockState; import com.sk89q.worldedit.world.entity.EntityType; +import com.sk89q.worldedit.world.item.ItemCategory; import com.sk89q.worldedit.world.item.ItemType; import org.bstats.bukkit.Metrics; +import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.Tag; import org.bukkit.block.Biome; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -158,6 +162,17 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { for (org.bukkit.entity.EntityType entityType : org.bukkit.entity.EntityType.values()) { EntityType.REGISTRY.register("minecraft:" + entityType.name().toLowerCase(), new EntityType("minecraft:" + entityType.name().toLowerCase())); } + // Tags + try { + for (org.bukkit.Tag blockTag : Bukkit.getTags(Tag.REGISTRY_BLOCKS, Material.class)) { + BlockCategory.REGISTRY.register(blockTag.getKey().toString(), new BlockCategory(blockTag.getKey().toString())); + } + for (org.bukkit.Tag itemTag : Bukkit.getTags(Tag.REGISTRY_ITEMS, Material.class)) { + ItemCategory.REGISTRY.register(itemTag.getKey().toString(), new ItemCategory(itemTag.getKey().toString())); + } + } catch (NoSuchMethodError e) { + getLogger().warning("The version of Spigot/Paper you are using doesn't support Tags. The usage of tags with WorldEdit will not work until you update."); + } } private void loadConfig() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java index b9e08aab8..5d5304f5b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java @@ -26,50 +26,42 @@ import javax.annotation.Nullable; */ public final class BlockCategories { - public static final BlockCategory ACACIA_LOGS = register("minecraft:acacia_logs"); - public static final BlockCategory ANVIL = register("minecraft:anvil"); - public static final BlockCategory BANNERS = register("minecraft:banners"); - public static final BlockCategory BIRCH_LOGS = register("minecraft:birch_logs"); - public static final BlockCategory BUTTONS = register("minecraft:buttons"); - public static final BlockCategory CARPETS = register("minecraft:carpets"); - public static final BlockCategory CORALS = register("minecraft:corals"); - public static final BlockCategory CORAL_BLOCKS = register("minecraft:coral_blocks"); - public static final BlockCategory DARK_OAK_LOGS = register("minecraft:dark_oak_logs"); - public static final BlockCategory DOORS = register("minecraft:doors"); - public static final BlockCategory ENDERMAN_HOLDABLE = register("minecraft:enderman_holdable"); - public static final BlockCategory FLOWER_POTS = register("minecraft:flower_pots"); - public static final BlockCategory ICE = register("minecraft:ice"); - public static final BlockCategory JUNGLE_LOGS = register("minecraft:jungle_logs"); - public static final BlockCategory LEAVES = register("minecraft:leaves"); - public static final BlockCategory LOGS = register("minecraft:logs"); - public static final BlockCategory OAK_LOGS = register("minecraft:oak_logs"); - public static final BlockCategory PLANKS = register("minecraft:planks"); - public static final BlockCategory RAILS = register("minecraft:rails"); - public static final BlockCategory SAND = register("minecraft:sand"); - public static final BlockCategory SAPLINGS = register("minecraft:saplings"); - public static final BlockCategory SLABS = register("minecraft:slabs"); - public static final BlockCategory SPRUCE_LOGS = register("minecraft:spruce_logs"); - public static final BlockCategory STAIRS = register("minecraft:stairs"); - public static final BlockCategory STONE_BRICKS = register("minecraft:stone_bricks"); - public static final BlockCategory VALID_SPAWN = register("minecraft:valid_spawn"); - public static final BlockCategory WOODEN_BUTTONS = register("minecraft:wooden_buttons"); - public static final BlockCategory WOODEN_DOORS = register("minecraft:wooden_doors"); - public static final BlockCategory WOODEN_PRESSURE_PLATES = register("minecraft:wooden_pressure_plates"); - public static final BlockCategory WOODEN_SLABS = register("minecraft:wooden_slabs"); - public static final BlockCategory WOODEN_STAIRS = register("minecraft:wooden_stairs"); - public static final BlockCategory WOOL = register("minecraft:wool"); + public static final BlockCategory ACACIA_LOGS = get("minecraft:acacia_logs"); + public static final BlockCategory ANVIL = get("minecraft:anvil"); + public static final BlockCategory BANNERS = get("minecraft:banners"); + public static final BlockCategory BIRCH_LOGS = get("minecraft:birch_logs"); + public static final BlockCategory BUTTONS = get("minecraft:buttons"); + public static final BlockCategory CARPETS = get("minecraft:carpets"); + public static final BlockCategory CORALS = get("minecraft:corals"); + public static final BlockCategory CORAL_BLOCKS = get("minecraft:coral_blocks"); + public static final BlockCategory DARK_OAK_LOGS = get("minecraft:dark_oak_logs"); + public static final BlockCategory DOORS = get("minecraft:doors"); + public static final BlockCategory ENDERMAN_HOLDABLE = get("minecraft:enderman_holdable"); + public static final BlockCategory FLOWER_POTS = get("minecraft:flower_pots"); + public static final BlockCategory ICE = get("minecraft:ice"); + public static final BlockCategory JUNGLE_LOGS = get("minecraft:jungle_logs"); + public static final BlockCategory LEAVES = get("minecraft:leaves"); + public static final BlockCategory LOGS = get("minecraft:logs"); + public static final BlockCategory OAK_LOGS = get("minecraft:oak_logs"); + public static final BlockCategory PLANKS = get("minecraft:planks"); + public static final BlockCategory RAILS = get("minecraft:rails"); + public static final BlockCategory SAND = get("minecraft:sand"); + public static final BlockCategory SAPLINGS = get("minecraft:saplings"); + public static final BlockCategory SLABS = get("minecraft:slabs"); + public static final BlockCategory SPRUCE_LOGS = get("minecraft:spruce_logs"); + public static final BlockCategory STAIRS = get("minecraft:stairs"); + public static final BlockCategory STONE_BRICKS = get("minecraft:stone_bricks"); + public static final BlockCategory VALID_SPAWN = get("minecraft:valid_spawn"); + public static final BlockCategory WOODEN_BUTTONS = get("minecraft:wooden_buttons"); + public static final BlockCategory WOODEN_DOORS = get("minecraft:wooden_doors"); + public static final BlockCategory WOODEN_PRESSURE_PLATES = get("minecraft:wooden_pressure_plates"); + public static final BlockCategory WOODEN_SLABS = get("minecraft:wooden_slabs"); + public static final BlockCategory WOODEN_STAIRS = get("minecraft:wooden_stairs"); + public static final BlockCategory WOOL = get("minecraft:wool"); private BlockCategories() { } - private static BlockCategory register(final String id) { - return register(new BlockCategory(id)); - } - - public static BlockCategory register(final BlockCategory tag) { - return BlockCategory.REGISTRY.register(tag.getId(), tag); - } - public static @Nullable BlockCategory get(final String id) { return BlockCategory.REGISTRY.get(id); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java index 68f232d7b..460473d22 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java @@ -26,48 +26,40 @@ import javax.annotation.Nullable; */ public final class ItemCategories { - public static final ItemCategory ACACIA_LOGS = register("minecraft:acacia_logs"); - public static final ItemCategory ANVIL = register("minecraft:anvil"); - public static final ItemCategory BANNERS = register("minecraft:banners"); - public static final ItemCategory BIRCH_LOGS = register("minecraft:birch_logs"); - public static final ItemCategory BOATS = register("minecraft:boats"); - public static final ItemCategory BUTTONS = register("minecraft:buttons"); - public static final ItemCategory CARPETS = register("minecraft:carpets"); - public static final ItemCategory CORAL = register("minecraft:coral"); - public static final ItemCategory CORAL_PLANTS = register("minecraft:coral_plants"); - public static final ItemCategory DARK_OAK_LOGS = register("minecraft:dark_oak_logs"); - public static final ItemCategory DOORS = register("minecraft:doors"); - public static final ItemCategory FISHES = register("minecraft:fishes"); - public static final ItemCategory JUNGLE_LOGS = register("minecraft:jungle_logs"); - public static final ItemCategory LEAVES = register("minecraft:leaves"); - public static final ItemCategory LOGS = register("minecraft:logs"); - public static final ItemCategory OAK_LOGS = register("minecraft:oak_logs"); - public static final ItemCategory PLANKS = register("minecraft:planks"); - public static final ItemCategory RAILS = register("minecraft:rails"); - public static final ItemCategory SAND = register("minecraft:sand"); - public static final ItemCategory SAPLINGS = register("minecraft:saplings"); - public static final ItemCategory SLABS = register("minecraft:slabs"); - public static final ItemCategory SPRUCE_LOGS = register("minecraft:spruce_logs"); - public static final ItemCategory STAIRS = register("minecraft:stairs"); - public static final ItemCategory STONE_BRICKS = register("minecraft:stone_bricks"); - public static final ItemCategory WOODEN_BUTTONS = register("minecraft:wooden_buttons"); - public static final ItemCategory WOODEN_DOORS = register("minecraft:wooden_doors"); - public static final ItemCategory WOODEN_PRESSURE_PLATES = register("minecraft:wooden_pressure_plates"); - public static final ItemCategory WOODEN_SLABS = register("minecraft:wooden_slabs"); - public static final ItemCategory WOODEN_STAIRS = register("minecraft:wooden_stairs"); - public static final ItemCategory WOOL = register("minecraft:wool"); + public static final ItemCategory ACACIA_LOGS = get("minecraft:acacia_logs"); + public static final ItemCategory ANVIL = get("minecraft:anvil"); + public static final ItemCategory BANNERS = get("minecraft:banners"); + public static final ItemCategory BIRCH_LOGS = get("minecraft:birch_logs"); + public static final ItemCategory BOATS = get("minecraft:boats"); + public static final ItemCategory BUTTONS = get("minecraft:buttons"); + public static final ItemCategory CARPETS = get("minecraft:carpets"); + public static final ItemCategory CORAL = get("minecraft:coral"); + public static final ItemCategory CORAL_PLANTS = get("minecraft:coral_plants"); + public static final ItemCategory DARK_OAK_LOGS = get("minecraft:dark_oak_logs"); + public static final ItemCategory DOORS = get("minecraft:doors"); + public static final ItemCategory FISHES = get("minecraft:fishes"); + public static final ItemCategory JUNGLE_LOGS = get("minecraft:jungle_logs"); + public static final ItemCategory LEAVES = get("minecraft:leaves"); + public static final ItemCategory LOGS = get("minecraft:logs"); + public static final ItemCategory OAK_LOGS = get("minecraft:oak_logs"); + public static final ItemCategory PLANKS = get("minecraft:planks"); + public static final ItemCategory RAILS = get("minecraft:rails"); + public static final ItemCategory SAND = get("minecraft:sand"); + public static final ItemCategory SAPLINGS = get("minecraft:saplings"); + public static final ItemCategory SLABS = get("minecraft:slabs"); + public static final ItemCategory SPRUCE_LOGS = get("minecraft:spruce_logs"); + public static final ItemCategory STAIRS = get("minecraft:stairs"); + public static final ItemCategory STONE_BRICKS = get("minecraft:stone_bricks"); + public static final ItemCategory WOODEN_BUTTONS = get("minecraft:wooden_buttons"); + public static final ItemCategory WOODEN_DOORS = get("minecraft:wooden_doors"); + public static final ItemCategory WOODEN_PRESSURE_PLATES = get("minecraft:wooden_pressure_plates"); + public static final ItemCategory WOODEN_SLABS = get("minecraft:wooden_slabs"); + public static final ItemCategory WOODEN_STAIRS = get("minecraft:wooden_stairs"); + public static final ItemCategory WOOL = get("minecraft:wool"); private ItemCategories() { } - private static ItemCategory register(final String id) { - return register(new ItemCategory(id)); - } - - public static ItemCategory register(final ItemCategory tag) { - return ItemCategory.REGISTRY.register(tag.getId(), tag); - } - public static @Nullable ItemCategory get(final String id) { return ItemCategory.REGISTRY.get(id); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherTypes.java index 1aa1c9f12..d7450610d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherTypes.java @@ -23,21 +23,20 @@ import javax.annotation.Nullable; public class WeatherTypes { - public static final WeatherType CLEAR = register("clear"); - public static final WeatherType RAIN = register("rain"); - public static final WeatherType THUNDER_STORM = register("thunder_storm"); + static { + // This isn't really a proper registry - so inject these before they're obtained. + WeatherType.REGISTRY.register("clear", new WeatherType("clear")); + WeatherType.REGISTRY.register("rain", new WeatherType("rain")); + WeatherType.REGISTRY.register("thunder_storm", new WeatherType("thunder_storm")); + } + + @Nullable public static final WeatherType CLEAR = get("clear"); + @Nullable public static final WeatherType RAIN = get("rain"); + @Nullable public static final WeatherType THUNDER_STORM = get("thunder_storm"); private WeatherTypes() { } - private static WeatherType register(final String id) { - return register(new WeatherType(id)); - } - - public static WeatherType register(final WeatherType weatherType) { - return WeatherType.REGISTRY.register(weatherType.getId(), weatherType); - } - public static @Nullable WeatherType get(final String id) { return WeatherType.REGISTRY.get(id); } From 8984289695b9feb5615e29273746803f1649aa59 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 18 Feb 2019 20:56:21 +1000 Subject: [PATCH 120/182] Bump Spigot version so it compiles. --- worldedit-bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 050ee45f9..bd98623f8 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -12,7 +12,7 @@ repositories { dependencies { compile project(':worldedit-core') compile 'com.sk89q:dummypermscompat:1.8' - compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz + compile 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT' // zzz compile 'org.bstats:bstats-bukkit:1.4' compile "io.papermc:paperlib:1.0.1" compileOnly "net.milkbowl.vault:VaultAPI:1.7" From 5de8e0852c92aa9b870fb2ff1fd5705914511729 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 18 Feb 2019 21:17:36 +1000 Subject: [PATCH 121/182] Treat categories as empty when missing --- .../factory/parser/mask/BlockCategoryMaskParser.java | 3 +-- .../parser/pattern/BlockCategoryPatternParser.java | 4 +--- .../sk89q/worldedit/world/block/BlockCategories.java | 10 ++++++---- .../com/sk89q/worldedit/world/item/ItemCategories.java | 10 ++++++---- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java index 0ef1a1730..aceba782a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java @@ -27,7 +27,6 @@ import com.sk89q.worldedit.function.mask.BlockCategoryMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.session.request.Request; -import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockCategory; public class BlockCategoryMaskParser extends InputParser { @@ -45,7 +44,7 @@ public class BlockCategoryMaskParser extends InputParser { Extent extent = Request.request().getEditSession(); // This means it's a tag mask. - BlockCategory category = BlockCategories.get(input.substring(2).toLowerCase()); + BlockCategory category = BlockCategory.REGISTRY.get(input.substring(2).toLowerCase()); if (category == null) { throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\''); } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java index 5b08053b0..b2e9672f5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java @@ -26,9 +26,7 @@ import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockCategory; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import java.util.List; @@ -58,7 +56,7 @@ public class BlockCategoryPatternParser extends InputParser { anyState = true; } - BlockCategory category = BlockCategories.get(tag); + BlockCategory category = BlockCategory.REGISTRY.get(tag); if (category == null) { throw new InputParseException("Unknown block tag: " + tag); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java index 5d5304f5b..28c3385d5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.world.block; -import javax.annotation.Nullable; - /** * Stores a list of categories of Block Types. */ @@ -62,7 +60,11 @@ public final class BlockCategories { private BlockCategories() { } - public static @Nullable BlockCategory get(final String id) { - return BlockCategory.REGISTRY.get(id); + private static BlockCategory get(final String id) { + BlockCategory blockCategory = BlockCategory.REGISTRY.get(id); + if (blockCategory == null) { + return new BlockCategory(id); + } + return blockCategory; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java index 460473d22..021d6834c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.world.item; -import javax.annotation.Nullable; - /** * Stores a list of categories of Item Types. */ @@ -60,7 +58,11 @@ public final class ItemCategories { private ItemCategories() { } - public static @Nullable ItemCategory get(final String id) { - return ItemCategory.REGISTRY.get(id); + private static ItemCategory get(final String id) { + ItemCategory itemCategory = ItemCategory.REGISTRY.get(id); + if (itemCategory == null) { + return new ItemCategory(id); + } + return itemCategory; } } From e6d5ce81659fc82bb24b7c94b3586b1fc85c0e8d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 18 Nov 2018 17:47:43 +1000 Subject: [PATCH 122/182] Start work on Forge 1.13 --- gradle/wrapper/gradle-wrapper.jar | Bin 56177 -> 54413 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- worldedit-forge/build.gradle | 47 ++++++++++------------- 3 files changed, 22 insertions(+), 27 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 29953ea141f55e3b8fc691d31b5ca8816d89fa87..0d4a9516871afd710a9d84d89e31ba77745607bd 100644 GIT binary patch delta 47733 zcmZ6yV{oQT)HRxkZQ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DjGE0Xm)^L4jh_Qf!VbwLX};&ts^>GLQUgNo3nUH)=M2X?@Hb^R zc$??8Bph%NEbt79?+1W5`xy|raYrRZz$-LCmi?-bS)h)7HppJkML!SZ*&kOl!2vV? zIgdQU2e3sW3nByr6PW#XB7p?$4q=1*2j~GB#3h3T;QuUwXNrFb@KP@9A7}yr9ux~U zbvyyrxa@4&g$llXKZ5h`Isbx#;r;`=z~O^r2hjkh2#2;!V4JpBA_xewzu*IeKXCLQ zF|=2JTt29J5C=ptgbVs-Q~QI|06Oo&{tj@kaRf311jk<`NAdrZofvD@DCbpGzbXt|0)6jF~sr*$_7I}&F*ZO!I#C90Rn>bFDQij4|Fk1 z1o&UG%zwFS**}oL2mtVxSK+?|cqvQa5A=W5g|vXb{O|q(iF!-+r0R#l?Uo|2c{sCV`h2H_KKtMAp zkntG(yDckF%orKqADvwR@HJ8ew?ekRilJD8P|P_%Z)0eHzXVkOf>Le45I$H>l@sun zoZ(;4XD3i^JOHe2NCWssnGYX)lUaZ_N%t3Y?feJ2v`783$$v%az`+@Rfy%CbKt)I7 zKga!#BvCOKI0nyuA9tQN7^DF8OyC0kqXh&$-TZ&m_SNSP1e}BcDR^LmSSQf{|EQV# zljKAPZd`x2ZEoQIhsgndX@n?&yv#_AW863iY zV=e!8*XBX9vy|YZn}32YsR93lw84Q-bvyV3vH!K_9(+B7 z|AGL8e<0)>;y=6hS3u8SpiT)GBnSN*!~y*K9^`);mgqOoW;;2kX$}YQpFt4#KpFq4 zDYy>|G5=|K|NFrBmn$6veVUj1zXwMAJkC4cVNlt;**nEi5ZVG8;J=?1;12J Date: Sat, 15 Dec 2018 18:57:37 +1000 Subject: [PATCH 123/182] Further attempts --- build.gradle | 10 ++++------ worldedit-forge/build.gradle | 8 +------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 6b63f5caf..8bdb1a122 100644 --- a/build.gradle +++ b/build.gradle @@ -7,20 +7,19 @@ buildscript { configurations.all { resolutionStrategy { - force 'com.google.guava:guava:21.0' - force 'org.ow2.asm:asm:6.0_BETA' + force 'commons-io:commons-io:2.4' } } dependencies { classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' - classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.7.5' - classpath 'org.ajoberstar:gradle-git:1.7.2' + classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.8.1' } } plugins { id 'net.minecrell.licenser' version '0.4.1' apply false + id "org.ajoberstar.grgit" version "2.3.0" } println """ @@ -48,7 +47,7 @@ if (!project.hasProperty("artifactory_password")) ext.artifactory_password = "" if (!project.hasProperty("gitCommitHash") && !JavaVersion.current().isJava6()) { try { - def repo = org.ajoberstar.grgit.Grgit.open(dir: '.') + def repo = grgit.open() ext.gitCommitHash = repo.head().abbreviatedId } catch (Exception e) { println "Error getting commit hash: " + e.getMessage() @@ -100,7 +99,6 @@ subprojects { repositories { mavenCentral() - maven { url "http://repo.bukkit.org/content/groups/public" } maven { url "http://maven.sk89q.com/repo/" } maven { url "http://repo.maven.apache.org/maven2" } } diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 054bd138b..229f4447b 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -13,12 +13,6 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' -configurations.all { - resolutionStrategy { - force 'org.ow2.asm:asm:5.2' - } -} - def minecraftVersion = "1.13" def forgeVersion = "24.0.16-1.13-pre" @@ -34,7 +28,7 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 minecraft { - mappings channel: 'snapshot', version: '20181117' + mappings channel: 'snapshot', version: '20181215' // runDir = 'run' // replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java" From 7a08098b03749305830b8117f30f11d9e41cbc88 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 15 Dec 2018 22:13:13 +1000 Subject: [PATCH 124/182] Further work on Forge 1.13 compat. --- worldedit-forge/build.gradle | 32 ++++++------ .../worldedit/forge/ForgeBlockMaterial.java | 6 +-- .../forge/ForgeEntityProperties.java | 2 +- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 46 ++++++++++-------- .../forge/InternalPacketHandler.java | 11 +++-- .../com/sk89q/worldedit/forge/KeyHandler.java | 4 +- .../worldedit/forge/ThreadSafeCache.java | 3 +- .../worldedit/forge/TileEntityUtils.java | 6 +-- .../worldedit/forge/WECUIPacketHandler.java | 2 +- .../src/main/resources/META-INF/mods.toml | 30 ++++++++++++ worldedit-forge/src/main/resources/mcmod.info | 21 -------- .../src/main/resources/worldedit-icon.png | Bin 0 -> 5636 bytes 12 files changed, 89 insertions(+), 74 deletions(-) create mode 100644 worldedit-forge/src/main/resources/META-INF/mods.toml delete mode 100644 worldedit-forge/src/main/resources/mcmod.info create mode 100644 worldedit-forge/src/main/resources/worldedit-icon.png diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 229f4447b..3885ff369 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -2,7 +2,7 @@ buildscript { repositories { mavenLocal() mavenCentral() - maven { url = "http://files.minecraftforge.net/maven" } + maven { url = "https://files.minecraftforge.net/maven" } jcenter() } @@ -14,7 +14,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' def minecraftVersion = "1.13" -def forgeVersion = "24.0.16-1.13-pre" +def forgeVersion = "24.0.32-1.13-pre" dependencies { compile project(':worldedit-core') @@ -28,26 +28,28 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 minecraft { - mappings channel: 'snapshot', version: '20181215' -// runDir = 'run' - -// replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java" -// replace "%VERSION%", project.version + mappings channel: 'snapshot', version: '20180921-1.13' } project.archivesBaseName = "${project.archivesBaseName}-mc${minecraftVersion}" processResources { - from (sourceSets.main.resources.srcDirs) { - expand 'version': project.version, - 'mcVersion': minecraftVersion, - 'forgeVersion': forgeVersion, - 'internalVersion': project.internalVersion - include 'mcmod.info' + // this will ensure that this task is redone when the versions change. + inputs.property 'version', project.version + inputs.property 'mcversion', minecraftVersion + inputs.property 'internalVersion', internalVersion + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'META_INF/mods.toml' + + // replace version and mcversion + expand 'version':project.version, 'mcversion': minecraftVersion, 'internalVersion': internalVersion } - from (sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' + // copy everything else except the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'META_INF/mods.toml' } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockMaterial.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockMaterial.java index 9d98f39ef..5f15a683b 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockMaterial.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockMaterial.java @@ -63,12 +63,12 @@ public class ForgeBlockMaterial extends PassthroughBlockMaterial { @Override public boolean isFragileWhenPushed() { - return delegate.getMobilityFlag() == EnumPushReaction.DESTROY; + return delegate.getPushReaction() == EnumPushReaction.DESTROY; } @Override public boolean isUnpushable() { - return delegate.getMobilityFlag() == EnumPushReaction.BLOCK; + return delegate.getPushReaction() == EnumPushReaction.BLOCK; } @Override @@ -78,7 +78,7 @@ public class ForgeBlockMaterial extends PassthroughBlockMaterial { @Override public boolean isBurnable() { - return delegate.getCanBurn(); + return delegate.isFlammable(); } @Override diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityProperties.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityProperties.java index bf6a16ae2..6e07e18ad 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityProperties.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityProperties.java @@ -136,7 +136,7 @@ public class ForgeEntityProperties implements EntityProperties { @Override public boolean isTagged() { - return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomName(); + return entity.hasCustomName(); } @Override diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 5a5a217ad..9d182c32e 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -44,10 +44,10 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.CommandEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty; +import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; @@ -56,7 +56,8 @@ import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; import net.minecraftforge.fml.common.event.FMLServerStartedEvent; import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; import net.minecraftforge.fml.common.eventhandler.Event.Result; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext; +import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.File; @@ -64,16 +65,15 @@ import java.io.File; /** * The Forge implementation of WorldEdit. */ -@Mod(modid = ForgeWorldEdit.MOD_ID, name = "WorldEdit", version = "%VERSION%", acceptableRemoteVersions = "*") +@Mod(ForgeWorldEdit.MOD_ID) public class ForgeWorldEdit { - public static Logger logger; + private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "worldedit"; public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui"; private ForgePermissionsProvider provider; - @Instance(MOD_ID) public static ForgeWorldEdit inst; @SidedProxy(serverSide = "com.sk89q.worldedit.forge.CommonProxy", clientSide = "com.sk89q.worldedit.forge.ClientProxy") @@ -83,36 +83,42 @@ public class ForgeWorldEdit { private ForgeConfiguration config; private File workingDir; - @EventHandler + public ForgeWorldEdit() { + inst = this; + + FMLModLoadingContext.get().getModEventBus().addListener(this::preInit); + FMLModLoadingContext.get().getModEventBus().addListener(this::init); + FMLModLoadingContext.get().getModEventBus().addListener(this::postInit); + FMLModLoadingContext.get().getModEventBus().addListener(this::serverAboutToStart); + FMLModLoadingContext.get().getModEventBus().addListener(this::serverStopping); + FMLModLoadingContext.get().getModEventBus().addListener(this::serverStarted); + + MinecraftForge.EVENT_BUS.register(ThreadSafeCache.getInstance()); + MinecraftForge.EVENT_BUS.register(this); + } + public void preInit(FMLPreInitializationEvent event) { - logger = event.getModLog(); // Setup working directory workingDir = new File(event.getModConfigurationDirectory() + File.separator + "worldedit"); workingDir.mkdir(); config = new ForgeConfiguration(this); config.load(); - - MinecraftForge.EVENT_BUS.register(ThreadSafeCache.getInstance()); } - @EventHandler public void init(FMLInitializationEvent event) { - MinecraftForge.EVENT_BUS.register(this); WECUIPacketHandler.init(); InternalPacketHandler.init(); proxy.registerHandlers(); } - @EventHandler public void postInit(FMLPostInitializationEvent event) { - logger.info("WorldEdit for Forge (version " + getInternalVersion() + ") is loaded"); + LOGGER.info("WorldEdit for Forge (version " + getInternalVersion() + ") is loaded"); } - @EventHandler public void serverAboutToStart(FMLServerAboutToStartEvent event) { if (this.platform != null) { - logger.warn("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't"); + LOGGER.warn("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't"); WorldEdit.getInstance().getPlatformManager().unregister(platform); } @@ -141,14 +147,12 @@ public class ForgeWorldEdit { } } - @EventHandler public void serverStopping(FMLServerStoppingEvent event) { WorldEdit worldEdit = WorldEdit.getInstance(); worldEdit.getSessionManager().unload(); worldEdit.getPlatformManager().unregister(platform); } - @EventHandler public void serverStarted(FMLServerStartedEvent event) { WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); } @@ -183,11 +187,11 @@ public class ForgeWorldEdit { boolean isLeftDeny = event instanceof PlayerInteractEvent.LeftClickBlock && ((PlayerInteractEvent.LeftClickBlock) event) - .getUseItem() == Result.DENY; + .getUseItem() == Event.Result.DENY; boolean isRightDeny = event instanceof PlayerInteractEvent.RightClickBlock && ((PlayerInteractEvent.RightClickBlock) event) - .getUseItem() == Result.DENY; + .getUseItem() == Event.Result.DENY; if (isLeftDeny || isRightDeny || event.getEntity().world.isRemote) { return; } @@ -233,7 +237,7 @@ public class ForgeWorldEdit { if (item.getNbtData() != null) { forgeCompound = NBTConverter.toNative(item.getNbtData()); } - return new ItemStack(Item.getByNameOrId(item.getType().getId()), item.getAmount(), 0, forgeCompound); + return new ItemStack(Item.REGISTRY.get(new ResourceLocation(item.getType().getId())), item.getAmount(), 0, forgeCompound); } /** diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java index afac351ac..c81062121 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java @@ -20,18 +20,19 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.forge.net.LeftClickAirEventMessage; -import net.minecraftforge.fml.common.network.NetworkRegistry; -import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import net.minecraftforge.fml.relauncher.Side; +import javafx.geometry.Side; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.network.NetworkRegistry; +import net.minecraftforge.fml.network.simple.SimpleChannel; import java.nio.charset.Charset; public class InternalPacketHandler { public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); - public static SimpleNetworkWrapper CHANNEL; + public static SimpleChannel CHANNEL; public static void init() { - CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(ForgeWorldEdit.MOD_ID); + CHANNEL = NetworkRegistry.newSimpleChannel(new ResourceLocation(ForgeWorldEdit.MOD_ID, "worldedit"), () -> "1", check -> true, check -> true); CHANNEL.registerMessage(LeftClickAirEventMessage.Handler.class, LeftClickAirEventMessage.class, 0, Side.SERVER); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java index 76e726884..1395beb87 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java @@ -22,14 +22,14 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.forge.gui.GuiHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; import org.lwjgl.input.Keyboard; public class KeyHandler { - private static Minecraft mc = Minecraft.getMinecraft(); + private static Minecraft mc = Minecraft.getInstance(); private static KeyBinding mainKey = new KeyBinding("WorldEdit Reference", Keyboard.KEY_L, "WorldEdit"); public KeyHandler() { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java index a52233564..91fdc3fcd 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java @@ -21,8 +21,7 @@ package com.sk89q.worldedit.forge; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import java.util.Collections; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java index 4147d835c..8a65feaf4 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java @@ -81,7 +81,7 @@ final class TileEntityUtils { if (tag != null) { // Set X, Y, Z updateForSet(tag, position); - tileEntity.readFromNBT(tag); + tileEntity.read(tag); } world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity); @@ -98,7 +98,7 @@ final class TileEntityUtils { static void setTileEntity(World world, BlockVector3 position, @Nullable NBTTagCompound tag) { if (tag != null) { updateForSet(tag, position); - TileEntity tileEntity = TileEntity.create(world, tag); + TileEntity tileEntity = TileEntity.create(tag); if (tileEntity != null) { world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity); } @@ -143,7 +143,7 @@ final class TileEntityUtils { public static NBTTagCompound copyNbtData(TileEntity tile) { NBTTagCompound tag = new NBTTagCompound(); - tile.writeToNBT(tag); + tile.write(tag); return tag; } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java index c6cf673e4..276eadcc6 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java @@ -25,7 +25,7 @@ import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; import net.minecraft.network.ThreadQuickExitException; import net.minecraft.network.play.server.SPacketCustomPayload; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.network.FMLEventChannel; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; diff --git a/worldedit-forge/src/main/resources/META-INF/mods.toml b/worldedit-forge/src/main/resources/META-INF/mods.toml new file mode 100644 index 000000000..7a8a52407 --- /dev/null +++ b/worldedit-forge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,30 @@ +# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml +modLoader="javafml" +# A version range to match for said mod loader - for regular FML @Mod it will be the minecraft version (without the 1.) +loaderVersion="[13,)" +# A URL to refer people to when problems occur with this mod +issueTrackerURL="https://discord.gg/YKbmj7V" +# A URL for the "homepage" for this mod, displayed in the mod UI +displayURL="http://wiki.sk89q.com/wiki/WorldEdit/" +# A file name (in the root of the mod JAR) containing a logo for display +logoFile="worldedit-icon.png" +# A text field displayed in the mod UI +authors="sk89q, wizjany, TomyLobo, kenzierocks, Me4502" +# A list of mods - how many allowed here is determined by the individual mod loader +[[worldedit]] +# The modid of the mod +modId="worldedit" +# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it +version="${internalVersion}" + # A display name for the mod +displayName="WorldEdit" +# The description text for the mod (multi line!) +description=''' +WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single player and multiplayer. +''' +[[dependencies.sponge]] + modId="sponge" + mandatory=false + versionRange="[1.13]" + ordering="NONE" + side="BOTH" \ No newline at end of file diff --git a/worldedit-forge/src/main/resources/mcmod.info b/worldedit-forge/src/main/resources/mcmod.info deleted file mode 100644 index bcee1cd4a..000000000 --- a/worldedit-forge/src/main/resources/mcmod.info +++ /dev/null @@ -1,21 +0,0 @@ -[{ - "modid": "worldedit", - "name": "WorldEdit", - "description": "WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single player and multiplayer.", - "version": "${internalVersion}", - "mcversion": "${mcVersion}", - "url": "http://wiki.sk89q.com/wiki/WorldEdit", - "updateUrl": "", - "authors": [ "sk89q", "wizjany", "TomyLobo", "kenzierocks", "Me4502" ], - "credits": "", - "logoFile": "", - "screenshots": [], - "requiredMods": [ - "Forge@[${forgeVersion},)" - ], - "dependencies": [ - "Forge@[${forgeVersion},)", - "sponge" - ], - "dependants": [] -}] diff --git a/worldedit-forge/src/main/resources/worldedit-icon.png b/worldedit-forge/src/main/resources/worldedit-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..dc269dcf7b17ffb3d5b4ba950c2dda74a3b5c26b GIT binary patch literal 5636 zcmV+f7W?UmP)3LSnB__s;iHVxjB^FVQ(UfOILyRbTLPRu*MnpA= zz;UXFQ4mp1Jz}CRiAg9mR!a3wtBj{9qnfB-1O?fDv+V3l_xHVY&wS0R?yqO3cNSo# z+|PQ|-K=?+We4X@XyYK&%M9^1Mtwp8I1He-VXkP#jo@_;c z-${boY{U=7XDqN#-++JzpU3@d_YU%;z?U{O;3!J^hD)?kAWp^-Ck&qDR8NjTfQtcW z5dhrei31HZM5DnNaMf9Tj`|e>Ocnqj&=+JW|5+OVF3dUV=LFEyNI>jHgVFD(RThFJ zu&fz~Y}u$J=m`aybW(3o{(MZ6bsBn?qZ+akWl*Yb^cU4C;ln7Yw$=tuuq^tTe`X6M>;%oo zIUWpzZ1C12!|>0;gES%r;|W1t(p*JyLVJ_-!+JJfqV64dvE;zB0(}_lGX!c)fry|M ztw|R6f+dheNz;1^vaTJysC%CQ+DvKVBuJkVJ9DfggzR6a49HQQPbm(|r;GwA_&&pt zzL~NxWTJQ=G7Jp;2P`}j3u#k9mVCnKhUbp^v= z7?>~(L{&&(%r$FH*{AdrwWA*e!e+{cfv90%<%dtC&nX0j!Nfz-niichYba8k*jsk= zqb92${h&{-4Z(=`2BI<~3J?&oO$xyygoTib2x(vKk!){NdVj4V%M z`7LJ{IY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ky?#uXqd`;3nv5SEM(k7sS`Tt%Ri5u6cF1O~)zgkx%xF|DrH=fyr_ z^vj949DFYjpx@vfWWoh6g9z=n7#$cBPO5NK&zu18ZmB+ulMSEovD6R~%Br-5rzn5{ z#SL-Bwy(7f);Ps59yVZ%0x|qWClP&1DGy4}RTBA9Vyc3Lp;cN+2L4!X#k6;hnyktR z$?r*mhlxn=GA`7oyyg+BG(Z3a*W5b=l(5n_sv#^E!XpCU0tKK{c=@mv3SApJS#t`6 zwWGwstn`g)NMa~>msGS(0o@M-%{mhpPC{xFrimhB2{KXbmA+9REWc0$IYM|0h%!D7 zp*tQcG&{3)7;F02OpO8=nXDHCXG?&GfCz(}3O8nB$ekOSQ40ECC&Cy70s?U@5lxT) zw~-HpgFt@H5f~cIdR}^Lj!~yRGAMTdz-$RXQZJ(PMS+&!nmgis7&|}C7}XFK1h`EA ze54etM4;x-N-hnD09+!vLkRpa01PsKQ6RfSY{Ulz!gGU)W-EXbkl+A~WTS7Qi0F13 e@il_R8-E89rZjGhc4GJd0000 Date: Wed, 26 Dec 2018 22:46:18 +1000 Subject: [PATCH 125/182] Fixed a lot of the errors, still more to go. Gotta switch to Forge registries once they exist. --- worldedit-forge/build.gradle | 4 +- .../sk89q/worldedit/forge/ForgeAdapter.java | 26 +++---- .../worldedit/forge/ForgeBiomeRegistry.java | 2 +- .../worldedit/forge/ForgeBlockRegistry.java | 6 +- .../sk89q/worldedit/forge/ForgeEntity.java | 4 +- .../sk89q/worldedit/forge/ForgePlayer.java | 13 ++-- .../com/sk89q/worldedit/forge/ForgeWorld.java | 67 +++++++++---------- .../worldedit/forge/IPropertyAdapter.java | 5 +- .../sk89q/worldedit/forge/NBTConverter.java | 14 ++-- 9 files changed, 68 insertions(+), 73 deletions(-) diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 3885ff369..9b033cab8 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -14,7 +14,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' def minecraftVersion = "1.13" -def forgeVersion = "24.0.32-1.13-pre" +def forgeVersion = "24.0.44-1.13-pre" dependencies { compile project(':worldedit-core') @@ -29,6 +29,8 @@ targetCompatibility = 1.8 minecraft { mappings channel: 'snapshot', version: '20180921-1.13' + + accessTransformer = file('worldedit_at.cfg') } project.archivesBaseName = "${project.archivesBaseName}-mc${minecraftVersion}" diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index f28e35a0b..a3523ddb6 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -33,12 +33,12 @@ import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.properties.PropertyInteger; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import net.minecraft.state.DirectionProperty; +import net.minecraft.state.IProperty; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.biome.Biome; @@ -105,20 +105,20 @@ final class ForgeAdapter { } public static Property adaptProperty(IProperty property) { - if (property instanceof PropertyBool) { - return new BooleanProperty(property.getName(), ImmutableList.copyOf(((PropertyBool) property).getAllowedValues())); + if (property instanceof net.minecraft.state.BooleanProperty) { + return new BooleanProperty(property.getName(), ImmutableList.copyOf(((net.minecraft.state.BooleanProperty) property).getAllowedValues())); } - if (property instanceof PropertyInteger) { - return new IntegerProperty(property.getName(), ImmutableList.copyOf(((PropertyInteger) property).getAllowedValues())); + if (property instanceof net.minecraft.state.IntegerProperty) { + return new IntegerProperty(property.getName(), ImmutableList.copyOf(((net.minecraft.state.IntegerProperty) property).getAllowedValues())); } - if (property instanceof PropertyDirection) { - return new DirectionalProperty(property.getName(), ((PropertyDirection) property).getAllowedValues().stream() + if (property instanceof DirectionProperty) { + return new DirectionalProperty(property.getName(), ((DirectionProperty) property).getAllowedValues().stream() .map(ForgeAdapter::adaptEnumFacing) .collect(Collectors.toList())); } - if (property instanceof PropertyEnum) { - return new EnumProperty(property.getName(), ((PropertyEnum) property).getAllowedValues().stream() - .map(e -> e.getName()) + if (property instanceof net.minecraft.state.EnumProperty) { + return new EnumProperty(property.getName(), ((net.minecraft.state.EnumProperty) property).getAllowedValues().stream() + .map(IStringSerializable::getName) .collect(Collectors.toList())); } return new IPropertyAdapter<>(property); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java index 986a3afc2..cbe2102c9 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java @@ -52,7 +52,7 @@ class ForgeBiomeRegistry implements BiomeRegistry { @Override public String getName() { - return biome.getBiomeName(); + return biome.getDisplayName().getString(); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java index ddf3762bb..f77dc2304 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java @@ -26,7 +26,7 @@ import com.sk89q.worldedit.world.registry.BundledBlockRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; +import net.minecraft.state.IProperty; import net.minecraft.util.ResourceLocation; import java.util.Collection; @@ -43,7 +43,7 @@ public class ForgeBlockRegistry extends BundledBlockRegistry { @Nullable @Override public String getName(BlockType blockType) { - return Block.REGISTRY.getObject(new ResourceLocation(blockType.getId())).getLocalizedName(); + return Block.REGISTRY.get(new ResourceLocation(blockType.getId())).getNameTextComponent().getFormattedText(); } @Override @@ -57,7 +57,7 @@ public class ForgeBlockRegistry extends BundledBlockRegistry { Map> map = new TreeMap<>(); Collection> propertyKeys = Block.getBlockFromName(blockType.getId()) .getDefaultState() - .getPropertyKeys(); + .getProperties(); for (IProperty key : propertyKeys) { map.put(key.getName(), ForgeAdapter.adaptProperty(key)); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java index e4b391fe0..1c428e0c1 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java @@ -52,7 +52,7 @@ class ForgeEntity implements Entity { String id = EntityList.getEntityString(entity); if (id != null) { NBTTagCompound tag = new NBTTagCompound(); - entity.writeToNBT(tag); + entity.writeWithoutTypeId(tag); return new BaseEntity(EntityTypes.get(id), NBTConverter.fromNative(tag)); } else { return null; @@ -96,7 +96,7 @@ class ForgeEntity implements Entity { public boolean remove() { net.minecraft.entity.Entity entity = entityRef.get(); if (entity != null) { - entity.setDead(); + entity.remove(); } return true; } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index a20abd100..65705004c 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -41,10 +41,10 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.server.SPacketCustomPayload; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.common.registry.ForgeRegistries; import java.util.UUID; @@ -69,12 +69,12 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public BaseItemStack getItemInHand(HandSide handSide) { ItemStack is = this.player.getHeldItem(handSide == HandSide.MAIN_HAND ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND); - return new BaseItemStack(ItemTypes.get(ForgeRegistries.ITEMS.getKey(is.getItem()).toString())); + return new BaseItemStack(ItemTypes.get(Item.REGISTRY.getKey(is.getItem()).toString())); } @Override public String getName() { - return this.player.getName(); + return this.player.getName().getFormattedText(); } @Override @@ -105,8 +105,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public void giveItem(BaseItemStack itemStack) { - this.player.inventory.addItemStackToInventory( - new ItemStack(Item.getByNameOrId(itemStack.getType().getId()), itemStack.getAmount(), 0)); + this.player.inventory.addItemStackToInventory(new ItemStack(Item.REGISTRY.get(new ResourceLocation(itemStack.getType().getId())), itemStack.getAmount(), null)); } @Override @@ -117,7 +116,7 @@ public class ForgePlayer extends AbstractPlayerActor { send = send + "|" + StringUtil.joinString(params, "|"); } PacketBuffer buffer = new PacketBuffer(Unpooled.copiedBuffer(send.getBytes(WECUIPacketHandler.UTF_8_CHARSET))); - SPacketCustomPayload packet = new SPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, buffer); + SPacketCustomPayload packet = new SPacketCustomPayload(new ResourceLocation(ForgeWorldEdit.CUI_PLUGIN_CHANNEL), buffer); this.player.connection.sendPacket(packet); } @@ -197,7 +196,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public SessionKey getSessionKey() { - return new SessionKeyImpl(player.getUniqueID(), player.getName()); + return new SessionKeyImpl(player.getUniqueID(), player.getName().getString()); } private static class SessionKeyImpl implements SessionKey { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index 09fcc4241..13205b726 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -51,15 +51,7 @@ import com.sk89q.worldedit.world.weather.WeatherType; import com.sk89q.worldedit.world.weather.WeatherTypes; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; -import net.minecraft.block.BlockOldLeaf; -import net.minecraft.block.BlockOldLog; -import net.minecraft.block.BlockPlanks; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityList; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; @@ -67,6 +59,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; +import net.minecraft.state.DirectionProperty; +import net.minecraft.state.EnumProperty; +import net.minecraft.state.IProperty; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; @@ -77,6 +72,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.biome.Biome; +import net.minecraft.world.chunk.BlockStateContainer; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.storage.AnvilSaveHandler; @@ -116,9 +112,9 @@ public class ForgeWorld extends AbstractWorld { private static final Random random = new Random(); private static final int UPDATE = 1, NOTIFY = 2; - private static final IBlockState JUNGLE_LOG = Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); - private static final IBlockState JUNGLE_LEAF = Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); - private static final IBlockState JUNGLE_SHRUB = Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final IBlockState JUNGLE_LOG = Blocks.JUNGLE_LOG.getDefaultState(); + private static final IBlockState JUNGLE_LEAF = Blocks.JUNGLE_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, Boolean.TRUE); + private static final IBlockState JUNGLE_SHRUB = Blocks.OAK_LEAVES.getDefaultState().with(BlockLeaves.PERSISTENT, Boolean.TRUE); private final WeakReference worldRef; @@ -178,7 +174,7 @@ public class ForgeWorld extends AbstractWorld { int z = position.getBlockZ(); // First set the block - Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4); + Chunk chunk = world.getChunk(x >> 4, z >> 4); BlockPos pos = new BlockPos(x, y, z); IBlockState old = chunk.getBlockState(pos); Block mcBlock = Block.getBlockFromName(block.getBlockType().getId()); @@ -224,17 +220,17 @@ public class ForgeWorld extends AbstractWorld { IProperty property = stateContainer.getProperty(state.getKey().getName()); Comparable value = (Comparable) state.getValue(); // we may need to adapt this value, depending on the source prop - if (property instanceof PropertyDirection) { + if (property instanceof DirectionProperty) { Direction dir = (Direction) value; value = ForgeAdapter.adapt(dir); - } else if (property instanceof PropertyEnum) { + } else if (property instanceof EnumProperty) { String enumName = (String) value; - value = ((PropertyEnum) property).parseValue((String) value).or(() -> { + value = ((EnumProperty) property).parseValue((String) value).orElseGet(() -> { throw new IllegalStateException("Enum property " + property.getName() + " does not contain " + enumName); }); } - newState = newState.withProperty(property, value); + newState = newState.with(property, value); } return newState; } @@ -271,7 +267,7 @@ public class ForgeWorld extends AbstractWorld { checkNotNull(position); checkNotNull(biome); - Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())); + Chunk chunk = getWorld().getChunk(new BlockPos(position.getBlockX(), 0, position.getBlockZ())); if (chunk.isLoaded()) { chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) Biome.getIdForBiome(ForgeAdapter.adapt(biome)); return true; @@ -282,12 +278,12 @@ public class ForgeWorld extends AbstractWorld { @Override public boolean useItem(BlockVector3 position, BaseItem item, Direction face) { - Item nativeItem = Item.getByNameOrId(item.getType().getId()); + Item nativeItem = Item.REGISTRY.get(new ResourceLocation(item.getType().getId())); ItemStack stack = null; if (item.getNbtData() == null) { - stack = new ItemStack(nativeItem, 1, 0); + stack = new ItemStack(nativeItem, 1); } else { - stack = new ItemStack(nativeItem, 1, 0, NBTConverter.toNative(item.getNbtData())); + stack = new ItemStack(nativeItem, 1, NBTConverter.toNative(item.getNbtData())); } World world = getWorld(); EnumActionResult used = stack.onItemUse(new WorldEditFakePlayer((WorldServer) world), world, ForgeAdapter.toBlockPos(position), @@ -333,16 +329,15 @@ public class ForgeWorld extends AbstractWorld { WorldServer originalWorld = (WorldServer) getWorld(); MinecraftServer server = originalWorld.getMinecraftServer(); - AnvilSaveHandler saveHandler = new AnvilSaveHandler(saveFolder, - originalWorld.getSaveHandler().getWorldDirectory().getName(), true, server.getDataFixer()); + AnvilSaveHandler saveHandler = new AnvilSaveHandler(saveFolder, originalWorld.getSaveHandler().getWorldDirectory().getName(), true, server.getDataFixer()); World freshWorld = new WorldServer(server, saveHandler, originalWorld.getWorldInfo(), - originalWorld.provider.getDimension(), originalWorld.profiler).init(); + originalWorld.dimension.getId(), originalWorld.profiler).init(); // Pre-gen all the chunks // We need to also pull one more chunk in every direction CuboidRegion expandedPreGen = new CuboidRegion(region.getMinimumPoint().subtract(16, 0, 16), region.getMaximumPoint().add(16, 0, 16)); for (BlockVector2 chunk : expandedPreGen.getChunks()) { - freshWorld.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ()); + freshWorld.getChunk(chunk.getBlockX(), chunk.getBlockZ()); } ForgeWorld from = new ForgeWorld(freshWorld); @@ -354,8 +349,8 @@ public class ForgeWorld extends AbstractWorld { throw new RuntimeException(e); } finally { saveFolder.delete(); - DimensionManager.setWorld(originalWorld.provider.getDimension(), null, server); - DimensionManager.setWorld(originalWorld.provider.getDimension(), originalWorld, server); + DimensionManager.setWorld(originalWorld.dimension.getId(), null, server); + DimensionManager.setWorld(originalWorld.dimension.getId(), originalWorld, server); } return true; @@ -396,7 +391,7 @@ public class ForgeWorld extends AbstractWorld { @Override public void checkLoadedChunk(BlockVector3 pt) { - getWorld().getChunkFromBlockCoords(ForgeAdapter.toBlockPos(pt)); + getWorld().getChunk(ForgeAdapter.toBlockPos(pt)); } @Override @@ -408,7 +403,7 @@ public class ForgeWorld extends AbstractWorld { public void fixLighting(Iterable chunks) { World world = getWorld(); for (BlockVector2 chunk : chunks) { - world.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ()).resetRelightChecks(); + world.getChunk(chunk.getBlockX(), chunk.getBlockZ()).resetRelightChecks(); } } @@ -439,7 +434,7 @@ public class ForgeWorld extends AbstractWorld { if (info.isRaining()) { return info.getRainTime(); } - return info.getCleanWeatherTime(); + return info.getClearWeatherTime(); } @Override @@ -451,17 +446,17 @@ public class ForgeWorld extends AbstractWorld { public void setWeather(WeatherType weatherType, long duration) { WorldInfo info = getWorld().getWorldInfo(); if (WeatherTypes.THUNDER_STORM.equals(weatherType)) { - info.setCleanWeatherTime(0); + info.setClearWeatherTime(0); info.setThundering(true); info.setThunderTime((int) duration); } else if (WeatherTypes.RAIN.equals(weatherType)) { - info.setCleanWeatherTime(0); + info.setClearWeatherTime(0); info.setRaining(true); info.setRainTime((int) duration); } else if (WeatherTypes.CLEAR.equals(weatherType)) { info.setRaining(false); info.setThundering(false); - info.setCleanWeatherTime((int) duration); + info.setClearWeatherTime((int) duration); } } @@ -476,7 +471,7 @@ public class ForgeWorld extends AbstractWorld { BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); IBlockState mcState = world.getBlockState(pos); - BlockType blockType = BlockType.REGISTRY.get(Block.REGISTRY.getNameForObject(mcState.getBlock()).toString()); + BlockType blockType = BlockType.REGISTRY.get(Block.REGISTRY.getKey(mcState.getBlock()).toString()); return blockType.getState(adaptProperties(blockType, mcState.getProperties())); } @@ -484,9 +479,9 @@ public class ForgeWorld extends AbstractWorld { Map, Object> props = new TreeMap<>(Comparator.comparing(Property::getName)); for (Map.Entry, Comparable> prop : mcProps.entrySet()) { Object value = prop.getValue(); - if (prop.getKey() instanceof PropertyDirection) { + if (prop.getKey() instanceof DirectionProperty) { value = ForgeAdapter.adaptEnumFacing((EnumFacing) value); - } else if (prop.getKey() instanceof PropertyEnum) { + } else if (prop.getKey() instanceof EnumProperty) { value = ((IStringSerializable) value).getName(); } props.put(block.getProperty(prop.getKey().getName()), value); @@ -559,7 +554,7 @@ public class ForgeWorld extends AbstractWorld { for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { tag.removeTag(name); } - createdEntity.readFromNBT(tag); + createdEntity.read(tag); } createdEntity.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/IPropertyAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/IPropertyAdapter.java index 0ac900a55..e024f6e93 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/IPropertyAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/IPropertyAdapter.java @@ -21,13 +21,12 @@ package com.sk89q.worldedit.forge; import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.registry.state.Property; - -import net.minecraft.block.properties.IProperty; +import net.minecraft.state.IProperty; import java.util.List; +import java.util.Optional; class IPropertyAdapter> implements Property { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java index 0992d3d4f..f05fbef47 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java @@ -32,7 +32,7 @@ import com.sk89q.jnbt.LongTag; import com.sk89q.jnbt.ShortTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; -import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.INBTBase; import net.minecraft.nbt.NBTTagByte; import net.minecraft.nbt.NBTTagByteArray; import net.minecraft.nbt.NBTTagCompound; @@ -62,7 +62,7 @@ final class NBTConverter { private NBTConverter() { } - public static NBTBase toNative(Tag tag) { + public static INBTBase toNative(Tag tag) { if (tag instanceof IntArrayTag) { return toNative((IntArrayTag) tag); @@ -111,7 +111,7 @@ final class NBTConverter { if (child instanceof EndTag) { continue; } - list.appendTag(toNative(child)); + list.add(toNative(child)); } return list; } @@ -157,7 +157,7 @@ final class NBTConverter { return new NBTTagDouble(tag.getValue()); } - public static Tag fromNative(NBTBase other) { + public static Tag fromNative(INBTBase other) { if (other instanceof NBTTagIntArray) { return fromNative((NBTTagIntArray) other); @@ -207,9 +207,9 @@ final class NBTConverter { other = other.copy(); List list = new ArrayList<>(); Class listClass = StringTag.class; - int tags = other.tagCount(); + int tags = other.size(); for (int i = 0; i < tags; i++) { - Tag child = fromNative(other.removeTag(0)); + Tag child = fromNative(other.remove(0)); list.add(child); listClass = child.getClass(); } @@ -242,7 +242,7 @@ final class NBTConverter { } public static CompoundTag fromNative(NBTTagCompound other) { - Set tags = other.getKeySet(); + Set tags = other.keySet(); Map map = new HashMap<>(); for (String tagName : tags) { map.put(tagName, fromNative(other.getTag(tagName))); From 9fccfdfaeb34ab68bb50a70c416ddd3adbadf99f Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 29 Dec 2018 16:04:36 +1000 Subject: [PATCH 126/182] Further work on 1.13 --- worldedit-forge/build.gradle | 2 +- .../sk89q/worldedit/forge/CommonProxy.java | 2 +- .../sk89q/worldedit/forge/ForgeAdapter.java | 40 ++++++ .../worldedit/forge/ForgeBiomeRegistry.java | 2 +- .../worldedit/forge/ForgeBlockRegistry.java | 18 ++- .../sk89q/worldedit/forge/ForgeEntity.java | 3 +- .../forge/ForgePermissionsProvider.java | 3 +- .../sk89q/worldedit/forge/ForgePlatform.java | 4 +- .../sk89q/worldedit/forge/ForgePlayer.java | 4 +- .../com/sk89q/worldedit/forge/ForgeWorld.java | 124 ++++++++++-------- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 29 ++-- .../com/sk89q/worldedit/forge/KeyHandler.java | 4 +- .../worldedit/forge/ThreadSafeCache.java | 3 +- .../worldedit/forge/gui/GuiReferenceCard.java | 4 +- 14 files changed, 144 insertions(+), 98 deletions(-) diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 9b033cab8..42a242d65 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -14,7 +14,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' def minecraftVersion = "1.13" -def forgeVersion = "24.0.44-1.13-pre" +def forgeVersion = "24.0.45-1.13-pre" dependencies { compile project(':worldedit-core') diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java index 18a7de68f..9f60936c0 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.forge.gui.GuiHandler; -import net.minecraftforge.fml.common.network.NetworkRegistry; +import net.minecraftforge.fml.network.NetworkRegistry; public class CommonProxy { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index a3523ddb6..ef05edfaa 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -20,6 +20,8 @@ package com.sk89q.worldedit.forge; import com.google.common.collect.ImmutableList; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.registry.state.BooleanProperty; @@ -35,13 +37,23 @@ import com.sk89q.worldedit.world.biome.BiomeTypes; import net.minecraft.block.properties.IProperty; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.state.DirectionProperty; import net.minecraft.state.IProperty; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.biome.Biome; +import net.minecraftforge.registries.ForgeRegistries; import java.util.stream.Collectors; @@ -124,4 +136,32 @@ final class ForgeAdapter { return new IPropertyAdapter<>(property); } + public static Block adapt(BlockType blockType) { + return ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockType.getId())); + } + + public static BlockType adapt(Block block) { + return BlockTypes.get(ForgeRegistries.BLOCKS.getKey(block).toString()); + } + + public static Item adapt(ItemType itemType) { + return ForgeRegistries.ITEMS.getValue(new ResourceLocation(itemType.getId())); + } + + public static ItemType adapt(Item item) { + return ItemTypes.get(ForgeRegistries.ITEMS.getKey(item).toString()); + } + + public static ItemStack adapt(BaseItemStack baseItemStack) { + NBTTagCompound forgeCompound = null; + if (baseItemStack.getNbtData() != null) { + forgeCompound = NBTConverter.toNative(baseItemStack.getNbtData()); + } + return new ItemStack(adapt(baseItemStack.getType()), baseItemStack.getAmount(), forgeCompound); + } + + public static BaseItemStack adapt(ItemStack itemStack) { + CompoundTag tag = NBTConverter.fromNative(itemStack.serializeNBT()); + return new BaseItemStack(adapt(itemStack.getItem()), tag, itemStack.getCount()); + } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java index cbe2102c9..b38a625ab 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java @@ -23,13 +23,13 @@ import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.registry.BiomeRegistry; import net.minecraft.world.biome.Biome; +import net.minecraftforge.registries.ForgeRegistries; /** * Provides access to biome data in Forge. */ class ForgeBiomeRegistry implements BiomeRegistry { - @Override public BiomeData getData(BiomeType biome) { return new ForgeBiomeData(ForgeAdapter.adapt(biome)); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java index f77dc2304..91c0b4cc8 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBlockRegistry.java @@ -23,11 +23,9 @@ import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.world.registry.BundledBlockRegistry; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.state.IProperty; -import net.minecraft.util.ResourceLocation; import java.util.Collection; import java.util.HashMap; @@ -43,19 +41,29 @@ public class ForgeBlockRegistry extends BundledBlockRegistry { @Nullable @Override public String getName(BlockType blockType) { - return Block.REGISTRY.get(new ResourceLocation(blockType.getId())).getNameTextComponent().getFormattedText(); + Block block = ForgeAdapter.adapt(blockType); + if (block != null) { + return block.getNameTextComponent().getFormattedText(); + } else { + return super.getName(blockType); + } } @Override public BlockMaterial getMaterial(BlockType blockType) { - return materialMap.computeIfAbsent(Block.getBlockFromName(blockType.getId()).getDefaultState().getMaterial(), + Block block = ForgeAdapter.adapt(blockType); + if (block == null) { + return super.getMaterial(blockType); + } + return materialMap.computeIfAbsent(block.getDefaultState().getMaterial(), m -> new ForgeBlockMaterial(m, super.getMaterial(blockType))); } @Override public Map> getProperties(BlockType blockType) { + Block block = ForgeAdapter.adapt(blockType); Map> map = new TreeMap<>(); - Collection> propertyKeys = Block.getBlockFromName(blockType.getId()) + Collection> propertyKeys = block .getDefaultState() .getProperties(); for (IProperty key : propertyKeys) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java index 1c428e0c1..595effbe3 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java @@ -29,7 +29,6 @@ import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.NullWorld; import com.sk89q.worldedit.world.entity.EntityTypes; -import net.minecraft.entity.EntityList; import net.minecraft.nbt.NBTTagCompound; import java.lang.ref.WeakReference; @@ -49,7 +48,7 @@ class ForgeEntity implements Entity { public BaseEntity getState() { net.minecraft.entity.Entity entity = entityRef.get(); if (entity != null) { - String id = EntityList.getEntityString(entity); + String id = entity.getType().getRegistryName().toString(); if (id != null) { NBTTagCompound tag = new NBTTagCompound(); entity.writeWithoutTypeId(tag); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java index bc6820c0d..7fe30a943 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java @@ -23,6 +23,7 @@ import net.minecraft.command.ICommand; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.GameType; import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.server.ServerLifecycleHooks; import org.spongepowered.api.entity.living.player.Player; public interface ForgePermissionsProvider { @@ -43,7 +44,7 @@ public interface ForgePermissionsProvider { public boolean hasPermission(EntityPlayerMP player, String permission) { ForgeConfiguration configuration = platform.getConfiguration(); return configuration.cheatMode || - FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile()) || + ServerLifecycleHooks.getCurrentServer().getPlayerList().canSendCommands(player.getGameProfile()) || (configuration.creativeEnable && player.interactionManager.getGameType() == GameType.CREATIVE); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java index 2eb66bf14..543285447 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java @@ -37,7 +37,7 @@ import net.minecraft.server.management.PlayerList; import net.minecraft.util.ResourceLocation; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.server.ServerLifecycleHooks; import java.util.ArrayList; import java.util.Collection; @@ -55,7 +55,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { ForgePlatform(ForgeWorldEdit mod) { this.mod = mod; - this.server = FMLCommonHandler.instance().getMinecraftServerInstance(); + this.server = ServerLifecycleHooks.getCurrentServer(); } boolean isHookingEvents() { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index 65705004c..c36e06471 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -69,7 +69,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public BaseItemStack getItemInHand(HandSide handSide) { ItemStack is = this.player.getHeldItem(handSide == HandSide.MAIN_HAND ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND); - return new BaseItemStack(ItemTypes.get(Item.REGISTRY.getKey(is.getItem()).toString())); + return ForgeAdapter.adapt(is); } @Override @@ -105,7 +105,7 @@ public class ForgePlayer extends AbstractPlayerActor { @Override public void giveItem(BaseItemStack itemStack) { - this.player.inventory.addItemStackToInventory(new ItemStack(Item.REGISTRY.get(new ResourceLocation(itemStack.getType().getId())), itemStack.getAmount(), null)); + this.player.inventory.addItemStackToInventory(ForgeAdapter.adapt(itemStack)); } @Override diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index 13205b726..991db00f0 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -52,44 +52,48 @@ import com.sk89q.worldedit.world.weather.WeatherTypes; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityType; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUseContext; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.state.DirectionProperty; import net.minecraft.state.EnumProperty; import net.minecraft.state.IProperty; +import net.minecraft.state.StateContainer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.biome.Biome; -import net.minecraft.world.chunk.BlockStateContainer; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.storage.AnvilSaveHandler; import net.minecraft.world.gen.ChunkProviderServer; -import net.minecraft.world.gen.feature.WorldGenBigMushroom; -import net.minecraft.world.gen.feature.WorldGenBigTree; -import net.minecraft.world.gen.feature.WorldGenBirchTree; -import net.minecraft.world.gen.feature.WorldGenCanopyTree; -import net.minecraft.world.gen.feature.WorldGenMegaJungle; -import net.minecraft.world.gen.feature.WorldGenMegaPineTree; -import net.minecraft.world.gen.feature.WorldGenSavannaTree; -import net.minecraft.world.gen.feature.WorldGenShrub; -import net.minecraft.world.gen.feature.WorldGenSwamp; -import net.minecraft.world.gen.feature.WorldGenTaiga1; -import net.minecraft.world.gen.feature.WorldGenTaiga2; -import net.minecraft.world.gen.feature.WorldGenTrees; -import net.minecraft.world.gen.feature.WorldGenerator; +import net.minecraft.world.gen.feature.BigBrownMushroomFeature; +import net.minecraft.world.gen.feature.BigRedMushroomFeature; +import net.minecraft.world.gen.feature.BigTreeFeature; +import net.minecraft.world.gen.feature.BirchTreeFeature; +import net.minecraft.world.gen.feature.CanopyTreeFeature; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.JungleTreeFeature; +import net.minecraft.world.gen.feature.MegaJungleFeature; +import net.minecraft.world.gen.feature.MegaPineTree; +import net.minecraft.world.gen.feature.NoFeatureConfig; +import net.minecraft.world.gen.feature.PointyTaigaTreeFeature; +import net.minecraft.world.gen.feature.SavannaTreeFeature; +import net.minecraft.world.gen.feature.ShrubFeature; +import net.minecraft.world.gen.feature.SwampTreeFeature; +import net.minecraft.world.gen.feature.TallTaigaTreeFeature; +import net.minecraft.world.gen.feature.TreeFeature; import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.common.DimensionManager; @@ -101,6 +105,7 @@ import java.util.List; import java.util.Map; import java.util.Random; import java.util.TreeMap; +import java.util.concurrent.ThreadLocalRandom; import javax.annotation.Nullable; @@ -180,8 +185,8 @@ public class ForgeWorld extends AbstractWorld { Block mcBlock = Block.getBlockFromName(block.getBlockType().getId()); IBlockState newState = mcBlock.getDefaultState(); Map, Object> states = block.getStates(); - newState = applyProperties(mcBlock.getBlockState(), newState, states); - IBlockState successState = chunk.setBlockState(pos, newState); + newState = applyProperties(mcBlock.getStateContainer(), newState, states); + IBlockState successState = chunk.setBlockState(pos, newState, false); boolean successful = successState != null; // Create the TileEntity @@ -212,12 +217,9 @@ public class ForgeWorld extends AbstractWorld { return false; } - // Can't get the "Object" to be right for withProperty w/o this - @SuppressWarnings({ "rawtypes", "unchecked" }) - private IBlockState applyProperties(BlockStateContainer stateContainer, IBlockState newState, Map, Object> states) { + private IBlockState applyProperties(StateContainer stateContainer, IBlockState newState, Map, Object> states) { for (Map.Entry, Object> state : states.entrySet()) { - - IProperty property = stateContainer.getProperty(state.getKey().getName()); + IProperty property = stateContainer.getProperty(state.getKey().getName()); Comparable value = (Comparable) state.getValue(); // we may need to adapt this value, depending on the source prop if (property instanceof DirectionProperty) { @@ -259,7 +261,7 @@ public class ForgeWorld extends AbstractWorld { @Override public BiomeType getBiome(BlockVector2 position) { checkNotNull(position); - return ForgeAdapter.adapt(getWorld().getBiomeForCoordsBody(new BlockPos(position.getBlockX(), 0, position.getBlockZ()))); + return ForgeAdapter.adapt(getWorld().getBiomeBody(new BlockPos(position.getBlockX(), 0, position.getBlockZ()))); } @Override @@ -269,7 +271,7 @@ public class ForgeWorld extends AbstractWorld { Chunk chunk = getWorld().getChunk(new BlockPos(position.getBlockX(), 0, position.getBlockZ())); if (chunk.isLoaded()) { - chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) Biome.getIdForBiome(ForgeAdapter.adapt(biome)); + chunk.getBiomes()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = ForgeAdapter.adapt(biome); return true; } @@ -278,16 +280,24 @@ public class ForgeWorld extends AbstractWorld { @Override public boolean useItem(BlockVector3 position, BaseItem item, Direction face) { - Item nativeItem = Item.REGISTRY.get(new ResourceLocation(item.getType().getId())); - ItemStack stack = null; + Item nativeItem = ForgeAdapter.adapt(item.getType()); + ItemStack stack; if (item.getNbtData() == null) { stack = new ItemStack(nativeItem, 1); } else { stack = new ItemStack(nativeItem, 1, NBTConverter.toNative(item.getNbtData())); } World world = getWorld(); - EnumActionResult used = stack.onItemUse(new WorldEditFakePlayer((WorldServer) world), world, ForgeAdapter.toBlockPos(position), - EnumHand.MAIN_HAND, ForgeAdapter.adapt(face), 0, 0, 0); + ItemUseContext itemUseContext = new ItemUseContext( + new WorldEditFakePlayer((WorldServer) world), + stack, + ForgeAdapter.toBlockPos(position), + ForgeAdapter.adapt(face), + 0f, + 0f, + 0f + ); + EnumActionResult used = stack.onItemUse(itemUseContext); return used != EnumActionResult.FAIL; } @@ -300,7 +310,7 @@ public class ForgeWorld extends AbstractWorld { return; } - EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeWorldEdit.toForgeItemStack(item)); + EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeAdapter.adapt(item)); entity.setPickupDelay(10); getWorld().spawnEntity(entity); } @@ -309,8 +319,8 @@ public class ForgeWorld extends AbstractWorld { public void simulateBlockMine(BlockVector3 position) { BlockPos pos = ForgeAdapter.toBlockPos(position); IBlockState state = getWorld().getBlockState(pos); - state.getBlock().dropBlockAsItem(getWorld(), pos, state, 0); - getWorld().setBlockToAir(pos); + state.dropBlockAsItem(getWorld(), pos, 0); + getWorld().removeBlock(pos); } @Override @@ -328,9 +338,9 @@ public class ForgeWorld extends AbstractWorld { WorldServer originalWorld = (WorldServer) getWorld(); - MinecraftServer server = originalWorld.getMinecraftServer(); - AnvilSaveHandler saveHandler = new AnvilSaveHandler(saveFolder, originalWorld.getSaveHandler().getWorldDirectory().getName(), true, server.getDataFixer()); - World freshWorld = new WorldServer(server, saveHandler, originalWorld.getWorldInfo(), + MinecraftServer server = originalWorld.getServer(); + AnvilSaveHandler saveHandler = new AnvilSaveHandler(saveFolder, originalWorld.getSaveHandler().getWorldDirectory().getName(), server, server.getDataFixer()); + World freshWorld = (World) new WorldServer(server, saveHandler, originalWorld.getWorldInfo(), originalWorld.dimension.getId(), originalWorld.profiler).init(); // Pre-gen all the chunks @@ -357,26 +367,26 @@ public class ForgeWorld extends AbstractWorld { } @Nullable - private static WorldGenerator createWorldGenerator(TreeType type) { + private static Feature createTreeFeatureGenerator(TreeType type) { switch (type) { - case TREE: return new WorldGenTrees(true); - case BIG_TREE: return new WorldGenBigTree(true); - case REDWOOD: return new WorldGenTaiga2(true); - case TALL_REDWOOD: return new WorldGenTaiga1(); - case BIRCH: return new WorldGenBirchTree(true, false); - case JUNGLE: return new WorldGenMegaJungle(true, 10, 20, JUNGLE_LOG, JUNGLE_LEAF); - case SMALL_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, false); - case SHORT_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, true); - case JUNGLE_BUSH: return new WorldGenShrub(JUNGLE_LOG, JUNGLE_SHRUB); - case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.BROWN_MUSHROOM_BLOCK); - case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.RED_MUSHROOM_BLOCK); - case SWAMP: return new WorldGenSwamp(); - case ACACIA: return new WorldGenSavannaTree(true); - case DARK_OAK: return new WorldGenCanopyTree(true); - case MEGA_REDWOOD: return new WorldGenMegaPineTree(false, random.nextBoolean()); - case TALL_BIRCH: return new WorldGenBirchTree(true, true); - case RANDOM: + case TREE: return new TreeFeature(true); + case BIG_TREE: return new BigTreeFeature(true); case PINE: + case REDWOOD: return new PointyTaigaTreeFeature(); + case TALL_REDWOOD: return new TallTaigaTreeFeature(true); + case BIRCH: return new BirchTreeFeature(true, false); + case JUNGLE: return new MegaJungleFeature(true, 10, 20, JUNGLE_LOG, JUNGLE_LEAF); + case SMALL_JUNGLE: return new JungleTreeFeature(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, false); + case SHORT_JUNGLE: return new JungleTreeFeature(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, true); + case JUNGLE_BUSH: return new ShrubFeature(JUNGLE_LOG, JUNGLE_SHRUB); + case RED_MUSHROOM: return new BigBrownMushroomFeature(); + case BROWN_MUSHROOM: return new BigRedMushroomFeature(); + case SWAMP: return new SwampTreeFeature(); + case ACACIA: return new SavannaTreeFeature(true); + case DARK_OAK: return new CanopyTreeFeature(true); + case MEGA_REDWOOD: return new MegaPineTree(false, random.nextBoolean()); + case TALL_BIRCH: return new BirchTreeFeature(true, true); + case RANDOM: return createTreeFeatureGenerator(TreeType.values()[ThreadLocalRandom.current().nextInt(TreeType.values().length)]); case RANDOM_REDWOOD: default: return null; @@ -385,8 +395,8 @@ public class ForgeWorld extends AbstractWorld { @Override public boolean generateTree(TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException { - WorldGenerator generator = createWorldGenerator(type); - return generator != null && generator.generate(getWorld(), random, ForgeAdapter.toBlockPos(position)); + Feature generator = createTreeFeatureGenerator(type); + return generator != null && generator.func_212245_a(getWorld(), getWorld().getChunkProvider().getChunkGenerator(), random, ForgeAdapter.toBlockPos(position), new NoFeatureConfig()); } @Override @@ -471,8 +481,8 @@ public class ForgeWorld extends AbstractWorld { BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); IBlockState mcState = world.getBlockState(pos); - BlockType blockType = BlockType.REGISTRY.get(Block.REGISTRY.getKey(mcState.getBlock()).toString()); - return blockType.getState(adaptProperties(blockType, mcState.getProperties())); + BlockType blockType = ForgeAdapter.adapt(mcState.getBlock()); + return blockType.getState(adaptProperties(blockType, mcState.getValues())); } private Map, Object> adaptProperties(BlockType block, Map, Comparable> mcProps) { @@ -546,7 +556,7 @@ public class ForgeWorld extends AbstractWorld { @Override public Entity createEntity(Location location, BaseEntity entity) { World world = getWorld(); - net.minecraft.entity.Entity createdEntity = EntityList.createEntityByIDFromName(new ResourceLocation(entity.getType().getId()), world); + net.minecraft.entity.Entity createdEntity = EntityType.create(world, new ResourceLocation(entity.getType().getId())); if (createdEntity != null) { CompoundTag nativeTag = entity.getNbtData(); if (nativeTag != null) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 9d182c32e..3da93610e 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.Joiner; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.forge.net.LeftClickAirEventMessage; @@ -33,11 +32,7 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -46,17 +41,17 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; import net.minecraftforge.fml.common.event.FMLServerStartedEvent; import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; -import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext; +import net.minecraftforge.registries.ForgeRegistries; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -76,8 +71,7 @@ public class ForgeWorldEdit { public static ForgeWorldEdit inst; - @SidedProxy(serverSide = "com.sk89q.worldedit.forge.CommonProxy", clientSide = "com.sk89q.worldedit.forge.ClientProxy") - public static CommonProxy proxy; + public static CommonProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> CommonProxy::new); private ForgePlatform platform; private ForgeConfiguration config; @@ -126,20 +120,21 @@ public class ForgeWorldEdit { WorldEdit.getInstance().getPlatformManager().register(platform); - if (Loader.isModLoaded("sponge")) { + if (ModList.get().isLoaded("sponge")) { this.provider = new ForgePermissionsProvider.SpongePermissionsProvider(); } else { this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform); } - for (ResourceLocation name : Block.REGISTRY.getKeys()) { + // TODO Setup states + for (ResourceLocation name : ForgeRegistries.BLOCKS.getKeys()) { String nameStr = name.toString(); if (!BlockType.REGISTRY.keySet().contains(nameStr)) { BlockType.REGISTRY.register(nameStr, new BlockType(nameStr)); } } - for (ResourceLocation name : Item.REGISTRY.getKeys()) { + for (ResourceLocation name : ForgeRegistries.ITEMS.getKeys()) { String nameStr = name.toString(); if (!ItemType.REGISTRY.keySet().contains(nameStr)) { ItemType.REGISTRY.register(nameStr, new ItemType(nameStr)); @@ -232,14 +227,6 @@ public class ForgeWorldEdit { } } - public static ItemStack toForgeItemStack(BaseItemStack item) { - NBTTagCompound forgeCompound = null; - if (item.getNbtData() != null) { - forgeCompound = NBTConverter.toNative(item.getNbtData()); - } - return new ItemStack(Item.REGISTRY.get(new ResourceLocation(item.getType().getId())), item.getAmount(), 0, forgeCompound); - } - /** * Get the configuration. * diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java index 1395beb87..5cd7b7e80 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java @@ -25,12 +25,12 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; -import org.lwjgl.input.Keyboard; +import org.lwjgl.glfw.GLFW; public class KeyHandler { private static Minecraft mc = Minecraft.getInstance(); - private static KeyBinding mainKey = new KeyBinding("WorldEdit Reference", Keyboard.KEY_L, "WorldEdit"); + private static KeyBinding mainKey = new KeyBinding("WorldEdit Reference", GLFW.GLFW_KEY_L, "WorldEdit"); public KeyHandler() { ClientRegistry.registerKeyBinding(mainKey); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java index 91fdc3fcd..5f80516eb 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java @@ -23,6 +23,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.server.ServerLifecycleHooks; import java.util.Collections; import java.util.HashSet; @@ -56,7 +57,7 @@ public class ThreadSafeCache { if (now - lastRefresh > REFRESH_DELAY) { Set onlineIds = new HashSet<>(); - MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); + MinecraftServer server = ServerLifecycleHooks.getCurrentServer(); if (server == null || server.getPlayerList() == null) { return; } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java index a9e53d36d..f982b21df 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java @@ -37,14 +37,14 @@ public class GuiReferenceCard extends GuiScreen { } @Override - public void drawScreen(int mouseX, int mouseY, float par3) { + public void render(int mouseX, int mouseY, float par3) { int x = (this.width - this.backgroundWidth) / 2; int y = (this.height - this.backgroundHeight) / 2 - this.closeButton.height; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(new ResourceLocation(ForgeWorldEdit.MOD_ID, "textures/gui/reference.png")); this.drawTexturedModalRect(x, y, 0, 0, this.backgroundWidth, this.backgroundHeight); - super.drawScreen(mouseX, mouseY, par3); + super.render(mouseX, mouseY, par3); } @Override From c849f69ef418eedb32ca2a1d704a61c9839e1bd4 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 29 Dec 2018 16:42:02 +1000 Subject: [PATCH 127/182] Convert across the network handlers --- .../sk89q/worldedit/forge/ForgePlatform.java | 3 +- .../sk89q/worldedit/forge/ForgePlayer.java | 3 +- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 8 ++- .../worldedit/forge/WECUIPacketHandler.java | 72 ------------------- .../handler}/InternalPacketHandler.java | 23 +++--- .../forge/net/handler/WECUIPacketHandler.java | 72 +++++++++++++++++++ .../LeftClickAirEventMessage.java | 28 ++++---- 7 files changed, 104 insertions(+), 105 deletions(-) delete mode 100644 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java rename worldedit-forge/src/main/java/com/sk89q/worldedit/forge/{ => net/handler}/InternalPacketHandler.java (56%) create mode 100644 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java rename worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/{ => packet}/LeftClickAirEventMessage.java (53%) diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java index 543285447..5c2f1ab89 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java @@ -30,7 +30,6 @@ import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.registry.Registries; import net.minecraft.command.ServerCommandManager; -import net.minecraft.entity.EntityList; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.server.management.PlayerList; @@ -69,7 +68,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public boolean isValidMobType(String type) { - return EntityList.isRegistered(new ResourceLocation(type)); + return net.minecraftforge.registries.ForgeRegistries.ENTITIES.containsKey(new ResourceLocation(type)); } @Override diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index c36e06471..5b3b2ca84 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extent.inventory.BlockBag; +import com.sk89q.worldedit.forge.net.handler.WECUIPacketHandler; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; @@ -32,10 +33,8 @@ import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.item.ItemTypes; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.server.SPacketCustomPayload; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 3da93610e..cf3b99c37 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -26,7 +26,9 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.forge.net.LeftClickAirEventMessage; +import com.sk89q.worldedit.forge.net.handler.WECUIPacketHandler; +import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage; +import com.sk89q.worldedit.forge.net.handler.InternalPacketHandler; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; @@ -65,7 +67,7 @@ public class ForgeWorldEdit { private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "worldedit"; - public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui"; + public static final String CUI_PLUGIN_CHANNEL = "cui"; private ForgePermissionsProvider provider; @@ -176,7 +178,7 @@ public class ForgeWorldEdit { if (event.getWorld().isRemote && event instanceof LeftClickEmpty) { // catch LCE, pass it to server - InternalPacketHandler.CHANNEL.sendToServer(new LeftClickAirEventMessage()); + InternalPacketHandler.HANDLER.sendToServer(new LeftClickAirEventMessage()); return; } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java deleted file mode 100644 index 276eadcc6..000000000 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.forge; - -import com.sk89q.worldedit.LocalSession; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.NetHandlerPlayServer; -import net.minecraft.network.PacketBuffer; -import net.minecraft.network.ThreadQuickExitException; -import net.minecraft.network.play.server.SPacketCustomPayload; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.network.FMLEventChannel; -import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; -import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; -import net.minecraftforge.fml.common.network.NetworkRegistry; - -import java.nio.charset.Charset; - -public class WECUIPacketHandler { - public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); - public static FMLEventChannel WECUI_CHANNEL; - - public static void init() { - WECUI_CHANNEL = NetworkRegistry.INSTANCE.newEventDrivenChannel(ForgeWorldEdit.CUI_PLUGIN_CHANNEL); - WECUI_CHANNEL.register(new WECUIPacketHandler()); - } - - @SubscribeEvent - public void onPacketData(ServerCustomPacketEvent event) { - if (event.getPacket().channel().equals(ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) { - EntityPlayerMP player = getPlayerFromEvent(event); - LocalSession session = ForgeWorldEdit.inst.getSession(player); - - if (session.hasCUISupport()) { - return; - } - - String text = event.getPacket().payload().toString(UTF_8_CHARSET); - session.handleCUIInitializationMessage(text); - session.describeCUI(ForgeWorldEdit.inst.wrap(player)); - } - } - - @SubscribeEvent - public void callProcessPacket(ClientCustomPacketEvent event) { - try { - new SPacketCustomPayload(event.getPacket().channel(), new PacketBuffer(event.getPacket().payload())).processPacket(event.getHandler()); - } catch (ThreadQuickExitException suppress) { - } - } - - private static EntityPlayerMP getPlayerFromEvent(ServerCustomPacketEvent event) { - return ((NetHandlerPlayServer) event.getHandler()).player; - } -} \ No newline at end of file diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/InternalPacketHandler.java similarity index 56% rename from worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java rename to worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/InternalPacketHandler.java index c81062121..5af96dd61 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/InternalPacketHandler.java @@ -17,25 +17,26 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.forge; +package com.sk89q.worldedit.forge.net.handler; -import com.sk89q.worldedit.forge.net.LeftClickAirEventMessage; -import javafx.geometry.Side; +import com.sk89q.worldedit.forge.ForgeWorldEdit; +import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.network.NetworkRegistry; import net.minecraftforge.fml.network.simple.SimpleChannel; -import java.nio.charset.Charset; - public class InternalPacketHandler { - public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); - public static SimpleChannel CHANNEL; + private static final String PROTOCOL_VERSION = Integer.toString(1); + public static SimpleChannel HANDLER = NetworkRegistry.ChannelBuilder + .named(new ResourceLocation(ForgeWorldEdit.MOD_ID, "internal")) + .clientAcceptedVersions(PROTOCOL_VERSION::equals) + .serverAcceptedVersions(PROTOCOL_VERSION::equals) + .networkProtocolVersion(() -> PROTOCOL_VERSION) + .simpleChannel(); public static void init() { - CHANNEL = NetworkRegistry.newSimpleChannel(new ResourceLocation(ForgeWorldEdit.MOD_ID, "worldedit"), () -> "1", check -> true, check -> true); - CHANNEL.registerMessage(LeftClickAirEventMessage.Handler.class, LeftClickAirEventMessage.class, 0, Side.SERVER); - } + int disc = 0; - private InternalPacketHandler() { + HANDLER.registerMessage(disc++, LeftClickAirEventMessage.class, LeftClickAirEventMessage::encode, LeftClickAirEventMessage::decode, LeftClickAirEventMessage.Handler::handle); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java new file mode 100644 index 000000000..215e31526 --- /dev/null +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java @@ -0,0 +1,72 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.forge.net.handler; + +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.forge.ForgeWorldEdit; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.ThreadQuickExitException; +import net.minecraft.network.play.server.SPacketCustomPayload; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraftforge.fml.network.NetworkRegistry; +import net.minecraftforge.fml.network.event.EventNetworkChannel; + +import java.nio.charset.Charset; + +public class WECUIPacketHandler { + public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); + private static final String PROTOCOL_VERSION = Integer.toString(1); + public static EventNetworkChannel HANDLER = NetworkRegistry.ChannelBuilder + .named(new ResourceLocation(ForgeWorldEdit.MOD_ID, ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) + .clientAcceptedVersions(PROTOCOL_VERSION::equals) + .serverAcceptedVersions(PROTOCOL_VERSION::equals) + .networkProtocolVersion(() -> PROTOCOL_VERSION) + .eventNetworkChannel(); + + public static void init() { + HANDLER.addListener(WECUIPacketHandler::onPacketData); + HANDLER.addListener(WECUIPacketHandler::callProcessPacket); + } + + public static void onPacketData(NetworkEvent.ServerCustomPayloadEvent event) { + EntityPlayerMP player = event.getSource().get().getSender(); + LocalSession session = ForgeWorldEdit.inst.getSession(player); + + if (session.hasCUISupport()) { + return; + } + + String text = event.getPayload().toString(UTF_8_CHARSET); + session.handleCUIInitializationMessage(text); + session.describeCUI(ForgeWorldEdit.inst.wrap(player)); + } + + public static void callProcessPacket(NetworkEvent.ClientCustomPayloadEvent event) { + try { + new SPacketCustomPayload( + new ResourceLocation(ForgeWorldEdit.MOD_ID, ForgeWorldEdit.CUI_PLUGIN_CHANNEL), + event.getPayload() + ).processPacket(Minecraft.getInstance().player.connection); + } catch (ThreadQuickExitException suppress) { + } + } +} \ No newline at end of file diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/LeftClickAirEventMessage.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/packet/LeftClickAirEventMessage.java similarity index 53% rename from worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/LeftClickAirEventMessage.java rename to worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/packet/LeftClickAirEventMessage.java index 1e3b2b20e..9d983848c 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/LeftClickAirEventMessage.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/packet/LeftClickAirEventMessage.java @@ -17,34 +17,32 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.forge.net; +package com.sk89q.worldedit.forge.net.packet; import com.sk89q.worldedit.forge.ForgeWorldEdit; import io.netty.buffer.ByteBuf; +import net.minecraft.network.PacketBuffer; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.common.network.simpleimpl.IMessage; -import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; +import net.minecraftforge.fml.network.NetworkEvent; -public class LeftClickAirEventMessage implements IMessage { +import java.util.function.Supplier; - public static final class Handler implements IMessageHandler { +public class LeftClickAirEventMessage { - @Override - public IMessage onMessage(LeftClickAirEventMessage message, final MessageContext ctx) { - ctx.getServerHandler().player.mcServer.addScheduledTask( - () -> ForgeWorldEdit.inst.onPlayerInteract(new PlayerInteractEvent.LeftClickEmpty(ctx.getServerHandler().player))); - return null; + public static final class Handler { + + public static void handle(final LeftClickAirEventMessage message, Supplier ctx) { + NetworkEvent.Context context = ctx.get(); + context.enqueueWork(() -> ForgeWorldEdit.inst.onPlayerInteract(new PlayerInteractEvent.LeftClickEmpty(context.getSender()))); } } - @Override - public void fromBytes(ByteBuf buf) { + public static LeftClickAirEventMessage decode(ByteBuf buf) { + return new LeftClickAirEventMessage(); } - @Override - public void toBytes(ByteBuf buf) { + public static void encode(LeftClickAirEventMessage msg, PacketBuffer buf) { } } From e4ce51003e0f5550bc8dfc69ba6f3e0ea546fbf7 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 26 Jan 2019 21:50:42 +1000 Subject: [PATCH 128/182] Bump to latest Forge --- worldedit-forge/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 42a242d65..1fbeb6350 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -14,7 +14,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' def minecraftVersion = "1.13" -def forgeVersion = "24.0.45-1.13-pre" +def forgeVersion = "24.0.116-1.13-pre" dependencies { compile project(':worldedit-core') From d079f06c31287650872d5f475334901e48fafd27 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 28 Jan 2019 15:54:27 +1000 Subject: [PATCH 129/182] Make it actually load into an IDE on latest FG --- gradle.properties | 3 ++ worldedit-forge/build.gradle | 33 +++++++++++++++---- .../sk89q/worldedit/forge/ForgeEntity.java | 5 +-- 3 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 gradle.properties diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..e9b9fd5ac --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +# This is required to provide enough memory for the Minecraft decompilation process. +org.gradle.jvmargs=-Xmx3G diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 1fbeb6350..2f9b34717 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -14,7 +14,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' def minecraftVersion = "1.13" -def forgeVersion = "24.0.116-1.13-pre" +def forgeVersion = "24.0.136-1.13-pre" dependencies { compile project(':worldedit-core') @@ -30,6 +30,25 @@ targetCompatibility = 1.8 minecraft { mappings channel: 'snapshot', version: '20180921-1.13' + runs { + client = { + // recommended logging data for a userdev environment + properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' + // recommended logging level for the console + properties 'forge.logging.console.level': 'debug' + workingDirectory project.file('run').canonicalPath + source sourceSets.main + } + server = { + // recommended logging data for a userdev environment + properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP' + // recommended logging level for the console + properties 'forge.logging.console.level': 'debug' + workingDirectory project.file('run').canonicalPath + source sourceSets.main + } + } + accessTransformer = file('worldedit_at.cfg') } @@ -69,11 +88,13 @@ shadowJar { } } -//reobf { -// shadowJar { -// mappingType = 'SEARGE' -// } -//} +afterEvaluate { + reobf { + shadowJar { + mappings = createMcpToSrg.output + } + } +} task deobfJar(type: Jar) { from sourceSets.main.output diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java index 595effbe3..96e97cf29 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java @@ -30,6 +30,7 @@ import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.NullWorld; import com.sk89q.worldedit.world.entity.EntityTypes; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; import java.lang.ref.WeakReference; @@ -48,11 +49,11 @@ class ForgeEntity implements Entity { public BaseEntity getState() { net.minecraft.entity.Entity entity = entityRef.get(); if (entity != null) { - String id = entity.getType().getRegistryName().toString(); + ResourceLocation id = entity.getType().getRegistryName(); if (id != null) { NBTTagCompound tag = new NBTTagCompound(); entity.writeWithoutTypeId(tag); - return new BaseEntity(EntityTypes.get(id), NBTConverter.fromNative(tag)); + return new BaseEntity(EntityTypes.get(id.toString()), NBTConverter.fromNative(tag)); } else { return null; } From cf435fd63d2cb77a19b9cc67f40a31f504194883 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 16 Feb 2019 15:20:52 +1000 Subject: [PATCH 130/182] Bump to 1.13.2 --- worldedit-forge/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 2f9b34717..097173d49 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -13,13 +13,13 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' -def minecraftVersion = "1.13" -def forgeVersion = "24.0.136-1.13-pre" +def minecraftVersion = "1.13.2" +def forgeVersion = "25.0.13" dependencies { compile project(':worldedit-core') - minecraft "net.minecraftforge.test:forge:${minecraftVersion}-${forgeVersion}" + minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}" testCompile group: 'org.mockito', name: 'mockito-core', version: '1.9.0-rc1' } From de9798bf7e397b56d3c57a54e78bf0ea0399468e Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 16 Feb 2019 16:13:03 +1000 Subject: [PATCH 131/182] Further work on 1.13.2 WorldEdit for Forge. Forge still is missing too many features to finish this, and I need to work out how to port the command wrapper system over. --- gradle.properties | 1 + .../forge/ForgePermissionsProvider.java | 27 +++++++------ .../sk89q/worldedit/forge/ForgeWorldEdit.java | 38 ++++++++----------- 3 files changed, 29 insertions(+), 37 deletions(-) diff --git a/gradle.properties b/gradle.properties index e9b9fd5ac..878bf1f7e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx3G +org.gradle.daemon=false \ No newline at end of file diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java index 7fe30a943..8f9011268 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java @@ -22,9 +22,7 @@ package com.sk89q.worldedit.forge; import net.minecraft.command.ICommand; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.GameType; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.server.ServerLifecycleHooks; -import org.spongepowered.api.entity.living.player.Player; public interface ForgePermissionsProvider { @@ -52,16 +50,17 @@ public interface ForgePermissionsProvider { public void registerPermission(ICommand command, String permission) {} } - class SpongePermissionsProvider implements ForgePermissionsProvider { - - @Override - public boolean hasPermission(EntityPlayerMP player, String permission) { - return ((Player) player).hasPermission(permission); - } - - @Override - public void registerPermission(ICommand command, String permission) { - - } - } + // TODO Re-add when Sponge for 1.13 is out +// class SpongePermissionsProvider implements ForgePermissionsProvider { +// +// @Override +// public boolean hasPermission(EntityPlayerMP player, String permission) { +// return ((Player) player).hasPermission(permission); +// } +// +// @Override +// public void registerPermission(ICommand command, String permission) { +// +// } +// } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index cf3b99c37..f0dda4960 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -46,13 +46,11 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent; -import net.minecraftforge.fml.common.event.FMLServerStartedEvent; -import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; -import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; +import net.minecraftforge.fml.event.server.FMLServerStartedEvent; +import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.ForgeRegistries; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -82,33 +80,27 @@ public class ForgeWorldEdit { public ForgeWorldEdit() { inst = this; - FMLModLoadingContext.get().getModEventBus().addListener(this::preInit); - FMLModLoadingContext.get().getModEventBus().addListener(this::init); - FMLModLoadingContext.get().getModEventBus().addListener(this::postInit); - FMLModLoadingContext.get().getModEventBus().addListener(this::serverAboutToStart); - FMLModLoadingContext.get().getModEventBus().addListener(this::serverStopping); - FMLModLoadingContext.get().getModEventBus().addListener(this::serverStarted); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverAboutToStart); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverStopping); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverStarted); MinecraftForge.EVENT_BUS.register(ThreadSafeCache.getInstance()); MinecraftForge.EVENT_BUS.register(this); } - public void preInit(FMLPreInitializationEvent event) { + public void init(FMLCommonSetupEvent event) { // Setup working directory workingDir = new File(event.getModConfigurationDirectory() + File.separator + "worldedit"); workingDir.mkdir(); config = new ForgeConfiguration(this); config.load(); - } - public void init(FMLInitializationEvent event) { WECUIPacketHandler.init(); InternalPacketHandler.init(); proxy.registerHandlers(); - } - public void postInit(FMLPostInitializationEvent event) { LOGGER.info("WorldEdit for Forge (version " + getInternalVersion() + ") is loaded"); } @@ -122,11 +114,11 @@ public class ForgeWorldEdit { WorldEdit.getInstance().getPlatformManager().register(platform); - if (ModList.get().isLoaded("sponge")) { - this.provider = new ForgePermissionsProvider.SpongePermissionsProvider(); - } else { - this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform); - } +// TODO if (ModList.get().isLoaded("sponge")) { +// this.provider = new ForgePermissionsProvider.SpongePermissionsProvider(); +// } else { + this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform); +// } // TODO Setup states for (ResourceLocation name : ForgeRegistries.BLOCKS.getKeys()) { From 7faafa1635cc95e7ec0b10689f06102b6a1bd06b Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Mon, 18 Feb 2019 21:03:03 -0800 Subject: [PATCH 132/182] Update mappings and forge, correct toml keys --- worldedit-forge/build.gradle | 4 ++-- .../src/main/resources/META-INF/mods.toml | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 097173d49..faaa4931c 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -14,7 +14,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' def minecraftVersion = "1.13.2" -def forgeVersion = "25.0.13" +def forgeVersion = "25.0.34" dependencies { compile project(':worldedit-core') @@ -28,7 +28,7 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 minecraft { - mappings channel: 'snapshot', version: '20180921-1.13' + mappings channel: 'snapshot', version: '20190217-1.13.1' runs { client = { diff --git a/worldedit-forge/src/main/resources/META-INF/mods.toml b/worldedit-forge/src/main/resources/META-INF/mods.toml index 7a8a52407..9bb66bea4 100644 --- a/worldedit-forge/src/main/resources/META-INF/mods.toml +++ b/worldedit-forge/src/main/resources/META-INF/mods.toml @@ -1,7 +1,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" # A version range to match for said mod loader - for regular FML @Mod it will be the minecraft version (without the 1.) -loaderVersion="[13,)" +loaderVersion="[24,)" # A URL to refer people to when problems occur with this mod issueTrackerURL="https://discord.gg/YKbmj7V" # A URL for the "homepage" for this mod, displayed in the mod UI @@ -11,7 +11,7 @@ logoFile="worldedit-icon.png" # A text field displayed in the mod UI authors="sk89q, wizjany, TomyLobo, kenzierocks, Me4502" # A list of mods - how many allowed here is determined by the individual mod loader -[[worldedit]] +[[mods]] # The modid of the mod modId="worldedit" # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it @@ -20,11 +20,17 @@ version="${internalVersion}" displayName="WorldEdit" # The description text for the mod (multi line!) description=''' -WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single player and multiplayer. +WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single- and multi-player. ''' -[[dependencies.sponge]] +[[dependencies.worldedit]] + modId="minecraft" + mandatory=true + versionRange="[1.13.2]" + ordering="NONE" + side="SERVER" +[[dependencies.worldedit]] modId="sponge" mandatory=false versionRange="[1.13]" - ordering="NONE" - side="BOTH" \ No newline at end of file + ordering="BEFORE" + side="SERVER" \ No newline at end of file From 29b6c84230ad35a1d1aa60ed573c4141d25efb4d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 19 Feb 2019 20:30:52 +1000 Subject: [PATCH 133/182] Rebase and properly setup the registries --- .../sk89q/worldedit/forge/ForgeAdapter.java | 58 +++++++++++-- .../worldedit/forge/ForgeBiomeRegistry.java | 1 - .../com/sk89q/worldedit/forge/ForgeWorld.java | 82 ++++--------------- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 42 ++++++---- .../sk89q/worldedit/forge/NBTConverter.java | 4 +- .../worldedit/forge/TileEntityUtils.java | 6 +- 6 files changed, 101 insertions(+), 92 deletions(-) diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index ef05edfaa..58aba645c 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -31,22 +31,21 @@ import com.sk89q.worldedit.registry.state.IntegerProperty; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.World; - import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; -import net.minecraft.block.properties.IProperty; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.state.DirectionProperty; import net.minecraft.state.IProperty; +import net.minecraft.state.StateContainer; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.ResourceLocation; @@ -55,6 +54,9 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.biome.Biome; import net.minecraftforge.registries.ForgeRegistries; +import java.util.Comparator; +import java.util.Map; +import java.util.TreeMap; import java.util.stream.Collectors; final class ForgeAdapter { @@ -67,7 +69,7 @@ final class ForgeAdapter { } public static Biome adapt(BiomeType biomeType) { - return Biome.REGISTRY.getObject(new ResourceLocation(biomeType.getId())); + return ForgeRegistries.BIOMES.getValue(new ResourceLocation(biomeType.getId())); } public static BiomeType adapt(Biome biome) { @@ -136,6 +138,52 @@ final class ForgeAdapter { return new IPropertyAdapter<>(property); } + public static Map, Object> adaptProperties(BlockType block, Map, Comparable> mcProps) { + Map, Object> props = new TreeMap<>(Comparator.comparing(Property::getName)); + for (Map.Entry, Comparable> prop : mcProps.entrySet()) { + Object value = prop.getValue(); + if (prop.getKey() instanceof DirectionProperty) { + value = adaptEnumFacing((EnumFacing) value); + } else if (prop.getKey() instanceof net.minecraft.state.EnumProperty) { + value = ((IStringSerializable) value).getName(); + } + props.put(block.getProperty(prop.getKey().getName()), value); + } + return props; + } + + private static IBlockState applyProperties(StateContainer stateContainer, IBlockState newState, Map, Object> states) { + for (Map.Entry, Object> state : states.entrySet()) { + IProperty property = stateContainer.getProperty(state.getKey().getName()); + Comparable value = (Comparable) state.getValue(); + // we may need to adapt this value, depending on the source prop + if (property instanceof DirectionProperty) { + Direction dir = (Direction) value; + value = ForgeAdapter.adapt(dir); + } else if (property instanceof net.minecraft.state.EnumProperty) { + String enumName = (String) value; + value = ((net.minecraft.state.EnumProperty) property).parseValue((String) value).orElseGet(() -> { + throw new IllegalStateException("Enum property " + property.getName() + " does not contain " + enumName); + }); + } + + newState = newState.with(property, value); + } + return newState; + } + + public static IBlockState adapt(BlockState blockState) { + Block mcBlock = ForgeAdapter.adapt(blockState.getBlockType()); + IBlockState newState = mcBlock.getDefaultState(); + Map, Object> states = blockState.getStates(); + return applyProperties(mcBlock.getStateContainer(), newState, states); + } + + public static BlockState adapt(IBlockState blockState) { + BlockType blockType = adapt(blockState.getBlock()); + return blockType.getState(ForgeAdapter.adaptProperties(blockType, blockState.getValues())); + } + public static Block adapt(BlockType blockType) { return ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockType.getId())); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java index b38a625ab..e0337d735 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java @@ -23,7 +23,6 @@ import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.registry.BiomeRegistry; import net.minecraft.world.biome.Biome; -import net.minecraftforge.registries.ForgeRegistries; /** * Provides access to biome data in Forge. diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index 991db00f0..da9d0bf61 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -36,7 +36,6 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TreeGenerator.TreeType; @@ -45,11 +44,9 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.weather.WeatherType; import com.sk89q.worldedit.world.weather.WeatherTypes; -import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityType; @@ -61,19 +58,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; -import net.minecraft.state.DirectionProperty; -import net.minecraft.state.EnumProperty; -import net.minecraft.state.IProperty; -import net.minecraft.state.StateContainer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.IStringSerializable; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.storage.AnvilSaveHandler; @@ -100,11 +90,8 @@ import net.minecraftforge.common.DimensionManager; import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; -import java.util.Map; import java.util.Random; -import java.util.TreeMap; import java.util.concurrent.ThreadLocalRandom; import javax.annotation.Nullable; @@ -182,10 +169,7 @@ public class ForgeWorld extends AbstractWorld { Chunk chunk = world.getChunk(x >> 4, z >> 4); BlockPos pos = new BlockPos(x, y, z); IBlockState old = chunk.getBlockState(pos); - Block mcBlock = Block.getBlockFromName(block.getBlockType().getId()); - IBlockState newState = mcBlock.getDefaultState(); - Map, Object> states = block.getStates(); - newState = applyProperties(mcBlock.getStateContainer(), newState, states); + IBlockState newState = ForgeAdapter.adapt(block.toImmutableState()); IBlockState successState = chunk.setBlockState(pos, newState, false); boolean successful = successState != null; @@ -195,7 +179,7 @@ public class ForgeWorld extends AbstractWorld { // Kill the old TileEntity world.removeTileEntity(pos); NBTTagCompound nativeTag = NBTConverter.toNative(((BaseBlock) block).getNbtData()); - nativeTag.setString("id", ((BaseBlock) block).getNbtId()); + nativeTag.putString("id", ((BaseBlock) block).getNbtId()); TileEntityUtils.setTileEntity(world, position, nativeTag); } } @@ -217,26 +201,6 @@ public class ForgeWorld extends AbstractWorld { return false; } - private IBlockState applyProperties(StateContainer stateContainer, IBlockState newState, Map, Object> states) { - for (Map.Entry, Object> state : states.entrySet()) { - IProperty property = stateContainer.getProperty(state.getKey().getName()); - Comparable value = (Comparable) state.getValue(); - // we may need to adapt this value, depending on the source prop - if (property instanceof DirectionProperty) { - Direction dir = (Direction) value; - value = ForgeAdapter.adapt(dir); - } else if (property instanceof EnumProperty) { - String enumName = (String) value; - value = ((EnumProperty) property).parseValue((String) value).orElseGet(() -> { - throw new IllegalStateException("Enum property " + property.getName() + " does not contain " + enumName); - }); - } - - newState = newState.with(property, value); - } - return newState; - } - @Override public int getBlockLightLevel(BlockVector3 position) { checkNotNull(position); @@ -340,8 +304,7 @@ public class ForgeWorld extends AbstractWorld { MinecraftServer server = originalWorld.getServer(); AnvilSaveHandler saveHandler = new AnvilSaveHandler(saveFolder, originalWorld.getSaveHandler().getWorldDirectory().getName(), server, server.getDataFixer()); - World freshWorld = (World) new WorldServer(server, saveHandler, originalWorld.getWorldInfo(), - originalWorld.dimension.getId(), originalWorld.profiler).init(); + World freshWorld = new WorldServer(server, saveHandler, originalWorld.getSavedDataStorage(), originalWorld.getWorldInfo(), originalWorld.dimension.getType(), originalWorld.profiler).func_212251_i__(); // Pre-gen all the chunks // We need to also pull one more chunk in every direction @@ -359,8 +322,8 @@ public class ForgeWorld extends AbstractWorld { throw new RuntimeException(e); } finally { saveFolder.delete(); - DimensionManager.setWorld(originalWorld.dimension.getId(), null, server); - DimensionManager.setWorld(originalWorld.dimension.getId(), originalWorld, server); + DimensionManager.setWorld(originalWorld.dimension.getType(), null, server); + DimensionManager.setWorld(originalWorld.dimension.getType(), originalWorld, server); } return true; @@ -396,7 +359,7 @@ public class ForgeWorld extends AbstractWorld { @Override public boolean generateTree(TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException { Feature generator = createTreeFeatureGenerator(type); - return generator != null && generator.func_212245_a(getWorld(), getWorld().getChunkProvider().getChunkGenerator(), random, ForgeAdapter.toBlockPos(position), new NoFeatureConfig()); + return generator != null && generator.place(getWorld(), getWorld().getChunkProvider().getChunkGenerator(), random, ForgeAdapter.toBlockPos(position), new NoFeatureConfig()); } @Override @@ -455,15 +418,15 @@ public class ForgeWorld extends AbstractWorld { @Override public void setWeather(WeatherType weatherType, long duration) { WorldInfo info = getWorld().getWorldInfo(); - if (WeatherTypes.THUNDER_STORM.equals(weatherType)) { + if (weatherType == WeatherTypes.THUNDER_STORM) { info.setClearWeatherTime(0); info.setThundering(true); info.setThunderTime((int) duration); - } else if (WeatherTypes.RAIN.equals(weatherType)) { + } else if (weatherType == WeatherTypes.RAIN) { info.setClearWeatherTime(0); info.setRaining(true); info.setRainTime((int) duration); - } else if (WeatherTypes.CLEAR.equals(weatherType)) { + } else if (weatherType == WeatherTypes.CLEAR) { info.setRaining(false); info.setThundering(false); info.setClearWeatherTime((int) duration); @@ -477,26 +440,13 @@ public class ForgeWorld extends AbstractWorld { @Override public BlockState getBlock(BlockVector3 position) { - World world = getWorld(); - BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - IBlockState mcState = world.getBlockState(pos); + IBlockState mcState = getWorld().getChunk(position.getBlockX() >> 4, position.getBlockZ() >> 4).getBlockState( + position.getBlockX(), + position.getBlockY(), + position.getBlockZ() + ); - BlockType blockType = ForgeAdapter.adapt(mcState.getBlock()); - return blockType.getState(adaptProperties(blockType, mcState.getValues())); - } - - private Map, Object> adaptProperties(BlockType block, Map, Comparable> mcProps) { - Map, Object> props = new TreeMap<>(Comparator.comparing(Property::getName)); - for (Map.Entry, Comparable> prop : mcProps.entrySet()) { - Object value = prop.getValue(); - if (prop.getKey() instanceof DirectionProperty) { - value = ForgeAdapter.adaptEnumFacing((EnumFacing) value); - } else if (prop.getKey() instanceof EnumProperty) { - value = ((IStringSerializable) value).getName(); - } - props.put(block.getProperty(prop.getKey().getName()), value); - } - return props; + return ForgeAdapter.adapt(mcState); } @Override @@ -562,7 +512,7 @@ public class ForgeWorld extends AbstractWorld { if (nativeTag != null) { NBTTagCompound tag = NBTConverter.toNative(entity.getNbtData()); for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.removeTag(name); + tag.remove(name); } createdEntity.read(tag); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index f0dda4960..4c8ca8e1e 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -26,15 +26,18 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.forge.net.handler.InternalPacketHandler; import com.sk89q.worldedit.forge.net.handler.WECUIPacketHandler; import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage; -import com.sk89q.worldedit.forge.net.handler.InternalPacketHandler; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.entity.EntityType; +import com.sk89q.worldedit.world.item.ItemCategory; import com.sk89q.worldedit.world.item.ItemType; -import com.sk89q.worldedit.world.item.ItemTypes; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -44,7 +47,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; @@ -120,19 +122,29 @@ public class ForgeWorldEdit { this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform); // } - // TODO Setup states - for (ResourceLocation name : ForgeRegistries.BLOCKS.getKeys()) { - String nameStr = name.toString(); - if (!BlockType.REGISTRY.keySet().contains(nameStr)) { - BlockType.REGISTRY.register(nameStr, new BlockType(nameStr)); - } - } + setupRegistries(); + } + private void setupRegistries() { + // Blocks + for (ResourceLocation name : ForgeRegistries.BLOCKS.getKeys()) { + BlockType.REGISTRY.register(name.toString(), new BlockType(name.toString(), + input -> ForgeAdapter.adapt(ForgeAdapter.adapt(input.getBlockType()).getDefaultState()))); + } + // Items for (ResourceLocation name : ForgeRegistries.ITEMS.getKeys()) { - String nameStr = name.toString(); - if (!ItemType.REGISTRY.keySet().contains(nameStr)) { - ItemType.REGISTRY.register(nameStr, new ItemType(nameStr)); - } + ItemType.REGISTRY.register(name.toString(), new ItemType(name.toString())); + } + // Entities + for (ResourceLocation name : ForgeRegistries.ENTITIES.getKeys()) { + EntityType.REGISTRY.register(name.toString(), new EntityType(name.toString())); + } + // Tags + for (ResourceLocation name : BlockTags.getCollection().getRegisteredTags()) { + BlockCategory.REGISTRY.register(name.toString(), new BlockCategory(name.toString())); + } + for (ResourceLocation name : ItemTags.getCollection().getRegisteredTags()) { + ItemCategory.REGISTRY.register(name.toString(), new ItemCategory(name.toString())); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java index f05fbef47..bae43851c 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java @@ -140,7 +140,7 @@ final class NBTConverter { public static NBTTagCompound toNative(CompoundTag tag) { NBTTagCompound compound = new NBTTagCompound(); for (Entry child : tag.getValue().entrySet()) { - compound.setTag(child.getKey(), toNative(child.getValue())); + compound.put(child.getKey(), toNative(child.getValue())); } return compound; } @@ -245,7 +245,7 @@ final class NBTConverter { Set tags = other.keySet(); Map map = new HashMap<>(); for (String tagName : tags) { - map.put(tagName, fromNative(other.getTag(tagName))); + map.put(tagName, fromNative(other.get(tagName))); } return new CompoundTag(map); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java index 8a65feaf4..52f027f51 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java @@ -52,9 +52,9 @@ final class TileEntityUtils { checkNotNull(tag); checkNotNull(position); - tag.setTag("x", new NBTTagInt(position.getBlockX())); - tag.setTag("y", new NBTTagInt(position.getBlockY())); - tag.setTag("z", new NBTTagInt(position.getBlockZ())); + tag.put("x", new NBTTagInt(position.getBlockX())); + tag.put("y", new NBTTagInt(position.getBlockY())); + tag.put("z", new NBTTagInt(position.getBlockZ())); return tag; } From aa295d91e896ebe186f786d57453e83fa84baf0a Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 19 Feb 2019 21:49:06 +1000 Subject: [PATCH 134/182] All but commands and config directory are ported. --- .../sk89q/worldedit/forge/CommonProxy.java | 15 +++- .../sk89q/worldedit/forge/ForgePlatform.java | 7 +- .../com/sk89q/worldedit/forge/ForgeWorld.java | 86 +++++++++---------- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 8 +- .../com/sk89q/worldedit/forge/KeyHandler.java | 6 +- .../sk89q/worldedit/forge/gui/GuiHandler.java | 45 ---------- .../worldedit/forge/gui/GuiReferenceCard.java | 18 ++-- .../ResourceLocationInteractionObject.java | 65 ++++++++++++++ 8 files changed, 140 insertions(+), 110 deletions(-) delete mode 100644 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiHandler.java create mode 100644 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/ResourceLocationInteractionObject.java diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java index 9f60936c0..7c5708358 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java @@ -19,13 +19,22 @@ package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.forge.gui.GuiHandler; -import net.minecraftforge.fml.network.NetworkRegistry; +import com.sk89q.worldedit.forge.gui.GuiReferenceCard; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.ExtensionPoint; +import net.minecraftforge.fml.ModLoadingContext; public class CommonProxy { + public static ResourceLocation REFERENCE_GUI = new ResourceLocation("worldedit", "resource_gui"); + public void registerHandlers() { - NetworkRegistry.INSTANCE.registerGuiHandler(ForgeWorldEdit.inst, new GuiHandler()); + ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, () -> openContainer -> { + if (openContainer.getId().equals(REFERENCE_GUI)) { + return new GuiReferenceCard(); + } + return null; + }); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java index 5c2f1ab89..4d83e1ded 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java @@ -35,7 +35,6 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.management.PlayerList; import net.minecraft.util.ResourceLocation; import net.minecraft.world.WorldServer; -import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.server.ServerLifecycleHooks; import java.util.ArrayList; @@ -83,8 +82,8 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public List getWorlds() { - WorldServer[] worlds = DimensionManager.getWorlds(); - List ret = new ArrayList<>(worlds.length); + Iterable worlds = server.getWorlds(); + List ret = new ArrayList<>(); for (WorldServer world : worlds) { ret.add(new ForgeWorld(world)); } @@ -108,7 +107,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { if (world instanceof ForgeWorld) { return world; } else { - for (WorldServer ws : DimensionManager.getWorlds()) { + for (WorldServer ws : server.getWorlds()) { if (ws.getWorldInfo().getWorldName().equals(world.getName())) { return new ForgeWorld(ws); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index da9d0bf61..8291f50ae 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -21,7 +21,6 @@ package com.sk89q.worldedit.forge; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.io.Files; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; @@ -34,7 +33,6 @@ import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; @@ -57,7 +55,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.ResourceLocation; @@ -65,9 +62,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.chunk.storage.AnvilSaveHandler; -import net.minecraft.world.gen.ChunkProviderServer; import net.minecraft.world.gen.feature.BigBrownMushroomFeature; import net.minecraft.world.gen.feature.BigRedMushroomFeature; import net.minecraft.world.gen.feature.BigTreeFeature; @@ -85,9 +79,7 @@ import net.minecraft.world.gen.feature.SwampTreeFeature; import net.minecraft.world.gen.feature.TallTaigaTreeFeature; import net.minecraft.world.gen.feature.TreeFeature; import net.minecraft.world.storage.WorldInfo; -import net.minecraftforge.common.DimensionManager; -import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; @@ -289,44 +281,46 @@ public class ForgeWorld extends AbstractWorld { @Override public boolean regenerate(Region region, EditSession editSession) { - // Don't even try to regen if it's going to fail. - IChunkProvider provider = getWorld().getChunkProvider(); - if (!(provider instanceof ChunkProviderServer)) { - return false; - } - - File saveFolder = Files.createTempDir(); - // register this just in case something goes wrong - // normally it should be deleted at the end of this method - saveFolder.deleteOnExit(); - - WorldServer originalWorld = (WorldServer) getWorld(); - - MinecraftServer server = originalWorld.getServer(); - AnvilSaveHandler saveHandler = new AnvilSaveHandler(saveFolder, originalWorld.getSaveHandler().getWorldDirectory().getName(), server, server.getDataFixer()); - World freshWorld = new WorldServer(server, saveHandler, originalWorld.getSavedDataStorage(), originalWorld.getWorldInfo(), originalWorld.dimension.getType(), originalWorld.profiler).func_212251_i__(); - - // Pre-gen all the chunks - // We need to also pull one more chunk in every direction - CuboidRegion expandedPreGen = new CuboidRegion(region.getMinimumPoint().subtract(16, 0, 16), region.getMaximumPoint().add(16, 0, 16)); - for (BlockVector2 chunk : expandedPreGen.getChunks()) { - freshWorld.getChunk(chunk.getBlockX(), chunk.getBlockZ()); - } - - ForgeWorld from = new ForgeWorld(freshWorld); - try { - for (BlockVector3 vec : region) { - editSession.setBlock(vec, from.getFullBlock(vec)); - } - } catch (MaxChangedBlocksException e) { - throw new RuntimeException(e); - } finally { - saveFolder.delete(); - DimensionManager.setWorld(originalWorld.dimension.getType(), null, server); - DimensionManager.setWorld(originalWorld.dimension.getType(), originalWorld, server); - } - - return true; + // TODO Fix for 1.13 + return false; +// // Don't even try to regen if it's going to fail. +// IChunkProvider provider = getWorld().getChunkProvider(); +// if (!(provider instanceof ChunkProviderServer)) { +// return false; +// } +// +// File saveFolder = Files.createTempDir(); +// // register this just in case something goes wrong +// // normally it should be deleted at the end of this method +// saveFolder.deleteOnExit(); +// +// WorldServer originalWorld = (WorldServer) getWorld(); +// +// MinecraftServer server = originalWorld.getServer(); +// AnvilSaveHandler saveHandler = new AnvilSaveHandler(saveFolder, originalWorld.getSaveHandler().getWorldDirectory().getName(), server, server.getDataFixer()); +// World freshWorld = new WorldServer(server, saveHandler, originalWorld.getSavedDataStorage(), originalWorld.getWorldInfo(), originalWorld.dimension.getType(), originalWorld.profiler).func_212251_i__(); +// +// // Pre-gen all the chunks +// // We need to also pull one more chunk in every direction +// CuboidRegion expandedPreGen = new CuboidRegion(region.getMinimumPoint().subtract(16, 0, 16), region.getMaximumPoint().add(16, 0, 16)); +// for (BlockVector2 chunk : expandedPreGen.getChunks()) { +// freshWorld.getChunk(chunk.getBlockX(), chunk.getBlockZ()); +// } +// +// ForgeWorld from = new ForgeWorld(freshWorld); +// try { +// for (BlockVector3 vec : region) { +// editSession.setBlock(vec, from.getFullBlock(vec)); +// } +// } catch (MaxChangedBlocksException e) { +// throw new RuntimeException(e); +// } finally { +// saveFolder.delete(); +// DimensionManager.setWorld(originalWorld.dimension.getType(), null, server); +// DimensionManager.setWorld(originalWorld.dimension.getType(), originalWorld, server); +// } +// +// return true; } @Nullable diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 4c8ca8e1e..f25e50544 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -47,6 +47,8 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.ModContainer; +import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; @@ -79,6 +81,8 @@ public class ForgeWorldEdit { private ForgeConfiguration config; private File workingDir; + private ModContainer container; + public ForgeWorldEdit() { inst = this; @@ -92,6 +96,8 @@ public class ForgeWorldEdit { } public void init(FMLCommonSetupEvent event) { + this.container = ModLoadingContext.get().getActiveContainer(); + // Setup working directory workingDir = new File(event.getModConfigurationDirectory() + File.separator + "worldedit"); workingDir.mkdir(); @@ -299,7 +305,7 @@ public class ForgeWorldEdit { * @return a version string */ String getInternalVersion() { - return ForgeWorldEdit.class.getAnnotation(Mod.class).version(); + return container.getModInfo().getVersion().toString(); } public void setPermissionsProvider(ForgePermissionsProvider provider) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java index 5cd7b7e80..d0a23fcf1 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.forge.gui.GuiHandler; +import com.sk89q.worldedit.forge.gui.GuiReferenceCard; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -39,7 +39,9 @@ public class KeyHandler { @SubscribeEvent public void onKey(KeyInputEvent evt) { if (mc.player != null && mc.world != null && mainKey.isPressed()) { - mc.player.openGui(ForgeWorldEdit.inst, GuiHandler.REFERENCE_ID, mc.world, 0, 0, 0); + mc.displayGuiScreen(new GuiReferenceCard()); + // TODO Seems GuiHandlers don't work on client right now +// NetworkHooks.openGui(mc.player, new ResourceLocationInteractionObject(CommonProxy.REFERENCE_GUI)); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiHandler.java deleted file mode 100644 index d88b97379..000000000 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.forge.gui; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.network.IGuiHandler; - -public class GuiHandler implements IGuiHandler { - - public static final int REFERENCE_ID = 0; - - @Override - public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { - return null; - } - - @Override - public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { - switch (id) { - case REFERENCE_ID: - return new GuiReferenceCard(); - } - - return null; - } - -} \ No newline at end of file diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java index f982b21df..23e0bb90c 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java @@ -33,7 +33,14 @@ public class GuiReferenceCard extends GuiScreen { @Override public void initGui() { - this.buttonList.add(this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2, (this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close")); + this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2, (this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close") { + @Override + public void onClick(double p_194829_1_, double p_194829_3_) { + super.onClick(p_194829_1_, p_194829_3_); + + mc.player.closeScreen(); + } + }; } @Override @@ -42,18 +49,11 @@ public class GuiReferenceCard extends GuiScreen { int y = (this.height - this.backgroundHeight) / 2 - this.closeButton.height; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.renderEngine.bindTexture(new ResourceLocation(ForgeWorldEdit.MOD_ID, "textures/gui/reference.png")); + this.mc.textureManager.bindTexture(new ResourceLocation(ForgeWorldEdit.MOD_ID, "textures/gui/reference.png")); this.drawTexturedModalRect(x, y, 0, 0, this.backgroundWidth, this.backgroundHeight); super.render(mouseX, mouseY, par3); } - @Override - protected void actionPerformed(GuiButton button) { - if (button.id == 0) { - this.mc.player.closeScreen(); - } - } - @Override public boolean doesGuiPauseGame() { return true; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/ResourceLocationInteractionObject.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/ResourceLocationInteractionObject.java new file mode 100644 index 000000000..6e11d02dd --- /dev/null +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/ResourceLocationInteractionObject.java @@ -0,0 +1,65 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.forge.gui; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.world.IInteractionObject; + +import javax.annotation.Nullable; + +public class ResourceLocationInteractionObject implements IInteractionObject { + + private ResourceLocation resourceLocation; + + public ResourceLocationInteractionObject(ResourceLocation resourceLocation) { + this.resourceLocation = resourceLocation; + } + + @Override + public Container createContainer(InventoryPlayer inventoryPlayer, EntityPlayer entityPlayer) { + throw new UnsupportedOperationException(); + } + + @Override + public String getGuiID() { + return resourceLocation.toString(); + } + + @Override + public ITextComponent getName() { + return new TextComponentString(resourceLocation.toString()); + } + + @Override + public boolean hasCustomName() { + return false; + } + + @Nullable + @Override + public ITextComponent getCustomName() { + return null; + } +} From a0f127813dda4fe9d20a347fc6cddf7240eef61b Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Thu, 21 Feb 2019 00:40:00 -0800 Subject: [PATCH 135/182] Pull config dir from FMLPaths --- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index f25e50544..8b26c285f 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -55,11 +55,16 @@ import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; import net.minecraftforge.fml.event.server.FMLServerStartedEvent; import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.registries.ForgeRegistries; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; /** * The Forge implementation of WorldEdit. @@ -79,7 +84,7 @@ public class ForgeWorldEdit { private ForgePlatform platform; private ForgeConfiguration config; - private File workingDir; + private Path workingDir; private ModContainer container; @@ -99,8 +104,14 @@ public class ForgeWorldEdit { this.container = ModLoadingContext.get().getActiveContainer(); // Setup working directory - workingDir = new File(event.getModConfigurationDirectory() + File.separator + "worldedit"); - workingDir.mkdir(); + workingDir = FMLPaths.CONFIGDIR.get().resolve("worldedit"); + if (!Files.exists(workingDir)) { + try { + Files.createDirectory(workingDir); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } config = new ForgeConfiguration(this); config.load(); @@ -296,7 +307,7 @@ public class ForgeWorldEdit { * @return the working directory */ public File getWorkingDir() { - return this.workingDir; + return this.workingDir.toFile(); } /** From 2f734d4570b311486b15c676600a3cd70199128b Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 23 Feb 2019 11:57:15 -0500 Subject: [PATCH 136/182] Check radius instead of diameter for clipboard brush. This brings it more in line with other brushes in terms of allowable size. --- .../java/com/sk89q/worldedit/command/BrushCommands.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 d1547b27e..a53178c0d 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 @@ -146,9 +146,9 @@ public class BrushCommands { BlockVector3 size = clipboard.getDimensions(); - worldEdit.checkMaxBrushRadius(size.getBlockX()); - worldEdit.checkMaxBrushRadius(size.getBlockY()); - worldEdit.checkMaxBrushRadius(size.getBlockZ()); + worldEdit.checkMaxBrushRadius(size.getBlockX() / 2D - 1); + worldEdit.checkMaxBrushRadius(size.getBlockY() / 2D - 1); + worldEdit.checkMaxBrushRadius(size.getBlockZ() / 2D - 1); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin), "worldedit.brush.clipboard"); From 90797d12f41907b60f0dd868ad2a8e39df635753 Mon Sep 17 00:00:00 2001 From: wizjany Date: Mon, 25 Feb 2019 18:15:26 -0500 Subject: [PATCH 137/182] Skip legacy materials when setting up registries. Doesn't make a difference normally, but avoids errors in special envs. --- .../main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 6509db543..640e07338 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 @@ -132,7 +132,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { } // Block & Item for (Material material : Material.values()) { - if (material.isBlock()) { + if (material.isBlock() && !material.isLegacy()) { BlockType.REGISTRY.register(material.getKey().toString(), new BlockType(material.getKey().toString(), blockState -> { // TODO Use something way less hacky than this. ParserContext context = new ParserContext(); @@ -154,7 +154,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { } })); } - if (material.isItem()) { + if (material.isItem() && !material.isLegacy()) { ItemType.REGISTRY.register(material.getKey().toString(), new ItemType(material.getKey().toString())); } } From 9eeb0acffe3c2d1ff267c91ca59628f70da33094 Mon Sep 17 00:00:00 2001 From: wizjany Date: Mon, 25 Feb 2019 18:31:31 -0500 Subject: [PATCH 138/182] Add radius checks to a few more utility commands. --- .../com/sk89q/worldedit/command/UtilityCommands.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 3a4425f88..bd8ae4da9 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 @@ -275,6 +275,7 @@ public class UtilityCommands { public void replaceNear(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { int size = Math.max(1, args.getInteger(0)); + we.checkMaxRadius(size); int affected; Set from; Pattern to; @@ -288,9 +289,11 @@ public class UtilityCommands { if (args.argsLength() == 2) { from = null; + context.setRestricted(true); to = we.getPatternFactory().parseFromInput(args.getString(1), context); } else { from = we.getBlockFactory().parseFromListInput(args.getString(1), context); + context.setRestricted(true); to = we.getPatternFactory().parseFromInput(args.getString(2), context); } @@ -317,8 +320,8 @@ public class UtilityCommands { @CommandPermissions("worldedit.snow") @Logging(PLACEMENT) public void snow(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10; + we.checkMaxRadius(size); int affected = editSession.simulateSnow(session.getPlacementPosition(player), size); player.print(affected + " surfaces covered. Let it snow~"); @@ -334,8 +337,8 @@ public class UtilityCommands { @CommandPermissions("worldedit.thaw") @Logging(PLACEMENT) public void thaw(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10; + we.checkMaxRadius(size); int affected = editSession.thaw(session.getPlacementPosition(player), size); player.print(affected + " surfaces thawed."); @@ -345,6 +348,7 @@ public class UtilityCommands { aliases = { "/green", "green" }, usage = "[radius]", desc = "Greens the area", + help = "Converts dirt to grass blocks. -f also converts coarse dirt.", flags = "f", min = 0, max = 1 @@ -352,8 +356,8 @@ public class UtilityCommands { @CommandPermissions("worldedit.green") @Logging(PLACEMENT) public void green(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - final double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10; + we.checkMaxRadius(size); final boolean onlyNormalDirt = !args.hasFlag('f'); final int affected = editSession.green(session.getPlacementPosition(player), size, onlyNormalDirt); From 243d6476ac358d19511c616a8618cf7ffa1ae16f Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 26 Feb 2019 18:15:35 -0500 Subject: [PATCH 139/182] Re-add smooth filtering via a mask. Instead of trying to maintain a list of "natural terrain blocks", just let the user specify a mask of blocks to use for the height map filter. https://gfycat.com/severaljauntycondor --- .../java/com/sk89q/worldedit/EditSession.java | 19 +++++++++++++++++-- .../worldedit/command/BrushCommands.java | 15 ++++++++------- .../worldedit/command/RegionCommands.java | 12 +++++++----- .../command/tool/brush/SmoothBrush.java | 11 ++++++++++- .../worldedit/math/convolution/HeightMap.java | 7 +++++-- 5 files changed, 47 insertions(+), 17 deletions(-) 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 c36f2625f..fef75da83 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -592,10 +592,25 @@ public class EditSession implements Extent, AutoCloseable { * @return height of highest block found or 'minY' */ public int getHighestTerrainBlock(int x, int z, int minY, int maxY) { + return getHighestTerrainBlock(x, z, minY, maxY, null); + } + + /** + * Returns the highest solid 'terrain' block. + * + * @param x the X coordinate + * @param z the Z coordinate + * @param minY minimal height + * @param maxY maximal height + * @param filter a mask of blocks to consider, or null to consider any solid (movement-blocking) block + * @return height of highest block found or 'minY' + */ + public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) { for (int y = maxY; y >= minY; --y) { BlockVector3 pt = BlockVector3.at(x, y, z); - BlockState block = getBlock(pt); - if (block.getBlockType().getMaterial().isMovementBlocker()) { + if (filter == null + ? getBlock(pt).getBlockType().getMaterial().isMovementBlocker() + : filter.test(pt)) { return y; } } 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 a53178c0d..0d1adc1d3 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 @@ -42,6 +42,7 @@ import com.sk89q.worldedit.command.util.CreatureButcher; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.mask.BlockTypeMask; +import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; @@ -158,24 +159,24 @@ public class BrushCommands { @Command( aliases = { "smooth" }, - usage = "[size] [iterations]", + usage = "[size] [iterations] [filter]", desc = "Choose the terrain softener brush", help = - "Chooses the terrain softener brush.", + "Chooses the terrain softener brush. Optionally, specify a mask of blocks to be used for the heightmap.\n" + + "For example, '/brush smooth 2 4 grass_block,dirt,stone'.", min = 0, - max = 2 + max = 3 ) @CommandPermissions("worldedit.brush.smooth") public void smoothBrush(Player player, LocalSession session, EditSession editSession, - @Optional("2") double radius, @Optional("4") int iterations) throws WorldEditException { - + @Optional("2") double radius, @Optional("4") int iterations, @Optional Mask mask) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); - tool.setBrush(new SmoothBrush(iterations), "worldedit.brush.smooth"); + tool.setBrush(new SmoothBrush(iterations, mask), "worldedit.brush.smooth"); - player.print(String.format("Smooth brush equipped (%.0f x %dx, using any block).", radius, iterations)); + player.print(String.format("Smooth brush equipped (%.0f x %dx, using %s).", radius, iterations, mask == null ? "any block" : "filter")); } @Command( 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 c12d897b8..704025a3f 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 @@ -240,17 +240,19 @@ public class RegionCommands { @Command( aliases = { "/smooth" }, - usage = "[iterations]", + usage = "[iterations] [filter]", desc = "Smooth the elevation in the selection", help = - "Smooths the elevation in the selection.", + "Smooths the elevation in the selection.\n" + + "Optionally, restricts the height map to a set of blocks specified with mask syntax.\n" + + "For example, '//smooth 1 grass_block,dirt,stone' would only smooth natural surface terrain.", min = 0, - max = 1 + max = 2 ) @CommandPermissions("worldedit.region.smooth") @Logging(REGION) - public void smooth(Player player, EditSession editSession, @Selection Region region, @Optional("1") int iterations) throws WorldEditException { - HeightMap heightMap = new HeightMap(editSession, region); + public void smooth(Player player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Optional Mask mask) throws WorldEditException { + HeightMap heightMap = new HeightMap(editSession, region, mask); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); int affected = heightMap.applyFilter(filter, iterations); player.print("Terrain's height map smoothed. " + affected + " block(s) changed."); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java index d46b1ec3a..2ecf245d1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; +import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; @@ -31,12 +32,20 @@ import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; +import javax.annotation.Nullable; + public class SmoothBrush implements Brush { + private final Mask mask; private int iterations; public SmoothBrush(int iterations) { + this(iterations, null); + } + + public SmoothBrush(int iterations, @Nullable Mask mask) { this.iterations = iterations; + this.mask = mask; } @Override @@ -45,7 +54,7 @@ public class SmoothBrush implements Brush { Location min = new Location(editSession.getWorld(), posDouble.subtract(size, size, size)); BlockVector3 max = posDouble.add(size, size + 10, size).toBlockPoint(); Region region = new CuboidRegion(editSession.getWorld(), min.toVector().toBlockPoint(), max); - HeightMap heightMap = new HeightMap(editSession, region); + HeightMap heightMap = new HeightMap(editSession, region, mask); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); heightMap.applyFilter(filter, iterations); } 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 ff2dae979..c075bbf7f 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 @@ -23,11 +23,14 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; +import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; +import javax.annotation.Nullable; + /** * Allows applications of Kernels onto the region's height map. * @@ -48,7 +51,7 @@ public class HeightMap { * @param session an edit session * @param region the region */ - public HeightMap(EditSession session, Region region) { + public HeightMap(EditSession session, Region region, @Nullable Mask mask) { checkNotNull(session); checkNotNull(region); @@ -67,7 +70,7 @@ public class HeightMap { data = new int[width * height]; for (int z = 0; z < height; ++z) { for (int x = 0; x < width; ++x) { - data[z * width + x] = session.getHighestTerrainBlock(x + minX, z + minZ, minY, maxY); + data[z * width + x] = session.getHighestTerrainBlock(x + minX, z + minZ, minY, maxY, mask); } } } From 4bd6d7308540666adc1d7e24cf1f796df075a415 Mon Sep 17 00:00:00 2001 From: wizjany Date: Thu, 28 Feb 2019 00:59:34 -0500 Subject: [PATCH 140/182] Fix some bad copy-pasta in expression environment queries. --- .../regions/shape/WorldEditExpressionEnvironment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java index 2b1c49309..4601164f7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java @@ -58,7 +58,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { @Override public int getBlockTypeAbs(double x, double y, double z) { - return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); + return editSession.getBlock(BlockVector3.at(x, y, z)).getBlockType().getLegacyId(); } @Override @@ -68,7 +68,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { @Override public int getBlockTypeRel(double x, double y, double z) { - return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); + return editSession.getBlock(toWorldRel(x, y, z).toBlockPoint()).getBlockType().getLegacyId(); } @Override From 0656ef1920f2e4562099f3cd37e70dde9deb5c30 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 1 Mar 2019 19:25:10 -0500 Subject: [PATCH 141/182] Fix LayerVisitor stopping early instead of skipping covered columns. --- .../java/com/sk89q/worldedit/function/visitor/LayerVisitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java index f3a191e12..f683637b3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java @@ -99,7 +99,7 @@ public class LayerVisitor implements Operation { // Abort if we are underground if (function.isGround(column.toBlockVector3(maxY + 1))) { - return null; + continue; } boolean found = false; From f46c70093ce42a0b82368f97d9e9ff518cc301ef Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 1 Mar 2019 19:29:34 -0500 Subject: [PATCH 142/182] Fix the long-range build tool's ability to build mid-air. --- .../src/main/java/com/sk89q/worldedit/util/Location.java | 3 +++ .../main/java/com/sk89q/worldedit/util/TargetBlock.java | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) 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 8e95e9eb0..ea161111b 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 @@ -208,6 +208,9 @@ public class Location { * @return the direction vector */ public Vector3 getDirection() { + if (Float.isNaN(getYaw()) && Float.isNaN(getPitch())) { + return Vector3.ZERO; + } double yaw = Math.toRadians(this.getYaw()); double pitch = Math.toRadians(this.getPitch()); double xz = Math.cos(pitch); 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 60c979dee..9d0cf2baa 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 @@ -189,11 +189,16 @@ public class TargetBlock { public Location getAnyTargetBlockFace() { getAnyTargetBlock(); - return getCurrentBlock().setDirection(getCurrentBlock().toVector().subtract(getPreviousBlock().toVector())); + Location current = getCurrentBlock(); + if (current != null) + return current.setDirection(current.toVector().subtract(getPreviousBlock().toVector())); + else + return new Location(world, targetPos.toVector3(), Float.NaN, Float.NaN); } public Location getTargetBlockFace() { - getAnyTargetBlock(); + getTargetBlock(); + if (getCurrentBlock() == null) return null; return getCurrentBlock().setDirection(getCurrentBlock().toVector().subtract(getPreviousBlock().toVector())); } From e53962daddc3a9d342f386a79eec55789316d106 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 1 Mar 2019 21:15:21 -0500 Subject: [PATCH 143/182] Apply source function after source mask in ForwardExtentCopy. The source function should only get applied to actually copied blocks. --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 2 +- .../java/com/sk89q/worldedit/command/RegionCommands.java | 8 +++++--- .../worldedit/function/operation/ForwardExtentCopy.java | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) 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 fef75da83..404299e99 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -1252,7 +1252,7 @@ public class EditSession implements Extent, AutoCloseable { BlockVector3 to = region.getMinimumPoint(); // Remove the original blocks - com.sk89q.worldedit.function.pattern.Pattern pattern = replacement != null ? + Pattern pattern = replacement != null ? replacement : new BlockPattern(BlockTypes.AIR.getDefaultState()); BlockReplace remove = new BlockReplace(this, pattern); 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 704025a3f..00c70d5c6 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 @@ -262,11 +262,12 @@ public class RegionCommands { @Command( aliases = { "/move" }, usage = "[count] [direction] [leave-id]", - flags = "s", + flags = "sa", desc = "Move the contents of the selection", help = "Moves the contents of the selection.\n" + "The -s flag shifts the selection to the target location.\n" + + "The -a flag skips air blocks.\n" + "Optionally fills the old location with .", min = 0, max = 3 @@ -278,9 +279,10 @@ public class RegionCommands { @Optional("1") @Range(min = 1) int count, @Optional(Direction.AIM) @Direction(includeDiagonals = true) BlockVector3 direction, @Optional("air") Pattern replace, - @Switch('s') boolean moveSelection) throws WorldEditException { + @Switch('s') boolean moveSelection, + @Switch('a') boolean ignoreAirBlocks) throws WorldEditException { - int affected = editSession.moveRegion(region, direction, count, true, replace); + int affected = editSession.moveRegion(region, direction, count, !ignoreAirBlocks, replace); if (moveSelection) { try { 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 b3f663836..cbf73e857 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 @@ -248,9 +248,9 @@ public class ForwardExtentCopy implements Operation { } ExtentBlockCopy blockCopy = new ExtentBlockCopy(source, from, destination, to, currentTransform); - RegionMaskingFilter filter = new RegionMaskingFilter(sourceMask, blockCopy); - RegionFunction function = sourceFunction != null ? new CombinedRegionFunction(filter, sourceFunction) : filter; - RegionVisitor blockVisitor = new RegionVisitor(region, function); + RegionMaskingFilter filteredFunction = new RegionMaskingFilter(sourceMask, + sourceFunction == null ? blockCopy : new CombinedRegionFunction(blockCopy, sourceFunction)); + RegionVisitor blockVisitor = new RegionVisitor(region, filteredFunction); lastVisitor = blockVisitor; From c3ee926a2e6cb3d70cc9cbc595d929077fe00b7c Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 2 Mar 2019 11:55:03 -0500 Subject: [PATCH 144/182] Correctness improvement for legacy data in expression generation. --- .../java/com/sk89q/worldedit/EditSession.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) 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 404299e99..38766ba6b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -1897,12 +1897,25 @@ public class EditSession implements Extent, AutoCloseable { final Vector3 scaled = current.subtract(zero).divide(unit); try { - if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), defaultMaterial.getBlockType().getLegacyId(), 0) <= 0) { - // TODO data + int[] legacy = LegacyMapper.getInstance().getLegacyFromBlock(defaultMaterial.toImmutableState()); + int typeVar = 0; + int dataVar = 0; + if (legacy != null) { + typeVar = legacy[0]; + if (legacy.length > 1) { + dataVar = legacy[1]; + } + } + if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), typeVar, dataVar) <= 0) { return null; } - - return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()).toBaseBlock(); + int newType = (int) typeVariable.getValue(); + int newData = (int) dataVariable.getValue(); + if (newType != typeVar || newData != dataVar) { + return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()).toBaseBlock(); + } else { + return defaultMaterial; + } } catch (Exception e) { log.log(Level.WARNING, "Failed to create shape", e); return null; From aafb854e4f8435b40862df82bc52f5a9166ac818 Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 2 Mar 2019 12:26:26 -0500 Subject: [PATCH 145/182] More useful names for block ItemTypes. --- .../world/registry/BundledItemRegistry.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java index 3e0ae8800..1ab788e42 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java @@ -32,7 +32,16 @@ public class BundledItemRegistry implements ItemRegistry { @Nullable @Override public String getName(ItemType itemType) { - BundledItemData.ItemEntry itemEntry = BundledItemData.getInstance().findById(itemType.getId()); - return itemEntry != null ? itemEntry.localizedName : null; + String id = itemType.getId(); + BundledItemData.ItemEntry itemEntry = BundledItemData.getInstance().findById(id); + if (itemEntry != null) { + String localized = itemEntry.localizedName; + if (localized.equals("Air")) { + int c = id.indexOf(':'); + return c < 0 ? id : id.substring(c + 1); + } + return localized; + } + return null; } } From f84f3c6f851690822418b4ecd888c0b18813e0ad Mon Sep 17 00:00:00 2001 From: wizjany Date: Sun, 3 Mar 2019 19:51:49 -0500 Subject: [PATCH 146/182] Fix error when parsing hand/offhand/pos1 as blocks. --- .../extension/factory/parser/DefaultBlockParser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java index d6c62b4d1..4f3793adb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java @@ -238,7 +238,7 @@ public class DefaultBlockParser extends InputParser { } blockType = blockInHand.getBlockType(); - blockStates = blockInHand.getStates(); + blockStates.putAll(blockInHand.getStates()); } else if ("offhand".equalsIgnoreCase(typeString)) { // Get the block type from the item in the user's off hand. final BaseBlock blockInHand = getBlockInHand(context.requireActor(), HandSide.OFF_HAND); @@ -247,7 +247,7 @@ public class DefaultBlockParser extends InputParser { } blockType = blockInHand.getBlockType(); - blockStates = blockInHand.getStates(); + blockStates.putAll(blockInHand.getStates()); } else if ("pos1".equalsIgnoreCase(typeString)) { // Get the block type from the "primary position" final World world = context.requireWorld(); @@ -260,7 +260,7 @@ public class DefaultBlockParser extends InputParser { final BlockState blockInHand = world.getBlock(primaryPosition); blockType = blockInHand.getBlockType(); - blockStates = blockInHand.getStates(); + blockStates.putAll(blockInHand.getStates()); } else { // Attempt to lookup a block from ID or name. blockType = BlockTypes.get(typeString.toLowerCase()); From 9ee0f000304b1b7b727312af4c47dcc4a7b70109 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Mon, 4 Mar 2019 18:31:20 -0800 Subject: [PATCH 147/182] Initial command registration setup. Pretty hacky, subcommands do not work, some arguments missing. --- worldedit-forge/build.gradle | 2 +- .../sk89q/worldedit/forge/CommandWrapper.java | 157 ++++++++++++------ .../sk89q/worldedit/forge/ForgeAdapter.java | 18 +- .../forge/ForgePermissionsProvider.java | 5 +- .../sk89q/worldedit/forge/ForgePlatform.java | 13 +- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 35 +--- .../forge/net/handler/WECUIPacketHandler.java | 4 +- .../src/main/resources/META-INF/mods.toml | 8 +- .../src/main/resources/pack.mcmeta | 6 + 9 files changed, 153 insertions(+), 95 deletions(-) create mode 100644 worldedit-forge/src/main/resources/pack.mcmeta diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index faaa4931c..536739a5c 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -14,7 +14,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' def minecraftVersion = "1.13.2" -def forgeVersion = "25.0.34" +def forgeVersion = "25.0.70" dependencies { compile project(':worldedit-core') diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java index 1ad0f10ca..cb1d051b4 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java @@ -19,60 +19,123 @@ package com.sk89q.worldedit.forge; +import com.mojang.brigadier.Command; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.ArgumentBuilder; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.tree.CommandNode; +import com.mojang.brigadier.tree.LiteralCommandNode; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.util.command.CommandMapping; -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.server.MinecraftServer; +import com.sk89q.worldedit.util.command.Parameter; +import net.minecraft.command.CommandSource; +import net.minecraft.entity.player.EntityPlayerMP; -import java.util.Arrays; -import java.util.List; +import java.util.LinkedList; +import java.util.function.Predicate; -import javax.annotation.Nullable; +import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer; +import static net.minecraft.command.Commands.argument; +import static net.minecraft.command.Commands.literal; -public class CommandWrapper extends CommandBase { - private CommandMapping command; +public class CommandWrapper { - protected CommandWrapper(CommandMapping command) { - this.command = command; - } + public static void register(CommandDispatcher dispatcher, CommandMapping command) { + LiteralArgumentBuilder base = literal(command.getPrimaryAlias()); + LinkedList> parameterStack = new LinkedList<>(); + LinkedList> optionalParameterStack = new LinkedList<>(); + boolean hasFlag = false; + for (Parameter parameter : command.getDescription().getParameters()) { + if (parameter.isValueFlag()) { + if (!hasFlag) { + hasFlag = true; + optionalParameterStack.push(argument("flags", StringArgumentType.string())); + } + } else if (parameter.isOptional()) { + optionalParameterStack.push(argument(parameter.getName(), StringArgumentType.string())); + } else { + parameterStack.push(argument(parameter.getName(), StringArgumentType.string())); + } + } - @Override - public String getName() { - return command.getPrimaryAlias(); - } - - @Override - public List getAliases() { - return Arrays.asList(command.getAllAliases()); - } - - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - } - - @Override - public String getUsage(ICommandSender icommandsender) { - return "/" + command.getPrimaryAlias() + " " + command.getDescription().getUsage(); - } - - @Override - public int getRequiredPermissionLevel() { - return 0; - } - - @Override - public boolean checkPermission(MinecraftServer server, ICommandSender sender) { - return true; - } - - @Override - public int compareTo(@Nullable ICommand o) { - if (o == null) { - return 0; + ArgumentBuilder argument = buildChildNodes(parameterStack, optionalParameterStack, command); + if (argument != null) { + base.then(argument); } else { - return super.compareTo(o); + base.executes(commandFor(command)); + } + LiteralCommandNode registered = + dispatcher.register( + base.requires(requirementsFor(command)) + ); + for (String alias : command.getAllAliases()) { + dispatcher.register( + literal(alias).redirect(registered) + ); } } + + /** + * Make the appropriate {@code then()} and {@code execute()} calls to emulate required and + * optional parameters, given the argument orders. + * + * @param parameterStack required parameters + * @param optionalParameterStack optional parameters + * @return the node with all calls chained + */ + private static ArgumentBuilder buildChildNodes(LinkedList> parameterStack, + LinkedList> optionalParameterStack, + CommandMapping mapping) { + ArgumentBuilder currentChild = null; + Command command = commandFor(mapping); + while (!optionalParameterStack.isEmpty()) { + ArgumentBuilder next = optionalParameterStack.removeLast(); + if (currentChild != null) { + next.then(currentChild.executes(command)); + } + currentChild = next; + } + boolean requiredExecute = false; + while (!parameterStack.isEmpty()) { + ArgumentBuilder next = parameterStack.removeLast(); + if (currentChild != null) { + next.then(currentChild); + } + if (!requiredExecute) { + // first required parameter also gets execute + requiredExecute = true; + next.executes(command); + } + currentChild = next; + } + return currentChild; + } + + private static Command commandFor(CommandMapping mapping) { + return ctx -> { + EntityPlayerMP player = ctx.getSource().asPlayer(); + if (player.world.isRemote()) { + return 0; + } + WorldEdit.getInstance().getEventBus().post(new CommandEvent( + adaptPlayer(player), + ctx.getRange().get(ctx.getInput()) + )); + return 1; + }; + } + + private static Predicate requirementsFor(CommandMapping mapping) { + return ctx -> { + ForgePermissionsProvider permsProvider = ForgeWorldEdit.inst.getPermissionsProvider(); + return ctx.getEntity() instanceof EntityPlayerMP && + mapping.getDescription().getPermissions().stream() + .allMatch(perm -> permsProvider.hasPermission( + (EntityPlayerMP) ctx.getEntity(), perm + )); + }; + } + } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index 58aba645c..fe13ed7eb 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -40,6 +40,7 @@ import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -59,7 +60,9 @@ import java.util.Map; import java.util.TreeMap; import java.util.stream.Collectors; -final class ForgeAdapter { +import static com.google.common.base.Preconditions.checkNotNull; + +public final class ForgeAdapter { private ForgeAdapter() { } @@ -154,7 +157,7 @@ final class ForgeAdapter { private static IBlockState applyProperties(StateContainer stateContainer, IBlockState newState, Map, Object> states) { for (Map.Entry, Object> state : states.entrySet()) { - IProperty property = stateContainer.getProperty(state.getKey().getName()); + IProperty property = stateContainer.getProperty(state.getKey().getName()); Comparable value = (Comparable) state.getValue(); // we may need to adapt this value, depending on the source prop if (property instanceof DirectionProperty) { @@ -212,4 +215,15 @@ final class ForgeAdapter { CompoundTag tag = NBTConverter.fromNative(itemStack.serializeNBT()); return new BaseItemStack(adapt(itemStack.getItem()), tag, itemStack.getCount()); } + + /** + * Get the WorldEdit proxy for the given player. + * + * @param player the player + * @return the WorldEdit player + */ + public static ForgePlayer adaptPlayer(EntityPlayerMP player) { + checkNotNull(player); + return new ForgePlayer(player); + } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java index 8f9011268..6129cb31b 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java @@ -19,7 +19,6 @@ package com.sk89q.worldedit.forge; -import net.minecraft.command.ICommand; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.GameType; import net.minecraftforge.fml.server.ServerLifecycleHooks; @@ -28,7 +27,7 @@ public interface ForgePermissionsProvider { boolean hasPermission(EntityPlayerMP player, String permission); - void registerPermission(ICommand command, String permission); + void registerPermission(String permission); class VanillaPermissionsProvider implements ForgePermissionsProvider { @@ -47,7 +46,7 @@ public interface ForgePermissionsProvider { } @Override - public void registerPermission(ICommand command, String permission) {} + public void registerPermission(String permission) {} } // TODO Re-add when Sponge for 1.13 is out diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java index 4d83e1ded..0530acc54 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java @@ -29,7 +29,7 @@ import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.registry.Registries; -import net.minecraft.command.ServerCommandManager; +import net.minecraft.command.Commands; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.server.management.PlayerList; @@ -37,14 +37,13 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.server.ServerLifecycleHooks; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.EnumMap; import java.util.List; import java.util.Map; -import javax.annotation.Nullable; - class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { private final ForgeWorldEdit mod; @@ -120,15 +119,13 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public void registerCommands(Dispatcher dispatcher) { if (server == null) return; - ServerCommandManager mcMan = (ServerCommandManager) server.getCommandManager(); + Commands mcMan = server.getCommandManager(); for (final CommandMapping command : dispatcher.getCommands()) { - CommandWrapper wrapper = new CommandWrapper(command); - mcMan.registerCommand(wrapper); + CommandWrapper.register(mcMan.getDispatcher(), command); if (command.getDescription().getPermissions().size() > 0) { - ForgeWorldEdit.inst.getPermissionsProvider().registerPermission(wrapper, command.getDescription().getPermissions().get(0)); for (int i = 1; i < command.getDescription().getPermissions().size(); i++) { - ForgeWorldEdit.inst.getPermissionsProvider().registerPermission(null, command.getDescription().getPermissions().get(i)); + ForgeWorldEdit.inst.getPermissionsProvider().registerPermission(command.getDescription().getPermissions().get(i)); } } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 8b26c285f..985880a44 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.forge; import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer; import com.google.common.base.Joiner; import com.sk89q.worldedit.LocalSession; @@ -92,9 +93,6 @@ public class ForgeWorldEdit { inst = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init); - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverAboutToStart); - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverStopping); - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverStarted); MinecraftForge.EVENT_BUS.register(ThreadSafeCache.getInstance()); MinecraftForge.EVENT_BUS.register(this); @@ -123,6 +121,7 @@ public class ForgeWorldEdit { LOGGER.info("WorldEdit for Forge (version " + getInternalVersion() + ") is loaded"); } + @SubscribeEvent public void serverAboutToStart(FMLServerAboutToStartEvent event) { if (this.platform != null) { LOGGER.warn("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't"); @@ -165,29 +164,18 @@ public class ForgeWorldEdit { } } + @SubscribeEvent public void serverStopping(FMLServerStoppingEvent event) { WorldEdit worldEdit = WorldEdit.getInstance(); worldEdit.getSessionManager().unload(); worldEdit.getPlatformManager().unregister(platform); } + @SubscribeEvent public void serverStarted(FMLServerStartedEvent event) { WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); } - @SubscribeEvent - public void onCommandEvent(CommandEvent event) { - if ((event.getSender() instanceof EntityPlayerMP)) { - if (((EntityPlayerMP) event.getSender()).world.isRemote) return; - String[] split = new String[event.getParameters().length + 1]; - System.arraycopy(event.getParameters(), 0, split, 1, event.getParameters().length); - split[0] = event.getCommand().getName(); - com.sk89q.worldedit.event.platform.CommandEvent weEvent = - new com.sk89q.worldedit.event.platform.CommandEvent(wrap((EntityPlayerMP) event.getSender()), Joiner.on(" ").join(split)); - WorldEdit.getInstance().getEventBus().post(weEvent); - } - } - @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { if (platform == null) { @@ -215,7 +203,7 @@ public class ForgeWorldEdit { } WorldEdit we = WorldEdit.getInstance(); - ForgePlayer player = wrap((EntityPlayerMP) event.getEntityPlayer()); + ForgePlayer player = adaptPlayer((EntityPlayerMP) event.getEntityPlayer()); ForgeWorld world = getWorld(event.getEntityPlayer().world); if (event instanceof PlayerInteractEvent.LeftClickEmpty) { @@ -259,17 +247,6 @@ public class ForgeWorldEdit { return this.config; } - /** - * Get the WorldEdit proxy for the given player. - * - * @param player the player - * @return the WorldEdit player - */ - public ForgePlayer wrap(EntityPlayerMP player) { - checkNotNull(player); - return new ForgePlayer(player); - } - /** * Get the session for a player. * @@ -278,7 +255,7 @@ public class ForgeWorldEdit { */ public LocalSession getSession(EntityPlayerMP player) { checkNotNull(player); - return WorldEdit.getInstance().getSessionManager().get(wrap(player)); + return WorldEdit.getInstance().getSessionManager().get(adaptPlayer(player)); } /** diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java index 215e31526..c03218b01 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java @@ -32,6 +32,8 @@ import net.minecraftforge.fml.network.event.EventNetworkChannel; import java.nio.charset.Charset; +import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer; + public class WECUIPacketHandler { public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); private static final String PROTOCOL_VERSION = Integer.toString(1); @@ -57,7 +59,7 @@ public class WECUIPacketHandler { String text = event.getPayload().toString(UTF_8_CHARSET); session.handleCUIInitializationMessage(text); - session.describeCUI(ForgeWorldEdit.inst.wrap(player)); + session.describeCUI(adaptPlayer(player)); } public static void callProcessPacket(NetworkEvent.ClientCustomPayloadEvent event) { diff --git a/worldedit-forge/src/main/resources/META-INF/mods.toml b/worldedit-forge/src/main/resources/META-INF/mods.toml index 9bb66bea4..c89f9c261 100644 --- a/worldedit-forge/src/main/resources/META-INF/mods.toml +++ b/worldedit-forge/src/main/resources/META-INF/mods.toml @@ -15,7 +15,7 @@ authors="sk89q, wizjany, TomyLobo, kenzierocks, Me4502" # The modid of the mod modId="worldedit" # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it -version="${internalVersion}" +version="${version}" # A display name for the mod displayName="WorldEdit" # The description text for the mod (multi line!) @@ -23,11 +23,11 @@ description=''' WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single- and multi-player. ''' [[dependencies.worldedit]] - modId="minecraft" + modId="forge" mandatory=true - versionRange="[1.13.2]" + versionRange="[${forge_version},)" ordering="NONE" - side="SERVER" + side="BOTH" [[dependencies.worldedit]] modId="sponge" mandatory=false diff --git a/worldedit-forge/src/main/resources/pack.mcmeta b/worldedit-forge/src/main/resources/pack.mcmeta new file mode 100644 index 000000000..b48da3b7d --- /dev/null +++ b/worldedit-forge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "WorldEdit Resources", + "pack_format": 4 + } +} \ No newline at end of file From 4878f382500171d0837d7cacf457762f0cf0460b Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Mon, 4 Mar 2019 19:36:06 -0800 Subject: [PATCH 148/182] Fix platform registration, config setup --- .../world/registry/LegacyMapper.java | 3 ++ .../sk89q/worldedit/forge/ForgeAdapter.java | 4 +- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 52 +++++++++++++++---- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java index e59cd762a..ad2eac4c0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java @@ -43,6 +43,8 @@ import java.util.logging.Logger; import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; + public class LegacyMapper { private static final Logger log = Logger.getLogger(LegacyMapper.class.getCanonicalName()); @@ -100,6 +102,7 @@ public class LegacyMapper { try { String id = itemEntry.getKey(); ItemType type = ItemTypes.get(itemEntry.getValue()); + checkNotNull(type); itemToStringMap.put(type, id); stringToItemMap.put(id, type); } catch (Exception e) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index fe13ed7eb..164ac65cf 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -134,8 +134,10 @@ public final class ForgeAdapter { .collect(Collectors.toList())); } if (property instanceof net.minecraft.state.EnumProperty) { + // Note: do not make x.getName a method reference. + // It will cause runtime bootstrap exceptions. return new EnumProperty(property.getName(), ((net.minecraft.state.EnumProperty) property).getAllowedValues().stream() - .map(IStringSerializable::getName) + .map(x -> x.getName()) .collect(Collectors.toList())); } return new IPropertyAdapter<>(property); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 985880a44..60025a7ec 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -36,26 +36,34 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.item.ItemCategory; import com.sk89q.worldedit.world.item.ItemType; +import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.CommandEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.SidedProvider; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; import net.minecraftforge.fml.event.server.FMLServerStartedEvent; import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.fml.loading.FMLCommonLaunchHandler; +import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.registries.ForgeRegistries; import org.apache.logging.log4j.LogManager; @@ -92,13 +100,15 @@ public class ForgeWorldEdit { public ForgeWorldEdit() { inst = this; - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init); + IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); + modBus.addListener(this::init); + modBus.addListener(this::load); MinecraftForge.EVENT_BUS.register(ThreadSafeCache.getInstance()); MinecraftForge.EVENT_BUS.register(this); } - public void init(FMLCommonSetupEvent event) { + private void init(FMLCommonSetupEvent event) { this.container = ModLoadingContext.get().getActiveContainer(); // Setup working directory @@ -111,9 +121,6 @@ public class ForgeWorldEdit { } } - config = new ForgeConfiguration(this); - config.load(); - WECUIPacketHandler.init(); InternalPacketHandler.init(); proxy.registerHandlers(); @@ -121,6 +128,14 @@ public class ForgeWorldEdit { LOGGER.info("WorldEdit for Forge (version " + getInternalVersion() + ") is loaded"); } + private void load(FMLLoadCompleteEvent event) { + if (FMLLoader.getDist() == Dist.CLIENT) { + // we want to setup platform before we hit the main menu + // but this event is async -- so we must delay until the first game loop: + Minecraft.getInstance().addScheduledTask(this::setupPlatform); + } + } + @SubscribeEvent public void serverAboutToStart(FMLServerAboutToStartEvent event) { if (this.platform != null) { @@ -128,6 +143,10 @@ public class ForgeWorldEdit { WorldEdit.getInstance().getPlatformManager().unregister(platform); } + setupPlatform(); + } + + private void setupPlatform() { this.platform = new ForgePlatform(this); WorldEdit.getInstance().getPlatformManager().register(platform); @@ -139,28 +158,41 @@ public class ForgeWorldEdit { // } setupRegistries(); + + config = new ForgeConfiguration(this); + config.load(); } private void setupRegistries() { // Blocks for (ResourceLocation name : ForgeRegistries.BLOCKS.getKeys()) { - BlockType.REGISTRY.register(name.toString(), new BlockType(name.toString(), + if (BlockType.REGISTRY.get(name.toString()) == null) { + BlockType.REGISTRY.register(name.toString(), new BlockType(name.toString(), input -> ForgeAdapter.adapt(ForgeAdapter.adapt(input.getBlockType()).getDefaultState()))); + } } // Items for (ResourceLocation name : ForgeRegistries.ITEMS.getKeys()) { - ItemType.REGISTRY.register(name.toString(), new ItemType(name.toString())); + if (ItemType.REGISTRY.get(name.toString()) == null) { + ItemType.REGISTRY.register(name.toString(), new ItemType(name.toString())); + } } // Entities for (ResourceLocation name : ForgeRegistries.ENTITIES.getKeys()) { - EntityType.REGISTRY.register(name.toString(), new EntityType(name.toString())); + if (EntityType.REGISTRY.get(name.toString()) == null) { + EntityType.REGISTRY.register(name.toString(), new EntityType(name.toString())); + } } // Tags for (ResourceLocation name : BlockTags.getCollection().getRegisteredTags()) { - BlockCategory.REGISTRY.register(name.toString(), new BlockCategory(name.toString())); + if (BlockCategory.REGISTRY.get(name.toString()) == null) { + BlockCategory.REGISTRY.register(name.toString(), new BlockCategory(name.toString())); + } } for (ResourceLocation name : ItemTags.getCollection().getRegisteredTags()) { - ItemCategory.REGISTRY.register(name.toString(), new ItemCategory(name.toString())); + if (ItemCategory.REGISTRY.get(name.toString()) == null) { + ItemCategory.REGISTRY.register(name.toString(), new ItemCategory(name.toString())); + } } } From bb33897221bed832bdfbc0d31853b19b709ae016 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Mon, 4 Mar 2019 19:57:22 -0800 Subject: [PATCH 149/182] Handle all commands like pre-1.13 for now --- .../sk89q/worldedit/forge/CommandWrapper.java | 22 +++++++++--------- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 23 +++++++++++++++++++ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java index cb1d051b4..b070d2a6c 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java @@ -24,6 +24,8 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.tree.CommandNode; import com.mojang.brigadier.tree.LiteralCommandNode; import com.sk89q.worldedit.WorldEdit; @@ -114,19 +116,17 @@ public class CommandWrapper { } private static Command commandFor(CommandMapping mapping) { - return ctx -> { - EntityPlayerMP player = ctx.getSource().asPlayer(); - if (player.world.isRemote()) { - return 0; - } - WorldEdit.getInstance().getEventBus().post(new CommandEvent( - adaptPlayer(player), - ctx.getRange().get(ctx.getInput()) - )); - return 1; - }; + return FAKE_COMMAND; } + public static final Command FAKE_COMMAND = ctx -> { + EntityPlayerMP player = ctx.getSource().asPlayer(); + if (player.world.isRemote()) { + return 0; + } + return 1; + }; + private static Predicate requirementsFor(CommandMapping mapping) { return ctx -> { ForgePermissionsProvider permsProvider = ForgeWorldEdit.inst.getPermissionsProvider(); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 60025a7ec..b5a80a36b 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -23,6 +23,8 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer; import com.google.common.base.Joiner; +import com.mojang.brigadier.ParseResults; +import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; @@ -37,6 +39,7 @@ import com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.item.ItemCategory; import com.sk89q.worldedit.world.item.ItemType; import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandSource; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; @@ -270,6 +273,26 @@ public class ForgeWorldEdit { } } + @SubscribeEvent + public void onCommandEvent(CommandEvent event) throws CommandSyntaxException { + ParseResults parseResults = event.getParseResults(); + if (!(parseResults.getContext().getSource().getEntity() instanceof EntityPlayerMP)) { + return; + } + EntityPlayerMP player = parseResults.getContext().getSource().asPlayer(); + if (player.world.isRemote()) { + return; + } + if (parseResults.getContext().getCommand() != CommandWrapper.FAKE_COMMAND) { + return; + } + event.setCanceled(true); + WorldEdit.getInstance().getEventBus().post(new com.sk89q.worldedit.event.platform.CommandEvent( + adaptPlayer(parseResults.getContext().getSource().asPlayer()), + parseResults.getReader().getString() + )); + } + /** * Get the configuration. * From de08c8b8c73e96a91c49f7599a58ef4eb2a61f8f Mon Sep 17 00:00:00 2001 From: wizjany Date: Wed, 6 Mar 2019 19:58:32 -0500 Subject: [PATCH 150/182] Add better control over expression timeouts. (#451) Add better control over expression timeouts. * //timeout command can be used to change player's current timeout. * Config now also has a max timeout, can be bypassed with permission * Timeout of < 0 will let expressions run indefinitely. * Said expressions won't run on a separate thread, slightly reducing the overhead from context switching. For large //gen commands, for example, this can actually increase speed. --- .../java/com/sk89q/worldedit/EditSession.java | 94 ++++++++++++++++--- .../sk89q/worldedit/LocalConfiguration.java | 1 + .../com/sk89q/worldedit/LocalSession.java | 19 ++++ .../worldedit/command/GeneralCommands.java | 40 +++++++- .../worldedit/command/GenerationCommands.java | 6 +- .../worldedit/command/RegionCommands.java | 2 +- .../worldedit/command/UtilityCommands.java | 12 ++- .../command/composition/SelectionCommand.java | 1 + .../composition/ShapedBrushCommand.java | 2 +- .../tool/brush/OperationFactoryBrush.java | 8 ++ .../parser/mask/ExpressionMaskParser.java | 8 ++ .../sk89q/worldedit/function/EditContext.java | 10 ++ .../worldedit/function/factory/Deform.java | 12 ++- .../function/mask/ExpressionMask.java | 20 +++- .../function/mask/ExpressionMask2D.java | 19 +++- .../internal/expression/Expression.java | 50 ++++++---- .../runtime/ExpressionTimeoutException.java | 29 ++++++ .../worldedit/session/SessionManager.java | 34 +++---- .../util/PropertiesConfiguration.java | 1 + .../worldedit/util/YAMLConfiguration.java | 1 + .../internal/expression/ExpressionTest.java | 8 +- 21 files changed, 301 insertions(+), 76 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/ExpressionTimeoutException.java 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 38766ba6b..966479e98 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -81,6 +81,7 @@ import com.sk89q.worldedit.history.changeset.BlockOptimizedHistory; import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; +import com.sk89q.worldedit.internal.expression.runtime.ExpressionTimeoutException; import com.sk89q.worldedit.internal.expression.runtime.RValue; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; @@ -1879,7 +1880,42 @@ public class EditSession implements Extent, AutoCloseable { return count.getDistribution(); } - public int makeShape(final Region region, final Vector3 zero, final Vector3 unit, final Pattern pattern, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException { + /** + * Generate a shape for the given expression. + * + * @param region the region to generate the shape in + * @param zero the coordinate origin for x/y/z variables + * @param unit the scale of the x/y/z/ variables + * @param pattern the default material to make the shape from + * @param expressionString the expression defining the shape + * @param hollow whether the shape should be hollow + * @return number of blocks changed + * @throws ExpressionException + * @throws MaxChangedBlocksException + */ + public int makeShape(final Region region, final Vector3 zero, final Vector3 unit, + final Pattern pattern, final String expressionString, final boolean hollow) + throws ExpressionException, MaxChangedBlocksException { + return makeShape(region, zero, unit, pattern, expressionString, hollow, WorldEdit.getInstance().getConfiguration().calculationTimeout); + } + + /** + * Generate a shape for the given expression. + * + * @param region the region to generate the shape in + * @param zero the coordinate origin for x/y/z variables + * @param unit the scale of the x/y/z/ variables + * @param pattern the default material to make the shape from + * @param expressionString the expression defining the shape + * @param hollow whether the shape should be hollow + * @param timeout the time, in milliseconds, to wait for each expression evaluation before halting it. -1 to disable + * @return number of blocks changed + * @throws ExpressionException + * @throws MaxChangedBlocksException + */ + public int makeShape(final Region region, final Vector3 zero, final Vector3 unit, + final Pattern pattern, final String expressionString, final boolean hollow, final int timeout) + throws ExpressionException, MaxChangedBlocksException { final Expression expression = Expression.compile(expressionString, "x", "y", "z", "type", "data"); expression.optimize(); @@ -1889,6 +1925,7 @@ public class EditSession implements Extent, AutoCloseable { final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(this, unit, zero); expression.setEnvironment(environment); + final int[] timedOut = {0}; final ArbitraryShape shape = new ArbitraryShape(region) { @Override protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) { @@ -1906,27 +1943,42 @@ public class EditSession implements Extent, AutoCloseable { dataVar = legacy[1]; } } - if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), typeVar, dataVar) <= 0) { + if (expression.evaluate(new double[]{scaled.getX(), scaled.getY(), scaled.getZ(), typeVar, dataVar}, timeout) <= 0) { return null; } int newType = (int) typeVariable.getValue(); int newData = (int) dataVariable.getValue(); if (newType != typeVar || newData != dataVar) { - return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()).toBaseBlock(); + BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(newType, newData); + return state == null ? defaultMaterial : state.toBaseBlock(); } else { return defaultMaterial; } + } catch (ExpressionTimeoutException e) { + timedOut[0] = timedOut[0] + 1; + return null; } catch (Exception e) { log.log(Level.WARNING, "Failed to create shape", e); return null; } } }; - - return shape.generate(this, pattern, hollow); + int changed = shape.generate(this, pattern, hollow); + if (timedOut[0] > 0) { + throw new ExpressionTimeoutException( + String.format("%d blocks changed. %d blocks took too long to evaluate (increase with //timeout).", + changed, timedOut[0])); + } + return changed; } - public int deformRegion(final Region region, final Vector3 zero, final Vector3 unit, final String expressionString) throws ExpressionException, MaxChangedBlocksException { + public int deformRegion(final Region region, final Vector3 zero, final Vector3 unit, final String expressionString) + throws ExpressionException, MaxChangedBlocksException { + return deformRegion(region, zero, unit, expressionString, WorldEdit.getInstance().getConfiguration().calculationTimeout); + } + + public int deformRegion(final Region region, final Vector3 zero, final Vector3 unit, final String expressionString, + final int timeout) throws ExpressionException, MaxChangedBlocksException { final Expression expression = Expression.compile(expressionString, "x", "y", "z"); expression.optimize(); @@ -1944,7 +1996,7 @@ public class EditSession implements Extent, AutoCloseable { final Vector3 scaled = position.toVector3().subtract(zero).divide(unit); // transform - expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ()); + expression.evaluate(new double[]{scaled.getX(), scaled.getY(), scaled.getZ()}, timeout); final BlockVector3 sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue()); @@ -2131,7 +2183,8 @@ public class EditSession implements Extent, AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int drawSpline(Pattern pattern, List nodevectors, double tension, double bias, double continuity, double quality, double radius, boolean filled) + public int drawSpline(Pattern pattern, List nodevectors, double tension, double bias, + double continuity, double quality, double radius, boolean filled) throws MaxChangedBlocksException { Set vset = new HashSet<>(); @@ -2231,7 +2284,15 @@ public class EditSession implements Extent, AutoCloseable { } } - public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType, final String expressionString, final boolean hollow) throws ExpressionException, MaxChangedBlocksException { + public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType, + final String expressionString, final boolean hollow) + throws ExpressionException, MaxChangedBlocksException { + return makeBiomeShape(region, zero, unit, biomeType, expressionString, hollow, WorldEdit.getInstance().getConfiguration().calculationTimeout); + } + + public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType, + final String expressionString, final boolean hollow, final int timeout) + throws ExpressionException, MaxChangedBlocksException { final Vector2 zero2D = zero.toVector2(); final Vector2 unit2D = unit.toVector2(); @@ -2242,6 +2303,7 @@ public class EditSession implements Extent, AutoCloseable { final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(editSession, unit, zero); expression.setEnvironment(environment); + final int[] timedOut = {0}; final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) { @Override protected BiomeType getBiome(int x, int z, BiomeType defaultBiomeType) { @@ -2250,20 +2312,28 @@ public class EditSession implements Extent, AutoCloseable { final Vector2 scaled = current.subtract(zero2D).divide(unit2D); try { - if (expression.evaluate(scaled.getX(), scaled.getZ()) <= 0) { + if (expression.evaluate(new double[]{scaled.getX(), scaled.getZ()}, timeout) <= 0) { return null; } // TODO: Allow biome setting via a script variable (needs BiomeType<->int mapping) return defaultBiomeType; + } catch (ExpressionTimeoutException e) { + timedOut[0] = timedOut[0] + 1; + return null; } catch (Exception e) { log.log(Level.WARNING, "Failed to create shape", e); return null; } } }; - - return shape.generate(this, biomeType, hollow); + int changed = shape.generate(this, biomeType, hollow); + if (timedOut[0] > 0) { + throw new ExpressionTimeoutException( + String.format("%d blocks changed. %d blocks took too long to evaluate (increase time with //timeout)", + changed, timedOut[0])); + } + return changed; } private static final BlockVector3[] recurseDirections = { 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 1e9d19660..51ace98a8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -67,6 +67,7 @@ public abstract class LocalConfiguration { public int navigationWandMaxDistance = 50; public int scriptTimeout = 3000; public int calculationTimeout = 100; + public int maxCalculationTimeout = 300; public Set allowedDataCycleBlocks = new HashSet<>(); public String saveDir = "schematics"; public String scriptsDir = "craftscripts"; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 5d1c50806..1d0968aa6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -85,6 +85,7 @@ public class LocalSession { private transient BlockTool pickaxeMode = new SinglePickaxe(); private transient Map tools = new HashMap<>(); private transient int maxBlocksChanged = -1; + private transient int maxTimeoutTime; private transient boolean useInventory; private transient Snapshot snapshot; private transient boolean hasCUISupport = false; @@ -415,6 +416,24 @@ public class LocalSession { this.maxBlocksChanged = maxBlocksChanged; } + /** + * Get the maximum time allowed for certain executions to run before cancelling them, such as expressions. + * + * @return timeout time, in milliseconds + */ + public int getTimeout() { + return maxTimeoutTime; + } + + /** + * Set the maximum number of blocks that can be changed. + * + * @param timeout the time, in milliseconds, to limit certain executions to, or -1 to disable + */ + public void setTimeout(int timeout) { + this.maxTimeoutTime = timeout; + } + /** * Checks whether the super pick axe is enabled. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 5e4f608ed..b16aece4e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -57,9 +57,9 @@ public class GeneralCommands { @Command( aliases = { "/limit" }, - usage = "", + usage = "[limit]", desc = "Modify block change limit", - min = 1, + min = 0, max = 1 ) @CommandPermissions("worldedit.limit") @@ -68,7 +68,7 @@ public class GeneralCommands { LocalConfiguration config = worldEdit.getConfiguration(); boolean mayDisable = player.hasPermission("worldedit.limit.unrestricted"); - int limit = Math.max(-1, args.getInteger(0)); + int limit = args.argsLength() == 0 ? config.defaultChangeLimit : Math.max(-1, args.getInteger(0)); if (!mayDisable && config.maxChangeLimit > -1) { if (limit > config.maxChangeLimit) { player.printError("Your maximum allowable limit is " + config.maxChangeLimit + "."); @@ -78,13 +78,43 @@ public class GeneralCommands { session.setBlockChangeLimit(limit); - if (limit != -1) { - player.print("Block change limit set to " + limit + ". (Use //limit -1 to go back to the default.)"); + if (limit != config.defaultChangeLimit) { + player.print("Block change limit set to " + limit + ". (Use //limit to go back to the default.)"); } else { player.print("Block change limit set to " + limit + "."); } } + @Command( + aliases = { "/timeout" }, + usage = "[time]", + desc = "Modify evaluation timeout time.", + min = 0, + max = 1 + ) + @CommandPermissions("worldedit.timeout") + public void timeout(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + + LocalConfiguration config = worldEdit.getConfiguration(); + boolean mayDisable = player.hasPermission("worldedit.timeout.unrestricted"); + + int limit = args.argsLength() == 0 ? config.calculationTimeout : Math.max(-1, args.getInteger(0)); + if (!mayDisable && config.maxCalculationTimeout > -1) { + if (limit > config.maxCalculationTimeout) { + player.printError("Your maximum allowable timeout is " + config.maxCalculationTimeout + " ms."); + return; + } + } + + session.setTimeout(limit); + + if (limit != config.calculationTimeout) { + player.print("Timeout time set to " + limit + " ms. (Use //timeout to go back to the default.)"); + } else { + player.print("Timeout time set to " + limit + " ms."); + } + } + @Command( aliases = { "/fast" }, usage = "[on|off]", 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 5d48ac3d9..d16edd976 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 @@ -306,7 +306,7 @@ public class GenerationCommands { } try { - final int affected = editSession.makeShape(region, zero, unit, pattern, expression, hollow); + final int affected = editSession.makeShape(region, zero, unit, pattern, expression, hollow, session.getTimeout()); player.findFreePosition(); player.print(affected + " block(s) have been created."); } catch (ExpressionException e) { @@ -333,7 +333,7 @@ public class GenerationCommands { min = 2, max = -1 ) - @CommandPermissions({"worldedit.generation.shape", "worldedit.biome.set"}) + @CommandPermissions("worldedit.generation.shape.biome") @Logging(ALL) public void generateBiome(Player player, LocalSession session, EditSession editSession, @Selection Region region, @@ -371,7 +371,7 @@ public class GenerationCommands { } try { - final int affected = editSession.makeBiomeShape(region, zero, unit, target, expression, hollow); + final int affected = editSession.makeBiomeShape(region, zero, unit, target, expression, hollow, session.getTimeout()); player.findFreePosition(); player.print("" + affected + " columns affected."); } catch (ExpressionException e) { 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 00c70d5c6..b02b2ba42 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 @@ -404,7 +404,7 @@ public class RegionCommands { } try { - final int affected = editSession.deformRegion(region, zero, unit, expression); + final int affected = editSession.deformRegion(region, zero, unit, expression, session.getTimeout()); player.findFreePosition(); player.print(affected + " block(s) have been deformed."); } catch (ExpressionException e) { 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 bd8ae4da9..8768be6c8 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 @@ -52,6 +52,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CylinderRegion; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.session.SessionOwner; import com.sk89q.worldedit.util.command.CommandCallable; import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.Dispatcher; @@ -541,13 +542,18 @@ public class UtilityCommands { public void calc(Actor actor, @Text String input) throws CommandException { try { Expression expression = Expression.compile(input); - actor.print("= " + expression.evaluate()); + if (actor instanceof SessionOwner) { + actor.print("= " + expression.evaluate( + new double[]{}, WorldEdit.getInstance().getSessionManager().get((SessionOwner) actor).getTimeout())); + } else { + actor.print("= " + expression.evaluate()); + } } catch (EvaluationException e) { actor.printError(String.format( - "'%s' could not be parsed as a valid expression", input)); + "'%s' could not be evaluated (error: %s)", input, e.getMessage())); } catch (ExpressionException e) { actor.printError(String.format( - "'%s' could not be evaluated (error: %s)", input, e.getMessage())); + "'%s' could not be parsed as a valid expression", input)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java index ffb06db2e..a8e89e364 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java @@ -79,6 +79,7 @@ public class SelectionCommand extends SimpleCommand { EditContext editContext = new EditContext(); editContext.setDestination(locals.get(EditSession.class)); editContext.setRegion(selection); + editContext.setSession(session); Operation operation = operationFactory.createFromContext(editContext); Operations.completeBlindly(operation); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java index 2fa613db4..98daedde2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java @@ -75,7 +75,7 @@ public class ShapedBrushCommand extends SimpleCommand { BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setFill(null); - tool.setBrush(new OperationFactoryBrush(factory, regionFactory), permission); + tool.setBrush(new OperationFactoryBrush(factory, regionFactory, session), permission); } catch (MaxBrushRadiusException | InvalidToolBindException e) { WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter().convert(e); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/OperationFactoryBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/OperationFactoryBrush.java index 6a323f14b..1d7c5e7ce 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/OperationFactoryBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/OperationFactoryBrush.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.function.Contextual; import com.sk89q.worldedit.function.EditContext; @@ -33,10 +34,16 @@ public class OperationFactoryBrush implements Brush { private final Contextual operationFactory; private final RegionFactory regionFactory; + private final LocalSession session; public OperationFactoryBrush(Contextual operationFactory, RegionFactory regionFactory) { + this(operationFactory, regionFactory, null); + } + + public OperationFactoryBrush(Contextual operationFactory, RegionFactory regionFactory, LocalSession session) { this.operationFactory = operationFactory; this.regionFactory = regionFactory; + this.session = session; } @Override @@ -45,6 +52,7 @@ public class OperationFactoryBrush implements Brush { context.setDestination(editSession); context.setRegion(regionFactory.createCenteredAt(position, size)); context.setFill(pattern); + context.setSession(session); Operation operation = operationFactory.createFromContext(context); Operations.completeLegacy(operation); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java index ba5fac5f1..9267af44a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java @@ -29,8 +29,11 @@ import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; +import com.sk89q.worldedit.session.SessionOwner; import com.sk89q.worldedit.session.request.Request; +import java.util.function.IntSupplier; + public class ExpressionMaskParser extends InputParser { public ExpressionMaskParser(WorldEdit worldEdit) { @@ -48,6 +51,11 @@ public class ExpressionMaskParser extends InputParser { WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment( Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO); exp.setEnvironment(env); + if (context.getActor() instanceof SessionOwner) { + SessionOwner owner = (SessionOwner) context.getActor(); + IntSupplier timeout = () -> WorldEdit.getInstance().getSessionManager().get(owner).getTimeout(); + return new ExpressionMask(exp, timeout); + } return new ExpressionMask(exp); } catch (ExpressionException e) { throw new InputParseException("Invalid expression: " + e.getMessage()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java index 07c1515ba..b26f8d74f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.function; import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.Region; @@ -32,6 +33,7 @@ public class EditContext { private Extent destination; @Nullable private Region region; @Nullable private Pattern fill; + @Nullable private LocalSession session; public Extent getDestination() { return destination; @@ -60,4 +62,12 @@ public class EditContext { this.fill = fill; } + @Nullable + public LocalSession getSession() { + return session; + } + + public void setSession(@Nullable LocalSession session) { + this.session = session; + } } 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 ac52933be..0098d455a 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 @@ -23,6 +23,8 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; @@ -147,7 +149,9 @@ public class Deform implements Contextual { unit = Vector3.ONE; } - return new DeformOperation(context.getDestination(), region, zero, unit, expression); + LocalSession session = context.getSession(); + return new DeformOperation(context.getDestination(), region, zero, unit, expression, + session == null ? WorldEdit.getInstance().getConfiguration().calculationTimeout : session.getTimeout()); } private static final class DeformOperation implements Operation { @@ -156,20 +160,22 @@ public class Deform implements Contextual { private final Vector3 zero; private final Vector3 unit; private final String expression; + private final int timeout; - private DeformOperation(Extent destination, Region region, Vector3 zero, Vector3 unit, String expression) { + private DeformOperation(Extent destination, Region region, Vector3 zero, Vector3 unit, String expression, int timeout) { this.destination = destination; this.region = region; this.zero = zero; this.unit = unit; this.expression = expression; + this.timeout = timeout; } @Override public Operation resume(RunContext run) throws WorldEditException { try { // TODO: Move deformation code - ((EditSession) destination).deformRegion(region, zero, unit, expression); + ((EditSession) destination).deformRegion(region, zero, unit, expression, timeout); return null; } catch (ExpressionException e) { throw new RuntimeException("Failed to execute expression", e); // TODO: Better exception to throw here? 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 9f597e267..d8ddcc704 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 @@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; @@ -28,6 +29,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; import javax.annotation.Nullable; +import java.util.function.IntSupplier; /** * A mask that evaluates an expression. @@ -38,6 +40,7 @@ import javax.annotation.Nullable; public class ExpressionMask extends AbstractMask { private final Expression expression; + private final IntSupplier timeout; /** * Create a new instance. @@ -46,8 +49,7 @@ public class ExpressionMask extends AbstractMask { * @throws ExpressionException thrown if there is an error with the expression */ public ExpressionMask(String expression) throws ExpressionException { - checkNotNull(expression); - this.expression = Expression.compile(expression, "x", "y", "z"); + this(Expression.compile(checkNotNull(expression), "x", "y", "z")); } /** @@ -56,8 +58,13 @@ public class ExpressionMask extends AbstractMask { * @param expression the expression */ public ExpressionMask(Expression expression) { + this(expression, null); + } + + public ExpressionMask(Expression expression, @Nullable IntSupplier timeout) { checkNotNull(expression); this.expression = expression; + this.timeout = timeout; } @Override @@ -66,7 +73,12 @@ public class ExpressionMask extends AbstractMask { if (expression.getEnvironment() instanceof WorldEditExpressionEnvironment) { ((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector.toVector3()); } - return expression.evaluate(vector.getX(), vector.getY(), vector.getZ()) > 0; + if (timeout == null) { + return expression.evaluate(vector.getX(), vector.getY(), vector.getZ()) > 0; + } else { + return expression.evaluate(new double[]{vector.getX(), vector.getY(), vector.getZ()}, + timeout.getAsInt()) > 0; + } } catch (EvaluationException e) { return false; } @@ -75,7 +87,7 @@ public class ExpressionMask extends AbstractMask { @Nullable @Override public Mask2D toMask2D() { - return new ExpressionMask2D(expression); + return new ExpressionMask2D(expression, timeout); } } 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 ffc6c9a94..0f4d9b198 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 @@ -21,14 +21,19 @@ package com.sk89q.worldedit.function.mask; import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; import com.sk89q.worldedit.math.BlockVector2; +import javax.annotation.Nullable; +import java.util.function.IntSupplier; + public class ExpressionMask2D extends AbstractMask2D { private final Expression expression; + private final IntSupplier timeout; /** * Create a new instance. @@ -37,8 +42,7 @@ public class ExpressionMask2D extends AbstractMask2D { * @throws ExpressionException thrown if there is an error with the expression */ public ExpressionMask2D(String expression) throws ExpressionException { - checkNotNull(expression); - this.expression = Expression.compile(expression, "x", "z"); + this(Expression.compile(checkNotNull(expression), "x", "z")); } /** @@ -47,14 +51,23 @@ public class ExpressionMask2D extends AbstractMask2D { * @param expression the expression */ public ExpressionMask2D(Expression expression) { + this(expression, null); + } + + public ExpressionMask2D(Expression expression, @Nullable IntSupplier timeout) { checkNotNull(expression); this.expression = expression; + this.timeout = timeout; } @Override public boolean test(BlockVector2 vector) { try { - return expression.evaluate(vector.getX(), 0, vector.getZ()) > 0; + if (timeout != null) { + return expression.evaluate(vector.getX(), 0, vector.getZ()) > 0; + } else { + return expression.evaluate(new double[]{vector.getX(), 0, vector.getZ()}, timeout.getAsInt()) > 0; + } } catch (EvaluationException e) { return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java index ec774f088..944fd97d8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.internal.expression.parser.Parser; import com.sk89q.worldedit.internal.expression.runtime.Constant; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; +import com.sk89q.worldedit.internal.expression.runtime.ExpressionTimeoutException; import com.sk89q.worldedit.internal.expression.runtime.Functions; import com.sk89q.worldedit.internal.expression.runtime.RValue; import com.sk89q.worldedit.internal.expression.runtime.ReturnException; @@ -36,7 +37,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; -import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -117,6 +117,10 @@ public class Expression { } public double evaluate(double... values) throws EvaluationException { + return evaluate(values, WorldEdit.getInstance().getConfiguration().calculationTimeout); + } + + public double evaluate(double[] values, int timeout) throws EvaluationException { for (int i = 0; i < values.length; ++i) { final String variableName = variableNames[i]; final RValue invokable = variables.get(variableName); @@ -127,34 +131,44 @@ public class Expression { ((Variable) invokable).value = values[i]; } - Future result = evalThread.submit(new Callable() { - @Override - public Double call() throws Exception { - pushInstance(); - try { - return root.getValue(); - } finally { - popInstance(); - } - } - }); try { - return result.get(WorldEdit.getInstance().getConfiguration().calculationTimeout, TimeUnit.MILLISECONDS); + if (timeout < 0) { + return evaluateRoot(); + } + return evaluateRootTimed(timeout); + } catch (ReturnException e) { + return e.getValue(); + } // other evaluation exceptions are thrown out of this method + } + + private double evaluateRootTimed(int timeout) throws EvaluationException { + Future result = evalThread.submit(this::evaluateRoot); + try { + return result.get(timeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); + } catch (TimeoutException e) { + result.cancel(true); + throw new ExpressionTimeoutException("Calculations exceeded time limit."); } catch (ExecutionException e) { Throwable cause = e.getCause(); - if (cause instanceof ReturnException) { - return ((ReturnException) cause).getValue(); + if (cause instanceof EvaluationException) { + throw (EvaluationException) cause; } if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new RuntimeException(cause); - } catch (TimeoutException e) { - result.cancel(true); - throw new EvaluationException(-1, "Calculations exceeded time limit."); + } + } + + private Double evaluateRoot() throws EvaluationException { + pushInstance(); + try { + return root.getValue(); + } finally { + popInstance(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/ExpressionTimeoutException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/ExpressionTimeoutException.java new file mode 100644 index 000000000..ce7d55140 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/ExpressionTimeoutException.java @@ -0,0 +1,29 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.internal.expression.runtime; + +/** + * Thrown when an evaluation exceeds the timeout time. + */ +public class ExpressionTimeoutException extends EvaluationException { + public ExpressionTimeoutException(String message) { + super(-1, message); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index af4fe5e3e..1da0c58cc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -155,31 +155,20 @@ public class SessionManager { session.setConfiguration(config); session.setBlockChangeLimit(config.defaultChangeLimit); + session.setTimeout(config.calculationTimeout); // Remember the session regardless of if it's currently active or not. // And have the SessionTracker FLUSH inactive sessions. sessions.put(getKey(owner), new SessionHolder(sessionKey, session)); } - // Set the limit on the number of blocks that an operation can - // change at once, or don't if the owner has an override or there - // is no limit. There is also a default limit - int currentChangeLimit = session.getBlockChangeLimit(); - - if (!owner.hasPermission("worldedit.limit.unrestricted") && config.maxChangeLimit > -1) { - // If the default limit is infinite but there is a maximum - // limit, make sure to not have it be overridden - if (config.defaultChangeLimit < 0) { - if (currentChangeLimit < 0 || currentChangeLimit > config.maxChangeLimit) { - session.setBlockChangeLimit(config.maxChangeLimit); - } - } else { - // Bound the change limit - int maxChangeLimit = config.maxChangeLimit; - if (currentChangeLimit == -1 || currentChangeLimit > maxChangeLimit) { - session.setBlockChangeLimit(maxChangeLimit); - } - } + if (shouldBoundLimit(owner.hasPermission("worldedit.limit.unrestricted"), + session.getBlockChangeLimit(), config.maxChangeLimit)) { + session.setBlockChangeLimit(config.maxChangeLimit); + } + if (shouldBoundLimit(owner.hasPermission("worldedit.timeout.unrestricted"), + session.getTimeout(), config.maxCalculationTimeout)) { + session.setTimeout(config.maxCalculationTimeout); } // Have the session use inventory if it's enabled and the owner @@ -192,6 +181,13 @@ public class SessionManager { return session; } + private boolean shouldBoundLimit(boolean mayBypass, int currentLimit, int maxLimit) { + if (!mayBypass && maxLimit > -1) { // if player can't bypass and max is finite + return currentLimit < 0 || currentLimit > maxLimit; // make sure current is finite and less than max + } + return false; + } + /** * Save a map of sessions to disk. * 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 b9dc1cece..acc845914 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 @@ -112,6 +112,7 @@ public class PropertiesConfiguration extends LocalConfiguration { navigationUseGlass = getBool("nav-use-glass", navigationUseGlass); scriptTimeout = getInt("scripting-timeout", scriptTimeout); calculationTimeout = getInt("calculation-timeout", calculationTimeout); + maxCalculationTimeout = getInt("max-calculation-timeout", maxCalculationTimeout); saveDir = getString("schematic-save-dir", saveDir); scriptsDir = getString("craftscript-dir", scriptsDir); butcherDefaultRadius = getInt("butcher-default-radius", butcherDefaultRadius); 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 fcfa35fd6..10940bbd9 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 @@ -108,6 +108,7 @@ public class YAMLConfiguration extends LocalConfiguration { scriptsDir = config.getString("scripting.dir", scriptsDir); calculationTimeout = config.getInt("calculation.timeout", calculationTimeout); + maxCalculationTimeout = config.getInt("calculation.max-timeout", maxCalculationTimeout); saveDir = config.getString("saving.dir", saveDir); diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java index bdb91abc2..28ad67b37 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java @@ -64,7 +64,7 @@ public class ExpressionTest { assertEquals(atan2(3, 4), simpleEval("atan2(3, 4)"), 0); // check variables - assertEquals(8, compile("foo+bar", "foo", "bar").evaluate(5, 3), 0); + assertEquals(8, compile("foo+bar", "foo", "bar").evaluate(5D, 3D), 0); } @Test @@ -123,7 +123,7 @@ public class ExpressionTest { @Test public void testAssign() throws ExpressionException { Expression foo = compile("{a=x} b=y; c=z", "x", "y", "z", "a", "b", "c"); - foo.evaluate(2, 3, 5); + foo.evaluate(2D, 3D, 5D); assertEquals(2, foo.getVariable("a", false).getValue(), 0); assertEquals(3, foo.getVariable("b", false).getValue(), 0); assertEquals(5, foo.getVariable("c", false).getValue(), 0); @@ -136,13 +136,13 @@ public class ExpressionTest { // test 'dangling else' final Expression expression1 = compile("if (1) if (0) x=4; else y=5;", "x", "y"); - expression1.evaluate(1, 2); + expression1.evaluate(1D, 2D); assertEquals(1, expression1.getVariable("x", false).getValue(), 0); assertEquals(5, expression1.getVariable("y", false).getValue(), 0); // test if the if construct is correctly recognized as a statement final Expression expression2 = compile("if (0) if (1) x=5; y=4;", "x", "y"); - expression2.evaluate(1, 2); + expression2.evaluate(1D, 2D); assertEquals(4, expression2.getVariable("y", false).getValue(), 0); } From eebba8e324cea44632e33150495d6269fecb6ed0 Mon Sep 17 00:00:00 2001 From: wizjany Date: Thu, 7 Mar 2019 23:55:58 -0500 Subject: [PATCH 151/182] Move vault to permscompat. --- build.gradle | 1 - worldedit-bukkit/build.gradle | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 6b63f5caf..2c70494c0 100644 --- a/build.gradle +++ b/build.gradle @@ -100,7 +100,6 @@ subprojects { repositories { mavenCentral() - maven { url "http://repo.bukkit.org/content/groups/public" } maven { url "http://maven.sk89q.com/repo/" } maven { url "http://repo.maven.apache.org/maven2" } } diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index bd98623f8..8c2890bd3 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -6,16 +6,14 @@ repositories { maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } maven { url "https://repo.codemc.org/repository/maven-public" } maven { url 'https://papermc.io/repo/repository/maven-public/' } - maven { url "http://nexus.hc.to/content/repositories/pub_releases" } } dependencies { compile project(':worldedit-core') - compile 'com.sk89q:dummypermscompat:1.8' + compile 'com.sk89q:dummypermscompat:1.10' compile 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT' // zzz compile 'org.bstats:bstats-bukkit:1.4' compile "io.papermc:paperlib:1.0.1" - compileOnly "net.milkbowl.vault:VaultAPI:1.7" testCompile 'org.mockito:mockito-core:1.9.0-rc1' } From 7c89ece96e3ce5f6ad574c0dd6d0af0610072f2c Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 8 Mar 2019 16:00:42 -0500 Subject: [PATCH 152/182] Few tweaks to schematic loading and error fixes. * Not all EntityTypes in Bukkit have the correct enum name. * Don't read entire schematic files to list. Go off file extension only. (Reading in files is more accurate, but slow.) * Enforce extensions. (Due to the above, while you can technically make a schematic called 'test.txt', it's better that we save it as 'test.txt.schem'.) * Fix a few minor warnings. --- .../worldedit/bukkit/WorldEditPlugin.java | 5 ++++- .../java/com/sk89q/worldedit/WorldEdit.java | 22 ++++++++++++------- .../worldedit/command/SchematicCommands.java | 19 ++++++++++++---- .../clipboard/io/NBTSchematicReader.java | 4 +--- .../clipboard/io/SpongeSchematicReader.java | 8 +++---- 5 files changed, 38 insertions(+), 20 deletions(-) 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 640e07338..d09578472 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 @@ -160,7 +160,10 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { } // Entity for (org.bukkit.entity.EntityType entityType : org.bukkit.entity.EntityType.values()) { - EntityType.REGISTRY.register("minecraft:" + entityType.name().toLowerCase(), new EntityType("minecraft:" + entityType.name().toLowerCase())); + String mcid = entityType.getName(); + if (mcid != null) { + EntityType.REGISTRY.register("minecraft:" + mcid.toLowerCase(), new EntityType("minecraft:" + mcid.toLowerCase())); + } } // Tags try { 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 3b3130180..d9a9c6ddc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -67,6 +67,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -90,11 +91,11 @@ import javax.script.ScriptException; * method {@link WorldEdit#getInstance()}, which is shared among all * platforms within the same classloader hierarchy.

    */ -public class WorldEdit { +public final class WorldEdit { public static final Logger logger = Logger.getLogger(WorldEdit.class.getCanonicalName()); - private final static WorldEdit instance = new WorldEdit(); + private static final WorldEdit instance = new WorldEdit(); private static String version; private final EventBus eventBus = new EventBus(); @@ -274,14 +275,15 @@ public class WorldEdit { } } else { List exts = extensions == null ? ImmutableList.of(defaultExt) : Lists.asList(defaultExt, extensions); - return getSafeFileWithExtensions(dir, filename, exts, isSave); + f = getSafeFileWithExtensions(dir, filename, exts, isSave); } try { String filePath = f.getCanonicalPath(); String dirPath = dir.getCanonicalPath(); - if (!filePath.substring(0, dirPath.length()).equals(dirPath) && !getConfiguration().allowSymlinks) { + if ((filePath.length() < dirPath.length() || !filePath.substring(0, dirPath.length()).equals(dirPath)) + && !getConfiguration().allowSymlinks) { throw new FilenameResolutionException(filename, "Path is outside allowable root"); } @@ -301,7 +303,7 @@ public class WorldEdit { } } File result = null; - for (Iterator iter = exts.iterator(); iter.hasNext() && (result == null || !result.exists());) { + for (Iterator iter = exts.iterator(); iter.hasNext() && (result == null || (!isSave && !result.exists()));) { result = getSafeFileWithExtension(dir, filename, iter.next()); } if (result == null) { @@ -311,8 +313,12 @@ public class WorldEdit { } private File getSafeFileWithExtension(File dir, String filename, String extension) { - if (extension != null && filename.lastIndexOf('.') == -1) { - filename += "." + extension; + if (extension != null) { + int dot = filename.lastIndexOf('.'); + if (dot < 0 || !filename.substring(dot).equalsIgnoreCase(extension)) + { + filename += "." + extension; + } } if (!checkFilename(filename)) { @@ -618,7 +624,7 @@ public class WorldEdit { byte[] data = new byte[in.available()]; in.readFully(data); in.close(); - script = new String(data, 0, data.length, "utf-8"); + script = new String(data, 0, data.length, StandardCharsets.UTF_8); } catch (IOException e) { player.printError("Script read error: " + e.getMessage()); return; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index bb5ecba27..cd7da8081 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -21,6 +21,8 @@ package com.sk89q.worldedit.command; import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.collect.Multimap; +import com.google.common.io.Files; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandException; @@ -196,7 +198,7 @@ public class SchematicCommands { String filename = args.getString(0); File dir = worldEdit.getWorkingDirectoryFile(config.saveDir); - File f = worldEdit.getSafeSaveFile(player, dir, filename, "schematic", "schematic"); + File f = worldEdit.getSafeOpenFile(player, dir, filename, "schematic", ClipboardFormats.getFileExtensionArray()); if (!f.exists()) { player.printError("Schematic " + filename + " does not exist!"); @@ -209,6 +211,11 @@ public class SchematicCommands { } player.print(filename + " has been deleted."); + try { + log.info(player.getName() + " deleted " + f.getCanonicalPath()); + } catch (IOException e) { + log.info(player.getName() + " deleted " + f.getAbsolutePath()); + } } @Command( @@ -245,7 +252,8 @@ public class SchematicCommands { help = "List all schematics in the schematics directory\n" + " -d sorts by date, oldest first\n" + " -n sorts by date, newest first\n" + - " -p prints the requested page\n" + " -p prints the requested page\n" + + "Note: Format is not thoroughly verified until loading." ) @CommandPermissions("worldedit.schematic.list") public void list(Actor actor, CommandContext args, @Switch('p') @Optional("1") int page) throws WorldEditException { @@ -328,10 +336,13 @@ public class SchematicCommands { StringBuilder build = new StringBuilder(); build.append("\u00a72"); - ClipboardFormat format = ClipboardFormats.findByFile(file); + //ClipboardFormat format = ClipboardFormats.findByFile(file); + Multimap exts = ClipboardFormats.getFileExtensionMap(); + ClipboardFormat format = exts.get(Files.getFileExtension(file.getName())) + .stream().findFirst().orElse(null); boolean inRoot = file.getParentFile().getName().equals(prefix); build.append(inRoot ? file.getName() : file.getPath().split(Pattern.quote(prefix + File.separator))[1]) - .append(": ").append(format == null ? "Unknown" : format.getName()); + .append(": ").append(format == null ? "Unknown" : format.getName() + "*"); result.add(build.toString()); } return result; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java index 424dffcc6..12f1f1b41 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java @@ -46,9 +46,7 @@ public abstract class NBTSchematicReader implements ClipboardReader { } @Nullable - protected static T getTag(CompoundTag tag, Class expected, String key) { - Map items = tag.getValue(); - + protected static T getTag(Map items, String key, Class expected) { if (!items.containsKey(key)) { return null; } 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 42dfea813..9714fc0de 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 @@ -88,16 +88,16 @@ public class SpongeSchematicReader extends NBTSchematicReader { int version = requireTag(schematic, "Version", IntTag.class).getValue(); switch (version) { case 1: - return readVersion1(schematic); + return readVersion1(schematicTag); default: throw new IOException("This schematic version is currently not supported"); } } - private Clipboard readVersion1(Map schematic) throws IOException { + private Clipboard readVersion1(CompoundTag schematicTag) throws IOException { BlockVector3 origin; Region region; - + Map schematic = schematicTag.getValue(); Map metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue(); int width = requireTag(schematic, "Width", ShortTag.class).getValue(); @@ -143,7 +143,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { try { state = WorldEdit.getInstance().getBlockFactory().parseFromInput(palettePart, parserContext).toImmutableState(); } catch (InputParseException e) { - throw new IOException("Invalid BlockState in schematic: " + palettePart + ". Are you missing a mod of using a schematic made in a newer version of Minecraft?"); + throw new IOException("Invalid BlockState in schematic: " + palettePart + ". Are you missing a mod or using a schematic made in a newer version of Minecraft?"); } palette.put(id, state); } From a22b5535fea93ce6dbb053ff30ba43c40e09f489 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 8 Mar 2019 16:14:16 -0500 Subject: [PATCH 153/182] Shh checkstyle, I'm a C# dev now. --- .../src/main/java/com/sk89q/worldedit/WorldEdit.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 d9a9c6ddc..be68eff6e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -315,8 +315,7 @@ public final class WorldEdit { private File getSafeFileWithExtension(File dir, String filename, String extension) { if (extension != null) { int dot = filename.lastIndexOf('.'); - if (dot < 0 || !filename.substring(dot).equalsIgnoreCase(extension)) - { + if (dot < 0 || !filename.substring(dot).equalsIgnoreCase(extension)) { filename += "." + extension; } } From 6937cfc9a9c9e4e9b84fc9d5b37d9ea55cb4631e Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 9 Mar 2019 10:46:40 -0500 Subject: [PATCH 154/182] Need internal ID for EntityType here too. --- .../src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e6b290125..c76c854d3 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 @@ -334,7 +334,7 @@ public class BukkitAdapter { * @return WorldEdit EntityType */ public static EntityType adapt(org.bukkit.entity.EntityType entityType) { - return EntityTypes.get(entityType.name().toLowerCase()); + return EntityTypes.get(entityType.getName().toLowerCase()); } public static org.bukkit.entity.EntityType adapt(EntityType entityType) { From 6192ba8dc16beee21a3d4b00f99c7ce590a7ee2f Mon Sep 17 00:00:00 2001 From: wizjany Date: Mon, 11 Mar 2019 00:02:51 -0400 Subject: [PATCH 155/182] Checkstyle fixes and warnings. Should get 'working' builds now. --- config/checkstyle/checkstyle.xml | 3 ++- config/checkstyle/import-control.xml | 1 + .../sk89q/worldedit/forge/CommandWrapper.java | 10 +++------- .../worldedit/forge/gui/GuiReferenceCard.java | 7 ++++--- .../net/handler/InternalPacketHandler.java | 15 +++++++++------ .../forge/net/handler/WECUIPacketHandler.java | 18 +++++++++++------- .../net/packet/LeftClickAirEventMessage.java | 14 +++++++------- 7 files changed, 37 insertions(+), 31 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 7872f45bc..a2d043d73 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -5,8 +5,9 @@ - + + diff --git a/config/checkstyle/import-control.xml b/config/checkstyle/import-control.xml index eedd07857..9cc735070 100644 --- a/config/checkstyle/import-control.xml +++ b/config/checkstyle/import-control.xml @@ -53,6 +53,7 @@ + diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java index b070d2a6c..6089040be 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java @@ -24,12 +24,7 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.brigadier.tree.CommandNode; import com.mojang.brigadier.tree.LiteralCommandNode; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.Parameter; import net.minecraft.command.CommandSource; @@ -38,11 +33,12 @@ import net.minecraft.entity.player.EntityPlayerMP; import java.util.LinkedList; import java.util.function.Predicate; -import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer; import static net.minecraft.command.Commands.argument; import static net.minecraft.command.Commands.literal; -public class CommandWrapper { +public final class CommandWrapper { + private CommandWrapper() { + } public static void register(CommandDispatcher dispatcher, CommandMapping command) { LiteralArgumentBuilder base = literal(command.getPrimaryAlias()); diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java index 23e0bb90c..d15642934 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java @@ -33,10 +33,11 @@ public class GuiReferenceCard extends GuiScreen { @Override public void initGui() { - this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2, (this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close") { + this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2, + (this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close") { @Override - public void onClick(double p_194829_1_, double p_194829_3_) { - super.onClick(p_194829_1_, p_194829_3_); + public void onClick(double mouseX, double mouseY) { + super.onClick(mouseX, mouseY); mc.player.closeScreen(); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/InternalPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/InternalPacketHandler.java index 5af96dd61..17b81a852 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/InternalPacketHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/InternalPacketHandler.java @@ -21,22 +21,25 @@ package com.sk89q.worldedit.forge.net.handler; import com.sk89q.worldedit.forge.ForgeWorldEdit; import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage; +import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage.Handler; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.network.NetworkRegistry; +import net.minecraftforge.fml.network.NetworkRegistry.ChannelBuilder; import net.minecraftforge.fml.network.simple.SimpleChannel; -public class InternalPacketHandler { +public final class InternalPacketHandler { private static final String PROTOCOL_VERSION = Integer.toString(1); - public static SimpleChannel HANDLER = NetworkRegistry.ChannelBuilder + public static SimpleChannel HANDLER = ChannelBuilder .named(new ResourceLocation(ForgeWorldEdit.MOD_ID, "internal")) .clientAcceptedVersions(PROTOCOL_VERSION::equals) .serverAcceptedVersions(PROTOCOL_VERSION::equals) .networkProtocolVersion(() -> PROTOCOL_VERSION) .simpleChannel(); - public static void init() { - int disc = 0; + private InternalPacketHandler() { + } - HANDLER.registerMessage(disc++, LeftClickAirEventMessage.class, LeftClickAirEventMessage::encode, LeftClickAirEventMessage::decode, LeftClickAirEventMessage.Handler::handle); + public static void init() { + HANDLER.registerMessage(0, LeftClickAirEventMessage.class, + LeftClickAirEventMessage::encode, LeftClickAirEventMessage::decode, Handler::handle); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java index c03218b01..541577e1f 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/handler/WECUIPacketHandler.java @@ -26,18 +26,22 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.ThreadQuickExitException; import net.minecraft.network.play.server.SPacketCustomPayload; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.network.NetworkEvent; -import net.minecraftforge.fml.network.NetworkRegistry; +import net.minecraftforge.fml.network.NetworkEvent.ClientCustomPayloadEvent; +import net.minecraftforge.fml.network.NetworkEvent.ServerCustomPayloadEvent; +import net.minecraftforge.fml.network.NetworkRegistry.ChannelBuilder; import net.minecraftforge.fml.network.event.EventNetworkChannel; import java.nio.charset.Charset; import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer; -public class WECUIPacketHandler { +public final class WECUIPacketHandler { + private WECUIPacketHandler() { + } + public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); private static final String PROTOCOL_VERSION = Integer.toString(1); - public static EventNetworkChannel HANDLER = NetworkRegistry.ChannelBuilder + public static EventNetworkChannel HANDLER = ChannelBuilder .named(new ResourceLocation(ForgeWorldEdit.MOD_ID, ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) .clientAcceptedVersions(PROTOCOL_VERSION::equals) .serverAcceptedVersions(PROTOCOL_VERSION::equals) @@ -49,7 +53,7 @@ public class WECUIPacketHandler { HANDLER.addListener(WECUIPacketHandler::callProcessPacket); } - public static void onPacketData(NetworkEvent.ServerCustomPayloadEvent event) { + public static void onPacketData(ServerCustomPayloadEvent event) { EntityPlayerMP player = event.getSource().get().getSender(); LocalSession session = ForgeWorldEdit.inst.getSession(player); @@ -62,13 +66,13 @@ public class WECUIPacketHandler { session.describeCUI(adaptPlayer(player)); } - public static void callProcessPacket(NetworkEvent.ClientCustomPayloadEvent event) { + public static void callProcessPacket(ClientCustomPayloadEvent event) { try { new SPacketCustomPayload( new ResourceLocation(ForgeWorldEdit.MOD_ID, ForgeWorldEdit.CUI_PLUGIN_CHANNEL), event.getPayload() ).processPacket(Minecraft.getInstance().player.connection); - } catch (ThreadQuickExitException suppress) { + } catch (ThreadQuickExitException ignored) { } } } \ No newline at end of file diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/packet/LeftClickAirEventMessage.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/packet/LeftClickAirEventMessage.java index 9d983848c..e5e5d8cdc 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/packet/LeftClickAirEventMessage.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/packet/LeftClickAirEventMessage.java @@ -22,20 +22,20 @@ package com.sk89q.worldedit.forge.net.packet; import com.sk89q.worldedit.forge.ForgeWorldEdit; import io.netty.buffer.ByteBuf; import net.minecraft.network.PacketBuffer; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty; +import net.minecraftforge.fml.network.NetworkEvent.Context; +import java.util.Objects; import java.util.function.Supplier; +@SuppressWarnings({"NonFinalUtilityClass", "checkstyle:hideutilityclassconstructor"}) public class LeftClickAirEventMessage { public static final class Handler { - - public static void handle(final LeftClickAirEventMessage message, Supplier ctx) { - NetworkEvent.Context context = ctx.get(); - context.enqueueWork(() -> ForgeWorldEdit.inst.onPlayerInteract(new PlayerInteractEvent.LeftClickEmpty(context.getSender()))); + public static void handle(final LeftClickAirEventMessage message, Supplier ctx) { + Context context = ctx.get(); + context.enqueueWork(() -> ForgeWorldEdit.inst.onPlayerInteract(new LeftClickEmpty(Objects.requireNonNull(context.getSender())))); } - } public static LeftClickAirEventMessage decode(ByteBuf buf) { From a59d994d84fde12763bbed88fb11bbf2de8780db Mon Sep 17 00:00:00 2001 From: wizjany Date: Mon, 11 Mar 2019 00:15:21 -0400 Subject: [PATCH 156/182] Hook up the biome registry. --- .../com/sk89q/worldedit/world/registry/legacy.json | 2 +- .../java/com/sk89q/worldedit/forge/ForgeWorldEdit.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json index 4bc2907a2..ec4c09040 100644 --- a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json @@ -1785,7 +1785,7 @@ "48:0": "minecraft:mossy_cobblestone", "49:0": "minecraft:obsidian", "50:0": "minecraft:torch", - "52:0": "minecraft:mob_spawner", + "52:0": "minecraft:spawner", "53:0": "minecraft:oak_stairs", "54:0": "minecraft:chest", "56:0": "minecraft:diamond_ore", diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index b5a80a36b..9793c6381 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -33,6 +33,7 @@ import com.sk89q.worldedit.forge.net.handler.InternalPacketHandler; import com.sk89q.worldedit.forge.net.handler.WECUIPacketHandler; import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.entity.EntityType; @@ -186,6 +187,12 @@ public class ForgeWorldEdit { EntityType.REGISTRY.register(name.toString(), new EntityType(name.toString())); } } + // Biomes + for (ResourceLocation name : ForgeRegistries.BIOMES.getKeys()) { + if (BiomeType.REGISTRY.get(name.toString()) == null) { + BiomeType.REGISTRY.register(name.toString(), new BiomeType(name.toString())); + } + } // Tags for (ResourceLocation name : BlockTags.getCollection().getRegisteredTags()) { if (BlockCategory.REGISTRY.get(name.toString()) == null) { From 6e24472af5053b1245f4b367b9eb51c1ad851cc3 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 11 Mar 2019 22:45:41 +1000 Subject: [PATCH 157/182] Bump to latest forge and cleanup some old files. --- .travis.yml | 1 - worldedit-forge/build.gradle | 4 +- worldedit-forge/src/main/ant/build.xml | 150 ------------------ .../sk89q/worldedit/forge/ForgeWorldEdit.java | 4 - 4 files changed, 2 insertions(+), 157 deletions(-) delete mode 100644 worldedit-forge/src/main/ant/build.xml diff --git a/.travis.yml b/.travis.yml index f8b8492f7..1c581a696 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: java notifications: email: false before_install: chmod +x gradlew -install: ./gradlew setupCIWorkspace -s script: ./gradlew build -s jdk: - oraclejdk8 diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 536739a5c..e9dff30ae 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -14,7 +14,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle' def minecraftVersion = "1.13.2" -def forgeVersion = "25.0.70" +def forgeVersion = "25.0.76" dependencies { compile project(':worldedit-core') @@ -28,7 +28,7 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 minecraft { - mappings channel: 'snapshot', version: '20190217-1.13.1' + mappings channel: 'snapshot', version: '20190311-1.13.2' runs { client = { diff --git a/worldedit-forge/src/main/ant/build.xml b/worldedit-forge/src/main/ant/build.xml deleted file mode 100644 index 5753b52ce..000000000 --- a/worldedit-forge/src/main/ant/build.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 9793c6381..07bf6c4d9 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit.forge; import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer; -import com.google.common.base.Joiner; import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.sk89q.worldedit.LocalSession; @@ -57,16 +56,13 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.SidedProvider; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; import net.minecraftforge.fml.event.server.FMLServerStartedEvent; import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fml.loading.FMLCommonLaunchHandler; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.registries.ForgeRegistries; From 1c5d3368a0ec42023357c6496c76d599e736a333 Mon Sep 17 00:00:00 2001 From: wizjany Date: Mon, 11 Mar 2019 20:37:35 -0400 Subject: [PATCH 158/182] Defer permissions check when making LocalSession. Also use Java7 Paths to get rid of some funky logic. --- .../main/java/com/sk89q/worldedit/WorldEdit.java | 16 ++++++++-------- .../sk89q/worldedit/session/SessionManager.java | 13 ++++++------- 2 files changed, 14 insertions(+), 15 deletions(-) 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 be68eff6e..8dbd65389 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -68,6 +68,8 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -279,19 +281,17 @@ public final class WorldEdit { } try { - String filePath = f.getCanonicalPath(); - String dirPath = dir.getCanonicalPath(); + Path filePath = Paths.get(f.toURI()).normalize(); + Path dirPath = Paths.get(dir.toURI()).normalize(); - if ((filePath.length() < dirPath.length() || !filePath.substring(0, dirPath.length()).equals(dirPath)) - && !getConfiguration().allowSymlinks) { - throw new FilenameResolutionException(filename, - "Path is outside allowable root"); + if (!filePath.startsWith(dirPath) + || (!getConfiguration().allowSymlinks && !filePath.toRealPath().startsWith(dirPath))) { + throw new FilenameResolutionException(filename, "Path is outside allowable root"); } return f; } catch (IOException e) { - throw new FilenameResolutionException(filename, - "Failed to resolve path"); + throw new FilenameResolutionException(filename, "Failed to resolve path"); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index 1da0c58cc..a1dd4d60a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -162,12 +162,10 @@ public class SessionManager { sessions.put(getKey(owner), new SessionHolder(sessionKey, session)); } - if (shouldBoundLimit(owner.hasPermission("worldedit.limit.unrestricted"), - session.getBlockChangeLimit(), config.maxChangeLimit)) { + if (shouldBoundLimit(owner, "worldedit.limit.unrestricted", session.getBlockChangeLimit(), config.maxChangeLimit)) { session.setBlockChangeLimit(config.maxChangeLimit); } - if (shouldBoundLimit(owner.hasPermission("worldedit.timeout.unrestricted"), - session.getTimeout(), config.maxCalculationTimeout)) { + if (shouldBoundLimit(owner, "worldedit.timeout.unrestricted", session.getTimeout(), config.maxCalculationTimeout)) { session.setTimeout(config.maxCalculationTimeout); } @@ -181,9 +179,10 @@ public class SessionManager { return session; } - private boolean shouldBoundLimit(boolean mayBypass, int currentLimit, int maxLimit) { - if (!mayBypass && maxLimit > -1) { // if player can't bypass and max is finite - return currentLimit < 0 || currentLimit > maxLimit; // make sure current is finite and less than max + private boolean shouldBoundLimit(SessionOwner owner, String permission, int currentLimit, int maxLimit) { + if (maxLimit > -1) { // if max is finite + return (currentLimit < 0 || currentLimit > maxLimit) // make sure current is finite and less than max + && !owner.hasPermission(permission); // unless user has unlimited permission } return false; } From 4f0506ec8b930f2c1ea9e58c6c3d9d0f35a673eb Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 12 Mar 2019 17:30:45 -0400 Subject: [PATCH 159/182] Fix versions in toml. Use internalversion (with git hash). --- worldedit-forge/build.gradle | 11 +++++------ worldedit-forge/src/main/resources/META-INF/mods.toml | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index e9dff30ae..6666d74c4 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -56,21 +56,20 @@ project.archivesBaseName = "${project.archivesBaseName}-mc${minecraftVersion}" processResources { // this will ensure that this task is redone when the versions change. - inputs.property 'version', project.version - inputs.property 'mcversion', minecraftVersion - inputs.property 'internalVersion', internalVersion + inputs.property 'version', project.internalVersion + inputs.property 'forgeVersion', forgeVersion // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { - include 'META_INF/mods.toml' + include 'META-INF/mods.toml' // replace version and mcversion - expand 'version':project.version, 'mcversion': minecraftVersion, 'internalVersion': internalVersion + expand 'version': project.internalVersion, 'forgeVersion': forgeVersion } // copy everything else except the mcmod.info from(sourceSets.main.resources.srcDirs) { - exclude 'META_INF/mods.toml' + exclude 'META-INF/mods.toml' } } diff --git a/worldedit-forge/src/main/resources/META-INF/mods.toml b/worldedit-forge/src/main/resources/META-INF/mods.toml index c89f9c261..07b5ff1a0 100644 --- a/worldedit-forge/src/main/resources/META-INF/mods.toml +++ b/worldedit-forge/src/main/resources/META-INF/mods.toml @@ -3,7 +3,7 @@ modLoader="javafml" # A version range to match for said mod loader - for regular FML @Mod it will be the minecraft version (without the 1.) loaderVersion="[24,)" # A URL to refer people to when problems occur with this mod -issueTrackerURL="https://discord.gg/YKbmj7V" +issueTrackerURL="https://discord.gg/enginehub" # A URL for the "homepage" for this mod, displayed in the mod UI displayURL="http://wiki.sk89q.com/wiki/WorldEdit/" # A file name (in the root of the mod JAR) containing a logo for display @@ -25,7 +25,7 @@ WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both [[dependencies.worldedit]] modId="forge" mandatory=true - versionRange="[${forge_version},)" + versionRange="[${forgeVersion},)" ordering="NONE" side="BOTH" [[dependencies.worldedit]] From 4191f017f1dd8a7d28d2f9127d1623c17a18f5bb Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 13 Mar 2019 18:54:23 -0700 Subject: [PATCH 160/182] [Forge] Fix sub-commands by registering even less --- .../sk89q/worldedit/forge/CommandWrapper.java | 79 ++----------------- 1 file changed, 5 insertions(+), 74 deletions(-) diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java index 6089040be..daab12824 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java @@ -21,19 +21,14 @@ package com.sk89q.worldedit.forge; import com.mojang.brigadier.Command; import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.tree.LiteralCommandNode; import com.sk89q.worldedit.util.command.CommandMapping; -import com.sk89q.worldedit.util.command.Parameter; import net.minecraft.command.CommandSource; import net.minecraft.entity.player.EntityPlayerMP; -import java.util.LinkedList; import java.util.function.Predicate; -import static net.minecraft.command.Commands.argument; import static net.minecraft.command.Commands.literal; public final class CommandWrapper { @@ -41,78 +36,14 @@ public final class CommandWrapper { } public static void register(CommandDispatcher dispatcher, CommandMapping command) { - LiteralArgumentBuilder base = literal(command.getPrimaryAlias()); - LinkedList> parameterStack = new LinkedList<>(); - LinkedList> optionalParameterStack = new LinkedList<>(); - boolean hasFlag = false; - for (Parameter parameter : command.getDescription().getParameters()) { - if (parameter.isValueFlag()) { - if (!hasFlag) { - hasFlag = true; - optionalParameterStack.push(argument("flags", StringArgumentType.string())); - } - } else if (parameter.isOptional()) { - optionalParameterStack.push(argument(parameter.getName(), StringArgumentType.string())); - } else { - parameterStack.push(argument(parameter.getName(), StringArgumentType.string())); - } - } - - ArgumentBuilder argument = buildChildNodes(parameterStack, optionalParameterStack, command); - if (argument != null) { - base.then(argument); - } else { - base.executes(commandFor(command)); - } - LiteralCommandNode registered = - dispatcher.register( - base.requires(requirementsFor(command)) - ); for (String alias : command.getAllAliases()) { - dispatcher.register( - literal(alias).redirect(registered) - ); - } - } - - /** - * Make the appropriate {@code then()} and {@code execute()} calls to emulate required and - * optional parameters, given the argument orders. - * - * @param parameterStack required parameters - * @param optionalParameterStack optional parameters - * @return the node with all calls chained - */ - private static ArgumentBuilder buildChildNodes(LinkedList> parameterStack, - LinkedList> optionalParameterStack, - CommandMapping mapping) { - ArgumentBuilder currentChild = null; - Command command = commandFor(mapping); - while (!optionalParameterStack.isEmpty()) { - ArgumentBuilder next = optionalParameterStack.removeLast(); - if (currentChild != null) { - next.then(currentChild.executes(command)); + LiteralArgumentBuilder base = literal(alias) + .executes(FAKE_COMMAND); + if (command.getDescription().getPermissions().size() > 0) { + base.requires(requirementsFor(command)); } - currentChild = next; + dispatcher.register(base); } - boolean requiredExecute = false; - while (!parameterStack.isEmpty()) { - ArgumentBuilder next = parameterStack.removeLast(); - if (currentChild != null) { - next.then(currentChild); - } - if (!requiredExecute) { - // first required parameter also gets execute - requiredExecute = true; - next.executes(command); - } - currentChild = next; - } - return currentChild; - } - - private static Command commandFor(CommandMapping mapping) { - return FAKE_COMMAND; } public static final Command FAKE_COMMAND = ctx -> { From d6804737cf2ad084e052a774438c9a8885731986 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 13 Mar 2019 19:51:48 -0700 Subject: [PATCH 161/182] Switch to SLF4J logging. --- config/checkstyle/import-control.xml | 1 + worldedit-bukkit/build.gradle | 1 + .../wepif/FlatFilePermissionsResolver.java | 10 ++-- .../sk89q/wepif/NijiPermissionsResolver.java | 15 +++-- .../wepif/PermissionsResolverManager.java | 14 ++--- .../bukkit/BukkitCommandInspector.java | 14 ++--- .../worldedit/bukkit/BukkitConfiguration.java | 3 +- .../sk89q/worldedit/bukkit/BukkitWorld.java | 20 +++---- .../worldedit/bukkit/WorldEditPlugin.java | 20 +++---- .../bukkit/adapter/BukkitImplLoader.java | 16 ++--- worldedit-core/build.gradle | 1 + .../util/commands/CommandsManager.java | 10 ++-- .../util/commands/SimpleInjector.java | 9 +-- .../java/com/sk89q/worldedit/EditSession.java | 23 ++++---- .../com/sk89q/worldedit/LocalSession.java | 7 +-- .../sk89q/worldedit/TracedEditSession.java | 8 +-- .../java/com/sk89q/worldedit/WorldEdit.java | 21 +++---- .../worldedit/command/SchematicCommands.java | 14 ++--- .../worldedit/command/SnapshotCommands.java | 6 +- .../command/SnapshotUtilCommands.java | 11 ++-- .../extension/platform/CommandManager.java | 26 ++++---- .../extension/platform/PlatformManager.java | 17 +++--- .../extent/clipboard/io/ClipboardFormats.java | 7 +-- .../clipboard/io/MCEditSchematicReader.java | 18 +++--- .../clipboard/io/SpongeSchematicReader.java | 9 +-- .../command/CommandLoggingHandler.java | 4 +- .../ReparametrisingInterpolation.java | 11 ++-- .../worldedit/session/SessionManager.java | 15 +++-- .../session/storage/JsonFileSessionStore.java | 16 ++--- .../util/PropertiesConfiguration.java | 10 ++-- .../worldedit/util/YAMLConfiguration.java | 5 +- .../worldedit/util/eventbus/EventBus.java | 13 ++-- .../com/sk89q/worldedit/util/io/Closer.java | 12 ++-- .../util/logging/WorldEditPrefixHandler.java | 59 ------------------- .../util/paste/ActorCallbackPaste.java | 8 +-- .../util/report/ShallowObjectReport.java | 9 +-- .../worldedit/world/block/BlockState.java | 2 +- .../worldedit/world/chunk/AnvilChunk.java | 5 +- .../sk89q/worldedit/world/chunk/OldChunk.java | 2 +- .../world/registry/BundledBlockData.java | 11 ++-- .../world/registry/BundledItemData.java | 11 ++-- .../world/registry/LegacyMapper.java | 15 +++-- .../worldedit/world/snapshot/Snapshot.java | 5 +- .../util/commands/CommandContextTest.java | 34 +++++------ worldedit-forge/build.gradle | 1 + .../sponge/adapter/SpongeImplLoader.java | 16 ++--- 46 files changed, 247 insertions(+), 318 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/WorldEditPrefixHandler.java diff --git a/config/checkstyle/import-control.xml b/config/checkstyle/import-control.xml index 9cc735070..28ccad1e4 100644 --- a/config/checkstyle/import-control.xml +++ b/config/checkstyle/import-control.xml @@ -15,6 +15,7 @@ + diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 8c2890bd3..944956fa8 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -14,6 +14,7 @@ dependencies { compile 'org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT' // zzz compile 'org.bstats:bstats-bukkit:1.4' compile "io.papermc:paperlib:1.0.1" + compile 'org.slf4j:slf4j-jdk14:1.7.26' testCompile 'org.mockito:mockito-core:1.9.0-rc1' } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java index 3f2324596..9b5229cf3 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java @@ -22,6 +22,8 @@ package com.sk89q.wepif; import com.sk89q.util.yaml.YAMLProcessor; import org.bukkit.OfflinePlayer; import org.bukkit.Server; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.File; @@ -32,12 +34,10 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; public class FlatFilePermissionsResolver implements PermissionsResolver { - private static final Logger log = Logger.getLogger(FlatFilePermissionsResolver.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(FlatFilePermissionsResolver.class); private Map> userPermissionsCache; private Set defaultPermissionsCache; @@ -98,7 +98,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver { } } } catch (IOException e) { - log.log(Level.WARNING, "Failed to load permissions", e); + log.warn("Failed to load permissions", e); } finally { try { if (buff != null) { @@ -164,7 +164,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver { } } } catch (IOException e) { - log.log(Level.WARNING, "Failed to load permissions", e); + log.warn("Failed to load permissions", e); } finally { try { if (buff != null) { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/NijiPermissionsResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/NijiPermissionsResolver.java index fe23bfa46..ef12e2ff4 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/NijiPermissionsResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/NijiPermissionsResolver.java @@ -28,13 +28,12 @@ import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; - -import java.util.logging.Level; -import java.util.logging.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class NijiPermissionsResolver implements PermissionsResolver { - private static final Logger log = Logger.getLogger(NijiPermissionsResolver.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(NijiPermissionsResolver.class); private Server server; private Permissions api; @@ -84,7 +83,7 @@ public class NijiPermissionsResolver implements PermissionsResolver { return api.Security.permission(player, permission); } } catch (Throwable t) { - log.log(Level.WARNING, "Failed to check permissions", t); + log.warn("Failed to check permissions", t); return false; } } @@ -98,7 +97,7 @@ public class NijiPermissionsResolver implements PermissionsResolver { return api.getHandler().has(server.getPlayerExact(name), permission); } } catch (Throwable t) { - log.log(Level.WARNING, "Failed to check permissions", t); + log.warn("Failed to check permissions", t); return false; } } @@ -115,7 +114,7 @@ public class NijiPermissionsResolver implements PermissionsResolver { return api.Security.inGroup(name, group); } } catch (Throwable t) { - log.log(Level.WARNING, "Failed to check groups", t); + log.warn("Failed to check groups", t); return false; } } @@ -139,7 +138,7 @@ public class NijiPermissionsResolver implements PermissionsResolver { return groups; } } catch (Throwable t) { - log.log(Level.WARNING, "Failed to get groups", t); + log.warn("Failed to get groups", t); return new String[0]; } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java index 4775d86c4..6514912a8 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java @@ -27,6 +27,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.plugin.Plugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; @@ -35,8 +37,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; public class PermissionsResolverManager implements PermissionsResolver { @@ -85,7 +85,7 @@ public class PermissionsResolverManager implements PermissionsResolver { private Server server; private PermissionsResolver permissionResolver; private YAMLProcessor config; - private Logger logger = Logger.getLogger(getClass().getCanonicalName()); + private Logger logger = LoggerFactory.getLogger(getClass()); private List> enabledResolvers = new ArrayList<>(); @SuppressWarnings("unchecked") @@ -119,7 +119,7 @@ public class PermissionsResolverManager implements PermissionsResolver { break; } } catch (Throwable e) { - logger.log(Level.WARNING, "Error in factory method for " + resolverClass.getSimpleName(), e); + logger.warn("Error in factory method for " + resolverClass.getSimpleName(), e); continue; } } @@ -195,14 +195,14 @@ public class PermissionsResolverManager implements PermissionsResolver { try { file.createNewFile(); } catch (IOException e) { - logger.log(Level.WARNING, "Failed to create new configuration file", e); + logger.warn("Failed to create new configuration file", e); } } config = new YAMLProcessor(file, false, YAMLFormat.EXTENDED); try { config.load(); } catch (IOException e) { - logger.log(Level.WARNING, "Error loading WEPIF configuration", e); + logger.warn("Error loading WEPIF configuration", e); } List keys = config.getKeys(null); config.setHeader(CONFIG_HEADER); @@ -232,7 +232,7 @@ public class PermissionsResolverManager implements PermissionsResolver { } catch (ClassNotFoundException e) {} if (next == null || !PermissionsResolver.class.isAssignableFrom(next)) { - logger.warning("WEPIF: Invalid or unknown class found in enabled resolvers: " + logger.warn("WEPIF: Invalid or unknown class found in enabled resolvers: " + nextName + ". Moving to disabled resolvers list."); i.remove(); disabledResolvers.add(nextName); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandInspector.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandInspector.java index b392c50ac..fa3f2917f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandInspector.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandInspector.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.bukkit; -import static com.google.common.base.Preconditions.checkNotNull; - import com.sk89q.bukkit.util.CommandInspector; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.extension.platform.Actor; @@ -29,12 +27,14 @@ import com.sk89q.worldedit.util.command.Description; import com.sk89q.worldedit.util.command.Dispatcher; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.util.logging.Logger; +import static com.google.common.base.Preconditions.checkNotNull; class BukkitCommandInspector implements CommandInspector { - private static final Logger logger = Logger.getLogger(BukkitCommandInspector.class.getCanonicalName()); + private static final Logger logger = LoggerFactory.getLogger(BukkitCommandInspector.class); private final WorldEditPlugin plugin; private final Dispatcher dispatcher; @@ -51,7 +51,7 @@ class BukkitCommandInspector implements CommandInspector { if (mapping != null) { return mapping.getDescription().getDescription(); } else { - logger.warning("BukkitCommandInspector doesn't know how about the command '" + command + "'"); + logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'"); return "Help text not available"; } } @@ -63,7 +63,7 @@ class BukkitCommandInspector implements CommandInspector { Description description = mapping.getDescription(); return "Usage: " + description.getUsage() + (description.getHelp() != null ? "\n" + description.getHelp() : ""); } else { - logger.warning("BukkitCommandInspector doesn't know how about the command '" + command + "'"); + logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'"); return "Help text not available"; } } @@ -76,7 +76,7 @@ class BukkitCommandInspector implements CommandInspector { locals.put(Actor.class, plugin.wrapCommandSender(sender)); return mapping.getCallable().testPermission(locals); } else { - logger.warning("BukkitCommandInspector doesn't know how about the command '" + command + "'"); + logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'"); return false; } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java index 494a464ea..96c755083 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.worldedit.util.YAMLConfiguration; import com.sk89q.worldedit.util.report.Unreported; +import org.slf4j.LoggerFactory; import java.io.File; @@ -34,7 +35,7 @@ public class BukkitConfiguration extends YAMLConfiguration { @Unreported private final WorldEditPlugin plugin; public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) { - super(config, plugin.getLogger()); + super(config, LoggerFactory.getLogger(plugin.getLogger().getName())); this.plugin = plugin; } 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 8490c891e..0eb37223e 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 @@ -19,8 +19,6 @@ package com.sk89q.worldedit.bukkit; -import static com.google.common.base.Preconditions.checkNotNull; - import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; @@ -48,17 +46,17 @@ import org.bukkit.block.Chest; import org.bukkit.entity.Entity; import org.bukkit.inventory.DoubleChestInventory; import org.bukkit.inventory.Inventory; +import org.slf4j.Logger; +import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; public class BukkitWorld extends AbstractWorld { @@ -118,9 +116,9 @@ public class BukkitWorld extends AbstractWorld { return null; } } catch (Exception e) { - logger.warning("Corrupt entity found when creating: " + entity.getType().getId()); + logger.warn("Corrupt entity found when creating: " + entity.getType().getId()); if (entity.getNbtData() != null) { - logger.warning(entity.getNbtData().toString()); + logger.warn(entity.getNbtData().toString()); } e.printStackTrace(); return null; @@ -183,7 +181,7 @@ public class BukkitWorld extends AbstractWorld { try { getWorld().regenerateChunk(chunk.getBlockX(), chunk.getBlockZ()); } catch (Throwable t) { - logger.log(Level.WARNING, "Chunk generation via Bukkit raised an error", t); + logger.warn("Chunk generation via Bukkit raised an error", t); } // Then restore @@ -280,7 +278,7 @@ public class BukkitWorld extends AbstractWorld { treeTypeMapping.put(TreeGenerator.TreeType.RANDOM_MUSHROOM, TreeType.BROWN_MUSHROOM); for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { if (treeTypeMapping.get(type) == null) { - WorldEdit.logger.severe("No TreeType mapping for TreeGenerator.TreeType." + type); + WorldEdit.logger.error("No TreeType mapping for TreeGenerator.TreeType." + type); } } } @@ -426,8 +424,8 @@ public class BukkitWorld extends AbstractWorld { return adapter.setBlock(BukkitAdapter.adapt(getWorld(), position), block, notifyAndLight); } catch (Exception e) { if (block instanceof BaseBlock && ((BaseBlock) block).getNbtData() != null) { - logger.warning("Tried to set a corrupt tile entity at " + position.toString()); - logger.warning(((BaseBlock) block).getNbtData().toString()); + logger.warn("Tried to set a corrupt tile entity at " + position.toString()); + logger.warn(((BaseBlock) block).getNbtData().toString()); } e.printStackTrace(); Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); 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 d09578472..200444ab4 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 @@ -19,8 +19,6 @@ package com.sk89q.worldedit.bukkit; -import static com.google.common.base.Preconditions.checkNotNull; - import com.google.common.base.Joiner; import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.wepif.PermissionsResolverManager; @@ -58,7 +56,10 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -68,17 +69,16 @@ import java.util.List; import java.util.Map; import java.util.jar.JarFile; import java.util.logging.Level; -import java.util.logging.Logger; import java.util.zip.ZipEntry; -import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; /** * Plugin for Bukkit. */ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { - private static final Logger log = Logger.getLogger(WorldEditPlugin.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(WorldEditPlugin.class); public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui"; private static WorldEditPlugin INSTANCE; @@ -194,23 +194,23 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { try { adapterLoader.addFromPath(getClass().getClassLoader()); } catch (IOException e) { - log.log(Level.WARNING, "Failed to search path for Bukkit adapters"); + log.warn("Failed to search path for Bukkit adapters"); } try { adapterLoader.addFromJar(getFile()); } catch (IOException e) { - log.log(Level.WARNING, "Failed to search " + getFile() + " for Bukkit adapters", e); + log.warn("Failed to search " + getFile() + " for Bukkit adapters", e); } try { bukkitAdapter = adapterLoader.loadAdapter(); - log.log(Level.INFO, "Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter"); + log.info("Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter"); } catch (AdapterLoadException e) { Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING); if (platform instanceof BukkitServerInterface) { - log.log(Level.WARNING, e.getMessage()); + log.warn(e.getMessage()); } else { - log.log(Level.INFO, "WorldEdit could not find a Bukkit adapter for this MC version, " + + log.info("WorldEdit could not find a Bukkit adapter for this MC version, " + "but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") " + "that handles the world editing."); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java index 891106eca..a03a9f229 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java @@ -20,6 +20,8 @@ package com.sk89q.worldedit.bukkit.adapter; import com.sk89q.worldedit.util.io.Closer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; @@ -29,15 +31,13 @@ import java.util.Enumeration; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; -import java.util.logging.Level; -import java.util.logging.Logger; /** * Loads Bukkit implementation adapters. */ public class BukkitImplLoader { - private static final Logger log = Logger.getLogger(BukkitImplLoader.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(BukkitImplLoader.class); private final List adapterCandidates = new ArrayList<>(); private String customCandidate; @@ -73,7 +73,7 @@ public class BukkitImplLoader { if (className != null) { customCandidate = className; adapterCandidates.add(className); - log.log(Level.INFO, "-Dworldedit.bukkit.adapter used to add " + className + " to the list of available Bukkit adapters"); + log.info("-Dworldedit.bukkit.adapter used to add " + className + " to the list of available Bukkit adapters"); } } @@ -157,18 +157,18 @@ public class BukkitImplLoader { if (BukkitImplAdapter.class.isAssignableFrom(cls)) { return (BukkitImplAdapter) cls.newInstance(); } else { - log.log(Level.WARNING, "Failed to load the Bukkit adapter class '" + className + + log.warn("Failed to load the Bukkit adapter class '" + className + "' because it does not implement " + BukkitImplAdapter.class.getCanonicalName()); } } catch (ClassNotFoundException e) { - log.log(Level.WARNING, "Failed to load the Bukkit adapter class '" + className + + log.warn("Failed to load the Bukkit adapter class '" + className + "' that is not supposed to be missing", e); } catch (IllegalAccessException e) { - log.log(Level.WARNING, "Failed to load the Bukkit adapter class '" + className + + log.warn("Failed to load the Bukkit adapter class '" + className + "' that is not supposed to be raising this error", e); } catch (Throwable e) { if (className.equals(customCandidate)) { - log.log(Level.WARNING, "Failed to load the Bukkit adapter class '" + className + "'", e); + log.warn("Failed to load the Bukkit adapter class '" + className + "'", e); } } } diff --git a/worldedit-core/build.gradle b/worldedit-core/build.gradle index da2c61c44..f91186083 100644 --- a/worldedit-core/build.gradle +++ b/worldedit-core/build.gradle @@ -12,6 +12,7 @@ dependencies { compile 'com.google.code.gson:gson:2.8.0' compile 'com.sk89q.lib:jlibnoise:1.0.0' compile 'com.googlecode.json-simple:json-simple:1.1.1' + compile 'org.slf4j:slf4j-api:1.7.26' //compile 'net.sf.trove4j:trove4j:3.0.3' testCompile 'org.mockito:mockito-core:1.9.0-rc1' } diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java index a8f49678b..df3b0806b 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java @@ -20,6 +20,8 @@ package com.sk89q.minecraft.util.commands; import com.sk89q.util.StringUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -30,8 +32,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; /** * Manager for handling commands. This allows you to easily process commands, @@ -63,7 +63,7 @@ import java.util.logging.Logger; public abstract class CommandsManager { protected static final Logger logger = - Logger.getLogger(CommandsManager.class.getCanonicalName()); + LoggerFactory.getLogger(CommandsManager.class); /** * Mapping of commands (including aliases) with a description. Root @@ -142,7 +142,7 @@ public abstract class CommandsManager { return registerMethods(cls, parent, obj); } } catch (InvocationTargetException | InstantiationException | IllegalAccessException e) { - logger.log(Level.SEVERE, "Failed to register commands", e); + logger.error("Failed to register commands", e); } return null; } @@ -523,7 +523,7 @@ public abstract class CommandsManager { try { method.invoke(instance, methodArgs); } catch (IllegalArgumentException | IllegalAccessException e) { - logger.log(Level.SEVERE, "Failed to execute command", e); + logger.error("Failed to execute command", e); } catch (InvocationTargetException e) { if (e.getCause() instanceof CommandException) { throw (CommandException) e.getCause(); diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/SimpleInjector.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/SimpleInjector.java index eb6097512..652c69a5d 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/SimpleInjector.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/SimpleInjector.java @@ -19,14 +19,15 @@ package com.sk89q.minecraft.util.commands; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import java.util.logging.Level; -import java.util.logging.Logger; public class SimpleInjector implements Injector { - private static final Logger log = Logger.getLogger(SimpleInjector.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(SimpleInjector.class); private Object[] args; private Class[] argClasses; @@ -45,7 +46,7 @@ public class SimpleInjector implements Injector { ctr.setAccessible(true); return ctr.newInstance(args); } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { - log.log(Level.SEVERE, "Error initializing commands class " + clazz, e); + log.error("Error initializing commands class " + clazz, e); return null; } } 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 966479e98..39c72c93f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -19,12 +19,6 @@ package com.sk89q.worldedit; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.regions.Regions.asFlatRegion; -import static com.sk89q.worldedit.regions.Regions.maximumBlockY; -import static com.sk89q.worldedit.regions.Regions.minimumBlockY; - import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.event.extent.EditSessionEvent; @@ -117,7 +111,10 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -126,10 +123,12 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.regions.Regions.asFlatRegion; +import static com.sk89q.worldedit.regions.Regions.maximumBlockY; +import static com.sk89q.worldedit.regions.Regions.minimumBlockY; /** * An {@link Extent} that handles history, {@link BlockBag}s, change limits, @@ -142,7 +141,7 @@ import javax.annotation.Nullable; @SuppressWarnings({"FieldCanBeLocal"}) public class EditSession implements Extent, AutoCloseable { - private static final Logger log = Logger.getLogger(EditSession.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(EditSession.class); /** * Used by {@link EditSession#setBlock(BlockVector3, BlockStateHolder, Stage)} to @@ -1958,7 +1957,7 @@ public class EditSession implements Extent, AutoCloseable { timedOut[0] = timedOut[0] + 1; return null; } catch (Exception e) { - log.log(Level.WARNING, "Failed to create shape", e); + log.warn("Failed to create shape", e); return null; } } @@ -2322,7 +2321,7 @@ public class EditSession implements Extent, AutoCloseable { timedOut[0] = timedOut[0] + 1; return null; } catch (Exception e) { - log.log(Level.WARNING, "Failed to create shape", e); + log.warn("Failed to create shape", e); return null; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 1d0968aa6..cadeec817 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit; -import static com.google.common.base.Preconditions.checkNotNull; - import com.sk89q.jchronic.Chronic; import com.sk89q.jchronic.Options; import com.sk89q.jchronic.utils.Span; @@ -53,6 +51,7 @@ import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.snapshot.Snapshot; +import javax.annotation.Nullable; import java.util.Calendar; import java.util.HashMap; import java.util.LinkedList; @@ -60,7 +59,7 @@ import java.util.Map; import java.util.TimeZone; import java.util.concurrent.atomic.AtomicBoolean; -import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; /** * Stores session information. @@ -798,7 +797,7 @@ public class LocalSession { try { setCUIVersion(Integer.parseInt(split[1])); } catch (NumberFormatException e) { - WorldEdit.logger.warning("Error while reading CUI init message: " + e.getMessage()); + WorldEdit.logger.warn("Error while reading CUI init message: " + e.getMessage()); this.failedCuiAttempts ++; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java index 5793a4f04..9832d084d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java @@ -24,8 +24,6 @@ import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.world.World; -import java.util.logging.Level; - public class TracedEditSession extends EditSession { TracedEditSession(EventBus eventBus, World world, int maxBlocks, BlockBag blockBag, EditSessionEvent event) { @@ -39,9 +37,9 @@ public class TracedEditSession extends EditSession { super.finalize(); if (commitRequired()) { - WorldEdit.logger.warning("####### LEFTOVER BUFFER BLOCKS DETECTED #######"); - WorldEdit.logger.warning("This means that some code did not flush their EditSession."); - WorldEdit.logger.log(Level.WARNING, "Here is a stacktrace from the creation of this EditSession:", stacktrace); + WorldEdit.logger.warn("####### LEFTOVER BUFFER BLOCKS DETECTED #######"); + WorldEdit.logger.warn("This means that some code did not flush their EditSession."); + WorldEdit.logger.warn("Here is a stacktrace from the creation of this EditSession:", stacktrace); } } } 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 8dbd65389..1869c834a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -19,9 +19,6 @@ package com.sk89q.worldedit; -import static com.sk89q.worldedit.event.platform.Interaction.HIT; -import static com.sk89q.worldedit.event.platform.Interaction.OPEN; - import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.sk89q.worldedit.blocks.BaseItem; @@ -53,7 +50,6 @@ import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException; import com.sk89q.worldedit.util.io.file.FilenameException; import com.sk89q.worldedit.util.io.file.FilenameResolutionException; import com.sk89q.worldedit.util.io.file.InvalidFilenameException; -import com.sk89q.worldedit.util.logging.WorldEditPrefixHandler; import com.sk89q.worldedit.util.task.SimpleSupervisor; import com.sk89q.worldedit.util.task.Supervisor; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -61,7 +57,11 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.registry.BundledBlockData; import com.sk89q.worldedit.world.registry.BundledItemData; import com.sk89q.worldedit.world.registry.LegacyMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; +import javax.script.ScriptException; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; @@ -74,11 +74,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.annotation.Nullable; -import javax.script.ScriptException; +import static com.sk89q.worldedit.event.platform.Interaction.HIT; +import static com.sk89q.worldedit.event.platform.Interaction.OPEN; /** * The entry point and container for a working implementation of WorldEdit. @@ -95,7 +93,7 @@ import javax.script.ScriptException; */ public final class WorldEdit { - public static final Logger logger = Logger.getLogger(WorldEdit.class.getCanonicalName()); + public static final Logger logger = LoggerFactory.getLogger(WorldEdit.class); private static final WorldEdit instance = new WorldEdit(); private static String version; @@ -112,7 +110,6 @@ public final class WorldEdit { private final PatternFactory patternFactory = new PatternFactory(this); static { - WorldEditPrefixHandler.register("com.sk89q.worldedit"); getVersion(); } @@ -655,13 +652,13 @@ public final class WorldEdit { } catch (ScriptException e) { player.printError("Failed to execute:"); player.printRaw(e.getMessage()); - logger.log(Level.WARNING, "Failed to execute script", e); + logger.warn("Failed to execute script", e); } catch (NumberFormatException | WorldEditException e) { throw e; } catch (Throwable e) { player.printError("Failed to execute (see console):"); player.printRaw(e.getClass().getCanonicalName()); - logger.log(Level.WARNING, "Failed to execute script", e); + logger.warn("Failed to execute script", e); } finally { for (EditSession editSession : scriptContext.getEditSessions()) { editSession.flushSession(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index cd7da8081..b75c4bdc1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.command; -import static com.google.common.base.Preconditions.checkNotNull; - import com.google.common.collect.Multimap; import com.google.common.io.Files; import com.sk89q.minecraft.util.commands.Command; @@ -48,6 +46,8 @@ import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.parametric.Optional; import com.sk89q.worldedit.util.io.Closer; import com.sk89q.worldedit.util.io.file.FilenameException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -58,10 +58,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.regex.Pattern; +import static com.google.common.base.Preconditions.checkNotNull; + /** * Commands that work with schematic files. */ @@ -71,7 +71,7 @@ public class SchematicCommands { * 9 schematics per page fits in the MC chat window. */ private static final int SCHEMATICS_PER_PAGE = 9; - private static final Logger log = Logger.getLogger(SchematicCommands.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(SchematicCommands.class); private final WorldEdit worldEdit; /** @@ -123,7 +123,7 @@ public class SchematicCommands { player.print(filename + " loaded. Paste it with //paste"); } catch (IOException e) { player.printError("Schematic could not read or it does not exist: " + e.getMessage()); - log.log(Level.WARNING, "Failed to load a saved clipboard", e); + log.warn("Failed to load a saved clipboard", e); } } @@ -179,7 +179,7 @@ public class SchematicCommands { player.print(filename + " saved."); } catch (IOException e) { player.printError("Schematic could not written: " + e.getMessage()); - log.log(Level.WARNING, "Failed to write a saved clipboard", e); + log.warn("Failed to write a saved clipboard", e); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java index 4cd0e0079..7c01fc305 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java @@ -40,14 +40,12 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.List; -import java.util.logging.Logger; /** * Snapshot commands. */ public class SnapshotCommands { - private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit"); private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); private final WorldEdit we; @@ -93,10 +91,10 @@ public class SnapshotCommands { File dir = config.snapshotRepo.getDirectory(); try { - logger.info("WorldEdit found no snapshots: looked in: " + WorldEdit.logger.info("WorldEdit found no snapshots: looked in: " + dir.getCanonicalPath()); } catch (IOException e) { - logger.info("WorldEdit found no snapshots: looked in " + WorldEdit.logger.info("WorldEdit found no snapshots: looked in " + "(NON-RESOLVABLE PATH - does it exist?): " + dir.getPath()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java index fcd5445a6..51c5695e5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.command; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; - import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; @@ -41,12 +39,11 @@ import com.sk89q.worldedit.world.storage.MissingWorldException; import java.io.File; import java.io.IOException; -import java.util.logging.Logger; + +import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; public class SnapshotUtilCommands { - private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit"); - private final WorldEdit we; public SnapshotUtilCommands(WorldEdit we) { @@ -97,10 +94,10 @@ public class SnapshotUtilCommands { File dir = config.snapshotRepo.getDirectory(); try { - logger.info("WorldEdit found no snapshots: looked in: " + WorldEdit.logger.info("WorldEdit found no snapshots: looked in: " + dir.getCanonicalPath()); } catch (IOException e) { - logger.info("WorldEdit found no snapshots: looked in " + WorldEdit.logger.info("WorldEdit found no snapshots: looked in " + "(NON-RESOLVABLE PATH - does it exist?): " + dir.getPath()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java index 297ccf318..01e8862e0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java @@ -19,9 +19,6 @@ package com.sk89q.worldedit.extension.platform; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.util.command.composition.LegacyCommandAdapter.adapt; - import com.google.common.base.Joiner; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; @@ -79,14 +76,18 @@ import com.sk89q.worldedit.util.formatting.ColorCodeBuilder; import com.sk89q.worldedit.util.formatting.component.CommandUsageBox; import com.sk89q.worldedit.util.logging.DynamicStreamHandler; import com.sk89q.worldedit.util.logging.LogFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.util.logging.FileHandler; import java.util.logging.Level; -import java.util.logging.Logger; import java.util.regex.Pattern; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.util.command.composition.LegacyCommandAdapter.adapt; + /** * Handles the registration and invocation of commands. * @@ -95,8 +96,9 @@ import java.util.regex.Pattern; public final class CommandManager { public static final Pattern COMMAND_CLEAN_PATTERN = Pattern.compile("^[/]+"); - private static final Logger log = Logger.getLogger(CommandManager.class.getCanonicalName()); - private static final Logger commandLog = Logger.getLogger(CommandManager.class.getCanonicalName() + ".CommandLog"); + private static final Logger log = LoggerFactory.getLogger(CommandManager.class); + private static final java.util.logging.Logger commandLog = + java.util.logging.Logger.getLogger(CommandManager.class.getCanonicalName() + ".CommandLog"); private static final Pattern numberFormatExceptionPattern = Pattern.compile("^For input string: \"(.*)\"$"); private final WorldEdit worldEdit; @@ -189,7 +191,7 @@ public final class CommandManager { } void register(Platform platform) { - log.log(Level.FINE, "Registering commands with " + platform.getClass().getCanonicalName()); + log.info("Registering commands with " + platform.getClass().getCanonicalName()); LocalConfiguration config = platform.getConfiguration(); boolean logging = config.logCommands; @@ -203,12 +205,12 @@ public final class CommandManager { File file = new File(config.getWorkingDirectory(), path); commandLog.setLevel(Level.ALL); - log.log(Level.INFO, "Logging WorldEdit commands to " + file.getAbsolutePath()); + log.info("Logging WorldEdit commands to " + file.getAbsolutePath()); try { dynamicHandler.setHandler(new FileHandler(file.getAbsolutePath(), true)); } catch (IOException e) { - log.log(Level.WARNING, "Could not use command log file " + path + ": " + e.getMessage()); + log.warn("Could not use command log file " + path + ": " + e.getMessage()); } dynamicHandler.setFormatter(new LogFormat(config.logFormat)); @@ -302,14 +304,14 @@ public final class CommandManager { Throwable t = e.getCause(); actor.printError("Please report this error: [See console]"); actor.printRaw(t.getClass().getName() + ": " + t.getMessage()); - log.log(Level.SEVERE, "An unexpected error while handling a WorldEdit command", t); + log.error("An unexpected error while handling a WorldEdit command", t); } catch (CommandException e) { String message = e.getMessage(); if (message != null) { actor.printError(e.getMessage()); } else { actor.printError("An unknown error has occurred! Please see console."); - log.log(Level.SEVERE, "An unknown error occurred", e); + log.error("An unknown error occurred", e); } } finally { EditSession editSession = locals.get(EditSession.class); @@ -359,7 +361,7 @@ public final class CommandManager { return dispatcher; } - public static Logger getLogger() { + public static java.util.logging.Logger getLogger() { return commandLog; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index af45b642f..dd6c16ab1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.extension.platform; -import static com.google.common.base.Preconditions.checkNotNull; - import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -44,7 +42,10 @@ import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.world.World; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.EnumMap; import java.util.Iterator; @@ -52,10 +53,8 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; /** * Manages registered {@link Platform}s for WorldEdit. Platforms are @@ -65,7 +64,7 @@ import javax.annotation.Nullable; */ public class PlatformManager { - private static final Logger logger = Logger.getLogger(PlatformManager.class.getCanonicalName()); + private static final Logger logger = LoggerFactory.getLogger(PlatformManager.class); private final WorldEdit worldEdit; private final CommandManager commandManager; @@ -97,7 +96,7 @@ public class PlatformManager { public synchronized void register(Platform platform) { checkNotNull(platform); - logger.log(Level.FINE, "Got request to register " + platform.getClass() + " with WorldEdit [" + super.toString() + "]"); + logger.info("Got request to register " + platform.getClass() + " with WorldEdit [" + super.toString() + "]"); // Just add the platform to the list of platforms: we'll pick favorites // once all the platforms have been loaded @@ -106,7 +105,7 @@ public class PlatformManager { // Make sure that versions are in sync if (firstSeenVersion != null) { if (!firstSeenVersion.equals(platform.getVersion())) { - logger.log(Level.WARNING, "Multiple ports of WorldEdit are installed but they report different versions ({0} and {1}). " + + logger.warn("Multiple ports of WorldEdit are installed but they report different versions ({0} and {1}). " + "If these two versions are truly different, then you may run into unexpected crashes and errors.", new Object[]{ firstSeenVersion, platform.getVersion() }); } @@ -129,7 +128,7 @@ public class PlatformManager { boolean removed = platforms.remove(platform); if (removed) { - logger.log(Level.FINE, "Unregistering " + platform.getClass().getCanonicalName() + " from WorldEdit"); + logger.info("Unregistering " + platform.getClass().getCanonicalName() + " from WorldEdit"); boolean choosePreferred = false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java index 9663a9b1f..584b39f0c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java @@ -19,13 +19,12 @@ package com.sk89q.worldedit.extent.clipboard.io; -import static com.google.common.base.Preconditions.checkNotNull; - import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.sk89q.worldedit.WorldEdit; +import javax.annotation.Nullable; import java.io.File; import java.util.ArrayList; import java.util.Collection; @@ -35,7 +34,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; public class ClipboardFormats { @@ -51,7 +50,7 @@ public class ClipboardFormats { ClipboardFormat old = aliasMap.put(lowKey, format); if (old != null) { aliasMap.put(lowKey, old); - WorldEdit.logger.warning(format.getClass().getName() + " cannot override existing alias '" + lowKey + "' used by " + old.getClass().getName()); + WorldEdit.logger.warn(format.getClass().getName() + " cannot override existing alias '" + lowKey + "' used by " + old.getClass().getName()); } } for (String ext : format.getFileExtensions()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index 27e9a1d2c..c20c72df8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.extent.clipboard.io; -import static com.google.common.base.Preconditions.checkNotNull; - import com.sk89q.jnbt.ByteArrayTag; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntTag; @@ -45,14 +43,16 @@ import com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.entity.EntityTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.storage.NBTConversions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; + +import static com.google.common.base.Preconditions.checkNotNull; /** * Reads schematic files that are compatible with MCEdit and other editors. @@ -66,7 +66,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { // TODO Add a handler for skulls, flower pots, note blocks, etc. } - private static final Logger log = Logger.getLogger(MCEditSchematicReader.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(MCEditSchematicReader.class); private final NBTInputStream inputStream; /** @@ -230,15 +230,15 @@ public class MCEditSchematicReader extends NBTSchematicReader { clipboard.setBlock(region.getMinimumPoint().add(pt), state); } } else { - log.warning("Unknown block when pasting schematic: " + blocks[index] + ":" + blockData[index] + ". Please report this issue."); + log.warn("Unknown block when pasting schematic: " + blocks[index] + ":" + blockData[index] + ". Please report this issue."); } } catch (WorldEditException e) { switch (failedBlockSets) { case 0: - log.log(Level.WARNING, "Failed to set block on a Clipboard", e); + log.warn("Failed to set block on a Clipboard", e); break; case 1: - log.log(Level.WARNING, "Failed to set block on a Clipboard (again) -- no more messages will be logged", e); + log.warn("Failed to set block on a Clipboard (again) -- no more messages will be logged", e); break; default: } @@ -268,7 +268,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { BaseEntity state = new BaseEntity(entityType, compound); clipboard.createEntity(location, state); } else { - log.warning("Unknown entity when pasting schematic: " + id.toLowerCase()); + log.warn("Unknown entity when pasting schematic: " + id.toLowerCase()); } } } 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 9714fc0de..3b944018e 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 @@ -19,8 +19,6 @@ package com.sk89q.worldedit.extent.clipboard.io; -import static com.google.common.base.Preconditions.checkNotNull; - import com.google.common.collect.Maps; import com.sk89q.jnbt.ByteArrayTag; import com.sk89q.jnbt.CompoundTag; @@ -42,15 +40,18 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.block.BlockState; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.logging.Logger; import java.util.stream.Collectors; +import static com.google.common.base.Preconditions.checkNotNull; + /** * Reads schematic files using the Sponge Schematic Specification. */ @@ -62,7 +63,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { // If NBT Compat handlers are needed - add them here. } - private static final Logger log = Logger.getLogger(SpongeSchematicReader.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(SpongeSchematicReader.class); private final NBTInputStream inputStream; /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java index 262bdd0af..10ba092a3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.internal.command; -import static com.google.common.base.Preconditions.checkNotNull; - import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.Logging; @@ -40,6 +38,8 @@ import java.lang.reflect.Method; import java.util.logging.Handler; import java.util.logging.Logger; +import static com.google.common.base.Preconditions.checkNotNull; + /** * Logs called commands to a logger. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java index 29a3ee5ee..23680f2bc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java @@ -21,14 +21,15 @@ package com.sk89q.worldedit.math.interpolation; -import static com.google.common.base.Preconditions.checkNotNull; - import com.sk89q.worldedit.math.Vector3; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.List; import java.util.Map.Entry; import java.util.TreeMap; -import java.util.logging.Logger; + +import static com.google.common.base.Preconditions.checkNotNull; /** * Reparametrises another interpolation function by arc length. @@ -38,7 +39,7 @@ import java.util.logging.Logger; */ public class ReparametrisingInterpolation implements Interpolation { - private static final Logger log = Logger.getLogger(ReparametrisingInterpolation.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(ReparametrisingInterpolation.class); private final Interpolation baseInterpolation; private double totalArcLength; @@ -102,7 +103,7 @@ public class ReparametrisingInterpolation implements Interpolation { Entry ceilingEntry = cache.ceilingEntry(arc); if (ceilingEntry == null) { - log.warning("Error in arcToParameter: no ceiling entry for " + arc + " found!"); + log.warn("Error in arcToParameter: no ceiling entry for " + arc + " found!"); return 0; } final double rightArc = ceilingEntry.getKey(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index a1dd4d60a..1260fc327 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.session; -import static com.google.common.base.Preconditions.checkNotNull; - import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; @@ -36,7 +34,10 @@ import com.sk89q.worldedit.session.storage.VoidStore; import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors; import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.world.gamemode.GameModes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.util.HashMap; @@ -46,10 +47,8 @@ import java.util.Timer; import java.util.TimerTask; import java.util.UUID; import java.util.concurrent.Callable; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; /** * Session manager for WorldEdit. @@ -63,7 +62,7 @@ public class SessionManager { public static int EXPIRATION_GRACE = 600000; private static final int FLUSH_PERIOD = 1000 * 30; private static final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 5)); - private static final Logger log = Logger.getLogger(SessionManager.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(SessionManager.class); private final Timer timer = new Timer(); private final WorldEdit worldEdit; private final Map sessions = new HashMap<>(); @@ -149,7 +148,7 @@ public class SessionManager { session = store.load(getKey(sessionKey)); session.postLoad(); } catch (IOException e) { - log.log(Level.WARNING, "Failed to load saved session", e); + log.warn("Failed to load saved session", e); session = new LocalSession(); } @@ -210,7 +209,7 @@ public class SessionManager { try { store.save(getKey(key), entry.getValue()); } catch (IOException e) { - log.log(Level.WARNING, "Failed to write session for UUID " + getKey(key), e); + log.warn("Failed to write session for UUID " + getKey(key), e); exception = e; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java index d7b2a9893..ad8e422bf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.session.storage; -import static com.google.common.base.Preconditions.checkNotNull; - import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonIOException; @@ -28,6 +26,8 @@ import com.google.gson.JsonParseException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.util.gson.GsonUtil; import com.sk89q.worldedit.util.io.Closer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -37,8 +37,8 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.UUID; -import java.util.logging.Level; -import java.util.logging.Logger; + +import static com.google.common.base.Preconditions.checkNotNull; /** * Stores sessions as JSON files in a directory. @@ -47,7 +47,7 @@ import java.util.logging.Logger; */ public class JsonFileSessionStore implements SessionStore { - private static final Logger log = Logger.getLogger(JsonFileSessionStore.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(JsonFileSessionStore.class); private final Gson gson; private final File dir; @@ -61,7 +61,7 @@ public class JsonFileSessionStore implements SessionStore { if (!dir.isDirectory()) { if (!dir.mkdirs()) { - log.log(Level.WARNING, "Failed to create directory '" + dir.getPath() + "' for sessions"); + log.warn("Failed to create directory '" + dir.getPath() + "' for sessions"); } } @@ -111,12 +111,12 @@ public class JsonFileSessionStore implements SessionStore { if (finalFile.exists()) { if (!finalFile.delete()) { - log.log(Level.WARNING, "Failed to delete " + finalFile.getPath() + " so the .tmp file can replace it"); + log.warn("Failed to delete " + finalFile.getPath() + " so the .tmp file can replace it"); } } if (!tempFile.renameTo(finalFile)) { - log.log(Level.WARNING, "Failed to rename temporary session file to " + finalFile.getPath()); + log.warn("Failed to rename temporary session file to " + finalFile.getPath()); } } 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 acc845914..12513b97d 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 @@ -27,6 +27,8 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.util.report.Unreported; import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.snapshot.SnapshotRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileInputStream; @@ -39,8 +41,6 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Properties; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; /** * Simple LocalConfiguration that loads settings using @@ -48,7 +48,7 @@ import java.util.logging.Logger; */ public class PropertiesConfiguration extends LocalConfiguration { - @Unreported private static final Logger log = Logger.getLogger(PropertiesConfiguration.class.getCanonicalName()); + @Unreported private static final Logger log = LoggerFactory.getLogger(PropertiesConfiguration.class); @Unreported protected Properties properties; @Unreported protected File path; @@ -70,7 +70,7 @@ public class PropertiesConfiguration extends LocalConfiguration { properties.load(stream); } catch (FileNotFoundException ignored) { } catch (IOException e) { - log.log(Level.WARNING, "Failed to read configuration", e); + log.warn("Failed to read configuration", e); } loadExtra(); @@ -131,7 +131,7 @@ public class PropertiesConfiguration extends LocalConfiguration { try (OutputStream output = new FileOutputStream(path)) { properties.store(output, "Don't put comments; they get removed"); } catch (IOException e) { - log.log(Level.WARNING, "Failed to write configuration", e); + log.warn("Failed to write configuration", e); } } 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 10940bbd9..5a657584d 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 @@ -26,11 +26,10 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.session.SessionManager; import com.sk89q.worldedit.util.report.Unreported; import com.sk89q.worldedit.world.snapshot.SnapshotRepository; +import org.slf4j.Logger; import java.io.IOException; import java.util.HashSet; -import java.util.logging.Level; -import java.util.logging.Logger; /** * A less simple implementation of {@link LocalConfiguration} @@ -51,7 +50,7 @@ public class YAMLConfiguration extends LocalConfiguration { try { config.load(); } catch (IOException e) { - logger.log(Level.WARNING, "Error loading WorldEdit configuration", e); + logger.warn("Error loading WorldEdit configuration", e); } profile = config.getBoolean("debug", profile); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java index d8cbe8b20..d97c090ea 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.util.eventbus; -import static com.google.common.base.Preconditions.checkNotNull; - import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.common.collect.SetMultimap; import com.google.common.eventbus.DeadEvent; import com.sk89q.worldedit.internal.annotation.RequiresNewerGuava; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; @@ -36,8 +36,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; + +import static com.google.common.base.Preconditions.checkNotNull; /** * Dispatches events to listeners, and provides ways for listeners to register @@ -53,7 +53,7 @@ import java.util.logging.Logger; */ public class EventBus { - private final Logger logger = Logger.getLogger(EventBus.class.getCanonicalName()); + private final Logger logger = LoggerFactory.getLogger(EventBus.class); private final SetMultimap, EventHandler> handlersByType = Multimaps.newSetMultimap(new HashMap<>(), this::newHandlerSet); @@ -186,8 +186,7 @@ public class EventBus { try { handler.handleEvent(event); } catch (InvocationTargetException e) { - logger.log(Level.SEVERE, - "Could not dispatch event: " + event + " to handler " + handler, e); + logger.error("Could not dispatch event: " + event + " to handler " + handler, e); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java index 26ef6a0f9..1b7aceda3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java @@ -19,23 +19,23 @@ package com.sk89q.worldedit.util.io; -import static com.google.common.base.Preconditions.checkNotNull; - import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Throwables; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.Closeable; import java.io.IOException; import java.lang.reflect.Method; import java.util.ArrayDeque; import java.util.Deque; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.zip.ZipFile; +import static com.google.common.base.Preconditions.checkNotNull; + public final class Closer implements Closeable { - private static final Logger logger = Logger.getLogger(Closer.class.getCanonicalName()); + private static final Logger logger = LoggerFactory.getLogger(Closer.class); /** * The suppressor implementation to use for the current Java version. @@ -218,7 +218,7 @@ public final class Closer implements Closeable { @Override public void suppress(Object closeable, Throwable thrown, Throwable suppressed) { // log to the same place as Closeables - logger.log(Level.WARNING, "Suppressing exception thrown when closing " + closeable, suppressed); + logger.warn("Suppressing exception thrown when closing " + closeable, suppressed); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/WorldEditPrefixHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/WorldEditPrefixHandler.java deleted file mode 100644 index f2c8a0754..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/WorldEditPrefixHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.util.logging; - -import java.util.logging.Handler; -import java.util.logging.LogRecord; -import java.util.logging.Logger; - -/** - * Adds a WorldEdit prefix to WorldEdit's logger messages using a handler. - */ -public final class WorldEditPrefixHandler extends Handler { - - private WorldEditPrefixHandler() { - } - - @Override - public void publish(LogRecord record) { - String message = record.getMessage(); - if (!message.startsWith("WorldEdit: ") && !message.startsWith("[WorldEdit] ")) { - record.setMessage("[WorldEdit] " + message); - } - } - - @Override - public void flush() { - } - - @Override - public void close() throws SecurityException { - } - - /** - * Add the handler to the following logger name. - * - * @param name the logger name - */ - public static void register(String name) { - Logger.getLogger(name).addHandler(new WorldEditPrefixHandler()); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java index a643146c7..bcacbfd8f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java @@ -26,14 +26,14 @@ import com.sk89q.worldedit.command.util.AsyncCommandHelper; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.util.command.parametric.ExceptionConverter; import com.sk89q.worldedit.util.task.Supervisor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.net.URL; -import java.util.logging.Level; -import java.util.logging.Logger; public class ActorCallbackPaste { - private static final Logger LOGGER = Logger.getLogger(ActorCallbackPaste.class.getSimpleName()); + private static final Logger LOGGER = LoggerFactory.getLogger(ActorCallbackPaste.class); private ActorCallbackPaste() { } @@ -62,7 +62,7 @@ public class ActorCallbackPaste { @Override public void onFailure(Throwable throwable) { - LOGGER.log(Level.WARNING, "Failed to submit pastebin", throwable); + LOGGER.warn("Failed to submit pastebin", throwable); sender.printError("Failed to submit to a pastebin. Please see console for the error."); } }); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ShallowObjectReport.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ShallowObjectReport.java index bb4abb1f3..18085bc0b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ShallowObjectReport.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/report/ShallowObjectReport.java @@ -19,16 +19,17 @@ package com.sk89q.worldedit.util.report; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.util.logging.Level; -import java.util.logging.Logger; import static com.google.common.base.Preconditions.checkNotNull; public class ShallowObjectReport extends DataReport { - private static final Logger log = Logger.getLogger(ShallowObjectReport.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(ShallowObjectReport.class); public ShallowObjectReport(String title, Object object) { super(title); @@ -52,7 +53,7 @@ public class ShallowObjectReport extends DataReport { Object value = field.get(object); append(field.getName(), String.valueOf(value)); } catch (IllegalAccessException e) { - log.log(Level.WARNING, "Failed to get value of '" + field.getName() + "' on " + type); + log.warn("Failed to get value of '" + field.getName() + "' on " + type); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index 6e4c5e721..d71430c52 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -107,7 +107,7 @@ public class BlockState implements BlockStateHolder { states.put(property, value, modifiedState); } else { System.out.println(stateMap); - WorldEdit.logger.warning("Found a null state at " + this.withValue(property, value)); + WorldEdit.logger.warn("Found a null state at " + this.withValue(property, value)); } } }); 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 1d4b92c90..5eacec086 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 @@ -36,12 +36,11 @@ import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.storage.InvalidFormatException; +import javax.annotation.Nullable; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.Nullable; - public class AnvilChunk implements Chunk { private CompoundTag rootTag; @@ -259,7 +258,7 @@ public class AnvilChunk implements Chunk { BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data); if (state == null) { - WorldEdit.logger.warning("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk."); + WorldEdit.logger.warn("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk."); return BlockTypes.AIR.getDefaultState().toBaseBlock(); } CompoundTag tileEntity = getBlockTileEntity(position); 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 89bad5678..9f8bda52d 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 @@ -182,7 +182,7 @@ public class OldChunk implements Chunk { BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal); if (state == null) { - WorldEdit.logger.warning("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk."); + WorldEdit.logger.warn("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk."); return BlockTypes.AIR.getDefaultState().toBaseBlock(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java index b98238dc0..4dffdb38f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java @@ -25,17 +25,16 @@ import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.gson.VectorAdapter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; import java.io.IOException; import java.net.URL; import java.nio.charset.Charset; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.annotation.Nullable; /** * Provides block data based on the built-in block database that is bundled @@ -50,7 +49,7 @@ import javax.annotation.Nullable; */ public class BundledBlockData { - private static final Logger log = Logger.getLogger(BundledBlockData.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(BundledBlockData.class); private static BundledBlockData INSTANCE; private final Map idMap = new HashMap<>(); @@ -62,7 +61,7 @@ public class BundledBlockData { try { loadFromResource(); } catch (Throwable e) { - log.log(Level.WARNING, "Failed to load the built-in block registry", e); + log.warn("Failed to load the built-in block registry", e); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java index 2867b2e56..4bdac0c8a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java @@ -25,17 +25,16 @@ import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.gson.VectorAdapter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; import java.io.IOException; import java.net.URL; import java.nio.charset.Charset; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.annotation.Nullable; /** * Provides item data based on the built-in item database that is bundled @@ -50,7 +49,7 @@ import javax.annotation.Nullable; */ public class BundledItemData { - private static final Logger log = Logger.getLogger(BundledItemData.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(BundledItemData.class); private static BundledItemData INSTANCE; private final Map idMap = new HashMap<>(); @@ -62,7 +61,7 @@ public class BundledItemData { try { loadFromResource(); } catch (Throwable e) { - log.log(Level.WARNING, "Failed to load the built-in item registry", e); + log.warn("Failed to load the built-in item registry", e); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java index ad2eac4c0..a41814abc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java @@ -32,22 +32,21 @@ import com.sk89q.worldedit.util.gson.VectorAdapter; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; import java.io.IOException; import java.net.URL; import java.nio.charset.Charset; import java.util.Arrays; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkNotNull; public class LegacyMapper { - private static final Logger log = Logger.getLogger(LegacyMapper.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(LegacyMapper.class); private static LegacyMapper INSTANCE; private Multimap stringToBlockMap = HashMultimap.create(); @@ -62,7 +61,7 @@ public class LegacyMapper { try { loadFromResource(); } catch (Throwable e) { - log.log(Level.WARNING, "Failed to load the built-in legacy id registry", e); + log.warn("Failed to load the built-in legacy id registry", e); } } @@ -94,7 +93,7 @@ public class LegacyMapper { blockToStringMap.put(state, id); stringToBlockMap.put(id, state); } catch (Exception e) { - log.warning("Unknown block: " + blockEntry.getValue()); + log.warn("Unknown block: " + blockEntry.getValue()); } } @@ -106,7 +105,7 @@ public class LegacyMapper { itemToStringMap.put(type, id); stringToItemMap.put(id, type); } catch (Exception e) { - log.warning("Unknown item: " + itemEntry.getValue()); + log.warn("Unknown item: " + itemEntry.getValue()); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java index 58525a7d2..0af2b6e18 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java @@ -29,11 +29,12 @@ import com.sk89q.worldedit.world.storage.TrueZipLegacyChunkStore; import com.sk89q.worldedit.world.storage.TrueZipMcRegionChunkStore; import com.sk89q.worldedit.world.storage.ZippedLegacyChunkStore; import com.sk89q.worldedit.world.storage.ZippedMcRegionChunkStore; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.util.Calendar; -import java.util.logging.Logger; import java.util.zip.ZipFile; /** @@ -41,7 +42,7 @@ import java.util.zip.ZipFile; */ public class Snapshot implements Comparable { - protected static Logger logger = Logger.getLogger(Snapshot.class.getCanonicalName()); + protected static Logger logger = LoggerFactory.getLogger(Snapshot.class); protected File file; protected String name; diff --git a/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java b/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java index 5cc3c1086..555c83889 100644 --- a/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java +++ b/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java @@ -19,23 +19,23 @@ package com.sk89q.minecraft.util.commands; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; +import java.util.HashSet; + import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import org.junit.Before; -import org.junit.Test; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.logging.Level; -import java.util.logging.Logger; - public class CommandContextTest { - private static final Logger log = Logger.getLogger(CommandContextTest.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(CommandContextTest.class); private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something"; CommandContext firstCommand; @@ -44,7 +44,7 @@ public class CommandContextTest { try { firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w'))); } catch (CommandException e) { - log.log(Level.WARNING, "Error", e); + log.warn("Error", e); fail("Unexpected exception when creating CommandContext"); } } @@ -83,7 +83,7 @@ public class CommandContextTest { new CommandContext(cmd); new CommandContext(cmd2); } catch (CommandException e) { - log.log(Level.WARNING, "Error", e); + log.warn("Error", e); fail("Error creating CommandContext"); } } @@ -94,7 +94,7 @@ public class CommandContextTest { try { new CommandContext(cmd); } catch (CommandException e) { - log.log(Level.WARNING, "Error", e); + log.warn("Error", e); fail("Error creating CommandContext"); } } @@ -105,7 +105,7 @@ public class CommandContextTest { try { new CommandContext(cmd); } catch (CommandException e) { - log.log(Level.WARNING, "Error", e); + log.warn("Error", e); fail("Error creating CommandContext"); } } @@ -119,7 +119,7 @@ public class CommandContextTest { CommandContext context2 = new CommandContext("r hello -f world"); assertTrue(context2.hasFlag('f')); } catch (CommandException e) { - log.log(Level.WARNING, "Error", e); + log.warn("Error", e); fail("Error creating CommandContext"); } } @@ -135,7 +135,7 @@ public class CommandContextTest { CommandContext context2 = new CommandContext("pm name \"hello world\" foo bar"); assertEquals("\"hello world\" foo bar", context2.getJoinedStrings(1)); } catch (CommandException e) { - log.log(Level.WARNING, "Error", e); + log.warn("Error", e); fail("Error creating CommandContext"); } } @@ -147,7 +147,7 @@ public class CommandContextTest { assertArrayEquals(new String[] { "foo", "bar", "baz" }, context.getSlice(0)); } catch (CommandException e) { - log.log(Level.WARNING, "Error", e); + log.warn("Error", e); fail("Error creating CommandContext"); } } @@ -158,7 +158,7 @@ public class CommandContextTest { CommandContext context = new CommandContext("region flag xmas blocked-cmds \"\""); assertEquals(context.argsLength(), 3); } catch (CommandException e) { - log.log(Level.WARNING, "Error", e); + log.warn("Error", e); fail("Error creating CommandContext"); } } diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 6666d74c4..7e46e4d05 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -18,6 +18,7 @@ def forgeVersion = "25.0.76" dependencies { compile project(':worldedit-core') + compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.2' minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}" diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java index dac72425e..7f5bb0f84 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java @@ -21,6 +21,8 @@ package com.sk89q.worldedit.sponge.adapter; import com.google.common.collect.Lists; import com.sk89q.worldedit.util.io.Closer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; @@ -30,15 +32,13 @@ import java.util.Enumeration; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; -import java.util.logging.Level; -import java.util.logging.Logger; /** * Loads Sponge implementation adapters. */ public class SpongeImplLoader { - private static final Logger log = Logger.getLogger(SpongeImplLoader.class.getCanonicalName()); + private static final Logger log = LoggerFactory.getLogger(SpongeImplLoader.class); private final List adapterCandidates = new ArrayList<>(); private String customCandidate; @@ -71,7 +71,7 @@ public class SpongeImplLoader { if (className != null) { customCandidate = className; adapterCandidates.add(className); - log.log(Level.INFO, "-Dworldedit.sponge.adapter used to add " + className + " to the list of available Sponge adapters"); + log.info("-Dworldedit.sponge.adapter used to add " + className + " to the list of available Sponge adapters"); } } @@ -157,18 +157,18 @@ public class SpongeImplLoader { if (SpongeImplAdapter.class.isAssignableFrom(cls)) { suitableAdapters.add((SpongeImplAdapter) cls.newInstance()); } else { - log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + + log.warn("Failed to load the Sponge adapter class '" + className + "' because it does not implement " + SpongeImplAdapter.class.getCanonicalName()); } } catch (ClassNotFoundException e) { - log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + + log.warn("Failed to load the Sponge adapter class '" + className + "' that is not supposed to be missing", e); } catch (IllegalAccessException e) { - log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + + log.warn("Failed to load the Sponge adapter class '" + className + "' that is not supposed to be raising this error", e); } catch (Throwable e) { if (className.equals(customCandidate)) { - log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + "'", e); + log.warn("Failed to load the Sponge adapter class '" + className + "'", e); } } } From 4be72fb9836525e47c2dfad077b38dff777db6f0 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 13 Mar 2019 19:56:58 -0700 Subject: [PATCH 162/182] Shade logger bridges as well --- worldedit-bukkit/build.gradle | 2 ++ worldedit-forge/build.gradle | 1 + 2 files changed, 3 insertions(+) diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 944956fa8..ecff0db24 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -39,6 +39,8 @@ jar { shadowJar { dependencies { include(dependency(':worldedit-core')) + // Must not be relocated, for StaticLoggerBinder to work: + include(dependency("org.slf4j:slf4j-jdk14:1.7.26")) relocate ("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { include(dependency("org.bstats:bstats-bukkit:1.4")) } diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 7e46e4d05..84dba2768 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -85,6 +85,7 @@ jar { shadowJar { dependencies { include(dependency(':worldedit-core')) + include(dependency("org.apache.logging.log4j:log4j-slf4j-impl:2.11.2")) } } From fba12b1282b54383dcfca7a5ac5163c45326e0f3 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Wed, 13 Mar 2019 20:15:01 -0700 Subject: [PATCH 163/182] More shading fixes --- worldedit-bukkit/build.gradle | 5 +++-- worldedit-forge/build.gradle | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index ecff0db24..335b96c0a 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -38,9 +38,10 @@ jar { shadowJar { dependencies { + relocate "org.slf4j", "com.sk89q.worldedit.slf4j" include(dependency(':worldedit-core')) - // Must not be relocated, for StaticLoggerBinder to work: - include(dependency("org.slf4j:slf4j-jdk14:1.7.26")) + include(dependency('org.slf4j:slf4j-api')) + include(dependency("org.slf4j:slf4j-jdk14")) relocate ("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { include(dependency("org.bstats:bstats-bukkit:1.4")) } diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index 84dba2768..8fe3fb9af 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -84,8 +84,12 @@ jar { shadowJar { dependencies { + relocate "org.slf4j", "com.sk89q.worldedit.slf4j" + relocate "org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge" + include(dependency(':worldedit-core')) - include(dependency("org.apache.logging.log4j:log4j-slf4j-impl:2.11.2")) + include(dependency('org.slf4j:slf4j-api')) + include(dependency("org.apache.logging.log4j:log4j-slf4j-impl")) } } From 18414fe3b5c14f7d64f00d241cb9d8bf4a1b6609 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 15 Mar 2019 09:10:51 -0400 Subject: [PATCH 164/182] Fix symlink detection. --- .../src/main/java/com/sk89q/worldedit/WorldEdit.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 8dbd65389..22ea5b38e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -284,12 +284,18 @@ public final class WorldEdit { Path filePath = Paths.get(f.toURI()).normalize(); Path dirPath = Paths.get(dir.toURI()).normalize(); - if (!filePath.startsWith(dirPath) - || (!getConfiguration().allowSymlinks && !filePath.toRealPath().startsWith(dirPath))) { + boolean inDir = filePath.startsWith(dirPath); + Path existingParent = filePath; + do { + existingParent = existingParent.getParent(); + } while (existingParent != null && !existingParent.toFile().exists()); + + boolean isSym = existingParent != null && !existingParent.toRealPath().equals(existingParent); + if (!inDir || (!getConfiguration().allowSymlinks && isSym)) { throw new FilenameResolutionException(filename, "Path is outside allowable root"); } - return f; + return filePath.toFile(); } catch (IOException e) { throw new FilenameResolutionException(filename, "Failed to resolve path"); } From 9d2d43f0db0725da13b35cd6adf29796e1ae8eb6 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 15 Mar 2019 17:08:11 -0400 Subject: [PATCH 165/182] Add -f to //schem save to confirm overwriting. Overwriting existing schematics now checks delete perm. Also allow delete to be run from console. Fixes WORLDEDIT-3868. --- .../worldedit/command/SchematicCommands.java | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index cd7da8081..b6c58df93 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -27,7 +27,6 @@ import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -129,12 +128,15 @@ public class SchematicCommands { @Command( aliases = { "save" }, + flags = "f", usage = "[] ", desc = "Save a schematic into your clipboard", + help = "-f is required to overwrite an existing file", min = 1, max = 2 ) @CommandPermissions({ "worldedit.clipboard.save", "worldedit.schematic.save" }) - public void save(Player player, LocalSession session, @Optional("sponge") String formatName, String filename) throws CommandException, WorldEditException { + public void save(Player player, LocalSession session, @Optional("sponge") String formatName, + String filename, @Switch('f') boolean allowOverwrite) throws CommandException, WorldEditException { LocalConfiguration config = worldEdit.getConfiguration(); File dir = worldEdit.getWorkingDirectoryFile(config.saveDir); @@ -147,6 +149,17 @@ public class SchematicCommands { File f = worldEdit.getSafeSaveFile(player, dir, filename, format.getPrimaryFileExtension()); + boolean overwrite = f.exists(); + if (overwrite) { + if (!player.hasPermission("worldedit.schematic.delete")) { + throw new CommandException("That schematic already exists!"); + } + if (!allowOverwrite) { + player.printError("That schematic already exists. Use the -f flag to overwrite it."); + return; + } + } + ClipboardHolder holder = session.getClipboard(); Clipboard clipboard = holder.getClipboard(); Transform transform = holder.getTransform(); @@ -162,21 +175,22 @@ public class SchematicCommands { target = clipboard; } - try (Closer closer = Closer.create()) { - // Create parent directories - File parent = f.getParentFile(); - if (parent != null && !parent.exists()) { - if (!parent.mkdirs()) { - throw new CommandException("Could not create folder for schematics!"); - } + // Create parent directories + File parent = f.getParentFile(); + if (parent != null && !parent.exists()) { + if (!parent.mkdirs()) { + throw new CommandException("Could not create folder for schematics!"); } + } + try (Closer closer = Closer.create()) { FileOutputStream fos = closer.register(new FileOutputStream(f)); BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos)); ClipboardWriter writer = closer.register(format.getWriter(bos)); writer.write(target); - log.info(player.getName() + " saved " + f.getCanonicalPath()); - player.print(filename + " saved."); + + log.info(player.getName() + " saved " + f.getCanonicalPath() + (overwrite ? " (overwriting previous file)" : "")); + player.print(filename + " saved" + (overwrite ? " (overwriting previous file)." : ".")); } catch (IOException e) { player.printError("Schematic could not written: " + e.getMessage()); log.log(Level.WARNING, "Failed to write a saved clipboard", e); @@ -192,29 +206,28 @@ public class SchematicCommands { max = 1 ) @CommandPermissions("worldedit.schematic.delete") - public void delete(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - + public void delete(Actor actor, String filename) throws WorldEditException { LocalConfiguration config = worldEdit.getConfiguration(); - String filename = args.getString(0); - File dir = worldEdit.getWorkingDirectoryFile(config.saveDir); - File f = worldEdit.getSafeOpenFile(player, dir, filename, "schematic", ClipboardFormats.getFileExtensionArray()); + + File f = worldEdit.getSafeOpenFile(actor instanceof Player ? ((Player) actor) : null, + dir, filename, "schematic", ClipboardFormats.getFileExtensionArray()); if (!f.exists()) { - player.printError("Schematic " + filename + " does not exist!"); + actor.printError("Schematic " + filename + " does not exist!"); return; } if (!f.delete()) { - player.printError("Deletion of " + filename + " failed! Maybe it is read-only."); + actor.printError("Deletion of " + filename + " failed! Maybe it is read-only."); return; } - player.print(filename + " has been deleted."); + actor.print(filename + " has been deleted."); try { - log.info(player.getName() + " deleted " + f.getCanonicalPath()); + log.info(actor.getName() + " deleted " + f.getCanonicalPath()); } catch (IOException e) { - log.info(player.getName() + " deleted " + f.getAbsolutePath()); + log.info(actor.getName() + " deleted " + f.getAbsolutePath()); } } @@ -246,7 +259,6 @@ public class SchematicCommands { @Command( aliases = {"list", "all", "ls"}, desc = "List saved schematics", - min = 0, max = 1, flags = "dnp", help = "List all schematics in the schematics directory\n" + From c885f70c7b561dc7bc1f603fac5eae380c48fb09 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 15 Mar 2019 18:20:12 -0400 Subject: [PATCH 166/182] Load Bukkit plugin at startup. This should allow plugins that use WorldEdit to do things on world load. --- .../main/java/com/sk89q/wepif/VaultResolver.java | 3 +++ .../sk89q/worldedit/bukkit/WorldEditPlugin.java | 15 +++++++++------ worldedit-bukkit/src/main/resources/plugin.yml | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java index a97017ceb..a918d601a 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java @@ -35,6 +35,9 @@ public class VaultResolver implements PermissionsResolver { return null; } RegisteredServiceProvider rsp = server.getServicesManager().getRegistration(Permission.class); + if (rsp == null) { + return null; + } perms = rsp.getProvider(); if (perms == null) { return null; 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 d09578472..9b50aa982 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 @@ -86,13 +86,9 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { private BukkitServerInterface server; private BukkitConfiguration config; - /** - * Called on plugin enable. - */ - @SuppressWarnings("AccessStaticViaInstance") @Override - public void onEnable() { - this.INSTANCE = this; + public void onLoad() { + INSTANCE = this; //noinspection ResultOfMethodCallIgnored getDataFolder().mkdirs(); @@ -107,6 +103,13 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { worldEdit.loadMappings(); loadConfig(); // Load configuration + } + + /** + * Called on plugin enable. + */ + @Override + public void onEnable() { PermissionsResolverManager.initialize(this); // Setup permission resolver // Register CUI diff --git a/worldedit-bukkit/src/main/resources/plugin.yml b/worldedit-bukkit/src/main/resources/plugin.yml index 9afc2c5a5..27808257f 100644 --- a/worldedit-bukkit/src/main/resources/plugin.yml +++ b/worldedit-bukkit/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: WorldEdit main: com.sk89q.worldedit.bukkit.WorldEditPlugin version: "${internalVersion}" -softdepend: [Spout] #hack to fix trove errors +load: STARTUP api-version: 1.13 # Permissions aren't here. Read http://wiki.sk89q.com/wiki/WEPIF/DinnerPerms From 678a78a98295f7585256c9b7268536f612f32ea8 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 15 Mar 2019 20:56:49 -0400 Subject: [PATCH 167/182] Update adapters. Don't update unchanged blocks, do change NBT, no need to light. Also clean up the forge side a bit. --- .../adapter/impl/Spigot_v1_13_R1$1.class | Bin 959 -> 959 bytes .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 25469 -> 25386 bytes .../adapter/impl/Spigot_v1_13_R2$1.class | Bin 959 -> 959 bytes .../bukkit/adapter/impl/Spigot_v1_13_R2.class | Bin 25491 -> 25408 bytes .../adapter/impl/Spigot_v1_13_R2_2$1.class | Bin 965 -> 965 bytes .../adapter/impl/Spigot_v1_13_R2_2.class | Bin 25557 -> 25474 bytes .../com/sk89q/worldedit/forge/ForgeWorld.java | 22 +++--- .../worldedit/forge/TileEntityUtils.java | 71 +----------------- 8 files changed, 11 insertions(+), 82 deletions(-) diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1$1.class index 1be36a1548ae79e29a8f2658a12ac417d786ced7..efa78dacc6f7d28a602adf0b9f4189588b996348 100644 GIT binary patch delta 13 UcmdnbzMp+V4l|?BQbg0!jn~5d{S7vS9CR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3(d)FVx)-Kp{|EDg7yJMK diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R2$1.class index fe6e8015a0812e54e0750abb1ba049e53a05a4cd..97a809b53396eabe2efe1086b896f97291cc9040 100644 GIT binary patch delta 13 UcmdnbzMp+V4l|?J7niLTMQB;VE5D_UNsDRiH>Lqgop+OL`4BXY$&3j*b7z!^8e1eQ1tf?pW8P#yF0tnzB~I4{|&BL%dxi(taycp zx;Xt@&f>k={Nqvv?{j%SA4uV5Tx*3~VG*#!SaBi}QZkHAv93fU#flq|R4ZPJq)9#P zOxMl~S2DFTDoUAkDBfRv`L0qU!OYNnTE1ji_m7`tiq$)O( zuG)07(mm$NF;c2c4;^%@D?O!Giu9H~snS=DbETj3*PRSV1#h60<6Y__gS77ir3R~< z6Lr!MD??oxD8rOqqHg0 z<_vAl)aER0MyJZzGA32VN_ncBBjdC=*UI=*8ZGBpnUG3jWTGpRWU_M3w=%`b1y-i& zO4F=dXyqc8CdkEEL~^Msm&xU+bb(x9xz3gA z9X*(?%Sk}6B(1y`0yrBW|idC8>;9TU$YBTHO*M87PzQsvU)O2$@1 zq*?>^WtSF9eKq$=E3dfpth|~cHL}XeYp%Smf%duv+Up23S|Y1mStDz$yy4PIvd+qz zE+r6IFvMHhyzNp~S#RYXEAP7WvTSf^rEIja$;x{!)yQU-R>>AC@7tJcb!oMH;L;lT z(8@ub>%at#}RLsw(0aiFOQxsqnWs`y4I zYOJcf1sa-&Yf_A>3V#R%O{!~Ro=H=Mw?Ri!&o${L1KOEP)$7ToW~oRgpijchkfgz)70P1q7KqYnnw&b8GTbxgqj}CYly5 zjW;c=$!Qfats|z5%T1uKDX^xkHSH=hLT%Y8w5F)?*l?jZ&5=iylOy{j0|SbIJ=T<1 zbCfmhD`%w+k)|E2=?JVrS^*)f>BJN&KeznC8B8PE`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q+@pwRS=C343Un#&I)^^V{Z^$A#@9O zzr)=p-2Fk+A@m6MP&xFefr#P|MhGk(8kQTxfElh6&)vY18*%Z^d>4la*TsW_=q*}V z_qn6&QD-YhME21jT0x8qVU&nJ?sOcJj^ja$4q{9QW2NJSvzr9zI1$9S5Hu6+59N^T zUl-tm$Jl`J#Y$CSlaWD8;P9*{LbJc-9<{|}%nk>VJe)&t6F@N-_&fx$WGCXOlM z;+ps-PcBH~cQq(dLjBZXt{Ra2g4ZQWQK-(eN_G@Sope;cbe8 z0~F7H`)dN`O^FfRb?#rQk4XiQ_00CsP{EqgFVd z((xh6z$MfMU!_cZjk2(UvKvw*z_^lx-|^kgU|bpG)V#zW?7a9r{=m^43tgCZh=aB% zAIo2G@+o|ce|^AdCs6Z2Lr!sPAI}Iwjoik=a(`yq2*7lLc=s7d4HvnLE~fw!6A}{> z0|^NZ?r_fh;^0pD-`ta!Fh=9A6l2PlPDvG((3xe*(Qo=|F|nF~6a*m7`vS+smz>$* zF99a+=XU^>z#mNOCFIvjh-s9-@z=ZxTl`nho#zRPX%xiYV(SH6&BkKoA-e{X8mi5B zOy(f*J5@6`;xQ#0Gg5_zu;r%z?6tkKL{pgS$l*%wJ|4glom;xpgMT{{PGLH~Td@&a zNq3Bg|3`sw_@JBr8n1S$cY6Db{>H_|01mM^+|Bh8-N1h;pG!B=Jg4;}Ev2WN)*7my KHTA7(TJt~O>oBwc diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index 8291f50ae..a8b4ba13b 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -166,21 +166,19 @@ public class ForgeWorld extends AbstractWorld { boolean successful = successState != null; // Create the TileEntity - if (successful) { - if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) { - // Kill the old TileEntity - world.removeTileEntity(pos); - NBTTagCompound nativeTag = NBTConverter.toNative(((BaseBlock) block).getNbtData()); - nativeTag.putString("id", ((BaseBlock) block).getNbtId()); - TileEntityUtils.setTileEntity(world, position, nativeTag); + if (successful || old == newState) { + if (block instanceof BaseBlock) { + CompoundTag tag = ((BaseBlock) block).getNbtData(); + if (tag != null) { + NBTTagCompound nativeTag = NBTConverter.toNative(tag); + nativeTag.putString("id", ((BaseBlock) block).getNbtId()); + TileEntityUtils.setTileEntity(world, position, nativeTag); + } } } - if (notifyAndLight) { - if (!successful) { - newState = old; - } - world.checkLight(pos); + if (successful && notifyAndLight) { + //world.checkLight(pos); world.markAndNotifyBlock(pos, chunk, old, newState, UPDATE | NOTIFY); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java index 52f027f51..41ec90f66 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java @@ -29,8 +29,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.lang.reflect.Constructor; - import javax.annotation.Nullable; /** @@ -46,45 +44,14 @@ final class TileEntityUtils { * * @param tag the tag * @param position the position - * @return a tag compound */ - private static NBTTagCompound updateForSet(NBTTagCompound tag, BlockVector3 position) { + private static void updateForSet(NBTTagCompound tag, BlockVector3 position) { checkNotNull(tag); checkNotNull(position); tag.put("x", new NBTTagInt(position.getBlockX())); tag.put("y", new NBTTagInt(position.getBlockY())); tag.put("z", new NBTTagInt(position.getBlockZ())); - - return tag; - } - - /** - * Set a tile entity at the given location. - * - * @param world the world - * @param position the position - * @param clazz the tile entity class - * @param tag the tag for the tile entity (may be null to not set NBT data) - */ - static void setTileEntity(World world, BlockVector3 position, Class clazz, @Nullable NBTTagCompound tag) { - checkNotNull(world); - checkNotNull(position); - checkNotNull(clazz); - - TileEntity tileEntity = constructTileEntity(world, position, clazz); - - if (tileEntity == null) { - return; - } - - if (tag != null) { - // Set X, Y, Z - updateForSet(tag, position); - tileEntity.read(tag); - } - - world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity); } /** @@ -105,42 +72,6 @@ final class TileEntityUtils { } } - /** - * Construct a tile entity from the given class. - * - * @param world the world - * @param position the position - * @param clazz the class - * @return a tile entity (may be null if it failed) - */ - @Nullable - static TileEntity constructTileEntity(World world, BlockVector3 position, Class clazz) { - Constructor baseConstructor; - try { - baseConstructor = clazz.getConstructor(); // creates "blank" TE - } catch (Throwable e) { - return null; // every TE *should* have this constructor, so this isn't necessary - } - - TileEntity genericTE; - try { - genericTE = baseConstructor.newInstance(); - } catch (Throwable e) { - return null; - } - - /* - genericTE.blockType = Block.blocksList[block.getId()]; - genericTE.blockMetadata = block.getData(); - genericTE.xCoord = pt.getBlockX(); - genericTE.yCoord = pt.getBlockY(); - genericTE.zCoord = pt.getBlockZ(); - genericTE.worldObj = world; - */ // handled by internal code - - return genericTE; - } - public static NBTTagCompound copyNbtData(TileEntity tile) { NBTTagCompound tag = new NBTTagCompound(); tile.write(tag); From d1c2a029bf87b77e7e774da7dadad4887dfb6ae9 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 15 Mar 2019 22:38:38 -0400 Subject: [PATCH 168/182] Move some platform stuff to load, put enable back to postworld. --- .../java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 9 +++++++-- worldedit-bukkit/src/main/resources/plugin.yml | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) 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 9b50aa982..54de04928 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 @@ -110,6 +110,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { */ @Override public void onEnable() { + setupTags(); // these have to be done post-world since they rely on MC registries. the other ones just use Bukkit enums + PermissionsResolverManager.initialize(this); // Setup permission resolver // Register CUI @@ -168,12 +170,15 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { EntityType.REGISTRY.register("minecraft:" + mcid.toLowerCase(), new EntityType("minecraft:" + mcid.toLowerCase())); } } + } + + private void setupTags() { // Tags try { - for (org.bukkit.Tag blockTag : Bukkit.getTags(Tag.REGISTRY_BLOCKS, Material.class)) { + for (Tag blockTag : Bukkit.getTags(Tag.REGISTRY_BLOCKS, Material.class)) { BlockCategory.REGISTRY.register(blockTag.getKey().toString(), new BlockCategory(blockTag.getKey().toString())); } - for (org.bukkit.Tag itemTag : Bukkit.getTags(Tag.REGISTRY_ITEMS, Material.class)) { + for (Tag itemTag : Bukkit.getTags(Tag.REGISTRY_ITEMS, Material.class)) { ItemCategory.REGISTRY.register(itemTag.getKey().toString(), new ItemCategory(itemTag.getKey().toString())); } } catch (NoSuchMethodError e) { diff --git a/worldedit-bukkit/src/main/resources/plugin.yml b/worldedit-bukkit/src/main/resources/plugin.yml index 27808257f..e64d26bdc 100644 --- a/worldedit-bukkit/src/main/resources/plugin.yml +++ b/worldedit-bukkit/src/main/resources/plugin.yml @@ -1,7 +1,6 @@ name: WorldEdit main: com.sk89q.worldedit.bukkit.WorldEditPlugin version: "${internalVersion}" -load: STARTUP api-version: 1.13 # Permissions aren't here. Read http://wiki.sk89q.com/wiki/WEPIF/DinnerPerms From 25631af31c1fc6ab029f2b6700e22d2e77819cda Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 16 Mar 2019 00:49:21 -0400 Subject: [PATCH 169/182] Add RequestExtent to be used when a delayed EditSession is needed. For example, if you set a mask that takes an extent (many of them), and then move to another world, the mask will test blocks in the old world and return bad results. --- .../worldedit/command/BrushCommands.java | 17 +-- .../factory/parser/mask/BiomeMaskParser.java | 3 +- .../parser/mask/BlockCategoryMaskParser.java | 7 +- .../parser/mask/BlockStateMaskParser.java | 13 +-- .../factory/parser/mask/BlocksMaskParser.java | 8 +- .../parser/mask/ExistingMaskParser.java | 10 +- .../parser/mask/ExpressionMaskParser.java | 3 +- .../factory/parser/mask/OffsetMaskParser.java | 7 +- .../factory/parser/mask/SolidMaskParser.java | 10 +- .../shape/WorldEditExpressionEnvironment.java | 14 +-- .../session/request/RequestExtent.java | 109 ++++++++++++++++++ 11 files changed, 145 insertions(+), 56 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java 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 0d1adc1d3..3c9e4b001 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 @@ -47,6 +47,7 @@ import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.session.ClipboardHolder; +import com.sk89q.worldedit.session.request.RequestExtent; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.parametric.Optional; @@ -81,7 +82,7 @@ public class BrushCommands { max = 2 ) @CommandPermissions("worldedit.brush.sphere") - public void sphereBrush(Player player, LocalSession session, EditSession editSession, Pattern fill, + public void sphereBrush(Player player, LocalSession session, Pattern fill, @Optional("2") double radius, @Switch('h') boolean hollow) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); @@ -110,7 +111,7 @@ public class BrushCommands { max = 3 ) @CommandPermissions("worldedit.brush.cylinder") - public void cylinderBrush(Player player, LocalSession session, EditSession editSession, Pattern fill, + public void cylinderBrush(Player player, LocalSession session, Pattern fill, @Optional("2") double radius, @Optional("1") int height, @Switch('h') boolean hollow) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(height); @@ -141,7 +142,7 @@ public class BrushCommands { "stood relative to the copied area when you copied it." ) @CommandPermissions("worldedit.brush.clipboard") - public void clipboardBrush(Player player, LocalSession session, EditSession editSession, @Switch('a') boolean ignoreAir, @Switch('p') boolean usingOrigin) throws WorldEditException { + public void clipboardBrush(Player player, LocalSession session, @Switch('a') boolean ignoreAir, @Switch('p') boolean usingOrigin) throws WorldEditException { ClipboardHolder holder = session.getClipboard(); Clipboard clipboard = holder.getClipboard(); @@ -168,7 +169,7 @@ public class BrushCommands { max = 3 ) @CommandPermissions("worldedit.brush.smooth") - public void smoothBrush(Player player, LocalSession session, EditSession editSession, + public void smoothBrush(Player player, LocalSession session, @Optional("2") double radius, @Optional("4") int iterations, @Optional Mask mask) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); @@ -187,14 +188,14 @@ public class BrushCommands { max = 1 ) @CommandPermissions("worldedit.brush.ex") - public void extinguishBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius) throws WorldEditException { + public void extinguishBrush(Player player, LocalSession session, @Optional("5") double radius) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); Pattern fill = new BlockPattern(BlockTypes.AIR.getDefaultState()); tool.setFill(fill); tool.setSize(radius); - tool.setMask(new BlockTypeMask(editSession, BlockTypes.FIRE)); + tool.setMask(new BlockTypeMask(new RequestExtent(), BlockTypes.FIRE)); tool.setBrush(new SphereBrush(), "worldedit.brush.ex"); player.print(String.format("Extinguisher equipped (%.0f).", radius)); @@ -213,7 +214,7 @@ public class BrushCommands { max = 1 ) @CommandPermissions("worldedit.brush.gravity") - public void gravityBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius, @Switch('h') boolean fromMaxY) throws WorldEditException { + public void gravityBrush(Player player, LocalSession session, @Optional("5") double radius, @Switch('h') boolean fromMaxY) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); @@ -244,7 +245,7 @@ public class BrushCommands { max = 1 ) @CommandPermissions("worldedit.brush.butcher") - public void butcherBrush(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void butcherBrush(Player player, LocalSession session, CommandContext args) throws WorldEditException { LocalConfiguration config = worldEdit.getConfiguration(); double radius = args.argsLength() > 0 ? args.getDouble(0) : 5; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java index bc4f81455..11b8bb54c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BiomeMaskParser.java @@ -28,6 +28,7 @@ import com.sk89q.worldedit.function.mask.BiomeMask2D; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.session.request.RequestExtent; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.Biomes; import com.sk89q.worldedit.world.registry.BiomeRegistry; @@ -59,6 +60,6 @@ public class BiomeMaskParser extends InputParser { biomes.add(biome); } - return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes)); + return Masks.asMask(new BiomeMask2D(new RequestExtent(), biomes)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java index aceba782a..ec3c65b5c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockCategoryMaskParser.java @@ -22,11 +22,10 @@ package com.sk89q.worldedit.extension.factory.parser.mask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.BlockCategoryMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.session.request.RequestExtent; import com.sk89q.worldedit.world.block.BlockCategory; public class BlockCategoryMaskParser extends InputParser { @@ -41,14 +40,12 @@ public class BlockCategoryMaskParser extends InputParser { return null; } - Extent extent = Request.request().getEditSession(); - // This means it's a tag mask. BlockCategory category = BlockCategory.REGISTRY.get(input.substring(2).toLowerCase()); if (category == null) { throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\''); } else { - return new BlockCategoryMask(extent, category); + return new BlockCategoryMask(new RequestExtent(), category); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java index f76346f27..0a2bd6e56 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java @@ -20,20 +20,13 @@ package com.sk89q.worldedit.extension.factory.parser.mask; import com.google.common.base.Splitter; -import com.google.common.collect.Maps; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.BlockStateMask; import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.mask.NoiseFilter; import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.math.noise.RandomNoise; -import com.sk89q.worldedit.session.request.Request; - -import java.util.Arrays; -import java.util.stream.Collectors; +import com.sk89q.worldedit.session.request.RequestExtent; public class BlockStateMaskParser extends InputParser { @@ -46,11 +39,11 @@ public class BlockStateMaskParser extends InputParser { if (!(input.startsWith("^[") || input.startsWith("^=[")) || !input.endsWith("]")) { return null; } - Extent extent = Request.request().getEditSession(); + boolean strict = input.charAt(1) == '='; String states = input.substring(2 + (strict ? 1 : 0), input.length() - 1); try { - return new BlockStateMask(extent, + return new BlockStateMask(new RequestExtent(), Splitter.on(',').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(states), strict); } catch (Exception e) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java index 006b0d27f..e67a7e8b1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java @@ -23,11 +23,10 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.session.request.RequestExtent; import com.sk89q.worldedit.world.block.BaseBlock; import java.util.Set; @@ -41,9 +40,8 @@ public class BlocksMaskParser extends InputParser { super(worldEdit); } + @Override public Mask parseFromInput(String component, ParserContext context) throws InputParseException { - Extent extent = Request.request().getEditSession(); - ParserContext tempContext = new ParserContext(context); tempContext.setRestricted(false); tempContext.setPreferringWildcard(true); @@ -52,7 +50,7 @@ public class BlocksMaskParser extends InputParser { if (holders.isEmpty()) { return null; } - return new BlockMask(extent, holders); + return new BlockMask(new RequestExtent(), holders); } catch (NoMatchException e) { return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java index a1dea6f48..5249d47ad 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExistingMaskParser.java @@ -21,13 +21,11 @@ package com.sk89q.worldedit.extension.factory.parser.mask; import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.internal.registry.SimpleInputParser; -import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.session.request.RequestExtent; import java.util.List; @@ -43,9 +41,7 @@ public class ExistingMaskParser extends SimpleInputParser { } @Override - public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException { - Extent extent = Request.request().getEditSession(); - - return new ExistingBlockMask(extent); + public Mask parseFromSimpleInput(String input, ParserContext context) { + return new ExistingBlockMask(new RequestExtent()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java index 9267af44a..4e254109c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExpressionMaskParser.java @@ -31,6 +31,7 @@ import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; import com.sk89q.worldedit.session.SessionOwner; import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.session.request.RequestExtent; import java.util.function.IntSupplier; @@ -49,7 +50,7 @@ public class ExpressionMaskParser extends InputParser { try { Expression exp = Expression.compile(input.substring(1), "x", "y", "z"); WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment( - Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO); + new RequestExtent(), Vector3.ONE, Vector3.ZERO); exp.setEnvironment(env); if (context.getActor() instanceof SessionOwner) { SessionOwner owner = (SessionOwner) context.getActor(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java index 74fe7de17..ab4882e00 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/OffsetMaskParser.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit.extension.factory.parser.mask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.MaskIntersection; @@ -30,7 +29,7 @@ import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.mask.OffsetMask; import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.session.request.RequestExtent; public class OffsetMaskParser extends InputParser { @@ -45,13 +44,11 @@ public class OffsetMaskParser extends InputParser { return null; } - Extent extent = Request.request().getEditSession(); - Mask submask; if (input.length() > 1) { submask = worldEdit.getMaskFactory().parseFromInput(input.substring(1), context); } else { - submask = new ExistingBlockMask(extent); + submask = new ExistingBlockMask(new RequestExtent()); } OffsetMask offsetMask = new OffsetMask(submask, BlockVector3.at(0, firstChar == '>' ? -1 : 1, 0)); return new MaskIntersection(offsetMask, Masks.negate(submask)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java index 84df2fec8..44e2f07a2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SolidMaskParser.java @@ -21,13 +21,11 @@ package com.sk89q.worldedit.extension.factory.parser.mask; import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.SolidBlockMask; import com.sk89q.worldedit.internal.registry.SimpleInputParser; -import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.session.request.RequestExtent; import java.util.List; @@ -43,9 +41,7 @@ public class SolidMaskParser extends SimpleInputParser { } @Override - public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException { - Extent extent = Request.request().getEditSession(); - - return new SolidBlockMask(extent); + public Mask parseFromSimpleInput(String input, ParserContext context) { + return new SolidBlockMask(new RequestExtent()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java index 4601164f7..2304e4876 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.regions.shape; -import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; @@ -29,10 +29,10 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { private final Vector3 unit; private final Vector3 zero2; private Vector3 current = Vector3.ZERO; - private EditSession editSession; + private Extent extent; - public WorldEditExpressionEnvironment(EditSession editSession, Vector3 unit, Vector3 zero) { - this.editSession = editSession; + public WorldEditExpressionEnvironment(Extent extent, Vector3 unit, Vector3 zero) { + this.extent = extent; this.unit = unit; this.zero2 = zero.add(0.5, 0.5, 0.5); } @@ -48,7 +48,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { @Override public int getBlockType(double x, double y, double z) { - return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); + return extent.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); } @Override @@ -58,7 +58,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { @Override public int getBlockTypeAbs(double x, double y, double z) { - return editSession.getBlock(BlockVector3.at(x, y, z)).getBlockType().getLegacyId(); + return extent.getBlock(BlockVector3.at(x, y, z)).getBlockType().getLegacyId(); } @Override @@ -68,7 +68,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { @Override public int getBlockTypeRel(double x, double y, double z) { - return editSession.getBlock(toWorldRel(x, y, z).toBlockPoint()).getBlockType().getLegacyId(); + return extent.getBlock(toWorldRel(x, y, z).toBlockPoint()).getBlockType().getLegacyId(); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java new file mode 100644 index 000000000..993e92572 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java @@ -0,0 +1,109 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.session.request; + +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.entity.Entity; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; + +import javax.annotation.Nullable; +import java.util.List; + +public class RequestExtent implements Extent { + + private EditSession extent; + + protected Extent getExtent() { + if (extent == null) { + extent = Request.request().getEditSession(); + } + return extent; + } + + @Override + public BlockVector3 getMinimumPoint() { + return getExtent().getMinimumPoint(); + } + + @Override + public BlockVector3 getMaximumPoint() { + return getExtent().getMaximumPoint(); + } + + @Override + public List getEntities(Region region) { + return getExtent().getEntities(region); + } + + @Override + public List getEntities() { + return getExtent().getEntities(); + } + + @Override + @Nullable + public Entity createEntity(Location location, BaseEntity entity) { + return getExtent().createEntity(location, entity); + } + + @Override + public BlockState getBlock(BlockVector3 position) { + return getExtent().getBlock(position); + } + + @Override + public BaseBlock getFullBlock(BlockVector3 position) { + return getExtent().getFullBlock(position); + } + + @Override + public BiomeType getBiome(BlockVector2 position) { + return getExtent().getBiome(position); + } + + @Override + public > boolean setBlock(BlockVector3 position, T block) throws WorldEditException { + return getExtent().setBlock(position, block); + } + + @Override + public boolean setBiome(BlockVector2 position, BiomeType biome) { + return getExtent().setBiome(position, biome); + } + + @Override + @Nullable + public Operation commit() { + Operation commit = getExtent().commit(); + extent = null; + return commit; + } +} From 1934006d141612d5ae7bd2c92f686164ae8b42db Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 16 Mar 2019 19:04:24 -0400 Subject: [PATCH 170/182] Better enforce the Request lifetime. Previously, the current request would just get a new EditSession when one was created. Now, a Request is reset before and after: - a command is used and - an interact is fired with the platform This means each action taken will get a single, non-reusable Request. Note that this only applies to actions taken through the platform. API users will not be using requests anyway, since things like Masks, etc. will be constructed directly instead of being passed through the platform's parsers and so on. (e.g. if a plugin loads a schematic into the world with a mask, they should create the EditSession and mask it directly, and not use that Mask again for another EditSession in another World). Also, get rid of a bunch of (some now-)unnecessary EditSession creation during command dispatching. Note that this also fixed the dynamic selection mask, which apparently has been broken for some unknown amount of time. --- .../com/sk89q/worldedit/LocalSession.java | 3 +- .../java/com/sk89q/worldedit/WorldEdit.java | 3 - .../worldedit/command/BrushCommands.java | 1 - .../worldedit/command/ChunkCommands.java | 7 +- .../worldedit/command/ClipboardCommands.java | 4 +- .../worldedit/command/GeneralCommands.java | 12 +- .../worldedit/command/HistoryCommands.java | 6 +- .../worldedit/command/NavigationCommands.java | 10 +- .../worldedit/command/ScriptingCommands.java | 5 +- .../worldedit/command/SelectionCommands.java | 28 +-- .../worldedit/command/SnapshotCommands.java | 11 +- .../command/SuperPickaxeCommands.java | 7 +- .../sk89q/worldedit/command/ToolCommands.java | 13 +- .../worldedit/command/ToolUtilCommands.java | 11 +- .../worldedit/command/WorldEditCommands.java | 5 +- .../worldedit/command/tool/BrushTool.java | 1 - .../extension/platform/CommandManager.java | 17 +- .../extension/platform/PlatformManager.java | 209 ++++++++++-------- .../scripting/CraftScriptContext.java | 2 + .../worldedit/session/SessionManager.java | 4 +- .../worldedit/session/request/Request.java | 15 ++ .../session/request/RequestExtent.java | 10 +- 22 files changed, 207 insertions(+), 177 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index cadeec817..bf15a504a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -875,9 +875,10 @@ public class LocalSession { EditSession editSession = WorldEdit.getInstance().getEditSessionFactory() .getEditSession(player.isPlayer() ? player.getWorld() : null, getBlockChangeLimit(), blockBag, player); + Request.request().setEditSession(editSession); + editSession.setFastMode(fastMode); editSession.setReorderMode(reorderMode); - Request.request().setEditSession(editSession); editSession.setMask(mask); return editSession; 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 66233e05c..e206f383f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -42,7 +42,6 @@ import com.sk89q.worldedit.scripting.CraftScriptContext; import com.sk89q.worldedit.scripting.CraftScriptEngine; import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; import com.sk89q.worldedit.session.SessionManager; -import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.eventbus.EventBus; @@ -595,8 +594,6 @@ public final class WorldEdit { * @throws WorldEditException */ public void runScript(Player player, File f, String[] args) throws WorldEditException { - Request.reset(); - String filename = f.getPath(); int index = filename.lastIndexOf('.'); String ext = filename.substring(index + 1); 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 3c9e4b001..26fcf4d92 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 @@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java index 39ee0969e..30d99269d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java @@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; import com.sk89q.minecraft.util.commands.Command; -import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.worldedit.EditSession; @@ -63,7 +62,7 @@ public class ChunkCommands { max = 0 ) @CommandPermissions("worldedit.chunkinfo") - public void chunkInfo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void chunkInfo(Player player) throws WorldEditException { Location pos = player.getBlockIn(); int chunkX = (int) Math.floor(pos.getBlockX() / 16.0); int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0); @@ -87,7 +86,7 @@ public class ChunkCommands { max = 0 ) @CommandPermissions("worldedit.listchunks") - public void listChunks(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void listChunks(Player player, LocalSession session) throws WorldEditException { Set chunks = session.getSelection(player.getWorld()).getChunks(); for (BlockVector2 chunk : chunks) { @@ -104,7 +103,7 @@ public class ChunkCommands { ) @CommandPermissions("worldedit.delchunks") @Logging(REGION) - public void deleteChunks(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void deleteChunks(Player player, LocalSession session) throws WorldEditException { player.print("Note that this command does not yet support the mcregion format."); LocalConfiguration config = worldEdit.getConfiguration(); 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 51c8c3602..95cb27f66 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 @@ -211,7 +211,7 @@ public class ClipboardCommands { max = 1 ) @CommandPermissions("worldedit.clipboard.flip") - public void flip(Player player, LocalSession session, EditSession editSession, + public void flip(Player player, LocalSession session, @Optional(Direction.AIM) @Direction BlockVector3 direction) throws WorldEditException { ClipboardHolder holder = session.getClipboard(); AffineTransform transform = new AffineTransform(); @@ -228,7 +228,7 @@ public class ClipboardCommands { max = 0 ) @CommandPermissions("worldedit.clipboard.clear") - public void clearClipboard(Player player, LocalSession session, EditSession editSession) throws WorldEditException { + public void clearClipboard(Player player, LocalSession session) throws WorldEditException { session.setClipboard(null); player.print("Clipboard cleared."); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index b16aece4e..b05adf155 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -63,7 +63,7 @@ public class GeneralCommands { max = 1 ) @CommandPermissions("worldedit.limit") - public void limit(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void limit(Player player, LocalSession session, CommandContext args) throws WorldEditException { LocalConfiguration config = worldEdit.getConfiguration(); boolean mayDisable = player.hasPermission("worldedit.limit.unrestricted"); @@ -93,7 +93,7 @@ public class GeneralCommands { max = 1 ) @CommandPermissions("worldedit.timeout") - public void timeout(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void timeout(Player player, LocalSession session, CommandContext args) throws WorldEditException { LocalConfiguration config = worldEdit.getConfiguration(); boolean mayDisable = player.hasPermission("worldedit.timeout.unrestricted"); @@ -123,7 +123,7 @@ public class GeneralCommands { max = 1 ) @CommandPermissions("worldedit.fast") - public void fast(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void fast(Player player, LocalSession session, CommandContext args) throws WorldEditException { String newState = args.getString(0, null); if (session.hasFastMode()) { @@ -153,7 +153,7 @@ public class GeneralCommands { max = 1 ) @CommandPermissions("worldedit.reorder") - public void reorderMode(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void reorderMode(Player player, LocalSession session, CommandContext args) throws WorldEditException { String newState = args.getString(0, null); if (newState == null) { player.print("The reorder mode is " + session.getReorderMode().getDisplayName()); @@ -213,7 +213,7 @@ public class GeneralCommands { max = -1 ) @CommandPermissions("worldedit.global-mask") - public void gmask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException { + public void gmask(Player player, LocalSession session, @Optional Mask mask) throws WorldEditException { if (mask == null) { session.setMask((Mask) null); player.print("Global mask disabled."); @@ -230,7 +230,7 @@ public class GeneralCommands { min = 0, max = 0 ) - public void togglePlace(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void togglePlace(Player player, LocalSession session) throws WorldEditException { if (session.togglePlacementPosition()) { player.print("Now placing at pos #1."); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java index 8b76b68d4..b960dfbe4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java @@ -55,7 +55,7 @@ public class HistoryCommands { max = 2 ) @CommandPermissions("worldedit.history.undo") - public void undo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void undo(Player player, LocalSession session, CommandContext args) throws WorldEditException { int times = Math.max(1, args.getInteger(0, 1)); for (int i = 0; i < times; ++i) { EditSession undone; @@ -88,7 +88,7 @@ public class HistoryCommands { max = 2 ) @CommandPermissions("worldedit.history.redo") - public void redo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void redo(Player player, LocalSession session, CommandContext args) throws WorldEditException { int times = Math.max(1, args.getInteger(0, 1)); @@ -122,7 +122,7 @@ public class HistoryCommands { max = 0 ) @CommandPermissions("worldedit.history.clear") - public void clearHistory(Player player, LocalSession session, EditSession editSession) throws WorldEditException { + public void clearHistory(Player player, LocalSession session) throws WorldEditException { session.clearHistory(); player.print("History cleared."); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java index a4b09eb18..2d64d472b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java @@ -26,9 +26,7 @@ import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; -import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; @@ -121,7 +119,7 @@ public class NavigationCommands { ) @CommandPermissions("worldedit.navigation.ceiling") @Logging(POSITION) - public void ceiling(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void ceiling(Player player, CommandContext args) throws WorldEditException { final int clearance = args.argsLength() > 0 ? Math.max(0, args.getInteger(0)) : 0; @@ -142,7 +140,7 @@ public class NavigationCommands { max = 0 ) @CommandPermissions("worldedit.navigation.thru.command") - public void thru(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void thru(Player player) throws WorldEditException { if (player.passThroughForwardWall(6)) { player.print("Whoosh!"); } else { @@ -158,7 +156,7 @@ public class NavigationCommands { max = 0 ) @CommandPermissions("worldedit.navigation.jumpto.command") - public void jumpTo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void jumpTo(Player player) throws WorldEditException { Location pos = player.getSolidBlockTrace(300); if (pos != null) { @@ -179,7 +177,7 @@ public class NavigationCommands { ) @CommandPermissions("worldedit.navigation.up") @Logging(POSITION) - public void up(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void up(Player player, CommandContext args) throws WorldEditException { final int distance = args.getInteger(0); final boolean alwaysGlass = getAlwaysGlass(args); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java index 922dfcb69..2b7d9a61f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java @@ -26,7 +26,6 @@ import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; @@ -60,7 +59,7 @@ public class ScriptingCommands { ) @CommandPermissions("worldedit.scripting.execute") @Logging(ALL) - public void execute(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void execute(Player player, LocalSession session, CommandContext args) throws WorldEditException { String[] scriptArgs = args.getSlice(1); String name = args.getString(0); @@ -87,7 +86,7 @@ public class ScriptingCommands { ) @CommandPermissions("worldedit.scripting.execute") @Logging(ALL) - public void executeLast(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void executeLast(Player player, LocalSession session, CommandContext args) throws WorldEditException { String lastScript = session.getLastScript(); 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 86e39dfd3..f0fc6634f 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 @@ -87,7 +87,7 @@ public class SelectionCommands { ) @Logging(POSITION) @CommandPermissions("worldedit.selection.pos") - public void pos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void pos1(Player player, LocalSession session, CommandContext args) throws WorldEditException { Location pos; @@ -121,7 +121,7 @@ public class SelectionCommands { ) @Logging(POSITION) @CommandPermissions("worldedit.selection.pos") - public void pos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void pos2(Player player, LocalSession session, CommandContext args) throws WorldEditException { Location pos; if (args.argsLength() == 1) { @@ -155,7 +155,7 @@ public class SelectionCommands { max = 0 ) @CommandPermissions("worldedit.selection.hpos") - public void hpos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void hpos1(Player player, LocalSession session) throws WorldEditException { Location pos = player.getBlockTrace(300); @@ -180,7 +180,7 @@ public class SelectionCommands { max = 0 ) @CommandPermissions("worldedit.selection.hpos") - public void hpos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void hpos2(Player player, LocalSession session) throws WorldEditException { Location pos = player.getBlockTrace(300); @@ -215,7 +215,7 @@ public class SelectionCommands { ) @Logging(POSITION) @CommandPermissions("worldedit.selection.chunk") - public void chunk(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void chunk(Player player, LocalSession session, CommandContext args) throws WorldEditException { final BlockVector3 min; final BlockVector3 max; final World world = player.getWorld(); @@ -277,7 +277,7 @@ public class SelectionCommands { max = 0 ) @CommandPermissions("worldedit.wand") - public void wand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void wand(Player player) throws WorldEditException { player.giveItem(new BaseItemStack(ItemTypes.get(we.getConfiguration().wandItem), 1)); player.print("Left click: select pos #1; Right click: select pos #2"); @@ -291,7 +291,7 @@ public class SelectionCommands { max = 0 ) @CommandPermissions("worldedit.wand.toggle") - public void toggleWand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void toggleWand(Player player, LocalSession session, CommandContext args) throws WorldEditException { session.setToolControl(!session.isToolControlEnabled()); @@ -311,7 +311,7 @@ public class SelectionCommands { ) @Logging(REGION) @CommandPermissions("worldedit.selection.expand") - public void expand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void expand(Player player, LocalSession session, CommandContext args) throws WorldEditException { // Special syntax (//expand vert) to expand the selection between // sky and bedrock. @@ -406,7 +406,7 @@ public class SelectionCommands { ) @Logging(REGION) @CommandPermissions("worldedit.selection.contract") - public void contract(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void contract(Player player, LocalSession session, CommandContext args) throws WorldEditException { List dirs = new ArrayList<>(); int change = args.getInteger(0); @@ -481,7 +481,7 @@ public class SelectionCommands { ) @Logging(REGION) @CommandPermissions("worldedit.selection.shift") - public void shift(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void shift(Player player, LocalSession session, CommandContext args) throws WorldEditException { List dirs = new ArrayList<>(); int change = args.getInteger(0); @@ -529,7 +529,7 @@ public class SelectionCommands { ) @Logging(REGION) @CommandPermissions("worldedit.selection.outset") - public void outset(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void outset(Player player, LocalSession session, CommandContext args) throws WorldEditException { Region region = session.getSelection(player.getWorld()); region.expand(getChangesForEachDir(args)); session.getRegionSelector(player.getWorld()).learnChanges(); @@ -552,7 +552,7 @@ public class SelectionCommands { ) @Logging(REGION) @CommandPermissions("worldedit.selection.inset") - public void inset(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void inset(Player player, LocalSession session, CommandContext args) throws WorldEditException { Region region = session.getSelection(player.getWorld()); region.contract(getChangesForEachDir(args)); session.getRegionSelector(player.getWorld()).learnChanges(); @@ -588,7 +588,7 @@ public class SelectionCommands { max = 0 ) @CommandPermissions("worldedit.selection.size") - public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void size(Player player, LocalSession session, CommandContext args) throws WorldEditException { if (args.hasFlag('c')) { ClipboardHolder holder = session.getClipboard(); Clipboard clipboard = holder.getClipboard(); @@ -706,7 +706,7 @@ public class SelectionCommands { min = 0, max = 1 ) - public void select(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void select(Player player, LocalSession session, CommandContext args) throws WorldEditException { final World world = player.getWorld(); if (args.argsLength() == 0) { session.getRegionSelector(world).clear(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java index 7c01fc305..1c4987734 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java @@ -24,7 +24,6 @@ package com.sk89q.worldedit.command; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -62,7 +61,7 @@ public class SnapshotCommands { max = 1 ) @CommandPermissions("worldedit.snapshots.list") - public void list(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void list(Player player, CommandContext args) throws WorldEditException { LocalConfiguration config = we.getConfiguration(); @@ -112,7 +111,7 @@ public class SnapshotCommands { max = 1 ) @CommandPermissions("worldedit.snapshots.restore") - public void use(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void use(Player player, LocalSession session, CommandContext args) throws WorldEditException { LocalConfiguration config = we.getConfiguration(); @@ -155,7 +154,7 @@ public class SnapshotCommands { max = 1 ) @CommandPermissions("worldedit.snapshots.restore") - public void sel(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void sel(Player player, LocalSession session, CommandContext args) throws WorldEditException { LocalConfiguration config = we.getConfiguration(); if (config.snapshotRepo == null) { @@ -202,7 +201,7 @@ public class SnapshotCommands { max = -1 ) @CommandPermissions("worldedit.snapshots.restore") - public void before(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void before(Player player, LocalSession session, CommandContext args) throws WorldEditException { LocalConfiguration config = we.getConfiguration(); @@ -241,7 +240,7 @@ public class SnapshotCommands { max = -1 ) @CommandPermissions("worldedit.snapshots.restore") - public void after(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void after(Player player, LocalSession session, CommandContext args) throws WorldEditException { LocalConfiguration config = we.getConfiguration(); 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 5fa571265..a3e21db8a 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 @@ -22,7 +22,6 @@ package com.sk89q.worldedit.command; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -47,7 +46,7 @@ public class SuperPickaxeCommands { max = 0 ) @CommandPermissions("worldedit.superpickaxe") - public void single(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void single(Player player, LocalSession session) throws WorldEditException { session.setSuperPickaxe(new SinglePickaxe()); session.enableSuperPickAxe(); @@ -62,7 +61,7 @@ public class SuperPickaxeCommands { max = 1 ) @CommandPermissions("worldedit.superpickaxe.area") - public void area(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void area(Player player, LocalSession session, CommandContext args) throws WorldEditException { LocalConfiguration config = we.getConfiguration(); int range = args.getInteger(0); @@ -85,7 +84,7 @@ public class SuperPickaxeCommands { max = 1 ) @CommandPermissions("worldedit.superpickaxe.recursive") - public void recursive(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void recursive(Player player, LocalSession session, CommandContext args) throws WorldEditException { LocalConfiguration config = we.getConfiguration(); double range = args.getDouble(0); 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 fdf5337aa..c61c2fc92 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 @@ -22,7 +22,6 @@ package com.sk89q.worldedit.command; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -56,7 +55,7 @@ public class ToolCommands { min = 0, max = 0 ) - public void none(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void none(Player player, LocalSession session) throws WorldEditException { session.setTool(player.getItemInHand(HandSide.MAIN_HAND).getType(), null); player.print("Tool unbound from your current item."); @@ -70,7 +69,7 @@ public class ToolCommands { max = 0 ) @CommandPermissions("worldedit.tool.info") - public void info(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void info(Player player, LocalSession session) throws WorldEditException { BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); session.setTool(itemStack.getType(), new QueryTool()); @@ -86,7 +85,7 @@ public class ToolCommands { max = 1 ) @CommandPermissions("worldedit.tool.tree") - public void tree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void tree(Player player, LocalSession session, CommandContext args) throws WorldEditException { TreeGenerator.TreeType type = args.argsLength() > 0 ? TreeGenerator.lookup(args.getString(0)) @@ -124,7 +123,7 @@ public class ToolCommands { max = 0 ) @CommandPermissions("worldedit.tool.data-cycler") - public void cycler(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void cycler(Player player, LocalSession session) throws WorldEditException { BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); session.setTool(itemStack.getType(), new BlockDataCyler()); @@ -161,7 +160,7 @@ public class ToolCommands { max = 0 ) @CommandPermissions("worldedit.tool.deltree") - public void deltree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void deltree(Player player, LocalSession session) throws WorldEditException { BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); session.setTool(itemStack.getType(), new FloatingTreeRemover()); @@ -177,7 +176,7 @@ public class ToolCommands { max = 0 ) @CommandPermissions("worldedit.tool.farwand") - public void farwand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void farwand(Player player, LocalSession session) throws WorldEditException { BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); session.setTool(itemStack.getType(), new DistanceWand()); 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 e74dd129f..df1637880 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 @@ -22,7 +22,6 @@ package com.sk89q.worldedit.command; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; @@ -50,7 +49,7 @@ public class ToolUtilCommands { max = 1 ) @CommandPermissions("worldedit.superpickaxe") - public void togglePickaxe(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void togglePickaxe(Player player, LocalSession session, CommandContext args) throws WorldEditException { String newState = args.getString(0, null); if (session.hasSuperPickAxe()) { @@ -80,7 +79,7 @@ public class ToolUtilCommands { max = -1 ) @CommandPermissions("worldedit.brush.options.mask") - public void mask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException { + public void mask(Player player, LocalSession session, @Optional Mask mask) throws WorldEditException { if (mask == null) { session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setMask(null); player.print("Brush mask disabled."); @@ -98,7 +97,7 @@ public class ToolUtilCommands { max = 1 ) @CommandPermissions("worldedit.brush.options.material") - public void material(Player player, LocalSession session, EditSession editSession, Pattern pattern) throws WorldEditException { + public void material(Player player, LocalSession session, Pattern pattern) throws WorldEditException { session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setFill(pattern); player.print("Brush material set."); } @@ -111,7 +110,7 @@ public class ToolUtilCommands { max = 1 ) @CommandPermissions("worldedit.brush.options.range") - public void range(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void range(Player player, LocalSession session, CommandContext args) throws WorldEditException { int range = args.getInteger(0); session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setRange(range); player.print("Brush range set."); @@ -125,7 +124,7 @@ public class ToolUtilCommands { max = 1 ) @CommandPermissions("worldedit.brush.options.size") - public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void size(Player player, LocalSession session, CommandContext args) throws WorldEditException { int radius = args.getInteger(0); we.checkMaxBrushRadius(radius); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java index 81add21d7..26c382beb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java @@ -23,7 +23,6 @@ import com.google.common.io.Files; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; @@ -126,7 +125,7 @@ public class WorldEditCommands { min = 0, max = 0 ) - public void cui(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void cui(Player player, LocalSession session) throws WorldEditException { session.setCUISupport(true); session.dispatchCUISetup(player); } @@ -138,7 +137,7 @@ public class WorldEditCommands { min = 1, max = 1 ) - public void tz(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { + public void tz(Player player, LocalSession session, CommandContext args) throws WorldEditException { TimeZone tz = TimeZone.getTimeZone(args.getString(0)); session.setTimezone(tz); player.print("Timezone set for this session to: " + tz.getDisplayName()); 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 403361f02..cb98b9a3a 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 @@ -173,7 +173,6 @@ public class BrushTool implements TraceTool { BlockBag bag = session.getBlockBag(player); try (EditSession editSession = session.createEditSession(player)) { - Request.request().setEditSession(editSession); if (mask != null) { Mask existingMask = editSession.getMask(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java index 01e8862e0..a0be07b65 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.extension.platform; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.util.command.composition.LegacyCommandAdapter.adapt; + import com.google.common.base.Joiner; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; @@ -54,8 +57,10 @@ import com.sk89q.worldedit.command.composition.DeformCommand; import com.sk89q.worldedit.command.composition.PaintCommand; import com.sk89q.worldedit.command.composition.SelectionCommand; import com.sk89q.worldedit.command.composition.ShapedBrushCommand; +import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; +import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.factory.Deform; import com.sk89q.worldedit.function.factory.Deform.Mode; import com.sk89q.worldedit.internal.command.ActorAuthorizer; @@ -76,6 +81,7 @@ import com.sk89q.worldedit.util.formatting.ColorCodeBuilder; import com.sk89q.worldedit.util.formatting.component.CommandUsageBox; import com.sk89q.worldedit.util.logging.DynamicStreamHandler; import com.sk89q.worldedit.util.logging.LogFormat; +import com.sk89q.worldedit.world.World; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -85,9 +91,6 @@ import java.util.logging.FileHandler; import java.util.logging.Level; import java.util.regex.Pattern; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.util.command.composition.LegacyCommandAdapter.adapt; - /** * Handles the registration and invocation of commands. * @@ -260,6 +263,13 @@ public final class CommandManager { } LocalSession session = worldEdit.getSessionManager().get(actor); + Request.request().setSession(session); + if (actor instanceof Entity) { + Extent extent = ((Entity) actor).getExtent(); + if (extent instanceof World) { + Request.request().setWorld(((World) extent)); + } + } LocalConfiguration config = worldEdit.getConfiguration(); CommandLocals locals = new CommandLocals(); @@ -335,6 +345,7 @@ public final class CommandManager { worldEdit.flushBlockBag(actor, editSession); } + Request.reset(); } event.setCancelled(true); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index dd6c16ab1..1f124dd23 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -38,6 +38,7 @@ import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.RegionSelector; +import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.eventbus.Subscribe; @@ -314,70 +315,78 @@ public class PlatformManager { Player player = (Player) actor; LocalSession session = worldEdit.getSessionManager().get(actor); - if (event.getType() == Interaction.HIT) { - if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().wandItem)) { - if (!session.isToolControlEnabled()) { - return; - } + Request.reset(); + Request.request().setSession(session); + Request.request().setWorld(player.getWorld()); - if (!actor.hasPermission("worldedit.selection.pos")) { - return; - } + try { + if (event.getType() == Interaction.HIT) { + if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().wandItem)) { + if (!session.isToolControlEnabled()) { + return; + } - RegionSelector selector = session.getRegionSelector(player.getWorld()); + if (!actor.hasPermission("worldedit.selection.pos")) { + return; + } - BlockVector3 blockPoint = vector.toBlockPoint(); - if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) { - selector.explainPrimarySelection(actor, session, blockPoint); - } + RegionSelector selector = session.getRegionSelector(player.getWorld()); - event.setCancelled(true); - return; - } + BlockVector3 blockPoint = vector.toBlockPoint(); + if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) { + selector.explainPrimarySelection(actor, session, blockPoint); + } - if (player.isHoldingPickAxe() && session.hasSuperPickAxe()) { - final BlockTool superPickaxe = session.getSuperPickaxe(); - if (superPickaxe != null && superPickaxe.canUse(player)) { - event.setCancelled(superPickaxe.actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location)); - return; - } - } - - Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); - if (tool instanceof DoubleActionBlockTool) { - if (tool.canUse(player)) { - ((DoubleActionBlockTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location); event.setCancelled(true); - } - } - - } else if (event.getType() == Interaction.OPEN) { - if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().wandItem)) { - if (!session.isToolControlEnabled()) { return; } - if (!actor.hasPermission("worldedit.selection.pos")) { - return; + if (player.isHoldingPickAxe() && session.hasSuperPickAxe()) { + final BlockTool superPickaxe = session.getSuperPickaxe(); + if (superPickaxe != null && superPickaxe.canUse(player)) { + event.setCancelled(superPickaxe.actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location)); + return; + } } - RegionSelector selector = session.getRegionSelector(player.getWorld()); - BlockVector3 blockPoint = vector.toBlockPoint(); - if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) { - selector.explainSecondarySelection(actor, session, blockPoint); + Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + if (tool instanceof DoubleActionBlockTool) { + if (tool.canUse(player)) { + ((DoubleActionBlockTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location); + event.setCancelled(true); + } } - event.setCancelled(true); - return; - } + } else if (event.getType() == Interaction.OPEN) { + if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().wandItem)) { + if (!session.isToolControlEnabled()) { + return; + } + + if (!actor.hasPermission("worldedit.selection.pos")) { + return; + } + + RegionSelector selector = session.getRegionSelector(player.getWorld()); + BlockVector3 blockPoint = vector.toBlockPoint(); + if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) { + selector.explainSecondarySelection(actor, session, blockPoint); + } - Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); - if (tool instanceof BlockTool) { - if (tool.canUse(player)) { - ((BlockTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location); event.setCancelled(true); + return; + } + + Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + if (tool instanceof BlockTool) { + if (tool.canUse(player)) { + ((BlockTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location); + event.setCancelled(true); + } } } + } finally { + Request.reset(); } } } @@ -387,74 +396,78 @@ public class PlatformManager { // Create a proxy actor with a potentially different world for // making changes to the world Player player = createProxyActor(event.getPlayer()); + LocalSession session = worldEdit.getSessionManager().get(player); + Request.reset(); + Request.request().setSession(session); + Request.request().setWorld(player.getWorld()); - switch (event.getInputType()) { - case PRIMARY: { - if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().navigationWand)) { - if (getConfiguration().navigationWandMaxDistance <= 0) { - return; - } + try { + switch (event.getInputType()) { + case PRIMARY: { + if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().navigationWand)) { + if (getConfiguration().navigationWandMaxDistance <= 0) { + return; + } - if (!player.hasPermission("worldedit.navigation.jumpto.tool")) { - return; - } + if (!player.hasPermission("worldedit.navigation.jumpto.tool")) { + return; + } - Location pos = player.getSolidBlockTrace(getConfiguration().navigationWandMaxDistance); - if (pos != null) { - player.findFreePosition(pos); - } else { - player.printError("No block in sight (or too far)!"); - } + Location pos = player.getSolidBlockTrace(getConfiguration().navigationWandMaxDistance); + if (pos != null) { + player.findFreePosition(pos); + } else { + player.printError("No block in sight (or too far)!"); + } - event.setCancelled(true); - return; - } - - LocalSession session = worldEdit.getSessionManager().get(player); - - Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); - if (tool instanceof DoubleActionTraceTool) { - if (tool.canUse(player)) { - ((DoubleActionTraceTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session); event.setCancelled(true); return; } + + Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + if (tool instanceof DoubleActionTraceTool) { + if (tool.canUse(player)) { + ((DoubleActionTraceTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session); + event.setCancelled(true); + return; + } + } + + break; } - break; - } + case SECONDARY: { + if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().navigationWand)) { + if (getConfiguration().navigationWandMaxDistance <= 0) { + return; + } - case SECONDARY: { - if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().navigationWand)) { - if (getConfiguration().navigationWandMaxDistance <= 0) { - return; - } + if (!player.hasPermission("worldedit.navigation.thru.tool")) { + return; + } - if (!player.hasPermission("worldedit.navigation.thru.tool")) { - return; - } + if (!player.passThroughForwardWall(40)) { + player.printError("Nothing to pass through!"); + } - if (!player.passThroughForwardWall(40)) { - player.printError("Nothing to pass through!"); - } - - event.setCancelled(true); - return; - } - - LocalSession session = worldEdit.getSessionManager().get(player); - - Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); - if (tool instanceof TraceTool) { - if (tool.canUse(player)) { - ((TraceTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session); event.setCancelled(true); return; } - } - break; + Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + if (tool instanceof TraceTool) { + if (tool.canUse(player)) { + ((TraceTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session); + event.setCancelled(true); + return; + } + } + + break; + } } + } finally { + Request.reset(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java index b01185c38..f31e0ba44 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java @@ -31,6 +31,7 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.util.io.file.FilenameException; import com.sk89q.worldedit.world.block.BaseBlock; @@ -65,6 +66,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { EditSession editSession = controller.getEditSessionFactory() .getEditSession(player.getWorld(), session.getBlockChangeLimit(), session.getBlockBag(player), player); + Request.request().setEditSession(editSession); editSession.enableStandardMode(); editSessions.add(editSession); return editSession; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index 1260fc327..138c5f5df 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -28,6 +28,7 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent; +import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.session.storage.JsonFileSessionStore; import com.sk89q.worldedit.session.storage.SessionStore; import com.sk89q.worldedit.session.storage.VoidStore; @@ -151,6 +152,7 @@ public class SessionManager { log.warn("Failed to load saved session", e); session = new LocalSession(); } + Request.request().setSession(session); session.setConfiguration(config); session.setBlockChangeLimit(config.defaultChangeLimit); @@ -313,7 +315,7 @@ public class SessionManager { /** * Stores the owner of a session, the session, and the last active time. */ - private static class SessionHolder { + private static final class SessionHolder { private final SessionKey key; private final LocalSession session; private long lastActive = System.currentTimeMillis(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java index fd7cd2dde..ea87db404 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java @@ -35,6 +35,7 @@ public final class Request { private @Nullable World world; private @Nullable LocalSession session; private @Nullable EditSession editSession; + private boolean valid; private Request() { } @@ -106,6 +107,20 @@ public final class Request { * Reset the current request and clear all fields. */ public static void reset() { + request().invalidate(); threadLocal.remove(); } + + /** + * Check if the current request object is still valid. Invalid requests may contain outdated values. + * + * @return true if the request is valid + */ + public boolean isValid() { + return valid; + } + + private void invalidate() { + valid = false; + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java index 993e92572..dc5aac815 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java @@ -39,13 +39,13 @@ import java.util.List; public class RequestExtent implements Extent { - private EditSession extent; + private Request request; protected Extent getExtent() { - if (extent == null) { - extent = Request.request().getEditSession(); + if (request == null || !request.isValid()) { + request = Request.request(); } - return extent; + return request.getEditSession(); } @Override @@ -103,7 +103,7 @@ public class RequestExtent implements Extent { @Nullable public Operation commit() { Operation commit = getExtent().commit(); - extent = null; + request = null; return commit; } } From 9b473cecbdfc9bff6fabe7213cae171fc23d933a Mon Sep 17 00:00:00 2001 From: wizjany Date: Wed, 20 Mar 2019 21:05:11 -0400 Subject: [PATCH 171/182] Fixes and changes to forest/forestgen. * Sync up implementations of the two commands. * Fix generating trees in spots with replaceable blocks. * Make message when you mistype tree-type arg more correct. Fixes WORLDEDIT-3869. --- .../java/com/sk89q/worldedit/EditSession.java | 50 +++++++------------ .../worldedit/command/GenerationCommands.java | 3 +- .../worldedit/command/RegionCommands.java | 10 +--- .../function/generator/ForestGenerator.java | 20 +++++--- .../internal/command/WorldEditBinding.java | 4 +- 5 files changed, 38 insertions(+), 49 deletions(-) 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 39c72c93f..07d3d084c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -44,6 +44,7 @@ import com.sk89q.worldedit.function.block.BlockDistributionCounter; import com.sk89q.worldedit.function.block.BlockReplace; import com.sk89q.worldedit.function.block.Counter; import com.sk89q.worldedit.function.block.Naturalizer; +import com.sk89q.worldedit.function.generator.ForestGenerator; import com.sk89q.worldedit.function.generator.GardenPatchGenerator; import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.mask.BlockStateMask; @@ -1832,38 +1833,25 @@ public class EditSession implements Extent, AutoCloseable { * @throws MaxChangedBlocksException thrown if too many blocks are changed */ public int makeForest(BlockVector3 basePosition, int size, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException { - int affected = 0; + return makeForest(CuboidRegion.fromCenter(basePosition, size), density, treeType); + } - for (int x = basePosition.getBlockX() - size; x <= basePosition.getBlockX() - + size; ++x) { - for (int z = basePosition.getBlockZ() - size; z <= basePosition.getBlockZ() - + size; ++z) { - // Don't want to be in the ground - if (!getBlock(BlockVector3.at(x, basePosition.getBlockY(), z)).getBlockType().getMaterial().isAir()) { - continue; - } - // The gods don't want a tree here - if (Math.random() >= density) { - continue; - } // def 0.05 - - for (int y = basePosition.getBlockY(); y >= basePosition.getBlockY() - 10; --y) { - // Check if we hit the ground - BlockType t = getBlock(BlockVector3.at(x, y, z)).getBlockType(); - if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) { - treeType.generate(this, BlockVector3.at(x, y + 1, z)); - ++affected; - break; - } else if (t == BlockTypes.SNOW) { - setBlock(BlockVector3.at(x, y, z), BlockTypes.AIR.getDefaultState()); - } else if (!t.getMaterial().isAir()) { // Trees won't grow on this! - break; - } - } - } - } - - return affected; + /** + * Makes a forest. + * + * @param region the region to generate trees in + * @param density between 0 and 1, inclusive + * @param treeType the tree type + * @return number of trees created + * @throws MaxChangedBlocksException thrown if too many blocks are changed + */ + public int makeForest(Region region, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException { + ForestGenerator generator = new ForestGenerator(this, treeType); + GroundFunction ground = new GroundFunction(new ExistingBlockMask(this), generator); + LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); + visitor.setMask(new NoiseFilter2D(new RandomNoise(), density)); + Operations.completeLegacy(visitor); + return ground.getAffected(); } /** 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 d16edd976..971fb58d8 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 @@ -197,7 +197,8 @@ public class GenerationCommands { ) @CommandPermissions("worldedit.generation.forest") @Logging(POSITION) - public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, @Optional("tree") TreeType type, @Optional("5") double density) throws WorldEditException { + public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, + @Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException { density = density / 100; int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type); player.print(affected + " trees created."); 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 b02b2ba42..1e5fb3fee 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 @@ -445,14 +445,8 @@ public class RegionCommands { @Logging(REGION) public void forest(Player player, EditSession editSession, @Selection Region region, @Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException { - density = density / 100; - ForestGenerator generator = new ForestGenerator(editSession, type); - GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator); - LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); - visitor.setMask(new NoiseFilter2D(new RandomNoise(), density)); - Operations.completeLegacy(visitor); - - player.print(ground.getAffected() + " trees created."); + int affected = editSession.makeForest(region, density / 100, type); + player.print(affected + " trees created."); } @Command( diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java index 231cfc79e..e45acd24b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java @@ -54,15 +54,19 @@ public class ForestGenerator implements RegionFunction { BlockType t = block.getBlockType(); if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) { - treeType.generate(editSession, position.add(0, 1, 0)); - return true; - } else if (t == BlockTypes.GRASS || t == BlockTypes.DEAD_BUSH || t == BlockTypes.POPPY || t == BlockTypes.DANDELION) { // TODO: This list needs to be moved + return treeType.generate(editSession, position.add(0, 1, 0)); + } else if (t.getMaterial().isReplacedDuringPlacement()) { + // since the implementation's tree generators generally don't generate in non-air spots, + // we trick editsession history here in the first call editSession.setBlock(position, BlockTypes.AIR.getDefaultState()); - treeType.generate(editSession, position); - return true; - } else if (t == BlockTypes.SNOW) { - editSession.setBlock(position, BlockTypes.AIR.getDefaultState()); - return false; + // and then trick the generator here by directly setting into the world + editSession.getWorld().setBlock(position, BlockTypes.AIR.getDefaultState()); + // so that now the generator can generate the tree + boolean success = treeType.generate(editSession, position); + if (!success) { + editSession.setBlock(position, block); // restore on failure + } + return success; } else { // Trees won't grow on this! return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index 267dfb7bf..3a8a895b9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -52,6 +52,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.registry.BiomeRegistry; +import sun.reflect.generics.tree.Tree; import java.util.Arrays; import java.util.Collection; @@ -290,7 +291,8 @@ public class WorldEditBinding extends BindingHelper { return type; } else { throw new ParameterException( - String.format("Can't recognize tree type '%s' -- choose from: %s", input, Arrays.toString(TreeType.values()))); + String.format("Can't recognize tree type '%s' -- choose from: %s", input, + TreeType.getPrimaryAliases())); } } else { return TreeType.TREE; From 692ba6fda36c6fbdb41d25ed4c5826f0dce04535 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 22 Mar 2019 14:03:43 -0400 Subject: [PATCH 172/182] Checkstyle. --- .../sk89q/worldedit/internal/command/WorldEditBinding.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index 3a8a895b9..b13924e72 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -52,9 +52,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import sun.reflect.generics.tree.Tree; -import java.util.Arrays; import java.util.Collection; /** @@ -85,7 +83,7 @@ public class WorldEditBinding extends BindingHelper { @BindingMatch(classifier = Selection.class, type = Region.class, behavior = BindingBehavior.PROVIDES) - public Object getSelection(ArgumentStack context, Selection selection) throws IncompleteRegionException, ParameterException { + public Object getSelection(ArgumentStack context, @SuppressWarnings("unused") Selection selection) throws IncompleteRegionException, ParameterException { Player sender = getPlayer(context); LocalSession session = worldEdit.getSessionManager().get(sender); return session.getSelection(sender.getWorld()); From 8eccdc74445a08e87bc80df3ee3d05bbafd8c039 Mon Sep 17 00:00:00 2001 From: wizjany Date: Mon, 25 Mar 2019 22:38:51 -0400 Subject: [PATCH 173/182] Add -f flag to //count to allow fuzzy inputs. Also re-implement //distr -c. And remove outdated help text on //copy. --- .../worldedit/command/ClipboardCommands.java | 3 +-- .../worldedit/command/SelectionCommands.java | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) 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 95cb27f66..0f61f0d2a 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 @@ -75,8 +75,7 @@ public class ClipboardCommands { help = "Copy the selection to the clipboard\n" + "Flags:\n" + " -e will also copy entities\n" + - " -m sets a source mask so that excluded blocks become air\n" + - "WARNING: Pasting entities cannot yet be undone!", + " -m sets a source mask so that excluded blocks become air", min = 0, max = 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 f0fc6634f..9ded39f33 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 @@ -36,6 +36,9 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.function.block.BlockDistributionCounter; +import com.sk89q.worldedit.function.operation.Operations; +import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; @@ -625,6 +628,7 @@ public class SelectionCommands { @Command( aliases = { "/count" }, usage = "", + flags = "f", desc = "Counts the number of a certain type of block", min = 1, max = 1 @@ -638,6 +642,7 @@ public class SelectionCommands { context.setWorld(player.getWorld()); context.setSession(session); context.setRestricted(false); + context.setPreferringWildcard(args.hasFlag('f')); Set searchBlocks = we.getBlockFactory().parseFromListInput(args.getString(0), context); int count = editSession.countBlocks(session.getSelection(player.getWorld()), searchBlocks); @@ -659,16 +664,17 @@ public class SelectionCommands { @CommandPermissions("worldedit.analysis.distr") public void distr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException, CommandException { - int size; boolean separateStates = args.hasFlag('d'); List> distribution; if (args.hasFlag('c')) { - // TODO: Update for new clipboard - throw new CommandException("Needs to be re-written again"); + Clipboard clipboard = session.getClipboard().getClipboard(); // throws if missing + BlockDistributionCounter count = new BlockDistributionCounter(clipboard, separateStates); + RegionVisitor visitor = new RegionVisitor(clipboard.getRegion(), count); + Operations.completeBlindly(visitor); + distribution = count.getDistribution(); } else { distribution = editSession.getBlockDistribution(session.getSelection(player.getWorld()), separateStates); - size = session.getSelection(player.getWorld()).getArea(); } if (distribution.isEmpty()) { // *Should* always be false @@ -676,19 +682,21 @@ public class SelectionCommands { return; } + // note: doing things like region.getArea is inaccurate for non-cuboids. + int size = distribution.stream().mapToInt(Countable::getAmount).sum(); player.print("# total blocks: " + size); for (Countable c : distribution) { String name = c.getID().getBlockType().getName(); String str; if (separateStates) { - str = String.format("%-7s (%.3f%%) %s #%s", + str = String.format("%-7s (%.3f%%) %s (%s)", String.valueOf(c.getAmount()), c.getAmount() / (double) size * 100, name, c.getID().getAsString()); } else { - str = String.format("%-7s (%.3f%%) %s #%s", + str = String.format("%-7s (%.3f%%) %s (%s)", String.valueOf(c.getAmount()), c.getAmount() / (double) size * 100, name, From 4629c1f7e476b5d90350b7f5e5446fcdf7d2def8 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 26 Mar 2019 21:09:41 +1000 Subject: [PATCH 174/182] Few fixes for the Forge version. --- .../com/sk89q/worldedit/forge/ForgeWorld.java | 5 ++-- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 5 +++- .../com/sk89q/worldedit/forge/KeyHandler.java | 2 +- .../worldedit/forge/gui/GuiReferenceCard.java | 3 +++ .../forge/{ => proxy}/ClientProxy.java | 9 ++++--- .../worldedit/forge/proxy/CommonProxy.java | 25 ++++++++++++++++++ .../ServerProxy.java} | 26 +++++++++---------- 7 files changed, 55 insertions(+), 20 deletions(-) rename worldedit-forge/src/main/java/com/sk89q/worldedit/forge/{ => proxy}/ClientProxy.java (79%) create mode 100644 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/CommonProxy.java rename worldedit-forge/src/main/java/com/sk89q/worldedit/forge/{CommonProxy.java => proxy/ServerProxy.java} (58%) diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index a8b4ba13b..43a9399b9 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -187,8 +187,9 @@ public class ForgeWorld extends AbstractWorld { @Override public boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException { - // TODO Implement - return false; + BlockPos pos = new BlockPos(position.getX(), position.getY(), position.getZ()); + getWorld().notifyBlockUpdate(pos, ForgeAdapter.adapt(previousType), getWorld().getBlockState(pos), 1 | 2); + return true; } @Override diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 07bf6c4d9..aef34005a 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -31,6 +31,9 @@ import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.forge.net.handler.InternalPacketHandler; import com.sk89q.worldedit.forge.net.handler.WECUIPacketHandler; import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage; +import com.sk89q.worldedit.forge.proxy.ClientProxy; +import com.sk89q.worldedit.forge.proxy.CommonProxy; +import com.sk89q.worldedit.forge.proxy.ServerProxy; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockCategory; @@ -89,7 +92,7 @@ public class ForgeWorldEdit { public static ForgeWorldEdit inst; - public static CommonProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> CommonProxy::new); + public static CommonProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new); private ForgePlatform platform; private ForgeConfiguration config; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java index d0a23fcf1..06c59eb7f 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java @@ -41,7 +41,7 @@ public class KeyHandler { if (mc.player != null && mc.world != null && mainKey.isPressed()) { mc.displayGuiScreen(new GuiReferenceCard()); // TODO Seems GuiHandlers don't work on client right now -// NetworkHooks.openGui(mc.player, new ResourceLocationInteractionObject(CommonProxy.REFERENCE_GUI)); +// NetworkHooks.openGui(mc.player, new ResourceLocationInteractionObject(ServerProxy.REFERENCE_GUI)); } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java index d15642934..a3b9756af 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/gui/GuiReferenceCard.java @@ -23,8 +23,11 @@ import com.sk89q.worldedit.forge.ForgeWorldEdit; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import org.lwjgl.opengl.GL11; +@OnlyIn(Dist.CLIENT) public class GuiReferenceCard extends GuiScreen { private GuiButton closeButton; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ClientProxy.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/ClientProxy.java similarity index 79% rename from worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ClientProxy.java rename to worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/ClientProxy.java index 688728a63..fab4e7d67 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ClientProxy.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/ClientProxy.java @@ -17,15 +17,18 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.forge; +package com.sk89q.worldedit.forge.proxy; +import com.sk89q.worldedit.forge.KeyHandler; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; -public class ClientProxy extends CommonProxy { +@OnlyIn(Dist.CLIENT) +public class ClientProxy implements CommonProxy { @Override public void registerHandlers() { - super.registerHandlers(); MinecraftForge.EVENT_BUS.register(new KeyHandler()); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/CommonProxy.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/CommonProxy.java new file mode 100644 index 000000000..9f4c166b3 --- /dev/null +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/CommonProxy.java @@ -0,0 +1,25 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.forge.proxy; + +public interface CommonProxy { + + void registerHandlers(); +} diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/ServerProxy.java similarity index 58% rename from worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java rename to worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/ServerProxy.java index 7c5708358..9ec84e328 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/proxy/ServerProxy.java @@ -17,24 +17,24 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.forge; +package com.sk89q.worldedit.forge.proxy; -import com.sk89q.worldedit.forge.gui.GuiReferenceCard; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.ExtensionPoint; -import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -public class CommonProxy { +@OnlyIn(Dist.DEDICATED_SERVER) +public class ServerProxy implements CommonProxy { - public static ResourceLocation REFERENCE_GUI = new ResourceLocation("worldedit", "resource_gui"); +// public static ResourceLocation REFERENCE_GUI = new ResourceLocation("worldedit", "resource_gui"); + @Override public void registerHandlers() { - ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, () -> openContainer -> { - if (openContainer.getId().equals(REFERENCE_GUI)) { - return new GuiReferenceCard(); - } - return null; - }); +// ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, () -> openContainer -> { +// if (openContainer.getId().equals(REFERENCE_GUI)) { +// return new GuiReferenceCard(); +// } +// return null; +// }); } } From 2a194b0434332b12909d994d17801b702ebd7cad Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 26 Mar 2019 18:11:32 -0400 Subject: [PATCH 175/182] Add pattern that randomly chooses states. Also works with fuzzy states. Syntax is `*type`, e.g. `//set *stone_slab` or with states, `//set *oak_fence[waterlogged=false]` --- .../extension/factory/PatternFactory.java | 4 +- .../pattern/RandomStatePatternParser.java | 56 +++++++++++++++++++ .../pattern/SingleBlockPatternParser.java | 8 +-- .../function/pattern/RandomStatePattern.java | 45 +++++++++++++++ 4 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomStatePatternParser.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java index 8c23c4ef8..8457f3fc3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.factory.parser.pattern.BlockCategoryPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.ClipboardPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.RandomPatternParser; +import com.sk89q.worldedit.extension.factory.parser.pattern.RandomStatePatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.SingleBlockPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.TypeOrStateApplyingPatternParser; import com.sk89q.worldedit.function.pattern.Pattern; @@ -52,8 +53,9 @@ public final class PatternFactory extends AbstractFactory { register(new BlockCategoryPatternParser(worldEdit)); register(new ClipboardPatternParser(worldEdit)); register(new TypeOrStateApplyingPatternParser(worldEdit)); + register(new RandomStatePatternParser(worldEdit)); - // inner-most pattern: just one block + // inner-most pattern: just one block - must be last register(new SingleBlockPatternParser(worldEdit)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomStatePatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomStatePatternParser.java new file mode 100644 index 000000000..27423f59e --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomStatePatternParser.java @@ -0,0 +1,56 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.factory.parser.pattern; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.pattern.RandomStatePattern; +import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.FuzzyBlockState; + +public class RandomStatePatternParser extends InputParser { + public RandomStatePatternParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { + if (!input.startsWith("*")) { + return null; + } + + boolean wasFuzzy = context.isPreferringWildcard(); + context.setPreferringWildcard(true); + BaseBlock block = worldEdit.getBlockFactory().parseFromInput(input.substring(1), context); + context.setPreferringWildcard(wasFuzzy); + if (block.getStates().size() == block.getBlockType().getPropertyMap().size()) { + // they requested random with *, but didn't leave any states empty - simplify + return new BlockPattern(block); + } else if (block.toImmutableState() instanceof FuzzyBlockState) { + return new RandomStatePattern((FuzzyBlockState) block.toImmutableState()); + } else { + return null; // only should happen if parseLogic changes + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SingleBlockPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SingleBlockPatternParser.java index 960983780..e71530a2e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SingleBlockPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SingleBlockPatternParser.java @@ -34,13 +34,7 @@ public class SingleBlockPatternParser extends InputParser { @Override public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { - String[] items = input.split(","); - - if (items.length == 1) { - return new BlockPattern(worldEdit.getBlockFactory().parseFromInput(items[0], context)); - } else { - return null; - } + return new BlockPattern(worldEdit.getBlockFactory().parseFromInput(input, context)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java new file mode 100644 index 000000000..f2e2870a9 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java @@ -0,0 +1,45 @@ +/* + * 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 Lesser 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 Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.function.pattern; + +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.FuzzyBlockState; + +import java.util.List; +import java.util.Random; +import java.util.stream.Collectors; + +public class RandomStatePattern implements Pattern { + + private final Random rand = new Random(); + private final List blocks; + + public RandomStatePattern(FuzzyBlockState state) { + blocks = state.getBlockType().getAllStates().stream().filter(state::equalsFuzzy) + .map(BlockState::toBaseBlock).collect(Collectors.toList()); + } + + @Override + public BaseBlock apply(BlockVector3 position) { + return blocks.get(rand.nextInt(blocks.size())); + } +} From 6b3426e1debd9b3dd7b3d0acf48bfd5941f09fae Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 26 Mar 2019 18:14:35 -0400 Subject: [PATCH 176/182] BaseBlock is technically mutable so that technically shouldn't use it. --- .../worldedit/function/pattern/RandomStatePattern.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java index f2e2870a9..698111dac 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java @@ -31,15 +31,15 @@ import java.util.stream.Collectors; public class RandomStatePattern implements Pattern { private final Random rand = new Random(); - private final List blocks; + private final List blocks; public RandomStatePattern(FuzzyBlockState state) { blocks = state.getBlockType().getAllStates().stream().filter(state::equalsFuzzy) - .map(BlockState::toBaseBlock).collect(Collectors.toList()); + .collect(Collectors.toList()); } @Override public BaseBlock apply(BlockVector3 position) { - return blocks.get(rand.nextInt(blocks.size())); + return blocks.get(rand.nextInt(blocks.size())).toBaseBlock(); } } From 74bff83e381f000f975a830a296cecabbb070809 Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 26 Mar 2019 22:30:24 -0400 Subject: [PATCH 177/182] Don't let items types be null. Better fail-fast if registry doesn't load? or why-ever else this happens --- .../main/java/com/sk89q/worldedit/blocks/BaseItem.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java index 114609e63..a81ee9ab2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java @@ -25,6 +25,8 @@ import com.sk89q.worldedit.world.item.ItemType; import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; + /** * Represents an item, without an amount value. See {@link BaseItemStack} * for an instance with stack amount information. @@ -32,7 +34,7 @@ import javax.annotation.Nullable; *

    This class may be removed in the future.

    */ public class BaseItem implements NbtValued { - + private ItemType itemType; @Nullable private CompoundTag nbtData; @@ -43,6 +45,7 @@ public class BaseItem implements NbtValued { * @param itemType Type of the item */ public BaseItem(ItemType itemType) { + checkNotNull(itemType); this.itemType = itemType; } @@ -52,7 +55,8 @@ public class BaseItem implements NbtValued { * @param itemType Type of the item * @param tag NBT Compound tag */ - public BaseItem(ItemType itemType, CompoundTag tag) { + public BaseItem(ItemType itemType, @Nullable CompoundTag tag) { + checkNotNull(itemType); this.itemType = itemType; this.nbtData = tag; } From d7d2d03ee82ae514ae4fbf8a08ff6f8bd84625d4 Mon Sep 17 00:00:00 2001 From: wizjany Date: Wed, 27 Mar 2019 23:36:59 -0400 Subject: [PATCH 178/182] Clipboard offset pattern is now #copy@[x,y,z]. Since the parsers were changed around, unescaped commas are parsed as separate blocks now. --- .../parser/pattern/ClipboardPatternParser.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java index 1df80b8d1..f0939ed60 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java @@ -55,15 +55,20 @@ public class ClipboardPatternParser extends InputParser { BlockVector3 offset = BlockVector3.ZERO; if (offsetParts.length == 2) { - String[] offsetSplit = offsetParts[1].split(","); + String coords = offsetParts[1]; + if (coords.length() < 7 // min length of `[x,y,z]` + || coords.charAt(0) != '[' || coords.charAt(coords.length() - 1) != ']') { + throw new InputParseException("Offset specified with @ but no offset given. Use '#copy@[x,y,z]'."); + } + String[] offsetSplit = coords.substring(1, coords.length() - 1).split(","); if (offsetSplit.length != 3) { throw new InputParseException("Clipboard offset needs x,y,z coordinates."); } offset = BlockVector3.at( - Integer.valueOf(offsetSplit[0]), - Integer.valueOf(offsetSplit[1]), - Integer.valueOf(offsetSplit[2]) - ); + Integer.valueOf(offsetSplit[0]), + Integer.valueOf(offsetSplit[1]), + Integer.valueOf(offsetSplit[2]) + ); } if (session != null) { From 42d0d6e79a5bb854505ce7ca13bb08914068fd24 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 29 Mar 2019 23:44:18 -0400 Subject: [PATCH 179/182] Use getTag instead of requireTag in a few places. --- .../clipboard/io/MCEditSchematicReader.java | 6 ++---- .../clipboard/io/SpongeSchematicReader.java | 15 ++++++--------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index c20c72df8..3997f28c7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -253,9 +253,8 @@ public class MCEditSchematicReader extends NBTSchematicReader { // Entities // ==================================================================== - try { - List entityTags = requireTag(schematic, "Entities", ListTag.class).getValue(); - + List entityTags = getTag(schematic, "Entities", ListTag.class).getValue(); + if (entityTags != null) { for (Tag tag : entityTags) { if (tag instanceof CompoundTag) { CompoundTag compound = (CompoundTag) tag; @@ -273,7 +272,6 @@ public class MCEditSchematicReader extends NBTSchematicReader { } } } - } catch (IOException ignored) { // No entities? No problem } return clipboard; 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 3b944018e..8cdc084bc 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 @@ -87,12 +87,10 @@ public class SpongeSchematicReader extends NBTSchematicReader { // Check Map schematic = schematicTag.getValue(); int version = requireTag(schematic, "Version", IntTag.class).getValue(); - switch (version) { - case 1: - return readVersion1(schematicTag); - default: - throw new IOException("This schematic version is currently not supported"); + if (version == 1) { + return readVersion1(schematicTag); } + throw new IOException("This schematic version is currently not supported"); } private Clipboard readVersion1(CompoundTag schematicTag) throws IOException { @@ -152,8 +150,9 @@ public class SpongeSchematicReader extends NBTSchematicReader { byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue(); Map> tileEntitiesMap = new HashMap<>(); - try { - List> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream() + ListTag tileEntities = getTag(schematic, "TileEntities", ListTag.class); + if (tileEntities != null) { + List> tileEntityTags = tileEntities.getValue().stream() .map(tag -> (CompoundTag) tag) .map(CompoundTag::getValue) .collect(Collectors.toList()); @@ -162,8 +161,6 @@ public class SpongeSchematicReader extends NBTSchematicReader { int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); tileEntitiesMap.put(BlockVector3.at(pos[0], pos[1], pos[2]), tileEntity); } - } catch (Exception e) { - throw new IOException("Failed to load Tile Entities: " + e.getMessage()); } BlockArrayClipboard clipboard = new BlockArrayClipboard(region); From 4e66b9a3366681c8ca9d66381ffe1bacebe188f3 Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 30 Mar 2019 00:41:47 -0400 Subject: [PATCH 180/182] Revert 6b3426e1. Empty base blocks are always immutable. Fuzzy states don't have NBT. --- .../worldedit/function/pattern/RandomStatePattern.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java index 698111dac..f2e2870a9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java @@ -31,15 +31,15 @@ import java.util.stream.Collectors; public class RandomStatePattern implements Pattern { private final Random rand = new Random(); - private final List blocks; + private final List blocks; public RandomStatePattern(FuzzyBlockState state) { blocks = state.getBlockType().getAllStates().stream().filter(state::equalsFuzzy) - .collect(Collectors.toList()); + .map(BlockState::toBaseBlock).collect(Collectors.toList()); } @Override public BaseBlock apply(BlockVector3 position) { - return blocks.get(rand.nextInt(blocks.size())).toBaseBlock(); + return blocks.get(rand.nextInt(blocks.size())); } } From a80420d14b3b3c29c71c0c72984bb445b61595e1 Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 30 Mar 2019 00:42:28 -0400 Subject: [PATCH 181/182] Add biome storage to BlockArrayClipboard. --- .../extent/clipboard/BlockArrayClipboard.java | 15 +++++++++++++++ .../clipboard/io/SpongeSchematicReader.java | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) 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 d4ecc26b3..9d13ea579 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 @@ -51,6 +51,7 @@ public class BlockArrayClipboard implements Clipboard { private final Region region; private BlockVector3 origin; private final BaseBlock[][][] blocks; + private BiomeType[][] biomes = null; private final List entities = new ArrayList<>(); /** @@ -162,11 +163,25 @@ public class BlockArrayClipboard implements Clipboard { @Override public BiomeType getBiome(BlockVector2 position) { + if (biomes != null + && position.containedWithin(getMinimumPoint().toBlockVector2(), getMaximumPoint().toBlockVector2())) { + BlockVector2 v = position.subtract(region.getMinimumPoint().toBlockVector2()); + return biomes[v.getBlockX()][v.getBlockZ()]; + } + return BiomeTypes.OCEAN; } @Override public boolean setBiome(BlockVector2 position, BiomeType biome) { + if (position.containedWithin(getMinimumPoint().toBlockVector2(), getMaximumPoint().toBlockVector2())) { + BlockVector2 v = position.subtract(region.getMinimumPoint().toBlockVector2()); + if (biomes == null) { + biomes = new BiomeType[region.getWidth()][region.getLength()]; + } + biomes[v.getBlockX()][v.getBlockZ()] = biome; + return true; + } return false; } 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 8cdc084bc..09594e388 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 @@ -93,7 +93,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { throw new IOException("This schematic version is currently not supported"); } - private Clipboard readVersion1(CompoundTag schematicTag) throws IOException { + private BlockArrayClipboard readVersion1(CompoundTag schematicTag) throws IOException { BlockVector3 origin; Region region; Map schematic = schematicTag.getValue(); From 961da1b93fe5328213798f2476a8c372bcb7e13a Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 30 Mar 2019 17:32:10 -0400 Subject: [PATCH 182/182] Add BukkitPlayer constructor without plugin. tbh I don't know why we even need to keep the plugin object around. --- .../main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java | 4 ++++ .../com/sk89q/worldedit/bukkit/BukkitServerInterface.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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 3e2b5cd3f..d814cc7ba 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 @@ -52,6 +52,10 @@ public class BukkitPlayer extends AbstractPlayerActor { private Player player; private WorldEditPlugin plugin; + public BukkitPlayer(Player player) { + this(WorldEditPlugin.getInstance(), player); + } + public BukkitPlayer(WorldEditPlugin plugin, Player player) { this.plugin = plugin; this.player = player; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java index 3e8f4bcf9..adfc64bc0 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java @@ -100,7 +100,7 @@ public class BukkitServerInterface implements MultiUserPlatform { return player; } else { org.bukkit.entity.Player bukkitPlayer = server.getPlayerExact(player.getName()); - return bukkitPlayer != null ? new BukkitPlayer(plugin, bukkitPlayer) : null; + return bukkitPlayer != null ? WorldEditPlugin.getInstance().wrapPlayer(bukkitPlayer) : null; } } @@ -177,7 +177,7 @@ public class BukkitServerInterface implements MultiUserPlatform { public Collection getConnectedUsers() { List users = new ArrayList<>(); for (org.bukkit.entity.Player player : Bukkit.getServer().getOnlinePlayers()) { - users.add(new BukkitPlayer(plugin, player)); + users.add(WorldEditPlugin.getInstance().wrapPlayer(player)); } return users; }