Don't construct new BaseBlock

This commit is contained in:
Jesse Boyd
2019-04-06 01:12:57 +11:00
parent 99db2d557a
commit 144215c813
12 changed files with 15 additions and 18 deletions

View File

@ -379,8 +379,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
trio.set(x, y, z);
CompoundTag nbt = nbtMap.get(trio);
if (nbt != null) {
BaseBlock block = new BaseBlock(state, nbt);
task.run(x, y, z, block);
task.run(x, y, z, state.toBaseBlock(nbt));
continue;
}
}
@ -411,8 +410,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
trio.set(x, y, z);
CompoundTag nbt = nbtMap.get(trio);
if (nbt != null) {
BaseBlock block = new BaseBlock(state, nbt);
task.run(x, y, z, block);
task.run(x, y, z, state.toBaseBlock(nbt));
continue;
}
}

View File

@ -12,7 +12,6 @@ import com.sk89q.worldedit.world.block.BlockTypes;
public class IdDataMaskPattern extends AbstractExtentPattern {
private final Pattern pattern;
private final int bitMask;
private final BaseBlock mutable = new BaseBlock(BlockTypes.AIR);
public IdDataMaskPattern(Extent extent, Pattern parent, int bitMask) {
super(extent);

View File

@ -205,7 +205,7 @@ public class PropertyPattern extends AbstractExtentPattern {
if (newOrdinal != ordinal) {
CompoundTag nbt = block.getNbtData();
BlockState newState = BlockState.getFromOrdinal(newOrdinal);
return nbt != null ? new BaseBlock(newState, nbt) : newState.toBaseBlock();
return newState.toBaseBlock(nbt);
}
return orDefault;
}

View File

@ -122,7 +122,7 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
if (state.getBlockType().getMaterial().hasContainer()) {
CompoundTag nbt = (CompoundTag) blockMap.get("nbt");
if (nbt != null) {
BaseBlock block = new BaseBlock(state, nbt);
BaseBlock block = state.toBaseBlock(nbt);
clipboard.setBlock(x, y, z, block);
continue;
}

View File

@ -153,7 +153,7 @@ public class FakePlayer extends AbstractPlayerActor {
@Override
public BaseBlock getBlockInHand(HandSide ignore) {
return new BaseBlock(BlockTypes.AIR.getDefaultState());
return BlockTypes.AIR.getDefaultState().toBaseBlock();
}
@Override