本文整理匯總了Java中net.minecraft.entity.monster.EntityZombie.setChild方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityZombie.setChild方法的具體用法?Java EntityZombie.setChild怎麽用?Java EntityZombie.setChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.monster.EntityZombie
的用法示例。
在下文中一共展示了EntityZombie.setChild方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onLivingDeath
import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
@SubscribeEvent
public void onLivingDeath(LivingDeathEvent event) {
if (event.getSource().getSourceOfDamage() != null && event.getSource().getSourceOfDamage() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getSource().getSourceOfDamage();
if (this.isActive(player) && event.getEntityLiving() instanceof EntityVillager) {
EntityVillager villager = (EntityVillager) event.getEntityLiving();
EntityZombie zombieVillager = new EntityZombie(player.worldObj);
zombieVillager.copyLocationAndAnglesFrom(villager);
player.worldObj.removeEntity(villager);
zombieVillager.onInitialSpawn(player.worldObj.getDifficultyForLocation(new BlockPos(zombieVillager)), null);
zombieVillager.setVillagerType(villager.getProfessionForge());
zombieVillager.setChild(villager.isChild());
zombieVillager.setNoAI(villager.isAIDisabled());
if (villager.hasCustomName()) {
zombieVillager.setCustomNameTag(villager.getCustomNameTag());
zombieVillager.setAlwaysRenderNameTag(villager.getAlwaysRenderNameTag());
}
player.worldObj.spawnEntityInWorld(zombieVillager);
player.worldObj.playEvent(null, 1026, zombieVillager.getPosition(), 0);
}
}
}
示例2: onKillEntity
import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
/**
* This method gets called when the entity kills another one.
*/
public void onKillEntity(EntityLivingBase p_70074_1_)
{
super.onKillEntity(p_70074_1_);
if ((this.worldObj.difficultySetting == EnumDifficulty.NORMAL || this.worldObj.difficultySetting == EnumDifficulty.HARD) && p_70074_1_ instanceof EntityVillager)
{
if (this.worldObj.difficultySetting != EnumDifficulty.HARD && this.rand.nextBoolean())
{
return;
}
EntityZombie entityzombie = new EntityZombie(this.worldObj);
entityzombie.copyLocationAndAnglesFrom(p_70074_1_);
this.worldObj.removeEntity(p_70074_1_);
entityzombie.onSpawnWithEgg((IEntityLivingData)null);
entityzombie.setVillager(true);
if (p_70074_1_.isChild())
{
entityzombie.setChild(true);
}
this.worldObj.spawnEntityInWorld(entityzombie);
this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
}
}
示例3: impactInfection
import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
private void impactInfection(MovingObjectPosition mop, boolean enhanced) {
if(mop.typeOfHit == MovingObjectType.BLOCK) {
Block itemEntity = super.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
int newBrewStack = super.worldObj.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
if((itemEntity == Blocks.stone || itemEntity == Blocks.cobblestone || itemEntity == Blocks.stonebrick && newBrewStack == 0) && BlockProtect.canBreak(mop.blockX, mop.blockZ, mop.blockY, super.worldObj)) {
if(itemEntity == Blocks.stone) {
super.worldObj.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.monster_egg, 0, 3);
} else if(itemEntity == Blocks.cobblestone) {
super.worldObj.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.monster_egg, 1, 3);
} else if(itemEntity == Blocks.stonebrick) {
super.worldObj.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.monster_egg, 2, 3);
}
return;
}
} else if(mop.typeOfHit == MovingObjectType.ENTITY && mop.entityHit instanceof EntityLivingBase) {
EntityLivingBase itemEntity2 = (EntityLivingBase)mop.entityHit;
if(itemEntity2 instanceof EntityVillager) {
EntityZombie newBrewStack2 = new EntityZombie(super.worldObj);
newBrewStack2.copyLocationAndAnglesFrom(itemEntity2);
super.worldObj.removeEntity(itemEntity2);
newBrewStack2.onSpawnWithEgg((IEntityLivingData)null);
newBrewStack2.setVillager(true);
if(itemEntity2.isChild()) {
newBrewStack2.setChild(true);
}
super.worldObj.spawnEntityInWorld(newBrewStack2);
super.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, (int)newBrewStack2.posX, (int)newBrewStack2.posY, (int)newBrewStack2.posZ, 0);
} else {
float newBrewStack3 = enhanced?4.0F:1.0F;
itemEntity2.attackEntityFrom(DamageSource.causeThrownDamage(itemEntity2, this.getThrower()), newBrewStack3);
itemEntity2.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 8));
}
return;
}
EntityItem itemEntity1 = null;
if(mop != null) {
ItemStack newBrewStack1 = Witchery.Items.GENERIC.itemBrewOfInfection.createStack();
switch(EntityWitchProjectile.NamelessClass2036201851.$SwitchMap$net$minecraft$util$MovingObjectPosition$MovingObjectType[mop.typeOfHit.ordinal()]) {
case 1:
itemEntity1 = new EntityItem(super.worldObj, (double)mop.blockX + 0.5D, (double)(mop.blockY + (mop.sideHit == 0?-1:1)) + 0.5D, (double)mop.blockZ + 0.5D, newBrewStack1);
break;
case 2:
itemEntity1 = new EntityItem(super.worldObj, mop.entityHit.posX, mop.entityHit.posY, mop.entityHit.posZ, newBrewStack1);
}
}
this.skipFX = true;
if(itemEntity1 != null) {
super.worldObj.spawnEntityInWorld(itemEntity1);
}
}
示例4: impactLove
import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
private void impactLove(MovingObjectPosition mop, boolean enhanced) {
double RADIUS = enhanced?5.0D:4.0D;
AxisAlignedBB axisalignedbb = super.boundingBox.expand(RADIUS, 2.0D, RADIUS);
List list1 = super.worldObj.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb);
if(list1 != null && !list1.isEmpty() && !super.worldObj.isRemote) {
EntityLivingBase entityThrower = this.getThrower();
EntityPlayer thrower = entityThrower != null && entityThrower instanceof EntityPlayer?(EntityPlayer)entityThrower:null;
Iterator iterator = list1.iterator();
ArrayList villagers = new ArrayList();
ArrayList zombies = new ArrayList();
while(iterator.hasNext()) {
EntityLiving limit = (EntityLiving)iterator.next();
double zombie = limit.getDistanceSq(super.posX, super.posY, super.posZ);
if(zombie < RADIUS * RADIUS) {
double baby = 1.0D - Math.sqrt(zombie) / RADIUS;
if(limit == mop.entityHit) {
baby = 1.0D;
}
int j = (int)(baby * 400.0D + 0.5D);
if(limit instanceof EntityAnimal) {
EntityAnimal zombie1 = (EntityAnimal)limit;
if(zombie1.getGrowingAge() >= 0) {
zombie1.setGrowingAge(0);
zombie1.func_146082_f((EntityPlayer)null);
}
} else if(limit instanceof EntityVillager) {
EntityVillager var26 = (EntityVillager)limit;
if(var26.getGrowingAge() >= 0) {
villagers.add(var26);
}
} else if(limit instanceof EntityZombie) {
EntityZombie var25 = (EntityZombie)limit;
if(!var25.isChild() && thrower != null) {
NBTTagCompound nbt = var25.getEntityData();
if(PotionEnslaved.isMobEnslavedBy(var25, thrower)) {
zombies.add(var25);
}
}
}
}
}
int var20 = 10;
while(villagers.size() > 1 && var20-- > 0) {
EntityVillager var22 = (EntityVillager)villagers.get(0);
EntityVillager mate = (EntityVillager)villagers.get(1);
var22.setPosition(mate.posX, mate.posY, mate.posZ);
ParticleEffect.HEART.send(SoundEffect.NONE, mate, 1.0D, 2.0D, 8);
this.giveBirth(var22, mate);
villagers.remove(0);
villagers.remove(0);
}
var20 = 10;
while(zombies.size() > 1 && var20-- > 0) {
EntityZombie var21 = (EntityZombie)zombies.get(0);
EntityZombie var23 = (EntityZombie)zombies.get(1);
var21.setPosition(var23.posX, var23.posY, var23.posZ);
ParticleEffect.HEART.send(SoundEffect.NONE, var23, 1.0D, 2.0D, 8);
var21.setVillager(true);
var23.setVillager(true);
EntityZombie var24 = new EntityZombie(super.worldObj);
var24.setLocationAndAngles(var23.posX, var23.posY, var23.posZ, 0.0F, 0.0F);
var24.setChild(true);
super.worldObj.spawnEntityInWorld(var24);
zombies.remove(0);
zombies.remove(0);
}
}
}