Prime Crystal
📎 1 file 1,459 chars
đź“„
pasted-code-1792654999880.txt
txt 20 lines
â–¶
Create a complete, ready-to-download Fabric mod for Minecraft 1.21.1 named "Arboris Tricolour Woods". The mod must include the following specifications:

1. Custom Dimension ("Arboris"):
   - Add a brand new custom dimension with a rich, dark-wooden ground color palette (resembling stripped logs and wooden planks).
   - The sky color, fog, and night aesthetic must feature the gorgeous gradient colors of the Indian Tricolour (Saffron/Orange, White, and Green).
   - Include glowing tricolour atmospheric dust/spores in the night sky for a magical look.

2. Portal & Activation:
   - Create a custom portal frame for this dimension that is ignited using standard "Flint & Steel", exactly like the Nether portal mechanic.

3. Special Water Mechanics:
   - When a player steps or swims into any water body inside this dimension, they automatically receive a 5-minute "Fire Resistance" effect and a "Regeneration / Health Boost" effect to help them survive.

4. Hostile Boss Mob ("Timber Warden"):
   - Add a dangerous hostile boss monster called "Timber Warden" with high health, heavy attack damage, and a terrifying Warden-style model that spawns naturally in the dimension's night.

5. Cute Food Mobs:
   - Add small, cute, passive rabbit-like mobs that spawn peacefully in the dimension and drop food items when defeated so players can easily gather food.

Compile this entire project and provide a direct downloadable .jar file package for Fabric 1.21.1.
Kodari AI
KodariOct 22 at 7:57 am 2
ArborisTricolourWoods
A Fabric mod for Minecraft 1.21.1 introducing the Arboris dimension with dark wooden terrain, tricolour sky gradients, and glowing atmospheric spores. Features a Flint & Steel-ignited portal frame, special water mechanics granting Fire Resistance and Regeneration effects, the hostile Timber Warden boss mob with Warden-style model, and cute passive rabbit-like food mobs. Includes custom dimension, portal activation, mob spawning, and environmental effects for immersive exploration.
  1. Add the Fabric 1.21.1 project setup and Arboris dimension data.

  2. Implement the flint-and-steel portal, water effects, night spores, and Timber Warden spawning.

  3. Add peaceful rabbit spawns and the dark-wood frame’s in-game assets/recipe.

Created the Fabric 1.21.1 project with the Arboris dimension, flint-and-steel portal, water-granted effects, tricolour night particles, nighttime Timber Warden spawns, and peaceful rabbit spawns.

A couple of visual details are approximate: the dimension uses dark-forest vegetation and tinted biome colors, but its terrain is still generated with the Overworld’s surface blocks; the sky tint and particles don’t create a true gradient. The Timber Warden uses Minecraft’s vanilla Warden model. For a custom model, enable Generation in this project’s Settings, create it in Kodari Studio, then bring it into the project through a workspace.

To get the mod jar: click Compile in the top bar, click Compile in the window, then click Download when the build succeeds.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
16 428
src/main/java/com/arboris/tricolourwoods/ArborisTricolourWoods.java
package com.arboris.tricolourwoods;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
import net.minecraft.block.Block;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.mob.WardenEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Items;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.world.Heightmap;
import net.minecraft.world.World;

public final class ArborisTricolourWoods implements ModInitializer {
    public static final String MOD_ID = "arboris";
    public static final RegistryKey<World> ARBORIS_WORLD = RegistryKey.of(
            RegistryKeys.WORLD,
            Identifier.of(MOD_ID, "arboris")
    );

    @Override
    public void onInitialize() {
        ArborisBlocks.initialize();
        UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> {
            if (world.isClient || !player.getStackInHand(hand).isOf(Items.FLINT_AND_STEEL)) {
                return ActionResult.PASS;
            }

            BlockPos clicked = hitResult.getBlockPos();
            if (!world.getBlockState(clicked).isOf(ArborisBlocks.ARBORIS_FRAME)) {
                return ActionResult.PASS;
            }

            return activatePortal((ServerWorld) world, clicked) ? ActionResult.SUCCESS : ActionResult.PASS;
        });

        ServerTickEvents.END_WORLD_TICK.register(ArborisTricolourWoods::tickArboris);
    }

    private static boolean activatePortal(ServerWorld world, BlockPos clicked) {
        for (boolean alongX : new boolean[]{true, false}) {
            int axisPosition = alongX ? clicked.getX() : clicked.getZ();
            int fixedPosition = alongX ? clicked.getZ() : clicked.getX();
            for (int left = axisPosition - 2; left <= axisPosition + 1; left++) {
                for (int bottom = clicked.getY() - 4; bottom <= clicked.getY() + 1; bottom++) {
                    if (!isPortalFrame(world, alongX, fixedPosition, left, bottom)) {
                        continue;
                    }

                    for (int width = 1; width <= 2; width++) {
                        for (int height = 1; height <= 3; height++) {
                            BlockPos portalPos = alongX
                                    ? new BlockPos(left + width, bottom + height, fixedPosition)
                                    : new BlockPos(fixedPosition, bottom + height, left + width);
                            world.setBlockState(portalPos, ArborisBlocks.ARBORIS_PORTAL.getDefaultState(), Block.NOTIFY_ALL);
                        }
                    }
                    return true;
                }
            }
        }
        return false;
    }

    private static boolean isPortalFrame(ServerWorld world, boolean alongX, int fixedPosition, int left, int bottom) {
        for (int width = 0; width < 4; width++) {
            for (int height = 0; height < 5; height++) {
                BlockPos pos = alongX
                        ? new BlockPos(left + width, bottom + height, fixedPosition)
                        : new BlockPos(fixedPosition, bottom + height, left + width);
                boolean border = width == 0 || width == 3 || height == 0 || height == 4;
                if (border) {
                    if (!world.getBlockState(pos).isOf(ArborisBlocks.ARBORIS_FRAME)) {
                        return false;
                    }
                } else if (!world.getBlockState(pos).isAir()) {
                    return false;
                }
            }
        }
        return true;
    }

    private static void tickArboris(ServerWorld world) {
        if (!world.getRegistryKey().equals(ARBORIS_WORLD)) {
            return;
        }

        long time = world.getTimeOfDay() % 24000L;
        boolean night = time >= 13000L && time < 23000L;

        if (world.getTime() % 20L == 0L) {
            for (ServerPlayerEntity player : world.getPlayers()) {
                if (player.isTouchingWater()) {
                    player.addStatusEffect(new StatusEffectInstance(StatusEffects.FIRE_RESISTANCE, 6000, 0));
                    player.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 6000, 0));
                    player.addStatusEffect(new StatusEffectInstance(StatusEffects.HEALTH_BOOST, 6000, 0));
                }
            }
        }

        if (night && world.getTime() % 8L == 0L) {
            for (ServerPlayerEntity player : world.getPlayers()) {
                double x = player.getX() + world.getRandom().nextDouble() * 28.0D - 14.0D;
                double y = player.getY() + 8.0D + world.getRandom().nextDouble() * 12.0D;
                double z = player.getZ() + world.getRandom().nextDouble() * 28.0D - 14.0D;
                switch (world.getRandom().nextInt(3)) {
                    case 0 -> world.spawnParticles(ParticleTypes.FLAME, x, y, z, 1, 0.08D, 0.08D, 0.08D, 0.0D);
                    case 1 -> world.spawnParticles(ParticleTypes.END_ROD, x, y, z, 1, 0.08D, 0.08D, 0.08D, 0.0D);
                    default -> world.spawnParticles(ParticleTypes.HAPPY_VILLAGER, x, y, z, 1, 0.08D, 0.08D, 0.08D, 0.0D);
                }
            }
        }

        if (!night || world.getTime() % 1200L != 0L || world.getPlayers().isEmpty() || world.getRandom().nextInt(3) != 0) {
            return;
        }

        ServerPlayerEntity target = world.getPlayers().get(world.getRandom().nextInt(world.getPlayers().size()));
        Box nearby = target.getBoundingBox().expand(128.0D);
        boolean bossNearby = !world.getEntitiesByType(EntityType.WARDEN, nearby, ArborisTricolourWoods::isTimberWarden).isEmpty();
        if (bossNearby) {
            return;
        }

        int x = target.getBlockX() + world.getRandom().nextBetween(-24, 24);
        int z = target.getBlockZ() + world.getRandom().nextBetween(-24, 24);
        int y = world.getTopY(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, x, z);
        WardenEntity warden = EntityType.WARDEN.create(world, SpawnReason.EVENT);
        if (warden != null) {
            warden.refreshPositionAndAngles(x + 0.5D, y, z + 0.5D, world.getRandom().nextFloat() * 360.0F, 0.0F);
            warden.setCustomName(net.minecraft.text.Text.literal("Timber Warden"));
            warden.setCustomNameVisible(true);
            world.spawnEntity(warden);
        }
    }

    private static boolean isTimberWarden(WardenEntity entity) {
        return entity.getCustomName() != null && entity.getCustomName().getString().equals("Timber Warden");
    }
}