use of net.glowstone.generator.structures.util.StructureBoundingBox in project Glowstone by GlowstoneMC.
the class StructurePieceStore method load.
/**
* Load structure piece data of the appropriate type from the given compound tag.
*
* @param structurePiece The target structure piece.
* @param compound The structure piece's tag.
*/
public void load(T structurePiece, CompoundTag compound) {
if (compound.isInt("GD")) {
structurePiece.setGD(compound.getInt("GD"));
}
if (compound.isInt("O")) {
structurePiece.setNumericOrientation(compound.getInt("O"));
}
if (compound.isIntArray("BB")) {
int[] bb = compound.getIntArray("BB");
if (bb.length == 6) {
StructureBoundingBox boundingBox = new StructureBoundingBox(new Vector(bb[0], bb[1], bb[2]), new Vector(bb[3], bb[4], bb[5]));
structurePiece.setBoundingBox(boundingBox);
}
}
}
use of net.glowstone.generator.structures.util.StructureBoundingBox in project Glowstone by GlowstoneMC.
the class StructurePieceStore method save.
/**
* Save information about this structure piece to the given tag.
*
* @param structurePiece The structure piece to save.
* @param compound The target tag.
*/
public void save(T structurePiece, CompoundTag compound) {
compound.putInt("GD", structurePiece.getGD());
compound.putInt("O", structurePiece.getNumericOrientation());
StructureBoundingBox boundingBox = structurePiece.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);
}
use of net.glowstone.generator.structures.util.StructureBoundingBox in project Glowstone by GlowstoneMC.
the class StructureStore method load.
/**
* Load structure data of the appropriate type from the given compound tag.
*
* @param structure The target structure.
* @param compound The structure's tag.
*/
public void load(T structure, CompoundTag compound) {
if (compound.isIntArray("BB")) {
int[] bb = compound.getIntArray("BB");
if (bb.length == 6) {
StructureBoundingBox boundingBox = new StructureBoundingBox(new Vector(bb[0], bb[1], bb[2]), new Vector(bb[3], bb[4], bb[5]));
structure.setBoundingBox(boundingBox);
}
}
if (compound.isList("Children", TagType.COMPOUND)) {
for (CompoundTag tag : compound.getCompoundList("Children")) {
structure.addPiece(StructurePieceStorage.loadStructurePiece(tag));
}
}
}
Aggregations