Skip to content

Commit fe3f2ec

Browse files
committed
Display error message if using evaluator when not debugging
1 parent 7294267 commit fe3f2ec

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
66

77
## [UNRELEASED]
88

9+
### Changed
10+
11+
- A message is now displayed if attempting to use an Evaluator when not debugging, instead of silently failing.
12+
913
### Fixed
1014

1115
- The Evaluator was unable to cast any spells requiring media.

Common/src/main/kotlin/gay/object/hexdebug/items/ItemEvaluator.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import gay.`object`.hexdebug.casting.eval.EvaluatorCastEnv
1111
import gay.`object`.hexdebug.utils.itemPredicate
1212
import net.minecraft.client.player.LocalPlayer
1313
import net.minecraft.client.renderer.item.ClampedItemPropertyFunction
14+
import net.minecraft.network.chat.Component
1415
import net.minecraft.server.level.ServerPlayer
1516
import net.minecraft.stats.Stats
1617
import net.minecraft.world.InteractionHand
@@ -36,6 +37,7 @@ class ItemEvaluator(properties: Properties) : ItemStaff(properties) {
3637
val debugAdapter = DebugAdapterManager[player]
3738
val debugger = debugAdapter?.debugger
3839
if (debugAdapter == null || debugger == null) {
40+
player.displayClientMessage(Component.translatable("text.hexdebug.no_session"), true)
3941
return InteractionResultHolder.fail(itemStack)
4042
}
4143

Common/src/main/resources/assets/hexdebug/lang/en_us.flatten.json5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
hexdebug: {
1111
no_client: "Debug client is not connected.",
1212
connected: "Debug client connected!",
13+
no_session: "No debug session is running.",
1314
thwack: "Thwack!",
1415
},
1516

0 commit comments

Comments
 (0)