Skip to content
Projetos

Sobre

Version specific implementations of the HeadlessMc runtime.

Jogos e emulação

Como estes números são medidos

Crescimento medido de estrelas

em 24 h
0
em 7 dias
0
em 15 dias
0
em 1 mês
Coletando histórico

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

HMC-Specifics

Version specific implementations of the HeadlessMc runtime.

logo

Mc-Runtime-Test | HMC | HMC-Specifics | HMC-Optimizations

CodeFactor GitHub All Releases GitHub Github last-commit

Version specific implementations of the HeadlessMc runtime. Just place the jar for your version in your mods folder. Then you need to find a way to send commands to your running Minecraft game. The easiest way is probably to just launch it with HeadlessMc. The -commands flag is not required for HeadlessMc in that case.

Name Description Args/Flags
gui Lists all currently displayed gui elements.
click Clicks an element on Minecrafts screen. <id/p> <x> <y> <button> -enable
text Sets the contents of a text field. <id> <text>
menu Opens the ingame menu.
quit Quits the game.
render Dumps all strings rendered by Minecrafts FontRenderer. <time> -f -t
close Closes the menu if ingame.
connect Connects you to a server. <ip> <port>
disconnect Disconnects you from a server.
respawn Respawns you if you are dead. respawn auto toggles AutoRespawn. <now/auto/status> <on/off>
metrics Displays metrics, e.g. TPS, ping, players, FPS, memory. metrics tps ping selects metrics by name, group or last part of the name. <metric...> --list --json
screenshot Saves a screenshot, only if the game renders (not in HeadlessMc's headless mode). <file> --timeout
account Manage accounts, alias auth, login is a shortcut for account login. Subcommands: login, list, select, remove, refresh, current, token, autorefresh -p <provider>
msg or . Sends a chat message. <message>
/ Sends a chat command. <command>

You can find a good example on how to use these commands here.

The HMC-Specifics currently support the following Minecraft versions and modloaders:

Version Forge Fabric NeoForge
26.1 - 26.3 ✅ ✅ ✅
1.21 - 1.21.11 ✅ ✅ ✅
1.20.6 ✅ ✅ ✅
1.19.4 ✅ ✅ —
1.18.2 ✅ ✅ —
1.17.1 ✅ ✅ —
1.16.5 ✅ ✅ —
1.12.2 ✅ ✅ —
1.8.9 ✅ ✅ —
1.7.10 ✅ ✅ —

AutoRespawn

respawn auto toggles AutoRespawn, respawn auto on|off turns it on or off, and respawn status shows whether it is on. To turn AutoRespawn on when the game starts, launch the game with -Dhmc.respawn.auto=true.

Adding commands from your own mod

HMC-Specifics uses picocli commands. To add your own, write a picocli command and list it in a file called META-INF/hmc-specifics-commands in your mod jar, one class name per line. Subcommands of existing commands are prefixed with the names of their parent commands:

com.example.MyCommand
account com.example.MyAccountSubCommand

Commands are instantiated with a constructor that takes a me.earth.headlessmc.mc.commands.MinecraftContext, or with a no-arg constructor. If your command (or e.g. its completionCandidates) needs anything else, implement me.earth.headlessmc.mc.commands.CommandFactory and register it in META-INF/services/me.earth.headlessmc.mc.commands.CommandFactory. Implement me.earth.headlessmc.mc.commands.ScheduledCommand if your command needs to run on Minecraft's main thread. If HMC-Specifics is not installed, these files are simply ignored.

To execute commands from your own mod, e.g. from a web interface, use the context HMC-Specifics reads commands with and capture the output:

CapturingConsole output = new CapturingConsole();
MinecraftContext.getInstance().execute("metrics tps", output).get(10, TimeUnit.SECONDS); // also waits for ScheduledCommands
String text = output.getOutput();

Metrics

The metrics command displays values collected from the client, e.g. server.tps (estimated from the game time the server sends every second), server.ping, players.list, client.fps, client.mspt, world.*, player.* and jvm.*. Use metrics --list to list all metrics. Other mods can access them through me.earth.headlessmc.mc.metrics.MetricsService.getInstance(), most metrics have to be collected on Minecraft's main thread:

MetricsService metrics = MetricsService.getInstance();
Future<Map<String, Object>> values = minecraft.schedule(() -> metrics.collect(metrics.select("server.tps", "players")));

Register your own metrics with MetricsService#register(Metric.of(name, description, supplier)), or implement me.earth.headlessmc.mc.metrics.MetricsProvider and list it in META-INF/services/me.earth.headlessmc.mc.metrics.MetricsProvider. The raw, typed values are available through Minecraft#getMetricsSource() and MetricsTracker.getInstance().

Screenshots

The screenshot command saves the last rendered frame as a PNG, screenshots/hmc_<time>.png by default. This needs a game that renders, e.g. a normal window or a virtual display like Xvfb. In HeadlessMc's headless mode nothing is rendered, so screenshots are disabled. The detection can be overridden with -Dhmc.screenshots.enabled=true or false. Other mods can take screenshots from any thread:

CompletableFuture<byte[]> png = Screenshots.take(minecraft);

The PNG is encoded off the main thread, so taking screenshots regularly does not make the game stutter.

Explore projetos relacionados

Carregando…