mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-02 03:46:43 +01:00
44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
package com.minelittlepony.unicopia.item;
|
|
|
|
import com.minelittlepony.unicopia.UItems;
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
import net.minecraft.init.MobEffects;
|
|
import net.minecraft.item.ItemFood;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.potion.PotionEffect;
|
|
import net.minecraft.util.NonNullList;
|
|
import net.minecraft.world.World;
|
|
|
|
public class ItemTomato extends ItemFood {
|
|
|
|
public ItemTomato(String domain, String name, int heal, int sat) {
|
|
super(heal, sat, false);
|
|
|
|
setTranslationKey(name);
|
|
setRegistryName(domain, name);
|
|
}
|
|
|
|
|
|
@Override
|
|
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
|
|
if (this == UItems.tomato && isInCreativeTab(tab)) {
|
|
items.add(new ItemStack(this));
|
|
items.add(new ItemStack(UItems.rotten_tomato));
|
|
items.add(new ItemStack(UItems.cloudsdale_tomato));
|
|
items.add(new ItemStack(UItems.rotten_cloudsdale_tomato));
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected void onFoodEaten(ItemStack stack, World worldIn, PlayerEntity player) {
|
|
|
|
PotionEffect effect = player.getActivePotionEffect(MobEffects.NAUSEA);
|
|
|
|
if (effect != null) {
|
|
player.removePotionEffect(MobEffects.NAUSEA);
|
|
}
|
|
}
|
|
|
|
}
|