Unicopia/src/main/java/com/minelittlepony/unicopia/item/TomatoItem.java
2020-01-27 12:05:22 +02:00

30 lines
922 B
Java

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;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class TomatoItem extends Item {
public TomatoItem(int hunger, float saturation) {
super(new Settings()
.group(ItemGroup.FOOD)
.food(new FoodComponent.Builder()
.hunger(hunger)
.saturationModifier(saturation)
.build())
);
}
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity entity) {
stack = super.finishUsing(stack, world, entity);
entity.removePotionEffect(StatusEffects.NAUSEA);
return stack;
}
}