Moved report framework to WorldEdit and fixed a few bugs.

This commit is contained in:
Matthew Miller
2018-08-15 12:45:18 +10:00
parent 96388df4b0
commit c31161d068
11 changed files with 640 additions and 18 deletions

View File

@ -24,7 +24,6 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
@ -32,6 +31,7 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.world.biome.BaseBiome;
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;

View File

@ -34,18 +34,13 @@ import java.util.Objects;
import javax.annotation.Nullable;
/**
* Represents a mutable "snapshot" of a block.
* Represents a "snapshot" of a block with NBT Data.
*
* <p>An instance of this block contains all the information needed to
* accurately reproduce the block, provided that the instance was
* made correctly. In some implementations, it may not be possible to get a
* snapshot of blocks correctly, so, for example, the NBT data for a block
* may be missing.</p>
*
* <p>A peculiar detail of this class is that it accepts {@code -1} as a
* valid data value. This is due to legacy reasons: WorldEdit uses -1
* as a "wildcard" block value, even though a {@link Mask} would be
* more appropriate.</p>
*/
public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
@ -73,15 +68,6 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
this.nbtData = nbtData;
}
/**
* Create a clone of another block.
*
* @param other the other block
*/
public BaseBlock(BaseBlock other) {
this(other.toImmutableState(), other.getNbtData());
}
/**
* Gets a map of state to statevalue
*
@ -99,7 +85,7 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
@Override
public <V> BaseBlock with(Property<V> property, V value) {
return new BaseBlock(this.blockState.with(property, value), getNbtData());
return this.blockState.with(property, value).toBaseBlock(getNbtData());
}
/**