Skip to content

feat: add Minecraft 26.1 (Fabric) support + Extra QoL Features - #93

Open
JoshSald wants to merge 5 commits into
Octol1ttle:devfrom
JoshSald:dev
Open

JoshSald wants to merge 5 commits into
Octol1ttle:devfrom
JoshSald:dev

Conversation

@JoshSald

Copy link
Copy Markdown

Summary

  • Adds support for Minecraft 26.1 (Fabric), built against 26.1.2 (Architectury 20.1.14's minimum requirement)
  • Adds dependency coordinates for Minecraft 26.2 in versions/26.2-fabric, though only 26.1 has been built and run-tested here
  • Adds three new autopilot keybinds: an independent Auto Thrust toggle, a combined Flight Directors/Auto Thrust/Autopilot master toggle, and a new holding pattern mode
  • All changes to 1.20.1-1.21.11 are limited to the shared toolchain bump; verified those versions still build

What changed

Toolchain

  • modstitch 0.7.0-unstable -> 0.8.5 (the version that added unobfuscated-MC support, splitting the loom platform into fabric-loom-remap for existing obfuscated versions and fabric-loom for 26.1+)
  • Fabric Loom 1.14.6 -> 1.17.20, Gradle 9.2.1 -> 9.5.1, Fabric Loader 0.16.10 -> 0.19.5, Kotlin 2.2.0 -> 2.4.20 (needed for the new Java 25 target on 26.1+)
  • New versions/26.1.2-fabric and versions/26.2-fabric

HUD rendering port (Minecraft 26.1's GuiGraphics rewrite)

  • GuiGraphics -> GuiGraphicsExtractor typealias, plus Renderable.render()/hLine/vLine/drawString extension shims so most call sites don't need to change
  • extractRenderState/extractContents/extractContent stonecutter branches added where a Screen/Widget/list-entry directly overrides the renamed Mojang method
  • TypeStrictEditBox: replaced the removed EditBox.setFilter with an insertText override that reverts invalid input
  • LevelRenderer.renderLevel's matrix parameters restructured for CameraRenderState/single Matrix4fc

Projection fixes

(Found by comparing against #92 partway through debugging - see note below)

  • The single surviving Matrix4fc parameter on renderLevel is the frustum/view matrix, not projection - the real projection matrix now lives on CameraRenderState.projectionMatrix
  • ScreenSpace's viewport now reads from mc.window instead of the stale GL viewport during 26.1's CPU-side render-state extraction phase
  • 26.x's reversed-Z depth range meant points behind the camera were mirrored back into the visible range instead of rejected; fromWorldSpace now explicitly rejects clip.w <= 0

Bug fix found during testing

  • AirDataComputer.flightPitch/flightYaw were numerically unstable at near-zero velocity (normalizing a near-zero vector amplifies floating-point noise into an arbitrary angle), which intermittently made StallComputer's pitch protection clamp far more aggressively than intended while barely moving. Falls back to look-based pitch/yaw below a small velocity threshold.

New features

  • toggle_auto_thrust, toggle_all_autopilot, toggle_holding_pattern keybinds (unbound by default, same as toggle_enabled)
  • New HoldingPatternLateralMode: holds at the flight plan's current target waypoint if one exists, otherwise at present position/heading; built on top of DirectCoordinatesLateralMode
  • HOLD option added to the Autoflight setup screen for manual fix/course entry

Relationship to #92

This was developed independently and only found #92 partway through debugging the reversed-Z projection issue - comparing against it confirmed the root cause and shape of the fix (credited in the relevant commit). There's likely overlap in ScreenSpace.kt, GuiGraphics.kt, and the GuiGraphics extension shims between the two PRs since they solve the same underlying rendering-model change; probably worth reconciling before merging both rather than merging separately.

Validation

  • :26.1.2-fabric:build succeeds; mod boots and runs in-game (HUD, mixins, and mod init all verified live)
  • :1.20.1-fabric, :1.20.1-forge, :1.21.1-neoforge, and :1.21.11-fabric verified to still compile after the shared toolchain bump
  • :26.2-fabric has researched dependency coordinates but has not been built or run

Minecraft 26.1 ships fully deobfuscated, which the existing modstitch
0.7.0-unstable/Loom 1.14.6 toolchain has no concept of. Bump modstitch
to 0.8.5 (the version that added unobfuscated-MC support, splitting
the `loom` platform into `fabric-loom-remap` for existing obfuscated
versions and `fabric-loom` for 26.1+), Loom to 1.17.20, Gradle to
9.5.1, Fabric Loader to 0.19.5, and Kotlin to 2.4.20 (needed for the
new Java 25 target on 26.1+).

Adds versions/26.1.2-fabric (26.1's second patch, since Architectury
20.1.14 requires >=26.1.2) and versions/26.2-fabric with researched
dependency coordinates. Existing 1.20.1-1.21.11 fabric versions are
updated for the platform rename only and remain otherwise untouched;
verified they still compile after the shared toolchain bump.
Minecraft 26.1 renamed GuiGraphics to GuiGraphicsExtractor and moved
from immediate-mode rendering to a CPU-side render-state extraction
model: Screen/Widget `render()` became `extractRenderState()`,
AbstractButton's override point became `extractContents()`,
AbstractSelectionList.Entry's became `extractContent()`, and
`hLine`/`vLine`/`drawString` were renamed to `horizontalLine`/
`verticalLine`/`text`. EditBox also dropped `setFilter` entirely.

Adds a `GuiGraphics` typealias (-> GuiGraphicsExtractor) and a
`Renderable.render()` extension shim so the ~20 files that just
reference the type or call `.render(...)` on a widget keep compiling
unchanged; adds `hLine`/`vLine`/`drawString` extension shims backed by
the new `fill`/`text` methods. The handful of files that directly
override a renamed Mojang method (FABaseScreen, TextOnlyButton,
CycleTextOnlyButton, EnrouteWaypointsList, SystemManagementList) get a
new `>=26.1` stonecutter branch alongside the existing ones.
TypeStrictEditBox replaces `setFilter` with an `insertText` override
that reverts invalid input, replicating the old behavior.

This is compatibility work only - no HUD behavior or appearance is
intended to change on existing versions.
Three separate issues in the world-space -> screen-space pipeline
that fed the attitude ladder, heading tape, and flight path vector,
found by comparing against Octol1ttle#92:

- LevelRenderer.renderLevel's three matrices (frustum/projection/
  culling-projection) collapsed into a single Matrix4fc parameter on
  26.1. It's the frustum/view matrix, not the projection matrix as
  first assumed - the real projection matrix now lives on
  CameraRenderState.projectionMatrix. Using the wrong matrix in the
  wrong role corrupted every downstream world-space HUD calculation.
- ScreenSpace read the GL viewport via glGetIntegerv, which is stale
  during 26.1's new CPU-side render-state extraction phase. Now reads
  mc.window's dimensions directly instead.
- 26.1 uses a reversed-Z depth range, which broke the existing
  on-screen check: points behind the camera were mirrored back into
  the visible depth window instead of being rejected, so e.g. both
  ends of the pitch-limit indicator would render regardless of actual
  camera orientation. fromWorldSpace now explicitly rejects points at
  or behind the camera plane (clip.w <= 0) before projecting.

Also stopped reading RenderSystem.getModelViewMatrix() on 26.1+, which
is equally stale during extraction - it's now taken as identity, matching
the reference fix.
flightPitch/flightYaw derive the direction of travel via
velocity.normalize(), which amplifies floating-point noise into an
essentially random angle once velocity gets close to zero (e.g.
standing on the ground, or just after landing). StallComputer feeds
that angle straight into its max-pitch protection target, so it would
intermittently clamp down to near-zero for no real reason while barely
moving. Fall back to the player's actual look-based pitch/yaw below a
small velocity threshold, where the travel-direction angle isn't
meaningful anyway.
- toggle_auto_thrust toggles Auto Thrust on its own, addressing half of
  the long-standing TODO on the old autopilot_disconnect binding
- toggle_all_autopilot flips Flight Directors, Auto Thrust, and
  Autopilot together, mirrored off the current autopilot state
- toggle_holding_pattern enters/exits a new HoldingPatternLateralMode:
  it holds at the flight plan's current target waypoint if one exists
  (via a newly-public FlightPlanComputer.getEnrouteTarget), otherwise
  at present position and heading. The mode alternates between two
  points offset from the fix to trace a racetrack, delegating the
  actual steering to DirectCoordinatesLateralMode. Also added as a
  HOLD option in the Autoflight setup screen for manual fix/course entry

All three keybinds are unbound by default, same as the existing
toggle_enabled binding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant