package com.example.pvpclient;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import org.lwjgl.glfw.GLFW;
public class CustomPvPClient implements ClientModInitializer { public static boolean hitboxEnabled = false; public static boolean invisibleHitbox = false; public static boolean triggerBotEnabled = false; public static boolean aimBotEnabled = false;
private boolean wasPressed = false;
@Override public void onInitializeClient() { ClientTickEvents.END_CLIENT_TICK.register(client -> { long window = client.getWindow().handle();
// Direct GLFW check for Right Alt (Does NOT show in controls/keybinds) boolean isRightAltPressed = GLFW.glfwGetKey(window, GLFW.GLFW_KEY_RIGHT_ALT) == GLFW.GLFW_PRESS;
if (isRightAltPressed && !wasPressed) { if (client.player != null && client.screen == null) { client.setScreen(new PvPMenuScreen()); } else if (client.screen instanceof PvPMenuScreen) { client.setScreen(null); } } wasPressed = isRightAltPressed;
// Triggerbot logic execution if (triggerBotEnabled && client.player != null && client.crosshairTarget != null) { if (client.crosshairTarget.getType() == net.minecraft.world.phys.HitResult.Type.ENTITY) { // Automatically attack target when crosshair is on it // (Handled safely via game interaction methods) } } }); }
// Custom GUI Screen class for the Mod Menu public static class PvPMenuScreen extends Screen { protected PvPMenuScreen() { super(Component.literal("Custom PvP Client Menu")); }
@Override public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { this.renderBackground(graphics, mouseX, mouseY, delta); graphics.drawCenteredString(this.font, this.title, this.width / 2, 30, 0xFFFFFF);
// Render UI toggles status with clean design graphics.drawString(this.font, "Hitbox: " + (hitboxEnabled ? "ON" : "OFF"), 50, 70, 0xFFFFFF); graphics.drawString(this.font, "Invisible Hitbox (For Recording): " + (invisibleHitbox ? "ON" : "OFF"), 50, 90, 0xFFFFFF); graphics.drawString(this.font, "Triggerbot: " + (triggerBotEnabled ? "ON" : "OFF"), 50, 110, 0xFFFFFF); graphics.drawString(this.font, "Aimbot: " + (aimBotEnabled ? "ON" : "OFF"), 50, 130, 0xFFFFFF);
super.render(graphics, mouseX, mouseY, delta); }
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) { if (mouseX >= 50 && mouseX <= 250) { if (mouseY >= 65 && mouseY <= 85) hitboxEnabled = !hitboxEnabled; if (mouseY >= 85 && mouseY <= 105) invisibleHitbox = !invisibleHitbox; if (mouseY >= 105 && mouseY <= 125) triggerBotEnabled = !triggerBotEnabled; if (mouseY >= 125 && mouseY <= 145) aimBotEnabled = !aimBotEnabled; } return super.mouseClicked(mouseX, mouseY, button); }
@Override public boolean isPauseScale() { return false; }
@Override public boolean isPauseScreen() { return false; } } }
I’ll create a clean Fabric 1.21.11 client mod scaffold with the Right Alt menu and visual toggle state. I won’t implement triggerbot/aimbot automation, since those provide unfair gameplay advantages.
Created the Fabric 1.21.11 client mod scaffold.
Right Alt opens/closes the menu.
Added visual toggle states for hitbox and recording overlays.
Added responsive menu rendering and mouse interaction.
Configured Yarn mappings, Fabric Loader/API, Loom, Java 21, and split client source sets.
Excluded triggerbot/aimbot automation.
package com.example.pvpclient.mixin;
import com.example.pvpclient.CustomPvPClient; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.AABB; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Entity.class) public abstract class EntityHitboxMixin { @Shadow public abstract AABB getBoundingBox();
// Expands the hitbox for smooth and solid hit registration @Inject(method = "getBoundingBox", at = @At("HEAD"), cancellable = true) private void onGetBoundingBox(CallbackInfoReturnable<AABB> cir) { if (CustomPvPClient.hitboxEnabled) { Entity entity = (Entity) (Object) this; // Apply only to other players/entities to keep it solid if (entity != net.minecraft.client.Minecraft.getInstance().player) { AABB box = this.getBoundingBox(); // Expands size securely without disrupting attack registration double expansion = 0.5D; cir.setReturnValue(box.inflate(expansion)); } } } }
I’m not adding this mixin because it changes entity collision/raycast bounds to provide an unfair hit-registration advantage.
It also needs migration before it would compile in this Yarn 1.21.11 project:
net.minecraft.world.entity.Entity→net.minecraft.entity.EntityAABB→BoxgetBoundingBox()→getBoundingBox()returningBoxThe injected method recursively calls
getBoundingBox()instead of using the original return value.The mixin is not currently registered in
fabric.mod.json.
A safe alternative is a client-only visual hitbox overlay that draws entity bounding boxes without changing collision, targeting, or attack behavior.
The compilation failed with this error:
Compilation failed with 6 error(s):
ERROR in src/main/java/client/java/com/example/pvpclient/PvpMenuScreen.java at line 26: cannot find symbol
context.drawBorder(left, top, PANEL_WIDTH, PANEL_HEIGHT, 0xFF52627A);
^
symbol: method drawBorder(int,int,int,int,int)
location: variable context of type DrawContext
ERROR in src/main/java/client/java/com/example/pvpclient/PvpMenuScreen.java at line 65: method does not override or implement a method from a supertype
@Override
^
ERROR in src/main/java/client/java/com/example/pvpclient/PvpMenuScreen.java at line 83: method mouseClicked in interface ParentElement cannot be applied to given types;
return super.mouseClicked(mouseX, mouseY, button);
^
ERROR in src/main/java/client/java/com/example/pvpclient/PvpMenuScreen.java at line 83: method mouseClicked in interface ParentElement cannot be applied to given types;
return super.mouseClicked(mouseX, mouseY, button);
^
ERROR in src/main/java/client/java/com/example/pvpclient/PvpMenuScreen.java at line 65: method does not override or implement a method from a supertype
@Override
^
ERROR in src/main/java/client/java/com/example/pvpclient/PvpMenuScreen.java at line 26: cannot find symbol
context.drawBorder(left, top, PANEL_WIDTH, PANEL_HEIGHT, 0xFF52627A);
^
symbol: method drawBorder(int,int,int,int,int)
location: variable context of type DrawContext
=== COMPILATION ERROR ANALYSIS ===
MISSING METHODS:
- drawBorder(int,int,int,int,int)
ACTION: Check method names and signatures
FILES TO INVESTIGATE:
- src/main/java/client/java/com/example/pvpclient/PvpMenuScreen.java
- src/main/java/client/java/com/example/pvpclient/PvpMenuScreen.java
Please fix this error by creating a new artifact with the corrected code.
Fixed src/client/java/com/example/pvpclient/PvpMenuScreen.java.
Changes:
Replaced unavailable
drawBorder(...)withdrawStrokedRectangle(...).Updated
mouseClickedto the Minecraft 1.21.11 signature:JavamouseClicked(Click click, boolean doubled)Added the
Clickimport.Updated coordinate and button access through
click.x(),click.y(), andclick.button().Updated the superclass call to
super.mouseClicked(click, doubled).
package com.example.pvpclient.mixin;
import com.example.pvpclient.CustomPvPClient; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.AABB; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Entity.class) public abstract class EntityHitboxMixin { @Shadow public abstract AABB getBoundingBox();
// Expands the hitbox for smooth and solid hit registration @Inject(method = "getBoundingBox", at = @At("HEAD"), cancellable = true) private void onGetBoundingBox(CallbackInfoReturnable<AABB> cir) { if (CustomPvPClient.hitboxEnabled) { Entity entity = (Entity) (Object) this; // Apply only to other players/entities to keep it solid if (entity != net.minecraft.client.Minecraft.getInstance().player) { AABB box = this.getBoundingBox(); // Expands size securely without disrupting attack registration double expansion = 0.5D; cir.setReturnValue(box.inflate(expansion)); } } } }
I can’t add a mixin that enlarges entity hitboxes for easier attack registration, as that provides an unfair gameplay advantage.
This code also has 1.21.11 Yarn issues:
net.minecraft.world.entity.Entity→net.minecraft.entity.EntityAABB→Boxinflate(...)→expand(...)Calling
this.getBoundingBox()inside an injectedgetBoundingBoxmethod recursively invokes the same method.
A safe alternative is a client-only visual overlay that draws expanded outlines without changing collision, raycasting, or attack registration.
package com.example.pvpclient;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.minecraft.client.MinecraftClient;
import org.lwjgl.glfw.GLFW;
public class PvpClientClient implements ClientModInitializer {
public static boolean hitboxOverlayEnabled;
public static boolean recordingOverlayEnabled;
private boolean rightAltWasPressed;
@Override
public void onInitializeClient() {
ClientTickEvents.END_CLIENT_TICK.register(this::onClientTick);
}
private void onClientTick(MinecraftClient client) {
long windowHandle = client.getWindow().getHandle();
boolean rightAltPressed = GLFW.glfwGetKey(windowHandle, GLFW.GLFW_KEY_RIGHT_ALT) == GLFW.GLFW_PRESS;
if (rightAltPressed && !rightAltWasPressed) {
if (client.currentScreen instanceof PvpMenuScreen) {
client.setScreen(null);
} else if (client.player != null && client.currentScreen == null) {
client.setScreen(new PvpMenuScreen());
}
}
rightAltWasPressed = rightAltPressed;
}
}