本文整理匯總了Java中net.minecraft.entity.passive.EntityVillager.onInitialSpawn方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityVillager.onInitialSpawn方法的具體用法?Java EntityVillager.onInitialSpawn怎麽用?Java EntityVillager.onInitialSpawn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.passive.EntityVillager
的用法示例。
在下文中一共展示了EntityVillager.onInitialSpawn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: spawnVillagers
import net.minecraft.entity.passive.EntityVillager; //導入方法依賴的package包/類
protected void spawnVillagers(World worldIn, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
{
if (this.villagersSpawned < p_74893_6_)
{
for (int i = this.villagersSpawned; i < p_74893_6_; ++i)
{
int j = this.getXWithOffset(p_74893_3_ + i, p_74893_5_);
int k = this.getYWithOffset(p_74893_4_);
int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_);
if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
{
break;
}
++this.villagersSpawned;
EntityVillager entityvillager = new EntityVillager(worldIn);
entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
entityvillager.setProfession(this.func_180779_c(i, entityvillager.getProfession()));
worldIn.spawnEntityInWorld(entityvillager);
}
}
}
示例2: convertToVillager
import net.minecraft.entity.passive.EntityVillager; //導入方法依賴的package包/類
/**
* Convert this zombie into a villager.
*/
protected void convertToVillager()
{
EntityVillager entityvillager = new EntityVillager(this.worldObj);
entityvillager.copyLocationAndAnglesFrom(this);
entityvillager.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
entityvillager.setLookingForHome();
if (this.isChild())
{
entityvillager.setGrowingAge(-24000);
}
this.worldObj.removeEntity(this);
entityvillager.setNoAI(this.isAIDisabled());
if (this.hasCustomName())
{
entityvillager.setCustomNameTag(this.getCustomNameTag());
entityvillager.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
}
this.worldObj.spawnEntityInWorld(entityvillager);
entityvillager.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0));
this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1017, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
}
示例3: spawnVillagers
import net.minecraft.entity.passive.EntityVillager; //導入方法依賴的package包/類
/**
* Spawns a number of villagers in this component. Parameters: world, component bounding box, x offset, y
* offset, z offset, number of villagers
*/
protected void spawnVillagers(World worldIn, StructureBoundingBox structurebb, int x, int y, int z, int count)
{
if (this.villagersSpawned < count)
{
for (int i = this.villagersSpawned; i < count; ++i)
{
int j = this.getXWithOffset(x + i, z);
int k = this.getYWithOffset(y);
int l = this.getZWithOffset(x + i, z);
if (!structurebb.isVecInside(new BlockPos(j, k, l)))
{
break;
}
++this.villagersSpawned;
if (this.isZombieInfested)
{
EntityZombie entityzombie = new EntityZombie(worldIn);
entityzombie.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
entityzombie.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null);
entityzombie.setVillagerType(chooseForgeProfession(i, net.minecraftforge.fml.common.registry.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation("minecraft:farmer"))));
entityzombie.enablePersistence();
worldIn.spawnEntityInWorld(entityzombie);
}
else
{
EntityVillager entityvillager = new EntityVillager(worldIn);
entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
entityvillager.setProfession(this.chooseForgeProfession(i, entityvillager.getProfessionForge()));
worldIn.spawnEntityInWorld(entityvillager);
}
}
}
}
示例4: convertToVillager
import net.minecraft.entity.passive.EntityVillager; //導入方法依賴的package包/類
/**
* Convert this zombie into a villager.
*/
protected void convertToVillager()
{
EntityVillager entityvillager = new EntityVillager(this.worldObj);
entityvillager.copyLocationAndAnglesFrom(this);
entityvillager.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
entityvillager.setLookingForHome();
if (this.isChild())
{
entityvillager.setGrowingAge(-24000);
}
this.worldObj.removeEntity(this);
entityvillager.setNoAI(this.isAIDisabled());
if (this.getVillagerTypeForge() != null)
entityvillager.setProfession(this.getVillagerTypeForge());
else
entityvillager.setProfession(0);
if (this.hasCustomName())
{
entityvillager.setCustomNameTag(this.getCustomNameTag());
entityvillager.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
}
this.worldObj.spawnEntityInWorld(entityvillager);
entityvillager.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 200, 0));
this.worldObj.playEvent((EntityPlayer)null, 1027, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
}