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;
|
|
|
|
import net.minecraft.client.renderer.color.IItemColor;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraft.item.ItemUseContext;
|
2019-10-20 22:30:49 +02:00
|
|
|
import net.minecraft.util.ActionResultType;
|
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
|
|
|
|
public IItemColor getItemColor() {
|
|
|
|
return (stack, tintIndex) -> 0xF2FF00;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
public ActionResultType onItemUse(ItemUseContext context) {
|
|
|
|
ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
|
|
|
|
if (BlockGoldenLeaves.convert(context.getWorld(), context.getPos())) {
|
|
|
|
if (!context.getWorld().isRemote) {
|
2018-10-15 18:36:46 +02:00
|
|
|
stack.shrink(1);
|
|
|
|
}
|
2019-10-20 22:30:49 +02:00
|
|
|
return ActionResultType.SUCCESS;
|
2018-10-15 18:36:46 +02:00
|
|
|
}
|
2019-10-20 22:30:49 +02:00
|
|
|
return ActionResultType.PASS;
|
2018-10-15 18:36:46 +02:00
|
|
|
}
|
|
|
|
}
|