mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
#1011: Throw an exception if a RecipeChoice is ever supplied air
This would otherwise crash the client. By: 2008Choco <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
30784afe2f
commit
25c8c8a3da
1 changed files with 4 additions and 1 deletions
|
@ -13,7 +13,8 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
/**
|
||||
* Represents a potential item match within a recipe. All choices within a
|
||||
* recipe must be satisfied for it to be craftable.
|
||||
* recipe must be satisfied for it to be craftable. Choices must never be
|
||||
* null or air.
|
||||
*
|
||||
* <b>This class is not legal for implementation by plugins!</b>
|
||||
*/
|
||||
|
@ -66,6 +67,7 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
|
|||
Preconditions.checkArgument(!choices.isEmpty(), "Must have at least one choice");
|
||||
for (Material choice : choices) {
|
||||
Preconditions.checkArgument(choice != null, "Cannot have null choice");
|
||||
Preconditions.checkArgument(!choice.isAir(), "Cannot have empty/air choice");
|
||||
}
|
||||
|
||||
this.choices = new ArrayList<>(choices);
|
||||
|
@ -166,6 +168,7 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
|
|||
Preconditions.checkArgument(!choices.isEmpty(), "Must have at least one choice");
|
||||
for (ItemStack choice : choices) {
|
||||
Preconditions.checkArgument(choice != null, "Cannot have null choice");
|
||||
Preconditions.checkArgument(!choice.getType().isAir(), "Cannot have empty/air choice");
|
||||
}
|
||||
|
||||
this.choices = new ArrayList<>(choices);
|
||||
|
|
Loading…
Reference in a new issue