Search in sources :

Example 1 with GlowStructurePiece

use of net.glowstone.generator.structures.GlowStructurePiece in project Glowstone by GlowstoneMC.

the class StructureStore method save.

/**
     * Save information about this structure to the given tag.
     *
     * @param structure The structure to save.
     * @param compound  The target tag.
     */
public void save(T structure, CompoundTag compound) {
    StructureBoundingBox boundingBox = structure.getBoundingBox();
    int[] bb = new int[6];
    bb[0] = boundingBox.getMin().getBlockX();
    bb[1] = boundingBox.getMin().getBlockY();
    bb[2] = boundingBox.getMin().getBlockZ();
    bb[3] = boundingBox.getMax().getBlockX();
    bb[4] = boundingBox.getMax().getBlockY();
    bb[5] = boundingBox.getMax().getBlockZ();
    compound.putIntArray("BB", bb);
    List<CompoundTag> children = new ArrayList<>();
    for (GlowStructurePiece piece : structure.getPieces()) {
        CompoundTag tag = new CompoundTag();
        StructurePieceStorage.saveStructurePiece(piece, tag);
        children.add(tag);
    }
    compound.putCompoundList("Children", children);
}
Also used : StructureBoundingBox(net.glowstone.generator.structures.util.StructureBoundingBox) ArrayList(java.util.ArrayList) GlowStructurePiece(net.glowstone.generator.structures.GlowStructurePiece) CompoundTag(net.glowstone.util.nbt.CompoundTag)

Aggregations

ArrayList (java.util.ArrayList)1 GlowStructurePiece (net.glowstone.generator.structures.GlowStructurePiece)1 StructureBoundingBox (net.glowstone.generator.structures.util.StructureBoundingBox)1 CompoundTag (net.glowstone.util.nbt.CompoundTag)1