Registries#getEntityType should return null if invalid

This commit is contained in:
themode 2021-01-09 00:58:06 +01:00
parent ef1afb9cd9
commit 2c2a691af7

View File

@ -1,7 +1,6 @@
// AUTOGENERATED by net.minestom.codegen.RegistriesGenerator
package net.minestom.server.registry;
import java.util.HashMap;
import net.minestom.server.entity.EntityType;
import net.minestom.server.fluids.Fluid;
import net.minestom.server.instance.block.Block;
@ -16,6 +15,8 @@ import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
/**
* AUTOGENERATED
*/
@ -129,19 +130,19 @@ public final class Registries {
}
/**
* Returns the corresponding EntityType matching the given id. Returns 'PIG' if none match.
* Returns the corresponding EntityType matching the given id. Returns null if none match.
*/
@NotNull
@Nullable
public static EntityType getEntityType(String id) {
return getEntityType(NamespaceID.from(id));
}
/**
* Returns the corresponding EntityType matching the given id. Returns 'PIG' if none match.
* Returns the corresponding EntityType matching the given id. Returns null if none match.
*/
@NotNull
@Nullable
public static EntityType getEntityType(NamespaceID id) {
return entityTypes.getOrDefault(id, EntityType.PIG);
return entityTypes.get(id);
}
/**