Unicopia/src/main/java/com/minelittlepony/unicopia/item/TomatoItem.java

31 lines
922 B
Java
Raw Normal View History

2020-01-17 14:27:26 +01:00
package com.minelittlepony.unicopia.item;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;
2020-01-27 11:05:22 +01:00
import net.minecraft.item.ItemGroup;
2020-01-17 14:27:26 +01:00
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class TomatoItem extends Item {
2020-01-27 11:05:22 +01:00
public TomatoItem(int hunger, float saturation) {
super(new Settings()
.group(ItemGroup.FOOD)
.food(new FoodComponent.Builder()
.hunger(hunger)
.saturationModifier(saturation)
.build())
);
2020-01-17 14:27:26 +01:00
}
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity entity) {
stack = super.finishUsing(stack, world, entity);
entity.removePotionEffect(StatusEffects.NAUSEA);
return stack;
}
}