mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-16 17:33:12 +01:00
36 lines
1.2 KiB
Java
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;
|
|
}
|
|
}
|