Search in sources :

Example 1 with LandAspectRegistry

use of com.mraof.minestuck.world.lands.LandAspectRegistry 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)

Aggregations

LandAspectRegistry (com.mraof.minestuck.world.lands.LandAspectRegistry)1 AspectCombination (com.mraof.minestuck.world.lands.LandAspectRegistry.AspectCombination)1 TerrainLandAspect (com.mraof.minestuck.world.lands.terrain.TerrainLandAspect)1 TitleLandAspect (com.mraof.minestuck.world.lands.title.TitleLandAspect)1