Search in sources :

Example 1 with AspectCombination

use of com.mraof.minestuck.world.lands.LandAspectRegistry.AspectCombination in project Minestuck by mraof.

the class SburbHandler method genLandAspects.

private static void genLandAspects(SburbConnection connection) {
    LandAspectRegistry aspectGen = new LandAspectRegistry((Minestuck.worldSeed ^ connection.clientHomeLand) ^ (connection.clientHomeLand << 8));
    Session session = getPlayerSession(connection.getClientIdentifier());
    Title title = MinestuckPlayerData.getTitle(connection.getClientIdentifier());
    TitleLandAspect titleAspect = null;
    TerrainLandAspect terrainAspect = null;
    if (session.predefinedPlayers.containsKey(connection.getClientIdentifier())) {
        PredefineData data = session.predefinedPlayers.get(connection.getClientIdentifier());
        if (data.landTitle != null)
            titleAspect = data.landTitle;
        if (data.landTerrain != null)
            terrainAspect = data.landTerrain;
    }
    boolean frogs = false;
    ArrayList<TerrainLandAspect> usedTerrainAspects = new ArrayList<TerrainLandAspect>();
    ArrayList<TitleLandAspect> usedTitleAspects = new ArrayList<TitleLandAspect>();
    for (SburbConnection c : session.connections) if (c.enteredGame && c != connection) {
        LandAspectRegistry.AspectCombination aspects = MinestuckDimensionHandler.getAspects(c.clientHomeLand);
        if (aspects.aspectTitle == LandAspectRegistry.frogAspect)
            frogs = true;
        usedTitleAspects.add(aspects.aspectTitle);
        usedTerrainAspects.add(aspects.aspectTerrain);
    }
    for (PredefineData data : session.predefinedPlayers.values()) {
        if (data.landTerrain != null)
            usedTerrainAspects.add(data.landTerrain);
        if (data.landTitle != null) {
            usedTitleAspects.add(data.landTitle);
            if (data.landTitle == LandAspectRegistry.frogAspect)
                frogs = true;
        }
    }
    if (titleAspect == null)
        titleAspect = aspectGen.getTitleAspect(terrainAspect, title.getHeroAspect(), usedTitleAspects);
    if (terrainAspect == null)
        terrainAspect = aspectGen.getTerrainAspect(titleAspect, usedTerrainAspects);
    MinestuckDimensionHandler.registerLandDimension(connection.clientHomeLand, new AspectCombination(terrainAspect, titleAspect));
}
Also used : TerrainLandAspect(com.mraof.minestuck.world.lands.terrain.TerrainLandAspect) TitleLandAspect(com.mraof.minestuck.world.lands.title.TitleLandAspect) AspectCombination(com.mraof.minestuck.world.lands.LandAspectRegistry.AspectCombination) LandAspectRegistry(com.mraof.minestuck.world.lands.LandAspectRegistry)

Example 2 with AspectCombination

use of com.mraof.minestuck.world.lands.LandAspectRegistry.AspectCombination in project Minestuck by mraof.

the class LandAspectLootCondition method testCondition.

@Override
public boolean testCondition(Random rand, LootContext context) {
    WorldServer world = context.getWorld();
    if (world != null && MinestuckDimensionHandler.isLandDimension(world.provider.getDimension())) {
        AspectCombination aspects = MinestuckDimensionHandler.getAspects(world.provider.getDimension());
        TerrainLandAspect terrain = includeSubtypes ? aspects.aspectTerrain.getPrimaryVariant() : aspects.aspectTerrain;
        TitleLandAspect title = includeSubtypes ? aspects.aspectTitle.getPrimaryVariant() : aspects.aspectTitle;
        for (ILandAspect aspect : landAspectNames) if (terrain == aspect || title == aspect)
            return !inverted;
    }
    return inverted;
}
Also used : TerrainLandAspect(com.mraof.minestuck.world.lands.terrain.TerrainLandAspect) WorldServer(net.minecraft.world.WorldServer) TitleLandAspect(com.mraof.minestuck.world.lands.title.TitleLandAspect) ILandAspect(com.mraof.minestuck.world.lands.ILandAspect) AspectCombination(com.mraof.minestuck.world.lands.LandAspectRegistry.AspectCombination)

Aggregations

AspectCombination (com.mraof.minestuck.world.lands.LandAspectRegistry.AspectCombination)2 TerrainLandAspect (com.mraof.minestuck.world.lands.terrain.TerrainLandAspect)2 TitleLandAspect (com.mraof.minestuck.world.lands.title.TitleLandAspect)2 ILandAspect (com.mraof.minestuck.world.lands.ILandAspect)1 LandAspectRegistry (com.mraof.minestuck.world.lands.LandAspectRegistry)1 WorldServer (net.minecraft.world.WorldServer)1