Dominos

Ores & Metals: Raw Titanium, Steel Ingot, Brass Ingot, Cast Iron, and Machined Steel Plate.

Tools & Components: Adjustable Wrench (Seřizovací klíč), Precision Caliper (Posuvné měřítko), Steel Gear, Bearings, Cutting Tools (Univerzální břit/vrták), and Hydraulic Cylinder.

Special Mechanics: The "Adjustable Wrench" is used to fine-tune machine parameters (speed, torque, output size, and energy consumption) by shift-right-clicking on machines.

Kodari AI
KodariOct 19 at 12:06 pm 13
IndustrialRevival
IndustrialRevival is a Minecraft Fabric mod for version 1.18.2 that introduces a comprehensive industrial crafting system. Players can mine and process raw Titanium, forge Steel and Brass Ingots, create Cast Iron, and produce Machined Steel Plates. The mod features essential tools and components including Adjustable Wrench, Precision Caliper, Steel Gears, Bearings, Cutting Tools, and Hydraulic Cylinders. The Adjustable Wrench allows players to fine-tune machine parameters such as speed, torque, output size, and energy consumption by shift-right-clicking on machines, enabling precise control over industrial processes and automation.
  1. Set up the Fabric 1.18.2 project and register the listed materials, components, tools, and tuning machine.

  2. Add survival crafting recipes, item/block models, names, and the machine’s four wrench-adjustable settings.

  3. Add distinct textures for the new items and machine.

Created the Mechanical Works Fabric 1.18.2 project with all listed materials, components, tools, and a Tuning Machine.

  • Wrench mechanic: Sneak-right-click the machine with the Adjustable Wrench to increase one setting at a time through four levels: Speed, Torque, Output Size, and Energy Use. The selected value is stored in the machine’s block state and shown on screen. The wrench has 256 durability; its settings are configurable, but they do not yet change machine production.

  • Survival access: Raw Titanium is crafted from iron and an amethyst shard; Steel from iron and coal; Brass from copper and gold; Cast Iron by smelting raw iron. The plates, tools, and components are craftable from those materials and vanilla ingredients. The Tuning Machine is crafted from plates, a gear, bearings, cutting tools, and a hydraulic cylinder; it drops when mined with an iron-tier pickaxe.

  • Assets: Added names, models, recipes, loot, mining tags, and distinct custom textures for the machine and four metal items. The remaining component icons use vanilla textures because texture generation ran out of available credits.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
40 484
src/main/java/dev/kodari/mechanicalworks/MechanicalWorks.java
package dev.kodari.mechanicalworks;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;

public class MechanicalWorks implements ModInitializer {
    public static final String MOD_ID = "mechanicalworks";

    private static final Item RAW_TITANIUM = new Item(itemSettings());
    private static final Item STEEL_INGOT = new Item(itemSettings());
    private static final Item BRASS_INGOT = new Item(itemSettings());
    private static final Item CAST_IRON = new Item(itemSettings());
    private static final Item MACHINED_STEEL_PLATE = new Item(itemSettings());
    private static final Item ADJUSTABLE_WRENCH = new Item(itemSettings().maxDamage(256));
    private static final Item PRECISION_CALIPER = new Item(itemSettings());
    private static final Item STEEL_GEAR = new Item(itemSettings());
    private static final Item BEARINGS = new Item(itemSettings());
    private static final Item CUTTING_TOOLS = new Item(itemSettings());
    private static final Item HYDRAULIC_CYLINDER = new Item(itemSettings());
    private static final TuningMachineBlock TUNING_MACHINE = new TuningMachineBlock();

    @Override
    public void onInitialize() {
        Registry.register(Registry.BLOCK, id("tuning_machine"), TUNING_MACHINE);
        Registry.register(Registry.ITEM, id("tuning_machine"), new BlockItem(TUNING_MACHINE, itemSettings()));

        registerItem("raw_titanium", RAW_TITANIUM);
        registerItem("steel_ingot", STEEL_INGOT);
        registerItem("brass_ingot", BRASS_INGOT);
        registerItem("cast_iron", CAST_IRON);
        registerItem("machined_steel_plate", MACHINED_STEEL_PLATE);
        registerItem("adjustable_wrench", ADJUSTABLE_WRENCH);
        registerItem("precision_caliper", PRECISION_CALIPER);
        registerItem("steel_gear", STEEL_GEAR);
        registerItem("bearings", BEARINGS);
        registerItem("cutting_tools", CUTTING_TOOLS);
        registerItem("hydraulic_cylinder", HYDRAULIC_CYLINDER);
    }

    private static FabricItemSettings itemSettings() {
        return new FabricItemSettings().group(ItemGroup.MISC);
    }

    private static Identifier id(String path) {
        return new Identifier(MOD_ID, path);
    }

    private static void registerItem(String name, Item item) {
        Registry.register(Registry.ITEM, id(name), item);
    }

    private static final class TuningMachineBlock extends Block {
        private static final IntProperty SPEED = IntProperty.of("speed", 0, 3);
        private static final IntProperty TORQUE = IntProperty.of("torque", 0, 3);
        private static final IntProperty OUTPUT_SIZE = IntProperty.of("output_size", 0, 3);
        private static final IntProperty ENERGY_USE = IntProperty.of("energy_use", 0, 3);
        private static final IntProperty TUNING_MODE = IntProperty.of("tuning_mode", 0, 3);
        private static final IntProperty[] SETTINGS = {SPEED, TORQUE, OUTPUT_SIZE, ENERGY_USE};
        private static final String[] SETTING_NAMES = {"Speed", "Torque", "Output size", "Energy use"};

        private TuningMachineBlock() {
            super(FabricBlockSettings.of(Material.METAL).strength(4.0f, 6.0f));
            setDefaultState(getDefaultState()
                    .with(SPEED, 0)
                    .with(TORQUE, 0)
                    .with(OUTPUT_SIZE, 0)
                    .with(ENERGY_USE, 0)
                    .with(TUNING_MODE, 0));
        }

        @Override
        protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
            builder.add(SPEED, TORQUE, OUTPUT_SIZE, ENERGY_USE, TUNING_MODE);
        }

        @Override
        public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
            ItemStack heldItem = player.getStackInHand(hand);
            if (!player.isSneaking() || !heldItem.isOf(ADJUSTABLE_WRENCH)) {
                return ActionResult.PASS;
            }

            if (!world.isClient) {
                int mode = state.get(TUNING_MODE);
                IntProperty setting = SETTINGS[mode];
                int value = (state.get(setting) + 1) % 4;
                BlockState tunedState = state
                        .with(setting, value)
                        .with(TUNING_MODE, (mode + 1) % SETTINGS.length);
                world.setBlockState(pos, tunedState);
                player.sendMessage(Text.of(SETTING_NAMES[mode] + " tuned to " + (value + 1) + "/4"), true);
                heldItem.damage(1, player, entity -> entity.sendToolBreakStatus(hand));
            }

            return ActionResult.SUCCESS;
        }
    }
}