@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int i, int j, int k) { if (par1EnumCreatureType == EnumCreatureType.monster) { final List monsters = new ArrayList(); monsters.add(new SpawnListEntry(EntityEvolvedZombie.class, 3000, 1, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSpider.class, 2000, 1, 2)); monsters.add(new SpawnListEntry(EntityEvolvedSkeleton.class, 1500, 1, 1)); monsters.add(new SpawnListEntry(EntityEvolvedCreeper.class, 2000, 1, 1)); if (ConfigManagerCore.challengeMode) monsters.add(new SpawnListEntry(EntityEnderman.class, 250, 1, 1)); return monsters; } else { return null; } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int i, int j, int k) { if (par1EnumCreatureType == EnumCreatureType.monster) { final List monsters = new ArrayList(); monsters.add(new SpawnListEntry(EntityEvolvedZombie.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); return monsters; } else { return null; } }
public GenerationSettings(String planetName, double terrainHeightMod, double smallFeatureHeightMod, double mountainHeightMod, double valleyHeightMod, int craterProbibility, int caveChance, SpacePair<Block, Integer> blockTop, SpacePair<Block, Integer> blockFiller, SpacePair<Block, Integer> blockLower, SpacePair<Block, Integer> blockBrick, Block blockEgg, boolean dungeonEnabled, boolean pitEnabled, boolean villageEnabled, List<SpawnListEntry> spawnableMonsters) { this.planetName = planetName; this.terrainHeightMod = terrainHeightMod; this.smallFeatureHeightMod = smallFeatureHeightMod; this.mountainHeightMod = mountainHeightMod; this.valleyHeightMod = valleyHeightMod; this.craterProbibility = craterProbibility; this.caveChance = caveChance; this.blockTop = new SpacePair<Block, Byte>(blockTop.getFirst(), new Byte("" + blockTop.getSecond())); this.blockFiller = new SpacePair<Block, Byte>(blockFiller.getFirst(), new Byte("" + blockFiller.getSecond())); this.blockLower = new SpacePair<Block, Byte>(blockLower.getFirst(), new Byte("" + blockLower.getSecond())); this.blockBrick = new SpacePair<Block, Byte>(blockBrick.getFirst(), new Byte("" + blockBrick.getSecond())); this.blockEgg = blockEgg; this.spawnableMonsters = spawnableMonsters; }
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { for (BiomeGenBase biome : biomes) { @SuppressWarnings("unchecked") List<SpawnListEntry> spawns = biome.func_76747_a(typeOfCreature); for (SpawnListEntry entry : spawns) { //Adjusting an existing spawn entry if (entry.field_76300_b == entityClass) { entry.field_76292_a = weightedProb; entry.field_76301_c = min; entry.field_76299_d = max; break; } } spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max)); } }
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { for (BiomeGenBase biome : biomes) { @SuppressWarnings("unchecked") Iterator<SpawnListEntry> spawns = biome.func_76747_a(typeOfCreature).iterator(); while (spawns.hasNext()) { SpawnListEntry entry = spawns.next(); if (entry.field_76300_b == entityClass) { spawns.remove(); } } } }
public PotentialSpawns(World world, EnumCreatureType type, int x, int y, int z, List<SpawnListEntry> oldList) { super(world); this.x = x; this.y = y; this.z = z; this.type = type; if (oldList != null) { this.list = oldList; } else { this.list = new ArrayList<SpawnListEntry>(); } }
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { for (BiomeGenBase biome : biomes) { @SuppressWarnings("unchecked") List<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature); for (SpawnListEntry entry : spawns) { //Adjusting an existing spawn entry if (entry.entityClass == entityClass) { entry.itemWeight = weightedProb; entry.minGroupCount = min; entry.maxGroupCount = max; break; } } spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max)); } }
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { for (BiomeGenBase biome : biomes) { @SuppressWarnings("unchecked") Iterator<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature).iterator(); while (spawns.hasNext()) { SpawnListEntry entry = spawns.next(); if (entry.entityClass == entityClass) { spawns.remove(); } } } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int i, int j, int k) { if (par1EnumCreatureType == EnumCreatureType.monster) { final List monsters = new ArrayList(); if (!ConfigManagerCore.idRealisticEnabled) { monsters.add(new SpawnListEntry(EntityEvolvedZombie.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); } return monsters; } else { return null; } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int i, int j, int k) { if (par1EnumCreatureType == EnumCreatureType.monster) { List monsters = new ArrayList(); if (!ConfigManagerCore.idRealisticEnabled) { monsters.add(new SpawnListEntry(EntityEvolvedZombie.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); } return monsters; } else { return null; } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int i, int j, int k) { if (par1EnumCreatureType == EnumCreatureType.monster) { List monsters = new ArrayList(); monsters.add(new SpawnListEntry(EntityEvolvedZombie.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedBlaze.class, 8, 2, 3)); return monsters; } else { return null; } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int i, int j, int k) { if (par1EnumCreatureType == EnumCreatureType.monster) { List monsters = new ArrayList(); if (!ConfigManagerCore.idRealisticEnabled) { monsters.add(new SpawnListEntry(EntityEvolvedZombie.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); monsters.add(new SpawnListEntry(EntityEvolvedBlaze.class, 8, 2, 3)); } return monsters; } else { return null; } }
@SuppressWarnings({"unchecked","rawtypes"}) @Override public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType,int i,int j,int k){ if (par1EnumCreatureType == EnumCreatureType.monster) { List monsters=new ArrayList(); monsters.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 8, 2, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 8, 2, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 8, 2, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 8, 2, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntityEnderman.class, 8, 1, 3)); monsters.add(new BiomeGenBase.SpawnListEntry(EntityPixelOneSwingman.class, 1, 1, 1)); return monsters; } if (par1EnumCreatureType == EnumCreatureType.creature) { List creatures=new ArrayList(); creatures.add(new BiomeGenBase.SpawnListEntry(EntityhumanPixel.class, 8, 2, 3)); creatures.add(new BiomeGenBase.SpawnListEntry(EntitypixelPig.class, 8, 1, 3)); creatures.add(new BiomeGenBase.SpawnListEntry(EntitypixelCow.class, 8, 1, 3)); return creatures; } return null; }
/** * Replaces the class used when spawning an entity in a world. * * @param o Original class * @param c Replacement class * @param e CreatureType */ public static void swapEntitySpawn(Class<? extends Entity> o, Class<? extends Entity> c, EnumCreatureType e) { BiomeGenBase[] standardBiomes = BiomeGenBase.getBiomeGenArray(); for (BiomeGenBase biome : standardBiomes) { if (biome != null) { List<SpawnListEntry> spawnableList = biome.getSpawnableList(e); if (spawnableList != null) { for (SpawnListEntry entry : spawnableList) { if (entry != null && entry.entityClass == o) { entry.entityClass = c; } } } } } }
/** * Registers an Entity spawn in certain biomes. * Registers for all biomes if none specified * * @param c Entity class * @param weight How often this entity is spawned in the world * @param minGroup Minimum group size * @param maxGroup Maximum group size * @param type Type of spwning to be used by this entity * @param biomes List of biomes this entity should spawn in */ public static void registerSpawn(Class<? extends Entity> c, int weight, int minGroup, int maxGroup, EnumCreatureType type, BiomeGenBase... biomes) { if (biomes.length == 0) { biomes = BiomeGenBase.getBiomeGenArray(); } for (BiomeGenBase biome : biomes) { if (biome != null) { List<SpawnListEntry> spawnableList = biome.getSpawnableList(type); Iterator<SpawnListEntry> iter = spawnableList.iterator(); while (iter.hasNext()) { if (iter.next().entityClass == c) iter.remove(); //Ensure there are no duplications } spawnableList.add(new SpawnListEntry(c, weight, minGroup, maxGroup)); } } }
public BiomeGenSoulShrubbery(int par1){ super(par1); this.topBlock = SoulBlocks.BogGrass.get(); this.fillerBlock = SoulBlocks.BogDirt.get(); spawnableMonsterList.clear(); spawnableCreatureList.clear(); spawnableCaveCreatureList.clear(); spawnableWaterCreatureList.clear(); this.temperature = 0.5F; spawnableMonsterList.add(new SpawnListEntry(EntityGroundhog.class, SoulConfigCreatures.groundhogSpawnFreq, SoulConfigCreatures.groundhogMinGroup, SoulConfigCreatures.groundhogMaxGroup)); theBiomeDecorator = new TheBiomeDeco(this); customBiomeDecorator = (TheBiomeDeco)theBiomeDecorator; customBiomeDecorator.tallgrasstype = 1; customBiomeDecorator.tallgrassperchunk = 250; customBiomeDecorator.soulbushperchunk = 100; customBiomeDecorator.bushesperchunk = 25; customBiomeDecorator.slatetowersperchunk = 1; }
public BiomeGenFyrisedShrubbery(int par1){ super(par1); this.topBlock = SoulBlocks.FyrisedSandGrass.get(); this.fillerBlock = SoulBlocks.FyrisedSand.get(); spawnableMonsterList.clear(); spawnableCreatureList.clear(); spawnableCaveCreatureList.clear(); spawnableWaterCreatureList.clear(); this.temperature = 0.5F; spawnableMonsterList.add(new SpawnListEntry(EntityFurivoli.class, SoulConfigCreatures.furivoliSpawnFreq, SoulConfigCreatures.furivoliMinGroup, SoulConfigCreatures.furivoliMaxGroup)); theBiomeDecorator = new TheBiomeDeco(this); customBiomeDecorator = (TheBiomeDeco)theBiomeDecorator; customBiomeDecorator.fireblossomsperchunk = 80; customBiomeDecorator.fyrisedbushperchunk = 100; }
@Override public void handleBiomeSetting(BiomeSettingPacket packet, EntityPlayer player) { ModConfig config = MobSpawnControls.instance.getConfig().getModConfig(packet.mod); BiomeGenBase biome = (packet.biome.equalsIgnoreCase("master")) ? null : BiomeNameHelper.getBiome(packet.biome); BiomeGroup group = (biome == null && !packet.biome.equalsIgnoreCase("master")) ? config.getBiomeGroup(packet.biome) : null; SpawnMap map = config.getSpawnMap(); for (EnumCreatureType type : EnumCreatureType.values()) { List<SpawnListEntry> spawnList = new ArrayList<SpawnListEntry>(); EntityEntry[] entries = packet.entries[type.ordinal()]; for (EntityEntry e : entries) spawnList.add(new SpawnListEntry(config.getEntityClass(e.entity), e.weight, e.min, e.max)); if (group != null) map.setGroupSection(group, type, spawnList); else map.setBiomeSection(biome, type, spawnList); } config.save(); config.getSpawnMap().evaluate(); MobSpawnControls.instance.getConfig().sync(); }
public void merge(SpawnList list) { /* * If a biome definition isn't present in the config but it is present in a group, * we can infer that the biome setting is an empty spawn list. */ if (!inGroup && !defEdited){ active.clear(); biomeSettings.clear(); } inGroup = true; for (EnumCreatureType type : EnumCreatureType.values()){ List<SpawnListEntry> myEntries = active.getSpawnList(type); List<SpawnListEntry> theirEntries = list.getSpawnList(type); mergeLists(myEntries,theirEntries); } }
@SuppressWarnings("unchecked") public MSCPacket getBiomeSettingPacket(String mod, String biome, ModConfig config) { EntityEntry[][] spawning = new EntityEntry[4][]; String[][] notSpawning = new String[4][]; SpawnList spawnList = biome.equalsIgnoreCase("master") ? master : (biome.contains(".") ? biomeMap.get(BiomeNameHelper.getBiome(biome)).getBiomeSettings() : getSettings(biome).getSpawnList()); for (EnumCreatureType type : EnumCreatureType.values()) { int index = type.ordinal(); List<EntityEntry> entries = new ArrayList<EntityEntry>(); List<String> disabled = new ArrayList<String>(); for (SpawnListEntry e : spawnList.getSpawnList(type)) { String entityName = config.getEntityName(e.entityClass); entries.add(new EntityEntry(entityName, e.itemWeight, e.minGroupCount, e.maxGroupCount)); } for (Class<? extends EntityLiving> c : SpawnList.getDisabledEntities(spawnList.getSpawnList(type), config.getTypeMap().getEntitiesOfType(type))) disabled.add(config.getEntityName(c)); spawning[index] = entries.toArray(new EntityEntry[0]); notSpawning[index] = disabled.toArray(new String[0]); } return MSCPacket.getPacket(PacketType.BIOME_SETTING, mod, biome, spawning, notSpawning); }
public static List<Class<? extends EntityLiving>> getDisabledEntities(List<SpawnListEntry> spawning, List<Class<? extends EntityLiving>> list) { List<Class<? extends EntityLiving>> disabled = new ArrayList<Class<? extends EntityLiving>>(); for (Class<? extends EntityLiving> clazz : list) { boolean found = false; for (SpawnListEntry e : spawning) { if (e.entityClass == clazz) { found = true; break; } } if (!found) disabled.add(clazz); } return disabled; }
/** Called by Forge - call setCanceled(true) to prevent spawning in our world.*/ @SubscribeEvent public void onGetPotentialSpawns(PotentialSpawns ps) { // Decide whether or not to allow spawning. // We shouldn't allow spawning unless it has been specifically turned on - whether // a mission is running or not. (Otherwise spawning may happen in between missions.) boolean allowSpawning = false; if (currentMissionInit() != null && currentMissionInit().getMission() != null) { // There is a mission running - does it allow spawning? ServerSection ss = currentMissionInit().getMission().getServerSection(); ServerInitialConditions sic = (ss != null) ? ss.getServerInitialConditions() : null; if (sic != null) allowSpawning = (sic.isAllowSpawning() == Boolean.TRUE); if (allowSpawning && sic.getAllowedMobs() != null && !sic.getAllowedMobs().isEmpty()) { // Spawning is allowed, but restricted to our list: Iterator<SpawnListEntry> it = ps.list.iterator(); while (it.hasNext()) { // Is this on our list? SpawnListEntry sle = it.next(); String mobName = EntityList.classToStringMapping.get(sle.entityClass).toString(); boolean allowed = false; for (EntityTypes mob : sic.getAllowedMobs()) { if (mob.value().equals(mobName)) allowed = true; } if (!allowed) it.remove(); } } } // Cancel spawn event: if (!allowSpawning) ps.setCanceled(true); }
@Override public List<SpawnListEntry> getSpawnableMonsters() { List<SpawnListEntry> spawnableMonsters = new ArrayList<SpawnListEntry>(); spawnableMonsters.add(new SpawnListEntry(EntityEvolvedZombie.class, 5, 1, 1)); spawnableMonsters.add(new SpawnListEntry(EntityEvolvedSpider.class, 3, 1, 1)); spawnableMonsters.add(new SpawnListEntry(EntityEvolvedCreeper.class, 2, 1, 1)); return spawnableMonsters; }
@Override public List<SpawnListEntry> getSpawnableMonsters() { List<SpawnListEntry> spawnableMonsters = new ArrayList<SpawnListEntry>(); spawnableMonsters.add(new SpawnListEntry(EntityEvolvedZombie.class, 5, 1, 1)); spawnableMonsters.add(new SpawnListEntry(EntityEvolvedSpider.class, 3, 1, 1)); spawnableMonsters.add(new SpawnListEntry(EntityEvolvedCreeper.class, 2, 1, 1)); spawnableMonsters.add(new SpawnListEntry(EntityEvolvedBlaze.class, 4, 1, 1)); return spawnableMonsters; }
public void RemoveCustomSpawn(Class class1, EnumCreatureType enumcreaturetype, BiomeGenBase abiomegenbase[]) { if (class1 == null) { throw new IllegalArgumentException("entityClass cannot be null"); } if (enumcreaturetype == null) { throw new IllegalArgumentException("spawnList cannot be null"); } if (abiomegenbase == null) { abiomegenbase = standardBiomes; } for (int l = 0; l < abiomegenbase.length; l++) { List[] fulllist = getCustomSpawnableList(enumcreaturetype); if (fulllist != null) { int x = biomeList.indexOf(abiomegenbase[l].biomeName); for (Iterator iterator = fulllist[x].iterator(); iterator.hasNext();) { if (iterator != null) { SpawnListEntry spawnlistentry = (SpawnListEntry) iterator.next(); if (spawnlistentry.entityClass == class1) { iterator.remove(); } } } } } }
/** * only spawns creatures allowed by the chunkProvider */ public BiomeGenBase.SpawnListEntry spawnRandomCreature(EnumCreatureType type, int x, int y, int z) { @SuppressWarnings("unchecked") List<SpawnListEntry> list = this.getChunkProvider().getPossibleCreatures(type, x, y, z); list = ForgeEventFactory.getPotentialSpawns(this.thePlayerManager.getWorldServer(), type, x, y, z, list); return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry) WeightedRandom.getRandomItem(this.rand, list) : null; }