mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-12 04:23:54 +00:00
Move to BinaryTags where appropriate in adapters
This commit is contained in:
@ -4,6 +4,7 @@ import com.fastasyncworldedit.core.Fawe;
|
||||
import com.fastasyncworldedit.core.util.TaskManager;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -11,26 +12,26 @@ import java.util.function.Supplier;
|
||||
|
||||
public class LazyBaseEntity extends BaseEntity {
|
||||
|
||||
private Supplier<CompoundTag> saveTag;
|
||||
private Supplier<CompoundBinaryTag> saveTag;
|
||||
|
||||
public LazyBaseEntity(EntityType type, Supplier<CompoundTag> saveTag) {
|
||||
public LazyBaseEntity(EntityType type, Supplier<CompoundBinaryTag> saveTag) {
|
||||
super(type);
|
||||
this.saveTag = saveTag;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CompoundTag getNbtData() {
|
||||
Supplier<CompoundTag> tmp = saveTag;
|
||||
public CompoundBinaryTag getNbt() {
|
||||
Supplier<CompoundBinaryTag> tmp = saveTag;
|
||||
if (tmp != null) {
|
||||
saveTag = null;
|
||||
if (Fawe.isMainThread()) {
|
||||
setNbtData(tmp.get());
|
||||
setNbt(tmp.get());
|
||||
} else {
|
||||
setNbtData(TaskManager.taskManager().sync(tmp));
|
||||
setNbt(TaskManager.taskManager().sync(tmp));
|
||||
}
|
||||
}
|
||||
return super.getNbtData();
|
||||
return super.getNbt();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user