@Override protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(DW_SPIN_TICKS, Integer.valueOf(0)); this.dataWatcher.addObject(DW_CRYSE_TYPE, (byte) 0); this.dataWatcher.addObject(DW_TEXTURE_ID, (byte) 0); this.dataWatcher.addObject(DW_ATTACK_TIME, Integer.valueOf(0)); this.dataWatcher.addObject(DW_FLUTTER_TICKS, Integer.valueOf(0)); }
@Override public void writeEntityToNBT(NBTTagCompound tag) { super.writeEntityToNBT(tag); tag.setByte("texture", this.getTextureID()); tag.setByte("cryseType", this.getCryseType()); tag.setInteger("spinTicks", this.getSpinTicks()); tag.setInteger("attackTime", this.getAttackTime()); tag.setInteger("flutterTicks", this.getFlutterTicks()); }
@Override public void readEntityFromNBT(NBTTagCompound tag) { super.readEntityFromNBT(tag); if (tag.hasKey("texture")) this.setTextureID(tag.getByte("texture")); if (tag.hasKey("cryseType")) this.setCryseType(tag.getByte("cryseType")); if (tag.hasKey("spinTicks")) this.setSpinTicks(tag.getInteger("spinTicks")); if (tag.hasKey("attackTime")) this.setAttackTime(tag.getInteger("attackTime")); if (tag.hasKey("flutterTicks")) this.setFlutterTicks(tag.getInteger("flutterTicks")); }
@Override protected void applyEntityAttributes() { super.applyEntityAttributes(); double[] stats = TragicConfig.getMobStat(this.getCryseType() == 0 ? "cryseStats" : "starCryseStats") .getStats(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(stats[0]); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(stats[1]); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(stats[2]); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(stats[3]); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(stats[4]); }
@Override public void onLivingUpdate() { super.onLivingUpdate(); if (this.worldObj.isRemote) { } else { if (this.isSpinning()) this.decrementSpinTicks(); if (this.getAttackTime() > 0) this.decrementAttackTime(); if (this.isFluttering()) this.decrementFlutterTicks(); if (this.ticksExisted % 120 == 0 && this.getAttackTarget() == null && rand.nextBoolean() && !this.isSpinning() && !this.isFluttering()) { if (rand.nextBoolean()) { this.setSpinTicks(120); } else { this.setFlutterTicks(60); } } } }