public static void complete() { if (!HFAnimals.CAN_SPAWN) { for (Biome biome: Biome.REGISTRY) { Iterator<SpawnListEntry> it = biome.getSpawnableList(EnumCreatureType.CREATURE).iterator(); while (it.hasNext()) { SpawnListEntry entry = it.next(); if (entry.entityClass == EntityCow.class || entry.entityClass == EntityChicken.class || entry.entityClass == EntitySheep.class) { it.remove(); } } } } } }
@Override @Nonnull public List<Biome.SpawnListEntry> getPossibleCreatures(@Nonnull EnumCreatureType creatureType, @Nonnull BlockPos pos) { if (creatureType == EnumCreatureType.MONSTER) { return MONSTERS; } else return this.world.getBiome(pos).getSpawnableList(creatureType); }
/** * 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)); } }
@Override public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { Biome biome = this.worldObj.getBiome(pos); return biome == null ? null : biome.getSpawnableList(creatureType); }
@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)); }
private Biome[] getBiomesWithMob(Class<? extends Entity> clazz) { List<Biome> biomes = new ArrayList(); Iterator<Biome> bIter = Biome.REGISTRY.iterator(); while(bIter.hasNext()) { Biome b = bIter.next(); List<SpawnListEntry> spawnList = b.getSpawnableList(EnumCreatureType.MONSTER); for(SpawnListEntry e : spawnList) if(e.entityClass == clazz) { biomes.add(b); break; } } return biomes.toArray(new Biome[biomes.size()]); }
@Override public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { return world.getBiome(pos).getSpawnableList(creatureType); }
@Override public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { return this.world.getBiome(pos).getSpawnableList(creatureType); }
@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)); }
public static void reinitSpawns() { for(Biome biome : ForgeRegistries.BIOMES.getValuesCollection()) { List<Biome.SpawnListEntry> list = biome.getSpawnableList(EnumCreatureType.CREATURE); list.removeIf(entry -> entry.entityClass == GoatEntity.class); JurassiCraft.PROXY.addSpawn(list); } }
private static void addInBiome(Iterator<Biome> biomes) { loadBiomeBlacklist(MatterOverdrive.CONFIG_HANDLER); loadBiomesWhitelist(MatterOverdrive.CONFIG_HANDLER); while (biomes.hasNext()) { Biome biome = biomes.next(); if (biome != null) { List spawnList = biome.getSpawnableList(EnumCreatureType.MONSTER); for (Biome.SpawnListEntry entry : spawnListEntries) { if (isBiomeValid(biome) && !spawnList.contains(entry) && entry.itemWeight > 0) { spawnList.add(entry); } } } } }
/** * Gets the spawn list of the given biome for the given category. * @param biome The biome. * @param type The category. * @return The spawn list for the given category. */ public static List<WeightedMobSpawnGroup> getListFromMinecraftBiome(Biome biome, EntityCategory type) { Collection<SpawnListEntry> mobList = biome.getSpawnableList(toEnumCreatureType(type)); return fromMinecraftList(mobList); }
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType typeOfCreature, List<String> biomes) { for (String biomeName : biomes) { ResourceLocation loc = new ResourceLocation(biomeName); if (ForgeRegistries.BIOMES.containsKey(loc)) { Biome biome = ForgeRegistries.BIOMES.getValue(loc); Iterator<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature).iterator(); while (spawns.hasNext()) { SpawnListEntry entry = spawns.next(); if (entry.entityClass == entityClass) { spawns.remove(); } } } } } }
@Override public void perform() throws Exception { final Iterator<Biome> it = this.pack.getIterator(); while(it.hasNext()){ final Biome gen = it.next(); if(MinecraftForge.EVENT_BUS.post(new BiomeTweakEvent.RemoveAllSpawns(this, gen, this.type))) continue; gen.getSpawnableList(this.type).clear(); BiomeTweaker.getInstance().onTweak(Biome.getIdForBiome(gen)); } }
private EntityLiving findMonsterToSpawn(World world, BlockPos pos, Random rand) { List<SpawnListEntry> spawnOptions = world.getBiome(pos).getSpawnableList(type); if (spawnOptions == null) { return null; } //end is inclusive int found = MathHelper.getInt(rand, 0, spawnOptions.size() - 1); SpawnListEntry entry = spawnOptions.get(found); if (entry == null || entry.entityClass == null) { return null; } EntityEntry entityEntry = EntityRegistry.getEntry(entry.entityClass); EntityLiving monster = null; Entity ent = entityEntry.newInstance(world); if (ent instanceof EntityLiving) monster = (EntityLiving) ent; return monster; }
public void onInit(FMLInitializationEvent event) { for(Biome biome : ForgeRegistries.BIOMES.getValuesCollection()) { //Adds the goat spawning to biomes that spawn pigs. TODO: maybe add a config for biomes ? List<Biome.SpawnListEntry> list = biome.getSpawnableList(EnumCreatureType.CREATURE); addSpawn(list); } Blocks.FIRE.setFireInfo(BlockHandler.VINES, 15, 100); }
@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)); } }
private List<Biome.SpawnListEntry> getDefaultCreatures(EnumCreatureType creatureType, BlockPos pos) { Biome Biome = this.worldObj.getBiomeForCoordsBody(pos); if (creatureType == EnumCreatureType.MONSTER) { if (profile.GENERATE_SCATTERED) { if (this.scatteredFeatureGenerator.isInsideStructure(pos)) { return this.scatteredFeatureGenerator.getMonsters(); } } if (profile.GENERATE_OCEANMONUMENTS) { if (this.oceanMonumentGenerator.isPositionInStructure(this.worldObj, pos)) { return this.oceanMonumentGenerator.getMonsters(); } } } return Biome.getSpawnableList(creatureType); }
@Override public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { Biome biome = world.getBiome(pos); if (mapFeaturesEnabled) { if (creatureType == EnumCreatureType.MONSTER && scatteredFeatureGenerator.isSwampHut(pos)) { return scatteredFeatureGenerator.getMonsters(); } if (creatureType == EnumCreatureType.MONSTER && useMonuments && oceanMonumentGenerator.isPositionInStructure(world, pos)) { return oceanMonumentGenerator.getMonsters(); } } return biome.getSpawnableList(creatureType); }
@Override public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType paramaca, BlockPos blockPos) { WorldConfig worldConfig = this.world.getConfigs().getWorldConfig(); Biome biomeBase = this.worldHandle.getBiomeForCoordsBody(blockPos); if (worldConfig.rareBuildingsEnabled) { if (paramaca == EnumCreatureType.MONSTER && this.world.rareBuildingGen.isSwampHut(blockPos)) { return this.world.rareBuildingGen.getMonsters(); } } if (worldConfig.oceanMonumentsEnabled) { if (paramaca == EnumCreatureType.MONSTER && this.world.oceanMonumentGen.isPositionInStructure(this.worldHandle, blockPos)) { return this.world.oceanMonumentGen.getMonsterSpawnList(); } } return biomeBase.getSpawnableList(paramaca); }