I guarantee this is broken. Start some form of string ID for blocks

This commit is contained in:
Matthew Miller
2018-01-03 15:35:51 +10:00
parent e6c6a2cfea
commit 41a80064f5
39 changed files with 349 additions and 118 deletions

View File

@ -120,17 +120,17 @@ public class SchematicWriter implements ClipboardWriter {
BaseBlock block = clipboard.getBlock(point);
// Save 4096 IDs in an AddBlocks section
if (block.getType() > 255) {
if (block.getId() > 255) {
if (addBlocks == null) { // Lazily create section
addBlocks = new byte[(blocks.length >> 1) + 1];
}
addBlocks[index >> 1] = (byte) (((index & 1) == 0) ?
addBlocks[index >> 1] & 0xF0 | (block.getType() >> 8) & 0xF
: addBlocks[index >> 1] & 0xF | ((block.getType() >> 8) & 0xF) << 4);
addBlocks[index >> 1] & 0xF0 | (block.getId() >> 8) & 0xF
: addBlocks[index >> 1] & 0xF | ((block.getId() >> 8) & 0xF) << 4);
}
blocks[index] = (byte) block.getType();
blocks[index] = (byte) block.getId();
blockData[index] = (byte) block.getData();
// Store TileEntity data

View File

@ -34,7 +34,7 @@ import java.util.Map;
public class SignCompatibilityHandler implements NBTCompatibilityHandler {
@Override
public boolean isAffectedBlock(BaseBlock block) {
return block.getType() == BlockID.SIGN_POST || block.getType() == BlockID.WALL_SIGN;
return block.getType().getLegacyId() == BlockID.SIGN_POST || block.getType().getLegacyId() == BlockID.WALL_SIGN;
}
@Override

View File

@ -82,8 +82,8 @@ public class BlockBagExtent extends AbstractDelegateExtent {
public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException {
if (blockBag != null) {
BaseBlock lazyBlock = getExtent().getLazyBlock(position);
int existing = lazyBlock.getType();
final int type = block.getType();
int existing = lazyBlock.getType().getLegacyId();
final int type = block.getType().getLegacyId();
if (type > 0) {
try {

View File

@ -93,15 +93,15 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
return super.setBlock(location, block);
}
if (BlockType.shouldPlaceLast(block.getType())) {
if (BlockType.shouldPlaceLast(block.getType().getLegacyId())) {
// Place torches, etc. last
stage2.put(location.toBlockVector(), block);
return !(lazyBlock.getType() == block.getType() && lazyBlock.getData() == block.getData());
} else if (BlockType.shouldPlaceFinal(block.getType())) {
} else if (BlockType.shouldPlaceFinal(block.getType().getLegacyId())) {
// Place signs, reed, etc even later
stage3.put(location.toBlockVector(), block);
return !(lazyBlock.getType() == block.getType() && lazyBlock.getData() == block.getData());
} else if (BlockType.shouldPlaceLast(lazyBlock.getType())) {
} else if (BlockType.shouldPlaceLast(lazyBlock.getType().getLegacyId())) {
// Destroy torches, etc. first
super.setBlock(location, new BaseBlock(BlockID.AIR));
return super.setBlock(location, block);
@ -149,7 +149,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
final BaseBlock baseBlock = blockTypes.get(current);
final int type = baseBlock.getType();
final int type = baseBlock.getType().getLegacyId();
final int data = baseBlock.getData();
switch (type) {

View File

@ -50,7 +50,7 @@ public class DataValidatorExtent extends AbstractDelegateExtent {
@Override
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
final int y = location.getBlockY();
final int type = block.getType();
final int type = block.getType().getLegacyId();
if (y < 0 || y > world.getMaxY()) {
return false;
}

View File

@ -53,7 +53,7 @@ public class BlockQuirkExtent extends AbstractDelegateExtent {
@Override
public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException {
BaseBlock lazyBlock = getExtent().getLazyBlock(position);
int existing = lazyBlock.getType();
int existing = lazyBlock.getType().getLegacyId();
if (BlockType.isContainerBlock(existing)) {
world.clearContainerBlockContents(position); // Clear the container block so that it doesn't drop items

View File

@ -81,7 +81,7 @@ public class SurvivalModeExtent extends AbstractDelegateExtent {
@Override
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
if (toolUse && block.getType() == BlockID.AIR) {
if (toolUse && block.getType().getLegacyId() == BlockID.AIR) {
world.simulateBlockMine(location);
return true;
} else {