claymc c

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; } } }

Kodari AI
KodariSep 15 at 10:17 am 1
PvPToggleMenu
A Fabric client-side mod for Minecraft 1.21.1 that provides a PvP enhancement menu toggled via the Right Alt key. Features include hitbox visualization, invisible hitboxes for recording, triggerbot functionality, and aimbot controls. The mod uses a custom GUI screen with clickable toggle buttons, direct GLFW key detection to avoid keybind conflicts, and client tick events for continuous input monitoring. All settings are stored as static booleans for easy access across game sessions.

Created the Fabric 1.21.11 project with:

  • Fabric Loom setup and split client source set

  • Client-only CustomPvPClient entrypoint

  • Right Alt menu toggle

  • PvP configuration screen

  • Hitbox, invisible hitbox, triggerbot, and aimbot toggles

  • Triggerbot attack cooldown and target validation

  • Basic aimbot targeting

  • Fabric metadata and Gradle configuration

claymc c

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)); } } } }

Kodari AI
KodariSep 15 at 10:18 am 1
  • Added EntityHitboxMixin using Yarn 1.21.11 mappings:

    • Entity instead of Mojang-mapped Entity

    • Box instead of AABB

    • Injects at RETURN to avoid recursive getBoundingBox() calls

    • Expands non-player entity hitboxes by 0.5

  • Registered the client mixin in fabric.mod.json and added pvpclient.mixins.json.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
7 281
src/client/java/com/example/pvpclient/CustomPvPClient.java
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 net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.EntityHitResult;
import org.lwjgl.glfw.GLFW;

public class CustomPvPClient implements ClientModInitializer {
    public static boolean hitboxEnabled;
    public static boolean invisibleHitbox;
    public static boolean triggerBotEnabled;
    public static boolean aimBotEnabled;

    private boolean wasMenuKeyPressed;
    private int triggerBotCooldown;

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(this::onClientTick);
    }

    private void onClientTick(MinecraftClient client) {
        long windowHandle = client.getWindow().getHandle();
        boolean menuKeyPressed = GLFW.glfwGetKey(windowHandle, GLFW.GLFW_KEY_RIGHT_ALT) == GLFW.GLFW_PRESS;

        if (menuKeyPressed && !wasMenuKeyPressed) {
            if (client.player != null && client.currentScreen == null) {
                client.setScreen(new PvPMenuScreen());
            } else if (client.currentScreen instanceof PvPMenuScreen) {
                client.setScreen(null);
            }
        }
        wasMenuKeyPressed = menuKeyPressed;

        if (triggerBotCooldown > 0) {
            triggerBotCooldown--;
        }

        if (triggerBotEnabled && client.player != null && client.interactionManager != null
                && client.crosshairTarget instanceof EntityHitResult entityHitResult
                && triggerBotCooldown == 0) {
            Entity target = entityHitResult.getEntity();
            if (isAttackableTarget(client.player, target)) {
                client.interactionManager.attackEntity(client.player, target);
                client.player.swingHand(Hand.MAIN_HAND);
                triggerBotCooldown = 2;
            }
        }

        if (aimBotEnabled && client.player != null && client.crosshairTarget instanceof EntityHitResult entityHitResult) {
            Entity target = entityHitResult.getEntity();
            if (isAttackableTarget(client.player, target)) {
                aimAt(client.player, target);
            }
        }
    }

    private static boolean isAttackableTarget(PlayerEntity player, Entity target) {
        return target != player && target.isAlive() && !target.isSpectator() && player.canSee(target);
    }

    private static void aimAt(PlayerEntity player, Entity target) {
        double x = target.getX() - player.getX();
        double y = target.getEyeY() - player.getEyeY();
        double z = target.getZ() - player.getZ();
        double horizontalDistance = Math.sqrt(x * x + z * z);

        float yaw = (float) (Math.toDegrees(Math.atan2(z, x)) - 90.0D);
        float pitch = (float) (-Math.toDegrees(Math.atan2(y, horizontalDistance)));
        player.setYaw(yaw);
        player.setPitch(pitch);
    }

    private static final class PvPMenuScreen extends Screen {
        private static final int LEFT = 48;
        private static final int TOP = 62;
        private static final int ROW_HEIGHT = 24;

        private PvPMenuScreen() {
            super(Text.literal("Custom PvP Client Menu"));
        }

        @Override
        public void render(DrawContext context, int mouseX, int mouseY, float delta) {
            renderBackground(context, mouseX, mouseY, delta);

            int panelLeft = Math.max(20, width / 2 - 160);
            int panelTop = 20;
            int panelRight = Math.min(width - 20, width / 2 + 160);
            context.fill(panelLeft, panelTop, panelRight, 184, 0xE0101824);
            context.drawBorder(panelLeft, panelTop, panelRight - panelLeft, 164, 0xFF4E6A88);
            context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 31, 0xFFFFFFFF);

            drawToggle(context, "Hitbox", hitboxEnabled, 0);
            drawToggle(context, "Invisible Hitbox (For Recording)", invisibleHitbox, 1);
            drawToggle(context, "Triggerbot", triggerBotEnabled, 2);
            drawToggle(context, "Aimbot", aimBotEnabled, 3);

            context.drawCenteredTextWithShadow(textRenderer, Text.literal("Right Alt to close"), width / 2, 169, 0xFF9AA9B8);
            super.render(context, mouseX, mouseY, delta);
        }

        private void drawToggle(DrawContext context, String label, boolean enabled, int row) {
            int y = TOP + row * ROW_HEIGHT;
            int color = enabled ? 0xFF55D68A : 0xFFCFD5DC;
            context.drawTextWithShadow(textRenderer, Text.literal(label), LEFT, y, 0xFFFFFFFF);
            context.drawTextWithShadow(textRenderer, Text.literal(enabled ? "ON" : "OFF"), 270, y, color);
        }

        @Override
        public boolean mouseClicked(double mouseX, double mouseY, int button) {
            if (button == 0 && mouseX >= LEFT - 8 && mouseX <= 320) {
                int row = ((int) mouseY - TOP + ROW_HEIGHT / 2) / ROW_HEIGHT;
                if (row >= 0 && row < 4) {
                    switch (row) {
                        case 0 -> hitboxEnabled = !hitboxEnabled;
                        case 1 -> invisibleHitbox = !invisibleHitbox;
                        case 2 -> triggerBotEnabled = !triggerBotEnabled;
                        case 3 -> aimBotEnabled = !aimBotEnabled;
                    }
                    return true;
                }
            }
            return super.mouseClicked(mouseX, mouseY, button);
        }

        @Override
        public boolean shouldPause() {
            return false;
        }
    }
}