Only triggering Entity Spawned once and persistent NBTs

Started by EliPlayz333 on

Topic category: Help with modding (Java Edition)

Last seen on 16:22, 4. Mar 2023
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Only triggering Entity Spawned once and persistent NBTs

I'm attempting to create texture variants for one of my entities, but it's not necessarily working as expected. 

I currently have the texture changing based on a number NBT (1-3) held by the entity, and if that NBT number is 0, it changes it to a random int between 1 and 3. All of that works perfectly, but it seems that the texture is randomized locally and not on the server end; Every player sees a different texture, but they all see the same NBT (usually mismatched); When a player relogs, this texture is randomized again. The texture only deviates from it's default based on it's NBT, according to the code but it seems that it still randomizes itself no-matter my efforts. Specific things, such as display name, keep the texture persistent for all players and past relogs, but the NBT seems to be different. I have tried using scoreboards with the same, failed, result. I have also tried using both the global trigger 'Entity spawns' and the dependent trigger 'On initial entity spawn' with no luck.

I did, in fact, see a tutorial on entity variation that required locking the element and importing code from a different library (which doesn't seem to exist, for some reason), but I had no luck with it. i figured that something as simple as randomizing any number that is at it's default value would be simple enough, but it seems to have created an unclear issue. Please do let me know if you have solutions or need extra info. Thank you in advance!

https://imgur.com/a/FwZsmmM

if entity element <entity> is the target entity then set texture to <texture> is part of Nerdy's Geckolib, and just changes the texture. My method has also been tested with custom code bricks to change the texture (fundamentally the same thing) but yet again, did not produce different results.

I have also tried using 'wait' blocks in various areas with no luck.

Last seen on 01:31, 16. Mar 2024
Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm trying to do the same,…
Mon, 02/26/2024 - 21:44

I'm trying to do the same, but don't know how you got it to change texture... the change texture block isn't working for me.
Anyways, maybe just try to use something else? if it doesn't show in the model, maybe use a held item. I know it seems like kind of a weird idea, but I'm pretty sure that those save and  are across players and stuff.