ou are an expert Minecraft Mod Developer specializing in Fabric API for version 1.21.x. Your task is to design and generate code for a mod named "Autowork" (also known as "AutoBeam").
Mod Overview
- Name: Autowork by TOX
- Version: 1.21.x
- Loader: Fabric
- Type: Utility/Automation Mod
Core Features & Logic
1. Keybinding System
- Implement a customizable keybinding via
FabricKeyBinding or standard Minecraft keybind registry. - The key should open the main GUI when pressed.
- Optional: Add a secondary keybind for quick-toggling specific features if needed.
2. Main GUI Interface
Create a simple custom screen (using Screen class) with the following controls:
- AutoAI Chat: ON/OFF toggle. - AutoActions: ON/OFF toggle.
- Status Indicator: Show current state (Active/Inactive).
- Settings Button: To configure keybinds or other options.
3. Feature: AutoAI Chat
- Trigger: When enabled, the mod detects when the player is looking at another entity (player/NPC).
- Logic:
1. Detect target entity within render distance. 2. Send a pre-defined message from the user's input list. 3. Simulate typing delay to appear human-like. 4. Wait for response (optional advanced feature, but basic version just sends messages).
- Customization: Allow users to add multiple chat messages in settings.
4. Feature: AutoActions (Automation)
- Trigger: When enabled, perform a sequence of actions on a targeted block or entity.
- Sequence:
1. Right Click: Interact with the target (e.g., open a door, use an item, activate a beam). 2. Crouch: Press 'Sneak' key immediately after interaction. 3. Loop: Repeat this sequence at a configurable interval (e.g., every 1-5 seconds).
- Targeting: Use Raycast to find the block/entity the player is looking at.
Technical Requirements for Fabric 1.21.x
- Use
net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper for keybindings. - Use
ScreenHandler and Container logic if building complex GUIs, otherwise stick to simple Screen overrides. - Use
ClientPlayerInteractionManager for right-click actions. - Use
Input class to simulate key presses (like Sneak/Crouch) using KeyboardInput or AbstractClientPlayerEntity. - Ensure all client-side logic is properly registered in
ClientModInitializer.
Code Structure
Provide the following files:
AutoworkMod.java (Main entry point implementing ClientModInitializer)Keybinds.java (Register keybinds)AutoworkScreen.java (The GUI)AutoTaskScheduler.java (Handles the timing for Chat and Actions)Mixin classes if necessary for injecting into client methods.
Tone
- Professional, clean code.
- Add comments explaining each section.
- Ensure compatibility with Fabric API latest version for 1.21.x.
```