NaturesAura/src/main/java/de/ellpeck/naturesaura/items/ItemGoldFiber.java
2018-10-15 18:36:46 +02:00

36 lines
1.2 KiB
Java

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.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ItemGoldFiber extends ItemImpl implements IColorProvidingItem {
public ItemGoldFiber() {
super("gold_fiber");
}
@Override
public IItemColor getItemColor() {
return (stack, tintIndex) -> 0xF2FF00;
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (BlockGoldenLeaves.convert(worldIn, pos)) {
if (!worldIn.isRemote) {
stack.shrink(1);
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
}