Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecipeBook click ignores ExactChoice #11593

Closed
LoneDev6 opened this issue Nov 8, 2024 · 1 comment · Fixed by #11546
Closed

RecipeBook click ignores ExactChoice #11593

LoneDev6 opened this issue Nov 8, 2024 · 1 comment · Fixed by #11546
Labels
type: bug Something doesn't work as it was intended to. version: 1.21.3 Game version 1.21.3

Comments

@LoneDev6
Copy link

LoneDev6 commented Nov 8, 2024

Expected behavior

Custom recipe to be selected correctly.

Observed/Actual behavior

If you click on the recipe button you clearly see vanilla items added instead of the renamed Diamond.
This causes the recipe to not be selected correctly, instead the vanilla overlapping recipe gets used.

This happens both on Spigot (even on pre-1.21.3) and on Paper 1.21.3.
Paper 1.21.1 implemented a fix for that which wasn't introduced in 1.21.3.

I did some tests by logging client packets, using this guide, and seems that 1.21.3 client doesn't send [play:serverbound/minecraft:place_recipe] (ServerboundPlaceRecipePacket) packet at all when clicking again on the recipe. It used to do that on 1.21.1, so this might now be fixable.

Steps/models to reproduce

1.21.1

Minecraft.1.21.1.-.Multiplayer.3rd-party.Server.2024-11-08.11-03-35.2.mp4

1.21.3

Minecraft.1.21.3.-.Multiplayer.3rd-party.Server.2024-11-08.11-03-15.2.1.mp4

Example code to reproduce the issue:

Player player = Bukkit.getPlayer("LoneDev");
org.bukkit.inventory.ShapedRecipe recipe = new org.bukkit.inventory.ShapedRecipe(new NamespacedKey("test", "test_exact_choice"), new org.bukkit.inventory.ItemStack(Material.BARRIER));
recipe.shape( "ccc",  "xix",  "xix");
org.bukkit.inventory.ItemStack exact = new org.bukkit.inventory.ItemStack(Material.DIAMOND);
ItemMeta meta = exact.getItemMeta();
meta.setDisplayName("test item");
exact.setItemMeta(meta);
recipe.setIngredient('c', new RecipeChoice.ExactChoice(exact));
recipe.setIngredient('i', new RecipeChoice.MaterialChoice(Material.STICK));

org.bukkit.inventory.ItemStack aaa = exact.clone();
aaa.setAmount(32);
player.getInventory().addItem(aaa);

if(Bukkit.getRecipe(recipe.getKey()) != null)
    Bukkit.removeRecipe(recipe.getKey());
Bukkit.addRecipe(recipe); 

Plugin and Datapack List

None

Paper version

This server is running Paper version 1.21.3-14-master@fcb6c72 (2024-11-06T10:06:32Z) (Implementing API version 1.21.3-R0.1-SNAPSHOT)
You are running the latest version

Other

Opened an issue on Spigot jira too as this bug is reproducible also on Spigot.
https://hub.spigotmc.org/jira/browse/SPIGOT-7950

@Machine-Maker
Copy link
Member

Was already gonna be fixed by #11546 so it’s a known issue. I’ll still leave this open tho until that’s merged.

@Machine-Maker Machine-Maker linked a pull request Nov 8, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from 🕑 Needs Triage to Done in Issues: Bugs Nov 9, 2024
@papermc-projects papermc-projects bot moved this from Done to Invalid in Issues: Bugs Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something doesn't work as it was intended to. version: 1.21.3 Game version 1.21.3
Projects
Status: Invalid
Development

Successfully merging a pull request may close this issue.

3 participants