NaturesAura/src/main/java/de/ellpeck/naturesaura/items/ItemGoldFiber.java

37 lines
1.2 KiB
Java
Raw Normal View History

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;
2019-10-20 22:30:49 +02:00
import net.minecraft.entity.player.PlayerEntity;
2018-10-15 18:36:46 +02:00
import net.minecraft.item.ItemStack;
2019-10-20 22:30:49 +02:00
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
2018-10-15 18:36:46 +02:00
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
2019-10-20 22:30:49 +02:00
public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
2018-10-15 18:36:46 +02:00
ItemStack stack = player.getHeldItem(hand);
if (BlockGoldenLeaves.convert(worldIn, pos)) {
if (!worldIn.isRemote) {
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
}
}