net.minecraft.item.ShearsItem Java Examples

The following examples show how to use net.minecraft.item.ShearsItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CavernousVineBlockPoisonous.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public ActionResult onUse(BlockState blockState, World world, BlockPos blockPos, PlayerEntity playerEntity, Hand hand, BlockHitResult blockHitResult) {
    if (playerEntity.getStackInHand(hand).getItem() instanceof ShearsItem) {
        world.setBlockState(blockPos, GalacticraftBlocks.CAVERNOUS_VINE.getDefaultState().with(VINES, blockState.get(VINES)));
        world.playSound(blockPos.getX(), blockPos.getY(), blockPos.getZ(), SoundEvents.BLOCK_GRASS_BREAK, SoundCategory.BLOCKS, 1f, 1f, true);
        return ActionResult.SUCCESS;
    }
    return ActionResult.SUCCESS;
}
 
Example #2
Source File: CavernousVineBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void onBreak(World world, BlockPos blockPos, BlockState blockState, PlayerEntity playerEntity) {
    super.onBreak(world, blockPos, blockState, playerEntity);

    if (playerEntity.getActiveItem().getItem() instanceof ShearsItem) {
        ItemScatterer.spawn(world, blockPos.getX(), blockPos.getY(), blockPos.getZ(), new ItemStack(this.asItem(), 1));
    }
}