#(Iki) Getting the LivingEntity out of an NPC

1 messages · Page 1 of 1 (latest)

paper leaf
#

I'm trying to get the LivingEntity out of my NPC but something isn't right, whatever I do with the LivingEntity doesn't run at all and doesn't give any excpetions.
Here's my code:

npc.addTrait(SentinelTrait.class);
SentinelTrait sentinelTrait = npc.getOrAddTrait(SentinelTrait.class);

erebus.spawn(loc);
LivingEntity entity = sentinelTrait.getLivingEntity(); //i've tried both npc.getEntity(); and this
entity.setGlowing(true); //this is just an example thing, it doesn't work```
dusty bronzeBOT
#

(Iki) Getting the LivingEntity out of an NPC

dusty bronzeBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

paper leaf
#

also yes, I made sure that the entity is spawned

stiff hazel
#

@paper leaf so, do you mean glowing doesn't work?

paper leaf
#

anything involving the entity

stiff hazel
#

@paper leaf so, it's not null?

#

and you're sure it's not being respawned?

paper leaf
#

well no
if it were to be null it would throw exceptions

paper leaf
#

there's nothing in my code that respawns anything

stiff hazel
#

if it was a player, setting a skin might respawn it

paper leaf
#

hm lemme check that

paper leaf
stiff hazel
#

@paper leaf try not adding a skin

paper leaf
#

sure i'll try

paper leaf
stiff hazel
#

if you need to add a skin, set it before the NPC spawns

#

otherwise you will have to wait for the skin to be downloaded (which forces a respawn)

paper leaf
#

i assume it's just slow downloading right?
if that's the case i can just add some delay before it spawns

stiff hazel
#

@paper leaf as in, set it directly to the blob

#

rather than downloading it every time

paper leaf
#

setSkinPersistent stores it in the files right?

#

instead of downloading

stiff hazel
#

stores it in memory

#

yeah and files

#

downloaded from mojang servers, so you probably didn't do it right if you got the wrong texture

paper leaf
# stiff hazel downloaded from mojang servers, so you probably didn't do it right if you got th...
skinTrait.setSkinPersistent("Erebus","jSH8ZNFuGrjPV+FrHNHDVQ1ha8U1zYGtPXO+4pvOd7toWUKYXQYBu1FNcj0D1WzOkvYIc1X8gvGjbMAiHI7h9LIe24Wt0Wg4Oy/QKv/WJzm1t7qIKdaBUR0vorXD/RP0X4E/3NCz/WYZhKsPVA7pRPy3wMl+cUKU4R9KaQ4h0IQ8Vc/+QPIWxTce6w+nkQC+JFSscA8aeXFj5vYOycBMxW/950N2uc9oH1ax7cP9gTKLvqFYzMRacStiBstSl3/lb+yXExcjgZhojOovYuYotLDsvWAVtw3ObL7VtNsZQGlxbrDSnYGO/20MryQsLa6z7chLsMLOwjfmolnRTq0Xhth8X59Nk76ZvsUWuK90yMa7+U7pu4shYt7CGVt+Qr4wqks1opHASQ8VqJxsSxRBNggMztE+Ip40cpIz12xaLBtQ+jjzsQRxaezJCxEsa6OEuRKJJUjKHQucg2dO5uNKpWIb92Rq/YLG34FxMg/t8D9duMT2p2+LZhJdO9zLl/XPXDp4h+cuQM5kWSjbD7SeoBSRMCy5GbM/UrmXAeb8gDix12Omvdf2OGbEL1iFgqwxGtl0rr97GjUdA9Ggg4duVYulZto/+a09FG+QaHe4kjLkJluDN69Wed/8Fj44JWncCgZQZOJ0Sk5jAG+RGxBjFLvbfHjyK/fhzWH1dedQ0w8=" , "ewogICJ0aW1lc3RhbXAiIDogMTY3OTc5OTAyMzQ2NiwKICAicHJvZmlsZUlkIiA6ICJhNTkyMjkwNDVjMjI0MGUyOTM0ZjMxZWFjMzNiY2IzNSIsCiAgInByb2ZpbGVOYW1lIiA6ICJTbHVnRGVhbGVyQWdhaW4iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTI4MDU4ODc0NDhkNWFlYWJhNDRhOTcwOGQ2M2RhMTU0OWE1MmFhMzA5YzM4ZjE1NTUwZjE0N2MyNjlkNDY1IgogICAgfQogIH0KfQ==");

im not sure what the first arg "skinName" is
as for the encoded signature and texture i think its good

stiff hazel
#

seems ok

#

the first argument is a cache key

paper leaf
stiff hazel
#

yep

paper leaf
#

not the texture

#

well now when i tested it did this:
it changed itself to the normal texture, the actual skin i want
then it changed to alex
then to the skin above

stiff hazel
#

@paper leaf need your code then

paper leaf
#
NPC erebus = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, "§c§l« §e§lErebus, Servant of The Void §c§l»", loc);


        SkinTrait skinTrait = erebus.getOrAddTrait(SkinTrait.class);
        //skinTrait.setSkinName("Rednine_");
        //try skin set texture instead of persistent
        skinTrait.setSkinPersistent("Rednine_", "jSH8ZNFuGrjPV+FrHNHDVQ1ha8U1zYGtPXO+4pvOd7toWUKYXQYBu1FNcj0D1WzOkvYIc1X8gvGjbMAiHI7h9LIe24Wt0Wg4Oy/QKv/WJzm1t7qIKdaBUR0vorXD/RP0X4E/3NCz/WYZhKsPVA7pRPy3wMl+cUKU4R9KaQ4h0IQ8Vc/+QPIWxTce6w+nkQC+JFSscA8aeXFj5vYOycBMxW/950N2uc9oH1ax7cP9gTKLvqFYzMRacStiBstSl3/lb+yXExcjgZhojOovYuYotLDsvWAVtw3ObL7VtNsZQGlxbrDSnYGO/20MryQsLa6z7chLsMLOwjfmolnRTq0Xhth8X59Nk76ZvsUWuK90yMa7+U7pu4shYt7CGVt+Qr4wqks1opHASQ8VqJxsSxRBNggMztE+Ip40cpIz12xaLBtQ+jjzsQRxaezJCxEsa6OEuRKJJUjKHQucg2dO5uNKpWIb92Rq/YLG34FxMg/t8D9duMT2p2+LZhJdO9zLl/XPXDp4h+cuQM5kWSjbD7SeoBSRMCy5GbM/UrmXAeb8gDix12Omvdf2OGbEL1iFgqwxGtl0rr97GjUdA9Ggg4duVYulZto/+a09FG+QaHe4kjLkJluDN69Wed/8Fj44JWncCgZQZOJ0Sk5jAG+RGxBjFLvbfHjyK/fhzWH1dedQ0w8=", "ewogICJ0aW1lc3RhbXAiIDogMTY3OTc5OTAyMzQ2NiwKICAicHJvZmlsZUlkIiA6ICJhNTkyMjkwNDVjMjI0MGUyOTM0ZjMxZWFjMzNiY2IzNSIsCiAgInByb2ZpbGVOYW1lIiA6ICJTbHVnRGVhbGVyQWdhaW4iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTI4MDU4ODc0NDhkNWFlYWJhNDRhOTcwOGQ2M2RhMTU0OWE1MmFhMzA5YzM4ZjE1NTUwZjE0N2MyNjlkNDY1IgogICAgfQogIH0KfQ==");
        
skinTrait.setShouldUpdateSkins(true);

        erebus.addTrait(SentinelTrait.class);
        SentinelTrait sentinelTrait = erebus.getOrAddTrait(SentinelTrait.class);
        sentinelTrait.addTarget("players");

        sentinelTrait.damage = 4;
        sentinelTrait.range = 64;
        sentinelTrait.chaseRange = 8;
        sentinelTrait.armor = 0.15;
        sentinelTrait.closeChase = true;
        sentinelTrait.setHealth(2048);

        erebus.spawn(loc);
#
new BukkitRunnable() {

            public void run() {

                if(erebus.isSpawned()) {
                    cancel();
//does stuff

}
  }.runTaskTimer(ForlornWorld.getInstance(), 0, 1);```
#

i carved it out for visibility if you need the entire thing i can send it

stiff hazel
#

remove setShouldUpdateSkins

paper leaf
paper leaf
static eagleBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@paper leaf