Skip to content

Commit 0b6cd67

Browse files
committed
Log warnings instead of crashing when Hexical is outdated (fix #62)
1 parent 5db5f78 commit 0b6cd67

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and [Pydantic's HISTORY.md](https://github.com/pydantic/pydantic/blob/main/HISTORY.md), and this project *mostly* adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [UNRELEASED]
8+
9+
### Fixed
10+
11+
- Fixed a crash when closing the Splicing Table with Hexical 1.5.0 installed ([#62](https://github.com/object-Object/HexDebug/issues/62)).
12+
713
## `0.7.0+1.20.1` - 2025-10-02
814

915
### Added

Fabric/src/main/kotlin/gay/object/hexdebug/fabric/HexDebugClientAbstractionsImpl.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@
22

33
package gay.`object`.hexdebug.fabric
44

5+
import gay.`object`.hexdebug.HexDebug
56
import gay.`object`.hexdebug.fabric.interop.FabricHexDebugHexicalInterop
67
import net.fabricmc.loader.api.FabricLoader
8+
import net.fabricmc.loader.api.Version
79
import net.minecraft.client.Minecraft
10+
import kotlin.jvm.optionals.getOrNull
11+
12+
private val HEXICAL_MIN_VERSION: Version = Version.parse("2.0.0")
13+
private var hasLoggedWarning = false
814

915
fun sendHexicalKeyEvent(client: Minecraft, keyCode: Int, scanCode: Int, isPressed: Boolean) {
10-
if (FabricLoader.getInstance().isModLoaded("hexical")) {
16+
val hexical = FabricLoader.getInstance().getModContainer("hexical").getOrNull() ?: return
17+
val hexicalVersion = hexical.metadata.version
18+
if (hexicalVersion >= HEXICAL_MIN_VERSION) {
1119
FabricHexDebugHexicalInterop.sendKeyEvent(client, keyCode, scanCode, isPressed)
20+
} else if (!hasLoggedWarning) {
21+
HexDebug.LOGGER.error("Hexical splicing table interop requires hexical>=${HEXICAL_MIN_VERSION.friendlyString}, but found ${hexicalVersion.friendlyString}. Disable Hexical interop in HexDebug's client config to suppress this message.")
22+
hasLoggedWarning = true
1223
}
1324
}

Fabric/src/main/resources/fabric.mod.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@
5757
"emi": ">=${versions.emi}",
5858
"modmenu": ">=${versions.modMenu}",
5959
"hexical": ">=${versions.hexical}"
60+
},
61+
"conflicts": {
62+
"hexical": "<${versions.hexical}"
6063
}
6164
}

0 commit comments

Comments
 (0)