Spectre0987 / TardisMod

Other
9 stars 4 forks source link

Game freeze/crash with nonvanilla height mods #13

Closed BaccarWozat closed 6 years ago

BaccarWozat commented 6 years ago

With mods whose worlds go higher than Y=256, such as Cubic Chunks, whenever the player attempts to summon a Tardis using a key, said blue box does not appear, though the key then says where (in the Tardis dimension) the console is. Then, using the sonic screwdriver to enter the Tardis causes the loading terrain screen, but the game has frozen.

This happens at virtually any height in a CustomCubic world, so it's not because one is "merely" out of vanilla bounds. This has happened with 0.0.1a and 0.0.3a. Also using Forge 2705.

Subsequently, when rejoining the world, it crashes (not a big surprise).

Pastebin of last game freeze: https://pastebin.com/EvPrC0QL Subsequent crash report: https://pastebin.com/6Es44QFV CC Github: https://github.com/OpenCubicChunks/CubicChunks CC Discord + mod builds: https://discord.gg/8QrUYzz

Barteks2x commented 6 years ago

That looks like an issue in my mod, but it really shouldn't be possible. Also the "game freeze" is actually a crtash. I'm not actually questioning how it's possible my code works at all.

Jeryn99 commented 6 years ago

Looking over the crash report, as @Barteks2x said, it seem's to be more on them than us as there isn't much mention of anything to do with us other than you giving yourself a key

Although, reading further into, the crash appears to happen on Line 67 of the ItemKey, in which we generate the console room in a dimension, perhaps there are conflicting dimensions somewhere?

https://github.com/Spectre0987/TardisMod/blob/f916671d911981e4e0df23973722c42488ed9748/src/main/java/net/tardis/mod/common/items/ItemKey.java#L67

I take it you did not own a TARDIS until you right clicked in this 'CubicChunks' dimension?

Barteks2x commented 6 years ago

As I understand it right now, the issue is that tradis chunk generator uses the unexpected Chunk constructor. But after reviewing the whole code path several times, I'm nearly 100% convinced it can't even work in vanilla when the right one is used. But it does work. And I'm confused. Also the code in the terrain generator that is now commented out wouldn't work for similar reason.

Jeryn99 commented 6 years ago

Unexpected chunk constructor?

Barteks2x commented 6 years ago

The one that doesn't have ChunkPrimer. Or just generating an empty chunk.

Jeryn99 commented 6 years ago

I have made some revisions to the code until @Spectre0987 can take a closer look at this when he comes online. I'm not sure if the changes I have made will help in any way, they can be found in commit https://github.com/Spectre0987/TardisMod/commit/46881276808c503c32617adc192bbad1a0527617

Barteks2x commented 6 years ago

I figured out why using the other constructor works and it's just a big coincidence...

Basically, the problem is that I modify getBlockStorageArrays to return a completely different array (for reasons that are no longer relevant) when inside a chunk that has isColumn flag set.

That isColumn flag is initialized to false at declaration, and set in an injection at RETURN for the constructor without ChunkPrimer argument. And since invoking the chunkprimer constructor also invokes the first one, the isColumn flag should be set to true for a cubic chunks world, right? So world generation should fail the same way even with vanilla generator, right?

Turns out, due to the very unexpected way the java compiler treats constructors and field initializers, Mixin has to do some "magic" to merge Mixin field initializers into the class we are mixing into. And it does that by adding them to every constructor in the target class... which means that BOTH constructor contain the isColumn = false assignment from declaration, and the one in the second constructor reverses the assignment done in the injection to the first one. And I didn't ever intend to do it that way, it was just a few ommisions on my end and things "just working" that made this happen.

Jeryn99 commented 6 years ago

Ah, so is this something you will be fixing on your end?

Barteks2x commented 6 years ago

If I figure out how. This insane coincidence is actually quite convenient and makes things work most of the time. And I don't see a clear way to do it properly.

BaccarWozat commented 6 years ago

I take it you did not own a TARDIS until you right clicked in this 'CubicChunks' dimension?

Correct.

Jeryn99 commented 6 years ago

@BaccarWozat I think creating a Tardis in a different dimension would be your temp fix until we get to the bottom of this properly, I reccomend using a NBT editor to place yourself in the overworld to recover your world aswell. Try and get back to me on whether this works in other dimensions, as I'm curious.

@Barteks2x I wish you luck on doing so, if you need us to do anything you can contact us here: https://discord.gg/SGWw3C or continue replying to this issue

Barteks2x commented 6 years ago

There are likely to be a lot of other compatibility issues but it's likely to actually run now.

BaccarWozat commented 6 years ago

Used key on new CC world in the (vanilla) nether. Same result-- nothing appeared. Went back to (CC) overworld and returned to nether, still nothing there. Used sonic screwdriver in nether and game froze as before.

Spectre0987 commented 6 years ago

I'm a bit confused. Who's issue is this?

Spectre0987 commented 6 years ago

@BaccarWozat Avoid using the key in a dimension that doesn't have a sky. I'm working on a fix for that.

BaccarWozat commented 6 years ago

0.0.4a works with Cubic Chunks build 852. Had no trouble spawning in a Tardis in a new world and entering/leaving it. Don't know if it will work 100% outside vanilla bounds but it's good for now.