diff --git a/src/main/java/org/spongepowered/common/mixin/core/util/text/event/HoverEventMixin.java b/src/main/java/org/spongepowered/common/mixin/core/util/text/event/HoverEventMixin.java index 62a989c9d96..ee244ba02d1 100644 --- a/src/main/java/org/spongepowered/common/mixin/core/util/text/event/HoverEventMixin.java +++ b/src/main/java/org/spongepowered/common/mixin/core/util/text/event/HoverEventMixin.java @@ -71,7 +71,7 @@ public abstract class HoverEventMixin implements HoverEventBridge { String name = nbt.getString("name"); EntityType type = null; if (nbt.hasKey("type", Constants.NBT.TAG_STRING)) { - type = SpongeImpl.getGame().getRegistry().getType(EntityType.class, name).orElse(null); + type = SpongeImpl.getGame().getRegistry().getType(EntityType.class, nbt.getString("type")).orElse(null); } UUID uniqueId = UUID.fromString(nbt.getString("id")); diff --git a/src/main/java/org/spongepowered/common/text/action/SpongeHoverAction.java b/src/main/java/org/spongepowered/common/text/action/SpongeHoverAction.java index fdcf25c3039..59dbc85ca08 100644 --- a/src/main/java/org/spongepowered/common/text/action/SpongeHoverAction.java +++ b/src/main/java/org/spongepowered/common/text/action/SpongeHoverAction.java @@ -27,6 +27,7 @@ import net.minecraft.entity.EntityList; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.event.HoverEvent; @@ -66,7 +67,10 @@ public static HoverEvent getHandle(HoverAction action) { nbt.setString("id", entity.getUniqueId().toString()); if (entity.getType().isPresent()) { - nbt.setString("type", EntityList.getKey(((SpongeEntityType) entity.getType().get()).entityClass).toString()); + ResourceLocation resource = EntityList.getKey(((SpongeEntityType) entity.getType().get()).entityClass); + if (resource != null) { + nbt.setString("type", resource.toString()); + } } nbt.setString("name", entity.getName());