net.minecraft.util.FoodStats Java Examples
The following examples show how to use
net.minecraft.util.FoodStats.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Food.java From TFC2 with GNU General Public License v3.0 | 6 votes |
public static void addNutrition(FoodStats fs, ItemStack is) { IFoodStatsTFC stats = (IFoodStatsTFC)fs; TFCFood food = FoodRegistry.getInstance().getFood(is.getItem(), is.getItemDamage()); if(food != null && is.getItem() instanceof ItemFood) { ItemFood item = (ItemFood)is.getItem(); Iterator iter = food.foodGroup.iterator(); while(iter.hasNext()) { FoodGroupPair pair = (FoodGroupPair) iter.next(); float amount = pair.amount; if(pair.foodGroup != EnumFoodGroup.None) { amount = Math.min(stats.getNutritionMap().get(pair.foodGroup) + (item.getHealAmount(is) * (pair.amount / 100f)*0.25f), 20); stats.getNutritionMap().put(pair.foodGroup, amount); } } } }
Example #2
Source File: TraitAbsorption.java From TofuCraftReload with MIT License | 5 votes |
@Override public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean isCritical) { super.onHit(tool, player, target, damage, isCritical); if (player instanceof EntityPlayer && player.world.rand.nextFloat() < 0.4F) { FoodStats foodStats = ((EntityPlayer) player).getFoodStats(); foodStats.addStats(1, damage * 0.3F); } }
Example #3
Source File: MixinEntityPlayer.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
@Shadow public abstract FoodStats getFoodStats();
Example #4
Source File: MixinEntityPlayer.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
@Shadow public abstract FoodStats getFoodStats();