本文整理汇总了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));
}
}
示例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();
}
}
}
}
示例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);
}
}
示例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);
}
}
示例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()]);
}
示例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()]);
}
示例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>();
}
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
}
}
}
}
示例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;
}
示例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;
}
示例14: getList
import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
public List<SpawnListEntry> getList()
{
return list;
}
示例15: getPossibleCreatures
import net.minecraft.world.biome.Biome.SpawnListEntry; //导入依赖的package包/类
@Override
public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
{
return new ArrayList<SpawnListEntry>();
}