PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.73k stars 2.27k forks source link

Crafting Recipes don't work with custom Items #10971

Closed Pitrex111 closed 2 months ago

Pitrex111 commented 3 months ago

Expected behavior

Crafting recipes work as they did before with custom items (custom name, custom persistent data, custom model etc.)

Observed/Actual behavior

Recipes are somewhat broken and are not recognized inside crafting grid or even don't show properly in recipe book.

Steps/models to reproduce

Create custom ItemStack (with special name, custom model data, some persistent tags etc.) and add it as exact ingriedient into some new recipe (ShjapelessRecipe in my case)

Plugin and Datapack List

[09:38:04 INFO]: Server Plugins (14): [09:38:04 INFO]: Bukkit Plugins: [09:38:04 INFO]: - ICraft2.0-Special, JoinFullServer, Multiverse-Core, Multiverse-Inventories, Multiverse-Portals, NoChatReports, PermissionsEx, PexTabCompleter, ProtocolLib, SimplePrefix-Reloaded [09:38:04 INFO]: TreasureChestX, VoidWorld, WorldEdit, WorldGuard

[09:38:21 INFO]: There are 3 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)] [09:38:21 INFO]: There are no more data packs available

Paper version

[09:41:18 INFO]: Checking version, please wait... [09:41:18 INFO]: This server is running Paper version 1.21-37-master@dd49fba (2024-06-24T02:08:49Z) (Implementing API version 1.21-R0.1-SNAPSHOT) You are running the latest version Previous version: 1.21-28-812701d (MC: 1.21)

Other

In my plugin I found it on those 2 recipes ` ShapelessRecipe recipe2 = new ShapelessRecipe(new NamespacedKey(root, "teleportTablet"), item.clone()); // item is special custom item I'm creating in diffrent place of my class recipe2.addIngredient(ItemLibrary.getInstance().getItem(ItemList.ALCHEMICAL_POWDER)[0]); // This extract another custom item to add it as ingriedient recipe2.addIngredient(Material.BRICK); root.getServer().addRecipe(recipe2);

        ShapelessRecipe recipe3 = new ShapelessRecipe(new NamespacedKey(root, "calibrateTablet"), item.clone()); //second recipe, I recognize it inside listener later and change persistent tags to encode location
        recipe3.addIngredient(Material.COMPASS);
        recipe3.addIngredient(item.clone());
        root.getServer().addRecipe(recipe3);`

In game in crafting inventory it looks like that: image image And this is how it work on my older version: image image

Machine-Maker commented 3 months ago

Yeah, I can replicate this. To reproduce it, you have to have >=2 ingredients as the shortcut if there's only a single ingredient bypasses this issue. The stacked contents system for exact choice ingredients needs to be slightly reworked.

Machine-Maker commented 3 months ago

In a few minutes, a server jar will be linked at the top of this PR, I'd appreciate if you could download it and try it out with your plugin to see if your crafting issues here are fixed.

Pitrex111 commented 3 months ago

@Machine-Maker I can confirm the crafting works as it did on PR linked build

SlicedWatermelon commented 2 months ago

Same problem here, following.