#entities despawning

1 messages · Page 1 of 1 (latest)

quasi echo
#

When does it despawn

austere prism
#

i'm not actually sure but read this #1449975064094048337 message

#

maybe ask buddelbubi about the entity issue

quasi echo
austere prism
#

i'll test it now

#

okay

#

hologram entity disappears when restarting the server

austere prism
tiny sigil
austere prism
tiny sigil
#

Try /save-all

#

Idk

austere prism
#

doesn't work unforunately

quasi echo
#

hey

#

i solved this after hours of thinking

#

use isPersistent function on your entity class

#

and set it to true

austere prism
#

oh okay

#

shouldn't this be implemented on the servers side at some point instead of all plugins?

quasi echo
#

idk, maybe

#

it can implemented on customentity interface

austere prism
#

yeah cause normal entities despawn

quasi echo
#

idk about normal entities but proably there is a problem if it isn't implemented yet

austere prism
#

no i meant like normal entities are supposed to despawn

#

anyway

#

thanks

quasi echo
#

atleast some of them

austere prism
#

yeah

austere prism
#

it doesn't work...

#

i checked if the entity is persistent and restarted the server but it still disappears

#

i also changed the hologram plugin to set the entities persistency to true

quasi echo
#

it worked on me

#

weird

austere prism
#

yeah idk

#

i even set the holograms despawnable property to false

green kraken
# austere prism i even set the holograms despawnable property to false

custom entity isPersistent is already there, by default any entity that is not persistent will despawn, this is Bedrock behavior to optimize the server.
if you create a custom entity and want it to be persistent you have to set it
vanilla entities that is persistent as example are NPCs, villagers and few others

#

but if you setup a custom entity that extend Human, then in that case aside of isPersistent tag you also need to reload the skin data on init, as these entities are not mobs oriented as others, they will act like players

austere prism
#

oh

#

so you're saying implement it like buddlebubis npc plugin?

green kraken
#

if you dont need to have it like human, npc would work
you only use human type if you need to load data from players, like skin, etc..

austere prism
#

holograms extend entity not entityhuman

green kraken
#

paste your code here

austere prism
#

but i changed persistence here:

        CompoundTag tag = Entity.getDefaultNBT(position);
        ListTag<StringTag> linesTag = new ListTag<>(lines.stream().map(StringTag::new).toList());
        tag.putList(EntityHologram.LINES, linesTag);
        EntityHologram hologram = new EntityHologram(position.getChunk(), tag);
        hologram.setNameTag(identifier);
        hologram.setPersistent(true);
        hologram.spawnToAll();
        return hologram;
    }```
#

i also made a command to check if nearby entities are persistent to validate this

green kraken
#

I dont know the code of Buddel`s plugin, better him to guide you here then, but regarding the persistance, you can try to add setPersistent on init, test if it works

austere prism
#

alr

arctic oar
#

did it work? @austere prism

quasi echo
#

You may need to set persistent in definition tho