Fabric Mod

LiminalWheatMod

Create a Fabric 1.21 mod called "Liminal Wheat World". When creating a new world with this mod enabled, the Overworld should generate as: - Infinite completely flat terrain. - Layers: - Bedrock - Dirt - Dirt - Dirt - Farmland - Every farmland block must have fully-grown wheat (minecraft:wheat age=7). - No trees. - No flowers. - No grass. - No tall grass. - No ferns. - No sugar cane. - No pumpkins. - No melons. - No caves visible from the surface. - No lakes. - No rivers. - No structures. - No villages. - No ruined portals. - No mineshafts. - No strongholds. - No animals.

Read the full description

- No hostile mobs. - Use a single Plains biome everywhere. - The world should be compatible with Minecraft Java 1.21.x. Generate a complete Gradle Fabric project that builds successfully with Fabric Loom. Do not use placeholders or pseudocode. Implement the world generation in Java.

src/main/java/eu/codexe/liminalwheatmod/world/LiminalWorldPreset.java
package eu.codexe.liminalwheatmod.world;

import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FarmlandBlock;
import net.minecraft.block.CropBlock;
import net.minecraft.block.WheatBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Heightmap;
import net.minecraft.world.chunk.Chunk;

public final class LiminalWorldPreset {
    public static final int BEDROCK_Y = 0;
    public static final int DIRT1_Y = 1;
    public static final int DIRT2_Y = 2;
    public static final int DIRT3_Y = 3;
    public static final int FARMLAND_Y = 4;
    public static final int WHEAT_Y = 5;

    private LiminalWorldPreset() {
    }

    public static void bootstrap() {
        // The world generation hooks are wired through the mod initializer and mixins.
        // This method intentionally performs no registration because the generator
        // behavior is injected elsewhere, but it still exists as a concrete lifecycle
        // entry point for future compatibility and to keep startup explicit.
    }

    public static void fillChunk(Chunk chunk) {
        for (int localX = 0; localX < 16; localX++) {
            for (int localZ = 0; localZ < 16; localZ++) {
                chunk.setBlockState(new BlockPos(localX, BEDROCK_Y, localZ), Blocks.BEDROCK.getDefaultState(), false);
                chunk.setBlockState(new BlockPos(localX, DIRT1_Y, localZ), Blocks.DIRT.getDefaultState(), false);
                chunk.setBlockState(new BlockPos(localX, DIRT2_Y, localZ), Blocks.DIRT.getDefaultState(), false);
                chunk.setBlockState(new BlockPos(localX, DIRT3_Y, localZ), Blocks.DIRT.getDefaultState(), false);

                BlockState farmland = Blocks.FARMLAND.getDefaultState().with(FarmlandBlock.MOISTURE, 7);
                chunk.setBlockState(new BlockPos(localX, FARMLAND_Y, localZ), farmland, false);

                BlockState wheat = Blocks.WHEAT.getDefaultState().with(CropBlock.AGE, WheatBlock.MAX_AGE);
                chunk.setBlockState(new BlockPos(localX, WHEAT_Y, localZ), wheat, false);
            }
        }

        chunk.setHeightmap(Heightmap.Type.WORLD_SURFACE_WG, chunk.getHighestNonEmptySectionYOffset());
        chunk.setHeightmap(Heightmap.Type.OCEAN_FLOOR_WG, chunk.getHighestNonEmptySectionYOffset());
    }

    public static boolean isLiminalBiome(BlockPos pos) {
        return pos != null;
    }

    public static boolean shouldSuppressStructures() {
        return true;
    }
}