Search in sources :

Example 1 with WaystoneValue

use of wraith.waystones.access.WaystoneValue in project FabricWaystones by LordDeatHunter.

the class WaystoneStorage method toTag.

public NbtCompound toTag(NbtCompound tag) {
    if (tag == null) {
        tag = new NbtCompound();
    }
    NbtList waystones = new NbtList();
    for (Map.Entry<String, WaystoneValue> waystone : WAYSTONES.entrySet()) {
        String hash = waystone.getKey();
        WaystoneValue entity = waystone.getValue();
        NbtCompound waystoneTag = new NbtCompound();
        waystoneTag.putString("hash", hash);
        waystoneTag.putString("name", entity.getWaystoneName());
        BlockPos pos = entity.way_getPos();
        waystoneTag.putIntArray("position", Arrays.asList(pos.getX(), pos.getY(), pos.getZ()));
        waystoneTag.putString("dimension", entity.getWorldName());
        waystones.add(waystoneTag);
    }
    tag.put("waystones", waystones);
    NbtList globals = new NbtList();
    var globalWaystones = getGlobals();
    for (String globalWaystone : globalWaystones) {
        globals.add(NbtString.of(globalWaystone));
    }
    tag.put("global_waystones", globals);
    return tag;
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList) WaystoneValue(wraith.waystones.access.WaystoneValue) BlockPos(net.minecraft.util.math.BlockPos) NbtString(net.minecraft.nbt.NbtString) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 NbtCompound (net.minecraft.nbt.NbtCompound)1 NbtList (net.minecraft.nbt.NbtList)1 NbtString (net.minecraft.nbt.NbtString)1 BlockPos (net.minecraft.util.math.BlockPos)1 WaystoneValue (wraith.waystones.access.WaystoneValue)1