public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { if (pos==null) return ImmutableList.of(); if (creatureType == EnumCreatureType.MONSTER) { //if (this.genNetherBridge.isInsideStructure(pos)) { // return this.genNetherBridge.getSpawnList(); //} if (this.genNetherBridge.isPositionInStructure(this.world, pos) && this.world.getBlockState(pos.down()).getBlock() == Blocks.NETHER_BRICK) { return this.genNetherBridge.getSpawnList(); } return Biomes.HELL.getSpawnableList(EnumCreatureType.MONSTER); //TODO: Replace with actual-biome lists. } return ImmutableList.of(); //Biome biome = this.world.getBiome(pos); //return biome.getSpawnableList(creatureType); }
@SubscribeEvent public void registerEntityEntries(RegistryEvent.Register<EntityEntry> event) { EntityRegistry.registerModEntity( new ResourceLocation(MODID, "trumpet_skeleton"), EntityTrumpetSkeleton.class, "trumpetskeleton.TrumpetSkeleton", 0, this, 80, 3, false, 0xC1C1C1, 0xFCFC00 ); List<Biome> biomes = ForgeRegistries.BIOMES.getValues(); EntityRegistry.addSpawn( EntityTrumpetSkeleton.class, 25, 4, 4, EnumCreatureType.MONSTER, biomes.toArray(new Biome[biomes.size()]) ); }
@Override public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { Biome biome = this.world.getBiome(pos); /* * if (this.mapFeaturesEnabled) { if (creatureType == * EnumCreatureType.MONSTER && * this.scatteredFeatureGenerator.isSwampHut(pos)) { return * this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); } * * if (creatureType == EnumCreatureType.MONSTER && * this.settings.useMonuments && * this.oceanMonumentGenerator.isPositionInStructure(this.world, pos)) { * return this.oceanMonumentGenerator.getScatteredFeatureSpawnList(); } * } */ return biome.getSpawnableList(creatureType); }
/** * Initializes an entities type on construction to specify what group this * entity is in for activation ranges. * * @param entity * @return group id */ public static byte initializeEntityActivationType(Entity entity) { Chunk chunk = null; // Cauldron start - account for entities that dont extend EntityMob, EntityAmbientCreature, EntityCreature if ( entity instanceof EntityMob || entity instanceof EntitySlime || entity.isCreatureType(EnumCreatureType.monster, false)) // Cauldron - account for entities that dont extend EntityMob { return 1; // Monster } else if ( entity instanceof EntityCreature || entity instanceof EntityAmbientCreature || entity.isCreatureType(EnumCreatureType.creature, false) || entity.isCreatureType(EnumCreatureType.waterCreature, false) || entity.isCreatureType(EnumCreatureType.ambient, false)) { return 2; // Animal // Cauldron end } else { return 3; // Misc } }
public static void init() { int id = 0; EntityRegistry.registerModEntity(new ResourceLocation(Infernum.MODID + ":withering_bolt"), EntityWitheringBolt.class, "withering_bolt", id++, Infernum.instance, 64, 1, true); EntityRegistry.registerModEntity(new ResourceLocation(Infernum.MODID + ":zombie_pigman_mage"), EntityPigZombieMage.class, "zombie_pigman_mage", id++, Infernum.instance, 64, 1, true); EntityRegistry.registerEgg(new ResourceLocation(Infernum.MODID + ":zombie_pigman_mage"), 14581128, 11799808); EntityRegistry.registerModEntity(new ResourceLocation(Infernum.MODID + ":pigman_mage"), EntityPigMage.class, "pigman_mage", id++, Infernum.instance, 64, 1, true); EntityRegistry.registerEgg(new ResourceLocation(Infernum.MODID + ":pigman_mage"), 14581128, 11665527); EntityRegistry.registerModEntity(new ResourceLocation(Infernum.MODID + ":fire_breath"), EntityFireBreath.class, "fire_breath", id++, Infernum.instance, 64, 1, true); List<Biome> spawnBiomes = new ArrayList<Biome>(); spawnBiomes.addAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.NETHER)); spawnBiomes.add(Biomes.HELL); for (Biome b : spawnBiomes) { System.out.println(b.getBiomeName()); } EntityRegistry.addSpawn(EntityPigZombieMage.class, 150, 1, 2, EnumCreatureType.MONSTER, spawnBiomes.toArray(new Biome[spawnBiomes.size()])); }
public static void init() { // Register mod entities int entityId = 1; EntityRegistry.registerModEntity(new ResourceLocation("btweagles:stevebeej"), EntitySteveBeej.class, "SteveBeej", entityId++, BetterThanWeagles.instance, 64, 3, true, 0xD1A288, 0x00CCCC); // Set up spawn criteria Set<Biome> validBiomes = new HashSet<>(); validBiomes.addAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.PLAINS)); validBiomes.addAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.FOREST)); validBiomes.addAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.HILLS)); validBiomes.addAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.SWAMP)); validBiomes.removeAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.NETHER)); validBiomes.removeAll(BiomeDictionary.getBiomes(BiomeDictionary.Type.END)); EntityRegistry.addSpawn(EntitySteveBeej.class, 10, 1, 1, EnumCreatureType.MONSTER, validBiomes.toArray(new Biome[validBiomes.size()])); // Register entity loot tables LootTableList.register(EntitySteveBeej.LOOT_TABLE); }
public List<BiomeGenBase.SpawnListEntry> getSpawnableList(EnumCreatureType creatureType) { switch (creatureType) { case MONSTER: return this.spawnableMonsterList; case CREATURE: return this.spawnableCreatureList; case WATER_CREATURE: return this.spawnableWaterCreatureList; case AMBIENT: return this.spawnableCaveCreatureList; default: return Collections.<BiomeGenBase.SpawnListEntry>emptyList(); } }
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { if (creatureType == EnumCreatureType.MONSTER) { if (this.genNetherBridge.func_175795_b(pos)) { return this.genNetherBridge.getSpawnList(); } if (this.genNetherBridge.func_175796_a(this.worldObj, pos) && this.worldObj.getBlockState(pos.down()).getBlock() == Blocks.nether_brick) { return this.genNetherBridge.getSpawnList(); } } BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); return biomegenbase.getSpawnableList(creatureType); }
public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); if (this.mapFeaturesEnabled) { if (creatureType == EnumCreatureType.MONSTER && this.scatteredFeatureGenerator.func_175798_a(pos)) { return this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); } if (creatureType == EnumCreatureType.MONSTER && this.settings.useMonuments && this.oceanMonumentGenerator.func_175796_a(this.worldObj, pos)) { return this.oceanMonumentGenerator.func_175799_b(); } } return biomegenbase.getSpawnableList(creatureType); }
@Override public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { Biome biome = this.world.getBiome(pos); for (MapGenStructure structure : this.structureGenerators) { if (this.featureSpawnListActions.containsKey(structure)) { List<Biome.SpawnListEntry> list = this.featureSpawnListActions.get(structure).apply(structure, creatureType, pos); if (list != null) { return list; } } } return biome.getSpawnableList(creatureType); }
public List<Biome.SpawnListEntry> getSpawnableList(EnumCreatureType creatureType) { switch (creatureType) { case MONSTER: return this.spawnableMonsterList; case CREATURE: return this.spawnableCreatureList; case WATER_CREATURE: return this.spawnableWaterCreatureList; case AMBIENT: return this.spawnableCaveCreatureList; default: return Collections.<Biome.SpawnListEntry>emptyList(); } }
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { if (creatureType == EnumCreatureType.MONSTER) { if (this.genNetherBridge.isInsideStructure(pos)) { return this.genNetherBridge.getSpawnList(); } if (this.genNetherBridge.isPositionInStructure(this.world, pos) && this.world.getBlockState(pos.down()).getBlock() == Blocks.NETHER_BRICK) { return this.genNetherBridge.getSpawnList(); } } Biome biome = this.world.getBiome(pos); return biome.getSpawnableList(creatureType); }
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { Biome biome = this.worldObj.getBiome(pos); if (this.mapFeaturesEnabled) { if (creatureType == EnumCreatureType.MONSTER && this.scatteredFeatureGenerator.isSwampHut(pos)) { return this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); } if (creatureType == EnumCreatureType.MONSTER && this.settings.useMonuments && this.oceanMonumentGenerator.isPositionInStructure(this.worldObj, pos)) { return this.oceanMonumentGenerator.getScatteredFeatureSpawnList(); } } return biome.getSpawnableList(creatureType); }
/** * Add a spawn entry for the supplied entity in the supplied {@link BiomeGenBase} list * @param entityClass Entity class added * @param weightedProb Probability * @param min Min spawn count * @param max Max spawn count * @param typeOfCreature Type of spawn * @param biomes List of biomes */ public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, Biome... biomes) { for (Biome biome : biomes) { 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)); } }
/** * Remove the spawn entry for the supplied entity * @param entityClass The entity class * @param typeOfCreature type of spawn * @param biomes Biomes to remove from */ public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType typeOfCreature, Biome... biomes) { for (Biome biome : biomes) { Iterator<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature).iterator(); while (spawns.hasNext()) { SpawnListEntry entry = spawns.next(); if (entry.entityClass == entityClass) { spawns.remove(); } } } }
public static void init() { registerEntity(EntitySoullessKnight.class, IdConfig.EntitySoullessKnight ,"soulless_knight", 0x19232C, 295051); registerEntity(EntitySoulPart.class, IdConfig.EntitySoulPart, "soul_part", 0xa62323, 0xaed1515); registerEntity(EntityThrown.class, IdConfig.EntityThrown, "entity_thrown"); registerEntity(EntityHarshenSoul.class, IdConfig.EntityHarshenSoul, "harshen_soul", 0xa62323, 0xaed1515); registerSpawn(EntityHarshenSoul.class, 95, 4, 4, EnumCreatureType.MONSTER, ForgeRegistries.BIOMES.getValues()); }
@Override public boolean isMobType(Entity entity) { return entity.isCreatureType(EnumCreatureType.CREATURE, false) || entity.isCreatureType(EnumCreatureType.AMBIENT, false) || entity.isCreatureType(EnumCreatureType.WATER_CREATURE, false) || entity instanceof EntityVillager || entity instanceof EntityGolem; }
/** * If the mob is friendly (not aggressive) */ public static boolean isFriendlyMob(Entity entity) { return (entity.isCreatureType(EnumCreatureType.CREATURE, false) && !EntityUtils.isNeutralMob(entity)) || (entity.isCreatureType(EnumCreatureType.AMBIENT, false) && !isBatsDisabled) || entity instanceof EntityVillager || entity instanceof EntityIronGolem || (isNeutralMob(entity) && !EntityUtils.isMobAggressive(entity)); }
public static void setupSpawns() { for (Biome b : ForgeRegistries.BIOMES) { if (BiomeDictionary.hasType(b, BiomeDictionary.Type.FOREST)) { net.minecraftforge.fml.common.registry.EntityRegistry.addSpawn(EntityBeetle.class, 3, 4, 5, EnumCreatureType.CREATURE, b); } } }
@Override public SpawnListEntry getSpawnListEntryForTypeAt(EnumCreatureType creatureType, BlockPos pos) { if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) { return m_proxyWorld.getSpawnListEntryForTypeAt(creatureType, pos); } else if (m_realWorld != null) { return m_realWorld.getSpawnListEntryForTypeAt(creatureType, pos); } else { return super.getSpawnListEntryForTypeAt(creatureType, pos); } }
@Override public boolean canCreatureTypeSpawnHere(EnumCreatureType creatureType, SpawnListEntry spawnListEntry, BlockPos pos) { if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) { return m_proxyWorld.canCreatureTypeSpawnHere(creatureType, spawnListEntry, pos); } else if (m_realWorld != null) { return m_realWorld.canCreatureTypeSpawnHere(creatureType, spawnListEntry, pos); } else { return super.canCreatureTypeSpawnHere(creatureType, spawnListEntry, pos); } }
@Override public int countEntities(EnumCreatureType type, boolean forSpawnCount) { if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) { return m_proxyWorld.countEntities(type, forSpawnCount); } else if (m_realWorld != null) { return m_realWorld.countEntities(type, forSpawnCount); } else { return super.countEntities(type, forSpawnCount); } }
@Override public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) { if (m_realPlayer == null) { return super.isCreatureType(type, forSpawnCount); } else { syncToRealPlayer(); return m_realPlayer.isCreatureType(type, forSpawnCount); } }
@Override public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) { if (m_realPlayer == null) { return super.isCreatureType(type, forSpawnCount); } else { return m_realPlayer.isCreatureType(type, forSpawnCount); } }
/** * Add spawning rules for the living mobs we want to be able to spawn naturally. */ public static void addEntitySpawns() { // get the list of biomes that creepers can spawn in, we'll use the same biomes for all of our mobs Biome[] biomes = getBiomeList(EntityCreeper.class, EnumCreatureType.MONSTER); // add the spawn rules to the entity registry EntityRegistry.addSpawn(EntityJumpkin.class, 100, 4, 4, EnumCreatureType.MONSTER, biomes); EntityRegistry.addSpawn(EntityZombieHands.class, 100, 4, 4, EnumCreatureType.MONSTER, biomes); EntityRegistry.addSpawn(EntityHallowitch.class, 75, 4, 4, EnumCreatureType.MONSTER, biomes); EntityRegistry.addSpawn(EntityCreeperween.class, 75, 4, 4, EnumCreatureType.MONSTER, biomes); EntityRegistry.addSpawn(EntityHaunter.class, 5, 1, 1, EnumCreatureType.MONSTER, biomes); EntityRegistry.addSpawn(EntityTreater.class, 50, 4, 4, EnumCreatureType.MONSTER, biomes); }
/** * Helper method to return an array of biomes in which an already existing instance of EntityLiving can spawn. */ private static final Biome[] getBiomeList(final Class<? extends EntityLiving> classToCopy, final EnumCreatureType creatureTypeToCopy) { final List<Biome> biomes = new ArrayList<Biome>(); for (final Biome biome : ForgeRegistries.BIOMES) { biome.getSpawnableList(creatureTypeToCopy).stream().filter(new Predicate<SpawnListEntry>() { @Override public boolean test(SpawnListEntry entry) { return entry.entityClass == classToCopy; } }) .findFirst() .ifPresent(new Consumer<SpawnListEntry>() { @Override public void accept(SpawnListEntry spawnListEntry) { biomes.add(biome); } }); } return biomes.toArray(new Biome[biomes.size()]); }
public static void init() { int endermanEggColor1 = new Color(254, 85, 176).getRGB(); int endermanEggColor2 = new Color(97, 230, 150).getRGB(); EntityRegistry.registerModEntity(new ResourceLocation(ModGlobals.MODID, "enderman_evolved"), EntityEvolvedEnderman.class, "evolved_enderman", 0, EndermanEvolution.INSTANCE, 80, 3, false, 0, endermanEggColor2); EntityRegistry.registerModEntity(new ResourceLocation(ModGlobals.MODID, "frienderman"), EntityFrienderman.class, "frienderman", 1, EndermanEvolution.INSTANCE, 80, 3, false, 0, endermanEggColor1); EntityRegistry.registerModEntity(new ResourceLocation(ModGlobals.MODID, "friender_pearl"), EntityFrienderPearl.class, "friender_pearl", 2, EndermanEvolution.INSTANCE, 80, 3, true); EntityRegistry.registerModEntity(new ResourceLocation(ModGlobals.MODID, "evolved_endermite"), EntityEvolvedEndermite.class, "evolved_endermite", 4, EndermanEvolution.INSTANCE, 80, 3, false, new Color(1, 66, 16).getRGB(), endermanEggColor2); EntitySpawnPlacementRegistry.setPlacementType(EntityEvolvedEnderman.class, SpawnPlacementType.ON_GROUND); EntitySpawnPlacementRegistry.setPlacementType(EntityFrienderman.class, SpawnPlacementType.ON_GROUND); EntityRegistry.addSpawn(EntityEvolvedEnderman.class, ConfigOptions.ENDERMAN_PROBABILITY, 1, ConfigOptions.ENDERMAN_MAX_SPAWN, EnumCreatureType.MONSTER, getBiomeList()); EntityRegistry.addSpawn(EntityFrienderman.class, ConfigOptions.FRIENDERMAN_PROBABILITY, 1, ConfigOptions.FRIENDERMAN_MAX_SPAWN, EnumCreatureType.CREATURE, Biomes.SKY, Biomes.DESERT, Biomes.HELL); }
private static Biome[] getBiomeList() { List<Biome> biomes = new ArrayList<Biome>(); List<Biome> biomeList = BiomeUtils.getBiomeList(); for (Biome currentBiome : biomeList) { List<SpawnListEntry> spawnList = currentBiome.getSpawnableList(EnumCreatureType.MONSTER); for (SpawnListEntry spawnEntry : spawnList) { if (spawnEntry.entityClass == EntityEnderman.class) { biomes.add(currentBiome); } } } return biomes.toArray(new Biome[biomes.size()]); }