public void setState(BossState state) { dataWatcher.updateObject(STATE, state.ordinal()); if (state == BossState.CHARGING) { getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.00001); } else { if (getState() == BossState.ATTACKING) { setCharge(0); setCurrentAttack(BossAttack.getRandom(this, rand)); } getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.075); } }
@Override public void readEntityFromNBT(NBTTagCompound data) { super.readEntityFromNBT(data); setState(BossState.values()[data.getInteger("state")]); setCharge(data.getInteger("charge")); setCurrentAttack( data.getInteger("curattack") == -1 ? null : BossAttack.values()[data.getInteger("curattack")]); }
public BossState getState() { return BossState.values()[dataWatcher.getWatchableObjectInt(STATE)]; }