private void setSpawnables() { spawnableCreatureList.clear(); spawnableMonsterList.clear(); spawnableWaterCreatureList.clear(); spawnableCaveCreatureList.clear(); spawnableCreatureList.add(new Biome.SpawnListEntry(EntitySheep.class, 12, 4, 4)); spawnableCreatureList.add(new Biome.SpawnListEntry(EntityPig.class, 10, 4, 4)); spawnableCreatureList.add(new Biome.SpawnListEntry(EntityChicken.class, 10, 4, 4)); spawnableCreatureList.add(new Biome.SpawnListEntry(EntityCow.class, 8, 4, 4)); spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySpider.class, 100, 4, 4)); spawnableMonsterList.add(new Biome.SpawnListEntry(EntityZombie.class, 95, 4, 4)); spawnableMonsterList.add(new Biome.SpawnListEntry(EntityZombieVillager.class, 5, 1, 1)); spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySkeleton.class, 100, 4, 4)); spawnableMonsterList.add(new Biome.SpawnListEntry(EntityCreeper.class, 100, 4, 4)); spawnableMonsterList.add(new Biome.SpawnListEntry(EntitySlime.class, 100, 4, 4)); spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEnderman.class, 10, 1, 4)); spawnableMonsterList.add(new Biome.SpawnListEntry(EntityWitch.class, 5, 1, 1)); spawnableWaterCreatureList.add(new Biome.SpawnListEntry(EntitySquid.class, 10, 4, 4)); spawnableCaveCreatureList.add(new Biome.SpawnListEntry(EntityBat.class, 10, 8, 8)); }
if (biome != null && BiomeDictionary.hasType(biome, BiomeDictionary.Type.HILLS)) { List<Biome.SpawnListEntry> spawnList = biome.getSpawnableList(EnumCreatureType.CREATURE); spawnList.add(new Biome.SpawnListEntry(EntityHippogryph.class, IceAndFire.CONFIG.hippogryphSpawnRate, 1, 1)); if (biome != null && BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY) && BiomeDictionary.hasType(biome, BiomeDictionary.Type.DRY) && !BiomeDictionary.hasType(biome, BiomeDictionary.Type.BEACH) && !BiomeDictionary.hasType(biome, BiomeDictionary.Type.MESA)) { List<Biome.SpawnListEntry> spawnList = biome.getSpawnableList(EnumCreatureType.CREATURE); spawnList.add(new Biome.SpawnListEntry(EntityDeathWorm.class, IceAndFire.CONFIG.deathWormSpawnRate, 1, 3)); if (biome != null && BiomeDictionary.hasType(biome, type.spawnBiome)) { List<Biome.SpawnListEntry> spawnList = biome.getSpawnableList(EnumCreatureType.MONSTER); spawnList.add(new Biome.SpawnListEntry(EntityTroll.class, IceAndFire.CONFIG.trollSpawnRate, 1, 1)); if (biome != null && BiomeDictionary.hasType(biome, BiomeDictionary.Type.SAVANNA) && BiomeDictionary.hasType(biome, BiomeDictionary.Type.SPARSE)) { List<Biome.SpawnListEntry> spawnList = biome.getSpawnableList(EnumCreatureType.CREATURE); spawnList.add(new Biome.SpawnListEntry(EntityCockatrice.class, IceAndFire.CONFIG.cockatriceSpawnRate, 1, 2));
spawnedMob = spawnListEntry.newInstance(world);
entity = spawnEntry.newInstance(machineWorld); } catch (Exception e) { e.printStackTrace();
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, Biome... biomes) { for (Biome biome : biomes) { if (biome != null) { List<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature); boolean found = false; for (SpawnListEntry entry : spawns) { //Adjusting an existing spawn entry if (entry.entityClass == entityClass) { entry.itemWeight = weightedProb; entry.minGroupCount = min; entry.maxGroupCount = max; found = true; break; } } if (!found) spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max)); } } } }
spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max));
/** * Converts a WeightedMobSpawnGroup collection to a BiomeMeta collection. * This method is the inverse of {@link #fromMinecraftList(Collection)}. * @param weightedMobSpawnGroups The WeighedMobSpawnGroup collection. * @return The BiomeMeta list. */ public static List<SpawnListEntry> toMinecraftlist(Collection<WeightedMobSpawnGroup> weightedMobSpawnGroups) { List<SpawnListEntry> biomeList = new ArrayList<SpawnListEntry>(); for (WeightedMobSpawnGroup mobGroup : weightedMobSpawnGroups) { Class<? extends EntityLiving> entityClass = toMinecraftClass(mobGroup.getInternalName()); if (entityClass != null) { biomeList.add(new SpawnListEntry(entityClass, mobGroup.getWeight(), mobGroup.getMin(), mobGroup.getMax())); } else { // The .toLowerCase() is just a safeguard so that we get // notified if this.af is no longer the biome name TerrainControl.log(LogMarker.WARN, "Mob type {} not found", mobGroup.getInternalName()); } } return biomeList; }
@Override public void perform() throws Exception { final Class<? extends Entity> clazz2 = EntityHelper.getEntityClass(this.entityClass); if(clazz2 == null) throw new IllegalArgumentException("Failed to find entity class: "+this.entityClass); if(!EntityLiving.class.isAssignableFrom(clazz2)) throw new IllegalArgumentException("entity class "+this.entityClass+" is not assignable to EntityLiving. It cannot be spawned!"); final Class<? extends EntityLiving> clazz = WarningHelper.uncheckedCast(clazz2); final SpawnListEntry entry = new SpawnListEntry(clazz, this.weight, this.minCount, this.maxCount); final Iterator<Biome> it = this.pack.getIterator(); while(it.hasNext()){ final Biome biome = it.next(); if(this.remove && MinecraftForge.EVENT_BUS.post(new BiomeTweakEvent.RemoveSpawn(this, biome, this.type, clazz))) continue; else if(!this.remove && MinecraftForge.EVENT_BUS.post(new BiomeTweakEvent.AddSpawn(this, biome, entry))) continue; if(this.remove) this.removeEntry(clazz, biome.getSpawnableList(this.type)); else biome.getSpawnableList(this.type).add(new Biome.SpawnListEntry(clazz, this.weight, this.minCount, this.maxCount)); BiomeTweaker.getInstance().onTweak(Biome.getIdForBiome(biome)); } }
public BiomeFluxed(BiomeProperties properties) { super(properties); decorator.treesPerChunk = 0; decorator.extraTreeChance = 0.2F; decorator.flowersPerChunk = 15; decorator.grassPerChunk = 15; decorator.reedsPerChunk = 2; spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 4)); spawnableCreatureList.add(new SpawnListEntry(EntityDonkey.class, 1, 1, 2)); this.flowers.clear(); for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) { continue; } if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) { type = BlockFlower.EnumFlowerType.POPPY; } addFlower(net.minecraft.init.Blocks.RED_FLOWER.getDefaultState().withProperty(net.minecraft.init.Blocks.RED_FLOWER.getTypeProperty(), type), 10); } }
public BiomeGenVampireForest() { super(new BiomeProperties(name).setWaterColor(0xEE2505).setBaseHeight(0.1F).setHeightVariation(0.025F)); this.spawnableCreatureList.clear(); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCaveCreatureList.clear(); this.spawnableMonsterList.add(new SpawnListEntry(EntityGhost.class, 3, 1, 1)); this.spawnableMonsterList.add(new SpawnListEntry(EntityBasicVampire.class, 7, 1, 3)); this.spawnableMonsterList.add(new SpawnListEntry(EntityVampireBaron.class, 2, 1, 1)); this.spawnableCaveCreatureList.add(new SpawnListEntry(EntityBlindingBat.class, 8, 2, 4)); this.spawnableCreatureList.add(new SpawnListEntry(EntityDummyBittenAnimal.class, 15, 3, 6)); this.topBlock = ModBlocks.cursed_earth.getDefaultState(); this.fillerBlock = ModBlocks.cursed_earth.getDefaultState(); this.decorator.treesPerChunk = 5; this.decorator.grassPerChunk = 4; this.decorator.deadBushPerChunk = 3; this.worldGenTrees = new WorldGenTrees(false, 4, Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE), Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK), false); }
public static void addAsBiomeGen(Class<? extends EntityLiving> entityClass) { spawnListEntries.add(new Biome.SpawnListEntry(entityClass, 15, 1, 2)); addInBiome(Biome.REGISTRY.iterator()); }
public TXOceanMonumentGen(ConfigProvider settings) { this.gridSize = settings.getWorldConfig().oceanMonumentGridSize; this.randomOffset = settings.getWorldConfig().oceanMonumentRandomOffset; this.monumentSpawnBiomes = new ArrayList<Biome>(); this.mobList = Arrays.asList(new SpawnListEntry(EntityGuardian.class, 1, 2, 4)); for (LocalBiome biome : settings.getBiomeArray()) { if (biome == null || !biome.getBiomeConfig().oceanMonumentsEnabled) { continue; } this.monumentSpawnBiomes.add(((ForgeBiome) biome).getHandle()); } }
public TXNetherFortressGen() { this.spawnList.add(new SpawnListEntry(EntityBlaze.class, 10, 2, 3)); this.spawnList.add(new SpawnListEntry(EntityPigZombie.class, 5, 4, 4)); this.spawnList.add(new SpawnListEntry(EntitySkeleton.class, 10, 4, 4)); this.spawnList.add(new SpawnListEntry(EntityMagmaCube.class, 3, 4, 4)); }
/** * Bridge Method for simpler spawning registry */ public static void add(int weight, Class<? extends EntityLiving> entityclassIn, int groupCountMin, int groupCountMax, Biome biome) { if (weight > 0) { biome.getSpawnableList(EnumCreatureType.MONSTER).add(new SpawnListEntry(entityclassIn, weight, groupCountMin, groupCountMax)); } }
private void addSpawn(List<SpawnListEntry> list) { boolean shouldAddGoat = false; for(Biome.SpawnListEntry entry : list) { if(entry.entityClass == EntityPig.class) { shouldAddGoat = true; } } if(shouldAddGoat && JurassiCraftConfig.ENTITIES.naturalSpawning_G) { list.add(new Biome.SpawnListEntry(GoatEntity.class, 10, 2, 4)); } }
@Nonnull @Override public List<Biome.SpawnListEntry> getPossibleCreatures(@Nonnull EnumCreatureType creatureType, @Nonnull BlockPos pos) { ArrayList<Biome.SpawnListEntry> list = new ArrayList<>(); list.add(new Biome.SpawnListEntry(EntityFairy.class, 1, 1, 3)); return list; }
@Nonnull @Override public List<Biome.SpawnListEntry> getPossibleCreatures(@Nonnull EnumCreatureType creatureType, @Nonnull BlockPos pos) { ArrayList<Biome.SpawnListEntry> list = new ArrayList<>(); list.add(new Biome.SpawnListEntry(EntityFairy.class, 1, 1, 3)); return list; }
@Override public void init(FMLInitializationEvent event) { Set<Biome> set = deepOceanOnly ? ImmutableSet.of(Biomes.DEEP_OCEAN) : ImmutableSet.of(Biomes.OCEAN, Biomes.DEEP_OCEAN); for(Biome b : set) b.getSpawnableList(EnumCreatureType.MONSTER).add(new SpawnListEntry(EntityGuardian.class, weight, min, max)); }
@Override public void init(FMLInitializationEvent event) { SpawnListEntry blazeEntry = new SpawnListEntry(EntityBlaze.class, weight, min, max); BiomeDictionary.getBiomes(BiomeDictionary.Type.NETHER).forEach(biome -> biome.getSpawnableList(EnumCreatureType.MONSTER).add(blazeEntry)); }