Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Nyan-Work#45 #1

Closed

Conversation

wendavid552
Copy link

@wendavid552 wendavid552 commented Sep 19, 2024

Nyan-Work#45 中有两个bug:

与sodium不兼容,启动时出问题

实际上是因为调用@WrapOperation的时候使用了magiclib@WrapOperation而没有使用Operation

ModMenu的界面中滚动时会崩溃

实际上是与Lithium的不兼容导致的。在Lithium中会提前调用getCollisionShape()的函数,而在OMMC关于脚手架上禁止往下的功能中注入了这个函数,函数开头调用了Configs,这时并没有初始化MinecraftClient,因此对应的handler里初始时获取到的是null值,从而会导致崩溃。

值得注意的是,这个修复的commit实际上比较hacky,可算是临时性的修复。进一步修复可能需要更改上游magiclib的相关函数。

目前还有一些bug:

sortInventory复制tag时tag可能为空

.copyTags()时可能本身DataComponents就是空的

Lithium will invoke the getCollisionShape() before the client instant is initialized. This is a hacky fix, preventing the calls to Configs.
@wendavid552 wendavid552 changed the title Fix https://github.com/Nyan-Work/oh-my-minecraft-client/issues/45 Fix #45 Sep 19, 2024
@wendavid552 wendavid552 changed the title Fix #45 Fix Nyan-Work#45 Sep 19, 2024
@@ -36,7 +36,7 @@ public class MixinScaffoldingBlock {
)
private void setNormalOutlineShape(BlockState state, BlockGetter world, BlockPos pos,
CollisionContext context, CallbackInfoReturnable<VoxelShape> cir) {
if (Configs.disableMoveDownInScaffolding.getBooleanValue() && context.isDescending() &&
if (context.isDescending() && Configs.disableMoveDownInScaffolding.getBooleanValue() &&
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个修复方法属于是专供lithium的,这里出bug的原因是lithium会提前调用该函数做缓存(PathNodeCache相关),然后以前的代码调用Config的时候顺带把malilib的也初始化了,可以通过给malilib那个onScroll之类的打断点看,lithium在客户端时因为这块代码是混合的所以一并调用了,进而导致在客户端没初始化的时候先把handler实例初始化了,这里面恰好当时就有一个获取当前客户端实例的操作。

另一个修复方法是检查context里是不是关于AbstractClientPlayer的,至少能判断是不是已经进行到客户端阶段了。

@wendavid552 wendavid552 deleted the branch SkyDynamic:nyan-work/dev September 22, 2024 14:33
@wendavid552 wendavid552 deleted the nyan-work/dev branch September 22, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant