Java 类net.minecraft.world.biome.Biome.SpawnListEntry 实例源码

项目:CustomWorldGen    文件:EntityRegistry.java   
/**
 * 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));
    }
}
项目:CustomWorldGen    文件:EntityRegistry.java   
/**
 * 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();
            }
        }
    }
}
项目:UniversalRemote    文件:WorldServerProxy.java   
@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);
    }
}
项目:UniversalRemote    文件:WorldServerProxy.java   
@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);
    }
}
项目:Halloween    文件:ModEntities.java   
/**
 * 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()]);
}
项目:EndermanEvolution    文件:ModEntities.java   
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()]);
}
项目:CustomWorldGen    文件:WorldEvent.java   
public PotentialSpawns(World world, EnumCreatureType type, BlockPos pos, List<SpawnListEntry> oldList)
{
    super(world);
    this.pos = pos;
    this.type = type;
    if (oldList != null)
    {
        this.list = new ArrayList<SpawnListEntry>(oldList);
    }
    else
    {
        this.list = new ArrayList<SpawnListEntry>();
    }
}
项目:CrystalMod    文件:ModEntites.java   
public static boolean canTypeSpawnByDefault(Biome biome, Class <? extends EntityLiving> entityClass, EnumCreatureType type){
    List<Biome.SpawnListEntry> entryList = biome.getSpawnableList(type);
    if(entryList == null || entryList.size() < 1) return false;
    for(SpawnListEntry entry : entryList){
        if(entityClass.equals(entry.entityClass)){
            return true;
        }
    }
    return false;
}
项目:Aether-Legacy    文件:ChunkProviderAether.java   
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) 
{
    Biome biome = this.worldObj.getBiomeProvider().getBiome(pos);

    return biome != null ? biome.getSpawnableList(creatureType) : null;
}
项目:DungeonDimension    文件:MonumentChunkProvider.java   
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
       if (creatureType == EnumCreatureType.MONSTER && this.oceanMonumentGenerator.isPositionInStructure(this.world, pos)){
           return this.oceanMonumentGenerator.getScatteredFeatureSpawnList();
       }
    return Lists.newArrayList();
}
项目:harshencastle    文件:PontusChunkProvider.java   
private void performWorldGenSpawning(World worldIn, EnumCreatureType type, BlockPos pos ,int p_77191_2_, int p_77191_3_, int p_77191_4_, int p_77191_5_, Random randomIn)
  {
    float amount;
    switch (type) {
case MONSTER:
    amount = 0.1f;
    break;
default:
    amount = 0.3f;
    break;
}
    List<SpawnListEntry> enteries = world.getBiome(pos).getSpawnableList(type);
    SpawnListEntry entry = enteries.get(rand.nextInt(enteries.size()));
    while (randomIn.nextFloat() < amount)
      {
          int i = entry.minGroupCount + randomIn.nextInt(1 + entry.maxGroupCount - entry.minGroupCount);
          IEntityLivingData ientitylivingdata = null;
          int j = p_77191_2_ + randomIn.nextInt(p_77191_4_);
          int k = p_77191_3_ + randomIn.nextInt(p_77191_5_);
          int l = j;
          int i1 = k;

          for (int j1 = 0; j1 < i; ++j1)
          {
              boolean flag = false;

              for (int k1 = 0; !flag && k1 < 4; ++k1)
              {
                  BlockPos blockpos = worldIn.getTopSolidOrLiquidBlock(new BlockPos(j, 0, k));

                  if (WorldEntitySpawner.canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType.ON_GROUND, worldIn, blockpos))
                  {
                      EntityLiving entityliving;

                      try
                      {
                          entityliving = entry.newInstance(worldIn);
                      }
                      catch (Exception exception)
                      {
                          exception.printStackTrace();
                          continue;
                      }

                      entityliving.setLocationAndAngles((double)((float)j + 0.5F), (double)blockpos.getY(), (double)((float)k + 0.5F), randomIn.nextFloat() * 360.0F, 0.0F);
                      worldIn.spawnEntity(entityliving);
                      ientitylivingdata = entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata);
                      flag = true;
                  }

                  j += randomIn.nextInt(5) - randomIn.nextInt(5);

                  for (k += randomIn.nextInt(5) - randomIn.nextInt(5); j < p_77191_2_ || j >= p_77191_2_ + p_77191_4_ || k < p_77191_3_ || k >= p_77191_3_ + p_77191_4_; k = i1 + randomIn.nextInt(5) - randomIn.nextInt(5))
                  {
                      j = l + randomIn.nextInt(5) - randomIn.nextInt(5);
                  }
              }
          }
      }
  }
项目:harshencastle    文件:PontusChunkProvider.java   
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
    ArrayList<Biome.SpawnListEntry> list = new ArrayList<Biome.SpawnListEntry>();
    list.add(new Biome.SpawnListEntry(EntityEndermite.class, 3, 2, 4));
    return list;
}
项目:modName    文件:ChunkProviderMod.java   
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
    // TODO Auto-generated method stub
    return null;
}
项目:CustomWorldGen    文件:WorldEvent.java   
public List<SpawnListEntry> getList()
{
    return list;
}
项目:CrystalMod    文件:PlayerCubeChunkProvider.java   
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
    return new ArrayList<SpawnListEntry>();
}
项目:placementpreview    文件:FakeWorld.java   
@Override
@Nullable
public SpawnListEntry getSpawnListEntryForTypeAt(EnumCreatureType creatureType, BlockPos pos)
{
    return null;
}
项目:placementpreview    文件:FakeWorld.java   
@Override
public boolean canCreatureTypeSpawnHere(EnumCreatureType creatureType, SpawnListEntry spawnListEntry, BlockPos pos)
{
    return false;
}
项目:malmo    文件:ServerStateMachine.java   
/** 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);
}
项目:Toms-Mod    文件:WorldHandler.java   
public boolean onEntitySpawning(BlockPos pos, EnumCreatureType type, List<SpawnListEntry> list) {
    return false;
}
项目:Alchemy    文件:ChunkProviderTheForgottenTimeCourtyard.java   
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { return spawns; }
项目:LightningCraft    文件:MapGenUnderworldRampart.java   
/** Initialize the structure */
public MapGenUnderworldRampart() {
    super(13, 9);
    this.spawnList.add(new SpawnListEntry(EntityUnderworldSilverfish.class, 100, 1, 1));
}
项目:LightningCraft    文件:MapGenUnderworldTower.java   
/** Initialize the structure */
public MapGenUnderworldTower() {
    super(12, 6);
    this.spawnList.add(new SpawnListEntry(EntityUnderworldSkeleton.class, 150, 3, 5));
}
项目:Easy-Editors    文件:FakeWorld.java   
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
    return Collections.emptyList();
}
项目:Toms-Mod    文件:WorldHandler.java   
boolean onEntitySpawning(BlockPos pos, EnumCreatureType type, List<SpawnListEntry> list);