Lazy tags + get / set tiles

Lazy tags means tiles/ents are not translated into the nms NBTBase until it is needed. Should be faster in cases where getFullBlock is called, but nbt is not always needed.
Commands like Copy and Paste, where the input/output are both nms worlds, can entirely bypass WorldEdit translating to and from the WorldEdit JNBT classes.
This commit is contained in:
Jesse Boyd
2019-11-20 03:40:52 +00:00
parent 60759934a3
commit 144ea2ef34
40 changed files with 298 additions and 172 deletions

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.beta.implementation.blocks;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -11,7 +12,8 @@ public abstract class CharGetBlocks extends CharBlocks implements IChunkGet {
@Override
public BaseBlock getFullBlock(int x, int y, int z) {
return BlockTypesCache.states[get(x, y, z)].toBaseBlock();
BlockState state = BlockTypesCache.states[get(x, y, z)];
return state.toBaseBlock(this, x, y, z);
}
@Override

View File

@ -101,7 +101,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
@Override
public boolean setTile(int x, int y, int z, CompoundTag tile) {
if (tiles == null) {
tiles = new BlockVector3ChunkMap<CompoundTag>();
tiles = new BlockVector3ChunkMap<>();
}
tiles.put(x, y, z, tile);
return true;