use of net.minecraft.world.gen.feature.structure.StructureStart in project BoundingBoxOutlineReloaded by irtimaled.
the class StructureProcessor method addStructures.
private void addStructures(BoundingBoxType type, Map<String, StructureStart> structureMap) {
StructureStart structureStart = structureMap.get(type.getName());
if (structureStart == null)
return;
MutableBoundingBox bb = structureStart.getBoundingBox();
if (bb == null)
return;
AbstractBoundingBox boundingBox = buildStructure(bb, type);
if (boundingBoxCache.isCached(boundingBox))
return;
Set<AbstractBoundingBox> structureBoundingBoxes = new HashSet<>();
for (StructurePiece structureComponent : structureStart.getComponents()) {
structureBoundingBoxes.add(buildStructure(structureComponent.getBoundingBox(), type));
}
boundingBoxCache.addBoundingBoxes(boundingBox, structureBoundingBoxes);
}
use of net.minecraft.world.gen.feature.structure.StructureStart in project BoundingBoxOutlineReloaded by irtimaled.
the class CommonInterop method chunkLoaded.
public static void chunkLoaded(Chunk chunk) {
DimensionId dimensionId = DimensionId.from(chunk.getWorld().getDimension().getType());
Map<String, StructureStart> structures = chunk.getStructureStarts();
if (structures.size() > 0)
EventBus.publish(new StructuresLoaded(structures, dimensionId));
}
use of net.minecraft.world.gen.feature.structure.StructureStart in project BoundingBoxOutlineReloaded by irtimaled.
the class NBTStructureLoader method loadStructures.
void loadStructures(int chunkX, int chunkZ) {
if (saveHandler == null)
return;
if (!loadedChunks.add(String.format("%s,%s", chunkX, chunkZ)))
return;
CompoundNBT structureStarts = loadStructureStarts(chunkX, chunkZ);
if (structureStarts == null || structureStarts.size() == 0)
return;
Map<String, StructureStart> structureStartMap = new HashMap<>();
for (String key : structureStarts.keySet()) {
CompoundNBT compound = structureStarts.getCompound(key);
if (compound.contains("BB")) {
structureStartMap.put(key, new SimpleStructureStart(compound));
}
}
EventBus.publish(new StructuresLoaded(structureStartMap, dimensionId));
}
Aggregations