Woot

Woot

24M Downloads

[1.12.2] Tier4 structure becomes malformed after chunk unload

Morpheus1101 opened this issue ยท 24 comments

commented

I have Tier4 running EnderDragon atm and ive noticed quite a few times after ive been offline or away form the chunk a while that part of it becomes unlinked for a lack of a better word while the remainder of the structure remains valid.

2018-01-13_07 19 08
2018-01-13_07 19 19

commented

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?

commented

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.

commented

No drops even when fully formed - that is not good.
Silly question, but are feeding the farm the ingredients for the Dragon?

commented

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

commented

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.

commented

Will test it now an c what happens

commented

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

2018-01-13_18 44 41

With Chunk Borders Shown

2018-01-13_18 57 18

commented

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

commented

To answer a prev question you had, the factory continues to work as T4 regardless of visually being malformed.

commented

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.

commented

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.

commented

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?

commented

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?

commented

1 scenario is i come back and is partially malformed but working.

2nd scenario is i come back and its 100% malformed an not registering any of it as a valid factory as shown in pic below.

But either way replacing the controller resets and it reforms everything as it should do.

2018-01-13_23 11 41

commented

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!

commented
  1. Yes
  2. Yes
  3. none of it
commented

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?
commented

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!

commented

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.

commented

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!

commented

Thanks for the update on this.

commented

c2dac58

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.

commented

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.

commented

Just some feedback to say that all issues have been resolved and ive not had a re-occurrence of this since this fix, thankyou for the effort and diligence with this tricky one.