Muhamad Ameen

i want mod that make people cant hit me and i cant take any damage like fall damage or whatever damage by press special buttom

Kodari AI
KodariOct 25 at 3:54 pm 2
InvincibilityToggle
A Fabric mod for Minecraft 1.21.11 that adds an invincibility toggle. Press a configurable key (default: I) to become completely immune to all damage sources, including melee attacks, fall damage, fire, drowning, and environmental hazards. When active, the player takes zero damage and cannot be hit by entities. Press the key again to disable invincibility. The mod provides clear visual feedback with a HUD indicator showing the current invincibility state, along with configurable settings for the toggle key binding and optional sound effects on activation/deactivation.
  1. Add the Fabric 1.21.11 project files and client/server entrypoints.

  2. Bind a configurable key to toggle server-side immunity to all damage, with status feedback.

Created Safe Toggle. Press G to toggle complete damage immunity; the server confirms whether protection is enabled or disabled. You can change the key in Controls.

For multiplayer, install the mod on both the server and your client. The immunity applies to the player who toggles it and blocks all damage handled by the server’s living-entity damage event.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 187
src/client/java/com/kodari/safetoggle/SafeToggleClient.java
package com.kodari.safetoggle;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;

public final class SafeToggleClient implements ClientModInitializer {
    private static final KeyBinding TOGGLE_PROTECTION = KeyBindingHelper.registerKeyBinding(
            new KeyBinding(
                    "key.safetoggle.toggle_protection",
                    GLFW.GLFW_KEY_G,
                    KeyBinding.Category.create(Identifier.of(SafeToggleMod.MOD_ID, "main"))
            )
    );

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            while (TOGGLE_PROTECTION.wasPressed()) {
                if (ClientPlayNetworking.canSend(ToggleProtectionPayload.ID)) {
                    ClientPlayNetworking.send(new ToggleProtectionPayload());
                }
            }
        });
    }
}