diff --git a/verification/src/changes/accepted-core-public-api-changes.json b/verification/src/changes/accepted-core-public-api-changes.json index 4876c13d16..0034d07467 100644 --- a/verification/src/changes/accepted-core-public-api-changes.json +++ b/verification/src/changes/accepted-core-public-api-changes.json @@ -23,5 +23,49 @@ "METHOD_REMOVED" ] } + ], + "RegionIntersection renamed to RegionUnion": [ + { + "type": "com.sk89q.worldedit.regions.RegionIntersection", + "member": "Class com.sk89q.worldedit.regions.RegionIntersection", + "changes": [ + "CLASS_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.regions.RegionIntersection", + "member": "Method com.sk89q.worldedit.regions.RegionIntersection.iterator()", + "changes": [ + "METHOD_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.regions.RegionIntersection", + "member": "Constructor com.sk89q.worldedit.regions.RegionIntersection(com.sk89q.worldedit.world.World,java.util.List)", + "changes": [ + "CONSTRUCTOR_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.regions.RegionIntersection", + "member": "Constructor com.sk89q.worldedit.regions.RegionIntersection(java.util.List)", + "changes": [ + "CONSTRUCTOR_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.regions.RegionIntersection", + "member": "Constructor com.sk89q.worldedit.regions.RegionIntersection(com.sk89q.worldedit.regions.Region[])", + "changes": [ + "CONSTRUCTOR_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.regions.RegionIntersection", + "member": "Constructor com.sk89q.worldedit.regions.RegionIntersection(com.sk89q.worldedit.world.World,com.sk89q.worldedit.regions.Region[])", + "changes": [ + "CONSTRUCTOR_REMOVED" + ] + } ] } 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 ded23e5f40..6cc0feb52b 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 @@ -120,7 +120,7 @@ public Region getFaces() { BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - return new RegionIntersection( + return new RegionUnion( // Project to Z-Y plane new CuboidRegion(pos1.withX(min.x()), pos2.withX(min.x())), new CuboidRegion(pos1.withX(max.x()), pos2.withX(max.x())), @@ -144,7 +144,7 @@ public Region getWalls() { BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); - return new RegionIntersection( + return new RegionUnion( // Project to Z-Y plane new CuboidRegion(pos1.withX(min.x()), pos2.withX(min.x())), new CuboidRegion(pos1.withX(max.x()), pos2.withX(max.x())), diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionUnion.java similarity index 85% rename from worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionUnion.java index e9f725e35b..ab1cf0be19 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionUnion.java @@ -33,15 +33,15 @@ import static com.google.common.base.Preconditions.checkNotNull; /** - * An intersection of several other regions. Any location that is contained in one - * of the child regions is considered as contained by this region. + * A union of several other regions. Any location that is contained in one of the + * child regions is considered as contained by this region. * *

{@link #iterator()} returns a special iterator that will iterate through * the iterators of each region in an undefined sequence. Some positions may * be repeated if the position is contained in more than one region, but this cannot * be guaranteed to occur.

*/ -public class RegionIntersection extends AbstractRegion { +public class RegionUnion extends AbstractRegion { private final List regions = new ArrayList<>(); @@ -50,7 +50,7 @@ public class RegionIntersection extends AbstractRegion { * * @param regions a list of regions, which is copied */ - public RegionIntersection(List regions) { + public RegionUnion(List regions) { this(null, regions); } @@ -59,7 +59,7 @@ public RegionIntersection(List regions) { * * @param regions a list of regions, which is copied */ - public RegionIntersection(Region... regions) { + public RegionUnion(Region... regions) { this(null, regions); } @@ -69,7 +69,7 @@ public RegionIntersection(Region... regions) { * @param world the world * @param regions a list of regions, which is copied */ - public RegionIntersection(World world, List regions) { + public RegionUnion(World world, List regions) { super(world); checkNotNull(regions); checkArgument(!regions.isEmpty(), "empty region list is not supported"); @@ -82,7 +82,7 @@ public RegionIntersection(World world, List regions) { * @param world the world * @param regions an array of regions, which is copied */ - public RegionIntersection(World world, Region... regions) { + public RegionUnion(World world, Region... regions) { super(world); checkNotNull(regions); checkArgument(regions.length > 0, "empty region list is not supported"); @@ -91,7 +91,7 @@ public RegionIntersection(World world, Region... regions) { @Override public BlockVector3 getMinimumPoint() { - BlockVector3 minimum = regions.get(0).getMinimumPoint(); + BlockVector3 minimum = regions.getFirst().getMinimumPoint(); for (int i = 1; i < regions.size(); i++) { minimum = regions.get(i).getMinimumPoint().getMinimum(minimum); } @@ -100,7 +100,7 @@ public BlockVector3 getMinimumPoint() { @Override public BlockVector3 getMaximumPoint() { - BlockVector3 maximum = regions.get(0).getMaximumPoint(); + BlockVector3 maximum = regions.getFirst().getMaximumPoint(); for (int i = 1; i < regions.size(); i++) { maximum = regions.get(i).getMaximumPoint().getMaximum(maximum); } @@ -110,13 +110,13 @@ public BlockVector3 getMaximumPoint() { @Override public void expand(BlockVector3... changes) throws RegionOperationException { checkNotNull(changes); - throw new RegionOperationException(TranslatableComponent.of("worldedit.selection.intersection.error.cannot-expand")); + throw new RegionOperationException(TranslatableComponent.of("worldedit.selection.union.error.cannot-expand")); } @Override public void contract(BlockVector3... changes) throws RegionOperationException { checkNotNull(changes); - throw new RegionOperationException(TranslatableComponent.of("worldedit.selection.intersection.error.cannot-contract")); + throw new RegionOperationException(TranslatableComponent.of("worldedit.selection.union.error.cannot-contract")); } @Override diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index f8d1be3b91..6ff2131bd0 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -458,8 +458,8 @@ "worldedit.selection.sphere.explain.secondary": "Radius set to {0}.", "worldedit.selection.sphere.explain.secondary-defined": "Radius set to {0} ({1}).", "worldedit.selection.null.error.immutable": "Cannot change NullRegion.", - "worldedit.selection.intersection.error.cannot-expand": "Cannot expand a region intersection.", - "worldedit.selection.intersection.error.cannot-contract": "Cannot contract a region intersection.", + "worldedit.selection.union.error.cannot-expand": "Cannot expand a region union.", + "worldedit.selection.union.error.cannot-contract": "Cannot contract a region union.", "worldedit.selection.transform.error.cannot-expand": "Cannot expand a TransformedRegion.", "worldedit.selection.transform.error.cannot-contract": "Cannot contract a TransformedRegion.", "worldedit.selection.transform.error.cannot-change": "Cannot change a TransformedRegion.",