Many upstream changes. Should be non-breaking

This commit is contained in:
MattBDev
2019-06-25 09:00:44 -04:00
parent c672bcfddd
commit a1c15e1c39
53 changed files with 689 additions and 1067 deletions

View File

@ -38,7 +38,7 @@ public class BlockReplace implements RegionFunction {
/**
* Create a new instance.
*
* @param extent an extent
* @param extent an extent
* @param pattern a pattern
*/
public BlockReplace(Extent extent, Pattern pattern) {
@ -53,6 +53,4 @@ public class BlockReplace implements RegionFunction {
return pattern.apply(extent, position, position);
}
}
}

View File

@ -19,13 +19,9 @@
package com.sk89q.worldedit.function.block;
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.WorldEditException;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.CompoundTagBuilder;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent;
@ -36,8 +32,6 @@ 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;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.world.block.BaseBlock;
/**
@ -54,11 +48,11 @@ public class ExtentBlockCopy implements RegionFunction {
/**
* Make a new copy.
*
* @param source the source extent
* @param from the source offset
* @param source the source extent
* @param from the source offset
* @param destination the destination extent
* @param to the destination offset
* @param transform a transform to apply to positions (after source offset, before destination offset)
* @param to the destination offset
* @param transform a transform to apply to positions (after source offset, before destination offset)
*/
public ExtentBlockCopy(Extent source, BlockVector3 from, Extent destination, BlockVector3 to, Transform transform) {
checkNotNull(source);
@ -75,11 +69,13 @@ public class ExtentBlockCopy implements RegionFunction {
@Override
public boolean apply(BlockVector3 position) throws WorldEditException {
BaseBlock block = source.getFullBlock(position);
BlockVector3 orig = position.subtract(from);
BlockVector3 transformed = transform.apply(orig.toVector3()).toBlockPoint();
// Apply transformations to NBT data if necessary
BaseBlock block = transformNbtData(source.getFullBlock(position));
block = transformNbtData(block);
return destination.setBlock(transformed.add(to), block);
}
@ -118,6 +114,4 @@ public class ExtentBlockCopy implements RegionFunction {
return state;
}
}

View File

@ -19,21 +19,16 @@
package com.sk89q.worldedit.function.block;
import com.google.common.collect.Sets;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.mask.BlockTypeMask;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
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;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockTypes;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Makes a layer of grass on top, three layers of dirt below, and smooth stone
* only below that for all layers that originally consist of grass, dirt,
@ -76,15 +71,15 @@ public class Naturalizer implements LayerFunction {
affected++;
switch (depth) {
case 0:
editSession.setBlock(position, BlockTypes.GRASS_BLOCK);
editSession.setBlock(position, BlockTypes.GRASS_BLOCK.getDefaultState());
break;
case 1:
case 2:
case 3:
editSession.setBlock(position, BlockTypes.DIRT);
editSession.setBlock(position, BlockTypes.DIRT.getDefaultState());
break;
default:
editSession.setBlock(position, BlockTypes.STONE);
editSession.setBlock(position, BlockTypes.STONE.getDefaultState());
}
}