Fix NPE in a validator from registry access refactor

This commit is contained in:
altrisi committed 2023-01-20 14:35:45 +01:00
1 parent 811b330446
commit d9a4a62f7c
1 file changed
+1
+1
View File
@@ -977,6 +977,7 @@ public class CarpetSettings
@Override
public String validate(CommandSourceStack source, CarpetRule<String> currentRule, String newValue, String string) {
if (source == null) return newValue; // closing or sync
Optional<Block> ignoredBlock = source.registryAccess().registryOrThrow(Registries.BLOCK).getOptional(ResourceLocation.tryParse(newValue));
if (!ignoredBlock.isPresent()) {
Messenger.m(source, "r Unknown block '" + newValue + "'.");