Fix NPE in a validator from registry access refactor
This commit is contained in:
1 file changed
+1
@@ -977,6 +977,7 @@ public class CarpetSettings
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String validate(CommandSourceStack source, CarpetRule<String> currentRule, String newValue, String string) {
|
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));
|
Optional<Block> ignoredBlock = source.registryAccess().registryOrThrow(Registries.BLOCK).getOptional(ResourceLocation.tryParse(newValue));
|
||||||
if (!ignoredBlock.isPresent()) {
|
if (!ignoredBlock.isPresent()) {
|
||||||
Messenger.m(source, "r Unknown block '" + newValue + "'.");
|
Messenger.m(source, "r Unknown block '" + newValue + "'.");
|
||||||
|
|||||||
Reference in new issue
Block a user