Omar Ahmad Refaat

Make me a fabric 1.20.1 or 1.21.1 Minecraft one piece mod

Kodari AI
KodariOct 8 at 2:11 pm 4
OnePieceAdventure
OnePieceAdventure is a Fabric mod for Minecraft 1.21.1 that brings the world of One Piece to life. It introduces Devil Fruits with unique powers, including Paramecia, Zoan, and Logia types, each granting special abilities and transformations. The mod adds new biomes inspired by the Grand Line, custom mobs like Marines and Pirates, and a bounty system that tracks player reputation. Players can consume Devil Fruits to gain powers, engage in naval combat with customizable ships, and explore islands filled with treasures and challenges. The mod features a Haki system with Observation and Armament abilities, allowing players to enhance their combat skills. Custom armor sets, weapons, and tools themed after iconic characters are included, along with a quest system that guides players through the One Piece storyline.
  1. Create a Fabric 1.21.11 survival mod themed around One Piece, with a craftable, edible Gum-Gum Fruit.

  2. Register it in the food creative tab, add its item model, texture, name, and crafting recipe.

Created Grand Line: Devil Fruits, a Fabric mod that adds a custom-textured Gum-Gum Fruit. Eating it grants Strength and Speed for 3 minutes and Resistance for 2 minutes.

Survival recipe: craft 2 apples, 2 slimeballs, and 1 emerald together in the pattern shown in the recipe. The fruit also appears in the food creative tab.

Version note: this project targets Fabric 1.21.11, not 1.20.1 or 1.21.1.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
10 177
src/main/java/com/kodari/grandline/GrandLineMod.java
package com.kodari.grandline;

import java.util.List;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.component.type.ConsumableComponent;
import net.minecraft.component.type.FoodComponent;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroups;
import net.minecraft.item.Items;
import net.minecraft.item.consume.ApplyEffectsConsumeEffect;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;

public class GrandLineMod implements ModInitializer {
    public static final String MOD_ID = "grandline";

    private static final RegistryKey<ItemGroup> FOOD_AND_DRINKS = RegistryKey.of(
            RegistryKeys.ITEM_GROUP,
            Identifier.of("minecraft", "food_and_drinks")
    );

    public static final Item GUM_GUM_FRUIT = register("gum_gum_fruit", new Item.Settings().food(
            new FoodComponent.Builder()
                    .nutrition(4)
                    .saturationModifier(0.3f)
                    .build(),
            ConsumableComponent.builder()
                    .consumeEffect(new ApplyEffectsConsumeEffect(List.of(
                            new StatusEffectInstance(StatusEffects.STRENGTH, 20 * 60 * 3),
                            new StatusEffectInstance(StatusEffects.SPEED, 20 * 60 * 3),
                            new StatusEffectInstance(StatusEffects.RESISTANCE, 20 * 60 * 2)
                    )))
                    .build()
    ));

    @Override
    public void onInitialize() {
        ItemGroupEvents.modifyEntriesEvent(FOOD_AND_DRINKS)
                .register(entries -> entries.addAfter(Items.APPLE, GUM_GUM_FRUIT));
    }

    private static Item register(String name, Item.Settings settings) {
        Identifier id = Identifier.of(MOD_ID, name);
        RegistryKey<Item> key = RegistryKey.of(RegistryKeys.ITEM, id);
        return Registry.register(Registries.ITEM, key, new Item(settings.registryKey(key)));
    }
}