Further BaseBlock modernisation

This commit is contained in:
Matthew Miller
2018-06-18 17:53:33 +10:00
parent 811f1d4433
commit e99190225e
61 changed files with 344 additions and 787 deletions

View File

@ -104,7 +104,7 @@ public class ExtentBlockCopy implements RegionFunction {
builder.putByte("Rot", (byte) MCDirections.toRotation(newDirection));
return new BaseBlock(state.getType(), state.getStates(), builder.build());
return new BaseBlock(state.getState(), builder.build());
}
}
}

View File

@ -106,10 +106,10 @@ public class FloraGenerator implements RegionFunction {
public boolean apply(Vector position) throws WorldEditException {
BaseBlock block = editSession.getBlock(position);
if (block.getType() == BlockTypes.GRASS) {
if (block.getBlockType() == BlockTypes.GRASS) {
editSession.setBlock(position.add(0, 1, 0), temperatePattern.apply(position));
return true;
} else if (block.getType() == BlockTypes.SAND) {
} else if (block.getBlockType() == BlockTypes.SAND) {
editSession.setBlock(position.add(0, 1, 0), desertPattern.apply(position));
return true;
}

View File

@ -51,7 +51,7 @@ public class ForestGenerator implements RegionFunction {
@Override
public boolean apply(Vector position) throws WorldEditException {
BaseBlock block = editSession.getBlock(position);
BlockType t = block.getType();
BlockType t = block.getBlockType();
if (t == BlockTypes.GRASS || t == BlockTypes.DIRT) {
treeGenerator.generate(editSession, position.add(0, 1, 0));

View File

@ -163,7 +163,7 @@ public class GardenPatchGenerator implements RegionFunction {
position = position.add(0, 1, 0);
}
if (editSession.getBlock(position.add(0, -1, 0)).getType() != BlockTypes.GRASS) {
if (editSession.getBlock(position.add(0, -1, 0)).getBlockType() != BlockTypes.GRASS) {
return false;
}

View File

@ -95,7 +95,7 @@ public class BlockMask extends AbstractExtentMask {
@Override
public boolean test(Vector vector) {
BaseBlock block = getExtent().getBlock(vector);
return blocks.contains(block) || blocks.contains(new BaseBlock(block.getType()));
return blocks.contains(block) || blocks.contains(new BaseBlock(block.getBlockType()));
}
@Nullable

View File

@ -41,7 +41,7 @@ public class FuzzyBlockMask extends BlockMask {
Extent extent = getExtent();
Collection<BaseBlock> blocks = getBlocks();
BaseBlock lazyBlock = extent.getLazyBlock(vector);
BaseBlock compare = new BaseBlock(lazyBlock.getType(), lazyBlock.getStates());
BaseBlock compare = new BaseBlock(lazyBlock.getState());
return Blocks.containsFuzzy(blocks, compare);
}
}

View File

@ -36,7 +36,7 @@ public class SolidBlockMask extends AbstractExtentMask {
public boolean test(Vector vector) {
Extent extent = getExtent();
BaseBlock lazyBlock = extent.getLazyBlock(vector);
return !BlockType.canPassThrough(lazyBlock.getType().getLegacyId(), lazyBlock.getData());
return !BlockType.canPassThrough(lazyBlock.getBlockType().getLegacyId(), lazyBlock.getData());
}
@Nullable