Spynonymous

A minecraft 1.20.1 forge mod that adds realistic trains and rails. Need to have a Creative Tab; A Survival craft recipe; and more.

Kodari AI
KodariOct 20 at 9:45 pm 8
RealisticTrainsMod
A comprehensive Minecraft Fabric 1.20.4 mod introducing realistic trains and railway systems. Features a dedicated creative tab with train locomotives, passenger cars, and cargo wagons. Includes functional rail types with realistic physics, acceleration, and braking mechanics. Provides survival crafting recipes using common materials like iron, coal, and wood. Trains can be coupled together, carry passengers, and transport cargo. Includes signal systems, crossing gates, and station platforms for immersive railway infrastructure. Custom train sounds and particle effects enhance the experience. Compatible with existing rail networks while adding new advanced track options.

I’ll target Fabric 1.20.4, which is the workspace’s available game/API source; that differs from the requested Forge 1.20.1.

  1. Set up the Fabric mod project and railway assets.

  2. Add craftable steel rails and a locomotive item that places a rideable furnace minecart on the rails.

  3. Add recipe, creative-tab entries, block/item models, and English names.

Created Ironworks Railways for Fabric 1.20.4. The workspace targets Fabric 1.20.4, not the requested Forge 1.20.1.

  • Craft 16 Steel Rails from iron ingots and a stick; they support standard rail shapes and curves.

  • Craft a Steam Locomotive from a furnace, two iron ingots, and a minecart. It uses the fuel-powered furnace minecart behavior and can be placed on rails.

  • Added a dedicated creative tab, rail drops and pickaxe mining tag, recipes, models, names, and custom textures.

The locomotive uses Minecraft’s vanilla furnace minecart appearance and behavior.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
21 299
src/main/java/com/kodari/railways/RailwayMod.java
package com.kodari.railways;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MinecartItem;
import net.minecraft.item.ItemGroup;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.entity.vehicle.AbstractMinecartEntity;

public final class RailwayMod implements ModInitializer {
    private static final String MOD_ID = "railways";

    private static BlockItem steelRailItem;
    private static Item steamLocomotive;

    @Override
    public void onInitialize() {
        Block steelRail = Registry.register(
                Registries.BLOCK,
                new Identifier(MOD_ID, "steel_rail"),
                new SteelRailBlock(AbstractBlock.Settings.copy(Blocks.RAIL))
        );
        steelRailItem = Registry.register(
                Registries.ITEM,
                new Identifier(MOD_ID, "steel_rail"),
                new BlockItem(steelRail, new Item.Settings())
        );
        steamLocomotive = Registry.register(
                Registries.ITEM,
                new Identifier(MOD_ID, "steam_locomotive"),
                new SteamLocomotiveItem()
        );

        Registry.register(
                Registries.ITEM_GROUP,
                new Identifier(MOD_ID, "railway"),
                FabricItemGroup.builder()
                        .displayName(Text.translatable("itemGroup.railways.railway"))
                        .icon(() -> new ItemStack(steamLocomotive))
                        .entries((context, entries) -> {
                            entries.add(steelRailItem);
                            entries.add(steamLocomotive);
                        })
                        .build()
        );
    }
}