@Override public void recieveMana(int mana) { int tiles = validPools.size(); if (tiles != 0) { int manaForEach = mana / tiles; for (IManaReceiver pool : validPools) { pool.recieveMana(manaForEach); TileEntity tile = (TileEntity) pool; VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, tile.getPos()); } } }
@Override public void update() { if (worldObj.isRemote) return; validPools.clear(); for (EnumFacing dir : EnumFacing.HORIZONTALS) { TileEntity tileAt = worldObj.getTileEntity(pos.offset(dir)); if (tileAt != null && tileAt instanceof IManaPool && !tileAt.isInvalid()) { IManaReceiver receiver = (IManaReceiver) tileAt; if (!receiver.isFull()) validPools.add(receiver); } } }