use of net.minecraftforge.common.BiomeDictionary.Type in project MinecraftForge by MinecraftForge.
the class BiomeDictionary method listSupertypes.
private static Collection<Type> listSupertypes(Type... types) {
Set<Type> supertypes = new HashSet<Type>();
Deque<Type> next = new ArrayDeque<Type>();
Collections.addAll(next, types);
while (!next.isEmpty()) {
Type type = next.remove();
for (Type sType : Type.byName.values()) {
if (type.subTypes.contains(type) && supertypes.add(sType))
next.add(sType);
}
}
return supertypes;
}
use of net.minecraftforge.common.BiomeDictionary.Type in project Railcraft by Railcraft.
the class GeneratorMine method attemptGen.
private boolean attemptGen(World world, Random rand, int worldX, int worldZ, Biome biome, int cycles, int yLevel) {
NoiseGen cloudNoise = getCloudNoise(world);
NoiseGen veinNoise = getVeinNoise(world);
boolean rich = false;
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
for (BiomeDictionary.Type type : types) {
if (RICH_BIOMES.contains(type)) {
rich = true;
break;
}
}
double fringeArea = 0.7;
double denseArea = rich ? 0.8 : 0.9;
boolean generated = false;
for (int i = 0; i < cycles; i++) {
int x = worldX + rand.nextInt(16);
int z = worldZ + rand.nextInt(16);
double cloudStrength = cloudNoise.noise(x, z);
if (cloudStrength > fringeArea) {
int y = yLevel + Math.round((float) rand.nextGaussian() * yRange);
double veinStrength = veinNoise.noise(x, y, z);
if (veinStrength >= -0.25F && veinStrength <= 0.25F) {
if (cloudStrength > denseArea) {
coreGen(world, rand, new BlockPos(x, y, z));
generated = true;
} else if (rand.nextFloat() > 0.7F) {
fringeGen(world, rand, new BlockPos(x, y, z));
generated = true;
}
}
}
}
return generated;
}
use of net.minecraftforge.common.BiomeDictionary.Type in project ArsMagica2 by Mithion.
the class AM2PoolGen method biomeIsValid.
private boolean biomeIsValid(World world, int x, int y, int z) {
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
Type[] types = BiomeDictionary.getTypesForBiome(biome);
for (Type type : types) {
if (type == Type.END || type == Type.MUSHROOM || type == Type.NETHER || type == Type.WATER || type == Type.WASTELAND) {
return false;
}
}
return true;
}
use of net.minecraftforge.common.BiomeDictionary.Type in project ArsMagica2 by Mithion.
the class BossSpawnHelper method checkForWaterGuardianSpawn.
private void checkForWaterGuardianSpawn(World world, int x, int y, int z) {
if (!world.isRaining())
return;
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
Type[] types = BiomeDictionary.getTypesForBiome(biome);
boolean containsWaterType = false;
for (Type type : types) {
if (type == Type.WATER || type == Type.SWAMP || type == Type.BEACH || type == Type.OCEAN || type == Type.RIVER || type == Type.WET) {
containsWaterType = true;
break;
}
}
if (!containsWaterType)
return;
for (int i = -1; i <= 1; ++i) for (int j = -1; j <= 1; ++j) if (!world.canBlockSeeTheSky(x + i, y + 1, z + j))
return;
List<EntityItem> itemsInRange = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1));
if (itemsInRange.size() != 2)
return;
boolean hasBucket = false;
boolean hasBoat = false;
for (EntityItem item : itemsInRange) {
if (item.isDead)
continue;
if (item.getEntityItem().getItem() == Items.boat)
hasBoat = true;
else if (item.getEntityItem().getItem() == Items.water_bucket)
hasBucket = true;
}
if (hasBoat && hasBucket && !world.isRemote) {
for (EntityItem item : itemsInRange) {
item.setDead();
}
EntityWaterGuardian guardian = new EntityWaterGuardian(world);
guardian.setPosition(x + 0.5, y + 1, z + 0.5);
queuedBosses.put(guardian, world);
}
}
use of net.minecraftforge.common.BiomeDictionary.Type in project ArsMagica2 by Mithion.
the class BossSpawnHelper method onIceEffigyBuilt.
public void onIceEffigyBuilt(World world, int x, int y, int z) {
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
Type[] types = BiomeDictionary.getTypesForBiome(biome);
boolean containsIceType = false;
for (Type type : types) {
if (type == Type.COLD) {
containsIceType = true;
break;
}
}
if (!containsIceType)
return;
for (int i = -1; i <= 1; ++i) for (int j = -1; j <= 1; ++j) if (i == 0 && j == 0)
continue;
else if (!world.canBlockSeeTheSky(x + i, y + 1, z + j))
return;
world.setBlockToAir(x, y, z);
world.setBlockToAir(x, y + 1, z);
world.setBlockToAir(x, y + 2, z);
EntityWinterGuardian guardian = new EntityWinterGuardian(world);
guardian.setPosition(x + 0.5, y + 1, z + 0.5);
world.spawnEntityInWorld(guardian);
}
Aggregations