mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-03-13 13:57:48 +08:00
Lazify some more conversions
This commit is contained in:
parent
b67fff6662
commit
b7880c2f4a
@ -100,7 +100,7 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
||||
|
||||
@Override
|
||||
public <V> BaseBlock with(Property<V> property, V value) {
|
||||
return this.blockState.with(property, value).toBaseBlock(getNbt());
|
||||
return this.blockState.with(property, value).toBaseBlock(getNbtReference());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,6 +51,7 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.SideEffect;
|
||||
import com.sk89q.worldedit.util.SideEffectSet;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.util.concurrency.LazyReference;
|
||||
import com.sk89q.worldedit.util.io.file.SafeFiles;
|
||||
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
@ -426,7 +427,7 @@ public class FabricWorld extends AbstractWorld {
|
||||
if (blockEntity != null) {
|
||||
net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag();
|
||||
blockEntity.toTag(tag);
|
||||
state = state.toBaseBlock(NBTConverter.fromNative(tag));
|
||||
state = state.toBaseBlock(LazyReference.from(() -> NBTConverter.fromNative(tag)));
|
||||
}
|
||||
extent.setBlock(vec, state.toBaseBlock());
|
||||
|
||||
@ -602,7 +603,7 @@ public class FabricWorld extends AbstractWorld {
|
||||
if (tile != null) {
|
||||
net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag();
|
||||
tile.toTag(tag);
|
||||
return getBlock(position).toBaseBlock(NBTConverter.fromNative(tag));
|
||||
return getBlock(position).toBaseBlock(LazyReference.from(() -> NBTConverter.fromNative(tag)));
|
||||
} else {
|
||||
return getBlock(position).toBaseBlock();
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.SideEffect;
|
||||
import com.sk89q.worldedit.util.SideEffectSet;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.util.concurrency.LazyReference;
|
||||
import com.sk89q.worldedit.util.io.file.SafeFiles;
|
||||
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
@ -437,7 +438,7 @@ public class ForgeWorld extends AbstractWorld {
|
||||
if (blockEntity != null) {
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
blockEntity.write(tag);
|
||||
state = state.toBaseBlock(NBTConverter.fromNative(tag));
|
||||
state = state.toBaseBlock(LazyReference.from(() -> NBTConverter.fromNative(tag)));
|
||||
}
|
||||
extent.setBlock(vec, state.toBaseBlock());
|
||||
|
||||
@ -610,7 +611,10 @@ public class ForgeWorld extends AbstractWorld {
|
||||
TileEntity tile = getWorld().getChunk(pos).getTileEntity(pos);
|
||||
|
||||
if (tile != null) {
|
||||
return getBlock(position).toBaseBlock(NBTConverter.fromNative(TileEntityUtils.copyNbtData(tile)));
|
||||
CompoundNBT tag = TileEntityUtils.copyNbtData(tile);
|
||||
return getBlock(position).toBaseBlock(
|
||||
LazyReference.from(() -> NBTConverter.fromNative(tag))
|
||||
);
|
||||
} else {
|
||||
return getBlock(position).toBaseBlock();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user