geforkt von Mirrors/FastAsyncWorldEdit
Fixed a few clipboard related issues.
Dieser Commit ist enthalten in:
Ursprung
db21f51a18
Commit
521238b4eb
@ -37,7 +37,7 @@ public class BlockVector extends Vector {
|
|||||||
* @param position the other position
|
* @param position the other position
|
||||||
*/
|
*/
|
||||||
public BlockVector(Vector position) {
|
public BlockVector(Vector position) {
|
||||||
this(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
super(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +59,7 @@ public class BlockVector extends Vector {
|
|||||||
* @param z the Z coordinate
|
* @param z the Z coordinate
|
||||||
*/
|
*/
|
||||||
public BlockVector(float x, float y, float z) {
|
public BlockVector(float x, float y, float z) {
|
||||||
this((int) x, (int) y, (int) z);
|
super(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +70,7 @@ public class BlockVector extends Vector {
|
|||||||
* @param z the Z coordinate
|
* @param z the Z coordinate
|
||||||
*/
|
*/
|
||||||
public BlockVector(double x, double y, double z) {
|
public BlockVector(double x, double y, double z) {
|
||||||
this((int) x, (int) y, (int) z);
|
super(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -36,7 +36,7 @@ public class BlockVector2D extends Vector2D {
|
|||||||
* @param position the position to copy
|
* @param position the position to copy
|
||||||
*/
|
*/
|
||||||
public BlockVector2D(Vector2D position) {
|
public BlockVector2D(Vector2D position) {
|
||||||
this(position.getBlockX(), position.getBlockZ());
|
super(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,7 +56,7 @@ public class BlockVector2D extends Vector2D {
|
|||||||
* @param z the Z coordinate
|
* @param z the Z coordinate
|
||||||
*/
|
*/
|
||||||
public BlockVector2D(float x, float z) {
|
public BlockVector2D(float x, float z) {
|
||||||
this((int) x, (int) z);
|
super(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,7 +66,7 @@ public class BlockVector2D extends Vector2D {
|
|||||||
* @param z the Z coordinate
|
* @param z the Z coordinate
|
||||||
*/
|
*/
|
||||||
public BlockVector2D(double x, double z) {
|
public BlockVector2D(double x, double z) {
|
||||||
this((int) x, (int) z);
|
super(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.extent;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
@ -59,7 +60,7 @@ public class ChangeSetExtent extends AbstractDelegateExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||||
BlockStateHolder previous = getBlock(location);
|
BaseBlock previous = getFullBlock(location);
|
||||||
changeSet.add(new BlockChange(location.toBlockVector(), previous, block));
|
changeSet.add(new BlockChange(location.toBlockVector(), previous, block));
|
||||||
return super.setBlock(location, block);
|
return super.setBlock(location, block);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class BlockArrayClipboard implements Clipboard {
|
|||||||
this.origin = region.getMinimumPoint();
|
this.origin = region.getMinimumPoint();
|
||||||
|
|
||||||
Vector dimensions = getDimensions();
|
Vector dimensions = getDimensions();
|
||||||
blocks = new BaseBlock[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()];
|
blocks = new BlockStateHolder[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -146,10 +146,10 @@ public class BlockArrayClipboard implements Clipboard {
|
|||||||
Vector v = position.subtract(region.getMinimumPoint());
|
Vector v = position.subtract(region.getMinimumPoint());
|
||||||
BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
if (block instanceof BlockState) {
|
if (block instanceof BaseBlock) {
|
||||||
return new BaseBlock((BlockState) block);
|
|
||||||
} else if (block instanceof BaseBlock) {
|
|
||||||
return (BaseBlock) block;
|
return (BaseBlock) block;
|
||||||
|
} else {
|
||||||
|
return new BaseBlock(block.toImmutableState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.function.operation;
|
package com.sk89q.worldedit.function.operation;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
@ -37,12 +41,8 @@ import com.sk89q.worldedit.math.transform.Identity;
|
|||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a copy of a portion of one extent to another extent or another point.
|
* Makes a copy of a portion of one extent to another extent or another point.
|
||||||
*
|
*
|
||||||
@ -257,16 +257,11 @@ public class ForwardExtentCopy implements Operation {
|
|||||||
if (copyingEntities) {
|
if (copyingEntities) {
|
||||||
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform);
|
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform);
|
||||||
entityCopy.setRemoving(removingEntities);
|
entityCopy.setRemoving(removingEntities);
|
||||||
List<? extends Entity> entities = source.getEntities(region);
|
List<? extends Entity> entities = Lists.newArrayList(source.getEntities(region));
|
||||||
// Switch to entities.removeIf after Java 8 cutoff.
|
entities.removeIf(entity -> {
|
||||||
Iterator<? extends Entity> entityIterator = entities.iterator();
|
EntityProperties properties = entity.getFacet(EntityProperties.class);
|
||||||
while (entityIterator.hasNext()) {
|
return properties != null && !properties.isPasteable();
|
||||||
EntityProperties type = entityIterator.next().getFacet(EntityProperties.class);
|
});
|
||||||
|
|
||||||
if (type != null && !type.isPasteable()) {
|
|
||||||
entityIterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy);
|
EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy);
|
||||||
return new DelegateOperation(this, new OperationQueue(blockVisitor, entityVisitor));
|
return new DelegateOperation(this, new OperationQueue(blockVisitor, entityVisitor));
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,7 +50,7 @@ public class ClipboardPattern extends AbstractPattern {
|
|||||||
int yp = Math.abs(position.getBlockY()) % size.getBlockY();
|
int yp = Math.abs(position.getBlockY()) % size.getBlockY();
|
||||||
int zp = Math.abs(position.getBlockZ()) % size.getBlockZ();
|
int zp = Math.abs(position.getBlockZ()) % size.getBlockZ();
|
||||||
|
|
||||||
return clipboard.getBlock(clipboard.getMinimumPoint().add(new Vector(xp, yp, zp)));
|
return clipboard.getFullBlock(clipboard.getMinimumPoint().add(new Vector(xp, yp, zp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public class RepeatingExtentPattern extends AbstractPattern {
|
|||||||
int x = base.getBlockX() % size.getBlockX();
|
int x = base.getBlockX() % size.getBlockX();
|
||||||
int y = base.getBlockY() % size.getBlockY();
|
int y = base.getBlockY() % size.getBlockY();
|
||||||
int z = base.getBlockZ() % size.getBlockZ();
|
int z = base.getBlockZ() % size.getBlockZ();
|
||||||
return extent.getBlock(new Vector(x, y, z));
|
return extent.getFullBlock(new Vector(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
ForgeWorld from = new ForgeWorld(freshWorld);
|
ForgeWorld from = new ForgeWorld(freshWorld);
|
||||||
try {
|
try {
|
||||||
for (BlockVector vec : region) {
|
for (BlockVector vec : region) {
|
||||||
editSession.setBlock(vec, from.getBlock(vec));
|
editSession.setBlock(vec, from.getFullBlock(vec));
|
||||||
}
|
}
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren