public static void preInit() { int biomeID = 10; while (BiomeDictionary.isBiomeRegistered(biomeID)) biomeID++; // Create Town Forest biomeTownForest = new BiomeTownForest(biomeID).setBiomeName(BiomeTownForest.name); // Allow villages in this biome BiomeManager.addVillageBiome(biomeTownForest, true); BiomeDictionary.registerBiomeType(biomeTownForest, Type.MAGICAL); int weight = Configs.VILLAGE.town_weight; LogHelper.info("ModBiomes: Town Forest created with weight: " + weight); biomeEntryTownForest = new BiomeEntry(biomeTownForest, weight); BiomeManager.addBiome(BiomeType.WARM, biomeEntryTownForest); // Create City Forest biomeID++; biomeCityPlains = new BiomeCityPlains(biomeID).setBiomeName(BiomeCityPlains.name); // Allow villages in this biome BiomeManager.addVillageBiome(biomeCityPlains, true); BiomeDictionary.registerBiomeType(biomeCityPlains, Type.MAGICAL); weight = Configs.VILLAGE.city_weight; LogHelper.info("ModBiomes: City Plains created with weight: " + weight); biomeEntryCityPlains = new BiomeEntry(biomeCityPlains, weight); BiomeManager.addBiome(BiomeType.WARM, biomeEntryCityPlains); }
public static Anima getFromBiome(Biome biome) { if (BiomeDictionary.hasType(biome, Type.WATER)) return Anima.DEPTH; else if (BiomeDictionary.hasType(biome, Type.FOREST) || BiomeDictionary.hasType(biome, Type.PLAINS)) return Anima.HORIZON; else if (BiomeDictionary.hasType(biome, Type.DRY) || BiomeDictionary.hasType(biome, Type.NETHER) || BiomeDictionary.hasType(biome, Type.HOT)) return Anima.INFERNO; else if (BiomeDictionary.hasType(biome, Type.HILLS) || BiomeDictionary.hasType(biome, Type.MOUNTAIN) || BiomeDictionary.hasType(biome, Type.COLD)) return Anima.OZONE; else if (BiomeDictionary.hasType(biome, Type.MESA)) return Anima.CHAOS; else if (biome.equals(Biomes.MUSHROOM_ISLAND) || biome.equals(Biomes.MUSHROOM_ISLAND_SHORE)) return Anima.PEACE; else return Anima.HORIZON; }
private boolean isBiomeValid(World world, int chunkX, int chunkZ, ArrayList<Type> biomeTypes, ArrayList<Integer> biomeIDs) { if (biomeTypes != null) { for (Type type : BiomeDictionary.getTypesForBiome(world.getBiomeGenForCoords(new BlockPos(chunkX * 16, 0, chunkZ * 16)))) { if (biomeTypes.contains(type)) { return true; } } } if (biomeIDs != null) { BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(chunkX * 16, 0, chunkZ * 16)); if (biomeIDs.contains(biome.biomeID)) { return true; } } return false; }
public Generation(IGenerationCategory Category, EnumGenerationPriority GeneratorPriority, EnumGenerationType GeneratorType, float Chance, int Frequency, int MinY, int MaxY, int Size, ArrayList<Integer> Dimensions, ArrayList<Type> BiomeTypes, ArrayList<Integer> BiomeIDs, IWeightedBlockState[] WeightedBlocks, IParsableBlockState BlockToReplace) { this.category = Category; this.generatorPriority = GeneratorPriority; this.generatorType = GeneratorType; this.frequency = Frequency; this.minY = MinY; this.maxY = MaxY; this.size = Size; this.dimensions = Dimensions; this.weightedBlocks = WeightedBlocks; this.biomeTypes = BiomeTypes; this.biomeIDs = BiomeIDs; this.blockToReplace = BlockToReplace; this.chance = Chance; }
/** * returns different spawn rates for different biomes TODO find a cleaner * method of implementation, poor case-by-case * * @param biome * @return */ public int biomeMultiplyer(BiomeGenBase biome) { if (BiomeDictionary.isBiomeOfType(biome, Type.SWAMP)) { return 16; } if (BiomeDictionary.isBiomeOfType(biome, Type.CONIFEROUS)) { return 10; } if (BiomeDictionary.isBiomeOfType(biome, Type.PLAINS)) { return 6; } else { return 0; } }
@Override public boolean setField(String fieldName, Object object) { String fieldValue = (String) object; String[] split = fieldValue.split(","); StringBuilder fullString = new StringBuilder(); try { Type[] types = new Type[split.length]; for (int i = 0; i < types.length; i++) { types[i] = Type.getType(split[i].trim()); } theBiomeTypes = types; } catch (Exception e) {} biomeTypes = fieldValue; return true; }
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature) { for (BiomeGenBase biome : BiomeGenBase.biomeList) { if(biome != null) { if(BiomeDictionary.isBiomeRegistered(biome)) { if(BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END)) { return; } if(BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)) { return; } if(BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MUSHROOM)) { return; } } EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biome); } } }
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeDictionary.Type type) { for (BiomeGenBase biome : BiomeGenBase.biomeList) { if(biome != null) { if(BiomeDictionary.isBiomeRegistered(biome)) { if(BiomeDictionary.isBiomeOfType(biome, type)) { EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biome); } } } } }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.forest.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forestHills.biomeName); defaultBiomesToSpawn.add("Autumn Woods"); defaultBiomesToSpawn.add("Birch Forest"); defaultBiomesToSpawn.add("Forested Hills"); defaultBiomesToSpawn.add("Forested Island"); defaultBiomesToSpawn.add("Green Hills"); defaultBiomesToSpawn.add("Redwood Forest"); defaultBiomesToSpawn.add("Lush Redwoods"); defaultBiomesToSpawn.add("Temperate Rainforest"); defaultBiomesToSpawn.add("Woodlands"); HashSet<String> nonFrozenForest = new HashSet<String>(); nonFrozenForest.addAll(typeToArray(Type.FOREST)); nonFrozenForest.addAll(typeToArray(Type.PLAINS)); nonFrozenForest.removeAll(typeToArray(Type.FROZEN)); defaultBiomesToSpawn.addAll(nonFrozenForest); return defaultBiomesToSpawn; }
@Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { final Settings settings = Settings.INSTANCE; if (settings.isOverworldTreeGenEnabled()) { final int x = (chunkX << 4) + 8 + random.nextInt(16); final int z = (chunkZ << 4) + 8 + random.nextInt(16); final BiomeGenBase biome = world.getBiomeGenForCoords(x, z); final List<Type> biomeTypes = ImmutableList.copyOf(BiomeDictionary.getTypesForBiome(biome)); if (!(biomeTypes.contains(Type.NETHER) || biomeTypes.contains(Type.END))) if (random.nextInt(settings.overworldTreeGenRarity()) == 0) { final OverworldTreeSpecies species = OverworldTreeSpecies.values()[random.nextInt(OverworldTreeSpecies.values().length)]; final WorldGenerator tree = species.worldTreeGenerator(); final int maxY = world.getHeightValue(x, z) * 2; final int y = maxY > 0 ? random.nextInt(maxY) : 0; tree.generate(world, random, x, y, z); } } }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.taiga.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.taigaHills.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forest.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forestHills.biomeName); defaultBiomesToSpawn.add("Birch Forest"); defaultBiomesToSpawn.add("Forested Island"); defaultBiomesToSpawn.add("Forested Hills"); defaultBiomesToSpawn.add("Green Hills"); defaultBiomesToSpawn.add("Mountain Taiga"); defaultBiomesToSpawn.add("Pine Forest"); defaultBiomesToSpawn.add("Rainforest"); defaultBiomesToSpawn.add("Redwood Forest"); defaultBiomesToSpawn.add("Lush Redwoods"); defaultBiomesToSpawn.add("Snow Forest"); defaultBiomesToSpawn.add("Snowy Rainforest"); defaultBiomesToSpawn.add("Temperate Rainforest"); defaultBiomesToSpawn.add("Woodlands"); defaultBiomesToSpawn.addAll(typeToArray(Type.FOREST)); return defaultBiomesToSpawn; }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.plains.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forest.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forestHills.biomeName); defaultBiomesToSpawn.add("Autumn Woods"); defaultBiomesToSpawn.add("Birch Forest"); defaultBiomesToSpawn.add("Forested Hills"); defaultBiomesToSpawn.add("Forested Island"); defaultBiomesToSpawn.add("Green Hills"); defaultBiomesToSpawn.add("Redwood Forest"); defaultBiomesToSpawn.add("Lush Redwoods"); defaultBiomesToSpawn.add("Temperate Rainforest"); defaultBiomesToSpawn.add("Woodlands"); HashSet<String> nonFrozenForest = new HashSet<String>(); nonFrozenForest.addAll(typeToArray(Type.FOREST)); nonFrozenForest.addAll(typeToArray(Type.PLAINS)); nonFrozenForest.removeAll(typeToArray(Type.FROZEN)); defaultBiomesToSpawn.addAll(nonFrozenForest); return defaultBiomesToSpawn; }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.forest.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forestHills.biomeName); defaultBiomesToSpawn.add("Autumn Woods"); defaultBiomesToSpawn.add("Birch Forest"); defaultBiomesToSpawn.add("Forested Hills"); defaultBiomesToSpawn.add("Forested Island"); defaultBiomesToSpawn.add("Mountain Taiga"); defaultBiomesToSpawn.add("Redwood Forest"); defaultBiomesToSpawn.add("Lush Redwoods"); defaultBiomesToSpawn.add("Snow Forest"); defaultBiomesToSpawn.add("Temperate Rainforest"); defaultBiomesToSpawn.add("Woodlands"); HashSet<String> nonFrozenForest = new HashSet<String>(); nonFrozenForest.addAll(typeToArray(Type.FOREST)); nonFrozenForest.removeAll(typeToArray(Type.FROZEN)); defaultBiomesToSpawn.addAll(nonFrozenForest); return defaultBiomesToSpawn; }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.taiga.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.taigaHills.biomeName); defaultBiomesToSpawn.add("Alpine"); defaultBiomesToSpawn.add("Mountain Taiga"); defaultBiomesToSpawn.add("Snow Forest"); defaultBiomesToSpawn.add("Snowy Rainforest"); HashSet<String> nonFrozenForest = new HashSet<String>(); defaultBiomesToSpawn.addAll(typeToArray(Type.FOREST)); nonFrozenForest.retainAll(typeToArray(Type.FROZEN)); defaultBiomesToSpawn.addAll(nonFrozenForest); return defaultBiomesToSpawn; }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.taiga.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.taigaHills.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forest.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forestHills.biomeName); defaultBiomesToSpawn.add("Autumn Woods"); defaultBiomesToSpawn.add("Birch Forest"); defaultBiomesToSpawn.add("Forested Hills"); defaultBiomesToSpawn.add("Forested Island"); defaultBiomesToSpawn.add("Mountain Taiga"); defaultBiomesToSpawn.add("Redwood Forest"); defaultBiomesToSpawn.add("Lush Redwoods"); defaultBiomesToSpawn.add("Snow Forest"); defaultBiomesToSpawn.add("Temperate Rainforest"); defaultBiomesToSpawn.add("Woodlands"); defaultBiomesToSpawn.addAll(typeToArray(Type.FOREST)); return defaultBiomesToSpawn; }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.plains.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.extremeHills.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forest.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.taiga.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.swampland.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forestHills.biomeName); HashSet<String> nonFrozen = new HashSet<String>(); nonFrozen.addAll(typeToArray(Type.MOUNTAIN)); nonFrozen.addAll(typeToArray(Type.FOREST)); nonFrozen.addAll(typeToArray(Type.PLAINS)); nonFrozen.removeAll(typeToArray(Type.FROZEN)); defaultBiomesToSpawn.addAll(nonFrozen); return defaultBiomesToSpawn; }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.desert.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.desertHills.biomeName); defaultBiomesToSpawn.add("Mountainous Desert"); defaultBiomesToSpawn.add("Mountain Ridge"); defaultBiomesToSpawn.add("Wasteland"); HashSet<String> nonFrozenForest = new HashSet<String>(); nonFrozenForest.addAll(typeToArray(Type.DESERT)); nonFrozenForest.addAll(typeToArray(Type.WASTELAND)); nonFrozenForest.removeAll(typeToArray(Type.FROZEN)); defaultBiomesToSpawn.addAll(nonFrozenForest); return defaultBiomesToSpawn; }
public void main() { //Ores GameRegistry.registerWorldGenerator(new WorldGenDerpyOres(), 42); //Biome BiomeGenBase magicBiome = new MagicBiomeGen(Main.idMagicBiome); BiomeDictionary.registerBiomeType(magicBiome, BiomeDictionary.Type.MAGICAL); BiomeManager.addBiome(BiomeType.COOL, new BiomeEntry(magicBiome, 10)); BiomeManager.addSpawnBiome(magicBiome); //Trees GameRegistry.registerWorldGenerator(new DerpyTreeGen(new WorldGenMagicTree(false),magicBiome,9,1),42); GameRegistry.registerWorldGenerator(new DerpyTreeGen(new WorldGenEbonyTree(false),magicBiome,10,1),42); BiomeGenBase[] forests = BiomeDictionary.getBiomesForType(Type.FOREST); for (int i=0;i<forests.length;i++) { BiomeGenBase b = forests[i]; GameRegistry.registerWorldGenerator(new DerpyTreeGen(new WorldGenEbonyTree(false),b,2,3),1); } }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.birchForestHills.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forestHills.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forest.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.birchForest.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.roofedForest.biomeName); HashSet<String> nonfrozenForest = new HashSet<String>(); nonfrozenForest.addAll(typeToArray(Type.PLAINS)); nonfrozenForest.addAll(typeToArray(Type.FOREST)); nonfrozenForest.addAll(typeToArray(Type.CONIFEROUS)); nonfrozenForest.removeAll(typeToArray(Type.FROZEN)); defaultBiomesToSpawn.addAll(nonfrozenForest); return defaultBiomesToSpawn; }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.river.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.swampland.biomeName); defaultBiomesToSpawn.add("Green Swamplands"); defaultBiomesToSpawn.add("Marsh"); defaultBiomesToSpawn.addAll(typeToArray(Type.SWAMP)); HashSet<String> nonFrozenForest = new HashSet<String>(); nonFrozenForest.addAll(typeToArray(Type.RIVER)); nonFrozenForest.addAll(typeToArray(Type.WET)); nonFrozenForest.removeAll(typeToArray(Type.FROZEN)); defaultBiomesToSpawn.addAll(nonFrozenForest); return defaultBiomesToSpawn; }
@Override public HashSet<String> getDefaultBiomesToSpawn() { HashSet<String> defaultBiomesToSpawn = new HashSet<String>(); defaultBiomesToSpawn.add(BiomeGenBase.taiga.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.taigaHills.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.birchForestHills.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.forestHills.biomeName); defaultBiomesToSpawn.add(BiomeGenBase.birchForestHills.biomeName); defaultBiomesToSpawn.add("Alpine"); defaultBiomesToSpawn.add("Mountain Taiga"); defaultBiomesToSpawn.add("Snowy Rainforest"); HashSet<String> frozenForest = new HashSet<String>(); frozenForest.addAll(typeToArray(Type.PLAINS)); frozenForest.addAll(typeToArray(Type.HILLS)); frozenForest.retainAll(typeToArray(Type.FROZEN)); defaultBiomesToSpawn.addAll(frozenForest); return defaultBiomesToSpawn; }