[SPIGOT-7853] AnvilInventory#getRepairCost() always returns 0 in 1.21 but works fine in 1.20.6 Created: 29/Jul/24  Updated: 25/Dec/24  Resolved: 29/Jul/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Explosivemines Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: anvil, inventory

Attachments: File 2024-07-29 08-33-46.mp4     File TestPlugin-1.0-SNAPSHOT.jar     PNG File image-2024-07-29-09-50-14-555.png     PNG File image-2024-07-29-09-50-22-429.png     PNG File image-2024-07-29-09-50-33-781.png    
Version: CraftBukkit version 4283-Spigot-fb8fb72-8c51673 (MC: 1.21) (Implementing API version 1.21-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   
  • Open an anvil
  • Trigger a PrepareAnvilEvent by renaming an item
  • Take a look at the output of AnvilInventory#getRepairCost() 
  • The correct output is provided by AnvilView#getRepairCost()

Outcome - shown in the attached video:

AnvilInventory#getRepairCost() is always 0.

AnvilView#getRepairCost() is not always 0.

 

Yes, AnvilInventory#getRepairCost() is deprecated since 1.21 and marked for removal in the future. However the replacement method in AnvilView is still marked as experimental. In any case, it can't be deprecated and made unusable in the same version



code in TestPlugin



 Comments   
Comment by Explosivemines [ 29/Jul/24 ]

thanks <3

Comment by Y2K_ [ 29/Jul/24 ]

Opened a Pull Request, seems like the was a sync was mismatched for that method. The old method names still confuses me, but this PR fixes it.

Comment by md_5 [ 29/Jul/24 ]

Y2K_

Generated at Fri Mar 14 09:35:30 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.