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);
|
final Biome bukkitBiome = BukkitAdapter.adapt(biome);
|
||||||
return bukkitBiome == null ? null : bukkitBiome::name;
|
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.HeightBoundExtent;
|
||||||
import com.boydti.fawe.object.extent.MultiRegionExtent;
|
import com.boydti.fawe.object.extent.MultiRegionExtent;
|
||||||
import com.boydti.fawe.object.extent.NullExtent;
|
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.ResettableExtent;
|
||||||
import com.boydti.fawe.object.extent.SingleRegionExtent;
|
import com.boydti.fawe.object.extent.SingleRegionExtent;
|
||||||
import com.boydti.fawe.object.extent.SlowExtent;
|
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);
|
private static final Logger log = LoggerFactory.getLogger(EditSession.class);
|
||||||
|
|
||||||
|
public enum Stage {
|
||||||
|
BEFORE_HISTORY,
|
||||||
|
BEFORE_REORDER,
|
||||||
|
BEFORE_CHANGE
|
||||||
|
}
|
||||||
|
|
||||||
private World world;
|
private World world;
|
||||||
private String worldName;
|
private String worldName;
|
||||||
private FaweQueue queue;
|
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 UUID CONSOLE = UUID.fromString("1-1-3-3-7");
|
||||||
public static final BlockState nullBlock = BlockTypes.AIR.getDefaultState();
|
public static final BlockState nullBlock = BlockTypes.AIR.getDefaultState();
|
||||||
|
|
||||||
public enum Stage {
|
|
||||||
BEFORE_HISTORY,
|
|
||||||
BEFORE_REORDER,
|
|
||||||
BEFORE_CHANGE
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@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) {
|
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);
|
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));
|
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.
|
* 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) {
|
if (find != null && find.get() != null) {
|
||||||
find.get().setLimit(this.limit);
|
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
|
// pkg private for TracedEditSession only, may later become public API
|
||||||
boolean commitRequired() {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1400,7 +1386,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
* and that it should apply them to the world.
|
* and that it should apply them to the world.
|
||||||
*/
|
*/
|
||||||
public void flushSession() {
|
public void flushSession() {
|
||||||
Operations.completeBlindly(commit());
|
flushQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -2895,11 +2881,11 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
counter[type.getInternalId()]++;
|
counter[type.getInternalId()]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Countable<BlockType>> distribution = new ArrayList<>();
|
List<Countable<BlockState>> distribution = new ArrayList<>();
|
||||||
for (int i = 0; i < counter.length; i++) {
|
for (int i = 0; i < counter.length; i++) {
|
||||||
int count = counter[i];
|
int count = counter[i];
|
||||||
if (count != 0) {
|
if (count != 0) {
|
||||||
distribution.add(new Countable<>(BlockTypes.get(i), count));
|
distribution.add(new Countable<>(BlockTypes.get(i).getDefaultState(), count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(distribution);
|
Collections.sort(distribution);
|
||||||
@ -2919,7 +2905,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
* @throws ExpressionException
|
* @throws ExpressionException
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public List<Countable<BlockStateHolder>> getBlockDistributionWithData(final Region region) {
|
public List<Countable<BlockState>> getBlockDistributionWithData(final Region region) {
|
||||||
int[][] counter = new int[BlockTypes.size()][];
|
int[][] counter = new int[BlockTypes.size()][];
|
||||||
|
|
||||||
if (region instanceof CuboidRegion) {
|
if (region instanceof CuboidRegion) {
|
||||||
@ -2958,7 +2944,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
stateCounter[blk.getInternalPropertiesId()]++;
|
stateCounter[blk.getInternalPropertiesId()]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Countable<BlockStateHolder>> distribution = new ArrayList<>();
|
List<Countable<BlockState>> distribution = new ArrayList<>();
|
||||||
for (int typeId = 0; typeId < counter.length; typeId++) {
|
for (int typeId = 0; typeId < counter.length; typeId++) {
|
||||||
BlockType type = BlockTypes.get(typeId);
|
BlockType type = BlockTypes.get(typeId);
|
||||||
int[] stateCount = counter[typeId];
|
int[] stateCount = counter[typeId];
|
||||||
@ -2966,7 +2952,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
for (int propId = 0; propId < stateCount.length; propId++) {
|
for (int propId = 0; propId < stateCount.length; propId++) {
|
||||||
int count = stateCount[propId];
|
int count = stateCount[propId];
|
||||||
if (count != 0) {
|
if (count != 0) {
|
||||||
BlockStateHolder state = type.withPropertyId(propId);
|
BlockState state = type.withPropertyId(propId);
|
||||||
distribution.add(new Countable<>(state, count));
|
distribution.add(new Countable<>(state, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3333,26 +3319,28 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void recurseHollow(Region region, BlockVector3 origin, Set<BlockVector3> outside) {
|
private void recurseHollow(Region region, BlockVector3 origin, Set<BlockVector3> outside) {
|
||||||
final BlockVectorSet queue = new BlockVectorSet<>();
|
final BlockVectorSet queue = new BlockVectorSet();
|
||||||
queue.addLast(origin);
|
|
||||||
|
|
||||||
while (!queue.isEmpty()) {
|
while (!queue.isEmpty()) {
|
||||||
final BlockVector3 current = queue.removeFirst();
|
Iterator<BlockVector3> iter = queue.iterator();
|
||||||
final BlockState block = getBlock(current);
|
while (iter.hasNext()) {
|
||||||
if (block.getBlockType().getMaterial().isMovementBlocker()) {
|
BlockVector3 current = iter.next();
|
||||||
continue;
|
iter.remove();
|
||||||
}
|
final BlockState block = getBlock(current);
|
||||||
|
if (block.getBlockType().getMaterial().isMovementBlocker()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!outside.add(current)) {
|
if (!outside.add(current)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!region.contains(current)) {
|
if (!region.contains(current)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BlockVector3 recurseDirection : recurseDirections) {
|
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);
|
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;
|
return changed;
|
||||||
}
|
}
|
||||||
private static final BlockVector3[] recurseDirections = {
|
private static final BlockVector3[] recurseDirections = {
|
||||||
@ -3504,9 +3487,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
int zz = z + bz;
|
int zz = z + bz;
|
||||||
for (int y = 0; y < getMaxY() + 1; y++) {
|
for (int y = 0; y < getMaxY() + 1; y++) {
|
||||||
// BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
|
BaseBlock block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||||
BlockVector3 bv = BlockVector3.at(xx, y, zz);
|
|
||||||
BaseBlock block = getFullBlock(bv);
|
|
||||||
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState().toBaseBlock());
|
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState().toBaseBlock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3530,18 +3511,17 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
mutable.mutZ(zz);
|
mutable.mutZ(zz);
|
||||||
for (int y = 0; y < getMaxY() + 1; y++) {
|
for (int y = 0; y < getMaxY() + 1; y++) {
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
BlockVector3 mbv = BlockVector3.at(xx, y, zz);
|
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mutable);
|
||||||
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mbv);
|
|
||||||
if (contains) {
|
if (contains) {
|
||||||
containsAny = true;
|
containsAny = true;
|
||||||
if (fcs != null) {
|
if (fcs != null) {
|
||||||
BaseBlock block = getFullBlock(mbv);
|
BaseBlock block = getFullBlock(mutable);
|
||||||
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState().toBaseBlock());
|
fcs.add(mutable, block, BlockTypes.AIR.getDefaultState().toBaseBlock());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BlockStateHolder block = getFullBlock(mbv);
|
BlockStateHolder block = getFullBlock(mutable);
|
||||||
try {
|
try {
|
||||||
setBlock(mbv, block);
|
setBlock(mutable, block);
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
throw new RuntimeException(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.item.ItemTypes;
|
||||||
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
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.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ListIterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
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)")
|
@Command(aliases = {}, desc = "Various utility commands: [More Info](http://wiki.sk89q.com/wiki/WorldEdit/Utilities)")
|
||||||
public class UtilityCommands extends MethodCommands {
|
public class UtilityCommands extends MethodCommands {
|
||||||
|
private final WorldEdit we;
|
||||||
|
|
||||||
public UtilityCommands(WorldEdit we) {
|
public UtilityCommands(WorldEdit we) {
|
||||||
super(we);
|
super(we);
|
||||||
|
this.we = we;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -536,15 +539,19 @@ public class UtilityCommands extends MethodCommands {
|
|||||||
EditSession editSession = null;
|
EditSession editSession = null;
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
session = worldEdit.getSessionManager().get(player);
|
session = we.getSessionManager().get(player);
|
||||||
BlockVector3 center = session.getPlacementPosition(player);
|
BlockVector3 center = session.getPlacementPosition(player);
|
||||||
editSession = session.createEditSession(player);
|
editSession = session.createEditSession(player);
|
||||||
List<? extends Entity> entities;
|
List<? extends Entity> entities;
|
||||||
if (radius >= 0) {
|
if (radius >= 0) {
|
||||||
CylinderRegion region = CylinderRegion.createRadius(editSession, center, radius);
|
CylinderRegion region = CylinderRegion.createRadius(editSession, center, radius);
|
||||||
|
entities = editSession.getEntities(region);
|
||||||
} else {
|
} else {
|
||||||
|
entities = editSession.getEntities();
|
||||||
|
}
|
||||||
|
visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction()));
|
||||||
} else {
|
} else {
|
||||||
Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
Platform platform = we.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
||||||
for (World world : platform.getWorlds()) {
|
for (World world : platform.getWorlds()) {
|
||||||
List<? extends Entity> entities = world.getEntities();
|
List<? extends Entity> entities = world.getEntities();
|
||||||
visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction()));
|
visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction()));
|
||||||
|
@ -44,27 +44,23 @@ public class AreaPickaxe implements BlockTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try (EditSession editSession = session.createEditSession(player)) {
|
try (EditSession editSession = session.createEditSession(player)) {
|
||||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
try {
|
||||||
|
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||||
for (int x = ox - range; x <= ox + range; ++x) {
|
for (int x = ox - range; x <= ox + range; ++x) {
|
||||||
for (int z = oz - range; z <= oz + range; ++z) {
|
for (int z = oz - range; z <= oz + range; ++z) {
|
||||||
for (int y = oy + range; y >= oy - range; --y) {
|
for (int y = oy + range; y >= oy - range; --y) {
|
||||||
if (initialType.equals(editSession.getLazyBlock(x, y, z))) {
|
if (initialType.equals(editSession.getLazyBlock(x, y, z))) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
|
|
||||||
}
|
}
|
||||||
} catch (MaxChangedBlocksException e) {
|
editSession.flushQueue();
|
||||||
player.printError("Max blocks change limit reached.");
|
|
||||||
} finally {
|
} finally {
|
||||||
session.remember(editSession);
|
session.remember(editSession);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
editSession.flushQueue();
|
|
||||||
session.remember(editSession);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command.tool;
|
package com.sk89q.worldedit.command.tool;
|
||||||
|
|
||||||
|
import com.boydti.fawe.object.mask.IdMask;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
@ -26,7 +27,12 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
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.pattern.Pattern;
|
||||||
|
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
@ -71,8 +77,11 @@ public class FloodFillTool implements BlockTool {
|
|||||||
|
|
||||||
try (EditSession editSession = session.createEditSession(player)) {
|
try (EditSession editSession = session.createEditSession(player)) {
|
||||||
try {
|
try {
|
||||||
TODO fillDirection (but replace)
|
Mask mask = initialType.toMask(editSession);
|
||||||
recurse(editSession, origin, origin, range, initialType, new HashSet<>());
|
BlockReplace function = new BlockReplace(editSession, pattern);
|
||||||
|
RecursiveVisitor visitor = new RecursiveVisitor(mask, function, range, editSession.getQueue());
|
||||||
|
visitor.visit(origin);
|
||||||
|
Operations.completeLegacy(visitor);
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
player.printError("Max blocks change limit reached.");
|
player.printError("Max blocks change limit reached.");
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -32,6 +32,8 @@ import com.sk89q.worldedit.LocalConfiguration;
|
|||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.command.tool.BlockTool;
|
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.DoubleActionTraceTool;
|
||||||
import com.sk89q.worldedit.command.tool.Tool;
|
import com.sk89q.worldedit.command.tool.Tool;
|
||||||
import com.sk89q.worldedit.command.tool.TraceTool;
|
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.math.Vector3;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
import com.sk89q.worldedit.session.request.Request;
|
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.util.eventbus.Subscribe;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -52,6 +57,8 @@ import java.util.EnumMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
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
|
// Check whether this platform was chosen to be the preferred one
|
||||||
// for any capability and be sure to remove it
|
// 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()) {
|
while (it.hasNext()) {
|
||||||
Entry<Capability, Platform> entry = it.next();
|
Map.Entry<Capability, Platform> entry = it.next();
|
||||||
if (entry.getValue().equals(platform)) {
|
if (entry.getValue().equals(platform)) {
|
||||||
entry.getKey().unload(this, entry.getValue());
|
entry.getKey().unload(this, entry.getValue());
|
||||||
it.remove();
|
it.remove();
|
||||||
@ -409,11 +416,11 @@ public class PlatformManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
Request.reset();
|
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
handleThrowable(e, actor);
|
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.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
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.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
||||||
@ -44,9 +46,8 @@ import java.util.List;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class AbstractDelegateExtent implements LightingExtent {
|
public class AbstractDelegateExtent implements LightingExtent {
|
||||||
|
|
||||||
private transient final Extent extent;
|
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.
|
* Create a new instance.
|
||||||
@ -75,11 +76,6 @@ public class AbstractDelegateExtent implements LightingExtent {
|
|||||||
return extent.getBlockType(position);
|
return extent.getBlockType(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
|
||||||
return extent.getFullBlock(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int getBlockLight(int x, int y, int z) {
|
public int getBlockLight(int x, int y, int z) {
|
||||||
if (extent instanceof LightingExtent) {
|
if (extent instanceof LightingExtent) {
|
||||||
|
@ -27,6 +27,8 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
|||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
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.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
@ -330,11 +332,11 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
* @param region a region
|
* @param region a region
|
||||||
* @return the results
|
* @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()][];
|
int[][] counter = new int[BlockTypes.size()][];
|
||||||
|
|
||||||
for (final BlockVector3 pt : region) {
|
for (final BlockVector3 pt : region) {
|
||||||
BlockStateHolder blk = this.getBlock(pt);
|
BlockState blk = this.getBlock(pt);
|
||||||
BlockType type = blk.getBlockType();
|
BlockType type = blk.getBlockType();
|
||||||
int[] stateCounter = counter[type.getInternalId()];
|
int[] stateCounter = counter[type.getInternalId()];
|
||||||
if (stateCounter == null) {
|
if (stateCounter == null) {
|
||||||
@ -342,7 +344,7 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
}
|
}
|
||||||
stateCounter[blk.getInternalPropertiesId()]++;
|
stateCounter[blk.getInternalPropertiesId()]++;
|
||||||
}
|
}
|
||||||
List<Countable<BlockStateHolder>> distribution = new ArrayList<>();
|
List<Countable<BlockState>> distribution = new ArrayList<>();
|
||||||
for (int typeId = 0; typeId < counter.length; typeId++) {
|
for (int typeId = 0; typeId < counter.length; typeId++) {
|
||||||
BlockType type = BlockTypes.get(typeId);
|
BlockType type = BlockTypes.get(typeId);
|
||||||
int[] stateCount = counter[typeId];
|
int[] stateCount = counter[typeId];
|
||||||
@ -350,7 +352,7 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
for (int propId = 0; propId < stateCount.length; propId++) {
|
for (int propId = 0; propId < stateCount.length; propId++) {
|
||||||
int count = stateCount[propId];
|
int count = stateCount[propId];
|
||||||
if (count != 0) {
|
if (count != 0) {
|
||||||
BlockStateHolder state = type.withPropertyId(propId);
|
BlockState state = type.withPropertyId(propId);
|
||||||
distribution.add(new Countable<>(state, count));
|
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.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the current state of blocks, entities, and so on.
|
* 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) {
|
public MultiStageReorder(Extent extent, boolean enabled) {
|
||||||
super(extent);
|
super(extent);
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
|
|
||||||
for (PlacementPriority priority : PlacementPriority.values()) {
|
for (PlacementPriority priority : PlacementPriority.values()) {
|
||||||
stages.put(priority, new LocatedBlockList());
|
stages.put(priority, new LocatedBlockList());
|
||||||
}
|
}
|
||||||
@ -229,7 +230,6 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
|
|||||||
stages.get(PlacementPriority.CLEAR_LAST).add(location, replacement);
|
stages.get(PlacementPriority.CLEAR_LAST).add(location, replacement);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (block.getBlockType().getMaterial().isAir()) {
|
if (block.getBlockType().getMaterial().isAir()) {
|
||||||
return !existing.equalsFuzzy(block);
|
return !existing.equalsFuzzy(block);
|
||||||
@ -252,4 +252,4 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
|
|||||||
|
|
||||||
return new OperationQueue(operations);
|
return new OperationQueue(operations);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,6 +38,13 @@ public class BlockMask extends AbstractExtentMask {
|
|||||||
private final long[][] bitSets;
|
private final long[][] bitSets;
|
||||||
protected final static long[] ALL = new long[0];
|
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
|
@Deprecated
|
||||||
public BlockMask(Extent extent, BaseBlock... blocks) {
|
public BlockMask(Extent extent, BaseBlock... blocks) {
|
||||||
super(extent);
|
super(extent);
|
||||||
|
@ -387,7 +387,7 @@ public class BlockMaskBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockMaskBuilder addBlocks(Collection<BlockStateHolder> blocks) {
|
public <T extends BlockStateHolder> BlockMaskBuilder addBlocks(Collection<T> blocks) {
|
||||||
for (BlockStateHolder block : blocks) add(block);
|
for (BlockStateHolder block : blocks) add(block);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ public class BlockMaskBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockMaskBuilder addBlocks(BlockStateHolder... blocks) {
|
public <T extends BlockStateHolder> BlockMaskBuilder addBlocks(T... blocks) {
|
||||||
for (BlockStateHolder block : blocks) add(block);
|
for (BlockStateHolder block : blocks) add(block);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.function.pattern;
|
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.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
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.util.command.parametric.ParameterException;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
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.biome.Biomes;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
@ -358,7 +359,7 @@ public BaseBlock getBaseBlock(ArgumentStack context) throws ParameterException,
|
|||||||
String input = context.next();
|
String input = context.next();
|
||||||
if (input != null) {
|
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()
|
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||||
|
@ -478,6 +478,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
} else {
|
} else {
|
||||||
x = cbx;
|
x = cbx;
|
||||||
z = cbz;
|
z = cbz;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
x = cbx;
|
x = cbx;
|
||||||
}
|
}
|
||||||
|
@ -84,12 +84,12 @@ public abstract class ArbitraryBiomeShape {
|
|||||||
*/
|
*/
|
||||||
protected abstract BiomeType getBiome(int x, int z, BiomeType defaultBiomeType);
|
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 int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ;
|
||||||
|
|
||||||
final BiomeType cacheEntry = cache[index];
|
final BiomeType cacheEntry = cache[index];
|
||||||
if (cacheEntry == null) {// unknown, fetch material
|
if (cacheEntry == null) {// unknown, fetch material
|
||||||
final BiomeType material = getBiome(x, z, BiomeType);
|
final BiomeType material = getBiome(x, z, biomeType);
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
// outside
|
// outside
|
||||||
cache[index] = BiomeTypes.THE_VOID;
|
cache[index] = BiomeTypes.THE_VOID;
|
||||||
@ -108,13 +108,13 @@ public abstract class ArbitraryBiomeShape {
|
|||||||
return cacheEntry;
|
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 int index = (z - cacheOffsetZ) + (x - cacheOffsetX) * cacheSizeZ;
|
||||||
|
|
||||||
final BiomeType cacheEntry = cache[index];
|
final BiomeType cacheEntry = cache[index];
|
||||||
if (cacheEntry == null) {
|
if (cacheEntry == null) {
|
||||||
// unknown block, meaning they must be outside the extent at this stage, but might still be inside the shape
|
// 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;
|
return cacheEntry != BiomeTypes.THE_VOID;
|
||||||
@ -124,11 +124,11 @@ public abstract class ArbitraryBiomeShape {
|
|||||||
* Generates the shape.
|
* Generates the shape.
|
||||||
*
|
*
|
||||||
* @param editSession The EditSession to use.
|
* @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.
|
* @param hollow Specifies whether to generate a hollow shape.
|
||||||
* @return number of affected blocks.
|
* @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;
|
int affected = 0;
|
||||||
|
|
||||||
for (BlockVector2 position : getExtent()) {
|
for (BlockVector2 position : getExtent()) {
|
||||||
@ -136,7 +136,7 @@ public abstract class ArbitraryBiomeShape {
|
|||||||
int z = position.getBlockZ();
|
int z = position.getBlockZ();
|
||||||
|
|
||||||
if (!hollow) {
|
if (!hollow) {
|
||||||
final BiomeType material = getBiome(x, z, BiomeType);
|
final BiomeType material = getBiome(x, z, biomeType);
|
||||||
if (material != null && material != BiomeTypes.THE_VOID) {
|
if (material != null && material != BiomeTypes.THE_VOID) {
|
||||||
editSession.getWorld().setBiome(position, material);
|
editSession.getWorld().setBiome(position, material);
|
||||||
++affected;
|
++affected;
|
||||||
@ -145,26 +145,26 @@ public abstract class ArbitraryBiomeShape {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final BiomeType material = getBiomeCached(x, z, BiomeType);
|
final BiomeType material = getBiomeCached(x, z, biomeType);
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean draw = false;
|
boolean draw = false;
|
||||||
do {
|
do {
|
||||||
if (!isInsideCached(x + 1, z, BiomeType)) {
|
if (!isInsideCached(x + 1, z, biomeType)) {
|
||||||
draw = true;
|
draw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!isInsideCached(x - 1, z, BiomeType)) {
|
if (!isInsideCached(x - 1, z, biomeType)) {
|
||||||
draw = true;
|
draw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!isInsideCached(x, z + 1, BiomeType)) {
|
if (!isInsideCached(x, z + 1, biomeType)) {
|
||||||
draw = true;
|
draw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!isInsideCached(x, z - 1, BiomeType)) {
|
if (!isInsideCached(x, z - 1, biomeType)) {
|
||||||
draw = true;
|
draw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -117,4 +117,8 @@ public class BiomeTypes {
|
|||||||
public static @Nullable BiomeType get(final String id) {
|
public static @Nullable BiomeType get(final String id) {
|
||||||
return BiomeType.REGISTRY.get(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.WorldEditException;
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.function.pattern.FawePattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
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.
|
* An immutable class that represents the state a block can be in.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class BlockState implements BlockStateHolder<BlockState> {
|
public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
||||||
private final BlockType blockType;
|
private final BlockType blockType;
|
||||||
private BaseBlock emptyBaseBlock;
|
private BaseBlock emptyBaseBlock;
|
||||||
|
|
||||||
@ -356,11 +357,6 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BaseBlock toBaseBlock() {
|
|
||||||
return this.emptyBaseBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInternalId() {
|
public int getInternalId() {
|
||||||
return blockType.getInternalId();
|
return blockType.getInternalId();
|
||||||
|
@ -60,6 +60,7 @@ import java.util.stream.Stream;
|
|||||||
*/
|
*/
|
||||||
public final class BlockTypes {
|
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_BUTTON = get("minecraft:acacia_button");
|
||||||
@Nullable public static final BlockType ACACIA_DOOR = get("minecraft:acacia_door");
|
@Nullable public static final BlockType ACACIA_DOOR = get("minecraft:acacia_door");
|
||||||
@Nullable public static final BlockType ACACIA_FENCE = get("minecraft:acacia_fence");
|
@Nullable public static final BlockType ACACIA_FENCE = get("minecraft:acacia_fence");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren