Skip to content

Commit

Permalink
Change RegistryStackIdentifierParsers#parseFrom to return an Optional
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfyScript committed Dec 14, 2023
1 parent 2110329 commit db035c3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public List<StackIdentifierParser<?>> matchingParsers(ItemStack stack) {
* @param stack
* @return
*/
public StackReference parseFrom(ItemStack stack) {
return new StackReference(registries.getCore(), parseIdentifier(stack), 1, stack.getAmount(), stack);
public Optional<StackReference> parseFrom(ItemStack stack) {
if (stack == null) return Optional.empty();
return Optional.of(new StackReference(registries.getCore(), parseIdentifier(stack), 1, stack.getAmount(), stack));
}

private void reIndexParsers() {
Expand Down

0 comments on commit db035c3

Please sign in to comment.