use of ivorius.reccomplex.world.gen.feature.structure.Structure in project RecurrentComplex by Ivorforce.
the class GenericVillageCreationHandler method getVillagePieceWeight.
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int villageSize) {
Structure structure = StructureRegistry.INSTANCE.hasActive(structureID) ? StructureRegistry.INSTANCE.get(structureID) : null;
if (structure != null) {
float tweakedWeight = RCConfig.tweakedSpawnRate(structureID);
GenerationType generationType = structure.generationType(generationID);
if (generationType instanceof VanillaGeneration) {
VanillaGeneration vanillaGenInfo = (VanillaGeneration) generationType;
int spawnLimit = MathHelper.floor(MathHelper.nextDouble(random, vanillaGenInfo.minBaseLimit + villageSize * vanillaGenInfo.minScaledLimit, vanillaGenInfo.maxBaseLimit + villageSize * vanillaGenInfo.maxScaledLimit) + 0.5);
return new StructureVillagePieces.PieceWeight(getComponentClass(), vanillaGenInfo.getVanillaWeight(tweakedWeight), spawnLimit);
}
}
return new StructureVillagePieces.PieceWeight(getComponentClass(), 0, 0);
}
use of ivorius.reccomplex.world.gen.feature.structure.Structure in project RecurrentComplex by Ivorforce.
the class PacketEditStructureHandler method openEditStructure.
public static void openEditStructure(GenericStructure structureInfo, String structureID, EntityPlayerMP player) {
if (structureID == null)
structureID = "NewStructure";
RCEntityInfo entityInfo = RCEntityInfo.get(player, null);
if (entityInfo != null)
entityInfo.setCachedExportStructureBlockDataNBT(structureInfo.worldDataCompound);
SimpleLeveledRegistry<Structure<?>>.Status<Structure<?>> status = StructureRegistry.INSTANCE.status(structureID);
RecurrentComplex.network.sendTo(new PacketEditStructure(structureInfo, structureID, SaveDirectoryData.defaultData(structureID, status != null && status.isActive(), RecurrentComplex.loader.tryFindIDs(ResourceDirectory.ACTIVE.toPath(), RCFileSuffix.STRUCTURE), RecurrentComplex.loader.tryFindIDs(ResourceDirectory.INACTIVE.toPath(), RCFileSuffix.STRUCTURE))), player);
}
Aggregations