Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ private void loadNBTFromFileFooter(int nbtCount, int entitiesCount, long biomeLe
double y = pos.get(1).getValue();
double z = pos.get(2).getValue();
BaseEntity entity = new BaseEntity(tag);
if (entity.getType() == null) {
LOGGER.warn("Skipping entity with unknown type: {}", tag);
entitiesCount--;
continue;
}
BlockArrayClipboard.ClipboardEntity clipboardEntity = new BlockArrayClipboard.ClipboardEntity(
this,
x,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ public EntityType getType() {

//FAWE start
public BaseEntity(CompoundTag tag) {
this(EntityTypes.parse(tag.getString("Id")), tag);
this(EntityTypes.parse(getEntityId(tag)), tag);
}

// FAWE uses "Id" internally, but entity NBT may also carry the vanilla "id" key
private static String getEntityId(CompoundTag tag) {
String id = tag.getString("Id");
return id.isEmpty() ? tag.getString("id") : id;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ private static String convertEntityId(String id) {
case "illusion_illager":
return "illusioner";
default: {
if (Character.isUpperCase(id.charAt(0))) {
if (!id.isEmpty() && Character.isUpperCase(id.charAt(0))) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can this be the case?

@intersecato intersecato Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can this be the case?

CompoundTag#getString returns "" for a missing key. That's what caused #2494: there was only id, so getString("Id") returned "" and charAt(0) threw. The id fallback covers that case, but a tag with neither key would still crash. Other callers of parse (e.g. MutableEntityChange) could hit it too. It's just a defensive check, so I can drop it if you prefer.

return convertEntityId(id.toLowerCase(Locale.ROOT));
}
return id;
Expand Down
Loading