João Francisco Capella Berti

make a very realistic detailed minecraft mod called my space mod

Kodari AI
KodariNov 11 at 6:30 pm 14
MySpaceMod
A highly detailed Minecraft Fabric mod that adds realistic space exploration to the game. Features procedurally generated planets with unique biomes, gravity variations, atmospheric conditions, and day-night cycles. Includes a fully functional rocket system with multi-stage launches, orbital mechanics, and landing mechanics. Adds astronaut suits with oxygen management, temperature regulation, and jetpack functionality. Introduces space stations with docking capabilities, resource mining on asteroids, and a comprehensive research system for unlocking advanced technologies. Implements realistic physics for zero-gravity environments, planetary weather systems, and celestial navigation tools. Compatible with Fabric 26.3 and designed for immersive, scientifically accurate space gameplay.
  1. Build a survival crafting progression around lunar regolith, moonstone, space alloy, and a reusable rocket thruster.

  2. Add custom textures, item/block models, recipes, drops, names, and a creative-tab listing.

  3. Verify the 26.3 Fabric/Minecraft APIs and vanilla JSON formats before creating the project files.

Created My Space Mod for Fabric 26.3, with custom textures, recipes, block drops, and a reusable rocket thruster.

Survival crafting:

  • Space Alloy: iron, copper, and quartz.

  • Oxygen Canister: Space Alloy, a glass bottle, and copper.

  • Rocket Thruster: Space Alloy, two Oxygen Canisters, redstone, a firework rocket, and iron. Right-click to boost upward; it grants brief slow falling and has a cooldown.

  • Lunar Regolith: sand, two gravel, and a clay ball; crafts four.

  • Moonstone: four amethyst shards and four smooth basalt; crafts four.

The Oxygen Canister currently serves as a thruster ingredient; it doesn’t provide a standalone breathing system.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
33 418
src/main/java/com/kodari/myspacemod/MySpaceMod.java
package com.kodari.myspacemod;

import java.util.function.Function;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;

public class MySpaceMod implements ModInitializer {
	public static final String MOD_ID = "myspacemod";

	public static final Block LUNAR_REGOLITH = registerBlock("lunar_regolith", MapColor.SAND, 0.7F, false);
	public static final Block MOONSTONE = registerBlock("moonstone", MapColor.DEEPSLATE, 2.5F, true);

	public static final Item LUNAR_REGOLITH_ITEM = registerBlockItem("lunar_regolith", LUNAR_REGOLITH);
	public static final Item MOONSTONE_ITEM = registerBlockItem("moonstone", MOONSTONE);
	public static final Item SPACE_ALLOY = registerItem("space_alloy", Item::new);
	public static final Item OXYGEN_CANISTER = registerItem("oxygen_canister", Item::new);
	public static final Item THRUSTER_PACK = registerItem("thruster_pack", ThrusterPackItem::new);

	@Override
	public void onInitialize() {
		CreativeModeTabEvents.modifyOutputEvent(creativeTabKey("building_blocks")).register(entries -> {
			entries.accept(LUNAR_REGOLITH_ITEM);
			entries.accept(MOONSTONE_ITEM);
		});

		CreativeModeTabEvents.modifyOutputEvent(creativeTabKey("ingredients")).register(entries -> {
			entries.accept(SPACE_ALLOY);
			entries.accept(OXYGEN_CANISTER);
			entries.accept(THRUSTER_PACK);
		});
	}

	private static Block registerBlock(String path, MapColor mapColor, float strength, boolean requiresCorrectTool) {
		Identifier identifier = id(path);
		BlockBehaviour.Properties properties = BlockBehaviour.Properties.of()
				.mapColor(mapColor)
				.strength(strength)
				.setId(ResourceKey.create(Registries.BLOCK, identifier));
		if (requiresCorrectTool) {
			properties.requiresCorrectToolForDrops();
		}
		return Registry.register(BuiltInRegistries.BLOCK, identifier, new Block(properties));
	}

	private static Item registerBlockItem(String path, Block block) {
		Identifier identifier = id(path);
		Item.Properties properties = new Item.Properties().setId(ResourceKey.create(Registries.ITEM, identifier));
		return Registry.register(BuiltInRegistries.ITEM, identifier, new BlockItem(block, properties));
	}

	private static Item registerItem(String path, Function<Item.Properties, Item> factory) {
		Identifier identifier = id(path);
		Item.Properties properties = new Item.Properties().setId(ResourceKey.create(Registries.ITEM, identifier));
		return Registry.register(BuiltInRegistries.ITEM, identifier, factory.apply(properties));
	}

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

	private static ResourceKey<CreativeModeTab> creativeTabKey(String path) {
		return ResourceKey.create(Registries.CREATIVE_MODE_TAB, Identifier.fromNamespaceAndPath("minecraft", path));
	}

	private static final class ThrusterPackItem extends Item {
		private ThrusterPackItem(Properties properties) {
			super(properties);
		}

		@Override
		public InteractionResult use(Level level, Player player, InteractionHand hand) {
			if (!level.isClientSide()) {
				player.push(0.0D, 1.35D, 0.0D);
				player.addEffect(new MobEffectInstance(MobEffects.SLOW_FALLING, 100, 0));
				player.getCooldowns().addCooldown(player.getItemInHand(hand), 100);
				level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.FIREWORK_ROCKET_LAUNCH, SoundSource.PLAYERS, 0.8F, 0.9F);
			}
			return InteractionResult.SUCCESS;
		}
	}
}