/** * 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(); }
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 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(); }