delvr / Repose

Walkable hills in Minecraft.
https://minecraft.curseforge.com/projects/repose
6 stars 3 forks source link

Crash with CubicChunks #20

Open Rongmario opened 6 years ago

Rongmario commented 6 years ago

https://gist.github.com/Rongmario/89ae122de96ec39fe50b7b7c5953ab37

Barteks2x commented 6 years ago

The issue comes from the fact that the mod seems to be replacing EntityFallingBlock#onUpdate whole, with a version written in scala and slightly modified. I'm relying on this Slice:

            slice = @Slice(
                    from = @At(value = "CONSTANT:ONE", args = "intValue=100"), // between this.fallTime > 100
                    to = @At(value = "CONSTANT:FIRST", args = "stringValue=doEntityDrops") // and this.world.getGameRules().getBoolean
                    // ("doEntityDrops")
            ))

to target constant "1" and replace it within that slice. If you make the slice not exist or change it's form too much, it won't work (relevant mixin https://github.com/OpenCubicChunks/CubicChunks/blob/9e8a74e95fa93912b6e2b06c5a5f58dcd51c766c/src/main/java/cubicchunks/asm/mixin/fixes/common/MixinEntityFallingBlock_HeightLimits.java#L56-L78)

Apparently it's not that. The issue is the way this mod replaces method, as I understand it, is not by replacing the actual methods code, but by replacing calls to these methods, which obviously is going to break things that attempt to target them in any way. CubicChunks does it to "wrap" the method, so if your mod just replaced the method whole by replacing it's bytecode, it would work just fine. And the above described "wrong" part still applies but differently: cubic chunks will happily patch the original onUpdate, which will never be called, leading to silent failures. Making other mods fail silently for no good reason isn't good.

delvr commented 6 years ago

@Barteks2x you got it right - Farseek replaces method calls instead of method bodies. In almost all cases the replacement method includes a call to the original (somewhat analogous to a super call in an overridden method) but not in this particular case. I'll see if I can fix this on my end to restore compatibility.

delvr commented 6 years ago

I just released Farseek 2.3 and Repose 1.6 which if used together should be compatible with OpenCubicChunks (tested with builds 835 and 845). The change turned out to be much more complicated than I thought and involved moving class transformers around, but it does make Farseek mods more compatible with Sponge mixins in general. Please give it a try and let me know if you still encounter errors.

Rongmario commented 6 years ago

Unfortunately with new versions of Farseek + Repose I crash with CC845 :( https://paste.ee/p/KLGvs

delvr commented 6 years ago

Aw, that's unfortunate. :( I see you have a ton of mods loaded so I'm not sure I'll be able to reproduce your crash, but I'll look into it and get back to you.

Rongmario commented 6 years ago

No worries, we can work closely if you have the heart and time heh :)