mojira.dev
MC-160901

Using an item while looking at an entity is no longer possible

The bug

It is no longer possible use items while looking at an entity.

This is caused by MC-127094 being fixed.

To reproduce

  1. Look at an entity

  2. Get some food

  3. Make sure you're hungry

  4. Try to eat
    → ❌ That doesn't work

Affected Items

(List may be incomplete)

  • Shields

  • Splash potions

  • Milk buckets

  • Honey bottles

  • Buckets (In Creative; milking cows/mooshrooms)

  • Bowls (In Creative; milking red/brown mooshrooms)

  • Bows

  • Crossbows (Loaded/Unloaded)

  • Tridents

  • Empty maps

  • Snowballs

  • Eggs

  • Food

  • Potions

  • Lingering potions (Same as splash potions)

  • Bottle o' Enchanting

  • Armor (Prevents players from equipping)

  • Fishing rods

Linked issues

MC-161025 Some items will not work when trying to right-clicking infront of an entity MC-161045 Click mobs don't use fishing rod and trident MC-161105 Shields not blocking while aiming at mobs MC-161155 Bow does not load when shooting zombies next to player MC-161397 Can't cast fishing rod when looking at a mob MC-161494 Won't hold shield while being attacked by mobs MC-162077 Shields can not be activated while looking at any mob MC-162189 Throw splash potions MC-162306 Cannot draw back bow or trident when looking at a mob MC-162436 Items with right-click actions do not function when aiming at an entity MC-162558 Shooting or raising a shield not working, when looking at mobs from close range MC-162631 Can't block MC-162650 You can't use item's right-click while looking to an entity MC-162874 Shield won't ''deploy'' while looking at a mob MC-163014 Can't use a splash potion while looking at a near iron golem MC-163175 A item with a 'use' ability wont activate on a non-intractable entity. MC-163512 Bow cannot be drawn if aiming at any mob within 4 blocks from player MC-163605 Shield not working properly MC-163679 Using item looking at mob

Comments

DrownedZombie

Please add some of these to the Affected Items:

  • Potions

  • Lingering potions (Same as splash potions)

  • Bottle o' Enchanting

  • Armor (Prevents players from equipping)

This issue may have "temporarily fixed" the issue MC-141494 as the items are no longer used. Though if this issue is fixed, the issue MC-141494 would return.

TheBoy358

Confirmed in 19w38a and 19w38b.

liach

This issue appears to be from the "startUseItem" (using 19w39a obfuscation map names for research) method in Minecraft class.

Snippet:

switch (this.hitResult.getType()) {
                    case ENTITY: {
                        EntityHitResult entityHitResult_1 = (EntityHitResult)this.hitResult;
                        Entity entity_1 = entityHitResult_1.getEntity();
                        if (this.gameMode.interactAt(this.player, entity_1, entityHitResult_1, interactionHand_1) == InteractionResult.SUCCESS || this.gameMode.interact(this.player, entity_1, interactionHand_1) == InteractionResult.SUCCESS) {
                            this.player.swing(interactionHand_1);
                        }
                        return; // This forces to skip item use logic; compare to block one below
                    }
                    case BLOCK: {
                        BlockHitResult blockHitResult_1 = (BlockHitResult)this.hitResult;
                        int int_1 = itemStack_1.getCount();
                        InteractionResult interactionResult_1 = this.gameMode.useItemOn(this.player, this.level, interactionHand_1, blockHitResult_1);
                        if (interactionResult_1 == InteractionResult.SUCCESS) {
                            this.player.swing(interactionHand_1);
                            if (!itemStack_1.isEmpty() && (itemStack_1.getCount() != int_1 || this.gameMode.hasInfiniteItems())) {
                                this.gameRenderer.itemInHandRenderer.itemUsed(interactionHand_1);
                            }
                            return;
                        }
                        if (interactionResult_1 != InteractionResult.FAIL) break;
                        return;
                    }
                }

As you can see, the entity block forces to skip the logic for item interaction even though two types of entity interactions may request to "PASS" instead of "FAIL".

Suggested:

case ENTITY: {
                        EntityHitResult entityHitResult_1 = (EntityHitResult)this.hitResult;
                        Entity entity_1 = entityHitResult_1.getEntity();
                        InteractionResult result1 = this.gameMode.interactAt(this.player, entity_1, entityHitResult_1, interactionHand_1);
                        InteractionResult result2;
                        if (result1 == InteractionResult.SUCCESS || (result2 = this.gameMode.interact(this.player, entity_1, interactionHand_1)) == InteractionResult.SUCCESS) {
                            this.player.swing(interactionHand_1);
                        }
                        if (result1 == InteractionResult.PASS && result2 == InteractionResult.PASS) {
                            break; // Continue to item use logic
                        }
                        return;
                    }
Alex Gonzalez

This also causes the Zombie Doctor advancement to be impossible

violine1101

That I cannot confirm. You just cannot look directly at the zombie villager while curing it, but you can throw a potion of weakness at it through other means. Feeding it a golden apple works as well.

wan6845

Affects bedrock edition

violine1101

coschevi

Confirmed

Important

Player

mob

19w37a, 19w38b, 19w39a, 19w40a

19w42a

Retrieved