将 26.1 兼容更新回移到 1.20.1#207
Open
rsdadada wants to merge 5 commits into
Open
Conversation
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.
概要
origin/1.20.1...HEAD的实际 diff,将26.1/dev中可在 Minecraft 1.20.1、Java 17、Forge + Fabric 架构下合理成立的行为和内部实现回移到1.20.1。行为与配置变更
swimOutTick重命名为更通用的outTick,用于“退出限制状态后延迟恢复主功能”;旧配置字段保留为 deprecated 迁移入口,读取旧配置时在outTick为默认值时迁移旧值并清空旧字段。disableWhenCrawling;游泳和爬行共用同一套outTick延迟逻辑。经典模式仍只同步游泳退出延迟,不新增爬行开关。disableConfig子分类:潜行、爬行、游泳、outTick、手持物品禁用主功能、手持物品禁用渲染。DisableHelper把游泳专用swimmingRecently泛化为checkCondition,并把 wildcard 中的\\*+split 改为预编译Pattern MULTI_STAR。BindTarget.vanillaTarget的默认disablingDepth从0.1f同步为0.2f;BindTarget的网络/JSON 字段和serialVersion保持不变。绑定、渲染捕获与缓存
RenderTypeCache,集中管理 texture id cache 和 primitive cache,使用 GuavaLoadingCache设置maximumSize和expireAfterAccess,避免长期运行时静态HashMap无限增长。CompositeRenderType -> CompositeState -> textureState -> cutoutTexture();不再用正则解析RenderType.toString()。对于无法提取 texture 的 RenderType,仍保留renderType.toString()作为兜底标识。realcamera-common.mixins.json和realcamera.accesswidener中声明 1.20.1 所需访问权限。RenderType -> Map<UV, float[]>改为PrimitiveLayoutKey -> Object2IntMap<UV>,缓存 UV 对应的 primitive index;缺失默认值为-1。PrimitiveLayoutKey在 1.20.1 上额外包含 texture/render type、draw mode、vertex layout、vertex/primitive count 和 mesh ordinal,用来适配旧渲染分段下“同 RenderType 不同 mesh”的情况,避免错误复用 26.1 风格的粗粒度 cache。IterableVertexBuffer新增mode()、vertexLayoutHash()、readPrimitiveAt(int)、primitiveLength和primitiveCount,让 cache hit 可以直接按 index 读取 primitive。BuiltIterableBuffer.resolvePrimitives()先尝试 cache hit,再只扫描缺失 UV;如果缓存 index 越界或读取出的 primitive 不再包含目标 UV,则失效当前 layout cache 并回退扫描。allCached/uvFingerprint路径,不再为每个 buffer 构造 UV fingerprint;stale cache 通过读取校验与 layout cache 失效处理。YSM 与模型捕获
YSMCompat的本质仍是模拟 4 组玩家头部旋转来尝试匹配 Yes Steve Model 的模型绑定点,没有改变“模拟头部转动匹配”的核心思路。TransformedVertexRecorder持有自己的MultiVertexCatcher:第一轮渲染并尝试 cache 命中,fallback 阶段复用同一批 captured buffers 扫描缺失 primitive,不再因为 cache miss 额外重复渲染实体。YSMCompat中resultMap.computeIfAbsent改为方法引用风格,并将 recorder 收窄为私有 final 类。MultiVertexCatcher新增create()、clear()、forEachBuffer()生命周期接口;旧endCatching()保留为try/finally包装,兼容原有“遍历后释放”语义。RealCameraCore.computeCamera、RealCameraCore.renderCameraEntity、ModelAnalyser.updateModel改为显式try/finally清理 catcher,防止异常路径泄漏 captured mesh。几何判断与模型视图
BuiltIterableBuffer和ModelAnalyser中的java.awt.Polygon依赖,改用MathUtil.pointInTriangle/pointInQuad与VertexData.containsUV/containsXY。MathUtil新增cross、三角形/四边形命中判断、固定参数floor/ceil工具,并将projectToVec2参数类型改为Matrix4fc。VertexData.ImmutableVertex.asImmutable()直接返回自身;MutableVertex从VertexData内部类提取为顶层类,减少接口内部实现膨胀并贴近 26.1 结构。ModelAnalyser将focusedPolyhedron改为私有字段并提供getFocusedPolyhedron(),用ZEntryrecord 替代Object[],并用LongOpenHashSet的量化顶点 key 扩展相邻 primitive。vertex.z() + deltaZ,不机械采用 26.1 坐标约定下的符号变化。GUIHelper改为 final,并将方法名同步为更短的outline、triangleOrQuad、vector。GUI 结构与按键
com.xtracr.realcamera.gui.components包:TexturedButton -> SimpleIconButton,CyclingTexturedButton -> CycleIconButton,DoubleSlider/NumberField同步迁移。NumberWidgetPair,把 offset/rotation 的输入框与 slider 组合为一个组件,ModelViewScreen不再维护 6 组重复的 field + slider 字段。KeyMappings使用新的key.category.xtracr_realcamera.general分类键,并把按键处理中的ConfigFile.save()从每个 click 内部改为一次 handle 中有按键消费后统一保存。资源与元数据
.github/ISSUE_TEMPLATE/bug_report_cn.yml和bug_report_en.yml。config.option.*.disableConfig、disableWhenCrawling、outTick、config.tooltip.*.outTick、key.category.*.general、screen.widget.*.modelView_currentConfig。config.option.*.swimOutTick、config.tooltip.*.swimOutTick、screen.widget.*.modelView_copy、modelView_paste、screen.tooltip.*.modelView_copy、modelView_paste。明确不回移
mod_version=0.7.7-beta或任何 Gradle 构建版本改动;1.20.1 构建仍保持当前分支版本。RenderSetup、extractEntity、submit、SubmitNodeStorage或新版 renderer 包结构;1.20.1 缺少这些渲染 API,本 PR 只回移“捕获后复用”和“cache hit 优先”的思路。RealCameraConfig顶层配置结构;当前 PR 只做字段迁移和 UI 分组,避免扩大 1.20.1 配置兼容风险。UV -> float[]primitive cache;1.20.1 使用 layout-scoped primitive index cache 来兼容旧渲染分段差异。兼容性说明
BindTarget.DisableConfig的 JSON 和网络序列化字段不变,只替换内部 UV 命中缓存结构。swimOutTick作为旧配置读取字段保留并迁移到outTick;新 UI 和语言键只暴露outTick。RenderType.toString()正则;fallbacktoString()只用于无可提取 texture 的 RenderType 标识。验证
.\gradlew.bat buildcommon:compileJavafabric:validateAccessWidenerforge:validateAccessWidenergit diff --checkallCached、uvFingerprint、RenderType -> Map<UV, Integer>RenderTypeUtil、旧 button 类名、VertexData.MutableVertex、AWTPolygon