📎
1 file
4,424 chars
📄
pasted-code-1794228972004.txt
txt
43 lines
▶
pasted-code-1794228972004.txt
txt
43 lines
• Game Version: 1.21.11 (Mounts of Mayhem)
• Platform: Fabric (Strictly Client-side mod)
• Project Name: FaceLock (An automated cinematic camera positioning tool)
🎯 Core Objective
Create a client-side helper tool to automate character movements for recording in-game cinematic content. The mod must continuously lock the user's character to a specific point relative to another selected player (the recording target).
🛠 Functional Requirements
1. Control Interface and Command Navigation
• System Activation: Triggered via a client-side chat command marker: #target1 [player_name].
• Autocomplete System: While typing this line, a dynamic dropdown list/suggestion box containing the names of all online players on the server (extracted from the current Tab-list or client render distance) must appear for quick selection.
• System Deactivation: Triggered via the chat marker: #stop1. This command must instantly disable the automated mode and immediately return standard manual control to the user.
2. High-Precision Positioning Geometry ("Face-to-Face Close-up")
• Vector Calculation: The mod must continuously calculate the exact coordinates and look direction vectors (Yaw/Pitch) of the target player.
• Maximum Density Positioning: The user's character must automatically move to a point located strictly along the target player's line of sight, at the minimum possible distance (0.1–0.2 meters) right in front of their eyes. The character must stay extremely close, completely "face-to-face" with the target.
• Camera Synchronization: The user's camera must automatically rotate 180 degrees relative to the target's look direction to simulate an "extreme close-up" shot (eye-to-eye). The user's character must mirror all head rotations of the target instantly and perfectly without any visible latency.
3. Dynamic Movement Physics and Server Plugin Compatibility
• Velocity Vector Control: Movement must be processed by dynamically altering the character's movement velocity vectors (velocity).
• Full Compatibility with Speed Plugins (e.g., /speed 10 and /flyspeed 10):
• The movement algorithm must not have hardcoded upper speed limits or thresholds.
• The mod must dynamically fetch the character's currently available speed attribute, inherited from any external factors: server-side plugins (Essentials, Custom Speed plugins), client mods, or active potion effects (scaling up to extreme values like 1000). If speed 10 is active on the server, the mod must utilize this maximum potential to fly towards the target as fast as possible.
• Hybrid Movement Mode (Keyboard Input Emulation):
• If direct modification of velocity vectors fails or gets blocked by server anticheats, the mod must feature an alternative (or combined) mode: automated W key (Forward) emulation.
• In this mode, the user can manually hold down the W key, while the mod calculates the trajectory on a micro-level, intercepting input, perfectly timing when to "press" or "release" the movement key, and applying strafe corrections (A/D) so the character flies flawlessly toward the target.
4. Automated Flight Synchronization
• Smart Takeoff (Double Spacebar): If the target player takes off (enters creative flight mode or activates an Elytra) while the user's character is grounded, the mod must automatically simulate a rapid double-tap of the "Spacebar" (the vanilla mechanic to toggle flight). Once airborne, the mod switches to a 3D aerial pursuit mode.
• Access Permissions: Flight synchronization occurs under the condition that the user has flight permissions on the server (Creative mode or /fly enabled).
5. Distance Handling and Out-of-Bounds Commands
• Distance Verification: The mod must check the exact distance between the two players on every single game tick. The maximum operational range is 200 blocks.
• Emergency Response on Target Loss: If the target player suddenly teleports, speeds away, or completely disappears beyond the 200-block radius, the position-locking mechanic is temporarily suspended.
• During that exact tick, the mod must automatically execute a standard server command: /top [target_player_name] (the name of the player selected for the recording session). This command must be sent to the chat input field exactly as if the user typed it and pressed Enter themselves. Once the target returns to the active radius, the mod must immediately resume the "face-to-face" close-up lock.
KodariNov 9 at 1:01 pm 3
FaceLock
FaceLock is a client-side Fabric mod for Minecraft 1.21.11 that automates cinematic camera positioning. It locks the user's character face-to-face with a selected target player, continuously calculating target coordinates and look vectors to maintain an extreme close-up position at 0.1-0.2 meters distance. The mod dynamically adjusts velocity vectors, supporting extreme server speed plugins without hardcoded limits, and includes hybrid keyboard emulation with W-key timing and A/D strafe corrections. It features smart double-spacebar takeoff detection, 200-block operational range with automatic /top command execution on target loss, and full command interface via #target1 and #stop1 chat markers with player autocomplete.
Create a Fabric 1.21.11 client-only scaffold with split client sources.
Add
#target1/#stop1chat handling and online-player dropdown suggestions.Implement tick-based close-up tracking, 200-block loss handling with
/top, and authorized takeoff key taps.Use locally synchronized movement/fly speed; a client cannot read arbitrary plugin settings or override server-side collision and movement validation.
[Generation stopped]
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 332
src/client/java/com/kodari/facelock/FaceLockClient.java
package com.kodari.facelock;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.message.v1.ClientSendMessageEvents;
public final class FaceLockClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
ClientSendMessageEvents.ALLOW_CHAT.register(FaceLockController::allowChatMessage);
ClientTickEvents.END_CLIENT_TICK.register(FaceLockController::tick);
}
}