Once again, this is for rs2hd, but easy to convert for any other source.

In com.rs2hd.content, create a class named Foods and paste this in it:

Code:
package com.rs2hd.server.content;

import com.rs2hd.content.Effects.FoodEffects;
import com.rs2hd.model.Item;
import com.rs2hd.model.Player;
import com.rs2hd.util.Misc;

public class Foods {

	private static Food getFood(int id) {
		for (Food food : Food.values())
			if (id == food.getFoodId())
				return food;
			return null;
	}
	
	public static enum Food {
		CRAYFISH(319, 2), 
		ANCHOVIE(319, 1),
		SHRIMP(315, 3), 
		SARDINE(325, 3), 
		POISON_KARAMBWANJI(3146, 0),
		KARAMBWANI(3144, 18), 
		SLIMY_EEL(3381, 7 + Misc.random(2)),
		RAINBOW_FISH(10136, 11), 
		CAVE_EEL(5003, 8 + Misc.random(2)),
		LAVA_EEL(2149, 7 + Misc.random(2)), 
		HERRING(347, 5), 
		MACKEREL(335, 6), 
		TROUT(339, 7),
		COD(333, 7), 
		PIKE(351, 8),
		SALMON(329, 9), 
		TUNA(361, 10),
		LOBSTER(379, 12), 
		BASS(365, 13),
		SWORDFISH(373, 14), 
		MONKFISH(7946, 16), 
		SHARK(385, 20), 
		TURTLE(397, 21),
		MANTA_RAY(391, 22), 
		CAVEFISH(15266, 20),
		ROCKTAIL(15272, 23), 
		CHICKEN(2140, 3),
		MEAT(2142, 3), 
		RABBIT(3228, 5),
		ROASTED_RABBIT(7223, 7), 
		ROASTED_BIRD_MEAT(9980, 6), 
		CRAB_MEAT(7521, 10), 
		ROASTED_BEAST_MEAT(9988, 8), 
		CHOMPY(2878, 10), 
		JUBBLY(7568, 15), 
		OOMMILE(2343, 14), 
		REDBERRY_FULL_PIE(2325, 5, 2333),
		REDBERRY_HALF_PIE(2333, 5, 2313), 
		MEAT_FULL_PIE(2327, 6, 2331),
		MEAT_HALF_PIE(2331, 6, 2313), 
		APPLE_FULL_PIE(2323, 7, 2335),
		APPLE_HALF_PIE(2335, 7, 2313),
		GARDEN_FULL_PIE(7178, 6, 7180),
		GARDEN_HALF_PIE(7180, 6, 2313), 
		FISH_FULL_PIE(7188, 6, 7190), 
		FISH_HALF_PIE(7188, 6, 2313),
		ADMIRAL_FULL_PIE(7198, 8, 7200),
		ADMIRAL_HALF_PIE(7200, 8, 2313),
		WILD_FULL_PIE(7208, 110, 7210),
		WILD_HALF_PIE(7210, 110, 2313),
		SUMMER_FULL_PIE(7218, 11, 7220),
		SUMMER_HALF_PIE(7220, 11, 2313),
		STEW(2003, 11, 1923),
		SPICY_STEW(7513, 11, 1923),
		CURRY(2011, 19, 1923),
		PLAIN_FULL_PIZZA(2289, 7, 2291),
		PLAIN_HALF_PIZZA(2291, 7),
		MEAT_FULL_PIZZA(2293, 8, 2295),
		MEAT_HALF_PIZZA(2295, 8),
		ANCHOVIE_FULL_PIZZA(2297, 9, 2299),
		ANCHOVIE_HALF_PIE(2299, 9),
		PINEAPPLE_FULL_PIZZA(2301, 11, 2303),
		PINEAPPLE_HALF_PIE(2303, 11),
		SPICY_SAUCE(7072, 2, 1923),
		CHILI_CON_CARNE(7062, 14, 1923),
		SCRAMBLES_EGGS(7078, 5, 1923),
		EGGS_AND_TOMATO(7064, 8, 1923),
		FRIED_ONIONS(7084, 9, 1923),
		MUSHROOM_AND_ONIONS(7066, 11, 1923),
		FRIED_MUSHROOMS(7082, 5, 1923),
		TUNA_AND_CORN(7068, 13, 1923),
		BAKED_POTATO(6701, 4),
		POTATO_WITH_BUTTER(6703, 14),
		CHILI_POTATO(7054, 14),
		POTATO_WITH_CHEESE(6705, 16),
		EGG_POTATO(7056, 16),
		MUSHROOMS_AND_ONION_POTATO(7058, 20),
		TUNA_POTATO(7060, 24),
		TOAD_CRUNCHIES(2217, 8),
		SPICY_CRUNCHIES(2213, 7),
		WORM_CRUNCHIES(2205, 8),
		CHOCOCHIP_CRUNCHIES(9544, 7),
		FRUIT_BATTA(2277, 11),
		TOAD_BATTA(2255, 11),
		WORM_BATTA(2253, 11),
		VEGETABLE_BATTA(2281, 11),
		CHEESE_AND_TOMATO_BATTA(9535, 11),
		WORM_HOLE(2191, 12),
		VEG_BALL(2195, 12),
		PRE_MADE_VEG_BALL(2235, 12),
		TANGLED_TOAD_LEGS(2187, 15),
		CHOCOLATE_BOMB(2185, 15),
		CAKE(1891, 4, 1893),
		TWO_THIRD_CAKE(1893, 4, 1896),
		SLICE_OF_CAKE(1896, 4),
		CHOCOLATE_CAKE(1897, 4, 1899),
		TWO_THIRDS_CHOCOLATE_CAKE(1899, 4, 1901),
		CHOCOLATE_SLICE(1901, 4),
		FISH_CAKE(7530, 11),
		BREAD(2309, 5),
		CABBAGE(1965, 1),
		ONION(1957, 1),
		EVIL_TURNIP(12134, 1),
		POT_OF_CREAM(2130, 1),
		CHEESE_WHEEL(18789, 2),
		THIN_SNAIL_MEAT(3369, 5 + Misc.random(2)),
		LEAN_SNAIL_MEAT(3371, 8),
		FAT_SNAIL_MEAT(3373, 8 + Misc.random(2));
	
		private int foodId;
		private int eatenFoodId;
		private int healAmount;
		
		private Food(int foodId, int healAmount, int eatenFoodId) {
			this.foodId = foodId;
			this.eatenFoodId = eatenFoodId;
			this.healAmount = healAmount;
		}
		
		private Food(int foodId, int healAmount) {
			this(foodId, healAmount, -1);
		}
		
		public int getFoodId() {
			return foodId;
		}
		
		public int getEatenFoodId() {
			return eatenFoodId;
		}
		
		public int getHealAmount() {
			return healAmount;
		}
		
		public void eat(Player player, int slot) {
			Item item = player.getInventory().get(slot);
			String def = item.getDefinition().getName();
			Food food = getFood(item.getId());
			
			if (player.getFoodDelay() > System.currentTimeMillis())
	            return;
			
			player.getActionSender().sendMessage("You eat the " + def.toLowerCase() + ".");
			player.addFoodDelay(1800);
			player.animate(829);
			player.getInventory().getContainer()
			.set(slot, (food.getEatenFoodId()) == -1 ? null : new Item(food.getEatenFoodId(), 1));
			player.getInventory().refresh();
			
			int hitpoints = player.getSkills().getLevel(3);
			player.heal(food.getHealAmount());
			
			if (player.getSkills().getLevel(3) > hitpoints)
				player.getActionSender().sendMessage("It heals some health.");
			
			FoodEffects.applyFoodEffect(player, food);
			
		}
	}
}
-----------------------------------------------------------------------------------------------------------------------------

In Player.java, add this:

Code:
public void addFoodDelay(long time) {
		foodDelay = time + System.currentTimeMillis();
	}

	public long getFoodDelay() {
		return foodDelay;
	}
If not already added with my other snippets, add this with the other variables at top:

Code:
private transient long foodDelay;
------------------------------------------------------------------------------------------------------------------------------------

In ItemPacketHandler.java, find

Code:
private void itemSelect(final Player player, final Packet packet) {
and under
Code:
if (interfaceId == 149) {
add

Code:
for(Food food : Food.values()) {
				if(food != null && id == food.getFoodId())
					food.eat(player, slot);
			}
and import this

Code:
import com.rs2hd.content.Foods.Food;
--------------------------------------------------------------------------------------------------

If you haven't added it from my Potion drinking snippet, create a class named Effects in com.rs2hd.content and paste this:

Code:
package com.rs2hd.content;

import com.rs2hd.GameEngine;
import com.rs2hd.content.Foods.Food;
import com.rs2hd.content.PotionDrinking.Potions;
import com.rs2hd.model.Player;
import com.rs2hd.model.Skills;

public class Effects {

	
/**
 * Class to handle the effects of potions/food when a player drinks/eats it.
 * @[Only registered and activated users can see links. ]or Guillaume (Hash - RuneLocus ; ByteValue - Rune-Server)
 *
 */
	/* Use only if the boost is added to the current level */
	private static boolean differentBoost;

	/**
	 * Gets the player's level after adding the boost to the real level or current level.
	 * @return currentLevel + boost
	 * else
	 * @return realLevel + boost
	 */
	 public static int getCurrentLevel(int realLevel, int currentLevel, double boost) {
		if (differentBoost)
			return (int) (currentLevel + boost);
		else
			return (int) (realLevel + boost);
	}
	
	/**
	 * Applies a boost to more than 1 skill
	 * 
	 */
	public static void getCurrentLevels(Player player, int[] skills, int realLevel, int currentLevel, double boost) {
		for (int i = 0; i < skills.length; i++)
			player.getSkills().set(skills[i], (int) (realLevel + boost));
	}
	
	static class PotionEffects {
		/**
		 * Applies effects to the player's skills after drinking the potion.
		 * 
		 */
		public static void applyPotionEffects(Player player, Potions potion) {
			int skill = 0;
			int currentLevel = player.getSkills().getLevel(skill);
			int realLevel = player.getSkills().getLevelForXp(skill);
			double boost = 0;
			double normalBoost = 3.0 + (realLevel * 0.10);
			double superBoost = 5.0 + (realLevel * 0.15);
			double extremeBoost = 5.0 + (realLevel * 0.22);
			
			switch(potion.getPotionId()) {
				
			/************************************
			 *          COMBAT POTIONS          *
			 ************************************/
			
				case 125: // Attack potions
				case 123:
				case 121:
				case 2428:
					skill = Skills.ATTACK;
					boost = normalBoost;
					GameEngine.poison.startPoison(player, 6);
					player.getSkills().drain(Skills.PRAYER, 50);
				break;
				
				case 145: // Super attack potions
				case 147:
				case 149:
				case 2436:
					skill = Skills.ATTACK;
					boost = superBoost;
				break;
				
				case 15308: // Extreme attack potions
				case 15309:
				case 15310:
				case 15311:
					skill = Skills.ATTACK;
					boost = extremeBoost;
				break;
			
				case 113: // Strength potions
				case 115:
				case 117:
				case 119:
					skill = Skills.STRENGTH;
					boost = normalBoost;		
				break;
				
				case 157: // Super strength potions
				case 159:
				case 161:
				case 2440:
					skill = Skills.STRENGTH;
					boost = superBoost;
				break;
					
				case 15312: // Extreme strength potions
				case 15313:
				case 15314:
				case 15315:
					skill = Skills.STRENGTH;
					boost = extremeBoost;
				break;
				
				case 133: // Defence potions
				case 135:
				case 137:
				case 2432:
					skill = Skills.DEFENCE;
					boost = normalBoost;		
				break;
				
				case 163: // Super defence potions
				case 165:
				case 167:
				case 2442:
					skill = Skills.DEFENCE;
					boost = superBoost;
				break;
				
				case 15316: // Extreme defence potions
				case 15317:
				case 15318:
				case 15319:
					skill = Skills.DEFENCE;
					boost = extremeBoost;
				break;
				
				case 9739: // Combat potions
				case 9741:
				case 9743:
				case 9745:
					boost = normalBoost;
					getCurrentLevels(player, new int[] {0, 2}, realLevel, currentLevel, boost);
				break;
				
				case 139: // Prayer potions
				case 141:
				case 143:
				case 2434:
					skill = Skills.PRAYER;
					differentBoost = true;
					boost = 7.0 + (0.25 * realLevel);
					if (currentLevel + boost > realLevel)
						boost = 0;
				break;
				
				case 175: case 177:
				case 179: case 2446:
					GameEngine.poison.curePoison(player);
					if (player.getPoisonImmunity() < System.currentTimeMillis())
						player.getActionSender().sendMessage("You are now immune to poison.");
					player.addImmunityToPoison(0x15f90);
				break;
				
				case 181: case 183:
				case 185: case 2448:
					GameEngine.poison.curePoison(player);
					if (player.getPoisonImmunity() < System.currentTimeMillis())
						player.getActionSender().sendMessage("You are now immune to poison.");
					player.addImmunityToPoison(0x57e40);
					break;
				
				
				/************************************
				 *          SKILLS POTIONS          *
				 ************************************/
				
				case 3032: // Agility potions
				case 3034:
				case 3036:
				case 3038:
					differentBoost = true;
					skill = Skills.AGILITY;
					boost = 2 + (Math.random() * ((3 - 2) + 1));
				break;
			}
				player.getSkills().set(skill, getCurrentLevel(realLevel, currentLevel, boost));
		}
	}
	
	/**
	 * Handles the effects of the food when a player eats it.
	 * @[Only registered and activated users can see links. ]or Guillaume
	 *
	 */
	static class FoodEffects {
		public static void applyFoodEffect(Player player, Food food) {
			
			 int skill = 0;
			 int currentLevel = player.getSkills().getLevel(skill);
			 int realLevel = player.getSkills().getLevelForXp(skill);
			 double boost = 0;
			
			 switch (food.getFoodId()) {
			
			case 7218:
			case 7220:
				skill = Skills.AGILITY;
				player.setRunEnergy((int)(player.getRunEnergy() 
						+ (double) player.getRunEnergy() * (20 / 100)));
				boost = 5;
			break;
				
			case 7178:
			case 7180:
				skill = Skills.FARMING;
				boost = 3;
			}
			
			player.getSkills().set(skill, getCurrentLevel(realLevel, currentLevel, boost));
		}
	}
}
If you have any questions, feel free to ask!