Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Gets called every tick from main Entity class
- */
- public void onEntityUpdate()
- {
- this.prevSwingProgress = this.swingProgress;
- super.onEntityUpdate();
- this.worldObj.theProfiler.startSection("livingEntityBaseTick");
- boolean flag = this instanceof EntityPlayer;
- if (this.isEntityAlive())
- {
- if (this.isEntityInsideOpaqueBlock())
- {
- this.attackEntityFrom(DamageSource.inWall, 1.0F);
- }
- else if (flag && !this.worldObj.getWorldBorder().contains(this.getEntityBoundingBox()))
- {
- double d0 = this.worldObj.getWorldBorder().getClosestDistance(this) + this.worldObj.getWorldBorder().getDamageBuffer();
- if (d0 < 0.0D)
- {
- this.attackEntityFrom(DamageSource.inWall, (float)Math.max(1, MathHelper.floor_double(-d0 * this.worldObj.getWorldBorder().getDamageAmount())));
- }
- }
- }
- if (this.isImmuneToFire() || this.worldObj.isRemote)
- {
- this.extinguish();
- }
- boolean flag1 = flag && ((EntityPlayer)this).capabilities.disableDamage;
- if (this.isEntityAlive())
- {
- if (this.isInsideOfMaterial(Material.water))
- {
- if (!this.canBreatheUnderwater() && !this.isPotionActive(Potion.waterBreathing.id) && !flag1)
- {
- this.setAir(this.decreaseAirSupply(this.getAir()));
- if (this.getAir() == -20)
- {
- this.setAir(0);
- for (int i = 0; i < 8; ++i)
- {
- float f = this.rand.nextFloat() - this.rand.nextFloat();
- float f1 = this.rand.nextFloat() - this.rand.nextFloat();
- float f2 = this.rand.nextFloat() - this.rand.nextFloat();
- this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX + (double)f, this.posY + (double)f1, this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ, new int[0]);
- }
- this.attackEntityFrom(DamageSource.drown, 2.0F);
- }
- }
- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase)
- {
- this.mountEntity((Entity)null);
- }
- }
- else
- {
- this.setAir(300);
- }
- }
- if (this.isEntityAlive() && this.isWet())
- {
- this.extinguish();
- }
- this.prevCameraPitch = this.cameraPitch;
- if (this.hurtTime > 0)
- {
- --this.hurtTime;
- }
- if (this.hurtResistantTime > 0 && !(this instanceof EntityPlayerMP))
- {
- --this.hurtResistantTime;
- }
- if (this.getHealth() <= 0.0F)
- {
- this.onDeathUpdate();
- }
- if (this.recentlyHit > 0)
- {
- --this.recentlyHit;
- }
- else
- {
- this.attackingPlayer = null;
- }
- if (this.lastAttacker != null && !this.lastAttacker.isEntityAlive())
- {
- this.lastAttacker = null;
- }
- if (this.entityLivingToAttack != null)
- {
- if (!this.entityLivingToAttack.isEntityAlive())
- {
- this.setRevengeTarget((EntityLivingBase)null);
- }
- else if (this.ticksExisted - this.revengeTimer > 100)
- {
- this.setRevengeTarget((EntityLivingBase)null);
- }
- }
- this.updatePotionEffects();
- this.prevMovedDistance = this.movedDistance;
- this.prevRenderYawOffset = this.renderYawOffset;
- this.prevRotationYawHead = this.rotationYawHead;
- this.prevRotationYaw = this.rotationYaw;
- this.prevRotationPitch = this.rotationPitch;
- if(this == Minecraft.getMinecraft().thePlayer) {
- this.prevRotationYawHead = PlayerHandler.yaw;
- PlayerHandler.prevPitch = PlayerHandler.pitch;
- }
- this.worldObj.theProfiler.endSection();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement