Fix NPE when calling ForgeHooks.getDefaultCreatorModId(ItemStack) on Spawn Eggs. Closes #10002

This commit is contained in:
LexManos committed 2024-06-04 15:48:07 -07:00
1 parent ff7085b95b
commit cdeb786877
1 file changed
+1 -1
@@ -697,7 +697,7 @@ public final class ForgeHooks {
if (potion != null && potion.unwrapKey().isPresent())
return potion.unwrapKey().get().location().getNamespace();
} else if (item instanceof SpawnEggItem egg) {
var resourceLocation = ForgeRegistries.ENTITY_TYPES.getKey(egg.getType(null));
var resourceLocation = ForgeRegistries.ENTITY_TYPES.getKey(egg.getType(itemStack));
if (resourceLocation != null)
return resourceLocation.getNamespace();
}