▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/KrepAPI (Mod)
KrepAPI (Mod)

KrepAPI (Mod)

Fabric client bridge for servers: custom key bindings synced from the host, optional raw-key hooks for addons, and a handshake so Paper/Fabric servers can require this mod. Install only on servers that use KrepAPI. Needs Fabric API.

59
0
Все версииKrepAPI 1.1.0

KrepAPI 1.1.0

Alpha2 нед. назад

Список изменений

What's New

Raw Keyboard Capture (SERVER_RAW_CAPTURE — capability bit 1 << 2)

Servers can now instruct the client to forward raw GLFW keyboard events (key code, scancode, action, modifier mask, monotone sequence number) back to the server via the new c2s_raw_key packet.

The server sends s2c_raw_capture with a RawCaptureConfig that specifies:

  • modeOFF (0), ALL (1), or WHITELIST (2, only keys in the key list are forwarded)
  • consumeVanilla — whether the client should suppress Minecraft's own handling of captured keys
  • whitelistKeys — list of GLFW key codes (max 256) used when mode is WHITELIST

New Fabric server-side API in KrepapiFabricServerNetworking:

  • sendRawCaptureConfig(ServerPlayerEntity, RawCaptureConfig) — push a capture config to a specific player
  • registerRawKeyListener(RawKeyListener) / unregisterRawKeyListener(RawKeyListener) — subscribe to incoming c2s_raw_key events with per-listener isolation (exceptions are caught and logged per listener)

Client-side state is managed by the new RawCaptureState class. Capture is cleared automatically on disconnect.

Hardcoded-Key Intercept (INTERCEPT_KEYS — capability bit 1 << 3)

Servers can now suppress specific vanilla key behaviors that are not exposed through KeyMapping — keys like Escape, F3, Tab, F1, and F5 that Minecraft handles internally.

The server sends s2c_intercept_keys with a list of InterceptEntry records, each containing a slot ID and a blockVanilla flag:

Slot constantKeyVanilla behaviour blocked
INTERCEPT_SLOT_ESCAPE (0)EscapeOpens game/pause menu
INTERCEPT_SLOT_F3 (1)F3Toggles debug HUD
INTERCEPT_SLOT_TAB (2)TabShows player list
INTERCEPT_SLOT_F1 (3)F1Toggles HUD visibility
INTERCEPT_SLOT_F5 (4)F5Cycles perspective / chunk reload

An empty entry list clears all intercepts. Maximum 32 entries per sync.

Two new mixins implement the Escape suppression specifically: GameMenuScreenMixin cancels the keyPressed handler in GameMenuScreen, and MinecraftClientMixin cancels openGameMenu — both guard behind InterceptKeyState.blockVanillaForSlot. F3/Tab/F1/F5 are handled inside the existing KeyboardMixin path via InterceptKeyState.shouldConsumeVanillaKey.

Client-side state is managed by the new InterceptKeyState class. Intercepts are cleared automatically on disconnect.

Key Release and Repeat Events for Bound Keys

KrepapiKeyPipeline previously only dispatched events for GLFW_PRESS (action == 1). It now also dispatches for GLFW_REPEAT and GLFW_RELEASE on bound keys.

A new OVERRIDE_HELD_KEYS set tracks which keys are currently held with an active binding so that repeat and release events are only forwarded if the press was already consumed — preventing orphaned release events from leaking through. The held-key set is cleared on disconnect and when server overrides are reset.

This is a wire-transparent change (no new packets), but it is a behaviour change for existing listeners: handlers that only expected press events will now also receive repeat and release.

New Protocol Messages and Packet Types

Three new packet channels are registered in KrepapiNetworking and PayloadTypeRegistry:

ChannelDirectionPayload class
s2c_raw_captureS2CKrepapiRawCaptureS2CPayload
s2c_intercept_keysS2CKrepapiInterceptKeysS2CPayload
c2s_raw_keyC2SKrepapiRawKeyC2SPayload

The :protocol module gains four new record types (RawCaptureConfig, RawKeyEvent, InterceptEntry, InterceptKeysSync) and the corresponding encode* / decode* pairs in ProtocolMessages, with explicit size caps and input validation on decode.

Unit Tests for New Protocol Messages

ProtocolMessagesTest gains four new tests covering the new encode/decode pairs:

  • rawCaptureConfigRoundTrip — full roundtrip including whitelist keys
  • rawKeyEventRoundTrip — all five fields preserved
  • interceptKeysSyncRoundTrip — multi-entry list and blockVanilla flag
  • encodeRawCaptureRejectsTooManyKeys — verifies the 256-key hard cap is enforced at encode time

Notes

  • KrepAPI is client-side only and compatible with vanilla servers. A 1.0.x client simply won't advertise the new capability bits — the new features are silently skipped, nothing breaks.
  • Developers building on KrepAPI: check the client-advertised protocolVersion in the handshake before sending s2c_raw_capture or s2c_intercept_keys to ensure the client supports them.
  • Install a Fabric API build that matches the Minecraft version.

KrepAPI (for developers)

  • Build version (Fabric mod release / c2s_client_info.modVersion, gradle.propertiesmod_version): 1.1.0
  • Wire protocol version (KrepapiProtocolVersion.CURRENT, protocolVersion in s2c_hello / c2s_client_info): 2 — bumped because two new S2C packet channels and one new C2S packet channel were added. A 1.0.x client simply won't advertise the new capability bits (SERVER_RAW_CAPTURE, INTERCEPT_KEYS) and will not receive the new packets — nothing breaks. For developers building on top of KrepAPI: check the client-advertised protocolVersion before sending 1.1.0-only packets.

Файлы

KrepAPI-1.1.0.jar(50.09 KiB)
Основной
Скачать

Метаданные

Канал релиза

Alpha

Номер версии

1.1.0

Загрузчики

Fabric

Версии игры

1.21.4–1.21.11

Загрузок

2

Дата публикации

2 нед. назад

Загрузил

ID версии

Главная