@Override public void onLivingUpdate() { super.onLivingUpdate(); if (this.worldObj.isRemote && this.statMessageTime < 60) { this.statMessageTime++; } }
/** * 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 && !this.isChild()) { float f = this.getBrightness(1.0F); if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.worldObj.canBlockSeeTheSky( MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))) { boolean flag = true; ItemStack itemstack = this.getEquipmentInSlot(4); if (itemstack != null) { if (itemstack.isItemStackDamageable()) { itemstack.setItemDamage(itemstack.getItemDamageForDisplay() + this.rand.nextInt(2)); if (itemstack.getItemDamageForDisplay() >= itemstack.getMaxDamage()) { this.renderBrokenItemStack(itemstack); this.setCurrentItemOrArmor(4, (ItemStack) null); } } flag = false; } if (flag) { this.setFire(8); } } } super.onLivingUpdate(); }
@Override public void onLivingUpdate() { if (this.motionY < 0.0D) { this.motionY += (0.3 - this.motionY) * 0.3; } if (!this.onGround && this.motionY < 0.0D) { this.motionY *= 0.6D; } if (growingAge == 0 && !worldObj.isRemote) { setDead(); } 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() { super.onLivingUpdate(); if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) { this.field_70928_h = true; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; this.worldObj.setEntityState(this, (byte) 8); } }
@Override public void onLivingUpdate() { super.onLivingUpdate(); if (!this.worldObj.isRemote) { if (this.ticksAlive <= 0) { this.setColorRed(this.colorRed); this.setColorGreen(this.colorGreen); this.setColorBlue(this.colorBlue); } this.ticksAlive++; if (this.ticksAlive >= Long.MAX_VALUE) { this.ticksAlive = 0; } if (this.ticksAlive % 2 == 0) { if (this.age < this.MAX_AGE) { this.age++; } this.setAge(Math.min(this.age, this.MAX_AGE)); } this.setFavoriteFood(this.favFoodID); this.setAttackDamage(this.attackDamage); this.setKillCount(this.kills); this.setCargoSlot(this.slimelingInventory.getStackInSlot(1)); } if (!this.worldObj.isRemote) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth) .setAttribute(this.getMaxHealthSlimeling()); } }
/** * 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() { super.onLivingUpdate(); if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) { this.field_70928_h = true; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; this.worldObj.setEntityState(this, (byte) 8); } /*if(this.isPotionActive(Potion.poison)) { this.curePotionEffects(new ItemStack(Item.bucketMilk)); }*/ if (this.entityToAttack == null && this.findPlayerToAttack() == null) { setAngry(false); } // attributeinstance.removeModifier(babySpeedBoostModifier); switch (isStone()) { case 1: // this.moveSpeed = 0.28F; this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.28D); // this.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 10, 0)); if (getHealth() <= getMaxHealth() / 2) { setStone(2); this.tasks.removeTask(wanderTaskA); this.tasks.removeTask(attackTaskA); this.tasks.removeTask(navTaskA); this.tasks.addTask(3, attackTaskB); this.tasks.addTask(4, wanderTaskB); this.tasks.addTask(5, navTaskB); } break; case 2: // this.moveSpeed = 0.19F; this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.19D); this.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 10, 3)); if (getHealth() == getMaxHealth()) { setStone(1); this.tasks.removeTask(wanderTaskB); this.tasks.removeTask(attackTaskB); this.tasks.removeTask(navTaskB); this.tasks.addTask(3, attackTaskA); this.tasks.addTask(4, wanderTaskA); this.tasks.addTask(5, navTaskA); } break; case 3: // this.moveSpeed = 0.0F; this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.0D); AxisAlignedBB par2AxisAlignedBB = AxisAlignedBB.getBoundingBox( this.posX - 16, this.posY - 16, this.posZ - 16, this.posX + 16, this.posY + 16, this.posZ + 16); List<EntityPlayer> ents = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, par2AxisAlignedBB); if (ents.size() > 0) { for (int entind = ents.size() - 1; entind >= 0; entind--) { EntityPlayer pl = ents.get(entind); if (!(pl.openContainer instanceof ContainerPlayer)) { setStone(1); this.setAttackTarget(pl); this.tasks.addTask(3, attackTaskA); this.tasks.addTask(4, wanderTaskA); this.tasks.addTask(5, navTaskA); this.tasks.addTask(7, trackTask); this.attackTime = 200; } } } break; } if (getAttackTarget() == null && isStone() < 3) { NBTTagCompound nbt = this.getEntityData(); if (nbt.getInteger("HealthOverflow") >= getMaxHealth() * 2 - 1) { // System.out.println("Gained stone form"); setStone(3); this.dataWatcher.updateObject(16, Byte.valueOf((byte) 1)); this.tasks.removeTask(leapTask); this.tasks.removeTask(wanderTaskA); this.tasks.removeTask(attackTaskA); this.tasks.removeTask(wanderTaskB); this.tasks.removeTask(attackTaskB); this.tasks.removeTask(navTaskB); this.tasks.removeTask(navTaskB); this.tasks.removeTask(trackTask); this.setPathToEntity((PathEntity) null); } } }