ClientCommandCompat

Client-side command send, spanning the MC 1.19 "secure chat" rework by resolving the moved method reflectively at runtime. The client's command-send path was split at 1.19:

  • >=1.19 : net.minecraft.client.multiplayer.ClientPacketListener.sendCommand(String) — command WITHOUT a leading / (a dedicated, signable command packet).

  • <=1.18.2: net.minecraft.client.player.LocalPlayer.chat(String) — command sent as a chat line WITH a leading / (the server parses it).

Method names are reflective strings, so each is mapped to the runtime namespace via Mappings.

Properties

Link copied to clipboard
private const val LISTENER_MOJMAP: String
Link copied to clipboard
private const val PLAYER_MOJMAP: String

Functions

Link copied to clipboard
private fun invoke(target: Any, owner: Class<*>, ownerMojmap: String, methodMojmap: String, arg: String): Boolean

Resolved on owner, not target.javaClass: getMethod on a non-public runtime class hands back a Method whose invoke() throws IllegalAccessException even for a method declared public on a public supertype. Invocation still targets target, so an override dispatches normally.

Link copied to clipboard
fun send(mc: Minecraft, command: String): Boolean

Sends command (bare, no leading '/') to the server. @return false if neither send path was usable: no connection AND no player (menu / not connected), or an unrecognized runtime where neither method name resolved.