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));
}
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;
}
Aggregations