70CentsApple / ChatTools

Chat Tools 一个 Minecraft Fabric 辅助模组 | A Fabric client-side Minecraft Mod
GNU General Public License v3.0
13 stars 4 forks source link

`java.lang.NoSuchMethodError` thown on 1.20(.1) when activating Repeat Key #16

Closed 70CentsApple closed 9 months ago

70CentsApple commented 9 months ago

Bug description

When we use Repeat feature on Minecraft 1.20 or 1.20.1, java.lang.NoSuchMethodError will be thrown and it crashes the whole game.

Steps to reproduce

  1. Set a Repeat Key
  2. Activate the Repeat Key

Expected behavior

Repeat my last message.

Actual behavior

The game crashes.

Relevant logs

No response

Minecraft version

1.20; 1.20.1

Mod version

1.4.0.2+

Other information

Why?

https://github.com/70CentsApple/ChatTools/blob/9393597120727eb8009358ad2e045d72f195616d/src/main/java/net/apple70cents/chattools/features/chatkeybindings/Repeat.java#L24

Between versions 1.20.1 ~ 1.20.2, the return value type of getMessageHistory() changed from List to net.minecraft.util.collection.ArrayListDeque (a.k.a net/minecraft/class_8623 ), so if this code is compiled on 1.20.2+, there will be a mapping problem here on both 1.20 and 1.20.1.

在1.20.1~1.20.2两个版本之间,getMessageHistory()的返回值类型从 List 变成了 net.minecraft.util.collection.ArrayListDeque (即net/minecraft/class_8623),所以这份代码如果编译于 1.20.2+ 的版本,在 1.20 和 1.20.1 两个版本,此处会有映射问题。

How to fix it?

Solution:

解决方法:

Check list