Convert the data system to a state system. This doesn't work, needs new data

This commit is contained in:
Matthew Miller
2018-06-14 16:35:56 +10:00
parent 1cc735e359
commit a71e39d777
21 changed files with 236 additions and 270 deletions

View File

@ -23,9 +23,13 @@ import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.type.BlockType;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.registry.state.State;
import com.sk89q.worldedit.world.registry.state.value.StateValue;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
/**
* A implementation of a lazy block for {@link Extent#getLazyBlock(Vector)}
* that takes the block's ID and metadata, but will defer loading of NBT
@ -78,13 +82,13 @@ public class LazyBlock extends BaseBlock {
* Create a new lazy block.
*
* @param type the block type
* @param data the data value
* @param states the block states
* @param extent the extent to later load the full block data from
* @param position the position to later load the full block data from
*/
@Deprecated
public LazyBlock(BlockType type, int data, Extent extent, Vector position) {
super(type, data);
public LazyBlock(BlockType type, Map<State, StateValue> states, Extent extent, Vector position) {
super(type, states);
checkNotNull(extent);
checkNotNull(position);
this.extent = extent;
@ -123,6 +127,11 @@ public class LazyBlock extends BaseBlock {
throw new UnsupportedOperationException("This object is immutable");
}
@Override
public void setState(State state, StateValue stateValue) {
throw new UnsupportedOperationException("This object is immutable");
}
@Override
public CompoundTag getNbtData() {
if (!loaded) {

View File

@ -67,7 +67,7 @@ public class BlockMask extends AbstractMask {
public boolean matches(EditSession editSession, Vector position) {
BaseBlock block = editSession.getBlock(position);
return blocks.contains(block)
|| blocks.contains(new BaseBlock(block.getType(), -1));
|| blocks.contains(new BaseBlock(block.getType()));
}
}