Search in sources :

Example 1 with StructuresLoaded

use of com.irtimaled.bbor.common.events.StructuresLoaded 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));
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT) StructureStart(net.minecraft.world.gen.feature.structure.StructureStart) StructuresLoaded(com.irtimaled.bbor.common.events.StructuresLoaded)

Aggregations

StructuresLoaded (com.irtimaled.bbor.common.events.StructuresLoaded)1 CompoundNBT (net.minecraft.nbt.CompoundNBT)1 StructureStart (net.minecraft.world.gen.feature.structure.StructureStart)1