@Override public void onUpdate() { super.onUpdate(); if (!worldObj.isRemote && isCharging) { if (++chargeTick > 50) { worldObj.spawnEntityInWorld(new EntityShockwave(worldObj, this, posX, posY, posZ)); this.playSound(GenericUtils.getRandomSound("lambdacraft:mobs.he_blast", 3), 0.5F, 1.0F); lastShockTick = ticksExisted; isCharging = false; } } if (worldObj.isRemote) { isCharging = dataWatcher.getWatchableObjectByte(20) > 0; chargeTick = dataWatcher.getWatchableObjectByte(20) - 1; } else { dataWatcher.updateObject(20, Byte.valueOf((byte) (isCharging ? chargeTick + 1 : 0))); } }
@Override public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); throwerName = nbt.getString("thrower"); }
@Override public void entityInit() { super.entityInit(); dataWatcher.addObject(20, Byte.valueOf((byte) 0)); }
@Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); if (throwerName != null && throwerName.equals("")) nbt.setString("thrower", throwerName); }