protected void updatePlayerActionState() { if (onGround && (motionX > 0.050000000745058101D || motionZ > 0.050000000745058101D || motionX < -0.050000000745058101D || motionZ < -0.050000000745058101D)) { motionY = 0.44999998807907099D; } if (!h) { super.updatePlayerActionState(); } else if (onGround) { h = false; worldObj.playSoundAtEntity( this, "rabbitland", 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F); List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(12D, 12D, 12D)); for (int k = 0; k < list.size(); k++) { Entity entity = (Entity) list.get(k); if (entity instanceof EntityMob) { EntityMob entitymobs = (EntityMob) entity; entitymobs.playerToAttack = this; } } } }
public void func_46081_b() { field_46093_b.func_46012_aJ().func_46070_a(field_46094_c, field_46093_b.func_46013_aQ()); field_46093_b.func_46008_aG().func_46141_a(field_46094_c, 30F, 30F); field_46091_d = Math.max(field_46091_d - 1, 0); double d = 4D; if (field_46093_b.func_387_e(field_46094_c) > d) { return; } if (field_46091_d > 0) { return; } else { field_46091_d = 20; field_46093_b.func_35175_b(field_46094_c); return; } }
/** * Called frequently so the entity can update its state every tick as required. For example, * zombies and skeletons use this to react to sunlight and start to burn. */ public void onLivingUpdate() { if (this.worldObj.isDaytime() && !this.worldObj.isRemote) { float var1 = this.getBrightness(1.0F); if (var1 > 0.5F && this.rand.nextFloat() * 30.0F < (var1 - 0.4F) * 2.0F && this.worldObj.canBlockSeeTheSky( MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))) { boolean var2 = true; ItemStack var3 = this.getCurrentItemOrArmor(4); if (var3 != null) { if (var3.isItemStackDamageable()) { var3.setItemDamage(var3.getItemDamageForDisplay() + this.rand.nextInt(2)); if (var3.getItemDamageForDisplay() >= var3.getMaxDamage()) { this.renderBrokenItemStack(var3); this.setCurrentItemOrArmor(4, (ItemStack) null); } } var2 = false; } if (var2) { this.setFire(8); } } } super.onLivingUpdate(); }
/** Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); if (!this.worldObj.isRemote) { this.setBesideClimbableBlock(this.isCollidedHorizontally); } }
/** Called when the mob's health reaches 0. */ public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); if (par1DamageSource.getEntity() instanceof EntitySkeleton) { this.dropItem(Item.record13.shiftedIndex + this.rand.nextInt(10), 1); } }
/** * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, * slot */ public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) { super.setCurrentItemOrArmor(par1, par2ItemStack); if (!this.worldObj.isRemote && par1 == 0) { this.func_85036_m(); } }
/** Called to update the entity's position/logic. */ public void onUpdate() { if (this.isEntityAlive()) { this.lastActiveTime = this.timeSinceIgnited; int var1 = this.getCreeperState(); if (var1 > 0 && this.timeSinceIgnited == 0) { this.worldObj.playSoundAtEntity(this, "random.fuse", 1.0F, 0.5F); } this.timeSinceIgnited += var1; if (this.timeSinceIgnited < 0) { this.timeSinceIgnited = 0; } if (this.timeSinceIgnited >= 30) { this.timeSinceIgnited = 30; if (!this.worldObj.isRemote) { if (this.getPowered()) { this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 6.0F); } else { this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 3.0F); } this.setDead(); } } } super.onUpdate(); }
/** (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); if (this.dataWatcher.getWatchableObjectByte(17) == 1) { par1NBTTagCompound.setBoolean("powered", true); } }
public void func_70071_h_() { if (func_70089_S()) { field_70834_e = field_70833_d; int i = func_70832_p(); if (i > 0 && field_70833_d == 0) { field_70170_p.func_72956_a(this, "random.fuse", 1.0F, 0.5F); } field_70833_d += i; if (field_70833_d < 0) { field_70833_d = 0; } if (field_70833_d >= 30) { field_70833_d = 30; if (!field_70170_p.field_72995_K) { if (func_70830_n()) { field_70170_p.func_72876_a(this, field_70165_t, field_70163_u, field_70161_v, 6F); } else { field_70170_p.func_72876_a(this, field_70165_t, field_70163_u, field_70161_v, 3F); } func_70106_y(); } } } super.func_70071_h_(); }
/** Drop 0-2 items of this living's type */ protected void dropFewItems(boolean par1, int par2) { super.dropFewItems(par1, par2); if (par1 && (this.rand.nextInt(3) == 0 || this.rand.nextInt(1 + par2) > 0)) { this.dropItem(Item.spiderEye.shiftedIndex, 1); } }
/** Handles updating while being ridden by an entity */ public void updateRidden() { super.updateRidden(); if (this.ridingEntity instanceof EntityCreature) { EntityCreature var1 = (EntityCreature) this.ridingEntity; this.renderYawOffset = var1.renderYawOffset; } }
private EntityLiving func_46090_h() { Object obj = field_46093_b.func_46007_aL(); if (obj == null) { obj = field_46095_a.func_40480_b(field_46093_b, field_46092_e); } if (obj == null) { return null; } if (((EntityLiving) (obj)).field_601_au.field_1702_e <= field_46093_b.field_601_au.field_1697_b || ((EntityLiving) (obj)).field_601_au.field_1697_b >= field_46093_b.field_601_au.field_1702_e) { return null; } if (!field_46093_b.func_420_c(((Entity) (obj)))) { return null; } else { return ((EntityLiving) (obj)); } }
/** (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); if (par1NBTTagCompound.hasKey("SkeletonType")) { byte var2 = par1NBTTagCompound.getByte("SkeletonType"); this.setSkeletonType(var2); } this.func_85036_m(); }
public void onLivingUpdate() { if (worldObj.isDaytime() && !worldObj.multiplayerWorld) { float f = getEntityBrightness(1.0F); if (f > 0.5F && worldObj.canBlockSeeTheSky( MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) && rand.nextFloat() * 30F < (f - 0.4F) * 2.0F) { // setFire(8); } } super.onLivingUpdate(); }
/** Called when the mob's health reaches 0. */ public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); if (par1DamageSource.getSourceOfDamage() instanceof EntityArrow && par1DamageSource.getEntity() instanceof EntityPlayer) { EntityPlayer var2 = (EntityPlayer) par1DamageSource.getEntity(); double var3 = var2.posX - this.posX; double var5 = var2.posZ - this.posZ; if (var3 * var3 + var5 * var5 >= 2500.0D) { var2.triggerAchievement(AchievementList.snipeSkeleton); } } }
/** * Called frequently so the entity can update its state every tick as required. For example, * zombies and skeletons use this to react to sunlight and start to burn. */ public void onLivingUpdate() { if (!worldObj.isRemote) { if (isWet()) { attackEntityFrom(DamageSource.drown, 1); } heightOffsetUpdateTime--; if (heightOffsetUpdateTime <= 0) { heightOffsetUpdateTime = 100; heightOffset = 0.5F + (float) rand.nextGaussian() * 3F; } if (getEntityToAttack() != null && getEntityToAttack().posY + (double) getEntityToAttack().getEyeHeight() > posY + (double) getEyeHeight() + (double) heightOffset) { motionY += (0.30000001192092896D - motionY) * 0.30000001192092896D; } } if (rand.nextInt(24) == 0) { worldObj.playSoundEffect( posX + 0.5D, posY + 0.5D, posZ + 0.5D, "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F); } if (!onGround && motionY < 0.0D) { motionY *= 0.59999999999999998D; } for (int i = 0; i < 2; i++) { worldObj.spawnParticle( "largesmoke", posX + (rand.nextDouble() - 0.5D) * (double) width, posY + rand.nextDouble() * (double) height, posZ + (rand.nextDouble() - 0.5D) * (double) width, 0.0D, 0.0D, 0.0D); } super.onLivingUpdate(); }
/** * Called frequently so the entity can update its state every tick as required. For example, * zombies and skeletons use this to react to sunlight and start to burn. */ public void onLivingUpdate() { if (!this.worldObj.isRemote) { if (this.isWet()) { this.attackEntityFrom(DamageSource.drown, 1); } --this.heightOffsetUpdateTime; if (this.heightOffsetUpdateTime <= 0) { this.heightOffsetUpdateTime = 100; this.heightOffset = 0.5F + (float) this.rand.nextGaussian() * 3.0F; } if (this.getEntityToAttack() != null && this.getEntityToAttack().posY + (double) this.getEntityToAttack().getEyeHeight() > this.posY + (double) this.getEyeHeight() + (double) this.heightOffset) { this.motionY += (0.30000001192092896D - this.motionY) * 0.30000001192092896D; } } if (this.rand.nextInt(24) == 0) { this.worldObj.playSoundEffect( this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.fire", 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F); } if (!this.onGround && this.motionY < 0.0D) { this.motionY *= 0.6D; } for (int var1 = 0; var1 < 2; ++var1) { this.worldObj.spawnParticle( "largesmoke", this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width, this.posY + this.rand.nextDouble() * (double) this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D); } super.onLivingUpdate(); }
public void onUpdate() { lastActiveTime = timeSinceIgnited; if (worldObj.multiplayerWorld) { int i = getCreeperState(); if (i > 0 && timeSinceIgnited == 0) { worldObj.playSoundAtEntity(this, "random.fuse", 1.0F, 0.5F); } timeSinceIgnited += i; if (timeSinceIgnited < 0) { timeSinceIgnited = 0; } if (timeSinceIgnited >= 30) { timeSinceIgnited = 30; } } super.onUpdate(); if (entityToAttack == null && timeSinceIgnited > 0) { setCreeperState(-1); timeSinceIgnited--; if (timeSinceIgnited < 0) { timeSinceIgnited = 0; } } }
public void func_370_e_() { field_763_b = field_764_a; if (field_615_ag.field_1026_y) { int i = func_21091_q(); if (i > 0 && field_764_a == 0) { field_615_ag.func_623_a(this, "random.fuse", 1.0F, 0.5F); } field_764_a += i; if (field_764_a < 0) { field_764_a = 0; } if (field_764_a >= 30) { field_764_a = 30; } } super.func_370_e_(); if (field_751_f == null && field_764_a > 0) { func_21090_e(-1); field_764_a--; if (field_764_a < 0) { field_764_a = 0; } } }
/** * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define * their attack. */ protected void attackEntity(Entity par1Entity, float par2) { float var3 = this.getBrightness(1.0F); if (var3 > 0.5F && this.rand.nextInt(100) == 0) { this.entityToAttack = null; } else { if (par2 > 2.0F && par2 < 6.0F && this.rand.nextInt(10) == 0) { if (this.onGround) { double var4 = par1Entity.posX - this.posX; double var6 = par1Entity.posZ - this.posZ; float var8 = MathHelper.sqrt_double(var4 * var4 + var6 * var6); this.motionX = var4 / (double) var8 * 0.5D * 0.800000011920929D + this.motionX * 0.20000000298023224D; this.motionZ = var6 / (double) var8 * 0.5D * 0.800000011920929D + this.motionZ * 0.20000000298023224D; this.motionY = 0.4000000059604645D; } } else { super.attackEntity(par1Entity, par2); } } }
public void func_70037_a(NBTTagCompound p_70037_1_) { super.func_70037_a(p_70037_1_); field_70180_af.func_75692_b( 17, Byte.valueOf((byte) (p_70037_1_.func_74767_n("powered") ? 1 : 0))); }
public void func_70014_b(NBTTagCompound p_70014_1_) { super.func_70014_b(p_70014_1_); if (field_70180_af.func_75683_a(17) == 1) { p_70014_1_.func_74757_a("powered", true); } }
/** (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setByte("SkeletonType", (byte) this.getSkeletonType()); }
public void func_27014_a(EntityLightningBolt entitylightningbolt) { super.func_27014_a(entitylightningbolt); field_21064_bx.func_21129_b(17, Byte.valueOf((byte) 1)); }
protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(13, new Byte((byte) 0)); }
protected void func_82164_bB() { super.func_82164_bB(); this.setCurrentItemOrArmor(0, new ItemStack(Item.bow)); }
protected void func_21057_b() { super.func_21057_b(); field_21064_bx.func_21124_a(16, Byte.valueOf((byte) -1)); field_21064_bx.func_21124_a(17, Byte.valueOf((byte) 0)); }
public void func_419_b(DamageSource damagesource) { super.func_419_b(damagesource); if (damagesource.func_35532_a() instanceof EntitySkeleton) { func_367_b(Item.field_293_aQ.field_291_aS + field_9312_bd.nextInt(10), 1); } }
public void func_357_b(NBTTagCompound nbttagcompound) { super.func_357_b(nbttagcompound); field_21064_bx.func_21129_b( 17, Byte.valueOf((byte) (nbttagcompound.func_760_m("powered") ? 1 : 0))); }
public void func_352_a(NBTTagCompound nbttagcompound) { super.func_352_a(nbttagcompound); if (field_21064_bx.func_21130_a(17) == 1) { nbttagcompound.func_748_a("powered", true); } }