Lord-Sr

a mod with /fly = for flying in survival an /ec for ender chest in survival Both Command dont need cheat and permision

Kodari AI
KodariJun 15 at 6:55 pm 12
SurvivalUtils
A Fabric 1.21.11 mod that adds two quality-of-life commands for survival players. /fly toggles creative-style flight without requiring cheats or operator permissions. /ec opens the player's ender chest anywhere, no block needed. Both commands work in survival mode with no permission requirements, making them ideal for servers or singleplayer worlds where convenience is valued.
SurvivalUtils
A Fabric 1.21.11 mod that adds two quality-of-life commands for survival players. /fly toggles creative-style flight without requiring cheats or operator permissions. /ec opens the player's ender chest anywhere without needing a physical block. Both commands require no permissions and work in survival mode, making them ideal for servers or singleplayer worlds where convenience is valued.

Now I’ll create all the files:

That’s the full mod. Here’s what each command does:

  • /fly — toggles allowFlying on the player’s abilities and syncs it to the client. Also disables active flight when turning off so players don’t stay airborne.

  • /ec — opens the player’s own ender chest inventory using a GenericContainerScreenHandler (9×3), no physical block required.

Neither command has a .requires(...) restriction, so any player can use them regardless of op level or gamemodes. Works in singleplayer and on servers.

Lord-Sr

no no ec with 12*12 slot

Kodari AI
KodariJun 15 at 6:59 pm 2

[Generation stopped]

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
7 144
src/main/java/com/example/survivalutils/SurvivalUtils.java
package com.example.survivalutils;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.screen.GenericContainerScreenHandler;
import net.minecraft.screen.SimpleNamedScreenHandlerFactory;
import net.minecraft.text.Text;
import net.minecraft.inventory.EnderChestInventory;
import com.mojang.brigadier.Command;

public class SurvivalUtils implements ModInitializer {

    @Override
    public void onInitialize() {
        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {

            dispatcher.register(CommandManager.literal("fly")
                .executes(context -> {
                    ServerPlayerEntity player = context.getSource().getPlayerOrThrow();
                    boolean nowFlying = !player.getAbilities().allowFlying;
                    player.getAbilities().allowFlying = nowFlying;
                    if (!nowFlying) {
                        player.getAbilities().flying = false;
                    }
                    player.sendAbilitiesUpdate();
                    context.getSource().sendFeedback(
                        () -> Text.literal("Flight " + (nowFlying ? "enabled" : "disabled") + "."),
                        false
                    );
                    return Command.SINGLE_SUCCESS;
                })
            );

            dispatcher.register(CommandManager.literal("ec")
                .executes(context -> {
                    ServerPlayerEntity player = context.getSource().getPlayerOrThrow();
                    EnderChestInventory enderChest = player.getEnderChestInventory();
                    player.openHandledScreen(new SimpleNamedScreenHandlerFactory(
                        (syncId, inv, p) -> GenericContainerScreenHandler.createGeneric9x3(syncId, inv, enderChest),
                        Text.translatable("container.enderchest")
                    ));
                    return Command.SINGLE_SUCCESS;
                })
            );
        });
    }
}