File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
paper-api/src/main/java/org/bukkit/inventory Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ record EmptyRecipeChoice() implements RecipeChoice {
99
1010 static final RecipeChoice INSTANCE = new EmptyRecipeChoice ();
1111 @ Override
12+ @ Deprecated (since = "1.13.1" )
1213 public ItemStack getItemStack () {
1314 throw new UnsupportedOperationException ("This is an empty RecipeChoice" );
1415 }
Original file line number Diff line number Diff line change @@ -31,8 +31,17 @@ final class ItemTypeRecipeChoiceImpl extends RecipeChoice.MaterialChoice impleme
3131 }
3232
3333 @ Override
34+ @ Deprecated (since = "1.13.1" )
3435 public ItemStack getItemStack () {
35- throw new UnsupportedOperationException ("ItemTypeChoice does not support this" );
36+ final ItemType type = Registry .ITEM .getOrThrow (this .itemTypes .iterator ().next ());
37+ final ItemStack item = type .createItemStack ();
38+
39+ // legacy compat
40+ if (this .itemTypes .size () > 1 ) {
41+ item .setDurability (Short .MAX_VALUE );
42+ }
43+
44+ return item ;
3645 }
3746
3847 @ Override
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ public boolean test(ItemStack t) {
152152 }
153153
154154 @ Override
155+ @ Deprecated (since = "1.13.1" )
155156 public ItemStack getItemStack () {
156157 ItemStack stack = new ItemStack (choices .get (0 ));
157158
@@ -247,6 +248,7 @@ public ExactChoice(List<ItemStack> choices) {
247248 }
248249
249250 @ Override
251+ @ Deprecated (since = "1.13.1" )
250252 public ItemStack getItemStack () {
251253 return choices .get (0 ).clone ();
252254 }
You can’t perform that action at this time.
0 commit comments