Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the effects on food to be Blue for good, and Red for …
…bad. (#276)
- Loading branch information
alexbegt
committed
Sep 27, 2016
1 parent
c81479d
commit 7f515d4
Showing
3 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/com/progwml6/natura/shared/item/ItemNaturaEdible.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.progwml6.natura.shared.item; | ||
|
||
import java.util.List; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.potion.PotionEffect; | ||
import net.minecraft.util.text.translation.I18n; | ||
import slimeknights.mantle.item.ItemEdible; | ||
|
||
public class ItemNaturaEdible extends ItemEdible | ||
{ | ||
public boolean displayCustomEffectsTooltip; // set to false to not display effects of food in tooltip | ||
|
||
public ItemNaturaEdible() | ||
{ | ||
super(); | ||
this.displayEffectsTooltip = false; | ||
this.displayCustomEffectsTooltip = true; | ||
} | ||
|
||
@SuppressWarnings("deprecation") | ||
@Override | ||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) | ||
{ | ||
super.addInformation(stack, playerIn, tooltip, advanced); | ||
|
||
// effect info | ||
if (displayCustomEffectsTooltip) | ||
{ | ||
for (PotionEffect potionEffect : potionEffects.get(stack.getMetadata())) | ||
{ | ||
if (potionEffect.getPotion().isBadEffect()) | ||
{ | ||
tooltip.add("§4" + I18n.translateToLocal(potionEffect.getEffectName()).trim()); | ||
} | ||
else | ||
{ | ||
tooltip.add("§9" + I18n.translateToLocal(potionEffect.getEffectName()).trim()); | ||
} | ||
} | ||
} | ||
} | ||
} |