public void onUpdate() { super.onUpdate(); if (getPuffed()) { fallDistance = 0.0F; if (motionY < -0.050000000000000003D) { motionY = -0.050000000000000003D; } } if (rand.nextInt(100) == 0) { int i = MathHelper.floor_double(posX); int j = MathHelper.floor_double(posY); int k = MathHelper.floor_double(posZ); if (worldObj.getBlockId(i, j - 1, k) == AetherBlocks.Grass.blockID) { worldObj.setBlockWithNotify(i, j - 1, k, AetherBlocks.Dirt.blockID); amountEaten++; } } if (amountEaten == 5 && !getSheared() && !getPuffed()) { setPuffed(true); amountEaten = 0; } if (amountEaten == 10 && getSheared() && !getPuffed()) { setSheared(false); setFleeceColor(0); amountEaten = 0; } }
public void readEntityFromNBT(NBTTagCompound nbttagcompound) { super.readEntityFromNBT(nbttagcompound); setSheared(nbttagcompound.getBoolean("Sheared")); setPuffed(nbttagcompound.getBoolean("Puffed")); setFleeceColor(nbttagcompound.getByte("Color")); }
protected void entityInit() { super.entityInit(); dataWatcher.addObject(16, new Byte((byte) 0)); }
public void writeEntityToNBT(NBTTagCompound nbttagcompound) { super.writeEntityToNBT(nbttagcompound); nbttagcompound.setBoolean("Sheared", getSheared()); nbttagcompound.setBoolean("Puffed", getPuffed()); nbttagcompound.setByte("Color", (byte) getFleeceColor()); }