Posted September 20, 20214 yr I'm trying to detect a right click on a sword. Did ActionResult change to InteractionResult from 1.16 to 1.17? I wrote below, but I get an error with hand in getHandSlot (hand) public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { attacker.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 1, 6)); target.setDeltaMovement(target.getDeltaMovement().add(0.0D, (double)0.2F, 1.0D)); stack.hurtAndBreak(1, attacker, (entity) -> { entity.broadcastBreakEvent(EquipmentSlot.MAINHAND); }); return true; } public InteractionResult use (BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { ItemStack itemStack = player.getHandSlots(hand); ←this return InteractionResult.CONSUME; } I'm struggling to figure out how to solve this problem. Knowledgeable people, please. Edited September 20, 20214 yr by ocome
September 20, 20214 yr forge now use mojang class names, that's why it's called now InteractionResult please post the debug log
September 21, 20214 yr Author My apologies. As it turns out, I've solved the problem by making player.getHandSlots(hand); to player.getItemInHand(hand)
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.