mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-02 03:46:43 +01:00
28 lines
792 B
Java
28 lines
792 B
Java
package com.minelittlepony.unicopia.item;
|
|
|
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
|
|
|
import net.minecraft.entity.LivingEntity;
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.world.World;
|
|
|
|
public class SugaryItem extends Item {
|
|
|
|
private final int sugarAmount;
|
|
|
|
public SugaryItem(Settings settings, int sugar) {
|
|
super(settings);
|
|
sugarAmount = sugar;
|
|
}
|
|
|
|
@Override
|
|
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity entity) {
|
|
if (sugarAmount != 0 && entity instanceof PlayerEntity) {
|
|
Pony.of((PlayerEntity)entity).addEnergy(sugarAmount);
|
|
}
|
|
|
|
return super.finishUsing(stack, world, entity);
|
|
}
|
|
}
|