2018-10-15 18:36:46 +02:00
|
|
|
package de.ellpeck.naturesaura.items;
|
|
|
|
|
|
|
|
import de.ellpeck.naturesaura.blocks.BlockGoldenLeaves;
|
|
|
|
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
|
2021-12-15 16:24:53 +01:00
|
|
|
import net.minecraft.client.color.item.ItemColor;
|
|
|
|
import net.minecraft.world.InteractionResult;
|
|
|
|
import net.minecraft.world.item.ItemStack;
|
|
|
|
import net.minecraft.world.item.context.UseOnContext;
|
2018-10-15 18:36:46 +02:00
|
|
|
|
2020-01-26 01:41:49 +01:00
|
|
|
public class ItemGoldFiber extends ItemImpl implements IColorProvidingItem {
|
2018-10-15 18:36:46 +02:00
|
|
|
|
2020-01-26 01:41:49 +01:00
|
|
|
public ItemGoldFiber() {
|
2020-02-07 23:50:16 +01:00
|
|
|
super("gold_fiber");
|
2018-10-15 18:36:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-15 16:24:53 +01:00
|
|
|
public ItemColor getItemColor() {
|
2018-10-15 18:36:46 +02:00
|
|
|
return (stack, tintIndex) -> 0xF2FF00;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-15 16:24:53 +01:00
|
|
|
public InteractionResult useOn(UseOnContext context) {
|
|
|
|
ItemStack stack = context.getPlayer().getItemInHand(context.getHand());
|
|
|
|
if (BlockGoldenLeaves.convert(context.getLevel(), context.getClickedPos())) {
|
2021-12-04 15:40:09 +01:00
|
|
|
if (!context.getLevel().isClientSide) {
|
2018-10-15 18:36:46 +02:00
|
|
|
stack.shrink(1);
|
|
|
|
}
|
2021-12-04 15:40:09 +01:00
|
|
|
return InteractionResult.SUCCESS;
|
2018-10-15 18:36:46 +02:00
|
|
|
}
|
2021-12-04 15:40:09 +01:00
|
|
|
return InteractionResult.PASS;
|
2018-10-15 18:36:46 +02:00
|
|
|
}
|
|
|
|
}
|