Metamorph

Metamorph

4M Downloads

Mob names stripped except for specific cases

TTFTCUTS opened this issue ยท 19 comments

commented

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.

commented

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.

commented

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?

commented

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?

commented

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.

commented

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!

commented

It still getting stripped, but I can disable it.

commented

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.

commented

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.

commented

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.

commented

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()

commented

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.

commented

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.

commented

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.

commented

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.

commented

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.

commented

@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! :)

commented

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.

commented

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! ๐Ÿ˜„

commented

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.