Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
这是一个很离谱的原因 来自于Mojang的抽象代码 也是我今天自己仔细看才找到的
所有的"假人不像真人"的问题都来自于这个
问题解析:
在之前的版本中, ServerBot#tick的调用链如下:
->ServerBot#tick
->ServerPlayer#tick
->ServerBot#doTick
注意: ServerPlayer#tick 不包括 super.tick,也就是 Player#tick 不是在这里调用的
Player#tick 来自于 ServerPlayer#tick ,也就是 ServerGamePacketListenerImpl#tick 产生的,而假人根本不会调用这个方法
而 doTick 没有调用 super 的内容,也不会调用到 Player#tick
这就导致了所有玩家相关的内容都没有被调用,自然也不像真人
修复后的调用链:
->ServerBot#tick
->ServerPlayer#tick
->ServerBot#doTick
->ServerPlayer#doTick
->Player#tick
已测试的食用和睡觉都正常工作,区块加载需要进一步测试