geforkt von Mirrors/FastAsyncWorldEdit
Don't construct new BaseBlock
Dieser Commit ist enthalten in:
Ursprung
99db2d557a
Commit
144215c813
@ -379,8 +379,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
|||||||
trio.set(x, y, z);
|
trio.set(x, y, z);
|
||||||
CompoundTag nbt = nbtMap.get(trio);
|
CompoundTag nbt = nbtMap.get(trio);
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
BaseBlock block = new BaseBlock(state, nbt);
|
task.run(x, y, z, state.toBaseBlock(nbt));
|
||||||
task.run(x, y, z, block);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -411,8 +410,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
|||||||
trio.set(x, y, z);
|
trio.set(x, y, z);
|
||||||
CompoundTag nbt = nbtMap.get(trio);
|
CompoundTag nbt = nbtMap.get(trio);
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
BaseBlock block = new BaseBlock(state, nbt);
|
task.run(x, y, z, state.toBaseBlock(nbt));
|
||||||
task.run(x, y, z, block);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
|||||||
public class IdDataMaskPattern extends AbstractExtentPattern {
|
public class IdDataMaskPattern extends AbstractExtentPattern {
|
||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
private final int bitMask;
|
private final int bitMask;
|
||||||
private final BaseBlock mutable = new BaseBlock(BlockTypes.AIR);
|
|
||||||
|
|
||||||
public IdDataMaskPattern(Extent extent, Pattern parent, int bitMask) {
|
public IdDataMaskPattern(Extent extent, Pattern parent, int bitMask) {
|
||||||
super(extent);
|
super(extent);
|
||||||
|
@ -205,7 +205,7 @@ public class PropertyPattern extends AbstractExtentPattern {
|
|||||||
if (newOrdinal != ordinal) {
|
if (newOrdinal != ordinal) {
|
||||||
CompoundTag nbt = block.getNbtData();
|
CompoundTag nbt = block.getNbtData();
|
||||||
BlockState newState = BlockState.getFromOrdinal(newOrdinal);
|
BlockState newState = BlockState.getFromOrdinal(newOrdinal);
|
||||||
return nbt != null ? new BaseBlock(newState, nbt) : newState.toBaseBlock();
|
return newState.toBaseBlock(nbt);
|
||||||
}
|
}
|
||||||
return orDefault;
|
return orDefault;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
|
|||||||
if (state.getBlockType().getMaterial().hasContainer()) {
|
if (state.getBlockType().getMaterial().hasContainer()) {
|
||||||
CompoundTag nbt = (CompoundTag) blockMap.get("nbt");
|
CompoundTag nbt = (CompoundTag) blockMap.get("nbt");
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
BaseBlock block = new BaseBlock(state, nbt);
|
BaseBlock block = state.toBaseBlock(nbt);
|
||||||
clipboard.setBlock(x, y, z, block);
|
clipboard.setBlock(x, y, z, block);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ public class FakePlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getBlockInHand(HandSide ignore) {
|
public BaseBlock getBlockInHand(HandSide ignore) {
|
||||||
return new BaseBlock(BlockTypes.AIR.getDefaultState());
|
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -341,7 +341,7 @@ public class CuboidClipboard {
|
|||||||
public BaseBlock getPoint(BlockVector3 position) throws ArrayIndexOutOfBoundsException {
|
public BaseBlock getPoint(BlockVector3 position) throws ArrayIndexOutOfBoundsException {
|
||||||
final BaseBlock block = getBlock(position);
|
final BaseBlock block = getBlock(position);
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
return new BaseBlock(BlockTypes.AIR);
|
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
|
@ -271,7 +271,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbt != null) return new BaseBlock(state, nbt);
|
if (nbt != null) return state.toBaseBlock(nbt);
|
||||||
|
|
||||||
if (blockType == BlockTypes.SIGN || blockType == BlockTypes.WALL_SIGN) {
|
if (blockType == BlockTypes.SIGN || blockType == BlockTypes.WALL_SIGN) {
|
||||||
// Allow special sign text syntax
|
// Allow special sign text syntax
|
||||||
|
@ -204,7 +204,7 @@ public class WorldEditBinding {
|
|||||||
behavior = BindingBehavior.CONSUMES,
|
behavior = BindingBehavior.CONSUMES,
|
||||||
consumedCount = 1)
|
consumedCount = 1)
|
||||||
public BaseBlock getBaseBlock(ArgumentStack context) throws ParameterException, WorldEditException {
|
public BaseBlock getBaseBlock(ArgumentStack context) throws ParameterException, WorldEditException {
|
||||||
return new BaseBlock(getBlockState(context));
|
return getBlockState(context).toBaseBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,6 +153,6 @@ public class ServerCUIHandler {
|
|||||||
structureTag.put("id", new StringTag(BlockTypes.STRUCTURE_BLOCK.getId()));
|
structureTag.put("id", new StringTag(BlockTypes.STRUCTURE_BLOCK.getId()));
|
||||||
|
|
||||||
// return BlockTypes.STRUCTURE_BLOCK.getDefaultState().toBaseBlock(new CompoundTag(structureTag));
|
// return BlockTypes.STRUCTURE_BLOCK.getDefaultState().toBaseBlock(new CompoundTag(structureTag));
|
||||||
return new BaseBlock(BlockTypes.STRUCTURE_BLOCK.getDefaultState(), new CompoundTag(structureTag));
|
return BlockTypes.STRUCTURE_BLOCK.getDefaultState().toBaseBlock(new CompoundTag(structureTag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
|||||||
this(getState(id, data));
|
this(getState(id, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final BlockState getState(int id, int data) {
|
public static final BlockState getState(int id, int data) {
|
||||||
BlockState blockState = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
BlockState blockState = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
||||||
if (blockState == null) {
|
if (blockState == null) {
|
||||||
blockState = BlockTypes.AIR.getDefaultState();
|
blockState = BlockTypes.AIR.getDefaultState();
|
||||||
@ -124,8 +124,8 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static BaseBlock getFromInternalId(int id, CompoundTag nbtData) {
|
public static BaseBlock getFromInternalId(int internalId, CompoundTag nbtData) {
|
||||||
return new BaseBlock(id, nbtData);
|
return BlockState.getFromInternalId(internalId).toBaseBlock(nbtData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -245,7 +245,7 @@ public class AnvilChunk13 implements Chunk {
|
|||||||
BlockState state = sectionBlocks != null ? sectionBlocks[(yIndex << 8) | (z << 4) | x] : BlockTypes.AIR.getDefaultState();
|
BlockState state = sectionBlocks != null ? sectionBlocks[(yIndex << 8) | (z << 4) | x] : BlockTypes.AIR.getDefaultState();
|
||||||
if (state.getMaterial().hasContainer()) {
|
if (state.getMaterial().hasContainer()) {
|
||||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||||
if (tileEntity != null) return new BaseBlock(state, tileEntity);
|
return state.toBaseBlock(tileEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
return state.toBaseBlock();
|
return state.toBaseBlock();
|
||||||
|
@ -238,7 +238,7 @@ public class LegacyMapper {
|
|||||||
}
|
}
|
||||||
}else if(plotBlock instanceof LegacyPlotBlock) {
|
}else if(plotBlock instanceof LegacyPlotBlock) {
|
||||||
try {
|
try {
|
||||||
return new BaseBlock(((LegacyPlotBlock)plotBlock).getId(), ((LegacyPlotBlock)plotBlock).getData());
|
return BaseBlock.getState(((LegacyPlotBlock)plotBlock).getId(), ((LegacyPlotBlock)plotBlock).getData()).toBaseBlock();
|
||||||
}catch(Throwable failed) {
|
}catch(Throwable failed) {
|
||||||
log.error("Unable to convert LegacyPlotBlock " + plotBlock + " to BaseBlock!");
|
log.error("Unable to convert LegacyPlotBlock " + plotBlock + " to BaseBlock!");
|
||||||
failed.printStackTrace();
|
failed.printStackTrace();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren