CommandsCompat

Cross-version seam for Commands#performPrefixedCommand(CommandSourceStack, String).

Renamed at 1.19 (performCommand(CommandSourceStack, String) ->performPrefixedCommand(...)) and its return went int ->void at the 1.20.2 command-execution rewrite — both INSIDE the 1.18.2 node's declared [1.18.2, 1.20.5), so no single compiled call site spans it. Bind reflectively, discard the return.

Matched by parameter types, not name: name strings aren't reobf'd (so "performPrefixedCommand" stays mojmap and misses on Fabric intermediary / Forge Mixed-SRG), while the parameter Class references are. (CommandSourceStack, String) uniquely identifies the method on Commands, and 1.18.2's pre-rename performCommand carries the identical signature, so one match spans the rename too. The return type is excluded from the match — it is exactly what differs across the range.

Properties

Link copied to clipboard
private val method: Method?

null if this runtime has no (CommandSourceStack, String) method on Commands, or if resolution threw.

Functions

Link copied to clipboard
fun performPrefixedCommand(commands: Commands, source: CommandSourceStack, command: String): Boolean

Invoke performPrefixedCommand(source, command) on commands, discarding its version-dependent return value. command is passed through as-is (the vanilla method tolerates a leading / either way).

Link copied to clipboard
private fun resolve(): Method?