Jump to content

ilyass555

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by ilyass555

  1. ohh yeah figured it out


        @Override
        public ActionResultType onItemUse(ItemUseContext context) {
        
            
            World world = context.getWorld();
            BlockPos pos = context.getPos();
            PlayerEntity playerIn = context.getPlayer();
            ItemStack item = context.getItem();
            Hand handIn = context.getHand();

            if (!world.isRemote && world.getBlockState(pos).getBlock() == Blocks.MOSSY_COBBLESTONE)
            {
            (( ServerWorld)world).setBlockState(pos, Blocks.COBBLESTONE.getDefaultState());
            item.damageItem(1, playerIn, (entity) -> {entity.sendBreakAnimation(handIn);;});
            playerIn.inventory.addItemStackToInventory(new ItemStack(ItemInit.moss));
            }
            
            return super.onItemUse(context);
        }

     

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.