Fix versioncheck - #66
Open
HotWaterFlask wants to merge 4 commits into
Open
Conversation
Minecraft 26.2 version support
修复内容(3 个文件)
NetMinecraft.java#L305-L306 — 新增枚举:
Java
/** {@code net.minecraft.world.entity.monster.cubemob} */
WORLD_ENTITY_MONSTER_CUBEMOB(WORLD_ENTITY_MONSTER, "cubemob"),
PaperRemappedAccessor_v1_21_6.java#L66-L77 — 新增 getMagmaCubeClass() 辅助方法,优先尝试旧包,失败后 fallback 到 cubemob 新包;两处 WORLD_ENTITY_MONSTER.getClass("MagmaCube") 替换为 getMagmaCubeClass()
PaperRemappedAccessorLegacy.java#L65-L76 — 同样的 fallback 处理
兼容性说明
GlowEntity(ScriptViewer 发光可视化)使用 Bukkit API 的 org.bukkit.entity.MagmaCube,该接口在 26.2 中依然存在(setSize 从 Slime 移到 AbstractCubeMob),无需修改
旧版本(≤1.21.x)会命中 WORLD_ENTITY_MONSTER 路径,新版本(26.2+)命中 cubemob 路径,两者兼容
…t.resources.Identifier(MC 1.21.11 起的全局改名),导致方案 2 反射失败。
更新 PaperRemappedAccessor_v1_21_6.java#L350-L365 和 PaperRemappedAccessorLegacy.java#L349-L364:
Java
// 先尝试 Identifier(1.21.11+ / 26.x)
identifierClass = Utils.getClassForName("net.minecraft.resources.Identifier");
// 失败再回退 ResourceLocation(1.21.10 及更早)
现在的完整 fallback 链
EntityType.MAGMA_CUBE 静态字段(≤1.21.10)
BuiltInRegistries.ENTITY_TYPE.getValue(Identifier.parse("minecraft:magma_cube"))(26.x,Identifier)
BuiltInRegistries.ENTITY_TYPE.getValue(ResourceLocation.parse(...))(1.21.11 前兜底)
CraftEntityType.bukkitToMinecraft(EntityType.MAGMA_CUBE)(CraftBukkit 桥接兜底)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
解决McVersion 静态初始化时调用 Version.of(...) 解析当前 MC 版本字符串,Integer.parseInt("") 抛异常,导致整个类初始化失败(ExceptionInInitializerError)。也就是说它解析 "26.2" 这种新版号格式时取到了空字符串(老插件通常按 1.x.x 三段式硬解析,26.2 只有两段,某段下标越界取到空的问题。
【McVersion 静的初期化時に Version.of(...) を呼び出して現在の MC バージョン文字列を解析する際、Integer.parseInt("") が例外を投げ、クラス全体の初期化が失敗する(ExceptionInInitializerError)。つまり、"26.2" のような新しいバージョン番号形式を解析する際に空文字列を取得してしまう(古いプラグインは通常 1.x.x の3セグメント形式でハードコード解析するが、26.2 は2セグメントしかないため、あるセグメントの添字が範囲外になり空文字を取得する)】問題が解決された。