Backport 26.1 compatibility updates to 1.20.1#207
Open
rsdadada wants to merge 6 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.
Overview
26.1/devthat are reasonable for Minecraft 1.20.1, Java 17, and the Forge + Fabric architecture, based on the actualorigin/1.20.1...HEADdiff.0.7.8-beta.Behavior and Configuration Changes
swimOutTickto the more generaloutTick, used for delaying main-feature recovery after leaving a restricted state. The old config field is kept as a deprecated migration entry point; when old configs are read, the old value is migrated ifoutTickis still at its default value, then the old field is cleared.disableWhenCrawlingfor bind mode. Swimming and crawling now share the sameoutTickdelay logic. Classic mode still only syncs the swimming exit delay and does not add a crawling toggle.disableConfigsubcategory: sneaking, crawling, swimming,outTick, held-item main-feature disable, and held-item rendering disable.DisableHelperfrom the swimming-specificswimmingRecentlypath intocheckCondition, and changed wildcard\\*+splitting to use the precompiledPattern MULTI_STAR.BindTarget.vanillaTarget's defaultdisablingDepthfrom0.1fto0.2f;BindTargetnetwork/JSON fields andserialVersionremain unchanged.Binding, Render Capture, and Caching
RenderTypeCacheto centrally manage the texture ID cache and primitive cache, using GuavaLoadingCachewithmaximumSizeandexpireAfterAccessso long-running sessions do not leave staticHashMaps growing without bounds.CompositeRenderType -> CompositeState -> textureState -> cutoutTexture(). It no longer parsesRenderType.toString()with a regex. For RenderTypes whose texture cannot be extracted, it still falls back torenderType.toString()as an identifier.realcamera-common.mixins.jsonandrealcamera.accesswidener.RenderType -> Map<UV, float[]>shape toPrimitiveLayoutKey -> Object2IntMap<UV>, caching the primitive index for each UV. The missing default value is-1.PrimitiveLayoutKeyadditionally includes texture/render type, draw mode, vertex layout, vertex/primitive count, and mesh ordinal on 1.20.1. This adapts to the older rendering segmentation, where different meshes can share the same RenderType, and avoids incorrectly reusing the coarser 26.1-style cache.mode(),vertexLayoutHash(),readPrimitiveAt(int),primitiveLength, andprimitiveCounttoIterableVertexBuffer, allowing cache hits to read primitives directly by index.BuiltIterableBuffer.resolvePrimitives()now tries cache hits first, then scans only missing UVs. If a cached index is out of bounds or the primitive read from it no longer contains the target UV, it invalidates the current layout cache and falls back to scanning.allCached/uvFingerprintpath. UV fingerprints are no longer built for every buffer; stale cache entries are handled through read validation and layout-cache invalidation.YSM and Model Capture
YSMCompatstill fundamentally simulates 4 player head rotations to match Yes Steve Model binding points; the core idea of matching by simulated head rotation is unchanged.TransformedVertexRecorderits ownMultiVertexCatcher: the first render pass captures buffers and tries cache hits, while the fallback phase reuses those captured buffers to scan missing primitives. Cache misses no longer trigger extra entity renders.resultMap.computeIfAbsentinYSMCompatto the method-reference style and narrowed the recorder into a private final class.create(),clear(), andforEachBuffer()toMultiVertexCatcher; the oldendCatching()is kept as atry/finallywrapper to preserve the original "iterate, then release" semantics.RealCameraCore.computeCamera,RealCameraCore.renderCameraEntity, andModelAnalyser.updateModelto explicitly clean up catchers withtry/finally, preventing captured meshes from leaking on exceptional paths.Geometry Checks and Model View
java.awt.Polygondependency fromBuiltIterableBufferandModelAnalyser, replacing it withMathUtil.pointInTriangle/pointInQuadandVertexData.containsUV/containsXY.cross, triangle/quad hit tests, fixed-argumentfloor/ceilhelpers toMathUtil, and changedprojectToVec2to takeMatrix4fc.VertexData.ImmutableVertex.asImmutable()now directly returns itself;MutableVertexwas extracted from an innerVertexDataclass into a top-level class, reducing implementation weight inside the interface and aligning more closely with the 26.1 structure.ModelAnalyser.focusedPolyhedronprivate and exposedgetFocusedPolyhedron(), replacedObject[]with theZEntryrecord, and usedLongOpenHashSetquantized vertex keys to expand adjacent primitives.vertex.z() + deltaZ; it does not mechanically adopt the sign change from the 26.1 coordinate convention.Polygon.GUIHelperfinal and synced method names to the shorteroutline,triangleOrQuad, andvectorforms.GUI Structure and Key Bindings
com.xtracr.realcamera.gui.componentspackage:TexturedButton -> SimpleIconButton,CyclingTexturedButton -> CycleIconButton, and movedDoubleSlider/NumberFieldas well.NumberWidgetPair, combining an offset/rotation input field and slider into one component.ModelViewScreenno longer maintains 6 duplicated field + slider pairs.KeyMappingsnow uses the newkey.category.xtracr_realcamera.generalcategory key, and key handling savesConfigFile.save()once after any key is consumed during a handle pass instead of saving inside each individual click branch.Resources and Metadata
.github/ISSUE_TEMPLATE/bug_report_cn.ymlandbug_report_en.yml.config.option.*.disableConfig,disableWhenCrawling,outTick,config.tooltip.*.outTick,key.category.*.general, andscreen.widget.*.modelView_currentConfig.config.option.*.swimOutTick,config.tooltip.*.swimOutTick,screen.widget.*.modelView_copy,modelView_paste,screen.tooltip.*.modelView_copy, andmodelView_paste.Explicitly Not Backported
mod_versionto0.7.8-beta.RenderSetup,extractEntity,submit,SubmitNodeStorage, or newer renderer package structure. Those rendering APIs do not exist in 1.20.1, so this PR only backports the ideas of post-capture reuse and cache-hit-first lookup.RealCameraConfigstructure. This PR only performs field migration and UI grouping to avoid expanding 1.20.1 config-compatibility risk.UV -> float[]primitive cache. 1.20.1 uses a layout-scoped primitive-index cache to support the differences in older rendering segmentation.Compatibility Notes
BindTarget.DisableConfigJSON and network serialization fields are unchanged; only the internal UV hit-cache structure is replaced.swimOutTickis preserved as an old config read field and migrated tooutTick; the new UI and language keys only exposeoutTick.RenderType.toString()regex; fallbacktoString()is only used as an identifier for RenderTypes whose texture cannot be extracted.Verification
.\\gradlew.bat buildcommon:compileJavafabric:validateAccessWidenerforge:validateAccessWidenergit diff --checkallCached,uvFingerprint,RenderType -> Map<UV, Integer>RenderTypeUtil, old button class names,VertexData.MutableVertex, AWTPolygon