mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Allow use of BlockVectorSet for large //line selections instead of LocalBlockVectorSet (#1713)
This commit is contained in:
@ -56,6 +56,7 @@ import com.fastasyncworldedit.core.util.ExtentTraverser;
|
||||
import com.fastasyncworldedit.core.util.MaskTraverser;
|
||||
import com.fastasyncworldedit.core.util.MathMan;
|
||||
import com.fastasyncworldedit.core.util.TaskManager;
|
||||
import com.fastasyncworldedit.core.util.collection.BlockVector3Set;
|
||||
import com.fastasyncworldedit.core.util.task.RunnableVal;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
@ -3052,7 +3053,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
*/
|
||||
public int hollowOutRegion(Region region, int thickness, Pattern pattern, Mask mask) {
|
||||
try {
|
||||
final Set<BlockVector3> outside = new LocalBlockVectorSet();
|
||||
final Set<BlockVector3> outside = BlockVector3Set.getAppropriateVectorSet(region);
|
||||
|
||||
final BlockVector3 min = region.getMinimumPoint();
|
||||
final BlockVector3 max = region.getMaximumPoint();
|
||||
@ -3096,7 +3097,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
|
||||
for (int i = 1; i < thickness; ++i) {
|
||||
final Set<BlockVector3> newOutside = new LocalBlockVectorSet();
|
||||
final Set<BlockVector3> newOutside = BlockVector3Set.getAppropriateVectorSet(region);
|
||||
outer:
|
||||
for (BlockVector3 position : region) {
|
||||
for (BlockVector3 recurseDirection : recurseDirections) {
|
||||
@ -3151,11 +3152,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
public int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled, boolean flat)
|
||||
throws MaxChangedBlocksException {
|
||||
|
||||
//FAWE start - LocalBlockVectorSet
|
||||
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
||||
boolean notdrawn = true;
|
||||
//FAWE end
|
||||
|
||||
int x1 = pos1.getBlockX();
|
||||
int y1 = pos1.getBlockY();
|
||||
int z1 = pos1.getBlockZ();
|
||||
@ -3169,6 +3165,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
int dy = Math.abs(y2 - y1);
|
||||
int dz = Math.abs(z2 - z1);
|
||||
|
||||
//FAWE start - LocalBlockVectorSet
|
||||
BlockVector3Set vset = BlockVector3Set.getAppropriateVectorSet(new CuboidRegion(pos1, pos2));
|
||||
|
||||
boolean notdrawn = true;
|
||||
//FAWE end
|
||||
|
||||
if (dx + dy + dz == 0) {
|
||||
//FAWE start - LocalBlockVectorSet
|
||||
vset.add(tipx, tipy, tipz);
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.extension.input;
|
||||
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.factory.MaskFactory;
|
||||
@ -27,6 +28,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Locatable;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
|
||||
@ -343,5 +345,29 @@ public class ParserContext {
|
||||
|
||||
return maxY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to retrieve the selection associated with this context. Requires an {@link Actor} or {@link LocalSession} be
|
||||
* supplied.
|
||||
*
|
||||
* @return Region representing the selection for this context or null if it cannot be retrieved.
|
||||
* @since TODO
|
||||
*/
|
||||
public Region getSelection() {
|
||||
if (session != null) {
|
||||
try {
|
||||
return session.getSelection();
|
||||
} catch (IncompleteRegionException ignored) {
|
||||
}
|
||||
}
|
||||
if (actor != null) {
|
||||
try {
|
||||
return actor.getSession().getSelection();
|
||||
} catch (IncompleteRegionException ignored) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//FAWE end
|
||||
}
|
||||
|
Reference in New Issue
Block a user