geforkt von Mirrors/FastAsyncWorldEdit
continue with merge
Dieser Commit ist enthalten in:
Ursprung
8aef06b29e
Commit
7086eb8b3e
@ -40,5 +40,4 @@ class BukkitBiomeRegistry implements BiomeRegistry {
|
||||
final Biome bukkitBiome = BukkitAdapter.adapt(biome);
|
||||
return bukkitBiome == null ? null : bukkitBiome::name;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ import com.boydti.fawe.object.extent.FaweRegionExtent;
|
||||
import com.boydti.fawe.object.extent.HeightBoundExtent;
|
||||
import com.boydti.fawe.object.extent.MultiRegionExtent;
|
||||
import com.boydti.fawe.object.extent.NullExtent;
|
||||
import com.boydti.fawe.object.extent.ProcessedWEExtent;
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.object.extent.SingleRegionExtent;
|
||||
import com.boydti.fawe.object.extent.SlowExtent;
|
||||
@ -194,6 +195,12 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EditSession.class);
|
||||
|
||||
public enum Stage {
|
||||
BEFORE_HISTORY,
|
||||
BEFORE_REORDER,
|
||||
BEFORE_CHANGE
|
||||
}
|
||||
|
||||
private World world;
|
||||
private String worldName;
|
||||
private FaweQueue queue;
|
||||
@ -218,12 +225,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
public static final UUID CONSOLE = UUID.fromString("1-1-3-3-7");
|
||||
public static final BlockState nullBlock = BlockTypes.AIR.getDefaultState();
|
||||
|
||||
public enum Stage {
|
||||
BEFORE_HISTORY,
|
||||
BEFORE_REORDER,
|
||||
BEFORE_CHANGE
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public EditSession(@Nonnull World world, @Nullable FaweQueue queue, @Nullable FawePlayer player, @Nullable FaweLimit limit, @Nullable FaweChangeSet changeSet, @Nullable RegionWrapper[] allowedRegions, @Nullable Boolean autoQueue, @Nullable Boolean fastmode, @Nullable Boolean checkMemory, @Nullable Boolean combineStages, @Nullable BlockBag blockBag, @Nullable EventBus bus, @Nullable EditSessionEvent event) {
|
||||
this(null, world, queue, player, limit, changeSet, allowedRegions, autoQueue, fastmode, checkMemory, combineStages, blockBag, bus, event);
|
||||
@ -417,10 +418,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
this(WorldEdit.getInstance().getEventBus(), world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null));
|
||||
}
|
||||
|
||||
private ReorderMode reorderMode = ReorderMode.MULTI_STAGE;
|
||||
|
||||
private Mask oldMask;
|
||||
|
||||
/**
|
||||
* Construct the object with a maximum number of blocks and a block bag.
|
||||
*
|
||||
@ -449,8 +446,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
if (find != null && find.get() != null) {
|
||||
find.get().setLimit(this.limit);
|
||||
}
|
||||
|
||||
setReorderMode(this.reorderMode);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -619,15 +614,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
|
||||
// pkg private for TracedEditSession only, may later become public API
|
||||
boolean commitRequired() {
|
||||
if (reorderExtent != null && reorderExtent.commitRequired()) {
|
||||
return true;
|
||||
}
|
||||
if (chunkBatchingExtent != null && chunkBatchingExtent.commitRequired()) {
|
||||
return true;
|
||||
}
|
||||
if (fastModeExtent != null && fastModeExtent.commitRequired()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1400,7 +1386,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
* and that it should apply them to the world.
|
||||
*/
|
||||
public void flushSession() {
|
||||
Operations.completeBlindly(commit());
|
||||
flushQueue();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2895,11 +2881,11 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
counter[type.getInternalId()]++;
|
||||
}
|
||||
}
|
||||
List<Countable<BlockType>> distribution = new ArrayList<>();
|
||||
List<Countable<BlockState>> distribution = new ArrayList<>();
|
||||
for (int i = 0; i < counter.length; i++) {
|
||||
int count = counter[i];
|
||||
if (count != 0) {
|
||||
distribution.add(new Countable<>(BlockTypes.get(i), count));
|
||||
distribution.add(new Countable<>(BlockTypes.get(i).getDefaultState(), count));
|
||||
}
|
||||
}
|
||||
Collections.sort(distribution);
|
||||
@ -2919,7 +2905,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
* @throws ExpressionException
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
public List<Countable<BlockStateHolder>> getBlockDistributionWithData(final Region region) {
|
||||
public List<Countable<BlockState>> getBlockDistributionWithData(final Region region) {
|
||||
int[][] counter = new int[BlockTypes.size()][];
|
||||
|
||||
if (region instanceof CuboidRegion) {
|
||||
@ -2958,7 +2944,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
stateCounter[blk.getInternalPropertiesId()]++;
|
||||
}
|
||||
}
|
||||
List<Countable<BlockStateHolder>> distribution = new ArrayList<>();
|
||||
List<Countable<BlockState>> distribution = new ArrayList<>();
|
||||
for (int typeId = 0; typeId < counter.length; typeId++) {
|
||||
BlockType type = BlockTypes.get(typeId);
|
||||
int[] stateCount = counter[typeId];
|
||||
@ -2966,7 +2952,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
for (int propId = 0; propId < stateCount.length; propId++) {
|
||||
int count = stateCount[propId];
|
||||
if (count != 0) {
|
||||
BlockStateHolder state = type.withPropertyId(propId);
|
||||
BlockState state = type.withPropertyId(propId);
|
||||
distribution.add(new Countable<>(state, count));
|
||||
}
|
||||
|
||||
@ -3333,11 +3319,12 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
|
||||
private void recurseHollow(Region region, BlockVector3 origin, Set<BlockVector3> outside) {
|
||||
final BlockVectorSet queue = new BlockVectorSet<>();
|
||||
queue.addLast(origin);
|
||||
|
||||
final BlockVectorSet queue = new BlockVectorSet();
|
||||
while (!queue.isEmpty()) {
|
||||
final BlockVector3 current = queue.removeFirst();
|
||||
Iterator<BlockVector3> iter = queue.iterator();
|
||||
while (iter.hasNext()) {
|
||||
BlockVector3 current = iter.next();
|
||||
iter.remove();
|
||||
final BlockState block = getBlock(current);
|
||||
if (block.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
continue;
|
||||
@ -3352,7 +3339,8 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
|
||||
for (BlockVector3 recurseDirection : recurseDirections) {
|
||||
queue.addLast(current.add(recurseDirection));
|
||||
queue.add(current.add(recurseDirection));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3388,11 +3376,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
};
|
||||
int changed = shape.generate(this, biomeType, hollow);
|
||||
if (timedOut[0] > 0) {
|
||||
throw new ExpressionTimeoutException(
|
||||
String.format("%d blocks changed. %d blocks took too long to evaluate (increase time with //timeout)",
|
||||
changed, timedOut[0]));
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
private static final BlockVector3[] recurseDirections = {
|
||||
@ -3504,9 +3487,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int zz = z + bz;
|
||||
for (int y = 0; y < getMaxY() + 1; y++) {
|
||||
// BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
BlockVector3 bv = BlockVector3.at(xx, y, zz);
|
||||
BaseBlock block = getFullBlock(bv);
|
||||
BaseBlock block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState().toBaseBlock());
|
||||
}
|
||||
}
|
||||
@ -3530,18 +3511,17 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
mutable.mutZ(zz);
|
||||
for (int y = 0; y < getMaxY() + 1; y++) {
|
||||
mutable.mutY(y);
|
||||
BlockVector3 mbv = BlockVector3.at(xx, y, zz);
|
||||
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mbv);
|
||||
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mutable);
|
||||
if (contains) {
|
||||
containsAny = true;
|
||||
if (fcs != null) {
|
||||
BaseBlock block = getFullBlock(mbv);
|
||||
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState().toBaseBlock());
|
||||
BaseBlock block = getFullBlock(mutable);
|
||||
fcs.add(mutable, block, BlockTypes.AIR.getDefaultState().toBaseBlock());
|
||||
}
|
||||
} else {
|
||||
BlockStateHolder block = getFullBlock(mbv);
|
||||
BlockStateHolder block = getFullBlock(mutable);
|
||||
try {
|
||||
setBlock(mbv, block);
|
||||
setBlock(mutable, block);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -68,12 +68,22 @@ import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
@ -113,8 +113,11 @@ import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
|
||||
*/
|
||||
@Command(aliases = {}, desc = "Various utility commands: [More Info](http://wiki.sk89q.com/wiki/WorldEdit/Utilities)")
|
||||
public class UtilityCommands extends MethodCommands {
|
||||
private final WorldEdit we;
|
||||
|
||||
public UtilityCommands(WorldEdit we) {
|
||||
super(we);
|
||||
this.we = we;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -536,15 +539,19 @@ public class UtilityCommands extends MethodCommands {
|
||||
EditSession editSession = null;
|
||||
|
||||
if (player != null) {
|
||||
session = worldEdit.getSessionManager().get(player);
|
||||
session = we.getSessionManager().get(player);
|
||||
BlockVector3 center = session.getPlacementPosition(player);
|
||||
editSession = session.createEditSession(player);
|
||||
List<? extends Entity> entities;
|
||||
if (radius >= 0) {
|
||||
CylinderRegion region = CylinderRegion.createRadius(editSession, center, radius);
|
||||
entities = editSession.getEntities(region);
|
||||
} else {
|
||||
entities = editSession.getEntities();
|
||||
}
|
||||
visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction()));
|
||||
} else {
|
||||
Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
||||
Platform platform = we.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
||||
for (World world : platform.getWorlds()) {
|
||||
List<? extends Entity> entities = world.getEntities();
|
||||
visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction()));
|
||||
|
@ -44,8 +44,8 @@ public class AreaPickaxe implements BlockTool {
|
||||
}
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
for (int x = ox - range; x <= ox + range; ++x) {
|
||||
for (int z = oz - range; z <= oz + range; ++z) {
|
||||
for (int y = oy + range; y >= oy - range; --y) {
|
||||
@ -54,17 +54,13 @@ public class AreaPickaxe implements BlockTool {
|
||||
}
|
||||
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
}
|
||||
}
|
||||
editSession.flushQueue();
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
editSession.flushQueue();
|
||||
session.remember(editSession);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -26,7 +27,12 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.function.block.BlockReplace;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -71,8 +77,11 @@ public class FloodFillTool implements BlockTool {
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
TODO fillDirection (but replace)
|
||||
recurse(editSession, origin, origin, range, initialType, new HashSet<>());
|
||||
Mask mask = initialType.toMask(editSession);
|
||||
BlockReplace function = new BlockReplace(editSession, pattern);
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, function, range, editSession.getQueue());
|
||||
visitor.visit(origin);
|
||||
Operations.completeLegacy(visitor);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
|
@ -32,6 +32,8 @@ import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.tool.BlockTool;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.command.tool.DoubleActionBlockTool;
|
||||
import com.sk89q.worldedit.command.tool.DoubleActionTraceTool;
|
||||
import com.sk89q.worldedit.command.tool.Tool;
|
||||
import com.sk89q.worldedit.command.tool.TraceTool;
|
||||
@ -42,7 +44,10 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -52,6 +57,8 @@ import java.util.EnumMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
@ -131,9 +138,9 @@ public class PlatformManager {
|
||||
|
||||
// Check whether this platform was chosen to be the preferred one
|
||||
// for any capability and be sure to remove it
|
||||
Iterator<Entry<Capability, Platform>> it = preferences.entrySet().iterator();
|
||||
Iterator<Map.Entry<Capability, Platform>> it = preferences.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<Capability, Platform> entry = it.next();
|
||||
Map.Entry<Capability, Platform> entry = it.next();
|
||||
if (entry.getValue().equals(platform)) {
|
||||
entry.getKey().unload(this, entry.getValue());
|
||||
it.remove();
|
||||
@ -409,11 +416,11 @@ public class PlatformManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Request.reset();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
handleThrowable(e, actor);
|
||||
} finally {
|
||||
Request.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,8 @@ import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
||||
@ -44,9 +46,8 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class AbstractDelegateExtent implements LightingExtent {
|
||||
|
||||
private transient final Extent extent;
|
||||
// private MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||
private MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -75,11 +76,6 @@ public class AbstractDelegateExtent implements LightingExtent {
|
||||
return extent.getBlockType(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return extent.getFullBlock(position);
|
||||
}
|
||||
|
||||
|
||||
public int getBlockLight(int x, int y, int z) {
|
||||
if (extent instanceof LightingExtent) {
|
||||
|
@ -27,6 +27,8 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -330,11 +332,11 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
* @param region a region
|
||||
* @return the results
|
||||
*/
|
||||
default List<Countable<BlockStateHolder>> getBlockDistributionWithData(final Region region) {
|
||||
default List<Countable<BlockState>> getBlockDistributionWithData(final Region region) {
|
||||
int[][] counter = new int[BlockTypes.size()][];
|
||||
|
||||
for (final BlockVector3 pt : region) {
|
||||
BlockStateHolder blk = this.getBlock(pt);
|
||||
BlockState blk = this.getBlock(pt);
|
||||
BlockType type = blk.getBlockType();
|
||||
int[] stateCounter = counter[type.getInternalId()];
|
||||
if (stateCounter == null) {
|
||||
@ -342,7 +344,7 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
}
|
||||
stateCounter[blk.getInternalPropertiesId()]++;
|
||||
}
|
||||
List<Countable<BlockStateHolder>> distribution = new ArrayList<>();
|
||||
List<Countable<BlockState>> distribution = new ArrayList<>();
|
||||
for (int typeId = 0; typeId < counter.length; typeId++) {
|
||||
BlockType type = BlockTypes.get(typeId);
|
||||
int[] stateCount = counter[typeId];
|
||||
@ -350,7 +352,7 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
for (int propId = 0; propId < stateCount.length; propId++) {
|
||||
int count = stateCount[propId];
|
||||
if (count != 0) {
|
||||
BlockStateHolder state = type.withPropertyId(propId);
|
||||
BlockState state = type.withPropertyId(propId);
|
||||
distribution.add(new Countable<>(state, count));
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
/**
|
||||
* Provides the current state of blocks, entities, and so on.
|
||||
|
@ -168,6 +168,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
|
||||
public MultiStageReorder(Extent extent, boolean enabled) {
|
||||
super(extent);
|
||||
this.enabled = enabled;
|
||||
|
||||
for (PlacementPriority priority : PlacementPriority.values()) {
|
||||
stages.put(priority, new LocatedBlockList());
|
||||
}
|
||||
@ -229,7 +230,6 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
|
||||
stages.get(PlacementPriority.CLEAR_LAST).add(location, replacement);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (block.getBlockType().getMaterial().isAir()) {
|
||||
return !existing.equalsFuzzy(block);
|
||||
|
@ -38,6 +38,13 @@ public class BlockMask extends AbstractExtentMask {
|
||||
private final long[][] bitSets;
|
||||
protected final static long[] ALL = new long[0];
|
||||
|
||||
@Deprecated
|
||||
public BlockMask(Extent extent, Collection<BaseBlock> blocks) {
|
||||
super(extent);
|
||||
MainUtil.warnDeprecated(BlockMaskBuilder.class);
|
||||
this.bitSets = new BlockMaskBuilder().addBlocks(blocks).optimize().getBits();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public BlockMask(Extent extent, BaseBlock... blocks) {
|
||||
super(extent);
|
||||
|
@ -387,7 +387,7 @@ public class BlockMaskBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BlockMaskBuilder addBlocks(Collection<BlockStateHolder> blocks) {
|
||||
public <T extends BlockStateHolder> BlockMaskBuilder addBlocks(Collection<T> blocks) {
|
||||
for (BlockStateHolder block : blocks) add(block);
|
||||
return this;
|
||||
}
|
||||
@ -397,7 +397,7 @@ public class BlockMaskBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BlockMaskBuilder addBlocks(BlockStateHolder... blocks) {
|
||||
public <T extends BlockStateHolder> BlockMaskBuilder addBlocks(T... blocks) {
|
||||
for (BlockStateHolder block : blocks) add(block);
|
||||
return this;
|
||||
}
|
||||
|
@ -19,6 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Link;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
@ -49,6 +49,7 @@ import com.sk89q.worldedit.util.command.parametric.BindingMatch;
|
||||
import com.sk89q.worldedit.util.command.parametric.ParameterException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.biome.Biomes;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -358,7 +359,7 @@ public BaseBlock getBaseBlock(ArgumentStack context) throws ParameterException,
|
||||
String input = context.next();
|
||||
if (input != null) {
|
||||
|
||||
if (MathMan.isInteger(input)) return new BiomeType(Integer.parseInt(input)); TODO FIXME
|
||||
if (MathMan.isInteger(input)) return BiomeTypes.get(Integer.parseInt(input));
|
||||
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
|
@ -478,6 +478,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
} else {
|
||||
x = cbx;
|
||||
z = cbz;
|
||||
}
|
||||
} else {
|
||||
x = cbx;
|
||||
}
|
||||
|
@ -84,12 +84,12 @@ public abstract class ArbitraryBiomeShape {
|
||||
*/
|
||||
protected abstract BiomeType getBiome(int x, int z, BiomeType defaultBiomeType);
|
||||
|
||||
private BiomeType getBiomeCached(int x, int z, BiomeType BiomeType) {
|
||||
private BiomeType getBiomeCached(int x, int z, BiomeType biomeType) {
|
||||
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, biomeType);
|
||||
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 biomeType) {
|
||||
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, biomeType) != 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 biomeType 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 biomeType, 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, biomeType);
|
||||
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, biomeType);
|
||||
if (material == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean draw = false;
|
||||
do {
|
||||
if (!isInsideCached(x + 1, z, BiomeType)) {
|
||||
if (!isInsideCached(x + 1, z, biomeType)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
if (!isInsideCached(x - 1, z, BiomeType)) {
|
||||
if (!isInsideCached(x - 1, z, biomeType)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
if (!isInsideCached(x, z + 1, BiomeType)) {
|
||||
if (!isInsideCached(x, z + 1, biomeType)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
if (!isInsideCached(x, z - 1, BiomeType)) {
|
||||
if (!isInsideCached(x, z - 1, biomeType)) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
|
@ -117,4 +117,8 @@ public class BiomeTypes {
|
||||
public static @Nullable BiomeType get(final String id) {
|
||||
return BiomeType.REGISTRY.get(id);
|
||||
}
|
||||
|
||||
public static BiomeType get(int parseInt) {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.pattern.FawePattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
@ -50,7 +51,7 @@ import java.util.Set;
|
||||
* An immutable class that represents the state a block can be in.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class BlockState implements BlockStateHolder<BlockState> {
|
||||
public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
||||
private final BlockType blockType;
|
||||
private BaseBlock emptyBaseBlock;
|
||||
|
||||
@ -356,11 +357,6 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock toBaseBlock() {
|
||||
return this.emptyBaseBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInternalId() {
|
||||
return blockType.getInternalId();
|
||||
|
@ -60,6 +60,7 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
public final class BlockTypes {
|
||||
|
||||
@Nullable public static final BlockType __RESERVED__ = get("minecraft:__reserved__");
|
||||
@Nullable public static final BlockType ACACIA_BUTTON = get("minecraft:acacia_button");
|
||||
@Nullable public static final BlockType ACACIA_DOOR = get("minecraft:acacia_door");
|
||||
@Nullable public static final BlockType ACACIA_FENCE = get("minecraft:acacia_fence");
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren