use of net.minecraftforge.common.BiomeDictionary.Type in project MinecraftForge by MinecraftForge.
the class BiomeDictionary method addTypes.
/**
* Adds the given types to the biome.
*
*/
public static void addTypes(Biome biome, Type... types) {
Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot add types to unregistered biome %s", biome);
Collection<Type> supertypes = listSupertypes(types);
for (Type type : supertypes) {
type.biomes.add(biome);
}
BiomeInfo biomeInfo = getBiomeInfo(biome);
Collections.addAll(biomeInfo.types, types);
biomeInfo.types.addAll(supertypes);
}
use of net.minecraftforge.common.BiomeDictionary.Type in project ArsMagica2 by Mithion.
the class AM2WorldDecorator method generateOverworld.
public void generateOverworld(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
generateOre(vinteum, vinteumFrequency, world, random, vinteumMin, vinteumMax, chunkX, chunkZ);
generateOre(chimerite, chimeriteFrequency, world, random, chimeriteMin, chimeriteMax, chunkX, chunkZ);
generateOre(blueTopaz, topazFrequency, world, random, topazMin, topazMax, chunkX, chunkZ);
generateOre(sunstone, sunstoneFrequency, world, random, sunstoneMin, sunstoneMax, chunkX, chunkZ);
generateFlowers(blueOrchid, world, random, chunkX, chunkZ);
generateFlowers(desertNova, world, random, chunkX, chunkZ);
generateFlowers(tarmaRoot, world, random, chunkX, chunkZ);
BiomeGenBase biome = world.getBiomeGenForCoords(chunkX << 4, chunkZ << 4);
Type[] biomeTypes = BiomeDictionary.getTypesForBiome(biome);
boolean typeValid = false;
for (Type type : biomeTypes) {
if (type == Type.BEACH || type == Type.SWAMP || type == Type.JUNGLE || type == Type.PLAINS || type == Type.WATER) {
typeValid = true;
} else if (type == Type.FROZEN) {
typeValid = false;
break;
}
}
if (biome != BiomeGenBase.ocean && typeValid && random.nextInt(wakeChance) < 7) {
generateFlowers(wakebloom, world, random, chunkX, chunkZ);
}
if (random.nextInt(witchChance) == 0) {
generateTree(witchwoodTree, world, random, chunkX, chunkZ);
}
if (random.nextInt(poolChance) == 0) {
generatePools(world, random, chunkX, chunkZ);
}
if ((BiomeDictionary.isBiomeOfType(biome, Type.MAGICAL) || BiomeDictionary.isBiomeOfType(biome, Type.FOREST)) && random.nextInt(4) == 0 && TerrainGen.populate(chunkProvider, world, random, chunkX, chunkZ, true, LAKE)) {
int lakeGenX = (chunkX * 16) + random.nextInt(16) + 8;
int lakeGenY = random.nextInt(128);
int lakeGenZ = (chunkZ * 16) + random.nextInt(16) + 8;
(new WorldGenEssenceLakes(BlocksCommonProxy.liquidEssence)).generate(world, random, lakeGenX, lakeGenY, lakeGenZ);
}
}
use of net.minecraftforge.common.BiomeDictionary.Type in project ArsMagica2 by Mithion.
the class EntityFlicker method getCanSpawnHere.
@Override
public boolean getCanSpawnHere() {
if (AMCore.proxy.getTotalFlickerCount() > 8 * worldObj.playerEntities.size() || worldObj.rand.nextDouble() > 0.2f) {
return false;
}
//get the biome we're trying to spawn in
BiomeGenBase biome = worldObj.getBiomeGenForCoords((int) Math.floor(this.posX), (int) Math.floor(this.posZ));
if (biome != null) {
//get the tags on this biome
Type[] biomeTags = BiomeDictionary.getTypesForBiome(biome);
//pick a random tag to focus on
Type tagType = biomeTags[worldObj.rand.nextInt(biomeTags.length)];
//create a list of valid types based on that tag
ArrayList<Affinity> validAffinities = new ArrayList<Affinity>();
//DO NOT USE THIS LIST FOR AIR/EARTH/LIFE - they are handled by special cases.
switch(tagType) {
case END:
validAffinities.add(Affinity.ENDER);
break;
case FOREST:
case CONIFEROUS:
case JUNGLE:
validAffinities.add(Affinity.NATURE);
break;
case COLD:
case SNOWY:
validAffinities.add(Affinity.ICE);
break;
case MAGICAL:
validAffinities.add(Affinity.ARCANE);
break;
case NETHER:
validAffinities.add(Affinity.FIRE);
break;
case OCEAN:
validAffinities.add(Affinity.LIGHTNING);
case SWAMP:
case WATER:
case RIVER:
case WET:
case BEACH:
validAffinities.add(Affinity.WATER);
break;
case DEAD:
case DENSE:
case DRY:
case HOT:
case LUSH:
case MESA:
case SANDY:
case SAVANNA:
case SPARSE:
case SPOOKY:
case WASTELAND:
case PLAINS:
case HILLS:
case MOUNTAIN:
case MUSHROOM:
default:
break;
}
//special conditions for air/earth flickers based on y coordinate
if (posY < 55) {
validAffinities.add(Affinity.EARTH);
}
if (worldObj.canBlockSeeTheSky((int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ)))
validAffinities.add(Affinity.AIR);
if (worldObj.isRaining() && worldObj.rand.nextBoolean()) {
validAffinities.clear();
validAffinities.add(Affinity.LIGHTNING);
}
if (validAffinities.size() <= 0)
return false;
//life flickers always have a chance to spawn?
if (worldObj.rand.nextDouble() < 0.1f) {
this.setFlickerType(Affinity.LIFE);
} else {
this.setFlickerType(validAffinities.get(worldObj.rand.nextInt(validAffinities.size())));
}
if (this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) {
AMCore.proxy.incrementFlickerCount();
return true;
}
}
return false;
}
use of net.minecraftforge.common.BiomeDictionary.Type in project Traverse by ProfessorProspector.
the class TraverseWorld method register.
public static void register(Version versionAdded, Biome biome, BiomeManager.BiomeType type, String name, int weight, BiomeDictionary.Type... biomeDictTypes) {
boolean canRegister;
if (!TraverseConfig.registerBiomesRegardless) {
TraverseConfig.reloadVersionConfig();
canRegister = VersionUtils.isVersionLessOrEqual(versionAdded, TraverseConfig.version);
} else {
canRegister = true;
}
if (canRegister) {
biome.setRegistryName(new ResourceLocation(TraverseConstants.MOD_ID, name));
GameRegistry.register(biome);
BiomeManager.addBiome(type, new BiomeManager.BiomeEntry(biome, weight));
BiomeManager.addSpawnBiome(biome);
BiomeProvider.allowedBiomes.add(biome);
for (BiomeDictionary.Type biomeDictType : biomeDictTypes) {
BiomeDictionary.addTypes(biome, biomeDictType);
}
biomeList.put(biome, versionAdded);
}
}
Aggregations