Build a Fabric 26.3 Minecraft mod adding a custom usable item that toggles the interacting player between Survival and Creative mode when used. Add a crafting recipe whose ingredients are exactly 4 dirt blocks (no other ingredients); choose a sensible simple shaped recipe. This should work without enabling vanilla cheats or granting operator status, by implementing the mechanic server-side as part of the installed mod; it should affect only the player who uses the item and switch Creative back to Survival on the next use (if the player is in a different mode, set them to Creative). Register item, recipe, translations/model/texture handling consistent with project conventions; use existing generated assets or simple available item texture as appropriate. Read the project’s existing structure first and make only necessary changes. Do not assume this is client-only; ensure use is server-authoritative. Done means the item is registered, craftable from exactly four dirt, and its server-side use toggles the user's game mode as described.

Kodari AI
KodariOct 16 at 10:49 pm 2
ModeToggleWand
A Fabric 26.3 Minecraft mod that adds a custom usable item called the Mode Toggle Wand. When right-clicked, the item server-side toggles the interacting player's game mode between Survival and Creative, without requiring cheats or operator status. The item is crafted from exactly four dirt blocks in a simple shaped recipe. The mod registers the item, recipe, translations, and model/texture assets following standard Fabric conventions. The mechanic is server-authoritative, affecting only the player who uses the item, switching them to Creative if not already in that mode, and back to Survival on subsequent uses.
  • Register a usable item whose server-side activation sets its user to Creative, or back to Survival if already Creative.

  • Add a 2×2 recipe using exactly four dirt, plus the mod metadata and item localization/model definition.

  • Use the vanilla dirt icon so no new texture asset is needed.

Created Mode Toggle, a Fabric 26.3 mod. Craft it in survival with a 2×2 recipe of exactly four dirt blocks. Using it sets only the user to Creative; using it again while in Creative returns them to Survival. If they’re in another game mode, use sets them to Creative.

The mode change runs server-side, and the item uses the vanilla dirt icon.

Eggs Eggs

can you sow me the recipe to craft it

Kodari AI
KodariOct 16 at 11:20 pm 1

Place four dirt blocks in a 2×2 square:

Plain Text
Dirt  Dirt
Dirt  Dirt

This crafts 1 Mode Toggle.

Eggs Eggs

it doesnt work

Kodari AI
KodariOct 16 at 11:24 pm 1

Fixed the recipe resource path: Minecraft expects data/mode_toggle/recipes/ (plural), so it wasn’t being discovered. The item’s game-mode change is already handled server-side.

Eggs Eggs

it doesnt let me load into a world or create one

Kodari AI
KodariOct 16 at 11:34 pm 1
  • 26.3 ingredient codecs expect the item-holder format, not the legacy {"item": ...} object.

  • Replace that ingredient value with the dirt identifier.

  • Keep the 2×2, four-dirt pattern and output unchanged.

Fixed the recipe ingredient format. Minecraft 26.3 expects the dirt identifier directly ("minecraft:dirt"); the old {"item":"minecraft:dirt"} format could make the recipe data fail to load and block world creation.

Recompile the updated project and use the new jar instead of the old one.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 131
src/main/java/com/kodari/modetoggle/ModeToggleMod.java
package com.kodari.modetoggle;

import net.fabricmc.api.ModInitializer;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;

public final class ModeToggleMod implements ModInitializer {
	public static final String MOD_ID = "mode_toggle";
	private static final ResourceKey<Item> MODE_TOGGLE_KEY = ResourceKey.create(
			Registries.ITEM,
			Identifier.fromNamespaceAndPath(MOD_ID, "mode_toggle")
	);
	public static final Item MODE_TOGGLE = new Item(new Item.Properties().setId(MODE_TOGGLE_KEY)) {
		@Override
		public InteractionResult use(final Level level, final Player player, final InteractionHand hand) {
			if (!level.isClientSide() && player instanceof ServerPlayer serverPlayer) {
				GameType targetMode = serverPlayer.gameMode() == GameType.CREATIVE
						? GameType.SURVIVAL
						: GameType.CREATIVE;
				serverPlayer.setGameMode(targetMode);
			}
			return InteractionResult.SUCCESS;
		}
	};

	@Override
	public void onInitialize() {
		Registry.register(BuiltInRegistries.ITEM, MODE_TOGGLE_KEY, MODE_TOGGLE);
	}
}