mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 04:46:40 +00:00
Major command changes that don't work yet.
This commit is contained in:
@ -19,6 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.regions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.collection.BlockVectorSet;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
@ -27,15 +30,12 @@ import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.AbstractSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* An axis-aligned cuboid. It can be defined using two corners of the cuboid.
|
||||
@ -300,10 +300,18 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
recalculate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shift(BlockVector3 change) throws RegionOperationException {
|
||||
pos1 = pos1.add(change);
|
||||
pos2 = pos2.add(change);
|
||||
|
||||
recalculate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BlockVector2> getChunks() {
|
||||
BlockVector3 min = getMinimumPoint();
|
||||
BlockVector3 max = getMaximumPoint();
|
||||
BlockVector3 min = getMinimumPoint();
|
||||
BlockVector3 max = getMaximumPoint();
|
||||
final int maxX = max.getBlockX() >> ChunkStore.CHUNK_SHIFTS;
|
||||
final int minX = min.getBlockX() >> ChunkStore.CHUNK_SHIFTS;
|
||||
final int maxZ = max.getBlockZ() >> ChunkStore.CHUNK_SHIFTS;
|
||||
@ -323,7 +331,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
|
||||
@Override
|
||||
public BlockVector2 next() {
|
||||
MutableBlockVector2 result = pos;
|
||||
MutableBlockVector2 result = pos;
|
||||
// calc next
|
||||
pos.setComponents(pos.getX() - 1, pos.getZ());
|
||||
if (pos.getX() <= minX) {
|
||||
@ -352,7 +360,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if (o instanceof BlockVector2) {
|
||||
BlockVector2 cv = (BlockVector2) o;
|
||||
BlockVector2 cv = (BlockVector2) o;
|
||||
return cv.getX() >= minX && cv.getX() <= maxX && cv.getZ() >= minZ && cv.getZ() <= maxZ;
|
||||
} else {
|
||||
return false;
|
||||
@ -360,12 +368,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
}
|
||||
};
|
||||
}
|
||||
public void shift(BlockVector3 change) throws RegionOperationException {
|
||||
pos1 = pos1.add(change);
|
||||
pos2 = pos2.add(change);
|
||||
|
||||
recalculate();
|
||||
}
|
||||
@Override
|
||||
public Set<BlockVector3> getChunkCubes() {
|
||||
Set<BlockVector3> chunks = new BlockVectorSet();
|
||||
@ -394,14 +397,16 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
public boolean contains(int x, int z) {
|
||||
return x >= this.minX && x <= this.maxX && z >= this.minZ && z <= this.maxZ;
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public boolean contains(BlockVector3 position) {
|
||||
BlockVector3 min = getMinimumPoint();
|
||||
BlockVector3 max = getMaximumPoint();
|
||||
|
||||
return position.containedWithin(min, max);
|
||||
}
|
||||
@NotNull @Override
|
||||
|
||||
@Override
|
||||
public Iterator<BlockVector3> iterator() {
|
||||
if (Settings.IMP.HISTORY.COMPRESSION_LEVEL >= 9 || useOldIterator) {
|
||||
return iterator_old();
|
||||
@ -490,7 +495,6 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
return new Iterator<BlockVector3>() {
|
||||
private BlockVector3 min = getMinimumPoint();
|
||||
private BlockVector3 max = getMaximumPoint();
|
||||
|
||||
private int nextX = min.getBlockX();
|
||||
private int nextY = min.getBlockY();
|
||||
private int nextZ = min.getBlockZ();
|
||||
@ -546,12 +550,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
|
||||
@Override
|
||||
public BlockVector2 next() {
|
||||
if (!hasNext()) throw new NoSuchElementException() {
|
||||
@Override
|
||||
public synchronized Throwable fillInStackTrace() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
BlockVector2 answer = BlockVector2.at(nextX, nextZ);
|
||||
if (++nextX > max.getBlockX()) {
|
||||
nextX = min.getBlockX();
|
||||
@ -593,15 +592,15 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
}
|
||||
|
||||
public static boolean contains(CuboidRegion region) {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
return region.contains(min.getBlockX(), min.getBlockY(), min.getBlockZ()) && region.contains(max.getBlockX(), max.getBlockY(), max.getBlockZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a cuboid from the center.
|
||||
*
|
||||
* @param origin the origin
|
||||
* @param origin the origin
|
||||
* @param apothem the apothem, where 0 is the minimum value to make a 1x1 cuboid
|
||||
* @return a cuboid region
|
||||
*/
|
||||
@ -611,6 +610,4 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
BlockVector3 size = BlockVector3.ONE.multiply(apothem);
|
||||
return new CuboidRegion(origin.subtract(size), origin.add(size));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.regions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
@ -179,11 +179,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
this.radius = radius;
|
||||
radiusSqr = radius.multiply(radius);
|
||||
radiusLengthSqr = (int) radiusSqr.getX();
|
||||
if (radius.getY() == radius.getX() && radius.getX() == radius.getZ()) {
|
||||
this.sphere = true;
|
||||
} else {
|
||||
this.sphere = false;
|
||||
}
|
||||
this.sphere = radius.getY() == radius.getX() && radius.getX() == radius.getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -323,6 +323,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
||||
return inside;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(BlockVector3 position) {
|
||||
return contains(points, minY, maxY, position);
|
||||
}
|
||||
@ -460,7 +461,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
||||
public Polygonal2DRegion clone() {
|
||||
Polygonal2DRegion clone = (Polygonal2DRegion) super.clone();
|
||||
clone.points = new ArrayList<>(points);
|
||||
return clone;
|
||||
return clone;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,10 +26,10 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Region selectors create {@link Region}s from a series of "selected points."
|
||||
* They are used, for example, to allow users to create a {@link CuboidRegion}
|
||||
@ -156,12 +156,4 @@ public interface RegionSelector {
|
||||
*/
|
||||
List<String> getInformationLines();
|
||||
|
||||
/**
|
||||
* Get the verticies
|
||||
* @return
|
||||
* @throws IncompleteRegionException
|
||||
*/
|
||||
default List<BlockVector3> getVerticies() throws IncompleteRegionException {
|
||||
return Collections.singletonList(getPrimaryPosition());
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -37,7 +37,6 @@ import com.sk89q.worldedit.regions.polyhedron.Triangle;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@ -45,6 +44,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Creates a {@code ConvexPolyhedralRegion} from a user's selections.
|
||||
*/
|
||||
@ -276,8 +277,4 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockVector3> getVerticies() {
|
||||
return new ArrayList<>(region.getVertices());
|
||||
}
|
||||
}
|
||||
|
@ -19,18 +19,14 @@
|
||||
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Commands;
|
||||
import com.boydti.fawe.util.chat.Message;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.SelectionCommands;
|
||||
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.SelectionShapeEvent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -40,7 +36,6 @@ import com.sk89q.worldedit.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -129,7 +124,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
|
||||
checkNotNull(position);
|
||||
|
||||
if (position1 != null && position1.equals(position)) {
|
||||
if (position.equals(position1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -142,7 +137,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) {
|
||||
checkNotNull(position);
|
||||
|
||||
if (position2 != null && position2.equals(position)) {
|
||||
if (position.equals(position2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -157,15 +152,12 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
checkNotNull(session);
|
||||
checkNotNull(pos);
|
||||
|
||||
Message msg;
|
||||
//TODO Re-add better translation
|
||||
if (position1 != null && position2 != null) {
|
||||
msg = BBC.SELECTOR_POS.m(1, position1, region.getArea());
|
||||
player.print("First position set to " + position1 + " (" + region.getArea() + ").");
|
||||
} else {
|
||||
msg = BBC.SELECTOR_POS.m(1, position1, "");
|
||||
player.print("First position set to " + position1 + ".");
|
||||
}
|
||||
String prefix = WorldEdit.getInstance().getConfiguration().noDoubleSlash ? "" : "/";
|
||||
String cmd = prefix + Commands.getAlias(SelectionCommands.class, "/pos1") + " " + pos.getBlockX() + "," + pos.getBlockY() + "," + pos.getBlockZ();
|
||||
msg.suggestTip(cmd).send(player);
|
||||
|
||||
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos, getArea()));
|
||||
}
|
||||
@ -176,15 +168,12 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
checkNotNull(session);
|
||||
checkNotNull(pos);
|
||||
|
||||
Message msg;
|
||||
//TODO Re-add better translation
|
||||
if (position1 != null && position2 != null) {
|
||||
msg = BBC.SELECTOR_POS.m(2, position2, region.getArea());
|
||||
player.print("Second position set to " + position2 + " (" + region.getArea() + ").");
|
||||
} else {
|
||||
msg = BBC.SELECTOR_POS.m(2, position2, "");
|
||||
player.print("Second position set to " + position2 + ".");
|
||||
}
|
||||
String prefix = WorldEdit.getInstance().getConfiguration().noDoubleSlash ? "" : "/";
|
||||
String cmd = prefix + Commands.getAlias(SelectionCommands.class, "/pos2") + " " + pos.getBlockX() + "," + pos.getBlockY() + "," + pos.getBlockZ();
|
||||
msg.suggestTip(cmd).send(player);
|
||||
|
||||
session.dispatchCUIEvent(player, new SelectionPointEvent(1, pos, getArea()));
|
||||
}
|
||||
@ -194,6 +183,8 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
checkNotNull(player);
|
||||
checkNotNull(session);
|
||||
|
||||
session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID()));
|
||||
|
||||
if (position1 != null) {
|
||||
session.dispatchCUIEvent(player, new SelectionPointEvent(0, position1, getArea()));
|
||||
}
|
||||
@ -309,9 +300,4 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
return "cuboid";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockVector3> getVerticies() {
|
||||
return Arrays.asList(position1, position2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -39,11 +39,12 @@ import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Creates a {@code CylinderRegionSelector} from a user's selections.
|
||||
*/
|
||||
@ -182,7 +183,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
if (!center.equals(Vector3.ZERO)) {
|
||||
BBC.SELECTOR_RADIUS.send(player, NUMBER_FORMAT.format(region.getRadius().getX()) + "/" + NUMBER_FORMAT.format(region.getRadius().getZ()), region.getArea());
|
||||
} else {
|
||||
BBC.SELECTION_WAND.send(player);
|
||||
player.printError("You must select the center point before setting the radius.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -284,5 +285,4 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
return "cuboid";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.regions.selector;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -37,11 +37,12 @@ import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Creates a {@code Polygonal2DRegion} from a user's selections.
|
||||
*/
|
||||
@ -282,4 +283,5 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion {
|
||||
public String getLegacyTypeID() {
|
||||
return "polygon2d";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@ -88,7 +87,11 @@ public class SphereRegionSelector extends EllipsoidRegionSelector {
|
||||
|
||||
@Override
|
||||
public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) {
|
||||
BBC.SELECTOR_RADIUS.send(player, region.getRadius().getX(), region.getArea());
|
||||
if (isDefined()) {
|
||||
player.print("Radius set to " + region.getRadius().getX() + " (" + region.getArea() + ").");
|
||||
} else {
|
||||
player.print("Radius set to " + region.getRadius().getX() + ".");
|
||||
}
|
||||
|
||||
session.describeCUI(player);
|
||||
}
|
||||
|
Reference in New Issue
Block a user