[SPIGOT-294] Durability of some recipe items messed up Created: 27/Dec/14  Updated: 04/Jan/15  Resolved: 04/Jan/15

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

Type: Bug Priority: Major
Reporter: David McCauley Assignee: Thinkofname
Resolution: Won't Fix Votes: 0
Labels: 1.8, bug, spigot
Environment:

Windows 7 and Linux (version unknown)


Plugin: Any plugin using the getDurability method on ItemStacks found in Recipies

 Description   

When using the method getDurability() on an ItemStack found in a ShapedRecipe and ShaplessRecipe, some things such as cobblestone in the furnace recipie or lapis_block in the lapis block to lapis lazuli have the wrong values.

In an inventory, these items have a durability of 0. However, in the recipie, these items are found with a durability of Short.MAX_VALUE (32767). Making any comparisons, or any remove from inventory attempt using the ItemStack from a recipie impossible.

The only temporary fix I can come up with for my plugins are to check:
if(item.getDurability() == Short.MAX_VALUE)

{ item.setDurability(0);}

If it matters, I'm getting the recipie using
this.getServer().getRecipesFor(some_item) where this is my plugin and some_item is an itemstack. I then loop through the list of recipies and attempt to remove the items in them from an inventory.

With the durability values messed up in the recipes, it is impossible remove without the temporary fix I have (and who knows if that will even work for all recipes).

I hope I filled out everything in this correctly. If you need more information, please let me know.



 Comments   
Comment by David McCauley [ 01/Jan/15 ]

I guess that makes sense. Its good for things like turning sand to glass since there is both sand and red sand, but for things like cobblestone where there is only 1 durability, its kind of annoying.

I'll fix my plugins to go with this.

Comment by Shevchik [ 01/Jan/15 ]

Short.MAX_VALUE is a wildcard, it means than any durability item can be used for this recipe.

Comment by Z750 [ 27/Dec/14 ]

Moved to Spigot from SpigotPlugins.

SpigotPlugins is specifically for the small number of plugins we have updated and any issues for them. Issues with the API/Server itself belong in the Spigot project issue tracker.

Generated at Mon Apr 21 20:53:37 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.