当前位置: 首页>>代码示例>>Java>>正文


Java SpawnListEntry类代码示例

本文整理汇总了Java中net.minecraft.world.biome.Biome.SpawnListEntry的典型用法代码示例。如果您正苦于以下问题:Java SpawnListEntry类的具体用法?Java SpawnListEntry怎么用?Java SpawnListEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SpawnListEntry类属于net.minecraft.world.biome.Biome包,在下文中一共展示了SpawnListEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSpawn

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:34,代码来源:EntityRegistry.java

示例2: removeSpawn

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
/**
 * 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();
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:EntityRegistry.java

示例3: getSpawnListEntryForTypeAt

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:11,代码来源:WorldServerProxy.java

示例4: canCreatureTypeSpawnHere

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:12,代码来源:WorldServerProxy.java

示例5: getBiomeList

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
/**
 * 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()]);
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:31,代码来源:ModEntities.java

示例6: getBiomeList

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
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()]);
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:14,代码来源:ModEntities.java

示例7: PotentialSpawns

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
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>();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:WorldEvent.java

示例8: canTypeSpawnByDefault

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
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;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:11,代码来源:ModEntites.java

示例9: getPossibleCreatures

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) 
{
	Biome biome = this.worldObj.getBiomeProvider().getBiome(pos);

	return biome != null ? biome.getSpawnableList(creatureType) : null;
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:8,代码来源:ChunkProviderAether.java

示例10: getPossibleCreatures

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
@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();
}
 
开发者ID:tiffit,项目名称:DungeonDimension,代码行数:8,代码来源:MonumentChunkProvider.java

示例11: performWorldGenSpawning

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
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);
                  }
              }
          }
      }
  }
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:61,代码来源:PontusChunkProvider.java

示例12: getPossibleCreatures

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
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;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:7,代码来源:PontusChunkProvider.java

示例13: getPossibleCreatures

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:6,代码来源:ChunkProviderMod.java

示例14: getList

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
public List<SpawnListEntry> getList()
{
    return list;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:WorldEvent.java

示例15: getPossibleCreatures

import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
	return new ArrayList<SpawnListEntry>();
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:6,代码来源:PlayerCubeChunkProvider.java


注:本文中的net.minecraft.world.biome.Biome.SpawnListEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。