[1.12.2] Tier4 structure becomes malformed after chunk unload
Morpheus1101 opened this issue ยท 24 comments
I knew chunks were going to be a problem :
I'm trying to work out if this is just a visual bug or something more insidious.
So it was a tier 4 when you started.
Was it still a tier 4 when you returned and still running, but just looked visually wrong?
Well there in is the issue, since the only T4 mob i have is the dragon and even when fully formed and not mucking up as above, im not getting any drops form the dragon. However when replacing the factory controller everything was fine. Exact specifics to IF it was remaining T4 i couldnt say.
No drops even when fully formed - that is not good.
Silly question, but are feeding the farm the ingredients for the Dragon?
I was not aware there was any ingredients i had to supply, i thought it was a case of i kill it 8 times get the shard etc etc etc and it just did its thing, wasnt aware it required ingredients
I allow people to specify ingredients per spawn and only ship with items for Wither Boss and Dragon.
The book will tell you which ones are configured and what they need.
Right clicking the factory will show the same information via chat or in the factory gui, depending on your version of Woot.
I'm still trying to find a better way of indicating that this mob had ingredients without spamming the user.
With my setup formed normally, i got 3 Dragon Eggs and 1 Dragon Heart and it used 8 crystals .. which it should have given me 2 hearts .. added egg, well i dont mind on that.
Malformed Version i get booted out of the game when clicking on the factory, no error information in console(dont have access to server console) and in this instance its completely unformed
With Chunk Borders Shown
Apologies, the crash bug was fixed in 0.0.6.
Basically it will crash on an unformed factory when trying to open the gui.
(#298)
The drop rate is again configurable by the config file, so someone may have tweaked that. When you update to 0.0.6, the gui will show you the ingredients needed and the drop rate of each item.
I'll need to see if I can replicate the chunk border issue.
I'll come back to you if I need some extra information
To answer a prev question you had, the factory continues to work as T4 regardless of visually being malformed.
So that is good in some way.
It means that I'm not refreshing the client when the chunk is loaded, hence the visual glitch. I'll have to see what the correct way of synching that data is.
I've not replicated the issue, but I have found some issues with my handling of chunks.
Basically once the factory is formed it doesn't care if any of the non-heart blocks is in a chunk that unloads. Only unloading the chunk with the heart in it will invalidate the factory.
This could be related to your issue, as the heart might not refresh the newly loaded blocks visually, since it doesn't care about them.
That sounds feasible and quite likely. However would that also cause the factory to completely malform and stop working all together despite having all the right blocks//valid blocks to form the factory?
So I need to understand if you have two different scenarios when the factory is covering more than one chunk.
- You return to the factory and it is partially formed but still working.
- You return to the factory and it is completely unformed and not working.
Either one works visually and operationally by removing any factory block and placing it again, as this forces the rescan of the factory?
So basically it all revolves around chunk loading and unloading.
Rather than constantly check the factory is formed I rely on the the new blocks finding the main block (heart) and poking it to say hello, which triggers a rescan. They should do the same when they are broken.
I think this all works correctly, which is why replacing a block fixes it.
But I don't think that blocks appearing/disappearing due to chunk load/unload are hooked in correctly. So I think that is the root of all the issues.
Unfortunately I need to understand exactly how to handle the chunk scenario correctly, so this isn't going to be quick to fix. But I think it just got bumped to the top of my list of things to do!
So I've completely rewritten the multiblock forming logic to handle both block breaking and chunk unloads. So now you have to chunkload all the blocks in the factory, or the loss of blocks will break the factory - which is what I thought it did to begin with.
This may or may not fix this issue, but I'm going to continue on and understand a bit better how the client refresh is working to see if I can see a hole that would explain your problem.
On the plus side, I've removed a good bit of code, which is always good :)
So a couple of questions:
- Do you see the issue when you return to the factory from the same dimension?
- Do you see the issue when you return to the factory from another dimension?
- How much of the factory do you have chunkloaded?
I'm still looking at this :(
The good news is that I finally managed to replicate a partially formed factory but in my case the formed bit was a lower tier.
Hopefully I can repeat this and solving it might show me a hole in the server->client sync that I'm missing.
So it is going slowly, but hopefully I'm getting somewhere!
Finding so far:
When building the farm or replacing any farm block:
Any manual placement of a block sets dirtyFarm=true causing it to be rescanned.
When the chunk reloads that contains the heart:
The TE for the heart is created with dirtyFarm=true. This causes the farm to be rescanned with the blocks in the current chunk therefore setting a valid tier (if a complete tier is in the chunk) and setting the appropriate blocks to be formed.
When the other chunks load the structure TEs are created. However the onBlockPlaced method is not called, therefore it doesn't poke the factory to set dirtyFarm and the blocks remain as unformed. The factory also remains as the tier it scanned at heart TE creation time.
So I had a Tier IV spread over three chunks. Tier II was completely in the chunk with the heart.
On heart TE create is discovered the Tier II factory, it then didn't rescan as the other chunks loaded.
To reproduce
Walk far enough away for the farm to unload.
Walk toward the farm ensuring that the first chunk to be loaded is the one with the heart.
If the other chunks are already loaded by the time the heart chunk is loaded then the problem will not appear.
This is - I think - the root of the problem.
I need to figure out how to get the loading of the other chunks with the structure blocks to trigger the farm to rescan.
Hmm, so I think I have a fix - but I don't like it.
All the blocks are non-ticking TEs apart from the heart.
If I set them to all be tickable and then have then poke the heart once, then the factory reforms at the correct tier. However this means I've just added a lot of extra tickable TEs to the world. Granted the ticks don't do anything, but it still takes time for the calls to be made.
I'll look for an alternative solution - if there is one - so some consultation with other modders is in order!
So I think I've got a non-ticking solution.
I've tested on client and dedicated server and nothing bad seems to happen - a few of the alternative fixes created very impressive crashes!
I've also convinced myself that the fix should work in all circumstances.
So hopefully this will fix your issue.
I'll try to roll out a new release some time this weekend.
0.0.8 uploaded to Forge - hopefully it fixes the issue.
Or I've just fixed a similar issue, not the exact one you how :)
Re-open this if you are still having problems.