mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Current Progress #3
This commit is contained in:
@ -31,6 +31,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -85,18 +86,18 @@ public class CuboidClipboard {
|
||||
|
||||
private BlockArrayClipboard clipboard;
|
||||
private AffineTransform transform;
|
||||
public Vector size;
|
||||
public BlockVector3 size;
|
||||
|
||||
/**
|
||||
* Constructs the clipboard.
|
||||
*
|
||||
* @param size the dimensions of the clipboard (should be at least 1 on every dimension)
|
||||
*/
|
||||
public CuboidClipboard(Vector size) {
|
||||
public CuboidClipboard(BlockVector3 size) {
|
||||
checkNotNull(size);
|
||||
MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class);
|
||||
this.size = size;
|
||||
this.clipboard = this.init(Vector.ZERO, Vector.ZERO);
|
||||
this.clipboard = this.init(BlockVector3.ZERO, BlockVector3.ZERO);
|
||||
}
|
||||
|
||||
public CuboidClipboard(BlockArrayClipboard clipboard) {
|
||||
@ -111,12 +112,12 @@ public class CuboidClipboard {
|
||||
* @param origin the origin point where the copy was made, which must be the
|
||||
* {@link CuboidRegion#getMinimumPoint()} relative to the copy
|
||||
*/
|
||||
public CuboidClipboard(Vector size, Vector origin) {
|
||||
public CuboidClipboard(BlockVector3 size, BlockVector3 origin) {
|
||||
checkNotNull(size);
|
||||
checkNotNull(origin);
|
||||
MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class);
|
||||
this.size = size;
|
||||
this.clipboard = init(Vector.ZERO, origin);
|
||||
this.clipboard = init(BlockVector3.ZERO, origin);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +128,7 @@ public class CuboidClipboard {
|
||||
* {@link CuboidRegion#getMinimumPoint()} relative to the copy
|
||||
* @param offset the offset from the minimum point of the copy where the user was
|
||||
*/
|
||||
public CuboidClipboard(Vector size, Vector origin, Vector offset) {
|
||||
public CuboidClipboard(BlockVector3 size, BlockVector3 origin, BlockVector3 offset) {
|
||||
checkNotNull(size);
|
||||
checkNotNull(origin);
|
||||
checkNotNull(offset);
|
||||
@ -138,9 +139,9 @@ public class CuboidClipboard {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
private BlockArrayClipboard init(Vector offset, Vector min) {
|
||||
Vector origin = min.subtract(offset);
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(Vector.ONE));
|
||||
private BlockArrayClipboard init(BlockVector3 offset, BlockVector3 min) {
|
||||
BlockVector3 origin = min.subtract(offset);
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(BlockVector3.ONE));
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
|
||||
clipboard.setOrigin(origin);
|
||||
return clipboard;
|
||||
@ -153,7 +154,7 @@ public class CuboidClipboard {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
public BaseBlock getBlock(Vector position) {
|
||||
public BaseBlock getBlock(BlockVector3 position) {
|
||||
return getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
}
|
||||
|
||||
@ -162,11 +163,11 @@ public class CuboidClipboard {
|
||||
return adapt(clipboard.IMP.getBlock(x, y, z));
|
||||
}
|
||||
|
||||
public BaseBlock getLazyBlock(Vector position) {
|
||||
public BaseBlock getLazyBlock(BlockVector3 position) {
|
||||
return getBlock(position);
|
||||
}
|
||||
|
||||
public void setBlock(Vector location, BaseBlock block) {
|
||||
public void setBlock(BlockVector3 location, BaseBlock block) {
|
||||
setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
}
|
||||
|
||||
@ -235,7 +236,7 @@ public class CuboidClipboard {
|
||||
public void flip(FlipDirection dir, boolean aroundPlayer) {
|
||||
checkNotNull(dir);
|
||||
Direction direction = dir.direction;
|
||||
AffineTransform newTransform = new AffineTransform().scale(direction.toVector().positive().multiply(-2).add(1, 1, 1));
|
||||
AffineTransform newTransform = new AffineTransform().scale(direction.toVector().abs().multiply(-2).add(1, 1, 1));
|
||||
this.transform = transform == null ? newTransform : newTransform.combine(transform);
|
||||
}
|
||||
|
||||
@ -248,7 +249,7 @@ public class CuboidClipboard {
|
||||
for (int x = 0; x < size.getBlockX(); ++x) {
|
||||
for (int y = 0; y < size.getBlockY(); ++y) {
|
||||
for (int z = 0; z < size.getBlockZ(); ++z) {
|
||||
setBlock(x, y, z, editSession.getBlock(new Vector(x, y, z).add(getOrigin())));
|
||||
setBlock(x, y, z, editSession.getBlock(new BlockVector3(x, y, z).add(getOrigin())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -264,7 +265,7 @@ public class CuboidClipboard {
|
||||
for (int x = 0; x < size.getBlockX(); ++x) {
|
||||
for (int y = 0; y < size.getBlockY(); ++y) {
|
||||
for (int z = 0; z < size.getBlockZ(); ++z) {
|
||||
final Vector pt = new Vector(x, y, z).add(getOrigin());
|
||||
final BlockVector3 pt = new BlockVector3(x, y, z).add(getOrigin());
|
||||
if (region.contains(pt)) {
|
||||
setBlock(x, y, z, editSession.getBlock(pt));
|
||||
} else {
|
||||
@ -288,7 +289,7 @@ public class CuboidClipboard {
|
||||
* @param noAir true to not copy air blocks in the source
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks were changed
|
||||
*/
|
||||
public void paste(EditSession editSession, Vector newOrigin, boolean noAir) throws MaxChangedBlocksException {
|
||||
public void paste(EditSession editSession, BlockVector3 newOrigin, boolean noAir) throws MaxChangedBlocksException {
|
||||
paste(editSession, newOrigin, noAir, false);
|
||||
}
|
||||
|
||||
@ -306,7 +307,7 @@ public class CuboidClipboard {
|
||||
* @param entities true to copy entities
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks were changed
|
||||
*/
|
||||
public void paste(EditSession editSession, Vector newOrigin, boolean noAir, boolean entities) throws MaxChangedBlocksException {
|
||||
public void paste(EditSession editSession, BlockVector3 newOrigin, boolean noAir, boolean entities) throws MaxChangedBlocksException {
|
||||
new Schematic(clipboard).paste(editSession, newOrigin, false, !noAir, entities, transform);
|
||||
editSession.flushQueue();
|
||||
}
|
||||
@ -324,7 +325,7 @@ public class CuboidClipboard {
|
||||
* @param noAir true to not copy air blocks in the source
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks were changed
|
||||
*/
|
||||
public void place(EditSession editSession, Vector newOrigin, boolean noAir) throws MaxChangedBlocksException {
|
||||
public void place(EditSession editSession, BlockVector3 newOrigin, boolean noAir) throws MaxChangedBlocksException {
|
||||
paste(editSession, newOrigin, noAir, false);
|
||||
}
|
||||
|
||||
@ -339,7 +340,7 @@ public class CuboidClipboard {
|
||||
* @deprecated use {@link #getBlock(Vector)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public BaseBlock getPoint(Vector position) throws ArrayIndexOutOfBoundsException {
|
||||
public BaseBlock getPoint(BlockVector3 position) throws ArrayIndexOutOfBoundsException {
|
||||
final BaseBlock block = getBlock(position);
|
||||
if (block == null) {
|
||||
return new BaseBlock(BlockTypes.AIR);
|
||||
@ -355,7 +356,7 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @return the origin
|
||||
*/
|
||||
public Vector getOrigin() {
|
||||
public BlockVector3 getOrigin() {
|
||||
return clipboard.getMinimumPoint();
|
||||
}
|
||||
|
||||
@ -366,14 +367,14 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @param origin the origin to set
|
||||
*/
|
||||
public void setOrigin(Vector origin) {
|
||||
public void setOrigin(BlockVector3 origin) {
|
||||
checkNotNull(origin);
|
||||
setOriginAndOffset(getOffset(), origin);
|
||||
}
|
||||
|
||||
public void setOriginAndOffset(Vector offset, Vector min) {
|
||||
Vector origin = min.subtract(offset);
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(Vector.ONE));
|
||||
public void setOriginAndOffset(BlockVector3 offset, BlockVector3 min) {
|
||||
BlockVector3 origin = min.subtract(offset);
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(size).subtract(BlockVector3.ONE));
|
||||
clipboard.setRegion(region);
|
||||
clipboard.setOrigin(origin);
|
||||
}
|
||||
@ -386,10 +387,10 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @return the offset the offset
|
||||
*/
|
||||
public Vector getOffset() {
|
||||
Vector min = clipboard.getMinimumPoint();
|
||||
Vector origin = clipboard.getOrigin();
|
||||
Vector offset = min.subtract(origin);
|
||||
public BlockVector3 getOffset() {
|
||||
BlockVector3 min = clipboard.getMinimumPoint();
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
BlockVector3 offset = min.subtract(origin);
|
||||
return offset;
|
||||
}
|
||||
|
||||
@ -401,7 +402,7 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @param offset the new offset
|
||||
*/
|
||||
public void setOffset(Vector offset) {
|
||||
public void setOffset(BlockVector3 offset) {
|
||||
checkNotNull(offset);
|
||||
setOriginAndOffset(offset, getOrigin());
|
||||
}
|
||||
@ -411,7 +412,7 @@ public class CuboidClipboard {
|
||||
*
|
||||
* @return the dimensions, where (1, 1, 1) is 1 wide, 1 across, 1 deep
|
||||
*/
|
||||
public Vector getSize() {
|
||||
public BlockVector3 getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -448,7 +449,7 @@ public class CuboidClipboard {
|
||||
@Deprecated
|
||||
public static CuboidClipboard loadSchematic(File path) throws DataException, IOException {
|
||||
checkNotNull(path);
|
||||
return new CuboidClipboard((Vector) ClipboardFormat.SCHEMATIC.load(path).getClipboard());
|
||||
return new CuboidClipboard((BlockVector3) ClipboardFormat.SCHEMATIC.load(path).getClipboard());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,6 +72,7 @@ import com.sk89q.worldedit.function.block.Naturalizer;
|
||||
import com.sk89q.worldedit.function.generator.GardenPatchGenerator;
|
||||
import com.sk89q.worldedit.function.operation.ChangeSetExecutor;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
@ -1085,8 +1086,8 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
public boolean setBlock(int x, int y, int z, Pattern pattern) {
|
||||
this.changes++;
|
||||
try {
|
||||
mutablebv.setComponents(x, y, z);
|
||||
return pattern.apply(extent, mutablebv, mutablebv);
|
||||
BlockVector3 bv = mutablebv.setComponents(x, y, z).toBlockVector3();
|
||||
return pattern.apply(extent, bv, bv);
|
||||
} catch (WorldEditException e) {
|
||||
throw new RuntimeException("Unexpected exception", e);
|
||||
}
|
||||
@ -2225,10 +2226,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2259,10 +2260,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
|
||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2336,21 +2337,21 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
|
||||
if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold)
|
||||
setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||
setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
|
||||
if (Math.abs((-x) * nx + (y) * ny + (z) * nz) < threshold)
|
||||
setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
|
||||
setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
|
||||
if (Math.abs((x) * nx + (-y) * ny + (z) * nz) < threshold)
|
||||
setBlock(mutable.setComponents(px + x, py - y, pz + z), block);
|
||||
setBlock(mutable.setComponents(px + x, py - y, pz + z).toBlockVector3(), block);
|
||||
if (Math.abs((x) * nx + (y) * ny + (-z) * nz) < threshold)
|
||||
setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
|
||||
setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
|
||||
if (Math.abs((-x) * nx + (-y) * ny + (z) * nz) < threshold)
|
||||
setBlock(mutable.setComponents(px - x, py - y, pz + z), block);
|
||||
setBlock(mutable.setComponents(px - x, py - y, pz + z).toBlockVector3(), block);
|
||||
if (Math.abs((x) * nx + (-y) * ny + (-z) * nz) < threshold)
|
||||
setBlock(mutable.setComponents(px + x, py - y, pz - z), block);
|
||||
setBlock(mutable.setComponents(px + x, py - y, pz - z).toBlockVector3(), block);
|
||||
if (Math.abs((-x) * nx + (y) * ny + (-z) * nz) < threshold)
|
||||
setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
|
||||
setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
|
||||
if (Math.abs((-x) * nx + (-y) * ny + (-z) * nz) < threshold)
|
||||
setBlock(mutable.setComponents(px - x, py - y, pz - z), block);
|
||||
setBlock(mutable.setComponents(px - x, py - y, pz - z).toBlockVector3(), block);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2956,9 +2957,9 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
@Override
|
||||
public BlockStateHolder getMaterial(final int x, final int y, final int z, final BlockStateHolder defaultMaterial) {
|
||||
//TODO Optimize - avoid vector creation (math)
|
||||
final Vector3 current = mutablev.setComponents(x, y, z);
|
||||
// final Vector3 current = mutablev.setComponents(x, y, z);
|
||||
// protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) {
|
||||
// final Vector3 current = new Vector3(x, y, z);
|
||||
final Vector3 current = new Vector3(x, y, z);
|
||||
environment.setCurrentBlock(current);
|
||||
final Vector3 scaled = current.subtract(zero).divide(unit);
|
||||
|
||||
@ -3472,14 +3473,17 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
boolean containsAny = false;
|
||||
if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2 && conNextX && conNextZ) {
|
||||
containsAny = true;
|
||||
BlockVector3 mbv = mutable.toBlockVector3();
|
||||
if (fcs != null) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
int xx = x + bx;
|
||||
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));
|
||||
fcs.add(mutable, block, BlockTypes.AIR.getDefaultState());
|
||||
// BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
BlockVector3 bv = new BlockVector3(xx, y, zz);
|
||||
BlockStateHolder block = getFullBlock(bv);
|
||||
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3502,17 +3506,18 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
mutable.mutZ(zz);
|
||||
for (int y = 0; y < getMaxY() + 1; y++) {
|
||||
mutable.mutY(y);
|
||||
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mutable);
|
||||
BlockVector3 mbv = new BlockVector3(xx, y, zz);
|
||||
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mbv);
|
||||
if (contains) {
|
||||
containsAny = true;
|
||||
if (fcs != null) {
|
||||
BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
fcs.add(mutable, block, BlockTypes.AIR.getDefaultState());
|
||||
BlockStateHolder block = getFullBlock(mbv);
|
||||
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
} else {
|
||||
BlockStateHolder block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
BlockStateHolder block = getFullBlock(mbv);
|
||||
try {
|
||||
setBlock(mutable, block);
|
||||
setBlock(mbv, block);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -3602,5 +3607,4 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ public abstract class LocalConfiguration {
|
||||
public int butcherDefaultRadius = -1;
|
||||
public int butcherMaxRadius = -1;
|
||||
public boolean allowSymlinks = false;
|
||||
public boolean serverSideCUI = true;
|
||||
|
||||
/**
|
||||
* Load the configuration.
|
||||
|
@ -40,6 +40,8 @@ import com.sk89q.jchronic.Chronic;
|
||||
import com.sk89q.jchronic.Options;
|
||||
import com.sk89q.jchronic.utils.Span;
|
||||
import com.sk89q.jchronic.utils.Time;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
@ -140,6 +142,7 @@ public class LocalSession implements TextureHolder {
|
||||
// Saved properties
|
||||
private String lastScript;
|
||||
private RegionSelectorType defaultSelector;
|
||||
private boolean useServerCUI = false; // Save this to not annoy players.
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
|
@ -22,6 +22,8 @@ package com.sk89q.worldedit.blocks;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -208,4 +210,5 @@ public class BaseBlock extends BlockState {
|
||||
return getAsString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,12 +42,9 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.FlatRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -153,54 +150,32 @@ public class BiomeCommands extends MethodCommands {
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toVector2D());
|
||||
biomes[biome.getId()]++;
|
||||
size = 1;
|
||||
} else if (args.hasFlag('p')) {
|
||||
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toVector2D());
|
||||
biomes[biome.getId()]++;
|
||||
size = 1;
|
||||
=======
|
||||
BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at line of sight point";
|
||||
biomes[biome.getId()]++;
|
||||
size = 1;
|
||||
} else if (args.hasFlag('p')) {
|
||||
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at your position";
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
biomes[biome.getId()]++;
|
||||
size = 1;
|
||||
} else {
|
||||
World world = player.getWorld();
|
||||
Region region = session.getSelection(world);
|
||||
|
||||
if (region instanceof FlatRegion) {
|
||||
<<<<<<< HEAD
|
||||
for (Vector2D pt : new Fast2DIterator(((FlatRegion) region).asFlatRegion(), editSession)) {
|
||||
for (BlockVector2 pt : new Fast2DIterator(((FlatRegion) region).asFlatRegion(), editSession)) {
|
||||
biomes[editSession.getBiome(pt).getId()]++;
|
||||
size++;
|
||||
}
|
||||
} else {
|
||||
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
biomes[editSession.getBiome(position.toVector2D()).getId()]++;
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
biomes[editSession.getBiome(position.toBlockVector2()).getId()]++;
|
||||
return true;
|
||||
}
|
||||
}, editSession);
|
||||
Operations.completeBlindly(visitor);
|
||||
size += visitor.getAffected();
|
||||
=======
|
||||
for (BlockVector2 pt : ((FlatRegion) region).asFlatRegion()) {
|
||||
biomes.add(world.getBiome(pt));
|
||||
}
|
||||
} else {
|
||||
for (BlockVector3 pt : region) {
|
||||
biomes.add(world.getBiome(pt.toBlockVector2()));
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,13 +24,9 @@ import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -79,17 +75,10 @@ public class ChunkCommands {
|
||||
String filename = "c." + Integer.toString(chunkX, 36)
|
||||
+ "." + Integer.toString(chunkZ, 36) + ".dat";
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.print(BBC.getPrefix() + "Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print(BBC.getPrefix() + "Old format: " + folder1 + "/" + folder2 + "/" + filename);
|
||||
player.print(BBC.getPrefix() + "McRegion: region/" + McRegionChunkStore.getFilename(
|
||||
new Vector2D(chunkX, chunkZ)));
|
||||
=======
|
||||
player.print("Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print("Old format: " + folder1 + "/" + folder2 + "/" + filename);
|
||||
player.print("McRegion: region/" + McRegionChunkStore.getFilename(
|
||||
new BlockVector2(chunkX, chunkZ)));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -100,19 +89,11 @@ public class ChunkCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.listchunks")
|
||||
<<<<<<< HEAD
|
||||
public void listChunks(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Set<Vector2D> chunks = session.getSelection(player.getWorld()).getChunks();
|
||||
|
||||
for (Vector2D chunk : chunks) {
|
||||
player.print(BBC.getPrefix() + LegacyChunkStore.getFilename(chunk));
|
||||
=======
|
||||
public void listChunks(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
Set<BlockVector2> chunks = session.getSelection(player.getWorld()).getChunks();
|
||||
|
||||
for (BlockVector2 chunk : chunks) {
|
||||
player.print(LegacyChunkStore.getFilename(chunk));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
player.print(BBC.getPrefix() + LegacyChunkStore.getFilename(chunk));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
@ -41,7 +40,6 @@ import com.boydti.fawe.util.gui.FormBuilder;
|
||||
import com.boydti.fawe.wrappers.FakePlayer;
|
||||
import com.sk89q.minecraft.util.commands.*;
|
||||
import com.sk89q.worldedit.*;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
|
||||
@ -53,7 +51,6 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.extent.PasteEvent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
@ -127,15 +124,15 @@ public class ClipboardCommands extends MethodCommands {
|
||||
public void lazyCopy(Player player, LocalSession session, EditSession editSession,
|
||||
@Selection final Region region, @Switch('e') boolean skipEntities,
|
||||
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
}
|
||||
session.setClipboard(null);
|
||||
final Vector origin = region.getMinimumPoint();
|
||||
final BlockVector3 origin = region.getMinimumPoint();
|
||||
final int mx = origin.getBlockX();
|
||||
final int my = origin.getBlockY();
|
||||
final int mz = origin.getBlockZ();
|
||||
@ -167,14 +164,14 @@ public class ClipboardCommands extends MethodCommands {
|
||||
public void copy(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region, @Switch('e') boolean skipEntities,
|
||||
@Switch('m') Mask mask, CommandContext context, @Switch('b') boolean copyBiomes) throws WorldEditException {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
}
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
session.setClipboard(null);
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
||||
@ -217,8 +214,8 @@ public class ClipboardCommands extends MethodCommands {
|
||||
public void lazyCut(Player player, LocalSession session, EditSession editSession,
|
||||
@Selection final Region region, @Switch('e') boolean skipEntities,
|
||||
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
@ -228,7 +225,7 @@ public class ClipboardCommands extends MethodCommands {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
|
||||
}
|
||||
session.setClipboard(null);
|
||||
final Vector origin = region.getMinimumPoint();
|
||||
final BlockVector3 origin = region.getMinimumPoint();
|
||||
final int mx = origin.getBlockX();
|
||||
final int my = origin.getBlockY();
|
||||
final int mz = origin.getBlockZ();
|
||||
@ -258,8 +255,8 @@ public class ClipboardCommands extends MethodCommands {
|
||||
public void cut(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean skipEntities,
|
||||
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes, CommandContext context) throws WorldEditException {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
@ -268,7 +265,7 @@ public class ClipboardCommands extends MethodCommands {
|
||||
if (volume >= limit.MAX_CHANGES) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
|
||||
}
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
session.setClipboard(null);
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
||||
@ -481,14 +478,8 @@ public class ClipboardCommands extends MethodCommands {
|
||||
}
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Region region = clipboard.getRegion();
|
||||
<<<<<<< HEAD
|
||||
Vector to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
||||
checkPaste(player, editSession, to, holder, clipboard);
|
||||
|
||||
=======
|
||||
|
||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
Operation operation = holder
|
||||
.createPaste(editSession)
|
||||
.to(to)
|
||||
@ -499,27 +490,20 @@ public class ClipboardCommands extends MethodCommands {
|
||||
Operations.completeLegacy(operation);
|
||||
|
||||
if (selectPasted) {
|
||||
<<<<<<< HEAD
|
||||
Vector clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
Vector realTo = to.add(new Vector(holder.getTransform().apply(clipboardOffset)));
|
||||
Vector max = realTo.add(new Vector(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()))));
|
||||
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max);
|
||||
=======
|
||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
||||
Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
||||
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo.toBlockPoint(), max.toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
session.setRegionSelector(player.getWorld(), selector);
|
||||
selector.learnChanges();
|
||||
selector.explainRegionAdjust(player, session);
|
||||
}
|
||||
BBC.COMMAND_PASTE.send(player, to.toBlockVector());
|
||||
BBC.COMMAND_PASTE.send(player, to);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips"))
|
||||
BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(player, to);
|
||||
}
|
||||
|
||||
private void checkPaste(Player player, EditSession editSession, Vector to, ClipboardHolder holder, Clipboard clipboard) {
|
||||
private void checkPaste(Player player, EditSession editSession, BlockVector3 to, ClipboardHolder holder, Clipboard clipboard) {
|
||||
URI uri = null;
|
||||
if (holder instanceof URIClipboardHolder) uri = ((URIClipboardHolder) holder).getURI(clipboard);
|
||||
PasteEvent event = new PasteEvent(player, clipboard, uri, editSession, to);
|
||||
@ -550,8 +534,8 @@ public class ClipboardCommands extends MethodCommands {
|
||||
@Switch('s') boolean selectPasted) throws WorldEditException {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
final Clipboard clipboard = holder.getClipboard();
|
||||
final Vector origin = clipboard.getOrigin();
|
||||
final Vector to = atOrigin ? origin : session.getPlacementPosition(player);
|
||||
final BlockVector3 origin = clipboard.getOrigin();
|
||||
final BlockVector3 to = atOrigin ? origin : session.getPlacementPosition(player);
|
||||
checkPaste(player, editSession, to, holder, clipboard);
|
||||
|
||||
Schematic schem = new Schematic(clipboard);
|
||||
@ -559,9 +543,9 @@ public class ClipboardCommands extends MethodCommands {
|
||||
|
||||
Region region = clipboard.getRegion().clone();
|
||||
if (selectPasted) {
|
||||
Vector clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
Vector realTo = to.add(new Vector(holder.getTransform().apply(clipboardOffset)));
|
||||
Vector max = realTo.add(new Vector(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()))));
|
||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
BlockVector3 realTo = to.add(holder.getTransform().apply(clipboardOffset.toVector3()).toBlockPoint());
|
||||
BlockVector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()).toBlockPoint());
|
||||
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max);
|
||||
session.setRegionSelector(player.getWorld(), selector);
|
||||
selector.learnChanges();
|
||||
@ -605,24 +589,13 @@ public class ClipboardCommands extends MethodCommands {
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.flip")
|
||||
<<<<<<< HEAD
|
||||
public void flip(Player player, LocalSession session,
|
||||
@Optional(Direction.AIM) @Direction Vector direction) throws WorldEditException {
|
||||
=======
|
||||
public void flip(Player player, LocalSession session, EditSession editSession,
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction) throws WorldEditException {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
AffineTransform transform = new AffineTransform();
|
||||
<<<<<<< HEAD
|
||||
transform = transform.scale(direction.positive().multiply(-2).add(1, 1, 1));
|
||||
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
|
||||
holder.setTransform(transform.combine(holder.getTransform()));
|
||||
BBC.COMMAND_FLIPPED.send(player);
|
||||
=======
|
||||
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
|
||||
holder.setTransform(holder.getTransform().combine(transform));
|
||||
player.print("The clipboard copy has been flipped.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Deprecated // See SchematicCommands#clear
|
||||
|
@ -19,17 +19,15 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.CombinedTransform;
|
||||
@ -82,19 +80,6 @@ public class FlattenedClipboardTransform {
|
||||
transform,
|
||||
new AffineTransform().translate(original.getOrigin()));
|
||||
|
||||
<<<<<<< HEAD
|
||||
// new Vector(minimum.getX(), minimum.getY(), minimum.getZ())
|
||||
// new Vector(maximum.getX(), maximum.getY(), maximum.getZ())
|
||||
Vector[] corners = new Vector[]{
|
||||
minimum,
|
||||
maximum,
|
||||
new Vector(maximum.getX(), minimum.getY(), minimum.getZ()),
|
||||
new Vector(minimum.getX(), maximum.getY(), minimum.getZ()),
|
||||
new Vector(minimum.getX(), minimum.getY(), maximum.getZ()),
|
||||
new Vector(minimum.getX(), maximum.getY(), maximum.getZ()),
|
||||
new Vector(maximum.getX(), minimum.getY(), maximum.getZ()),
|
||||
new Vector(maximum.getX(), maximum.getY(), minimum.getZ())};
|
||||
=======
|
||||
Vector3[] corners = new Vector3[] {
|
||||
minimum,
|
||||
maximum,
|
||||
@ -104,34 +89,27 @@ public class FlattenedClipboardTransform {
|
||||
maximum.withX(minimum.getX()),
|
||||
maximum.withY(minimum.getY()),
|
||||
maximum.withZ(minimum.getZ()) };
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
for (int i = 0; i < corners.length; i++) {
|
||||
corners[i] = transformAround.apply(new Vector(corners[i]));
|
||||
corners[i] = transformAround.apply(new Vector3(corners[i]));
|
||||
}
|
||||
|
||||
Vector3 newMinimum = corners[0];
|
||||
Vector3 newMaximum = corners[0];
|
||||
|
||||
MutableVector newMinimum = new MutableVector(corners[0]);
|
||||
MutableVector newMaximum = new MutableVector(corners[0]);
|
||||
// MutableVector cbv = new MutableVector();
|
||||
for (int i = 1; i < corners.length; i++) {
|
||||
newMinimum = newMinimum.getMinimum(corners[i]);
|
||||
newMaximum = newMaximum.getMaximum(corners[i]);
|
||||
MutableVector cbv = new MutableVector(corners[i]);
|
||||
newMinimum = newMinimum.setComponents(newMinimum.getMinimum(cbv));
|
||||
newMaximum = newMaximum.setComponents(newMaximum.getMaximum(cbv));
|
||||
}
|
||||
|
||||
// After transformation, the points may not really sit on a block,
|
||||
// so we should expand the region for edge cases
|
||||
<<<<<<< HEAD
|
||||
newMinimum.mutX(Math.ceil(Math.floor(newMinimum.getX())));
|
||||
newMinimum.mutY(Math.ceil(Math.floor(newMinimum.getY())));
|
||||
newMinimum.mutZ(Math.ceil(Math.floor(newMinimum.getZ())));
|
||||
|
||||
return new CuboidRegion(newMinimum, newMaximum);
|
||||
=======
|
||||
newMinimum = newMinimum.floor();
|
||||
newMaximum = newMaximum.ceil();
|
||||
|
||||
return new CuboidRegion(newMinimum.toBlockPoint(), newMaximum.toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return new CuboidRegion(new BlockVector3(newMinimum.getX(), newMinimum.getY(), newMinimum.getZ()), new BlockVector3(newMaximum.getX(), newMaximum.getY(), newMaximum.getZ()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,16 +31,13 @@ import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -49,12 +46,11 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
@ -134,7 +130,7 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.image")
|
||||
@Logging(PLACEMENT)
|
||||
public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, @Optional("100") int threshold, @Optional Vector2D dimensions) throws WorldEditException, ParameterException, IOException {
|
||||
public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, @Optional("100") int threshold, @Optional BlockVector2 dimensions) throws WorldEditException, ParameterException, IOException {
|
||||
TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold);
|
||||
URL url = new URL(arg);
|
||||
if (!url.getHost().equalsIgnoreCase("i.imgur.com") && !url.getHost().equalsIgnoreCase("empcraft.com")) {
|
||||
@ -146,14 +142,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
image = ImageUtil.getScaledInstance(image, dimensions.getBlockX(), dimensions.getBlockZ(), RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
|
||||
}
|
||||
|
||||
MutableBlockVector pos1 = new MutableBlockVector(player.getLocation().toVector());
|
||||
MutableBlockVector pos2 = new MutableBlockVector(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1));
|
||||
// MutableBlockVector pos1 = new MutableBlockVector(player.getLocation().toVector().toBlockPoint());
|
||||
// MutableBlockVector pos2 = new MutableBlockVector(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1));
|
||||
BlockVector3 pos1 = player.getLocation().toVector().toBlockPoint();
|
||||
BlockVector3 pos2 = pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1);
|
||||
CuboidRegion region = new CuboidRegion(pos1, pos2);
|
||||
int[] count = new int[1];
|
||||
final BufferedImage finalImage = image;
|
||||
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector pos) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 pos) throws WorldEditException {
|
||||
try {
|
||||
int x = pos.getBlockX() - pos1.getBlockX();
|
||||
int z = pos.getBlockZ() - pos1.getBlockZ();
|
||||
@ -203,17 +201,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.cylinder")
|
||||
@Logging(PLACEMENT)
|
||||
public void hcyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector2D radius, @Optional("1") int height, @Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException, ParameterException {
|
||||
public void hcyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException, ParameterException {
|
||||
double max = MathMan.max(radius.getBlockX(), radius.getBlockZ());
|
||||
worldEdit.checkMaxRadius(max);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makeHollowCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), thickness - 1);
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, getArguments(context), (int) max, context);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Command(
|
||||
aliases = {"/cyl"},
|
||||
usage = "<pattern> <radius>[,<radius>] [height]",
|
||||
@ -229,19 +226,14 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.cylinder")
|
||||
@Logging(PLACEMENT)
|
||||
public void cyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector2D radius, @Optional("1") int height, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
|
||||
public void cyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
|
||||
double max = MathMan.max(radius.getBlockX(), radius.getBlockZ());
|
||||
worldEdit.checkMaxRadius(max);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makeCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), !hollow);
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, getArguments(context), (int) max, context);
|
||||
=======
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow);
|
||||
player.print(affected + " block(s) have been created.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -258,7 +250,7 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.sphere")
|
||||
@Logging(PLACEMENT)
|
||||
public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException, ParameterException {
|
||||
public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException, ParameterException {
|
||||
sphere(fp, player, session, editSession, pattern, radius, raised, true, context);
|
||||
}
|
||||
|
||||
@ -277,50 +269,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.sphere")
|
||||
@Logging(PLACEMENT)
|
||||
<<<<<<< HEAD
|
||||
public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector radius, @Optional("false") boolean raised, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
|
||||
public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
|
||||
double max = MathMan.max(radius.getBlockX(), radius.getBlockY(), radius.getBlockZ());
|
||||
worldEdit.checkMaxRadius(max);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
Vector finalPos = raised ? pos.add(0, radius.getY(), 0) : pos;
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
BlockVector3 finalPos = raised ? pos.add(0, radius.getY(), 0) : pos;
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makeSphere(finalPos, pattern, radius.getX(), radius.getY(), radius.getZ(), !hollow);
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, getArguments(context), (int) max, context);
|
||||
=======
|
||||
public void sphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised, @Switch('h') boolean hollow) throws WorldEditException {
|
||||
String[] radii = radiusString.split(",");
|
||||
final double radiusX, radiusY, radiusZ;
|
||||
switch (radii.length) {
|
||||
case 1:
|
||||
radiusX = radiusY = radiusZ = Math.max(1, Double.parseDouble(radii[0]));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
radiusX = Math.max(1, Double.parseDouble(radii[0]));
|
||||
radiusY = Math.max(1, Double.parseDouble(radii[1]));
|
||||
radiusZ = Math.max(1, Double.parseDouble(radii[2]));
|
||||
break;
|
||||
|
||||
default:
|
||||
player.printError("You must either specify 1 or 3 radius values.");
|
||||
return;
|
||||
}
|
||||
|
||||
worldEdit.checkMaxRadius(radiusX);
|
||||
worldEdit.checkMaxRadius(radiusY);
|
||||
worldEdit.checkMaxRadius(radiusZ);
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
if (raised) {
|
||||
pos = pos.add(0, (int) radiusY, 0);
|
||||
}
|
||||
|
||||
int affected = editSession.makeSphere(pos, pattern, radiusX, radiusY, radiusZ, !hollow);
|
||||
player.findFreePosition();
|
||||
player.print(affected + " block(s) have been created.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -376,20 +334,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.pyramid")
|
||||
@Logging(PLACEMENT)
|
||||
<<<<<<< HEAD
|
||||
public void pyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
|
||||
=======
|
||||
public void pyramid(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow) throws WorldEditException {
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
worldEdit.checkMaxRadius(size);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makePyramid(pos, pattern, size, !hollow);
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
}, getArguments(context), size, context);
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
aliases = {"/generate", "/gen", "/g"},
|
||||
@ -419,17 +373,10 @@ public class GenerationCommands extends MethodCommands {
|
||||
@Switch('h') boolean hollow,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
@Switch('o') boolean offset,
|
||||
<<<<<<< HEAD
|
||||
@Switch('c') boolean offsetCenter,
|
||||
CommandContext context) throws WorldEditException, ParameterException {
|
||||
final Vector zero;
|
||||
Vector unit;
|
||||
=======
|
||||
@Switch('c') boolean offsetCenter) throws WorldEditException {
|
||||
@Switch('c') boolean offsetCenter, CommandContext context) throws WorldEditException {
|
||||
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (useRawCoords) {
|
||||
zero = Vector3.ZERO;
|
||||
@ -450,20 +397,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
zero = max.add(min).multiply(0.5);
|
||||
unit = max.subtract(zero);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (unit.getX() == 0) unit.mutX(1);
|
||||
if (unit.getY() == 0) unit.mutY(1);
|
||||
if (unit.getZ() == 0) unit.mutZ(1);
|
||||
=======
|
||||
if (unit.getX() == 0) unit = unit.withX(1.0);
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
try {
|
||||
final int affected = editSession.makeShape(region, zero, unit, pattern, expression, hollow);
|
||||
final int affected = editSession.makeShape(region, zero, unit1, pattern, expression, hollow);
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
} catch (ExpressionException e) {
|
||||
@ -500,16 +443,9 @@ public class GenerationCommands extends MethodCommands {
|
||||
@Switch('h') boolean hollow,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
@Switch('o') boolean offset,
|
||||
<<<<<<< HEAD
|
||||
@Switch('c') boolean offsetCenter,
|
||||
CommandContext context) throws WorldEditException, ParameterException {
|
||||
final Vector zero;
|
||||
Vector unit;
|
||||
=======
|
||||
@Switch('c') boolean offsetCenter) throws WorldEditException {
|
||||
@Switch('c') boolean offsetCenter, CommandContext context) throws WorldEditException {
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (useRawCoords) {
|
||||
zero = Vector3.ZERO;
|
||||
@ -530,27 +466,16 @@ public class GenerationCommands extends MethodCommands {
|
||||
zero = max.add(min).multiply(0.5);
|
||||
unit = max.subtract(zero);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (unit.getX() == 0) unit.mutX(1);
|
||||
if (unit.getY() == 0) unit.mutY(1);
|
||||
if (unit.getZ() == 0) unit.mutZ(1);
|
||||
=======
|
||||
if (unit.getX() == 0) unit = unit.withX(1.0);
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
}
|
||||
|
||||
try {
|
||||
final int affected = editSession.makeBiomeShape(region, zero, unit, target, expression, hollow);
|
||||
player.findFreePosition();
|
||||
player.print("" + affected + " columns affected.");
|
||||
} catch (ExpressionException e) {
|
||||
player.printError(e.getMessage());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
try {
|
||||
final int affected = editSession.makeBiomeShape(region, zero, unit, target, expression, hollow);
|
||||
final int affected = editSession.makeBiomeShape(region, zero, unit1, target, expression, hollow);
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_FLAT.send(fp, affected);
|
||||
} catch (ExpressionException e) {
|
||||
|
@ -39,6 +39,8 @@ import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.command.binding.Range;
|
||||
@ -112,7 +114,7 @@ public class HistoryCommands extends MethodCommands {
|
||||
RollbackOptimizedHistory rollback = new RollbackOptimizedHistory(world, uuid, Integer.parseInt(name.substring(0, name.length() - 3)));
|
||||
DiskStorageHistory.DiskStorageSummary summary = rollback.summarize(RegionWrapper.GLOBAL(), false);
|
||||
if (summary != null) {
|
||||
rollback.setDimensions(new Vector(summary.minX, 0, summary.minZ), new Vector(summary.maxX, 255, summary.maxZ));
|
||||
rollback.setDimensions(new BlockVector3(summary.minX, 0, summary.minZ), new BlockVector3(summary.maxX, 255, summary.maxZ));
|
||||
rollback.setTime(historyFile.lastModified());
|
||||
RollbackDatabase db = DBHandler.IMP.getDatabase(world);
|
||||
db.logEdit(rollback);
|
||||
@ -165,10 +167,12 @@ public class HistoryCommands extends MethodCommands {
|
||||
radius = Math.max(Math.min(500, radius), 0);
|
||||
final World world = player.getWorld();
|
||||
Location origin = player.getLocation();
|
||||
Vector bot = origin.toVector().subtract(radius, radius, radius);
|
||||
bot.mutY(Math.max(0, bot.getY()));
|
||||
Vector top = origin.toVector().add(radius, radius, radius);
|
||||
top.mutY(Math.min(255, top.getY()));
|
||||
BlockVector3 bot = origin.toVector().toBlockPoint().subtract(radius, radius, radius);
|
||||
bot = bot.withY(Math.max(0, bot.getY()));
|
||||
// bot.mutY(Math.max(0, bot.getY()));
|
||||
BlockVector3 top = origin.toVector().toBlockPoint().add(radius, radius, radius);
|
||||
bot = bot.withY(Math.min(255, top.getY()));
|
||||
// top.mutY(Math.min(255, top.getY()));
|
||||
RollbackDatabase database = DBHandler.IMP.getDatabase(world);
|
||||
final AtomicInteger count = new AtomicInteger();
|
||||
final FawePlayer fp = FawePlayer.wrap(player);
|
||||
|
@ -4,7 +4,6 @@ import com.boydti.fawe.object.mask.*;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -13,6 +12,8 @@ import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.*;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
import com.sk89q.worldedit.session.request.RequestSelection;
|
||||
import com.sk89q.worldedit.util.command.binding.Switch;
|
||||
@ -129,7 +130,7 @@ public class MaskCommands extends MethodCommands {
|
||||
max = 4
|
||||
)
|
||||
public Mask offset(double x, double y, double z, Mask mask) {
|
||||
return new OffsetMask(mask, new Vector(x, y, z));
|
||||
return new OffsetMask(mask, new BlockVector3(x, y, z));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -389,7 +390,7 @@ public class MaskCommands extends MethodCommands {
|
||||
max = 1
|
||||
)
|
||||
public Mask below(Mask mask) throws ExpressionException {
|
||||
OffsetMask offsetMask = new OffsetMask(mask, new Vector(0, 1, 0));
|
||||
OffsetMask offsetMask = new OffsetMask(mask, new BlockVector3(0, 1, 0));
|
||||
return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
}
|
||||
|
||||
@ -401,7 +402,7 @@ public class MaskCommands extends MethodCommands {
|
||||
max = 1
|
||||
)
|
||||
public Mask above(Mask mask) throws ExpressionException {
|
||||
OffsetMask offsetMask = new OffsetMask(mask, new Vector(0, -1, 0));
|
||||
OffsetMask offsetMask = new OffsetMask(mask, new BlockVector3(0, -1, 0));
|
||||
return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
}
|
||||
|
||||
@ -438,7 +439,7 @@ public class MaskCommands extends MethodCommands {
|
||||
)
|
||||
public Mask expression(Extent extent, String input) throws ExpressionException {
|
||||
Expression exp = Expression.compile(input, "x", "y", "z");
|
||||
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector.ONE, Vector.ZERO);
|
||||
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
|
||||
exp.setEnvironment(env);
|
||||
return new ExpressionMask(exp);
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class NavigationCommands {
|
||||
pos = player.getSolidBlockTrace(300);
|
||||
}
|
||||
if (pos != null) {
|
||||
if(args.hasFlag('f')) player.setPosition(pos); else player.findFreePosition(pos);
|
||||
if(args.hasFlag('f')) player.setPosition(pos.toVector()); else player.findFreePosition(pos);
|
||||
BBC.POOF.send(player);
|
||||
} else {
|
||||
BBC.NO_BLOCK.send(player);
|
||||
|
@ -22,6 +22,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.command.binding.Range;
|
||||
@ -426,7 +427,7 @@ public class PatternCommands extends MethodCommands {
|
||||
)
|
||||
public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException {
|
||||
Expression exp = Expression.compile(input, "x", "y", "z");
|
||||
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector.ONE, Vector.ZERO);
|
||||
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
|
||||
exp.setEnvironment(env);
|
||||
return new ExpressionPattern(exp);
|
||||
}
|
||||
|
@ -34,16 +34,13 @@ import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.minecraft.util.commands.Logging;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.function.GroundFunction;
|
||||
@ -58,6 +55,7 @@ import com.sk89q.worldedit.function.visitor.LayerVisitor;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.convolution.GaussianKernel;
|
||||
@ -122,7 +120,7 @@ public class RegionCommands extends MethodCommands {
|
||||
if (selection == null) {
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
selection = new CuboidRegion(new Vector(cx - 8, 0, cz - 8).multiply(16), new Vector(cx + 8, 0, cz + 8).multiply(16));
|
||||
selection = new CuboidRegion(new BlockVector3(cx - 8, 0, cz - 8).multiply(16), new BlockVector3(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.ALL);
|
||||
BBC.LIGHTING_PROPOGATE_SELECTION.send(fp, count);
|
||||
@ -156,7 +154,7 @@ public class RegionCommands extends MethodCommands {
|
||||
if (selection == null) {
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
selection = new CuboidRegion(new Vector(cx - 8, 0, cz - 8).multiply(16), new Vector(cx + 8, 0, cz + 8).multiply(16));
|
||||
selection = new CuboidRegion(new BlockVector3(cx - 8, 0, cz - 8).multiply(16), new BlockVector3(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(loc.world, selection, FaweQueue.RelightMode.NONE);
|
||||
BBC.UPDATED_LIGHTING_SELECTION.send(fp, count);
|
||||
@ -173,7 +171,7 @@ public class RegionCommands extends MethodCommands {
|
||||
BBC.NO_BLOCK.send(player);
|
||||
return;
|
||||
}
|
||||
CompoundTag nbt = editSession.getBlock(pos.toVector()).getNbtData();
|
||||
CompoundTag nbt = editSession.getBlock(pos.toVector().toBlockPoint()).getNbtData();
|
||||
if (nbt != null) {
|
||||
player.print(nbt.getValue().toString());
|
||||
} else {
|
||||
@ -194,11 +192,11 @@ public class RegionCommands extends MethodCommands {
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false);
|
||||
for (Vector pt : region) {
|
||||
for (BlockVector3 pt : region) {
|
||||
queue.setBlockLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value);
|
||||
}
|
||||
int count = 0;
|
||||
for (Vector2D chunk : region.getChunks()) {
|
||||
for (BlockVector2 chunk : region.getChunks()) {
|
||||
queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ()));
|
||||
count++;
|
||||
}
|
||||
@ -218,11 +216,11 @@ public class RegionCommands extends MethodCommands {
|
||||
final int cx = loc.x >> 4;
|
||||
final int cz = loc.z >> 4;
|
||||
final NMSMappedFaweQueue queue = (NMSMappedFaweQueue) fp.getFaweQueue(false);
|
||||
for (Vector pt : region) {
|
||||
for (BlockVector3 pt : region) {
|
||||
queue.setSkyLight((int) pt.getX(), (int) pt.getY(), (int) pt.getZ(), value);
|
||||
}
|
||||
int count = 0;
|
||||
for (Vector2D chunk : region.getChunks()) {
|
||||
for (BlockVector2 chunk : region.getChunks()) {
|
||||
queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ()));
|
||||
count++;
|
||||
}
|
||||
@ -290,14 +288,9 @@ public class RegionCommands extends MethodCommands {
|
||||
}
|
||||
worldEdit.checkMaxRadius(thickness);
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.checkConfirmationRegion(() -> {
|
||||
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
|
||||
List<Vector> vectors = new ArrayList<Vector>(cpregion.getVertices());
|
||||
=======
|
||||
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
|
||||
List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
|
||||
|
||||
@ -378,20 +371,19 @@ public class RegionCommands extends MethodCommands {
|
||||
@Logging(REGION)
|
||||
public void lay(FawePlayer player, EditSession editSession, @Selection Region region, Pattern pattern, CommandContext context) throws WorldEditException {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
int maxY = max.getBlockY();
|
||||
int width = region.getWidth();
|
||||
int height = region.getLength();
|
||||
int bx = min.getBlockX();
|
||||
int bz = min.getBlockZ();
|
||||
Iterable<Vector2D> flat = Regions.asFlatRegion(region).asFlatRegion();
|
||||
Iterator<Vector2D> iter = new Fast2DIterator(flat, editSession).iterator();
|
||||
Iterable<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion();
|
||||
Iterator<BlockVector2> iter = new Fast2DIterator(flat, editSession).iterator();
|
||||
int y = 0;
|
||||
int affected = 0;
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
while (iter.hasNext()) {
|
||||
Vector2D pos = iter.next();
|
||||
BlockVector2 pos = iter.next();
|
||||
int x = pos.getBlockX();
|
||||
int z = pos.getBlockZ();
|
||||
y = editSession.getNearestSurfaceTerrainBlock(x, z, y, 0, maxY);
|
||||
@ -479,8 +471,8 @@ public class RegionCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.region.smoothsnow")
|
||||
@Logging(REGION)
|
||||
public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Switch('n') boolean affectNatural, @Switch('s') boolean snow, CommandContext context) throws WorldEditException {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
@ -551,8 +543,7 @@ public class RegionCommands extends MethodCommands {
|
||||
public void move(FawePlayer player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Optional("1") @Range(min = 1) int count,
|
||||
<<<<<<< HEAD
|
||||
@Optional(Direction.AIM) @Direction Vector direction,
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction,
|
||||
@Optional("air") Pattern replace,
|
||||
@Switch('b') boolean copyBiomes,
|
||||
@Switch('e') boolean skipEntities,
|
||||
@ -571,22 +562,6 @@ public class RegionCommands extends MethodCommands {
|
||||
} catch (RegionOperationException e) {
|
||||
player.sendMessage(BBC.getPrefix() + e.getMessage());
|
||||
}
|
||||
=======
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction,
|
||||
@Optional("air") BlockStateHolder replace,
|
||||
@Switch('s') boolean moveSelection) throws WorldEditException {
|
||||
|
||||
int affected = editSession.moveRegion(region, direction, count, true, replace);
|
||||
|
||||
if (moveSelection) {
|
||||
try {
|
||||
region.shift(direction.multiply(count));
|
||||
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
} catch (RegionOperationException e) {
|
||||
player.printError(e.getMessage());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
@ -637,7 +612,6 @@ public class RegionCommands extends MethodCommands {
|
||||
@Optional("1") @Range(min = 1) int count,
|
||||
@Optional(Direction.AIM) @Direction BlockVector3 direction,
|
||||
@Switch('s') boolean moveSelection,
|
||||
<<<<<<< HEAD
|
||||
@Switch('b') boolean copyBiomes,
|
||||
@Switch('e') boolean skipEntities,
|
||||
@Switch('a') boolean ignoreAirBlocks, @Switch('m') Mask sourceMask, CommandContext context) throws WorldEditException {
|
||||
@ -649,8 +623,8 @@ public class RegionCommands extends MethodCommands {
|
||||
|
||||
if (moveSelection) {
|
||||
try {
|
||||
final Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
||||
Vector shiftVector = new Vector(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
|
||||
final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
||||
BlockVector3 shiftVector = new BlockVector3(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
|
||||
region.shift(shiftVector);
|
||||
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
@ -658,22 +632,6 @@ public class RegionCommands extends MethodCommands {
|
||||
} catch (RegionOperationException e) {
|
||||
player.sendMessage(BBC.getPrefix() + e.getMessage());
|
||||
}
|
||||
=======
|
||||
@Switch('a') boolean ignoreAirBlocks) throws WorldEditException {
|
||||
int affected = editSession.stackCuboidRegion(region, direction, count, !ignoreAirBlocks);
|
||||
|
||||
if (moveSelection) {
|
||||
try {
|
||||
final BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
|
||||
|
||||
final BlockVector3 shiftVector = direction.toVector3().multiply(count * (Math.abs(direction.dot(size)) + 1)).toBlockPoint();
|
||||
region.shift(shiftVector);
|
||||
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
} catch (RegionOperationException e) {
|
||||
player.printError(e.getMessage());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
@ -699,17 +657,10 @@ public class RegionCommands extends MethodCommands {
|
||||
@Selection Region region,
|
||||
@Text String expression,
|
||||
@Switch('r') boolean useRawCoords,
|
||||
<<<<<<< HEAD
|
||||
@Switch('o') boolean offset,
|
||||
CommandContext context) throws WorldEditException {
|
||||
final Vector zero;
|
||||
Vector unit;
|
||||
=======
|
||||
@Switch('o') boolean offset) throws WorldEditException {
|
||||
final Vector3 zero;
|
||||
Vector3 unit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (useRawCoords) {
|
||||
zero = Vector3.ZERO;
|
||||
unit = Vector3.ONE;
|
||||
@ -723,19 +674,15 @@ public class RegionCommands extends MethodCommands {
|
||||
zero = max.add(min).divide(2);
|
||||
unit = max.subtract(zero);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (unit.getX() == 0) unit.mutX(1);
|
||||
if (unit.getY() == 0) unit.mutY(1);
|
||||
if (unit.getZ() == 0) unit.mutZ(1);
|
||||
=======
|
||||
if (unit.getX() == 0) unit = unit.withX(1.0);
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
try {
|
||||
final int affected = editSession.deformRegion(region, zero, unit, expression);
|
||||
final int affected = editSession.deformRegion(region, zero, unit1, expression);
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
} catch (ExpressionException e) {
|
||||
|
@ -43,12 +43,10 @@ import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
@ -69,10 +67,7 @@ import com.sk89q.worldedit.util.formatting.StyledFragment;
|
||||
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||
import java.io.File;
|
||||
@ -109,21 +104,20 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(POSITION)
|
||||
@CommandPermissions("worldedit.selection.pos")
|
||||
public void pos1(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Vector pos;
|
||||
public void pos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
BlockVector3 pos;
|
||||
|
||||
if (args.argsLength() == 1) {
|
||||
if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) {
|
||||
String[] coords = args.getString(0).split(",");
|
||||
pos = new Vector(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2]));
|
||||
pos = new BlockVector3(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2]));
|
||||
} else {
|
||||
BBC.SELECTOR_INVALID_COORDINATES.send(player, args.getString(0));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
pos = player.getBlockIn().toVector();
|
||||
pos = player.getBlockIn().toVector().toBlockPoint();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
|
||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
||||
@ -131,16 +125,6 @@ public class SelectionCommands {
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld()).explainPrimarySelection(player, session, pos);
|
||||
=======
|
||||
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError("Position already set.");
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
.explainPrimarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -152,12 +136,12 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(POSITION)
|
||||
@CommandPermissions("worldedit.selection.pos")
|
||||
public void pos2(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Vector pos;
|
||||
public void pos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
BlockVector3 pos;
|
||||
if (args.argsLength() == 1) {
|
||||
if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) {
|
||||
String[] coords = args.getString(0).split(",");
|
||||
pos = new Vector(Integer.parseInt(coords[0]),
|
||||
pos = new BlockVector3(Integer.parseInt(coords[0]),
|
||||
Integer.parseInt(coords[1]),
|
||||
Integer.parseInt(coords[2]));
|
||||
} else {
|
||||
@ -165,26 +149,16 @@ public class SelectionCommands {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
pos = player.getBlockIn().toVector();
|
||||
pos = player.getBlockIn().toVector().toBlockPoint();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
|
||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
||||
=======
|
||||
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError("Position already set.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
<<<<<<< HEAD
|
||||
.explainSecondarySelection(player, session, pos);
|
||||
=======
|
||||
.explainSecondarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -195,26 +169,17 @@ public class SelectionCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.selection.hpos")
|
||||
public void hpos1(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Vector pos = player.getBlockTrace(300).toVector();
|
||||
public void hpos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
|
||||
|
||||
if (pos != null) {
|
||||
<<<<<<< HEAD
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
|
||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
||||
=======
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError("Position already set.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
<<<<<<< HEAD
|
||||
.explainPrimarySelection(player, session, pos);
|
||||
=======
|
||||
.explainPrimarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
} else {
|
||||
player.printError("No block in sight!");
|
||||
}
|
||||
@ -228,26 +193,17 @@ public class SelectionCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.selection.hpos")
|
||||
public void hpos2(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
Vector pos = player.getBlockTrace(300).toVector();
|
||||
public void hpos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
|
||||
|
||||
if (pos != null) {
|
||||
<<<<<<< HEAD
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
|
||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
||||
=======
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError("Position already set.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
<<<<<<< HEAD
|
||||
.explainSecondarySelection(player, session, pos);
|
||||
=======
|
||||
.explainSecondarySelection(player, session, pos.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
} else {
|
||||
player.printError("No block in sight!");
|
||||
}
|
||||
@ -271,15 +227,9 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(POSITION)
|
||||
@CommandPermissions("worldedit.selection.chunk")
|
||||
<<<<<<< HEAD
|
||||
public void chunk(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
final Vector min;
|
||||
final Vector max;
|
||||
=======
|
||||
public void chunk(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
final BlockVector3 min;
|
||||
final BlockVector3 max;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
final World world = player.getWorld();
|
||||
if (args.hasFlag('s')) {
|
||||
Region region = session.getSelection(world);
|
||||
@ -336,7 +286,7 @@ public class SelectionCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.wand")
|
||||
public void wand(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
public void wand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
player.giveItem(new BaseItemStack(we.getConfiguration().wandItem, 1));
|
||||
BBC.SELECTION_WAND.send(player);
|
||||
if (!FawePlayer.wrap(player).hasPermission("fawe.tips"))
|
||||
@ -370,7 +320,7 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.selection.expand")
|
||||
public void expand(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
public void expand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
// Special syntax (//expand vert) to expand the selection between
|
||||
// sky and bedrock.
|
||||
if (args.getString(0).equalsIgnoreCase("vert") || args.getString(0).equalsIgnoreCase("vertical")) {
|
||||
@ -390,12 +340,7 @@ public class SelectionCommands {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
List<Vector> dirs = new ArrayList<Vector>();
|
||||
=======
|
||||
List<BlockVector3> dirs = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
int reverseChange = 0;
|
||||
|
||||
@ -465,14 +410,9 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.selection.contract")
|
||||
<<<<<<< HEAD
|
||||
public void contract(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
List<Vector> dirs = new ArrayList<Vector>();
|
||||
=======
|
||||
public void contract(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
|
||||
List<BlockVector3> dirs = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
int reverseChange = 0;
|
||||
|
||||
@ -544,14 +484,9 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.selection.shift")
|
||||
<<<<<<< HEAD
|
||||
public void shift(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
List<Vector> dirs = new ArrayList<Vector>();
|
||||
=======
|
||||
public void shift(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
|
||||
List<BlockVector3> dirs = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
if (args.argsLength() == 2) {
|
||||
if (args.getString(1).contains(",")) {
|
||||
@ -596,7 +531,7 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.selection.outset")
|
||||
public void outset(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
public void outset(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
Region region = session.getSelection(player.getWorld());
|
||||
region.expand(getChangesForEachDir(args));
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
@ -619,7 +554,7 @@ public class SelectionCommands {
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.selection.inset")
|
||||
public void inset(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
public void inset(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
Region region = session.getSelection(player.getWorld());
|
||||
region.contract(getChangesForEachDir(args));
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
@ -627,13 +562,8 @@ public class SelectionCommands {
|
||||
BBC.SELECTION_INSET.send(player);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
private Vector[] getChangesForEachDir(CommandContext args) {
|
||||
List<Vector> changes = new ArrayList<Vector>(6);
|
||||
=======
|
||||
private BlockVector3[] getChangesForEachDir(CommandContext args) {
|
||||
List<BlockVector3> changes = new ArrayList<>(6);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int change = args.getInteger(0);
|
||||
|
||||
if (!args.hasFlag('h')) {
|
||||
@ -660,8 +590,7 @@ public class SelectionCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.selection.size")
|
||||
<<<<<<< HEAD
|
||||
public void size(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
if (args.hasFlag('c')) {
|
||||
ClipboardHolder root = session.getClipboard();
|
||||
// Clipboard clipboard = holder.getClipboard();
|
||||
@ -681,8 +610,8 @@ public class SelectionCommands {
|
||||
}
|
||||
|
||||
Region region = clipboard.getRegion();
|
||||
Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(Vector.ONE);
|
||||
Vector origin = clipboard.getOrigin();
|
||||
BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(BlockVector3.ONE);
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
|
||||
String sizeStr = size.getBlockX() + "*" + size.getBlockY() + "*" + size.getBlockZ();
|
||||
String originStr = origin.getBlockX() + "," + origin.getBlockY() + "," + origin.getBlockZ();
|
||||
@ -701,20 +630,19 @@ public class SelectionCommands {
|
||||
// player.print(BBC.getPrefix() + "Offset: " + origin);
|
||||
// player.print(BBC.getPrefix() + "Cuboid distance: " + size.distance(Vector.ONE));
|
||||
// player.print(BBC.getPrefix() + "# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
|
||||
=======
|
||||
public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
if (args.hasFlag('c')) {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Region region = clipboard.getRegion();
|
||||
BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
|
||||
player.print("Cuboid dimensions (max - min): " + size);
|
||||
player.print("Offset: " + origin);
|
||||
player.print("Cuboid distance: " + size.distance(BlockVector3.ONE));
|
||||
player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
// if (args.hasFlag('c')) {
|
||||
// ClipboardHolder holder = session.getClipboard();
|
||||
// Clipboard clipboard = holder.getClipboard();
|
||||
// Region region = clipboard.getRegion();
|
||||
// BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint());
|
||||
// BlockVector3 origin = clipboard.getOrigin();
|
||||
//
|
||||
// player.print("Cuboid dimensions (max - min): " + size);
|
||||
// player.print("Offset: " + origin);
|
||||
// player.print("Cuboid distance: " + size.distance(BlockVector3.ONE));
|
||||
// player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -723,11 +651,7 @@ public class SelectionCommands {
|
||||
.subtract(region.getMinimumPoint())
|
||||
.add(1, 1, 1);
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.print(BBC.getPrefix() + "Type: " + session.getRegionSelector(player.getWorld())
|
||||
=======
|
||||
player.print("Type: " + session.getRegionSelector(player.getWorld())
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
.getTypeName());
|
||||
|
||||
for (String line : session.getRegionSelector(player.getWorld())
|
||||
@ -735,15 +659,9 @@ public class SelectionCommands {
|
||||
player.print(BBC.getPrefix() + line);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
player.print(BBC.getPrefix() + "Size: " + size);
|
||||
player.print(BBC.getPrefix() + "Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
|
||||
player.print(BBC.getPrefix() + "# of blocks: " + region.getArea());
|
||||
=======
|
||||
player.print("Size: " + size);
|
||||
player.print("Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
|
||||
player.print("# of blocks: " + region.getArea());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.command.FaweParser;
|
||||
@ -40,10 +39,8 @@ import com.boydti.fawe.util.gui.FormBuilder;
|
||||
import com.boydti.fawe.util.image.ImageUtil;
|
||||
import com.sk89q.minecraft.util.commands.*;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
@ -57,7 +54,6 @@ import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.command.util.CreatureButcher;
|
||||
import com.sk89q.worldedit.command.util.EntityRemover;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
@ -260,7 +256,6 @@ public class UtilityCommands extends MethodCommands {
|
||||
BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Command(
|
||||
aliases = {"/fill"},
|
||||
usage = "<pattern> <radius> [depth] [direction]",
|
||||
@ -270,17 +265,12 @@ public class UtilityCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.fill")
|
||||
@Logging(PLACEMENT)
|
||||
public void fill(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("1") double depth, @Optional("down") @Direction Vector direction) throws WorldEditException {
|
||||
public void fill(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("1") double depth, @Optional("down") @Direction BlockVector3 direction) throws WorldEditException {
|
||||
worldEdit.checkMaxRadius(radius);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected;
|
||||
affected = editSession.fillDirection(pos, pattern, radius, (int) depth, direction);
|
||||
player.print(BBC.getPrefix() + affected + " block(s) have been created.");
|
||||
=======
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected = editSession.fillXZ(pos, pattern, radius, depth, false);
|
||||
player.print(affected + " block(s) have been created.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -292,35 +282,34 @@ public class UtilityCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.fill.recursive")
|
||||
@Logging(PLACEMENT)
|
||||
<<<<<<< HEAD
|
||||
public void fillr(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("-1") double depth) throws WorldEditException {
|
||||
worldEdit.checkMaxRadius(radius);
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
if (depth == -1) depth = Integer.MAX_VALUE;
|
||||
int affected = editSession.fillXZ(pos, pattern, radius, (int) depth, true);
|
||||
player.print(BBC.getPrefix() + affected + " block(s) have been created.");
|
||||
=======
|
||||
public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
|
||||
ParserContext context = new ParserContext();
|
||||
context.setActor(player);
|
||||
context.setWorld(player.getWorld());
|
||||
context.setSession(session);
|
||||
Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context);
|
||||
|
||||
double radius = Math.max(1, args.getDouble(1));
|
||||
we.checkMaxRadius(radius);
|
||||
int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE;
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected = 0;
|
||||
if (pattern instanceof BlockPattern) {
|
||||
affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true);
|
||||
} else {
|
||||
affected = editSession.fillXZ(pos, pattern, radius, depth, true);
|
||||
}
|
||||
player.print(affected + " block(s) have been created.");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
//
|
||||
// ParserContext context = new ParserContext();
|
||||
// context.setActor(player);
|
||||
// context.setWorld(player.getWorld());
|
||||
// context.setSession(session);
|
||||
// Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context);
|
||||
//
|
||||
// double radius = Math.max(1, args.getDouble(1));
|
||||
// we.checkMaxRadius(radius);
|
||||
// int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE;
|
||||
//
|
||||
// BlockVector3 pos = session.getPlacementPosition(player);
|
||||
// int affected = 0;
|
||||
// if (pattern instanceof BlockPattern) {
|
||||
// affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true);
|
||||
// } else {
|
||||
// affected = editSession.fillXZ(pos, pattern, radius, depth, true);
|
||||
// }
|
||||
// player.print(affected + " block(s) have been created.");
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -430,16 +419,10 @@ public class UtilityCommands extends MethodCommands {
|
||||
if (from == null) {
|
||||
from = new ExistingBlockMask(editSession);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
Vector base = session.getPlacementPosition(player);
|
||||
Vector min = base.subtract(size, size, size);
|
||||
Vector max = base.add(size, size, size);
|
||||
=======
|
||||
|
||||
BlockVector3 base = session.getPlacementPosition(player);
|
||||
BlockVector3 min = base.subtract(size, size, size);
|
||||
BlockVector3 max = base.add(size, size, size);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
BlockVector3 min = base.subtract((int)size, (int)size, (int)size);
|
||||
BlockVector3 max = base.add((int)size, (int)size, (int)size);
|
||||
Region region = new CuboidRegion(player.getWorld(), min, max);
|
||||
|
||||
int affected = editSession.replaceBlocks(region, from, to);
|
||||
@ -574,13 +557,8 @@ public class UtilityCommands extends MethodCommands {
|
||||
EditSession editSession = null;
|
||||
|
||||
if (player != null) {
|
||||
<<<<<<< HEAD
|
||||
session = worldEdit.getSessionManager().get(player);
|
||||
Vector center = session.getPlacementPosition(player);
|
||||
=======
|
||||
session = we.getSessionManager().get(player);
|
||||
BlockVector3 center = session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
editSession = session.createEditSession(player);
|
||||
List<? extends Entity> entities;
|
||||
if (radius >= 0) {
|
||||
@ -639,13 +617,8 @@ public class UtilityCommands extends MethodCommands {
|
||||
EditSession editSession = null;
|
||||
|
||||
if (player != null) {
|
||||
<<<<<<< HEAD
|
||||
session = worldEdit.getSessionManager().get(player);
|
||||
Vector center = session.getPlacementPosition(player);
|
||||
=======
|
||||
session = we.getSessionManager().get(player);
|
||||
BlockVector3 center = session.getPlacementPosition(player);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
editSession = session.createEditSession(player);
|
||||
List<? extends Entity> entities;
|
||||
if (radius >= 0) {
|
||||
|
@ -3,18 +3,12 @@ package com.sk89q.worldedit.command.tool;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
=======
|
||||
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.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -49,7 +43,6 @@ public class AreaPickaxe implements BlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
@ -58,24 +51,22 @@ public class AreaPickaxe implements BlockTool {
|
||||
for (int y = oy + range; y >= oy - range; --y) {
|
||||
if (initialType.equals(editSession.getLazyBlock(x, y, z))) {
|
||||
continue;
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
try {
|
||||
for (int x = ox - range; x <= ox + range; ++x) {
|
||||
for (int y = oy - range; y <= oy + range; ++y) {
|
||||
for (int z = oz - range; z <= oz + range; ++z) {
|
||||
BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
continue;
|
||||
}
|
||||
|
||||
((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos));
|
||||
|
||||
editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// try (EditSession editSession = session.createEditSession(player)) {
|
||||
// editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
//
|
||||
// try {
|
||||
// for (int x = ox - range; x <= ox + range; ++x) {
|
||||
// for (int y = oy - range; y <= oy + range; ++y) {
|
||||
// for (int z = oz - range; z <= oz + range; ++z) {
|
||||
// BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
// if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos));
|
||||
//
|
||||
// editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||
// }
|
||||
}
|
||||
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
|
@ -19,6 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -26,13 +32,11 @@ 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;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
/**
|
||||
@ -44,18 +48,17 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
public boolean canUse(Actor player) {
|
||||
return player.hasPermission("worldedit.tool.data-cycler");
|
||||
}
|
||||
|
||||
private Map<UUID, Property<?>> selectedProperties = new HashMap<>();
|
||||
|
||||
private boolean handleCycle(Platform server, LocalConfiguration config,
|
||||
Player player, LocalSession session, Location clicked, boolean forward) {
|
||||
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
<<<<<<< HEAD
|
||||
BlockStateHolder block = world.getBlock(clicked.toVector());
|
||||
=======
|
||||
// BlockStateHolder block = world.getBlock(clicked.toVector());
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
BlockState block = world.getBlock(blockPoint);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (!config.allowedDataCycleBlocks.isEmpty()
|
||||
&& !player.hasPermission("worldedit.override.data-cycler")
|
||||
@ -64,61 +67,45 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block.getBlockType().getProperties().isEmpty()) {
|
||||
player.printError("That block's data cannot be cycled!");
|
||||
if (block.getStates().keySet().isEmpty()) {
|
||||
player.printError("That block's data cannot be cycled!");
|
||||
} else {
|
||||
<<<<<<< HEAD
|
||||
BlockStateHolder newBlock = block;
|
||||
|
||||
// TODO Forward = cycle value, Backward = Next property
|
||||
// int increment = forward ? 1 : -1;
|
||||
// BaseBlock newBlock = new BaseBlock(type, BlockData.cycle(type, data, increment));
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
try {
|
||||
editSession.setBlock(clicked.toVector(), newBlock);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
=======
|
||||
Property currentProperty = selectedProperties.get(player.getUniqueId());
|
||||
|
||||
if (currentProperty == null || (forward && block.getState(currentProperty) == null)) {
|
||||
currentProperty = block.getStates().keySet().stream().findFirst().get();
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
}
|
||||
|
||||
if (forward) {
|
||||
block.getState(currentProperty);
|
||||
int index = currentProperty.getValues().indexOf(block.getState(currentProperty));
|
||||
index = (index + 1) % currentProperty.getValues().size();
|
||||
BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index));
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
editSession.disableBuffering();
|
||||
|
||||
try {
|
||||
editSession.setBlock(blockPoint, newBlock);
|
||||
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<Property<?>> properties = Lists.newArrayList(block.getStates().keySet());
|
||||
int index = properties.indexOf(currentProperty);
|
||||
index = (index + 1) % properties.size();
|
||||
currentProperty = properties.get(index);
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
player.print("Now cycling " + currentProperty.getName());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
Property<?> currentProperty = selectedProperties.get(player.getUniqueId());
|
||||
|
||||
if (currentProperty == null || (forward && block.getState(currentProperty) == null)) {
|
||||
currentProperty = block.getStates().keySet().stream().findFirst().get();
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
}
|
||||
|
||||
if (forward) {
|
||||
block.getState(currentProperty);
|
||||
int index = currentProperty.getValues().indexOf(block.getState(currentProperty));
|
||||
index = (index + 1) % currentProperty.getValues().size();
|
||||
@SuppressWarnings("unchecked")
|
||||
Property<Object> objProp = (Property<Object>) currentProperty;
|
||||
BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index));
|
||||
|
||||
try {
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
try {
|
||||
editSession.setBlock(blockPoint, newBlock);
|
||||
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}catch (Exception e) {}
|
||||
} else {
|
||||
List<Property<?>> properties = Lists.newArrayList(block.getStates().keySet());
|
||||
int index = properties.indexOf(currentProperty);
|
||||
index = (index + 1) % properties.size();
|
||||
currentProperty = properties.get(index);
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
player.print("Now cycling " + currentProperty.getName());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,22 +58,10 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
BlockBag bag = session.getBlockBag(player);
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
try {
|
||||
editSession.setBlock(clicked.toVector(), pattern);
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
editSession.disableBuffering();
|
||||
BlockVector3 position = clicked.toVector().toBlockPoint();
|
||||
editSession.setBlock(position, pattern.apply(position));
|
||||
} catch (MaxChangedBlocksException ignored) {
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
editSession.setBlock(clicked.toVector().toBlockPoint(), pattern);
|
||||
} finally {
|
||||
if (bag != null) {
|
||||
bag.flushChanges();
|
||||
@ -87,13 +75,9 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector());
|
||||
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector().toBlockPoint());
|
||||
BlockType type = targetBlock.getBlockType();
|
||||
=======
|
||||
BlockStateHolder targetBlock = player.getWorld().getBlock(clicked.toVector().toBlockPoint());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (type != null) {
|
||||
this.pattern = targetBlock;
|
||||
|
@ -24,6 +24,8 @@ import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
@ -379,19 +381,19 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
public Vector getPosition(EditSession editSession, Player player) {
|
||||
public BlockVector3 getPosition(EditSession editSession, Player player) {
|
||||
Location loc = player.getLocation();
|
||||
switch (targetMode) {
|
||||
case TARGET_BLOCK_RANGE:
|
||||
return offset(new MutableBlockVector(trace(editSession, player, getRange(), true)), loc.toVector());
|
||||
return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
|
||||
case FOWARD_POINT_PITCH: {
|
||||
int d = 0;
|
||||
float pitch = loc.getPitch();
|
||||
pitch = 23 - (pitch / 4);
|
||||
d += (int) (Math.sin(Math.toRadians(pitch)) * 50);
|
||||
final Vector vector = loc.getDirection().setY(0).normalize().multiply(d);
|
||||
vector.add(loc.getX(), loc.getY(), loc.getZ()).toBlockVector();
|
||||
return offset(new MutableBlockVector(vector), loc.toVector());
|
||||
final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d).add(loc.getX(), loc.getY(), loc.getZ());
|
||||
// vector = vector.add(loc.getX(), loc.getY(), loc.getZ());
|
||||
return offset(vector, loc.toVector()).toBlockPoint();
|
||||
}
|
||||
case TARGET_POINT_HEIGHT: {
|
||||
final int height = loc.getBlockY();
|
||||
@ -405,34 +407,33 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
}
|
||||
final int distance = (height - y) + 8;
|
||||
return offset(new MutableBlockVector(trace(editSession, player, distance, true)), loc.toVector());
|
||||
return offset(trace(editSession, player, distance, true), loc.toVector()).toBlockPoint();
|
||||
}
|
||||
case TARGET_FACE_RANGE:
|
||||
return offset(new MutableBlockVector(trace(editSession, player, getRange(), true)), loc.toVector());
|
||||
return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Vector offset(Vector target, Vector playerPos) {
|
||||
private Vector3 offset(Vector3 target, Vector3 playerPos) {
|
||||
if (targetOffset == 0) return target;
|
||||
return target.subtract(target.subtract(playerPos).normalize().multiply(targetOffset));
|
||||
}
|
||||
|
||||
private Vector trace(EditSession editSession, Player player, int range, boolean useLastBlock) {
|
||||
private Vector3 trace(EditSession editSession, Player player, int range, boolean useLastBlock) {
|
||||
Mask mask = targetMask == null ? new SolidBlockMask(editSession) : targetMask;
|
||||
new MaskTraverser(mask).reset(editSession);
|
||||
MaskedTargetBlock tb = new MaskedTargetBlock(mask, player, range, 0.2);
|
||||
return TaskManager.IMP.sync(new RunnableVal<Vector>() {
|
||||
return TaskManager.IMP.sync(new RunnableVal<Vector3>() {
|
||||
@Override
|
||||
public void run(Vector value) {
|
||||
public void run(Vector3 value) {
|
||||
Location result = tb.getMaskedTargetBlock(useLastBlock);
|
||||
this.value = result.toVector();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public boolean act(BrushAction action, Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
switch (action) {
|
||||
case PRIMARY:
|
||||
@ -454,7 +455,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector target = getPosition(editSession, player);
|
||||
BlockVector3 target = getPosition(editSession, player);
|
||||
|
||||
if (target == null) {
|
||||
editSession.cancel();
|
||||
@ -475,14 +476,14 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
MaskIntersection newMask = new MaskIntersection(existingMask);
|
||||
newMask.add(mask);
|
||||
editSession.setMask(newMask);
|
||||
=======
|
||||
try {
|
||||
brush.build(editSession, target.toVector().toBlockPoint(), material, size);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// try {
|
||||
// brush.build(editSession, target.toVector().toBlockPoint(), material, size);
|
||||
// } catch (MaxChangedBlocksException e) {
|
||||
// player.printError("Max blocks change limit reached.");
|
||||
// } finally {
|
||||
// session.remember(editSession);
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
Mask sourceMask = current.getSourceMask();
|
||||
@ -622,7 +623,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
.combineStages(false)
|
||||
.build();
|
||||
VisualExtent newVisualExtent = new VisualExtent(editSession.getExtent(), editSession.getQueue());
|
||||
Vector position = getPosition(editSession, player);
|
||||
BlockVector3 position = getPosition(editSession, player);
|
||||
if (position != null) {
|
||||
editSession.setExtent(newVisualExtent);
|
||||
switch (mode) {
|
||||
|
@ -75,24 +75,8 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
player.printError("That's not a tree.");
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
final EditSession editSession = session.createEditSession(player);
|
||||
|
||||
try {
|
||||
final Set<Vector> blockSet = bfs(world, clicked.toVector());
|
||||
if (blockSet == null) {
|
||||
player.printError("That's not a floating tree.");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (Vector blockVector : blockSet) {
|
||||
final BlockState otherState = editSession.getBlock(blockVector);
|
||||
if (isTreeBlock(otherState.getBlockType())) {
|
||||
editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState());
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
try /*(EditSession editSession = session.createEditSession(player))*/ {
|
||||
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
|
||||
if (blockSet == null) {
|
||||
player.printError("That's not a floating tree.");
|
||||
@ -104,9 +88,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
if (isTreeBlock(otherState.getBlockType())) {
|
||||
editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState());
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
|
@ -19,14 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.*;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
@ -62,12 +59,8 @@ public class FloodFillTool implements BlockTool {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
<<<<<<< HEAD
|
||||
BlockType initialType = world.getBlockType(clicked.toVector());
|
||||
=======
|
||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (initialType.getMaterial().isAir()) {
|
||||
return true;
|
||||
@ -77,38 +70,22 @@ public class FloodFillTool implements BlockTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
=======
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
try {
|
||||
recurse(editSession, origin, origin, range, initialType, new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
try {
|
||||
recurse(editSession, clicked.toVector().toBlockVector(),
|
||||
clicked.toVector(), range, initialType, new HashSet<BlockVector>());
|
||||
} catch (WorldEditException e) {
|
||||
throw new RuntimeException(e);
|
||||
recurse(editSession, origin, origin, range, initialType, new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
||||
editSession.flushQueue();
|
||||
session.remember(editSession);
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
private void recurse(EditSession editSession, BlockVector pos, Vector origin, int size, BlockType initialType,
|
||||
Set<BlockVector> visited) throws WorldEditException {
|
||||
=======
|
||||
private void recurse(EditSession editSession, BlockVector3 pos, BlockVector3 origin, int size, BlockType initialType,
|
||||
Set<BlockVector3> visited) throws MaxChangedBlocksException {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (origin.distance(pos) > size || visited.contains(pos)) {
|
||||
return;
|
||||
|
@ -56,11 +56,9 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
<<<<<<< HEAD
|
||||
EditSession eS = session.createEditSession(player);
|
||||
=======
|
||||
try (EditSession eS = session.createEditSession(player)) {
|
||||
eS.disableBuffering();
|
||||
try {
|
||||
// eS.disableBuffering();
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockStateHolder applied = secondary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
@ -73,31 +71,16 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
// one block? eat it
|
||||
}
|
||||
return false;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
BlockStateHolder applied = secondary.apply(pos.toVector());
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(pos.toVector(), secondary);
|
||||
} else {
|
||||
eS.setBlock(pos.add(pos.getDirection()), secondary);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
Location pos = getTargetFace(player);
|
||||
if (pos == null) return false;
|
||||
<<<<<<< HEAD
|
||||
EditSession eS = session.createEditSession(player);
|
||||
BlockStateHolder applied = primary.apply(pos.toVector());
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(pos.toVector(), primary);
|
||||
} else {
|
||||
eS.setBlock(pos.add(pos.getDirection()), primary);
|
||||
=======
|
||||
try (EditSession eS = session.createEditSession(player)) {
|
||||
eS.disableBuffering();
|
||||
|
||||
try {
|
||||
// eS.disableBuffering();
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockStateHolder applied = primary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
@ -108,7 +91,6 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
// one block? eat it
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import java.util.Set;
|
||||
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
@ -13,7 +13,6 @@ import com.sk89q.worldedit.function.block.BlockReplace;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
=======
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -22,9 +21,9 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
/**
|
||||
@ -46,14 +45,11 @@ public class RecursivePickaxe implements BlockTool {
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
final Vector pos = clicked.toVector();
|
||||
final BlockVector3 pos = clicked.toVector().toBlockPoint();
|
||||
|
||||
<<<<<<< HEAD
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
=======
|
||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
BlockStateHolder block = editSession.getBlock(pos);
|
||||
if (block.getBlockType().getMaterial().isAir()) {
|
||||
@ -66,7 +62,7 @@ public class RecursivePickaxe implements BlockTool {
|
||||
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
|
||||
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
final int radius = (int) range;
|
||||
final BlockReplace replace = new BlockReplace(editSession, (editSession.nullBlock));
|
||||
editSession.setMask((Mask) null);
|
||||
@ -76,54 +72,51 @@ public class RecursivePickaxe implements BlockTool {
|
||||
|
||||
editSession.flushQueue();
|
||||
session.remember(editSession);
|
||||
=======
|
||||
try {
|
||||
recurse(server, editSession, world, clicked.toVector().toBlockPoint(),
|
||||
clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// try {
|
||||
// recurse(server, editSession, world, clicked.toVector().toBlockPoint(),
|
||||
// clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>());
|
||||
// } catch (MaxChangedBlocksException e) {
|
||||
// player.printError("Max blocks change limit reached.");
|
||||
// } finally {
|
||||
// session.remember(editSession);
|
||||
// }
|
||||
// }
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
private static void recurse(Platform server, EditSession editSession, World world, BlockVector3 pos,
|
||||
BlockVector3 origin, double size, BlockType initialType, Set<BlockVector3> visited) throws MaxChangedBlocksException {
|
||||
|
||||
final double distanceSq = origin.distanceSq(pos);
|
||||
if (distanceSq > size*size || visited.contains(pos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
visited.add(pos);
|
||||
|
||||
if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
return;
|
||||
}
|
||||
|
||||
world.queueBlockBreakEffect(server, pos, initialType, distanceSq);
|
||||
|
||||
editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||
|
||||
recurse(server, editSession, world, pos.add(1, 0, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(-1, 0, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, 0, 1),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, 0, -1),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, 1, 0),
|
||||
origin, size, initialType, visited);
|
||||
recurse(server, editSession, world, pos.add(0, -1, 0),
|
||||
origin, size, initialType, visited);
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// private static void recurse(Platform server, EditSession editSession, World world, BlockVector3 pos,
|
||||
// BlockVector3 origin, double size, BlockType initialType, Set<BlockVector3> visited) throws MaxChangedBlocksException {
|
||||
//
|
||||
// final double distanceSq = origin.distanceSq(pos);
|
||||
// if (distanceSq > size*size || visited.contains(pos)) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// visited.add(pos);
|
||||
//
|
||||
// if (editSession.getBlock(pos).getBlockType() != initialType) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// world.queueBlockBreakEffect(server, pos, initialType, distanceSq);
|
||||
//
|
||||
// editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||
//
|
||||
// recurse(server, editSession, world, pos.add(1, 0, 0),
|
||||
// origin, size, initialType, visited);
|
||||
// recurse(server, editSession, world, pos.add(-1, 0, 0),
|
||||
// origin, size, initialType, visited);
|
||||
// recurse(server, editSession, world, pos.add(0, 0, 1),
|
||||
// origin, size, initialType, visited);
|
||||
// recurse(server, editSession, world, pos.add(0, 0, -1),
|
||||
// origin, size, initialType, visited);
|
||||
// recurse(server, editSession, world, pos.add(0, 1, 0),
|
||||
// origin, size, initialType, visited);
|
||||
// recurse(server, editSession, world, pos.add(0, -1, 0),
|
||||
// origin, size, initialType, visited);
|
||||
// }
|
||||
|
||||
}
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command.tool;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
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;
|
||||
@ -42,30 +43,20 @@ public class SinglePickaxe implements BlockTool {
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
<<<<<<< HEAD
|
||||
final BlockType blockType = world.getLazyBlock(clicked.toVector()).getBlockType();
|
||||
if (blockType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);
|
||||
=======
|
||||
World world = (World) clicked.getExtent();
|
||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
||||
final BlockType blockType = world.getBlock(blockPoint).getBlockType();
|
||||
if (blockType == BlockTypes.BEDROCK
|
||||
&& !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
final EditSession editSession = session.createEditSession(player);
|
||||
try {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);
|
||||
editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
try {
|
||||
if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
|
||||
|
@ -50,23 +50,14 @@ public class TreePlanter implements BlockTool {
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
<<<<<<< HEAD
|
||||
try {
|
||||
boolean successful = false;
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0))) {
|
||||
successful = true;
|
||||
break;
|
||||
=======
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0).toBlockPoint())) {
|
||||
successful = true;
|
||||
break;
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
||||
if (!successful) {
|
||||
player.printError("A tree can't go there.");
|
||||
|
@ -20,13 +20,9 @@
|
||||
package com.sk89q.worldedit.event.extent;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.event.Cancellable;
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -59,11 +55,7 @@ import static com.sk89q.worldedit.EditSession.Stage;
|
||||
* is set to {@link Stage#BEFORE_HISTORY}, then you can drop (or log) changes
|
||||
* before the change has reached the history, reordering, and actual change
|
||||
* extents, <em>but</em> that means that any changes made with
|
||||
<<<<<<< HEAD
|
||||
* {@link EditSession#rawSetBlock(Vector, BaseBlock)} will skip your
|
||||
=======
|
||||
* {@link EditSession#rawSetBlock(BlockVector3, BlockStateHolder)} will skip your
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
* custom {@link Extent} because that method bypasses history (and reorder).
|
||||
* It is thus recommended that loggers intercept at {@link Stage#BEFORE_CHANGE}
|
||||
* and block interceptors intercept at BOTH {@link Stage#BEFORE_CHANGE} and
|
||||
|
@ -19,12 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.event.extent;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.Cancellable;
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
|
||||
@ -35,11 +36,11 @@ public class PasteEvent extends Event implements Cancellable {
|
||||
private final Player player;
|
||||
private final Clipboard clipboard;
|
||||
private final URI uri;
|
||||
private final Vector to;
|
||||
private final BlockVector3 to;
|
||||
private final Extent extent;
|
||||
private boolean cancelled;
|
||||
|
||||
public PasteEvent(Player player, Clipboard clipboard, URI uri, Extent extent, Vector to) {
|
||||
public PasteEvent(Player player, Clipboard clipboard, URI uri, Extent extent, BlockVector3 to) {
|
||||
this.player = player;
|
||||
this.clipboard = clipboard;
|
||||
this.uri = uri;
|
||||
@ -59,7 +60,7 @@ public class PasteEvent extends Event implements Cancellable {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public Vector getPosition() {
|
||||
public BlockVector3 getPosition() {
|
||||
return to;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.command.SuggestInputParseException;
|
||||
import com.boydti.fawe.jnbt.JSON2NBT;
|
||||
import com.boydti.fawe.jnbt.NBTException;
|
||||
@ -31,13 +30,10 @@ import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
=======
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.NotABlockException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.blocks.MobSpawnerBlock;
|
||||
import com.sk89q.worldedit.blocks.SignBlock;
|
||||
import com.sk89q.worldedit.blocks.SkullBlock;
|
||||
@ -52,11 +48,8 @@ import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.extent.inventory.SlottableBlockBag;
|
||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -211,11 +204,7 @@ public class DefaultBlockParser extends InputParser<BlockStateHolder> {
|
||||
int index = Integer.parseInt(typeString.replaceAll("[a-z]+", ""));
|
||||
// Get the block type from the "primary position"
|
||||
final World world = context.requireWorld();
|
||||
<<<<<<< HEAD
|
||||
final Vector primaryPosition;
|
||||
=======
|
||||
final BlockVector3 primaryPosition;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
try {
|
||||
primaryPosition = context.requireSession().getRegionSelector(world).getVerticies().get(index - 1);
|
||||
} catch (IncompleteRegionException e) {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.command.FaweParser;
|
||||
import com.boydti.fawe.command.SuggestInputParseException;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
=======
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.MaskCommands;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -20,11 +17,9 @@ import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.function.mask.MaskUnion;
|
||||
import com.sk89q.worldedit.internal.command.ActorAuthorizer;
|
||||
import com.sk89q.worldedit.internal.command.WorldEditBinding;
|
||||
=======
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.mask.NoiseFilter;
|
||||
import com.sk89q.worldedit.function.mask.OffsetMask;
|
||||
@ -37,7 +32,6 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.noise.RandomNoise;
|
||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.command.Dispatcher;
|
||||
import com.sk89q.worldedit.util.command.SimpleDispatcher;
|
||||
@ -169,10 +163,10 @@ public class DefaultMaskParser extends FaweParser<Mask> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
<<<<<<< HEAD
|
||||
List<String> args = entry.getValue();
|
||||
String cmdArgs = ((args.isEmpty()) ? "" : " " + StringMan.join(args, " "));
|
||||
try {
|
||||
//<<<<<<< HEAD
|
||||
List<String> args = entry.getValue();
|
||||
String cmdArgs = ((args.isEmpty()) ? "" : " " + StringMan.join(args, " "));
|
||||
try {
|
||||
mask = (Mask) dispatcher.call(command + cmdArgs, locals, new String[0]);
|
||||
} catch (SuggestInputParseException rethrow) {
|
||||
throw rethrow;
|
||||
@ -198,55 +192,55 @@ public class DefaultMaskParser extends FaweParser<Mask> {
|
||||
throw new InputParseException(e2.getMessage());
|
||||
}
|
||||
});
|
||||
=======
|
||||
throw new NoMatchException("Unrecognized mask '" + component + '\'');
|
||||
}
|
||||
|
||||
case '>':
|
||||
case '<':
|
||||
Mask submask;
|
||||
if (component.length() > 1) {
|
||||
submask = getBlockMaskComponent(masks, component.substring(1), context);
|
||||
} else {
|
||||
submask = new ExistingBlockMask(extent);
|
||||
}
|
||||
OffsetMask offsetMask = new OffsetMask(submask, new BlockVector3(0, firstChar == '>' ? -1 : 1, 0));
|
||||
return new MaskIntersection(offsetMask, Masks.negate(submask));
|
||||
|
||||
case '$':
|
||||
Set<BaseBiome> biomes = new HashSet<>();
|
||||
String[] biomesList = component.substring(1).split(",");
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
List<BaseBiome> knownBiomes = biomeRegistry.getBiomes();
|
||||
for (String biomeName : biomesList) {
|
||||
BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry);
|
||||
if (biome == null) {
|
||||
throw new InputParseException("Unknown biome '" + biomeName + '\'');
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// throw new NoMatchException("Unrecognized mask '" + component + '\'');
|
||||
// }
|
||||
//
|
||||
// case '>':
|
||||
// case '<':
|
||||
// Mask submask;
|
||||
// if (component.length() > 1) {
|
||||
// submask = getBlockMaskComponent(masks, component.substring(1), context);
|
||||
// } else {
|
||||
// submask = new ExistingBlockMask(extent);
|
||||
// }
|
||||
// OffsetMask offsetMask = new OffsetMask(submask, new BlockVector3(0, firstChar == '>' ? -1 : 1, 0));
|
||||
// return new MaskIntersection(offsetMask, Masks.negate(submask));
|
||||
//
|
||||
// case '$':
|
||||
// Set<BaseBiome> biomes = new HashSet<>();
|
||||
// String[] biomesList = component.substring(1).split(",");
|
||||
// BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
// .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
// List<BaseBiome> knownBiomes = biomeRegistry.getBiomes();
|
||||
// for (String biomeName : biomesList) {
|
||||
// BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry);
|
||||
// if (biome == null) {
|
||||
// throw new InputParseException("Unknown biome '" + biomeName + '\'');
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
if (pe.and) {
|
||||
masks.add(new ArrayList<>());
|
||||
=======
|
||||
|
||||
return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes));
|
||||
|
||||
case '%':
|
||||
int i = Integer.parseInt(component.substring(1));
|
||||
return new NoiseFilter(new RandomNoise(), ((double) i) / 100);
|
||||
|
||||
case '=':
|
||||
try {
|
||||
Expression exp = Expression.compile(component.substring(1), "x", "y", "z");
|
||||
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(
|
||||
Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO);
|
||||
exp.setEnvironment(env);
|
||||
return new ExpressionMask(exp);
|
||||
} catch (ExpressionException e) {
|
||||
throw new InputParseException("Invalid expression: " + e.getMessage());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
//
|
||||
// return Masks.asMask(new BiomeMask2D(context.requireExtent(), biomes));
|
||||
//
|
||||
// case '%':
|
||||
// int i = Integer.parseInt(component.substring(1));
|
||||
// return new NoiseFilter(new RandomNoise(), ((double) i) / 100);
|
||||
//
|
||||
// case '=':
|
||||
// try {
|
||||
// Expression exp = Expression.compile(component.substring(1), "x", "y", "z");
|
||||
// WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(
|
||||
// Request.request().getEditSession(), Vector3.ONE, Vector3.ZERO);
|
||||
// exp.setEnvironment(env);
|
||||
// return new ExpressionMask(exp);
|
||||
// } catch (ExpressionException e) {
|
||||
// throw new InputParseException("Invalid expression: " + e.getMessage());
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
masks.get(masks.size() - 1).add(mask);
|
||||
}
|
||||
|
@ -22,10 +22,8 @@ package com.sk89q.worldedit.extension.platform;
|
||||
import com.sk89q.worldedit.NotABlockException;
|
||||
import com.sk89q.worldedit.PlayerDirection;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
=======
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||
@ -35,8 +33,6 @@ import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TargetBlock;
|
||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -127,13 +123,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
if (free == 2) {
|
||||
if (y - 1 != origY) {
|
||||
<<<<<<< HEAD
|
||||
final Vector pos = new Vector(x, y - 2, z);
|
||||
final BlockVector3 pos = new BlockVector3(x, y - 2, z);
|
||||
final BlockStateHolder state = world.getBlock(pos);
|
||||
setPosition(new Vector(x + 0.5, y - 2 + BlockType.centralTopLimit(state), z + 0.5));
|
||||
=======
|
||||
setPosition(new Vector3(x + 0.5, y - 2 + 1, z + 0.5));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
setPosition(new Vector3(x + 0.5, y - 2 + BlockType.centralTopLimit(state), z + 0.5));
|
||||
// setPosition(new Vector3(x + 0.5, y - 2 + 1, z + 0.5));
|
||||
}
|
||||
|
||||
return;
|
||||
@ -151,17 +144,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
int z = searchPos.getBlockZ();
|
||||
|
||||
while (y >= 0) {
|
||||
<<<<<<< HEAD
|
||||
final Vector pos = new Vector(x, y, z);
|
||||
final BlockStateHolder id = world.getBlock(pos);
|
||||
if (id.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
setPosition(new Vector(x + 0.5, y + BlockType.centralTopLimit(id), z + 0.5));
|
||||
=======
|
||||
final BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
final BlockState id = world.getBlock(pos);
|
||||
if (id.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
setPosition(new Vector3(x + 0.5, y + 1, z + 0.5));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
setPosition(new Vector3(x + 0.5, y + + BlockType.centralTopLimit(id), z + 0.5));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -185,8 +171,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
int maxY = world.getMaxY();
|
||||
if (y >= maxY) return false;
|
||||
|
||||
<<<<<<< HEAD
|
||||
BlockMaterial initialMaterial = world.getBlockType(new Vector(x, y, z)).getMaterial();
|
||||
BlockMaterial initialMaterial = world.getBlockType(new BlockVector3(x, y, z)).getMaterial();
|
||||
|
||||
boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube();
|
||||
|
||||
@ -196,7 +181,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
for (int level = y + 1; level <= maxY + 2; level++) {
|
||||
BlockState state;
|
||||
if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState();
|
||||
else state = world.getBlock(new Vector(x, level, z));
|
||||
else state = world.getBlock(new BlockVector3(x, level, z));
|
||||
BlockTypes type = state.getBlockType();
|
||||
BlockMaterial material = type.getMaterial();
|
||||
|
||||
@ -204,29 +189,6 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
if (!lastState) {
|
||||
lastState = BlockType.centralBottomLimit(state) != 1;
|
||||
continue;
|
||||
=======
|
||||
while (y <= world.getMaximumPoint().getY() + 2) {
|
||||
if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
|
||||
++free;
|
||||
} else {
|
||||
free = 0;
|
||||
}
|
||||
|
||||
if (free == 2) {
|
||||
++spots;
|
||||
if (spots == 2) {
|
||||
final BlockVector3 platform = new BlockVector3(x, y - 2, z);
|
||||
final BlockStateHolder block = world.getBlock(platform);
|
||||
final com.sk89q.worldedit.world.block.BlockType type = block.getBlockType();
|
||||
|
||||
// Don't get put in lava!
|
||||
if (type == BlockTypes.LAVA) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setPosition(platform.toVector3().add(0.5, 1, 0.5));
|
||||
return true;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
if (freeStart == -1) {
|
||||
freeStart = level + BlockType.centralTopLimit(state);
|
||||
@ -234,7 +196,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
double bottomLimit = BlockType.centralBottomLimit(state);
|
||||
double space = level + bottomLimit - freeStart;
|
||||
if (space >= height) {
|
||||
setPosition(new Vector(x + 0.5, freeStart, z + 0.5));
|
||||
setPosition(new Vector3(x + 0.5, freeStart, z + 0.5));
|
||||
return true;
|
||||
}
|
||||
// Not enough room, reset the free position
|
||||
@ -258,9 +220,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
final int z = pos.getBlockZ();
|
||||
final Extent world = pos.getExtent();
|
||||
|
||||
BlockMaterial initialMaterial = world.getBlockType(new Vector(x, y, z)).getMaterial();
|
||||
BlockMaterial initialMaterial = world.getBlockType(new BlockVector3(x, y, z)).getMaterial();
|
||||
|
||||
<<<<<<< HEAD
|
||||
boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube();
|
||||
|
||||
double height = 1.85;
|
||||
@ -272,7 +233,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
for (int level = y + 1; level > 0; level--) {
|
||||
BlockState state;
|
||||
if (level >= maxY) state = BlockTypes.VOID_AIR.getDefaultState();
|
||||
else state = world.getBlock(new Vector(x, level, z));
|
||||
else state = world.getBlock(new BlockVector3(x, level, z));
|
||||
BlockTypes type = state.getBlockType();
|
||||
BlockMaterial material = type.getMaterial();
|
||||
|
||||
@ -288,29 +249,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
double freeStart = level + topLimit;
|
||||
double space = freeEnd - freeStart;
|
||||
if (space >= height) {
|
||||
setPosition(new Vector(x + 0.5, freeStart, z + 0.5));
|
||||
=======
|
||||
while (y >= 1) {
|
||||
if (!world.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) {
|
||||
++free;
|
||||
} else {
|
||||
free = 0;
|
||||
}
|
||||
|
||||
if (free == 2) {
|
||||
// So we've found a spot, but we have to drop the player
|
||||
// lightly and also check to see if there's something to
|
||||
// stand upon
|
||||
while (y >= 0) {
|
||||
final BlockVector3 platform = new BlockVector3(x, y, z);
|
||||
final BlockStateHolder block = world.getBlock(platform);
|
||||
final BlockType type = block.getBlockType();
|
||||
|
||||
// Don't want to end up in lava
|
||||
if (!type.getMaterial().isAir() && type != BlockTypes.LAVA) {
|
||||
// Found a block!
|
||||
setPosition(platform.toVector3().add(0.5, 1, 0.5));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
setPosition(new Vector3(x + 0.5, freeStart, z + 0.5));
|
||||
return true;
|
||||
}
|
||||
// Not enough room, reset the free position
|
||||
@ -392,41 +331,25 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@Override
|
||||
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
||||
<<<<<<< HEAD
|
||||
Vector spot = new Vector(x, y - 1, z);
|
||||
if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) {
|
||||
try {
|
||||
getLocation().getExtent().setBlock(new Vector(x, y - 1, z), BlockTypes.GLASS.getDefaultState());
|
||||
} catch (WorldEditException e) {
|
||||
e.printStackTrace();
|
||||
=======
|
||||
try {
|
||||
BlockVector3 spot = new BlockVector3(x, y - 1, z);
|
||||
if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) {
|
||||
getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}catch (WorldEditException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
setPosition(new Vector3(x + 0.5, y, z + 0.5));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBlockIn() {
|
||||
<<<<<<< HEAD
|
||||
Location loc = getLocation();
|
||||
return new Location(loc.getExtent(), loc.toBlockVector(), loc.getDirection());
|
||||
=======
|
||||
return getLocation().setPosition(getLocation().toVector().floor());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBlockOn() {
|
||||
<<<<<<< HEAD
|
||||
return getLocation().setY(getLocation().getY() - 1);
|
||||
=======
|
||||
return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().floor());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -607,12 +530,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
return false;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
@Override
|
||||
public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) {
|
||||
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.platform;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||
@ -30,9 +29,7 @@ import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||
import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||
import com.boydti.fawe.wrappers.WorldWrapper;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.*;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -43,7 +40,6 @@ 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;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.*;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
@ -305,12 +301,11 @@ public class PlatformManager {
|
||||
public void handleBlockInteract(BlockInteractEvent event) {
|
||||
// Create a proxy actor with a potentially different world for
|
||||
// making changes to the world
|
||||
<<<<<<< HEAD
|
||||
Request.reset();
|
||||
final Actor actor = createProxyActor(event.getCause());
|
||||
try {
|
||||
final Location location = event.getLocation();
|
||||
final Vector vector = location.toVector();
|
||||
final BlockVector3 vector = location.toVector().toBlockPoint();
|
||||
|
||||
// At this time, only handle interaction from players
|
||||
if (actor instanceof Player) {
|
||||
@ -322,12 +317,6 @@ public class PlatformManager {
|
||||
virtual.handleBlockInteract(playerActor, vector, event);
|
||||
if (event.isCancelled()) return;
|
||||
}
|
||||
=======
|
||||
Actor actor = createProxyActor(event.getCause());
|
||||
|
||||
Location location = event.getLocation();
|
||||
Vector3 vector = location.toVector();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
if (event.getType() == Interaction.HIT) {
|
||||
if (session.isToolControlEnabled() && playerActor.getItemInHand(HandSide.MAIN_HAND).getType().equals(getConfiguration().wandItem)) {
|
||||
@ -340,7 +329,7 @@ public class PlatformManager {
|
||||
fp.runAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (selector.selectPrimary(location.toVector(), ActorSelectorLimits.forActor(player))) {
|
||||
if (selector.selectPrimary(vector, ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainPrimarySelection(actor, session, vector);
|
||||
}
|
||||
}
|
||||
@ -364,7 +353,7 @@ public class PlatformManager {
|
||||
return;
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
final Tool tool = session.getTool(playerActor);
|
||||
if (tool != null && tool instanceof DoubleActionBlockTool) {
|
||||
if (tool.canUse(playerActor)) {
|
||||
@ -379,14 +368,14 @@ public class PlatformManager {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
=======
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
|
||||
BlockVector3 blockPoint = vector.toBlockPoint();
|
||||
if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainPrimarySelection(actor, session, blockPoint);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
//
|
||||
// RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
//
|
||||
// BlockVector3 blockPoint = vector.toBlockPoint();
|
||||
// if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
// selector.explainPrimarySelection(actor, session, blockPoint);
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
} else if (event.getType() == Interaction.OPEN) {
|
||||
if (session.isToolControlEnabled() && playerActor.getItemInHand(HandSide.MAIN_HAND).getType().equals(getConfiguration().wandItem)) {
|
||||
@ -410,7 +399,7 @@ public class PlatformManager {
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
final Tool tool = session.getTool(playerActor);
|
||||
if (tool != null && tool instanceof BlockTool) {
|
||||
if (tool.canUse(playerActor)) {
|
||||
@ -431,23 +420,23 @@ public class PlatformManager {
|
||||
return;
|
||||
}
|
||||
}
|
||||
=======
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
BlockVector3 blockPoint = vector.toBlockPoint();
|
||||
if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
selector.explainSecondarySelection(actor, session, blockPoint);
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
||||
if (tool instanceof BlockTool) {
|
||||
if (tool.canUse(player)) {
|
||||
((BlockTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location);
|
||||
event.setCancelled(true);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
// BlockVector3 blockPoint = vector.toBlockPoint();
|
||||
// if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||
// selector.explainSecondarySelection(actor, session, blockPoint);
|
||||
// }
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
||||
// if (tool instanceof BlockTool) {
|
||||
// if (tool.canUse(player)) {
|
||||
// ((BlockTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location);
|
||||
// event.setCancelled(true);
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ import javax.annotation.Nullable;
|
||||
public class AbstractDelegateExtent implements LightingExtent {
|
||||
|
||||
private transient final Extent extent;
|
||||
private MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
// private MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -126,10 +126,10 @@ public class AbstractDelegateExtent implements LightingExtent {
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mutable.mutZ(z);
|
||||
return extent.getLazyBlock(mutable);
|
||||
// mutable.mutX(x);
|
||||
// mutable.mutY(y);
|
||||
// mutable.mutZ(z);
|
||||
return extent.getLazyBlock(new BlockVector3(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -139,10 +139,10 @@ public class AbstractDelegateExtent implements LightingExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mutable.mutZ(z);
|
||||
return setBlock(mutable, block);
|
||||
// mutable.mutX(x);
|
||||
// mutable.mutY(y);
|
||||
// mutable.mutZ(z);
|
||||
return setBlock(new BlockVector3(x, y, z), block);
|
||||
}
|
||||
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
|
@ -19,16 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.history.change.BlockChange;
|
||||
@ -38,13 +34,9 @@ import com.sk89q.worldedit.history.changeset.ChangeSet;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
<<<<<<< HEAD
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -71,15 +63,9 @@ public class ChangeSetExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||
BlockStateHolder previous = getBlock(location);
|
||||
changeSet.add(new BlockChange(location.toBlockVector(), previous, block));
|
||||
=======
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
BaseBlock previous = getFullBlock(location);
|
||||
BlockStateHolder previous = getBlock(location);
|
||||
changeSet.add(new BlockChange(location, previous, block));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return super.setBlock(location, block);
|
||||
}
|
||||
|
||||
|
@ -19,23 +19,15 @@
|
||||
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
|
||||
@ -47,7 +39,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class MaskingExtent extends AbstractDelegateExtent {
|
||||
|
||||
private Mask mask;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
// private MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -86,13 +78,13 @@ public class MaskingExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
return mask.test(mutable.setComponents(position.getBlockX(), 0, position.getBlockZ())) && super.setBiome(position, biome);
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return mask.test(position.toBlockVector3()) && super.setBiome(position, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome biome) {
|
||||
return mask.test(mutable.setComponents(x, y, z)) && super.setBiome(x, y, z, biome);
|
||||
return mask.test(new BlockVector3(x, y, z)) && super.setBiome(x, y, z, biome);
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,35 +20,27 @@
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.LazyBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
=======
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
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.BlockTypes;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
@ -60,13 +52,10 @@ import java.util.List;
|
||||
*/
|
||||
public class NullExtent implements Extent {
|
||||
|
||||
<<<<<<< HEAD
|
||||
private final Vector nullPoint = new Vector(0, 0, 0);
|
||||
private final BlockVector3 nullPoint = new BlockVector3(0, 0, 0);
|
||||
|
||||
public static final NullExtent INSTANCE = new NullExtent();
|
||||
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
@Override
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return BlockVector3.ZERO;
|
||||
@ -98,19 +87,13 @@ public class NullExtent implements Extent {
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getFullBlock(Vector position) {
|
||||
public BlockState getFullBlock(BlockVector3 position) {
|
||||
return new BaseBlock(getBlock(position));
|
||||
=======
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return getBlock(position).toBaseBlock();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -19,25 +19,20 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.clipboard;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
|
||||
import com.boydti.fawe.object.clipboard.FaweClipboard;
|
||||
import com.boydti.fawe.object.clipboard.FaweClipboard.ClipboardEntity;
|
||||
import com.boydti.fawe.object.clipboard.MemoryOptimizedClipboard;
|
||||
import com.boydti.fawe.object.extent.LightingExtent;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
@ -46,11 +41,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import java.io.Closeable;
|
||||
@ -69,16 +60,16 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable {
|
||||
|
||||
<<<<<<< HEAD
|
||||
private Region region;
|
||||
private Region region;
|
||||
private BlockVector3 origin;
|
||||
public FaweClipboard IMP;
|
||||
private Vector size;
|
||||
private BlockVector3 size;
|
||||
private int mx;
|
||||
private int my;
|
||||
private int mz;
|
||||
private Vector origin;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
private BlockStateHolder[][][] blocks;
|
||||
private final List<ClipboardEntity> entities = new ArrayList<>();
|
||||
|
||||
public BlockArrayClipboard(Region region) {
|
||||
checkNotNull(region);
|
||||
this.region = region.clone();
|
||||
@ -88,13 +79,8 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
this.mx = origin.getBlockX();
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
this.blocks = new BlockStateHolder[size.getBlockX()][size.getBlockY()][size.getBlockZ()];
|
||||
}
|
||||
=======
|
||||
private final Region region;
|
||||
private BlockVector3 origin;
|
||||
private final BlockStateHolder[][][] blocks;
|
||||
private final List<ClipboardEntity> entities = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -112,9 +98,9 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
this.mx = origin.getBlockX();
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
this.blocks = new BlockStateHolder[size.getBlockX()][size.getBlockY()][size.getBlockZ()];
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public BlockArrayClipboard(Region region, FaweClipboard clipboard) {
|
||||
checkNotNull(region);
|
||||
this.region = region.clone();
|
||||
@ -124,6 +110,7 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
this.IMP = clipboard;
|
||||
this.blocks = new BlockStateHolder[size.getBlockX()][size.getBlockY()][size.getBlockZ()];
|
||||
}
|
||||
|
||||
public void init(Region region, FaweClipboard fc) {
|
||||
@ -136,6 +123,7 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
this.mx = origin.getBlockX();
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
this.blocks = new BlockStateHolder[size.getBlockX()][size.getBlockY()][size.getBlockZ()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -146,10 +134,6 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
@Override
|
||||
public void close() {
|
||||
IMP.close();
|
||||
=======
|
||||
BlockVector3 dimensions = getDimensions();
|
||||
blocks = new BlockStateHolder[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()];
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -189,15 +173,9 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
<<<<<<< HEAD
|
||||
List<Entity> filtered = new ArrayList<Entity>();
|
||||
for (Entity entity : getEntities()) {
|
||||
if (region.contains(entity.getLocation().toVector())) {
|
||||
=======
|
||||
List<Entity> filtered = new ArrayList<>();
|
||||
for (Entity entity : entities) {
|
||||
for (Entity entity : getEntities()) {
|
||||
if (region.contains(entity.getLocation().toVector().toBlockPoint())) {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
filtered.add(entity);
|
||||
}
|
||||
}
|
||||
@ -218,18 +196,18 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
if (region.contains(position)) {
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
int x = position.getBlockX() - mx;
|
||||
int y = position.getBlockY() - my;
|
||||
int z = position.getBlockZ() - mz;
|
||||
return IMP.getBlock(x, y, z);
|
||||
=======
|
||||
BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
||||
if (block != null) {
|
||||
return block.toImmutableState();
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
// BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
||||
// if (block != null) {
|
||||
// return block.toImmutableState();
|
||||
// }
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
return EditSession.nullBlock;
|
||||
}
|
||||
@ -239,43 +217,42 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
//<<<<<<< HEAD
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return getBlock(position);
|
||||
}
|
||||
=======
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if (region.contains(position)) {
|
||||
BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
||||
if (block != null) {
|
||||
return block.toBaseBlock();
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
// if (region.contains(position)) {
|
||||
// BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
// BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
||||
// if (block != null) {
|
||||
// return block.toBaseBlock();
|
||||
// }
|
||||
// }
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
@Override
|
||||
public BlockState getFullBlock(Vector position) {
|
||||
public BlockState getFullBlock(BlockVector3 position) {
|
||||
return getLazyBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
if (region.contains(location)) {
|
||||
final int x = location.getBlockX();
|
||||
final int y = location.getBlockY();
|
||||
final int z = location.getBlockZ();
|
||||
return setBlock(x, y, z, block);
|
||||
=======
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
if (region.contains(position)) {
|
||||
BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()] = block;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
// if (region.contains(position)) {
|
||||
// BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
// blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()] = block;
|
||||
// return true;
|
||||
// } else {
|
||||
// return false;
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -296,28 +273,18 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
int x = position.getBlockX() - mx;
|
||||
int z = position.getBlockZ() - mz;
|
||||
return IMP.getBiome(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
int x = position.getBlockX() - mx;
|
||||
int z = position.getBlockZ() - mz;
|
||||
IMP.setBiome(x, z, biome.getId());
|
||||
return true;
|
||||
=======
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return new BaseBiome(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return false;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -345,17 +312,11 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
|
||||
@Override
|
||||
public int getOpacity(int x, int y, int z) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mutable.mutZ(z);
|
||||
return getBlock(mutable).getBlockType().getMaterial().getLightOpacity();
|
||||
return getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().getLightOpacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mutable.mutZ(z);
|
||||
return getBlock(mutable).getBlockType().getMaterial().getLightValue();
|
||||
return getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().getLightValue();
|
||||
}
|
||||
}
|
@ -38,12 +38,12 @@ import com.google.gson.Gson;
|
||||
import com.sk89q.jnbt.*;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -304,7 +304,7 @@ public enum ClipboardFormat {
|
||||
// summary
|
||||
// blocks
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
Vector dimensions = clipboard.getDimensions();
|
||||
BlockVector3 dimensions = clipboard.getDimensions();
|
||||
map.put("width", dimensions.getX());
|
||||
map.put("height", dimensions.getY());
|
||||
map.put("length", dimensions.getZ());
|
||||
|
@ -31,6 +31,7 @@ import com.sk89q.jnbt.ShortTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
@ -225,7 +226,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
|
||||
try {
|
||||
if (state != null) {
|
||||
if (tileEntitiesMap.containsKey(pt)) {
|
||||
clipboard.setBlock(region.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt))));
|
||||
clipboard.setBlock(region.getMinimumPoint().add(pt), /*state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))*/new BaseBlock(state, new CompoundTag(tileEntitiesMap.get(pt))));
|
||||
} else {
|
||||
clipboard.setBlock(region.getMinimumPoint().add(pt), state);
|
||||
}
|
||||
|
@ -42,12 +42,7 @@ import com.sk89q.jnbt.NamedTag;
|
||||
import com.sk89q.jnbt.ShortTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
@ -108,68 +103,214 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
return read(UUID.randomUUID());
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Override
|
||||
public Clipboard read(UUID uuid) throws IOException {
|
||||
return readVersion1(uuid);
|
||||
}
|
||||
=======
|
||||
private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
|
||||
BlockVector3 origin;
|
||||
Region region;
|
||||
|
||||
Map<String, Tag> metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
// private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
|
||||
// BlockVector3 origin;
|
||||
// Region region;
|
||||
//
|
||||
// Map<String, Tag> metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue();
|
||||
// }
|
||||
private int width, height, length;
|
||||
private int offsetX, offsetY, offsetZ;
|
||||
private char[] palette;
|
||||
private Vector min;
|
||||
private BlockVector3 min;
|
||||
private FaweClipboard fc;
|
||||
|
||||
private FaweClipboard setupClipboard(int size, UUID uuid) {
|
||||
if (fc != null) {
|
||||
if (fc.getDimensions().getX() == 0) {
|
||||
fc.setDimensions(new Vector(size, 1, 1));
|
||||
fc.setDimensions(new BlockVector3(size, 1, 1));
|
||||
}
|
||||
return fc;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
if (Settings.IMP.CLIPBOARD.USE_DISK) {
|
||||
return fc = new DiskOptimizedClipboard(size, 1, 1, uuid);
|
||||
} else if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL == 0) {
|
||||
return fc = new CPUOptimizedClipboard(size, 1, 1);
|
||||
} else {
|
||||
return fc = new MemoryOptimizedClipboard(size, 1, 1);
|
||||
=======
|
||||
|
||||
BlockVector3 min = new BlockVector3(offsetParts[0], offsetParts[1], offsetParts[2]);
|
||||
|
||||
if (metadata.containsKey("WEOffsetX")) {
|
||||
// We appear to have WorldEdit Metadata
|
||||
int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue();
|
||||
int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue();
|
||||
int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue();
|
||||
BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ);
|
||||
origin = min.subtract(offset);
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
} else {
|
||||
origin = min;
|
||||
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
}
|
||||
|
||||
int paletteMax = requireTag(schematic, "PaletteMax", IntTag.class).getValue();
|
||||
Map<String, Tag> paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue();
|
||||
if (paletteObject.size() != paletteMax) {
|
||||
throw new IOException("Differing given palette size to actual size");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
// BlockVector3 min = new BlockVector3(offsetParts[0], offsetParts[1], offsetParts[2]);
|
||||
//
|
||||
// if (metadata.containsKey("WEOffsetX")) {
|
||||
// // We appear to have WorldEdit Metadata
|
||||
// int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue();
|
||||
// int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue();
|
||||
// int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue();
|
||||
// BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ);
|
||||
// origin = min.subtract(offset);
|
||||
// region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
// } else {
|
||||
// origin = min;
|
||||
// region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
// }
|
||||
//
|
||||
// int paletteMax = requireTag(schematic, "PaletteMax", IntTag.class).getValue();
|
||||
// Map<String, Tag> paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue();
|
||||
// if (paletteObject.size() != paletteMax) {
|
||||
// throw new IOException("Differing given palette size to actual size");
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
// private Clipboard readVersion1(UUID uuid) throws IOException {
|
||||
// width = height = length = offsetX = offsetY = offsetZ = Integer.MIN_VALUE;
|
||||
//
|
||||
// final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new Vector(0, 0, 0), new Vector(0, 0, 0)), fc);
|
||||
// FastByteArrayOutputStream blocksOut = new FastByteArrayOutputStream();
|
||||
// FastByteArrayOutputStream biomesOut = new FastByteArrayOutputStream();
|
||||
//
|
||||
// NBTStreamer streamer = new NBTStreamer(inputStream);
|
||||
// streamer.addReader("Schematic.Width", (BiConsumer<Integer, Short>) (i, v) -> width = v);
|
||||
// streamer.addReader("Schematic.Height", (BiConsumer<Integer, Short>) (i, v) -> height = v);
|
||||
// streamer.addReader("Schematic.Length", (BiConsumer<Integer, Short>) (i, v) -> length = v);
|
||||
// streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector(v[0], v[1], v[2]));
|
||||
// streamer.addReader("Schematic.Metadata.WEOffsetX", (BiConsumer<Integer, Integer>) (i, v) -> offsetX = v);
|
||||
// streamer.addReader("Schematic.Metadata.WEOffsetY", (BiConsumer<Integer, Integer>) (i, v) -> offsetY = v);
|
||||
// streamer.addReader("Schematic.Metadata.WEOffsetZ", (BiConsumer<Integer, Integer>) (i, v) -> offsetZ = v);
|
||||
// streamer.addReader("Schematic.Palette", (BiConsumer<Integer, HashMap<String, Tag>>) (i, v) -> {
|
||||
// palette = new char[v.size()];
|
||||
// for (Map.Entry<String, Tag> entry : v.entrySet()) {
|
||||
// BlockState state = BlockState.get(entry.getKey());
|
||||
// int index = ((IntTag) entry.getValue()).getValue();
|
||||
// palette[index] = (char) state.getOrdinal();
|
||||
// }
|
||||
//<<<<<<< HEAD
|
||||
// });
|
||||
// streamer.addReader("Schematic.BlockData.#", new NBTStreamer.LazyReader() {
|
||||
// @Override
|
||||
// public void accept(Integer arrayLen, DataInputStream dis) {
|
||||
// try (FaweOutputStream blocks = new FaweOutputStream(new LZ4BlockOutputStream(blocksOut))) {
|
||||
// IOUtil.copy(dis, blocks, arrayLen);
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//=======
|
||||
// palette.put(id, state);
|
||||
// }
|
||||
//
|
||||
// byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue();
|
||||
//
|
||||
// Map<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
||||
// try {
|
||||
// List<Map<String, Tag>> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream()
|
||||
// .map(tag -> (CompoundTag) tag)
|
||||
// .map(CompoundTag::getValue)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// for (Map<String, Tag> tileEntity : tileEntityTags) {
|
||||
// int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
|
||||
// tileEntitiesMap.put(new BlockVector3(pos[0], pos[1], pos[2]), tileEntity);
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// }
|
||||
// });
|
||||
// streamer.addReader("Schematic.Biomes.#", new NBTStreamer.LazyReader() {
|
||||
// @Override
|
||||
// public void accept(Integer arrayLen, DataInputStream dis) {
|
||||
// try (FaweOutputStream biomes = new FaweOutputStream(new LZ4BlockOutputStream(biomesOut))) {
|
||||
// IOUtil.copy(dis, biomes, arrayLen);
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// streamer.addReader("Schematic.TileEntities.#", new BiConsumer<Integer, CompoundTag>() {
|
||||
// @Override
|
||||
// public void accept(Integer index, CompoundTag value) {
|
||||
// if (fc == null) {
|
||||
// setupClipboard(0, uuid);
|
||||
// }
|
||||
// int[] pos = value.getIntArray("Pos");
|
||||
// int x = pos[0];
|
||||
// int y = pos[1];
|
||||
// int z = pos[2];
|
||||
// fc.setTile(x, y, z, value);
|
||||
// }
|
||||
// });
|
||||
// streamer.addReader("Schematic.Entities.#", new BiConsumer<Integer, CompoundTag>() {
|
||||
// @Override
|
||||
// public void accept(Integer index, CompoundTag compound) {
|
||||
// if (fc == null) {
|
||||
// setupClipboard(0, uuid);
|
||||
// }
|
||||
// String id = compound.getString("id");
|
||||
// if (id.isEmpty()) {
|
||||
// return;
|
||||
// }
|
||||
// ListTag positionTag = compound.getListTag("Pos");
|
||||
// ListTag directionTag = compound.getListTag("Rotation");
|
||||
// EntityType type = EntityTypes.parse(id);
|
||||
// if (type != null) {
|
||||
// compound.getValue().put("Id", new StringTag(type.getId()));
|
||||
// BaseEntity state = new BaseEntity(type, compound);
|
||||
// fc.createEntity(clipboard, positionTag.asDouble(0), positionTag.asDouble(1), positionTag.asDouble(2), (float) directionTag.asDouble(0), (float) directionTag.asDouble(1), state);
|
||||
// } else {
|
||||
// Fawe.debug("Invalid entity: " + id);
|
||||
// }
|
||||
// }
|
||||
//<<<<<<< HEAD
|
||||
// });
|
||||
// streamer.readFully();
|
||||
// if (fc == null) setupClipboard(length * width * height, uuid);
|
||||
// Vector origin = min;
|
||||
// CuboidRegion region;
|
||||
// if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
|
||||
// origin = origin.subtract(new Vector(offsetX, offsetY, offsetZ));
|
||||
// region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
|
||||
// } else {
|
||||
// region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
|
||||
// }
|
||||
// if (blocksOut.getSize() != 0) {
|
||||
// try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(blocksOut.toByteArrays())))) {
|
||||
// int volume = width * height * length;
|
||||
// if (palette.length < 128) {
|
||||
// for (int index = 0; index < volume; index++) {
|
||||
// BlockState state = BlockTypes.states[palette[fis.read()]];
|
||||
// fc.setBlock(index, state);
|
||||
//=======
|
||||
// // index = (y * length + z) * width + x
|
||||
// int y = index / (width * length);
|
||||
// int z = (index % (width * length)) / width;
|
||||
// int x = (index % (width * length)) % width;
|
||||
// BlockState state = palette.get(value);
|
||||
// BlockVector3 pt = new BlockVector3(x, y, z);
|
||||
// try {
|
||||
// if (tileEntitiesMap.containsKey(pt)) {
|
||||
// Map<String, Tag> values = Maps.newHashMap(tileEntitiesMap.get(pt));
|
||||
// for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
|
||||
// if (handler.isAffectedBlock(state)) {
|
||||
// handler.updateNBT(state, values);
|
||||
// }
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// }
|
||||
// } else {
|
||||
// for (int index = 0; index < volume; index++) {
|
||||
// BlockState state = BlockTypes.states[palette[fis.readVarInt()]];
|
||||
// fc.setBlock(index, state);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (biomesOut.getSize() != 0) {
|
||||
// try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(biomesOut.toByteArrays())))) {
|
||||
// int volume = width * length;
|
||||
// for (int index = 0; index < volume; index++) {
|
||||
// fc.setBiome(index, fis.read());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// fc.setDimensions(new Vector(width, height, length));
|
||||
// clipboard.init(region, fc);
|
||||
// clipboard.setOrigin(origin);
|
||||
// return clipboard;
|
||||
// }
|
||||
|
||||
private Clipboard readVersion1(UUID uuid) throws IOException {
|
||||
width = height = length = offsetX = offsetY = offsetZ = Integer.MIN_VALUE;
|
||||
|
||||
final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new Vector(0, 0, 0), new Vector(0, 0, 0)), fc);
|
||||
final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(0, 0, 0)), fc);
|
||||
FastByteArrayOutputStream blocksOut = new FastByteArrayOutputStream();
|
||||
FastByteArrayOutputStream biomesOut = new FastByteArrayOutputStream();
|
||||
|
||||
@ -177,7 +318,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
streamer.addReader("Schematic.Width", (BiConsumer<Integer, Short>) (i, v) -> width = v);
|
||||
streamer.addReader("Schematic.Height", (BiConsumer<Integer, Short>) (i, v) -> height = v);
|
||||
streamer.addReader("Schematic.Length", (BiConsumer<Integer, Short>) (i, v) -> length = v);
|
||||
streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector(v[0], v[1], v[2]));
|
||||
streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector3(v[0], v[1], v[2]));
|
||||
streamer.addReader("Schematic.Metadata.WEOffsetX", (BiConsumer<Integer, Integer>) (i, v) -> offsetX = v);
|
||||
streamer.addReader("Schematic.Metadata.WEOffsetY", (BiConsumer<Integer, Integer>) (i, v) -> offsetY = v);
|
||||
streamer.addReader("Schematic.Metadata.WEOffsetZ", (BiConsumer<Integer, Integer>) (i, v) -> offsetZ = v);
|
||||
@ -188,7 +329,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
int index = ((IntTag) entry.getValue()).getValue();
|
||||
palette[index] = (char) state.getOrdinal();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
});
|
||||
streamer.addReader("Schematic.BlockData.#", new NBTStreamer.LazyReader() {
|
||||
@Override
|
||||
@ -198,23 +338,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
=======
|
||||
palette.put(id, state);
|
||||
}
|
||||
|
||||
byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue();
|
||||
|
||||
Map<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
||||
try {
|
||||
List<Map<String, Tag>> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream()
|
||||
.map(tag -> (CompoundTag) tag)
|
||||
.map(CompoundTag::getValue)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (Map<String, Tag> tileEntity : tileEntityTags) {
|
||||
int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
|
||||
tileEntitiesMap.put(new BlockVector3(pos[0], pos[1], pos[2]), tileEntity);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
});
|
||||
streamer.addReader("Schematic.Biomes.#", new NBTStreamer.LazyReader() {
|
||||
@ -261,17 +384,16 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
Fawe.debug("Invalid entity: " + id);
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
});
|
||||
streamer.readFully();
|
||||
if (fc == null) setupClipboard(length * width * height, uuid);
|
||||
Vector origin = min;
|
||||
BlockVector3 origin = min;
|
||||
CuboidRegion region;
|
||||
if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
|
||||
origin = origin.subtract(new Vector(offsetX, offsetY, offsetZ));
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
|
||||
origin = origin.subtract(new BlockVector3(offsetX, offsetY, offsetZ));
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
} else {
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
}
|
||||
if (blocksOut.getSize() != 0) {
|
||||
try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(blocksOut.toByteArrays())))) {
|
||||
@ -280,21 +402,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
for (int index = 0; index < volume; index++) {
|
||||
BlockState state = BlockTypes.states[palette[fis.read()]];
|
||||
fc.setBlock(index, state);
|
||||
=======
|
||||
// index = (y * length + z) * width + x
|
||||
int y = index / (width * length);
|
||||
int z = (index % (width * length)) / width;
|
||||
int x = (index % (width * length)) % width;
|
||||
BlockState state = palette.get(value);
|
||||
BlockVector3 pt = new BlockVector3(x, y, z);
|
||||
try {
|
||||
if (tileEntitiesMap.containsKey(pt)) {
|
||||
Map<String, Tag> values = Maps.newHashMap(tileEntitiesMap.get(pt));
|
||||
for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
|
||||
if (handler.isAffectedBlock(state)) {
|
||||
handler.updateNBT(state, values);
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
} else {
|
||||
for (int index = 0; index < volume; index++) {
|
||||
@ -312,12 +419,13 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
}
|
||||
}
|
||||
}
|
||||
fc.setDimensions(new Vector(width, height, length));
|
||||
fc.setDimensions(new BlockVector3(width, height, length));
|
||||
clipboard.init(region, fc);
|
||||
clipboard.setOrigin(origin);
|
||||
return clipboard;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
inputStream.close();
|
||||
|
@ -27,23 +27,14 @@ import com.sk89q.jnbt.NBTConstants;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
import net.jpountz.lz4.LZ4BlockOutputStream;
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -83,15 +74,9 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
public void write1(Clipboard clipboard) throws IOException {
|
||||
// metadata
|
||||
Region region = clipboard.getRegion();
|
||||
<<<<<<< HEAD
|
||||
Vector origin = clipboard.getOrigin();
|
||||
BlockVector min = region.getMinimumPoint().toBlockVector();
|
||||
Vector offset = min.subtract(origin);
|
||||
=======
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 offset = min.subtract(origin);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int width = region.getWidth();
|
||||
int height = region.getHeight();
|
||||
int length = region.getLength();
|
||||
@ -104,7 +89,7 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
if (length > MAX_SIZE) {
|
||||
throw new IllegalArgumentException("Length of region too large for a .schematic");
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
// output
|
||||
final DataOutput rawStream = outputStream.getOutputStream();
|
||||
outputStream.writeLazyCompoundTag("Schematic", out -> {
|
||||
@ -157,49 +142,49 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
}));
|
||||
numTiles[0]++;
|
||||
tilesOut.writeTagPayload(tile);
|
||||
=======
|
||||
|
||||
Map<String, Tag> schematic = new HashMap<>();
|
||||
schematic.put("Version", new IntTag(1));
|
||||
|
||||
Map<String, Tag> metadata = new HashMap<>();
|
||||
metadata.put("WEOffsetX", new IntTag(offset.getBlockX()));
|
||||
metadata.put("WEOffsetY", new IntTag(offset.getBlockY()));
|
||||
metadata.put("WEOffsetZ", new IntTag(offset.getBlockZ()));
|
||||
|
||||
schematic.put("Metadata", new CompoundTag(metadata));
|
||||
|
||||
schematic.put("Width", new ShortTag((short) width));
|
||||
schematic.put("Height", new ShortTag((short) height));
|
||||
schematic.put("Length", new ShortTag((short) length));
|
||||
|
||||
// The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
|
||||
schematic.put("Offset", new IntArrayTag(new int[]{
|
||||
min.getBlockX(),
|
||||
min.getBlockY(),
|
||||
min.getBlockZ(),
|
||||
}));
|
||||
|
||||
int paletteMax = 0;
|
||||
Map<String, Integer> palette = new HashMap<>();
|
||||
|
||||
List<CompoundTag> tileEntities = new ArrayList<>();
|
||||
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length);
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
int y0 = min.getBlockY() + y;
|
||||
for (int z = 0; z < length; z++) {
|
||||
int z0 = min.getBlockZ() + z;
|
||||
for (int x = 0; x < width; x++) {
|
||||
int x0 = min.getBlockX() + x;
|
||||
BlockVector3 point = new BlockVector3(x0, y0, z0);
|
||||
BaseBlock block = clipboard.getFullBlock(point);
|
||||
if (block.getNbtData() != null) {
|
||||
Map<String, Tag> values = new HashMap<>();
|
||||
for (Map.Entry<String, Tag> entry : block.getNbtData().getValue().entrySet()) {
|
||||
values.put(entry.getKey(), entry.getValue());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
//
|
||||
// Map<String, Tag> schematic = new HashMap<>();
|
||||
// schematic.put("Version", new IntTag(1));
|
||||
//
|
||||
// Map<String, Tag> metadata = new HashMap<>();
|
||||
// metadata.put("WEOffsetX", new IntTag(offset.getBlockX()));
|
||||
// metadata.put("WEOffsetY", new IntTag(offset.getBlockY()));
|
||||
// metadata.put("WEOffsetZ", new IntTag(offset.getBlockZ()));
|
||||
//
|
||||
// schematic.put("Metadata", new CompoundTag(metadata));
|
||||
//
|
||||
// schematic.put("Width", new ShortTag((short) width));
|
||||
// schematic.put("Height", new ShortTag((short) height));
|
||||
// schematic.put("Length", new ShortTag((short) length));
|
||||
//
|
||||
// // The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
|
||||
// schematic.put("Offset", new IntArrayTag(new int[]{
|
||||
// min.getBlockX(),
|
||||
// min.getBlockY(),
|
||||
// min.getBlockZ(),
|
||||
// }));
|
||||
//
|
||||
// int paletteMax = 0;
|
||||
// Map<String, Integer> palette = new HashMap<>();
|
||||
//
|
||||
// List<CompoundTag> tileEntities = new ArrayList<>();
|
||||
//
|
||||
// ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length);
|
||||
//
|
||||
// for (int y = 0; y < height; y++) {
|
||||
// int y0 = min.getBlockY() + y;
|
||||
// for (int z = 0; z < length; z++) {
|
||||
// int z0 = min.getBlockZ() + z;
|
||||
// for (int x = 0; x < width; x++) {
|
||||
// int x0 = min.getBlockX() + x;
|
||||
// BlockVector3 point = new BlockVector3(x0, y0, z0);
|
||||
// BaseBlock block = clipboard.getFullBlock(point);
|
||||
// if (block.getNbtData() != null) {
|
||||
// Map<String, Tag> values = new HashMap<>();
|
||||
// for (Map.Entry<String, Tag> entry : block.getNbtData().getValue().entrySet()) {
|
||||
// values.put(entry.getKey(), entry.getValue());
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
int ordinal = block.getOrdinal();
|
||||
char value = palette[ordinal];
|
||||
@ -221,7 +206,7 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
if (clipboard instanceof BlockArrayClipboard) {
|
||||
((BlockArrayClipboard) clipboard).IMP.forEach(reader, true);
|
||||
} else {
|
||||
for (Vector pt : region) {
|
||||
for (BlockVector3 pt : region) {
|
||||
BlockState block = clipboard.getBlock(pt);
|
||||
int x = pt.getBlockX() - min.getBlockX();
|
||||
int y = pt.getBlockY() - min.getBlockY();
|
||||
|
@ -1,18 +1,14 @@
|
||||
package com.sk89q.worldedit.extent.inventory;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
=======
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -90,15 +86,15 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean setBlock(Vector pos, BlockStateHolder block) throws WorldEditException {
|
||||
//<<<<<<< HEAD
|
||||
public boolean setBlock(BlockVector3 pos, BlockStateHolder block) throws WorldEditException {
|
||||
return setBlock(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), block);
|
||||
}
|
||||
=======
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
if (blockBag != null) {
|
||||
BlockState existing = getExtent().getBlock(position);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
// if (blockBag != null) {
|
||||
// BlockState existing = getExtent().getBlock(position);
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.logging;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
@ -47,11 +47,11 @@ public abstract class AbstractLoggingExtent extends AbstractDelegateExtent {
|
||||
* @param position the position
|
||||
* @param newBlock the new block to replace the old one
|
||||
*/
|
||||
protected void onBlockChange(Vector position, BlockStateHolder newBlock) {
|
||||
protected void onBlockChange(BlockVector3 position, BlockStateHolder newBlock) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
||||
public final boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
onBlockChange(position, block);
|
||||
return super.setBlock(position, block);
|
||||
}
|
||||
|
@ -19,13 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.reorder;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.google.common.collect.Iterables;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.Blocks;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
@ -34,11 +29,8 @@ import com.sk89q.worldedit.function.operation.BlockMapEntryPlacer;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.OperationQueue;
|
||||
import com.sk89q.worldedit.function.operation.RunContext;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.function.operation.SetLocatedBlocks;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.collection.TupleArrayList;
|
||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||
|
@ -1,13 +1,10 @@
|
||||
package com.sk89q.worldedit.extent.transform;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.ByteTag;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -15,25 +12,20 @@ import com.sk89q.worldedit.internal.helper.MCDirections;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.registry.state.BooleanProperty;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.registry.state.DirectionalProperty;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -43,6 +35,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Transforms blocks themselves (but not their position) according to a
|
||||
@ -77,71 +70,12 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
|
||||
case ROTATION:
|
||||
|
||||
<<<<<<< HEAD
|
||||
case AXIS:
|
||||
|
||||
case FACING:
|
||||
|
||||
case SHAPE:
|
||||
=======
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return transformBlock(super.getBlock(position), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return transformBlock(super.getFullBlock(position), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
return super.setBlock(location, transformBlock(block, true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Transform the given block using the given transform.
|
||||
*
|
||||
* <p>The provided block is modified.</p>
|
||||
*
|
||||
* @param block the block
|
||||
* @param transform the transform
|
||||
* @return the same block
|
||||
*/
|
||||
public static <T extends BlockStateHolder> T transform(T block, Transform transform) {
|
||||
return transform(block, transform, block);
|
||||
}
|
||||
|
||||
private static final Set<String> directionNames = Sets.newHashSet("north", "south", "east", "west");
|
||||
|
||||
/**
|
||||
* Transform the given block using the given transform.
|
||||
*
|
||||
* @param block the block
|
||||
* @param transform the transform
|
||||
* @param changedBlock the block to change
|
||||
* @return the changed block
|
||||
*/
|
||||
private static <T extends BlockStateHolder> T transform(T block, Transform transform, T changedBlock) {
|
||||
checkNotNull(block);
|
||||
checkNotNull(transform);
|
||||
|
||||
List<? extends Property> properties = block.getBlockType().getProperties();
|
||||
|
||||
for (Property property : properties) {
|
||||
if (property instanceof DirectionalProperty) {
|
||||
Direction value = (Direction) block.getState(property);
|
||||
if (value != null) {
|
||||
Vector3 newValue = getNewStateValue((DirectionalProperty) property, transform, value.toVector());
|
||||
if (newValue != null) {
|
||||
changedBlock = (T) changedBlock.with(property, Direction.findClosest(newValue, Direction.Flag.ALL));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
|
||||
case NORTH:
|
||||
case EAST:
|
||||
case SOUTH:
|
||||
@ -150,21 +84,79 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// @Override
|
||||
// public BlockState getBlock(BlockVector3 position) {
|
||||
// return transformBlock(super.getBlock(position), false);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
// return transformBlock(super.getFullBlock(position), false);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
// return super.setBlock(location, transformBlock(block, true));
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * Transform the given block using the given transform.
|
||||
// *
|
||||
// * <p>The provided block is modified.</p>
|
||||
// *
|
||||
// * @param block the block
|
||||
// * @param transform the transform
|
||||
// * @return the same block
|
||||
// */
|
||||
// public static <T extends BlockStateHolder> T transform(T block, Transform transform) {
|
||||
// return transform(block, transform, block);
|
||||
// }
|
||||
|
||||
private static final Set<String> directionNames = Sets.newHashSet("north", "south", "east", "west");
|
||||
|
||||
// /**
|
||||
// * Transform the given block using the given transform.
|
||||
// *
|
||||
// * @param block the block
|
||||
// * @param transform the transform
|
||||
// * @param changedBlock the block to change
|
||||
// * @return the changed block
|
||||
// */
|
||||
// private static <T extends BlockStateHolder> T transform(T block, Transform transform, T changedBlock) {
|
||||
// checkNotNull(block);
|
||||
// checkNotNull(transform);
|
||||
//
|
||||
// List<? extends Property> properties = block.getBlockType().getProperties();
|
||||
//
|
||||
// for (Property property : properties) {
|
||||
// if (property instanceof DirectionalProperty) {
|
||||
// Direction value = (Direction) block.getState(property);
|
||||
// if (value != null) {
|
||||
// Vector3 newValue = getNewStateValue((DirectionalProperty) property, transform, value.toVector());
|
||||
// if (newValue != null) {
|
||||
// changedBlock = (T) changedBlock.with(property, Direction.findClosest(newValue, Direction.Flag.ALL));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@Nullable
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
private static Integer getNewStateIndex(Transform transform, List<Direction> directions, int oldIndex) {
|
||||
Direction oldDirection = directions.get(oldIndex);
|
||||
Vector oldVector = oldDirection.toVector();
|
||||
Vector newVector = transform.apply(oldVector).subtract(transform.apply(Vector.ZERO)).normalize();
|
||||
Vector3 oldVector = oldDirection.toVector();
|
||||
Vector3 newVector = transform.apply(oldVector).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||
int newIndex = oldIndex;
|
||||
double closest = oldVector.toVector().normalize().dot(newVector);
|
||||
=======
|
||||
private static Vector3 getNewStateValue(DirectionalProperty state, Transform transform, Vector3 oldDirection) {
|
||||
Vector3 newDirection = transform.apply(oldDirection).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||
Vector3 newValue = null;
|
||||
double closest = -2;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
double closest = oldVector.normalize().dot(newVector);
|
||||
//=======
|
||||
// private static Vector3 getNewStateValue(DirectionalProperty state, Transform transform, Vector3 oldDirection) {
|
||||
// Vector3 newDirection = transform.apply(oldDirection).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||
// Vector3 newValue = null;
|
||||
// double closest = -2;
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
boolean found = false;
|
||||
|
||||
for (int i = 0; i < directions.size(); i++) {
|
||||
@ -265,13 +257,10 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
Direction direction = MCDirections.fromRotation(rot);
|
||||
|
||||
if (direction != null) {
|
||||
Vector applyAbsolute = transform.apply(direction.toVector());
|
||||
Vector applyOrigin = transform.apply(Vector.ZERO);
|
||||
applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX());
|
||||
applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY());
|
||||
applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ());
|
||||
Vector3 applyAbsolute = transform.apply(direction.toVector());
|
||||
Vector3 applyOrigin = transform.apply(Vector3.ZERO);
|
||||
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute, Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute.subtract(applyOrigin), Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||
|
||||
if (newDirection != null) {
|
||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
||||
@ -294,13 +283,10 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
Direction direction = MCDirections.fromRotation(rot);
|
||||
|
||||
if (direction != null) {
|
||||
Vector applyAbsolute = transformInverse.apply(direction.toVector());
|
||||
Vector applyOrigin = transformInverse.apply(Vector.ZERO);
|
||||
applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX());
|
||||
applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY());
|
||||
applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ());
|
||||
Vector3 applyAbsolute = transformInverse.apply(direction.toVector());
|
||||
Vector3 applyOrigin = transformInverse.apply(Vector3.ZERO);
|
||||
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute, Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute.subtract(applyOrigin), Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||
|
||||
if (newDirection != null) {
|
||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
||||
@ -319,17 +305,17 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return transformFast(super.getLazyBlock(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(Vector position) {
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return transformFast(super.getBlock(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return super.getBiome(position);
|
||||
}
|
||||
|
||||
@ -340,7 +326,7 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
return super.setBlock(location, transformFastInverse((BlockState) block));
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,10 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
<<<<<<< HEAD
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Limits the number of blocks that can be changed before a
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.validation;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
@ -22,13 +22,10 @@ package com.sk89q.worldedit.extent.world;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.world;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
@ -19,13 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.world;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
@ -19,13 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.world;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -98,7 +93,7 @@ public class SurvivalModeExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
if (toolUse && block.getBlockType().getMaterial().isAir()) {
|
||||
world.simulateBlockMine(MutableBlockVector.get(x, y, z));
|
||||
world.simulateBlockMine(new BlockVector3(x, y, z));
|
||||
return true;
|
||||
} else {
|
||||
return super.setBlock(x, y, z, block);
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ public class RegionMaskTestFunction implements RegionFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
if (mask.test(position)) {
|
||||
return pass.apply(position);
|
||||
} else {
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.biome;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.block;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
@ -56,13 +52,15 @@ public class BlockReplace implements RegionFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
return pattern.apply(extent, position, position);
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
// public boolean apply(Vector position) throws WorldEditException {
|
||||
// return pattern.apply(extent, position, position);
|
||||
//=======
|
||||
// public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
// return extent.setBlock(position, pattern.apply(position));
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
return extent.setBlock(position, pattern.apply(position));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return pattern.apply(extent, position, position);
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,16 +22,12 @@ package com.sk89q.worldedit.function.block;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.ByteTag;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import com.sk89q.jnbt.CompoundTagBuilder;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.internal.helper.MCDirections;
|
||||
@ -40,16 +36,13 @@ import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Direction.Flag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
/**
|
||||
* Copies blocks from one extent to another.
|
||||
@ -85,16 +78,16 @@ public class ExtentBlockCopy implements RegionFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
Vector orig = position.subtract(from);
|
||||
Vector transformed = transform.apply(orig);
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
BaseBlock block = source.getFullBlock(position);
|
||||
BlockVector3 orig = position.subtract(from);
|
||||
BlockVector3 transformed = transform.apply(orig.toVector3()).toBlockPoint();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
// BaseBlock block = source.getFullBlock(position);
|
||||
// BlockVector3 orig = position.subtract(from);
|
||||
// BlockVector3 transformed = transform.apply(orig.toVector3()).toBlockPoint();
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
// Apply transformations to NBT data if necessary
|
||||
BlockStateHolder block = transformNbtData(source.getBlock(position));
|
||||
@ -119,18 +112,18 @@ public class ExtentBlockCopy implements RegionFunction {
|
||||
Direction direction = MCDirections.fromRotation(rot);
|
||||
|
||||
if (direction != null) {
|
||||
<<<<<<< HEAD
|
||||
Vector applyAbsolute = transform.apply(direction.toVector());
|
||||
Vector applyOrigin = transform.apply(Vector.ZERO);
|
||||
applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX());
|
||||
applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY());
|
||||
applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ());
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
// Vector applyAbsolute = transform.apply(direction.toVector());
|
||||
// Vector applyOrigin = transform.apply(Vector.ZERO);
|
||||
// applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX());
|
||||
// applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY());
|
||||
// applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ());
|
||||
//=======
|
||||
Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||
Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL | Flag.ORDINAL | Flag.SECONDARY_ORDINAL);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute, Flag.CARDINAL | Flag.ORDINAL | Flag.SECONDARY_ORDINAL);
|
||||
// Direction newDirection = Direction.findClosest(applyAbsolute, Flag.CARDINAL | Flag.ORDINAL | Flag.SECONDARY_ORDINAL);
|
||||
|
||||
if (newDirection != null) {
|
||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
||||
|
@ -29,13 +29,10 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.function.LayerFunction;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
<<<<<<< HEAD
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Makes a layer of grass on top, three layers of dirt below, and smooth stone
|
||||
|
@ -22,15 +22,11 @@ package com.sk89q.worldedit.function.entity;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.ByteTag;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.jnbt.FloatTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.sk89q.jnbt.CompoundTagBuilder;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
@ -105,19 +101,19 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
Location newLocation;
|
||||
Location location = entity.getLocation();
|
||||
|
||||
<<<<<<< HEAD
|
||||
Vector pivot = from.round().add(0.5, 0.5, 0.5);
|
||||
Vector newPosition = transform.apply(location.toVector().subtract(pivot));
|
||||
Vector newDirection;
|
||||
if (transform.isIdentity()) {
|
||||
newDirection = entity.getLocation().getDirection();
|
||||
newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||
} else {
|
||||
newDirection = new Vector(transform.apply(location.getDirection())).subtract(transform.apply(Vector.ZERO)).normalize();
|
||||
newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||
state = transformNbtData(state);
|
||||
}
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
// Vector pivot = from.round().add(0.5, 0.5, 0.5);
|
||||
// Vector newPosition = transform.apply(location.toVector().subtract(pivot));
|
||||
// Vector newDirection;
|
||||
// if (transform.isIdentity()) {
|
||||
// newDirection = entity.getLocation().getDirection();
|
||||
// newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||
// } else {
|
||||
// newDirection = new Vector(transform.apply(location.getDirection())).subtract(transform.apply(Vector.ZERO)).normalize();
|
||||
// newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||
// state = transformNbtData(state);
|
||||
// }
|
||||
//=======
|
||||
Vector3 pivot = from.round().add(0.5, 0.5, 0.5);
|
||||
Vector3 newPosition = transform.apply(location.toVector().subtract(pivot));
|
||||
Vector3 newDirection;
|
||||
@ -129,7 +125,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
|
||||
// Some entities store their position data in NBT
|
||||
state = transformNbtData(state);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
boolean success = destination.createEntity(newLocation, state) != null;
|
||||
|
||||
@ -167,14 +163,14 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
boolean hasFacing = tag.containsKey("Facing");
|
||||
|
||||
if (hasTilePosition) {
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
changed = true;
|
||||
Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
||||
Vector newTilePosition = transform.apply(tilePosition.subtract(from)).add(to);
|
||||
=======
|
||||
// Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
||||
// Vector newTilePosition = transform.apply(tilePosition.subtract(from)).add(to);
|
||||
//=======
|
||||
Vector3 tilePosition = new Vector3(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
||||
BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
values.put("TileX", new IntTag(newTilePosition.getBlockX()));
|
||||
values.put("TileY", new IntTag(newTilePosition.getBlockY()));
|
||||
@ -213,10 +209,10 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
double pitch = Math.toRadians(rotation.getFloat(1));
|
||||
|
||||
double xz = Math.cos(pitch);
|
||||
Vector direction = new Vector(-xz * Math.sin(yaw), -Math.sin(pitch), xz * Math.cos(yaw));
|
||||
Vector3 direction = new Vector3(-xz * Math.sin(yaw), -Math.sin(pitch), xz * Math.cos(yaw));
|
||||
direction = transform.apply(direction);
|
||||
FloatTag yawTag = new FloatTag(direction.toYaw());
|
||||
FloatTag pitchTag = new FloatTag(direction.toPitch());
|
||||
FloatTag yawTag = new FloatTag((float)direction.toYaw());
|
||||
FloatTag pitchTag = new FloatTag((float)direction.toPitch());
|
||||
values.put("Rotation", new ListTag(FloatTag.class, Arrays.asList(yawTag, pitchTag)));
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,9 @@ import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Generates flora (which may include tall grass, flowers, etc.).
|
||||
|
@ -21,12 +21,9 @@ package com.sk89q.worldedit.function.generator;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
@ -25,11 +25,8 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
|
@ -1,22 +1,18 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.collection.FastBitSet;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -82,7 +78,6 @@ public class BlockMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public Mask optimize() {
|
||||
Map<Object, Integer> states = new HashMap<>();
|
||||
int indexFound = -1;
|
||||
@ -102,13 +97,6 @@ public class BlockMask extends AbstractExtentMask {
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
BlockStateHolder block = getExtent().getBlock(vector);
|
||||
for (BlockStateHolder testBlock : blocks) {
|
||||
if (testBlock.equalsFuzzy(block)) {
|
||||
return true;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
// Only types, no states
|
||||
if (indexFound == -1) {
|
||||
@ -138,6 +126,12 @@ public class BlockMask extends AbstractExtentMask {
|
||||
return mask;
|
||||
}
|
||||
}
|
||||
// public boolean test(BlockVector3 vector) {
|
||||
// BlockStateHolder block = getExtent().getBlock(vector);
|
||||
// for (BlockStateHolder testBlock : blocks) {
|
||||
// if (testBlock.equalsFuzzy(block)) {
|
||||
// return true;
|
||||
|
||||
|
||||
private Mask getOptimizedMask(BlockType type, long[] bitSet) {
|
||||
boolean single = true;
|
||||
@ -233,7 +227,7 @@ public class BlockMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
BlockStateHolder block = getExtent().getBlock(vector);
|
||||
long[] bitSet = bitSets[block.getInternalBlockTypeId()];
|
||||
if (bitSet == null) return false;
|
||||
|
@ -1,11 +1,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -15,6 +11,8 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class BlockTypeMask extends AbstractExtentMask {
|
||||
@ -81,18 +79,16 @@ public class BlockTypeMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean test(Vector vector) {
|
||||
return types[getExtent().getBlockType(vector).getInternalId()];
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return blocks.contains(getExtent().getBlock(vector).getBlockType());
|
||||
return types[getExtent().getBlockType(vector).getInternalId()];
|
||||
}
|
||||
// public boolean test(BlockVector3 vector) {
|
||||
// return blocks.contains(getExtent().getBlock(vector).getBlockType());
|
||||
// }
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
return null;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -20,11 +20,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -44,13 +40,8 @@ public class ExistingBlockMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean test(Vector vector) {
|
||||
return !getExtent().getBlock(vector).getMaterial().isAir();
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return !getExtent().getBlock(vector).getBlockType().getMaterial().isAir();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class InverseMask extends AbstractMask {
|
||||
private final Mask mask;
|
||||
|
||||
@ -12,7 +12,7 @@ public class InverseMask extends AbstractMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return !mask.test(vector);
|
||||
}
|
||||
|
||||
|
@ -19,14 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.google.common.base.Function;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
@ -172,17 +169,12 @@ public class MaskIntersection extends AbstractMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean test(Vector vector) {
|
||||
for (Mask mask : masksArray) {
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (masks.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Mask mask : masks) {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
if (!mask.test(vector)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.google.common.base.Function;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -58,17 +54,12 @@ public class MaskUnion extends MaskIntersection {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public Function<Map.Entry<Mask, Mask>, Mask> pairingFunction() {
|
||||
return input -> input.getKey().or(input.getValue());
|
||||
}
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
Collection<Mask> masks = getMasks();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
for (Mask mask : getMasksArray()) {
|
||||
if (mask.test(vector)) {
|
||||
return true;
|
||||
|
@ -1,14 +1,9 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -57,36 +52,36 @@ public final class Masks {
|
||||
* @param finalMask the mask
|
||||
* @return a new mask
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
public static Mask negate(final Mask finalMask) {
|
||||
return finalMask.inverse();
|
||||
=======
|
||||
public static Mask negate(final Mask mask) {
|
||||
if (mask instanceof AlwaysTrue) {
|
||||
return ALWAYS_FALSE;
|
||||
} else if (mask instanceof AlwaysFalse) {
|
||||
return ALWAYS_TRUE;
|
||||
}
|
||||
|
||||
checkNotNull(mask);
|
||||
return new AbstractMask() {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return !mask.test(vector);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
Mask2D mask2d = mask.toMask2D();
|
||||
if (mask2d != null) {
|
||||
return negate(mask2d);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public static Mask negate(final Mask mask) {
|
||||
// if (mask instanceof AlwaysTrue) {
|
||||
// return ALWAYS_FALSE;
|
||||
// } else if (mask instanceof AlwaysFalse) {
|
||||
// return ALWAYS_TRUE;
|
||||
// }
|
||||
//
|
||||
// checkNotNull(mask);
|
||||
// return new AbstractMask() {
|
||||
// @Override
|
||||
// public boolean test(BlockVector3 vector) {
|
||||
// return !mask.test(vector);
|
||||
// }
|
||||
//
|
||||
// @Nullable
|
||||
// @Override
|
||||
// public Mask2D toMask2D() {
|
||||
// Mask2D mask2d = mask.toMask2D();
|
||||
// if (mask2d != null) {
|
||||
// return negate(mask2d);
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,14 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.math.noise.NoiseGenerator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -19,14 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.math.noise.NoiseGenerator;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
@ -1,14 +1,9 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
@ -21,12 +16,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class OffsetMask extends AbstractMask {
|
||||
|
||||
private Mask mask;
|
||||
<<<<<<< HEAD
|
||||
private Vector offset;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
=======
|
||||
private BlockVector3 offset;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -80,16 +70,8 @@ public class OffsetMask extends AbstractMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean test(Vector vector) {
|
||||
mutable.mutX((vector.getX() + offset.getX()));
|
||||
mutable.mutY((vector.getY() + offset.getY()));
|
||||
mutable.mutZ((vector.getZ() + offset.getZ()));
|
||||
return getMask().test(mutable);
|
||||
=======
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return getMask().test(vector.add(offset));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class SingleBlockStateBitMask extends AbstractExtentMask {
|
||||
private final int bitMask;
|
||||
@ -12,7 +12,7 @@ public class SingleBlockStateBitMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
int internalId = getExtent().getBlock(vector).getInternalId();
|
||||
return (internalId & bitMask) == internalId;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
@ -18,7 +18,7 @@ public class SingleBlockStateMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return state.equals(getExtent().getBlock(vector));
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -15,7 +15,7 @@ public class SingleBlockTypeMask extends AbstractExtentMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return getExtent().getBlockType(vector).getInternalId() == internalId;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
=======
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -23,16 +20,14 @@ public class SolidBlockMask extends BlockTypeMask {
|
||||
return types;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public SolidBlockMask(Extent extent) {
|
||||
super(extent, getTypes());
|
||||
=======
|
||||
}
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
Extent extent = getExtent();
|
||||
BlockState block = extent.getBlock(vector);
|
||||
return block.getBlockType().getMaterial().isMovementBlocker();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.sk89q.worldedit.function.operation;
|
||||
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -16,11 +16,11 @@ public class BackwardsExtentBlockCopy implements Operation {
|
||||
private final Extent destination;
|
||||
private final Extent source;
|
||||
private final RegionFunction function;
|
||||
private final Vector origin;
|
||||
private final BlockVector3 origin;
|
||||
|
||||
private Vector mutable = new MutableBlockVector();
|
||||
// private Vector mutable = new MutableBlockVector();
|
||||
|
||||
public BackwardsExtentBlockCopy(Extent source, Region region, Extent destination, Vector origin, Transform transform, RegionFunction function) {
|
||||
public BackwardsExtentBlockCopy(Extent source, Region region, Extent destination, BlockVector3 origin, Transform transform, RegionFunction function) {
|
||||
this.source = source;
|
||||
this.region = region;
|
||||
this.destination = destination;
|
||||
@ -33,8 +33,8 @@ public class BackwardsExtentBlockCopy implements Operation {
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
CuboidRegion destRegion = transform(this.transform, this.region);
|
||||
Transform inverse = this.transform.inverse();
|
||||
for (Vector pt : destRegion) {
|
||||
Vector copyFrom = transform(inverse, pt);
|
||||
for (BlockVector3 pt : destRegion) {
|
||||
BlockVector3 copyFrom = transform(inverse, pt);
|
||||
if (region.contains(copyFrom)) {
|
||||
function.apply(pt);
|
||||
}
|
||||
@ -43,31 +43,32 @@ public class BackwardsExtentBlockCopy implements Operation {
|
||||
}
|
||||
|
||||
private CuboidRegion transform(Transform transform, Region region) {
|
||||
Vector min = new MutableBlockVector(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
Vector max = new MutableBlockVector(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
Vector pos1 = region.getMinimumPoint();
|
||||
Vector pos2 = region.getMaximumPoint();
|
||||
BlockVector3 min = new BlockVector3(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
BlockVector3 max = new BlockVector3(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
BlockVector3 pos1 = region.getMinimumPoint();
|
||||
BlockVector3 pos2 = region.getMaximumPoint();
|
||||
for (int x : new int[] { pos1.getBlockX(), pos2.getBlockX() }) {
|
||||
for (int y : new int[] { pos1.getBlockY(), pos2.getBlockY() }) {
|
||||
for (int z : new int[] { pos1.getBlockZ(), pos2.getBlockZ() }) {
|
||||
Vector pt = transform(transform, new Vector(x, y, z)).toBlockVector();
|
||||
min = Vector.getMinimum(min, pt);
|
||||
max = Vector.getMaximum(max, pt);
|
||||
BlockVector3 pt = transform(transform, new BlockVector3(x, y, z));
|
||||
min = min.getMinimum(pt);
|
||||
max = max.getMaximum(pt);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new CuboidRegion(min, max);
|
||||
}
|
||||
|
||||
private Vector transform(Transform transform, Vector pt) {
|
||||
mutable.mutX(((pt.getBlockX() - origin.getBlockX())));
|
||||
mutable.mutY(((pt.getBlockY() - origin.getBlockY())));
|
||||
mutable.mutZ(((pt.getBlockZ() - origin.getBlockZ())));
|
||||
Vector tmp = transform.apply(mutable);
|
||||
tmp.mutX((tmp.getBlockX() + origin.getBlockX()));
|
||||
tmp.mutY((tmp.getBlockY() + origin.getBlockY()));
|
||||
tmp.mutZ((tmp.getBlockZ() + origin.getBlockZ()));
|
||||
return tmp;
|
||||
private BlockVector3 transform(Transform transform, BlockVector3 pt) {
|
||||
// mutable.mutX(((pt.getBlockX() - origin.getBlockX())));
|
||||
// mutable.mutY(((pt.getBlockY() - origin.getBlockY())));
|
||||
// mutable.mutZ(((pt.getBlockZ() - origin.getBlockZ())));
|
||||
// BlockVector3 tmp = transform.apply(new Vector3(pt.getBlockX() - origin.getBlockX(), pt.getBlockY() - origin.getBlockY(), pt.getBlockZ() - origin.getBlockZ())).toBlockPoint();
|
||||
// tmp.mutX((tmp.getBlockX() + origin.getBlockX()));
|
||||
// tmp.mutY((tmp.getBlockY() + origin.getBlockY()));
|
||||
// tmp.mutZ((tmp.getBlockZ() + origin.getBlockZ()));
|
||||
// return tmp;
|
||||
return transform.apply(new Vector3(pt.getBlockX() - origin.getBlockX(), pt.getBlockY() - origin.getBlockY(), pt.getBlockZ() - origin.getBlockZ())).toBlockPoint().add(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.function.operation;
|
||||
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -40,7 +40,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class BlockMapEntryPlacer implements Operation {
|
||||
|
||||
private final Extent extent;
|
||||
private final Iterator<Map.Entry<BlockVector, BlockStateHolder>> iterator;
|
||||
private final Iterator<Map.Entry<BlockVector3, BlockStateHolder>> iterator;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -48,7 +48,7 @@ public class BlockMapEntryPlacer implements Operation {
|
||||
* @param extent the extent to set the blocks on
|
||||
* @param iterator the iterator
|
||||
*/
|
||||
public BlockMapEntryPlacer(Extent extent, Iterator<Map.Entry<BlockVector, BlockStateHolder>> iterator) {
|
||||
public BlockMapEntryPlacer(Extent extent, Iterator<Map.Entry<BlockVector3, BlockStateHolder>> iterator) {
|
||||
checkNotNull(extent);
|
||||
checkNotNull(iterator);
|
||||
this.extent = extent;
|
||||
@ -58,7 +58,7 @@ public class BlockMapEntryPlacer implements Operation {
|
||||
@Override
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<BlockVector, BlockStateHolder> entry = iterator.next();
|
||||
Map.Entry<BlockVector3, BlockStateHolder> entry = iterator.next();
|
||||
extent.setBlock(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.function.operation;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.example.MappedFaweQueue;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.extent.BlockTranslateExtent;
|
||||
@ -29,14 +28,10 @@ import com.boydti.fawe.object.function.block.CombinedBlockCopy;
|
||||
import com.boydti.fawe.object.function.block.SimpleBlockCopy;
|
||||
import com.boydti.fawe.util.MaskTraverser;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -51,12 +46,9 @@ import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
||||
import com.sk89q.worldedit.function.visitor.IntersectRegionFunction;
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.math.transform.Identity;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -279,9 +271,9 @@ public class ForwardExtentCopy implements Operation {
|
||||
}
|
||||
|
||||
Extent finalDest = destination;
|
||||
Vector translation = to.subtract(from);
|
||||
BlockVector3 translation = to.subtract(from);
|
||||
|
||||
if (!translation.equals(Vector.ZERO)) {
|
||||
if (!translation.equals(BlockVector3.ZERO)) {
|
||||
finalDest = new BlockTranslateExtent(finalDest, translation.getBlockX(), translation.getBlockY(), translation.getBlockZ());
|
||||
}
|
||||
|
||||
@ -318,30 +310,28 @@ public class ForwardExtentCopy implements Operation {
|
||||
RegionFunction maskFunc = null;
|
||||
|
||||
if (sourceFunction != null) {
|
||||
Vector disAbs = translation.positive();
|
||||
Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
||||
BlockVector3 disAbs = translation.abs();
|
||||
BlockVector3 size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
||||
boolean overlap = (disAbs.getBlockX() < size.getBlockX() && disAbs.getBlockY() < size.getBlockY() && disAbs.getBlockZ() < size.getBlockZ());
|
||||
|
||||
RegionFunction copySrcFunc = sourceFunction;
|
||||
if (overlap && translation.length() != 0) {
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
int x = translation.getBlockX();
|
||||
int y = translation.getBlockY();
|
||||
int z = translation.getBlockZ();
|
||||
|
||||
<<<<<<< HEAD
|
||||
maskFunc = position -> {
|
||||
mutable.setComponents(position.getBlockX() + x, position.getBlockY() + y, position.getBlockZ() + z);
|
||||
if (region.contains(mutable)) {
|
||||
return sourceFunction.apply(mutable);
|
||||
BlockVector3 bv = new BlockVector3(position.getBlockX() + x, position.getBlockY() + y, position.getBlockZ() + z);
|
||||
if (region.contains(bv)) {
|
||||
return sourceFunction.apply(bv);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
copySrcFunc = position -> {
|
||||
mutable.setComponents(position.getBlockX() - x, position.getBlockY() - y, position.getBlockZ() - z);
|
||||
if (!region.contains(mutable)) {
|
||||
BlockVector3 bv = new BlockVector3(position.getBlockX() - x, position.getBlockY() - y, position.getBlockZ() - z);
|
||||
if (!region.contains(bv)) {
|
||||
return sourceFunction.apply(position);
|
||||
}
|
||||
return false;
|
||||
@ -371,11 +361,9 @@ public class ForwardExtentCopy implements Operation {
|
||||
Operations.completeBlindly(blockCopy);
|
||||
|
||||
if (!entities.isEmpty()) {
|
||||
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform);
|
||||
=======
|
||||
if (copyingEntities) {
|
||||
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// if (copyingEntities) {
|
||||
// ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
|
||||
entityCopy.setRemoving(removingEntities);
|
||||
EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy);
|
||||
Operations.completeBlindly(entityVisitor);
|
||||
|
@ -1,22 +1,10 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* @deprecated Just use BaseBlock directly
|
||||
*/
|
||||
@ -29,11 +17,6 @@ public class BlockPattern implements Pattern {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
return block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block.
|
||||
*
|
||||
@ -52,13 +35,10 @@ public class BlockPattern implements Pattern {
|
||||
checkNotNull(block);
|
||||
this.block = block;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
return block;
|
||||
}
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
@ -1,14 +1,9 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -22,13 +17,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class ClipboardPattern extends AbstractPattern {
|
||||
|
||||
private final Clipboard clipboard;
|
||||
<<<<<<< HEAD
|
||||
private final int sx, sy, sz;
|
||||
private final Vector min;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
=======
|
||||
private final BlockVector3 size;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
private final BlockVector3 min;
|
||||
// private final BlockVector3 size;
|
||||
|
||||
/**
|
||||
* Create a new clipboard pattern.
|
||||
@ -38,7 +29,7 @@ public class ClipboardPattern extends AbstractPattern {
|
||||
public ClipboardPattern(Clipboard clipboard) {
|
||||
checkNotNull(clipboard);
|
||||
this.clipboard = clipboard;
|
||||
Vector size = clipboard.getMaximumPoint().subtract(clipboard.getMinimumPoint()).add(1, 1, 1);
|
||||
BlockVector3 size = clipboard.getMaximumPoint().subtract(clipboard.getMinimumPoint()).add(1, 1, 1);
|
||||
this.sx = size.getBlockX();
|
||||
this.sy = size.getBlockY();
|
||||
this.sz = size.getBlockZ();
|
||||
@ -46,26 +37,23 @@ public class ClipboardPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
//<<<<<<< HEAD
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
int xp = position.getBlockX() % sx;
|
||||
int yp = position.getBlockY() % sy;
|
||||
int zp = position.getBlockZ() % sz;
|
||||
if (xp < 0) xp += sx;
|
||||
if (yp < 0) yp += sy;
|
||||
if (zp < 0) zp += sz;
|
||||
mutable.mutX((min.getX() + xp));
|
||||
mutable.mutY((min.getY() + yp));
|
||||
mutable.mutZ((min.getZ() + zp));
|
||||
return clipboard.getBlock(mutable);
|
||||
=======
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
int xp = Math.abs(position.getBlockX()) % size.getBlockX();
|
||||
int yp = Math.abs(position.getBlockY()) % size.getBlockY();
|
||||
int zp = Math.abs(position.getBlockZ()) % size.getBlockZ();
|
||||
|
||||
return clipboard.getFullBlock(clipboard.getMinimumPoint().add(xp, yp, zp));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return clipboard.getBlock(new BlockVector3(min.getX() + xp, min.getY() + yp, min.getZ() + zp));
|
||||
//=======
|
||||
// public BlockStateHolder apply(BlockVector3 position) {
|
||||
// int xp = Math.abs(position.getBlockX()) % size.getBlockX();
|
||||
// int yp = Math.abs(position.getBlockY()) % size.getBlockY();
|
||||
// int zp = Math.abs(position.getBlockZ()) % size.getBlockZ();
|
||||
//
|
||||
// return clipboard.getFullBlock(clipboard.getMinimumPoint().add(xp, yp, zp));
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.minecraft.util.commands.Link;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -17,7 +17,7 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
public interface FawePattern extends Pattern {
|
||||
|
||||
@Deprecated
|
||||
default BlockStateHolder apply(Vector position) {
|
||||
default BlockStateHolder apply(BlockVector3 position) {
|
||||
throw new UnsupportedOperationException("Please use apply(extent, get, set)");
|
||||
}
|
||||
|
||||
@ -27,6 +27,6 @@ public interface FawePattern extends Pattern {
|
||||
* @return a block
|
||||
*/
|
||||
@Override
|
||||
boolean apply(Extent extent, Vector get, Vector set) throws WorldEditException;
|
||||
boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException;
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,15 @@
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.collection.RandomCollection;
|
||||
import com.boydti.fawe.object.random.SimpleRandom;
|
||||
import com.boydti.fawe.object.random.TrueRandom;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -60,24 +56,24 @@ public class RandomPattern extends AbstractPattern {
|
||||
this.patterns.add(pattern);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
public Set<Pattern> getPatterns() {
|
||||
return patterns;
|
||||
=======
|
||||
@Override
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
double r = random.nextDouble();
|
||||
double offset = 0;
|
||||
|
||||
for (Chance chance : patterns) {
|
||||
if (r <= (offset + chance.getChance()) / max) {
|
||||
return chance.getPattern().apply(position);
|
||||
}
|
||||
offset += chance.getChance();
|
||||
}
|
||||
|
||||
throw new RuntimeException("ProportionalFillPattern");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// @Override
|
||||
// public BlockStateHolder apply(BlockVector3 position) {
|
||||
// double r = random.nextDouble();
|
||||
// double offset = 0;
|
||||
//
|
||||
// for (Chance chance : patterns) {
|
||||
// if (r <= (offset + chance.getChance()) / max) {
|
||||
// return chance.getPattern().apply(position);
|
||||
// }
|
||||
// offset += chance.getChance();
|
||||
// }
|
||||
//
|
||||
// throw new RuntimeException("ProportionalFillPattern");
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
public RandomCollection<Pattern> getCollection() {
|
||||
@ -85,12 +81,12 @@ public class RandomPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(Vector get) {
|
||||
public BlockStateHolder apply(BlockVector3 get) {
|
||||
return collection.next(get.getBlockX(), get.getBlockY(), get.getBlockZ()).apply(get);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException {
|
||||
public boolean apply(Extent extent, BlockVector3 set, BlockVector3 get) throws WorldEditException {
|
||||
return collection.next(get.getBlockX(), get.getBlockY(), get.getBlockZ()).apply(extent, set, get);
|
||||
}
|
||||
|
||||
|
@ -19,14 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -97,10 +93,10 @@ public class RepeatingExtentPattern extends AbstractPattern {
|
||||
int x = base.getBlockX() % size.getBlockX();
|
||||
int y = base.getBlockY() % size.getBlockY();
|
||||
int z = base.getBlockZ() % size.getBlockZ();
|
||||
<<<<<<< HEAD
|
||||
return extent.getBlock(new Vector(x, y, z));
|
||||
=======
|
||||
//<<<<<<< HEAD
|
||||
// return extent.getBlock(new Vector(x, y, z));
|
||||
//=======
|
||||
return extent.getFullBlock(new BlockVector3(x, y, z));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.util;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.function.util;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
@ -44,18 +44,18 @@ public abstract class BreadthFirstSearch implements Operation {
|
||||
public static final BlockVector3[] DIAGONAL_DIRECTIONS;
|
||||
|
||||
static {
|
||||
DEFAULT_DIRECTIONS[0] = (new MutableBlockVector(0, -1, 0));
|
||||
DEFAULT_DIRECTIONS[1] = (new MutableBlockVector(0, 1, 0));
|
||||
DEFAULT_DIRECTIONS[2] = (new MutableBlockVector(-1, 0, 0));
|
||||
DEFAULT_DIRECTIONS[3] = (new MutableBlockVector(1, 0, 0));
|
||||
DEFAULT_DIRECTIONS[4] = (new MutableBlockVector(0, 0, -1));
|
||||
DEFAULT_DIRECTIONS[5] = (new MutableBlockVector(0, 0, 1));
|
||||
List<MutableBlockVector> list = new ArrayList<>();
|
||||
DEFAULT_DIRECTIONS[0] = (new BlockVector3(0, -1, 0));
|
||||
DEFAULT_DIRECTIONS[1] = (new BlockVector3(0, 1, 0));
|
||||
DEFAULT_DIRECTIONS[2] = (new BlockVector3(-1, 0, 0));
|
||||
DEFAULT_DIRECTIONS[3] = (new BlockVector3(1, 0, 0));
|
||||
DEFAULT_DIRECTIONS[4] = (new BlockVector3(0, 0, -1));
|
||||
DEFAULT_DIRECTIONS[5] = (new BlockVector3(0, 0, 1));
|
||||
List<BlockVector3> list = new ArrayList<>();
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
if (x != 0 || y != 0 || z != 0) {
|
||||
MutableBlockVector pos = new MutableBlockVector(x, y, z);
|
||||
BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
if (!list.contains(pos)) {
|
||||
list.add(pos);
|
||||
}
|
||||
@ -184,7 +184,7 @@ public abstract class BreadthFirstSearch implements Operation {
|
||||
@Override
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
MutableBlockVector mutable2 = new MutableBlockVector();
|
||||
// MutableBlockVector mutable2 = new MutableBlockVector();
|
||||
boolean shouldTrim = false;
|
||||
IntegerTrio[] dirs = getIntDirections();
|
||||
BlockVectorSet tempQueue = new BlockVectorSet();
|
||||
@ -223,10 +223,7 @@ public abstract class BreadthFirstSearch implements Operation {
|
||||
int x = from.getBlockX() + direction.x;
|
||||
int z = from.getBlockZ() + direction.z;
|
||||
if (!visited.contains(x, y, z)) {
|
||||
mutable2.mutX(x);
|
||||
mutable2.mutY(y);
|
||||
mutable2.mutZ(z);
|
||||
if (isVisitable(from, mutable2)) {
|
||||
if (isVisitable(from, new BlockVector3(x, y, z))) {
|
||||
j++;
|
||||
visited.add(x, y, z);
|
||||
tempQueue.add(x, y, z);
|
||||
|
@ -50,7 +50,7 @@ public class DirectionalVisitor extends RecursiveVisitor {
|
||||
super(mask, function, distance, hasFaweQueue);
|
||||
checkNotNull(mask);
|
||||
this.origin = origin;
|
||||
this.dirVec = new MutableBlockVector(direction);
|
||||
this.dirVec = direction;
|
||||
final Collection<BlockVector3> directions = this.getDirections();
|
||||
directions.clear();
|
||||
directions.add(new BlockVector3(1, 0, 0));
|
||||
|
@ -19,19 +19,15 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@ -63,12 +59,8 @@ public class DownwardVisitor extends RecursiveVisitor {
|
||||
super(mask, function, depth, hasFaweQueue);
|
||||
checkNotNull(mask);
|
||||
this.baseY = baseY;
|
||||
<<<<<<< HEAD
|
||||
final Collection<Vector> directions = this.getDirections();
|
||||
=======
|
||||
|
||||
Collection<BlockVector3> directions = getDirections();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
directions.clear();
|
||||
directions.add(new BlockVector3(1, 0, 0));
|
||||
directions.add(new BlockVector3(-1, 0, 0));
|
||||
@ -78,15 +70,9 @@ public class DownwardVisitor extends RecursiveVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean isVisitable(final Vector from, final Vector to) {
|
||||
final int fromY = from.getBlockY();
|
||||
return ((fromY == this.baseY) || (to.getBlockY() - from.getBlockY() < 0)) && super.isVisitable(from, to);
|
||||
=======
|
||||
protected boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
int fromY = from.getBlockY();
|
||||
return (fromY == baseY || to.subtract(from).getBlockY() < 0) && super.isVisitable(from, to);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,23 +19,20 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.example.MappedFaweQueue;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.boydti.fawe.object.visitor.Fast2DIterator;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.operation.RunContext;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.Vector2;
|
||||
import com.sk89q.worldedit.regions.FlatRegion;
|
||||
import java.util.List;
|
||||
|
||||
@ -50,7 +47,7 @@ public class FlatRegionVisitor implements Operation {
|
||||
private final FlatRegionFunction function;
|
||||
private MappedFaweQueue queue;
|
||||
private int affected = 0;
|
||||
private final Iterable<Vector2D> iterator;
|
||||
private final Iterable<BlockVector2> iterator;
|
||||
|
||||
/**
|
||||
* Create a new visitor.
|
||||
@ -84,21 +81,21 @@ public class FlatRegionVisitor implements Operation {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
public Operation resume(final RunContext run) throws WorldEditException {
|
||||
if (this.queue != null) {
|
||||
for (final Vector2D pt : new Fast2DIterator(this.iterator, queue)) {
|
||||
for (final BlockVector2 pt : new Fast2DIterator(this.iterator, queue)) {
|
||||
if (this.function.apply(pt)) affected++;
|
||||
}
|
||||
} else {
|
||||
for (final Vector2D pt : this.iterator) {
|
||||
for (final BlockVector2 pt : this.iterator) {
|
||||
if (this.function.apply(pt)) affected++;
|
||||
=======
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
for (BlockVector2 pt : flatRegion.asFlatRegion()) {
|
||||
if (function.apply(pt)) {
|
||||
affected++;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public Operation resume(RunContext run) throws WorldEditException {
|
||||
// for (BlockVector2 pt : flatRegion.asFlatRegion()) {
|
||||
// if (function.apply(pt)) {
|
||||
// affected++;
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class IntersectRegionFunction implements RegionFunction {
|
||||
private final RegionFunction[] functions;
|
||||
@ -13,7 +13,7 @@ public class IntersectRegionFunction implements RegionFunction {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Vector position) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
boolean ret = false;
|
||||
for (RegionFunction function : functions) {
|
||||
if (!function.apply(position)) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user