Fix getDefaultCreatorModId for enchanted books (#5534)

This commit is contained in:
Ben Staddon authored and mezz committed 2019-03-17 13:51:10 -07:00
1 parent 1e34f331da
commit be18bdee88
1 file changed
+3 -7
@@ -1009,14 +1009,10 @@ public class ForgeHooks
if (enchantmentsNbt.size() == 1)
{
NBTTagCompound nbttagcompound = enchantmentsNbt.getCompound(0);
Enchantment enchantment = Enchantment.getEnchantmentByID(nbttagcompound.getShort("id"));
if (enchantment != null)
ResourceLocation resourceLocation = ResourceLocation.makeResourceLocation(nbttagcompound.getString("id"));
if (resourceLocation != null && ForgeRegistries.ENCHANTMENTS.containsKey(resourceLocation))
{
ResourceLocation resourceLocation = ForgeRegistries.ENCHANTMENTS.getKey(enchantment);
if (resourceLocation != null)
{
return resourceLocation.getNamespace();
}
return resourceLocation.getNamespace();
}
}
}