[SPIGOT-6322] Recipe.getResult().getType() yields incorrect material types in certain scenarios. Created: 23/Jan/21  Updated: 27/Jan/21  Resolved: 27/Jan/21

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

Type: Bug Priority: Minor
Reporter: Steven Strickler Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: bug, spigot

Version: 2991-Spigot-018b9a0-f2f3094 (MC 1.16.5)
Guidelines Read: Yes

 Description   

While trying to create a plugin to prevent map duplication, I came across several weird instances of Recipe.getResult().getType() returning material types that do not reflect what the displayed material types in-game are in a crafting table. This affects unique recipes like the crafting recipes for tool repair, map enlargement, and map & book cloning.

Tool repair & cloning recipes output Material.AIR instead of the actual material.

Map enlargement outputs Material.MAP instead of Material.FILLED_MAP, when minecraft:filled_map is the result displayed in-game.

 

Below is the simple debug code I was using for testing:

@EventHandler
public void onCraft(PrepareItemCraftEvent e) {
    if (e.getRecipe() != null) {
        Bukkit.broadcastMessage(e.getRecipe().getResult().getType().toString());
    }
}

 



 Comments   
Comment by md_5 [ 27/Jan/21 ]

The map case is part of the vanilla recipe definition

Comment by md_5 [ 23/Jan/21 ]

Have you checked the docs for https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ComplexRecipe.html

The map case should probably be fixed, but the rest literally can't because the tool repair could have any tool as a result

Generated at Tue Apr 15 09:25:44 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.