Search in sources :

Example 11 with Structure

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);
}
Also used : Structure(ivorius.reccomplex.world.gen.feature.structure.Structure) VanillaGeneration(ivorius.reccomplex.world.gen.feature.structure.generic.generation.VanillaGeneration) GenerationType(ivorius.reccomplex.world.gen.feature.structure.generic.generation.GenerationType)

Example 12 with Structure

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);
}
Also used : RCEntityInfo(ivorius.reccomplex.capability.RCEntityInfo) GenericStructure(ivorius.reccomplex.world.gen.feature.structure.generic.GenericStructure) Structure(ivorius.reccomplex.world.gen.feature.structure.Structure) GuiEditGenericStructure(ivorius.reccomplex.gui.editstructure.GuiEditGenericStructure) SimpleLeveledRegistry(ivorius.reccomplex.files.SimpleLeveledRegistry)

Aggregations

Structure (ivorius.reccomplex.world.gen.feature.structure.Structure)12 BlockPos (net.minecraft.util.math.BlockPos)6 RCConfig (ivorius.reccomplex.RCConfig)5 StructureRegistry (ivorius.reccomplex.world.gen.feature.structure.StructureRegistry)5 Nullable (javax.annotation.Nullable)5 WorldServer (net.minecraft.world.WorldServer)5 RCParameters (ivorius.reccomplex.commands.parameters.RCParameters)4 BlockSurfacePos (ivorius.ivtoolkit.blocks.BlockSurfacePos)3 AxisAlignedTransform2D (ivorius.ivtoolkit.math.AxisAlignedTransform2D)3 RecurrentComplex (ivorius.reccomplex.RecurrentComplex)3 StructureSpawnContext (ivorius.reccomplex.world.gen.feature.structure.context.StructureSpawnContext)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 ImmutableMultimap (com.google.common.collect.ImmutableMultimap)2 Lists (com.google.common.collect.Lists)2 Multimap (com.google.common.collect.Multimap)2 WeightedSelector (ivorius.ivtoolkit.random.WeightedSelector)2 IvFunctions (ivorius.ivtoolkit.util.IvFunctions)2 RCExpect (ivorius.reccomplex.commands.parameters.RCExpect)2 ServerTranslations (ivorius.reccomplex.utils.ServerTranslations)2