mojira.dev
MC-36937

Unavailable enchants are not greyed out when enchanting fishing rods, cost XP & Lapis when used

This report only describes that an enchantment is shown which is not available. See MC-30730, which describes the general behavior that an enchantment table may provide less than three enchantments.


The bug

When enchanting fishing rods, you are not able to apply low level enchants; the bug here is that these enchants still appear as if they could be selected. They should be greyed out.

See attached

[media]

: The first slot, which the mouse is hovering over, does not display any promised enchant in the tooltip and clicking it does nothing, yet it's not greyed out like the middle slot.

Example

Here is an example in video:

[media]

Bug analysis

@unknown has done a detailed analysis of when the bug occurs and possible solutions in this comment.

Code analysis

The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

The reason why this happens is because the enchantment level returned by the method net.minecraft.enchantment.EnchantmentHelper.calcItemStackEnchantability(Random, int, int, ItemStack) is used. This method always returns at least 1 for the first enchantment (0 meaning no enchantment available). I am not sure if this can be fixed in this method, however what can be done is having the method net.minecraft.inventory.ContainerEnchantment.onCraftMatrixChanged(IInventory) set 0 as enchantment level if no enchantments are available.
This might not be the best solution and is only a suggestion.

Linked issues

Attachments

Comments 39

Tokes

Confirmed for 14w11b. First I've heard of it but it was so quick to playtest I thought "why not check".

Deleted account

Is this still a concern in the current Minecraft version 14w20b / Launcher version 1.3.11 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

branza

Confirmed for 14w27b.

Jared VDB

Still happening in 1.9.2 please fix it Thanks 🙂

marcono1234

Please link to this comment in the description

The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

The reason why this happens is because the enchantment level returned by the method net.minecraft.enchantment.EnchantmentHelper.calcItemStackEnchantability(Random, int, int, ItemStack) is used. This method always returns at least 1 for the first enchantment (0 meaning no enchantment available). I am not sure if this can be fixed in this method, however what can be done is having the method net.minecraft.inventory.ContainerEnchantment.onCraftMatrixChanged(IInventory) set 0 as enchantment level if no enchantments are available.
This might not be the best solution and is only a suggestion.

29 more comments
MacchuPicchu

Present in 1.19.4.

Seacraft Gaming

Also present in 1.21-rc1 and affects the mace

Jarl-Penguin

Please create a separate ticket regarding maces.
Edit: MC-273234

Dawoox

Present in the 1.21 release

BlackedIRL

Present in 1.21.4

[Mod] redstonehelper

(Unassigned)

Confirmed

Platform

Normal

Items, UI

enchanting, fishing_rod

Minecraft 1.7.1, Minecraft 1.7.2, Minecraft 13w47e, Minecraft 13w48a, Minecraft 13w48b, ..., 24w18a, 1.21, 1.21 Release Candidate 1, 1.21.4, 25w04a

Retrieved