Create Chunkloading

Create Chunkloading

5M Downloads

Crash when placing Cart Assembler contraption with a chunk loader attached (java.lang.NullPointerException: Ticking entity)

arketec opened this issue · 11 comments

commented

Steps:
Assembled mining contraption and ran for about 40 chunks (loaded by this mods attached chunkloader)
Right click cart with wrench to pick up
place down cart in a Cart Assembler - Crash
re-load game and server is rolled back to point just after right-clicking the cart (tested even after waiting a few minutes to place the cart into the assembler, same roll back)

fixed after placing cart in entity mode, then placing cart assembler on rail after

crash report here:
https://pastebin.com/V2CTfWzv

commented

Thanks for the report. The crash itself is caused by the cart not knowing what chunk to unload and can be fixed easily. However, I do want to do some more investigating to make sure that chunks aren't left loaded when they shouldn't be.

(Thanks for playing with the mod!)

commented

Awesome, thanks for looking into it

And yes, mod is great as long as I work around this issue :)

commented

Please try the following test build and confirm that it fixes your issue and still works stably. I've rewritten the chunk system to use the new chunk manager added in 1.16, as I think there were some corner cases with the previous logic.

I found in my test world that there were some spurious chunks which do not get unloaded by this update, so you will probably want to run /forceload remove all in your world (unless you don't mind having some random chunks loaded at all times).

unzipme.zip

commented

ok, so I tested it out and it doesnt crash anymore...but it also doesnt seem to be loading chunks anymore either. Each time I left it running and went out of range, it would stop until I approached it again

commented

It is a tunnel bore, and it stops right past the render distance, ie: once the machine disappears it stops shortly after. I’ve waited 20 mins after watching it disappear only to return to it and it had moved only ~10 blocks, which sounds to me like it stopped, and started moving again as I came within range.

I’ll try out the new build a bit later tonight when I get home. Thanks!

commented

Interesting... can you try this next build? In debug mode it definitely loads chunks even when I teleport thousands of blocks away.

unzipme2.zip

commented

Another question: if you're using it as a tunnel bore, do you see it physically stopping as it reaches the end of your render distance, and remaining right at the edge without moving?

commented

ok, I tested it again twice.

first run ran for 15 mins, it was out of render distance within the first 5 mins, so I caught up with the machine, placed a torch, and went back to the start and let the machine run outside of render distance for another 10 mins

When I went to check on the machine, it had only moved about 10 blocks past the torch I placed after 10 minutes of running

I then broke down the machine and replaced the chunk loader block with a fresh one and ran the same test again, and got the same result.

commented

Thanks for the detailed descriptions. This should be the last test build, as I was finally able to replicate your issue. After making my minecart contraption bigger and placing the chunk loader about 32 blocks away from the minecart itself (using linear bearings), I got the same behavior.

It turns out that I reintroduced a bug I previously fixed in the old logic, where the chunks around the minecart were not being loaded. Additionally, in the process of fixing that again, I discovered another bug which would result in chunks being unloaded too early. That is also fixed.

unzipme3.zip

I appreciate your patience with me; as you can probably tell, I am not an expert when it comes to mods. 🙂

commented

No prob man, I don't mind helping test. I do dev work myself, so understand the value of a fresh set of eyes testing things.

good news, chunks are being loaded once again, and no crash when placing down on a cart assembler. I think it is all good now.

thank you for the fast support

commented

You're welcome; glad to hear it's fixed.

The fix is now published as 0.2.0 on CurseForge.