mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 02:22:12 +01:00
#497: Add Material#getCraftingRemainingItem() to get item left behind after crafting
By: ben <ben@benwoodworth.net>
This commit is contained in:
parent
08c3c0c1c3
commit
7504d25db2
1 changed files with 26 additions and 0 deletions
|
@ -7978,4 +7978,30 @@ public enum Material implements Keyed {
|
|||
// </editor-fold>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the remaining item in a crafting grid after crafting with this
|
||||
* ingredient.
|
||||
* <br>
|
||||
* Only available when {@link #isItem()} is true.
|
||||
*
|
||||
* @return the item left behind when crafting, or null if nothing is.
|
||||
*/
|
||||
@Nullable
|
||||
public Material getCraftingRemainingItem() {
|
||||
Validate.isTrue(isItem(), "The Material is not an item!");
|
||||
switch (this) {
|
||||
// <editor-fold defaultstate="collapsed" desc="getCraftingRemainingItem">
|
||||
case WATER_BUCKET:
|
||||
case LAVA_BUCKET:
|
||||
case MILK_BUCKET:
|
||||
return BUCKET;
|
||||
case DRAGON_BREATH:
|
||||
case HONEY_BOTTLE:
|
||||
return GLASS_BOTTLE;
|
||||
default:
|
||||
return null;
|
||||
// </editor-fold>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue