Skip to content

Conversation

@AsukaRyo12
Copy link

"Hi there! I've added a 'Custom Entity Name' feature to replace the previous 'Random Number ID or Default Entity Name'.
I thought this might be useful for users who want more control over naming their entities, and I hope it adds value to the project.
If you don't mind, could you take a look at the changes? I'd love to contribute to making ZNPCsPlus even better! ❤
Thanks for your hard work on this project!"

@AsukaRyo12
Copy link
Author

AsukaRyo12 commented Jul 24, 2025

Sorry, I'm a Java beginner, I didn't check NullPointerException just now, this is my latest modified code❤

    String displayName = entity.getProperty(propertyRegistry.getByName("display_name", String.class));

    if (displayName != null) {
        EntityData<Optional<Component>> nameData = new EntityData<>(
                2,
                EntityDataTypes.OPTIONAL_ADV_COMPONENT,
                Optional.of(Component.text(displayName))
        );
        sendPacket(player, new WrapperPlayServerEntityMetadata(
                entity.getEntityId(),
                Collections.singletonList(nameData)
        ));
    }

…revious 'Random Number ID or Default Entity Name'.

I thought this might be useful for users who want more control over naming their entities, and I hope it adds value to the project.
If you don't mind, could you take a look at the changes? I'd love to contribute to making ZNPCsPlus even better! ❤
Thanks for your hard work on this project!"
…e name to select and replace the NPC model. The previous writing method will cause the player-type NPC to always use a random numeric ID as the entity name. Therefore, in order to solve this problem, I allow NPCs to have custom names.
…e name to select and replace the NPC model. The previous writing method will cause the player-type NPC to always use a random numeric ID as the entity name. Therefore, in order to solve this problem, I allow NPCs to have custom names.
@AsukaRyo12
Copy link
Author

AsukaRyo12 commented Aug 4, 2025

Some model rendering mods or plugins may use the entity's name to select and replace the NPC model. The previous writing method will cause the player-type NPC to always use a random number as the entity name. Therefore, in order to solve this problem, I allow NPCs to have custom names.
Now I can apply my model to the entities created by ZNpcPlus XD!
123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant