本文整理匯總了Java中net.minecraft.entity.EntityAgeable.setLocationAndAngles方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityAgeable.setLocationAndAngles方法的具體用法?Java EntityAgeable.setLocationAndAngles怎麽用?Java EntityAgeable.setLocationAndAngles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.EntityAgeable
的用法示例。
在下文中一共展示了EntityAgeable.setLocationAndAngles方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: spawnChild
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Attempts to spawn a child when the player interacts with an entity using a custom spawn egg
* @param stack a stack containing an ItemCustomEgg item
* @param player the player interacting with the entity
* @param entity the entity that will spawn the child
* @return true if a child was spawned and the EntityInteractEvent should be canceled
*/
private boolean spawnChild(World world, ItemStack stack, EntityPlayer player, EntityAgeable entity) {
Class<? extends Entity> oclass = CustomEntityList.getClassFromID(stack.getItemDamage());
if (oclass != null && oclass == entity.getClass()) {
EntityAgeable child = entity.createChild(entity);
if (child != null) {
child.setGrowingAge(-24000);
child.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, 0.0F, 0.0F);
if (!world.isRemote) {
world.spawnEntityInWorld(child);
}
if (stack.hasDisplayName()) {
child.setCustomNameTag(stack.getDisplayName());
}
if (!player.capabilities.isCreativeMode) {
--stack.stackSize;
if (stack.stackSize <= 0) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
return true;
}
}
return false;
}
示例2: onChildEntityBred
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
private void onChildEntityBred(EntityAgeable entity) {
// Drop additional experience.
int agingSlowdown = getAgingSlowdown(entity);
int experience = (agingSlowdown - 1) * 2 + RandomUtils.getInt(3);
while (experience > 0) {
int xp = EntityXPOrb.getXPSplit(experience);
entity.worldObj.spawnEntityInWorld(new EntityXPOrb(entity.worldObj, entity.posX, entity.posY, entity.posZ, xp));
experience -= xp;
}
// Spawn additional pigs.
if (entity instanceof EntityPig) {
int num = (RandomUtils.getBoolean(1.0 / 200) ? 3 : 1);
for (int i = 0; i < num; i++) {
EntityAgeable newEntity = entity.createChild(entity);
newEntity.setGrowingAge(-23999);
newEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, RandomUtils.getFloat(360), 0);
entity.worldObj.spawnEntityInWorld(newEntity);
}
}
}
示例3: spawnBaby
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Spawns a baby animal of the same type.
*/
private void spawnBaby()
{
EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);
if (entityageable != null)
{
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
this.theWorld.spawnEntityInWorld(entityageable);
Random random = this.theAnimal.getRNG();
for (int i = 0; i < 7; ++i)
{
double d0 = random.nextGaussian() * 0.02D;
double d1 = random.nextGaussian() * 0.02D;
double d2 = random.nextGaussian() * 0.02D;
this.theWorld.spawnParticle("heart", this.theAnimal.posX + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, this.theAnimal.posY + 0.5D + (double)(random.nextFloat() * this.theAnimal.height), this.theAnimal.posZ + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, d0, d1, d2);
}
this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
}
}
示例4: procreate
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Creates a baby animal according to the animal type of the target at the actual position and spawns 'love'
* particles.
*/
private void procreate(EntityAnimal par1EntityAnimal)
{
EntityAgeable entityageable = this.createChild(par1EntityAnimal);
if (entityageable != null)
{
this.setGrowingAge(6000);
par1EntityAnimal.setGrowingAge(6000);
this.inLove = 0;
this.breeding = 0;
this.entityToAttack = null;
par1EntityAnimal.entityToAttack = null;
par1EntityAnimal.breeding = 0;
par1EntityAnimal.inLove = 0;
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
for (int i = 0; i < 7; ++i)
{
double d0 = this.rand.nextGaussian() * 0.02D;
double d1 = this.rand.nextGaussian() * 0.02D;
double d2 = this.rand.nextGaussian() * 0.02D;
this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
}
this.worldObj.spawnEntityInWorld(entityageable);
}
}
示例5: spawnBaby
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Spawns a baby animal of the same type.
*/
private void spawnBaby()
{
EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);
if (entityageable != null)
{
EntityPlayer entityplayer = this.theAnimal.getPlayerInLove();
if (entityplayer == null && this.targetMate.getPlayerInLove() != null)
{
entityplayer = this.targetMate.getPlayerInLove();
}
if (entityplayer != null)
{
entityplayer.triggerAchievement(StatList.animalsBredStat);
if (this.theAnimal instanceof EntityCow)
{
entityplayer.triggerAchievement(AchievementList.breedCow);
}
}
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
this.theWorld.spawnEntityInWorld(entityageable);
Random random = this.theAnimal.getRNG();
for (int i = 0; i < 7; ++i)
{
double d0 = random.nextGaussian() * 0.02D;
double d1 = random.nextGaussian() * 0.02D;
double d2 = random.nextGaussian() * 0.02D;
double d3 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
double d4 = 0.5D + random.nextDouble() * (double)this.theAnimal.height;
double d5 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
this.theWorld.spawnParticle(EnumParticleTypes.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5, d0, d1, d2, new int[0]);
}
if (this.theWorld.getGameRules().getBoolean("doMobLoot"))
{
this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
}
}
}
示例6: spawnBaby
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Spawns a baby animal of the same type.
*/
private void spawnBaby()
{
EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);
if (entityageable != null)
{
EntityPlayer entityplayer = this.theAnimal.getPlayerInLove();
if (entityplayer == null && this.targetMate.getPlayerInLove() != null)
{
entityplayer = this.targetMate.getPlayerInLove();
}
if (entityplayer != null)
{
entityplayer.addStat(StatList.ANIMALS_BRED);
if (this.theAnimal instanceof EntityCow)
{
entityplayer.addStat(AchievementList.BREED_COW);
}
}
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
this.theWorld.spawnEntityInWorld(entityageable);
Random random = this.theAnimal.getRNG();
for (int i = 0; i < 7; ++i)
{
double d0 = random.nextGaussian() * 0.02D;
double d1 = random.nextGaussian() * 0.02D;
double d2 = random.nextGaussian() * 0.02D;
double d3 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
double d4 = 0.5D + random.nextDouble() * (double)this.theAnimal.height;
double d5 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
this.theWorld.spawnParticle(EnumParticleTypes.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5, d0, d1, d2, new int[0]);
}
if (this.theWorld.getGameRules().getBoolean("doMobLoot"))
{
this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
}
}
}
示例7: spawnBaby
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Spawns a baby animal of the same type.
*/
private void spawnBaby()
{
EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);
final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(theAnimal, targetMate, entityageable);
final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
entityageable = event.getChild();
if (cancelled) {
//Reset the "inLove" state for the animals
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
return;
}
if (entityageable != null)
{
EntityPlayer entityplayer = this.theAnimal.getPlayerInLove();
if (entityplayer == null && this.targetMate.getPlayerInLove() != null)
{
entityplayer = this.targetMate.getPlayerInLove();
}
if (entityplayer != null)
{
entityplayer.addStat(StatList.ANIMALS_BRED);
if (this.theAnimal instanceof EntityCow)
{
entityplayer.addStat(AchievementList.BREED_COW);
}
}
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
this.theWorld.spawnEntityInWorld(entityageable);
Random random = this.theAnimal.getRNG();
for (int i = 0; i < 7; ++i)
{
double d0 = random.nextGaussian() * 0.02D;
double d1 = random.nextGaussian() * 0.02D;
double d2 = random.nextGaussian() * 0.02D;
double d3 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
double d4 = 0.5D + random.nextDouble() * (double)this.theAnimal.height;
double d5 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
this.theWorld.spawnParticle(EnumParticleTypes.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5, d0, d1, d2, new int[0]);
}
if (this.theWorld.getGameRules().getBoolean("doMobLoot"))
{
this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
}
}
}
示例8: spawnBaby
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Spawns a baby animal of the same type.
*/
private void spawnBaby()
{
EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);
final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(theAnimal, targetMate, entityageable);
final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
entityageable = event.getChild();
if (cancelled) {
//Reset the "inLove" state for the animals
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
return;
}
if (entityageable != null)
{
EntityPlayer entityplayer = this.theAnimal.getPlayerInLove();
if (entityplayer == null && this.targetMate.getPlayerInLove() != null)
{
entityplayer = this.targetMate.getPlayerInLove();
}
if (entityplayer != null)
{
entityplayer.addStat(StatList.ANIMALS_BRED);
}
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
this.theWorld.spawnEntityInWorld(entityageable);
Random random = this.theAnimal.getRNG();
for (int i = 0; i < 7; ++i)
{
double d0 = random.nextGaussian() * 0.02D;
double d1 = random.nextGaussian() * 0.02D;
double d2 = random.nextGaussian() * 0.02D;
double d3 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
double d4 = 0.5D + random.nextDouble() * (double)this.theAnimal.height;
double d5 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
this.theWorld.spawnParticle(EnumParticleTypes.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5, d0, d1, d2, new int[0]);
}
if (this.theWorld.getGameRules().getBoolean("doMobLoot"))
{
this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
}
}
}
示例9: procreate
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Called when the mob breeds.
* @param mob
*/
private void procreate(EntityIatMob mob)
{
EntityAgeable entityageable = this.createChild(mob);
if (entityageable != null)
{
if (this.theBreeder == null && mob.getBreeder() != null)
{
this.theBreeder = mob.getBreeder();
}
if (this.theBreeder != null)
{
this.theBreeder.triggerAchievement(StatList.field_151186_x);
}
this.setGrowingAge(6000);
mob.setGrowingAge(6000);
this.inLove = 0;
this.breeding = 0;
this.entityToAttack = null;
mob.entityToAttack = null;
mob.breeding = 0;
mob.inLove = 0;
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
for (int i = 0; i < 7; ++i)
{
double d0 = this.rand.nextGaussian() * 0.02D;
double d1 = this.rand.nextGaussian() * 0.02D;
double d2 = this.rand.nextGaussian() * 0.02D;
this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
}
this.worldObj.spawnEntityInWorld(entityageable);
}
}
示例10: spawnBaby
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Spawns a baby animal of the same type.
*/
private void spawnBaby()
{
EntityAgeable var1 = this.theAnimal.createChild(this.targetMate);
if (var1 != null)
{
EntityPlayer var2 = this.theAnimal.func_146083_cb();
if (var2 == null && this.targetMate.func_146083_cb() != null)
{
var2 = this.targetMate.func_146083_cb();
}
if (var2 != null)
{
var2.triggerAchievement(StatList.field_151186_x);
if (this.theAnimal instanceof EntityCow)
{
var2.triggerAchievement(AchievementList.field_150962_H);
}
}
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
var1.setGrowingAge(-24000);
var1.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
this.theWorld.spawnEntityInWorld(var1);
Random var3 = this.theAnimal.getRNG();
for (int var4 = 0; var4 < 7; ++var4)
{
double var5 = var3.nextGaussian() * 0.02D;
double var7 = var3.nextGaussian() * 0.02D;
double var9 = var3.nextGaussian() * 0.02D;
this.theWorld.spawnParticle("heart", this.theAnimal.posX + (double)(var3.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, this.theAnimal.posY + 0.5D + (double)(var3.nextFloat() * this.theAnimal.height), this.theAnimal.posZ + (double)(var3.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, var5, var7, var9);
}
if (this.theWorld.getGameRules().getGameRuleBooleanValue("doMobLoot"))
{
this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, var3.nextInt(7) + 1));
}
}
}
示例11: procreate
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
* Creates a baby animal according to the animal type of the target at the actual position and spawns 'love'
* particles.
*/
private void procreate(EntityAnimal par1EntityAnimal)
{
EntityAgeable var2 = this.createChild(par1EntityAnimal);
if (var2 != null)
{
if (this.field_146084_br == null && par1EntityAnimal.func_146083_cb() != null)
{
this.field_146084_br = par1EntityAnimal.func_146083_cb();
}
if (this.field_146084_br != null)
{
this.field_146084_br.triggerAchievement(StatList.field_151186_x);
if (this instanceof EntityCow)
{
this.field_146084_br.triggerAchievement(AchievementList.field_150962_H);
}
}
this.setGrowingAge(6000);
par1EntityAnimal.setGrowingAge(6000);
this.inLove = 0;
this.breeding = 0;
this.entityToAttack = null;
par1EntityAnimal.entityToAttack = null;
par1EntityAnimal.breeding = 0;
par1EntityAnimal.inLove = 0;
var2.setGrowingAge(-24000);
var2.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
for (int var3 = 0; var3 < 7; ++var3)
{
double var4 = this.rand.nextGaussian() * 0.02D;
double var6 = this.rand.nextGaussian() * 0.02D;
double var8 = this.rand.nextGaussian() * 0.02D;
this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var4, var6, var8);
}
this.worldObj.spawnEntityInWorld(var2);
}
}
示例12: spawnBaby
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
private void spawnBaby()
{
EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);
if (entityageable != null)
{
// CraftBukkit start - set persistence for tame animals
if (entityageable instanceof EntityTameable && ((EntityTameable) entityageable).isTamed())
{
((EntityLiving)entityageable).persistenceRequired = true; // Cauldron - fix illegal access error. SS bug?
}
// CraftBukkit end
EntityPlayer entityplayer = this.theAnimal.func_146083_cb();
if (entityplayer == null && this.targetMate.func_146083_cb() != null)
{
entityplayer = this.targetMate.func_146083_cb();
}
if (entityplayer != null)
{
entityplayer.triggerAchievement(StatList.field_151186_x);
if (this.theAnimal instanceof EntityCow)
{
entityplayer.triggerAchievement(AchievementList.field_150962_H);
}
}
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
this.theWorld.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
Random random = this.theAnimal.getRNG();
for (int i = 0; i < 7; ++i)
{
double d0 = random.nextGaussian() * 0.02D;
double d1 = random.nextGaussian() * 0.02D;
double d2 = random.nextGaussian() * 0.02D;
this.theWorld.spawnParticle("heart", this.theAnimal.posX + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, this.theAnimal.posY + 0.5D + (double)(random.nextFloat() * this.theAnimal.height), this.theAnimal.posZ + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, d0, d1, d2);
}
if (this.theWorld.getGameRules().getGameRuleBooleanValue("doMobLoot"))
{
this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
}
}
}
示例13: procreate
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
private void procreate(EntityAnimal p_70876_1_)
{
EntityAgeable entityageable = this.createChild(p_70876_1_);
if (entityageable != null)
{
if (this.field_146084_br == null && p_70876_1_.func_146083_cb() != null)
{
this.field_146084_br = p_70876_1_.func_146083_cb();
}
if (this.field_146084_br != null)
{
this.field_146084_br.triggerAchievement(StatList.field_151186_x);
if (this instanceof EntityCow)
{
this.field_146084_br.triggerAchievement(AchievementList.field_150962_H);
}
}
this.setGrowingAge(6000);
p_70876_1_.setGrowingAge(6000);
this.inLove = 0;
this.breeding = 0;
this.entityToAttack = null;
p_70876_1_.entityToAttack = null;
p_70876_1_.breeding = 0;
p_70876_1_.inLove = 0;
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
for (int i = 0; i < 7; ++i)
{
double d0 = this.rand.nextGaussian() * 0.02D;
double d1 = this.rand.nextGaussian() * 0.02D;
double d2 = this.rand.nextGaussian() * 0.02D;
this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
}
this.worldObj.spawnEntityInWorld(entityageable);
}
}
示例14: spawnBaby
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
private void spawnBaby()
{
EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);
if (entityageable != null)
{
EntityPlayer entityplayer = this.theAnimal.func_146083_cb();
if (entityplayer == null && this.targetMate.func_146083_cb() != null)
{
entityplayer = this.targetMate.func_146083_cb();
}
if (entityplayer != null)
{
entityplayer.triggerAchievement(StatList.field_151186_x);
if (this.theAnimal instanceof EntityCow)
{
entityplayer.triggerAchievement(AchievementList.field_150962_H);
}
}
this.theAnimal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.theAnimal.resetInLove();
this.targetMate.resetInLove();
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
this.theWorld.spawnEntityInWorld(entityageable);
Random random = this.theAnimal.getRNG();
for (int i = 0; i < 7; ++i)
{
double d0 = random.nextGaussian() * 0.02D;
double d1 = random.nextGaussian() * 0.02D;
double d2 = random.nextGaussian() * 0.02D;
this.theWorld.spawnParticle("heart", this.theAnimal.posX + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, this.theAnimal.posY + 0.5D + (double)(random.nextFloat() * this.theAnimal.height), this.theAnimal.posZ + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, d0, d1, d2);
}
if (this.theWorld.getGameRules().getGameRuleBooleanValue("doMobLoot"))
{
this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
}
}
}
示例15: interact
import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
@Override
public boolean interact(EntityPlayer player)
{
super.interact(player);
ItemStack itemstack = player.inventory.getCurrentItem();
if (itemstack != null && itemstack.getItem() == DerpyItems.spawnegg)
{
if (!this.worldObj.isRemote)
{
Class oclass = (Class) EntityList.stringToClassMapping.get(itemstack.getTagCompound().getString("entity"));
if (oclass != null && oclass.isAssignableFrom(this.getClass()))
{
EntityAgeable entityageable = this.createChild(this);
if (entityageable != null)
{
entityageable.setGrowingAge(-24000);
entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F);
this.worldObj.spawnEntityInWorld(entityageable);
if (itemstack.hasDisplayName())
{
entityageable.setCustomNameTag(itemstack.getDisplayName());
}
if (!player.capabilities.isCreativeMode)
{
--itemstack.stackSize;
if (itemstack.stackSize <= 0)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
}
}
}
}
}
return true;
}
else
{
return false;
}
}