mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Added toxicity indicators to more food items
This commit is contained in:
parent
3129084f71
commit
ad327c6831
3 changed files with 32 additions and 4 deletions
|
@ -1,8 +1,12 @@
|
|||
package com.minelittlepony.unicopia.edibles;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
|
@ -27,6 +31,11 @@ public class UItemFoodDelegate extends ItemMultiTexture implements IEdible {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
foodItem.addInformation(stack, worldIn, tooltip, flagIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) {
|
||||
return foodItem.onItemUseFinish(stack, worldIn, entityLiving);
|
||||
|
|
|
@ -1,17 +1,24 @@
|
|||
package com.minelittlepony.unicopia.item;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.UItems;
|
||||
import com.minelittlepony.unicopia.edibles.IEdible;
|
||||
import com.minelittlepony.unicopia.edibles.Toxicity;
|
||||
import com.minelittlepony.unicopia.forgebullshit.IMultiItem;
|
||||
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemApple extends ItemFood implements IMultiItem {
|
||||
public class ItemApple extends ItemFood implements IMultiItem, IEdible {
|
||||
|
||||
private int[] typeRarities = new int[0];
|
||||
|
||||
|
@ -116,8 +123,8 @@ public class ItemApple extends ItemFood implements IMultiItem {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getDamage(ItemStack stack) {
|
||||
return super.getDamage(stack);// % subTypes.length;
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
tooltip.add(getToxicityLevel(stack).getTooltip());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -141,4 +148,9 @@ public class ItemApple extends ItemFood implements IMultiItem {
|
|||
|
||||
return super.getTranslationKey(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Toxicity getToxicityLevel(ItemStack stack) {
|
||||
return Toxicity.SAFE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.unicopia.item;
|
||||
|
||||
|
||||
import com.minelittlepony.unicopia.edibles.Toxicity;
|
||||
import com.minelittlepony.util.MagicalDamageSource;
|
||||
import com.minelittlepony.util.vector.VecHelper;
|
||||
|
||||
|
@ -73,6 +75,11 @@ public class ItemZapApple extends ItemApple {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Toxicity getToxicityLevel(ItemStack stack) {
|
||||
return stack.getMetadata() == 0 ? Toxicity.SEVERE : Toxicity.SAFE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
int meta = stack.getMetadata();
|
||||
|
|
Loading…
Reference in a new issue