net.minecraft.world.biome.Biome.SpawnListEntry Java Examples

The following examples show how to use net.minecraft.world.biome.Biome.SpawnListEntry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CyberwareContent.java    From Cyberware with MIT License 6 votes vote down vote up
public static void postInit()
{
	
	if (!CyberwareConfig.NO_ZOMBIES)
	{
		List<Biome> biomes = new ArrayList<Biome>();
		
		for (ResourceLocation key : Biome.REGISTRY.getKeys())
		{
			Biome biome = Biome.REGISTRY.getObject(key);
			for (SpawnListEntry entry : biome.getSpawnableList(EnumCreatureType.MONSTER))
			{
				if (entry.entityClass == EntityZombie.class)
				{
					biomes.add(biome);
				}
			}
		}
		EntityRegistry.addSpawn(EntityCyberZombie.class, CyberwareConfig.ZOMBIE_WEIGHT, CyberwareConfig.ZOMBIE_MIN_PACK, CyberwareConfig.ZOMBIE_MAX_PACK, EnumCreatureType.MONSTER, biomes.toArray(new Biome[0]));
	}

}
 
Example #2
Source File: ChunkProviderCavePlanet.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
/**
 * Returns a list of creatures of the specified type that can spawn at the given location.
 */
 @Override
 public List<SpawnListEntry> getPossibleCreatures(
		 EnumCreatureType creatureType, BlockPos pos) {
	Biome biome = this.world.getBiome(pos);

	return biome.getSpawnableList(creatureType);
}
 
Example #3
Source File: ChunkProviderPlanet.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
/**
 * Returns a list of creatures of the specified type that can spawn at the given location.
 */
@Override
public List<SpawnListEntry> getPossibleCreatures(
		EnumCreatureType creatureType, BlockPos pos) {
	Biome biome = this.worldObj.getBiome(pos);

       return biome.getSpawnableList(creatureType);
}
 
Example #4
Source File: SpaceChunkGenerator.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
   public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
return new ArrayList<Biome.SpawnListEntry>();
   }
 
Example #5
Source File: StorageChunkGenerator.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
   public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
return null;
   }
 
Example #6
Source File: ServerStateMachine.java    From malmo with MIT License 4 votes vote down vote up
/** 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.getList().iterator();
            while (it.hasNext())
            {
                // Is this on our list?
                SpawnListEntry sle = it.next();
                net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.EntityRegistry.getEntry(sle.entityClass);
                String mobName = entry == null ? null : entry.getName();
                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);
}
 
Example #7
Source File: ChunkProviderSpace.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public List<SpawnListEntry> getPossibleCreatures(
		EnumCreatureType creatureType, BlockPos pos) {
	return null;
}