Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mob names stripped except for specific cases #22

Closed
TTFTCUTS opened this issue Mar 14, 2017 · 19 comments
Closed

Mob names stripped except for specific cases #22

TTFTCUTS opened this issue Mar 14, 2017 · 19 comments
Labels

Comments

@TTFTCUTS
Copy link

TTFTCUTS commented Mar 14, 2017

Stripping of custom names from mobs prevents any mods which hook entity rendering to add effects based on the mob name from being used as morphs.

I see from the code that all names except for the vanilla special cases are removed. It would be helpful if the others were also left for the aforementioned reason. I've been putting together an little mod (ChickenShades) which was primarily designed for telling players apart by sight in a pack using Metamorph (Vaygrim's Coop Life pack), but the name stripping prevents it from working.

Other mod mobs which are possibly affected include some animal special cases added (I think) by ExU, and possibly the Headcrumbs player copies, though I haven't specifically checked.

@mchorse
Copy link
Owner

mchorse commented Mar 14, 2017

Hey there, @TTFTCUTS! Thanks for reporting this issue. Unfortunately, I don't really know whether it is possible to solve this issue since there is another issue regarding custom names.

Due to the fact that name tags rendring handled by entity's renderers, I have no choice as to dynamically set underlying entity's custom name to player's name and force rendering of entity's name tag. That would guarantee that players would be able to see morphed players' user names.

Would that interfere with your mod? If you would get custom name from entityData, then it should solve it, right?

@TTFTCUTS
Copy link
Author

TTFTCUTS commented Mar 14, 2017

Good question. I didn't know that there was an alternative way to get the entity name data. I'll give it a try and see.

@mchorse
Copy link
Owner

mchorse commented Mar 14, 2017

By the way, thank you very much for linking your mod! Now I know how to attach a resource pack with ability to detect packs reloading (in Blockbuster, if you would reload texture packs, all textures get purple black checkered!

@mchorse
Copy link
Owner

mchorse commented Mar 14, 2017

It still getting stripped, but I can disable it.

@TTFTCUTS
Copy link
Author

TTFTCUTS commented Mar 14, 2017

I'm not seeing anything in the entity data when getting the tag via .getEntityData(), in general, that is - from anything. Possibly a client-side only issue?

Edit: I think I might have found what you mean.

@TTFTCUTS
Copy link
Author

Ok, so if you were to leave it in the data, would it still be retrievable by .getCustomNameTag()? If so, then I'll use that - it has the added effect of eliminating default named mobs from the checks.

@TTFTCUTS
Copy link
Author

TTFTCUTS commented Mar 14, 2017

Additionally, by the looks of it you can cancel rendering of specific name tags by listening for a RenderLivingEvent.Specials.Pre and setting it as cancelled for the ones you wish to prevent.

@TTFTCUTS
Copy link
Author

TTFTCUTS commented Mar 14, 2017

Alternatively, it would be fine if I could get the name of the player out of the rendered entity somehow so that the changes were based on that, but that means they wouldn't be collectable like the jeb_ sheep etc.

Edit: I see that you set the custom name in the update, but I am reading no name when requesting it with .getCustomNameTag()

@mchorse
Copy link
Owner

mchorse commented Mar 14, 2017

Ok, so if you were to leave it in the data, would it still be retrievable by .getCustomNameTag()? If so, then I'll use that - it has the added effect of eliminating default named mobs from the checks.

Hm, I'm not sure about it, I think if there would be a custom name tag, then you will be, but the name won't be able to be rendered 😂

However that you mentioned the RenderLivingEvent.Specials.Pre, with this event I can actually try to make it render player's username. However it gives another obstacle, morphed player isn't directly accessible from there.

I'll try to figure out how to make player names visible on top of rendered player, and at the same time keep the entity's custom name.

@TTFTCUTS
Copy link
Author

TTFTCUTS commented Mar 14, 2017

Well, if you need something to test against, ChickenShades is now uploaded, pending approval, with a dev jar in there too. You'd need to make your own resource pack for it to work though.

Also, I can't work out why the entities don't have a custom name set - update is called on the player tick and sets the name if it isn't set, yet when I query the entity it returns empty.

@mchorse
Copy link
Owner

mchorse commented Mar 14, 2017

I'm not sure whether you're talking about the entity being null or "CustomName" property being empty. If you are talking about custom name, it will be empty even if you'll modify the player data, AFAIK, since it's getting stripped, but if you're talking about the entity being null, is that because it initialized after the first update.

@TTFTCUTS
Copy link
Author

I meant that the name is null, but I was curious as to why since it was being set here. I guess it must be being wiped between times?

@mchorse
Copy link
Owner

mchorse commented Mar 15, 2017

Entity is set after the first update. How do you access the name, though? You either will need to wait for entity to get set after first update, or use mchorse.metamorph.api.morphs.EntityMorph#getEntity(World world) method to get the entity by force.

@TTFTCUTS
Copy link
Author

TTFTCUTS commented Mar 15, 2017

The name is accessed per frame by .getCustomNameTag() in a listener catching the event posted from the method called here.

At least, that's the order as far as I am aware.

@mchorse
Copy link
Owner

mchorse commented Mar 16, 2017

Yeah, I might set player's name on render special event, but keep custom name to default. I'll need to experiment with it, though.

@mchorse
Copy link
Owner

mchorse commented Apr 2, 2017

@TTFTCUTS I think I got it working, the patch update is coming soon, I'll try to fix other bugs in the issue tracker. Thanks for suggestions! :)

@mchorse mchorse closed this as completed Apr 2, 2017
@mchorse mchorse mentioned this issue Apr 2, 2017
14 tasks
@TTFTCUTS
Copy link
Author

TTFTCUTS commented Apr 2, 2017

Nice. I'll give it a try when it's done and see if the issue is fully resolved in all cases. Thanks for looking into this.

@mchorse
Copy link
Owner

mchorse commented Apr 2, 2017

You're welcome! I'm going to release this update either today or tomorrow (as soon as I'll finish with most issues in the tracker).

P.S.: your ATG mod rocks! 😄

@TTFTCUTS
Copy link
Author

TTFTCUTS commented Apr 4, 2017

Issue resolved. My only reservation is that the mob name in the morph menu does not include the custom name for the morph, so it can be hard to see which one is selected when the skins are similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants