Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions verification/src/changes/accepted-core-public-api-changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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())),
Expand All @@ -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())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* <p>{@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.</p>
*/
public class RegionIntersection extends AbstractRegion {
public class RegionUnion extends AbstractRegion {

private final List<Region> regions = new ArrayList<>();

Expand All @@ -50,7 +50,7 @@ public class RegionIntersection extends AbstractRegion {
*
* @param regions a list of regions, which is copied
*/
public RegionIntersection(List<Region> regions) {
public RegionUnion(List<Region> regions) {
this(null, regions);
}

Expand All @@ -59,7 +59,7 @@ public RegionIntersection(List<Region> regions) {
*
* @param regions a list of regions, which is copied
*/
public RegionIntersection(Region... regions) {
public RegionUnion(Region... regions) {
this(null, regions);
}

Expand All @@ -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<Region> regions) {
public RegionUnion(World world, List<Region> regions) {
super(world);
checkNotNull(regions);
checkArgument(!regions.isEmpty(), "empty region list is not supported");
Expand All @@ -82,7 +82,7 @@ public RegionIntersection(World world, List<Region> 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");
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions worldedit-core/src/main/resources/lang/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Loading