Search in sources :

Example 1 with NbtLongArray

use of net.minecraft.nbt.NbtLongArray in project Astromine by Mixinors.

the class WorldHoloBridgeComponent method writeToNbt.

/**
 * Serializes this {@link WorldHoloBridgeComponent} to a {@link NbtCompound}.
 */
@Override
public void writeToNbt(NbtCompound tag) {
    var dataTag = new NbtList();
    for (var entry : entries.long2ObjectEntrySet()) {
        var pointTag = new NbtCompound();
        var vecs = new long[entry.getValue().size()];
        var i = 0;
        for (var vec : entry.getValue()) {
            vecs[i++] = BlockPos.asLong(vec.getX(), vec.getY(), vec.getZ());
        }
        pointTag.putLong("Positions", entry.getLongKey());
        pointTag.put("Vectors", new NbtLongArray(vecs));
        dataTag.add(pointTag);
    }
    tag.put("Data", dataTag);
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList) NbtLongArray(net.minecraft.nbt.NbtLongArray)

Aggregations

NbtCompound (net.minecraft.nbt.NbtCompound)1 NbtList (net.minecraft.nbt.NbtList)1 NbtLongArray (net.minecraft.nbt.NbtLongArray)1