mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 04:46:40 +00:00
Upstream
This commit is contained in:
@ -166,7 +166,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
||||
hasY = true;
|
||||
maxY = y;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return center.toVector2().subtract(getRadius()).toVector3(minY).toBlockPoint();
|
||||
@ -381,4 +381,5 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
||||
int maxY = extent.getMaximumPoint().getBlockY();
|
||||
return new CylinderRegion(center, radiusVec, minY, maxY);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,11 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A region that contains no points.
|
||||
|
@ -54,7 +54,7 @@ public interface RegionSelector {
|
||||
|
||||
/**
|
||||
* Called when the first point is selected.
|
||||
*
|
||||
*
|
||||
* @param position the position
|
||||
* @return true if something changed
|
||||
*/
|
||||
@ -62,7 +62,7 @@ public interface RegionSelector {
|
||||
|
||||
/**
|
||||
* Called when the second point is selected.
|
||||
*
|
||||
*
|
||||
* @param position the position
|
||||
* @return true if something changed
|
||||
*/
|
||||
@ -70,7 +70,7 @@ public interface RegionSelector {
|
||||
|
||||
/**
|
||||
* Tell the player information about his/her primary selection.
|
||||
*
|
||||
*
|
||||
* @param actor the actor
|
||||
* @param session the session
|
||||
* @param position position
|
||||
@ -97,7 +97,7 @@ public interface RegionSelector {
|
||||
|
||||
/**
|
||||
* Get the primary position.
|
||||
*
|
||||
*
|
||||
* @return the primary position
|
||||
* @throws IncompleteRegionException thrown if a region has not been fully defined
|
||||
*/
|
||||
@ -105,7 +105,7 @@ public interface RegionSelector {
|
||||
|
||||
/**
|
||||
* Get the selection.
|
||||
*
|
||||
*
|
||||
* @return the created region
|
||||
* @throws IncompleteRegionException thrown if a region has not been fully defined
|
||||
*/
|
||||
@ -113,21 +113,21 @@ public interface RegionSelector {
|
||||
|
||||
/**
|
||||
* Get the region even if it's not fully defined.
|
||||
*
|
||||
*
|
||||
* @return an incomplete region object that is incomplete
|
||||
*/
|
||||
Region getIncompleteRegion();
|
||||
|
||||
/**
|
||||
* Returns whether the region has been fully defined.
|
||||
*
|
||||
*
|
||||
* @return true if a selection is available
|
||||
*/
|
||||
boolean isDefined();
|
||||
|
||||
/**
|
||||
* Get the number of blocks inside the region.
|
||||
*
|
||||
*
|
||||
* @return number of blocks, or -1 if undefined
|
||||
*/
|
||||
int getArea();
|
||||
@ -144,25 +144,16 @@ public interface RegionSelector {
|
||||
|
||||
/**
|
||||
* Get a lowercase name of this region selector type.
|
||||
*
|
||||
*
|
||||
* @return a lower case name of the type
|
||||
*/
|
||||
String getTypeName();
|
||||
|
||||
/**
|
||||
* Get lines of information about the selection.
|
||||
*
|
||||
*
|
||||
* @return a list of lines describing the region
|
||||
*/
|
||||
List<String> getInformationLines();
|
||||
|
||||
/**
|
||||
* Get the verticies
|
||||
* @return
|
||||
* @throws IncompleteRegionException
|
||||
*/
|
||||
default List<BlockVector3> getVerticies() throws IncompleteRegionException {
|
||||
return Collections.singletonList(getPrimaryPosition());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,8 +20,8 @@
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
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;
|
||||
@ -37,11 +37,13 @@ import com.sk89q.worldedit.regions.polyhedron.Triangle;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.util.*;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Creates a {@code ConvexPolyhedralRegion} from a user's selections.
|
||||
@ -108,11 +110,6 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockVector3> getVerticies() {
|
||||
return new ArrayList<>(region.getVertices());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public World getWorld() {
|
||||
@ -279,5 +276,4 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -22,14 +22,12 @@ 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 static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
||||
import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
|
||||
@ -39,13 +37,10 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Creates a {@code CuboidRegion} from a user's selections.
|
||||
@ -96,6 +91,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
position1 = oldRegion.getMinimumPoint();
|
||||
position2 = oldRegion.getMaximumPoint();
|
||||
}
|
||||
|
||||
region.setPos1(position1);
|
||||
region.setPos2(position2);
|
||||
}
|
||||
@ -103,7 +99,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
/**
|
||||
* Create a new region selector with the given two positions.
|
||||
*
|
||||
* @param world the world
|
||||
* @param world the world
|
||||
* @param position1 position 1
|
||||
* @param position2 position 2
|
||||
*/
|
||||
@ -117,11 +113,6 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
region.setPos2(position2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlockVector3> getVerticies() {
|
||||
return Arrays.asList(position1, position2);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public World getWorld() {
|
||||
@ -317,5 +308,4 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
return "cuboid";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,8 +20,8 @@
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
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;
|
||||
@ -38,13 +38,11 @@ import com.sk89q.worldedit.regions.Region;
|
||||
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;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Creates a {@code CylinderRegionSelector} from a user's selections.
|
||||
|
@ -20,8 +20,8 @@
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
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;
|
||||
@ -35,12 +35,10 @@ import com.sk89q.worldedit.regions.Region;
|
||||
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.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Creates a {@code EllipsoidRegionSelector} from a user's selections.
|
||||
@ -251,5 +249,4 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
||||
return region.getCenter().toBlockPoint();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -142,5 +142,4 @@ public class ExtendingCuboidRegionSelector extends CuboidRegionSelector {
|
||||
explainRegionAdjust(player, session);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,8 +20,8 @@
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
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;
|
||||
@ -36,13 +36,11 @@ import com.sk89q.worldedit.regions.Region;
|
||||
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;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Creates a {@code Polygonal2DRegion} from a user's selections.
|
||||
@ -114,7 +112,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion {
|
||||
*/
|
||||
public Polygonal2DRegionSelector(@Nullable World world, List<BlockVector2> points, int minY, int maxY) {
|
||||
checkNotNull(points);
|
||||
|
||||
|
||||
final BlockVector2 pos2D = points.get(0);
|
||||
pos1 = BlockVector3.at(pos2D.getX(), minY, pos2D.getZ());
|
||||
region = new Polygonal2DRegion(world, points, minY, maxY);
|
||||
|
@ -79,17 +79,17 @@ public abstract class ArbitraryBiomeShape {
|
||||
*
|
||||
* @param x X coordinate to be queried
|
||||
* @param z Z coordinate to be queried
|
||||
* @param defaultBiomeType The default biome for the current column.
|
||||
* @param defaultBaseBiome The default biome for the current column.
|
||||
* @return material to place or null to not place anything.
|
||||
*/
|
||||
protected abstract BiomeType getBiome(int x, int z, BiomeType defaultBiomeType);
|
||||
protected abstract BiomeType getBiome(int x, int z, BiomeType defaultBaseBiome);
|
||||
|
||||
private BiomeType getBiomeCached(int x, int z, BiomeType biomeType) {
|
||||
private BiomeType getBiomeCached(int x, int z, BiomeType baseBiome) {
|
||||
final int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ;
|
||||
|
||||
final BiomeType cacheEntry = cache[index];
|
||||
if (cacheEntry == null) {// unknown, fetch material
|
||||
final BiomeType material = getBiome(x, z, biomeType);
|
||||
final BiomeType material = getBiome(x, z, baseBiome);
|
||||
if (material == null) {
|
||||
// outside
|
||||
cache[index] = BiomeTypes.THE_VOID;
|
||||
@ -108,13 +108,13 @@ public abstract class ArbitraryBiomeShape {
|
||||
return cacheEntry;
|
||||
}
|
||||
|
||||
private boolean isInsideCached(int x, int z, BiomeType biomeType) {
|
||||
private boolean isInsideCached(int x, int z, BiomeType baseBiome) {
|
||||
final int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ;
|
||||
|
||||
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, biomeType) != null;
|
||||
return getBiomeCached(x, z, baseBiome) != null;
|
||||
}
|
||||
|
||||
return cacheEntry != BiomeTypes.THE_VOID;
|
||||
@ -124,11 +124,11 @@ public abstract class ArbitraryBiomeShape {
|
||||
* Generates the shape.
|
||||
*
|
||||
* @param editSession The EditSession to use.
|
||||
* @param biomeType The default biome type.
|
||||
* @param baseBiome The default biome type.
|
||||
* @param hollow Specifies whether to generate a hollow shape.
|
||||
* @return number of affected blocks.
|
||||
*/
|
||||
public int generate(EditSession editSession, BiomeType biomeType, boolean hollow) {
|
||||
public int generate(EditSession editSession, BiomeType baseBiome, boolean hollow) {
|
||||
int affected = 0;
|
||||
|
||||
for (BlockVector2 position : getExtent()) {
|
||||
@ -136,7 +136,7 @@ public abstract class ArbitraryBiomeShape {
|
||||
int z = position.getBlockZ();
|
||||
|
||||
if (!hollow) {
|
||||
final BiomeType material = getBiome(x, z, biomeType);
|
||||
final BiomeType material = getBiome(x, z, baseBiome);
|
||||
if (material != null && material != BiomeTypes.THE_VOID) {
|
||||
editSession.getWorld().setBiome(position, material);
|
||||
++affected;
|
||||
@ -145,26 +145,26 @@ public abstract class ArbitraryBiomeShape {
|
||||
continue;
|
||||
}
|
||||
|
||||
final BiomeType material = getBiomeCached(x, z, biomeType);
|
||||
final BiomeType material = getBiomeCached(x, z, baseBiome);
|
||||
if (material == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean draw = false;
|
||||
do {
|
||||
if (!isInsideCached(x + 1, z, biomeType)) {
|
||||
if (!isInsideCached(x + 1, z, baseBiome)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
if (!isInsideCached(x - 1, z, biomeType)) {
|
||||
if (!isInsideCached(x - 1, z, baseBiome)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
if (!isInsideCached(x, z + 1, biomeType)) {
|
||||
if (!isInsideCached(x, z + 1, baseBiome)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
if (!isInsideCached(x, z - 1, biomeType)) {
|
||||
if (!isInsideCached(x, z - 1, baseBiome)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ import com.sk89q.worldedit.math.MutableVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
|
||||
public class WorldEditExpressionEnvironment implements ExpressionEnvironment {
|
||||
|
||||
private final Vector3 unit;
|
||||
private final Vector3 zero2;
|
||||
private Vector3 current = new MutableVector3(Vector3.ZERO);
|
||||
private EditSession editSession;
|
||||
private Extent extent;
|
||||
|
||||
public WorldEditExpressionEnvironment(EditSession editSession, Vector3 unit, Vector3 zero) {
|
||||
@ -90,5 +90,4 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user