#getBlock() in unloaded chunks

1 messages · Page 1 of 1 (latest)

pallid wave
#

Does anyone have a guideline or known working example of using a ticking area for world.getDimension().getBlock(), I have it "working" but it is a little unreliable. Just want to see if anyone has a better implementation.

flint spoke
pallid wave
#

For some reason using tick_world on an entity is worse that /tickingarea

flint spoke
pallid wave
#

By worse it's not working at all

flint spoke
#

No right? Choose between these two uses many entities or use tickingarea command and make math if the two ticking areas are besides each other don't make another tickingarea just calculate tyem

flint spoke
pallid wave
#

Most likely lol

#

My use case is very minimal. They only need to exist for a few ticks while getting and setting a block, then they are deleted

pallid wave
flint spoke
pallid wave
#

No, that's what the docs say, "Throws LocationInUnloadedChunkError"

#

I guess I'm going to have to just increase the delay on my getBlock() call

flint spoke
pallid wave
#

yerp sad_pack_icon

#

half a second isn't to bad I guess

pallid wave
#

Yeah, it's just to unreliable atm, Just have an entity exist at the block you want to get

languid scaffold
#
const entity = dimension.spawnEntity('my:loader', loadedPos);
entity.teleport(unloadedPos);
pallid wave
#

then killing it when "deactivating"

languid scaffold
#

fair enough

pallid wave
#

yeah wanted to go no entity, but, oh well

#

I don't really understand the no spawning in unloaded chunks issue though

flint spoke
#

Or you could try to add that your entity has the component minecraft:persistent

shell meteor
# pallid wave I don't really understand the no spawning in unloaded chunks issue though

Entities are stored inside chunks in the save files. The API won't let you spawn an entity in an unloaded chunk because the entity couldn't actually be saved to the world until the chunk was loaded.

I did a lot of testing with entities that have tick_world enabled and found that it's not very reliable. Sometimes when teleporting my entity it would get "lost" and the area that I teleported it to would not start ticking, making it impossible for me to interact with the entity.

Your best option is to manage ticking areas with the /tickingarea command and just wait for the block location that you need to load.

pallid wave
#

Fair, I would like to use ticking area, bit it's ttl is to varying, sometimes immediately, sometimes over a second, and it just looks bad for the player