Bro Ski

erstelle einen mod der genau dieses bauwerk mich an einer auswählten stelle platzieren lässt,es handelt sich hierbei um einen atomreaktor,das bild zeigt ihn

Kodari AI
KodariOct 29 at 5:14 pm 5
NuclearReactorPlacer
Creates a Minecraft Fabric mod that allows players to place a complete nuclear reactor structure at a selected location. The mod provides a placement tool that previews and spawns the full reactor building, including all walls, floors, reactor core, cooling pipes, and control room elements. Players can select a position in the world and the mod constructs the entire atomic reactor structure block-by-block, ensuring proper alignment and orientation. The placement system handles terrain adaptation and provides visual feedback during selection.
  1. Bauwerk: Ich setze den Reaktor als platzierbares, survival-taugliches Bauwerk aus Minecraft-Blöcken um, angelehnt an dein Bild.

  2. Benutzung: Ein Reaktor-Bausatz platziert ihn beim Benutzen an der angeklickten Stelle.

  3. Projekt: Ich erstelle Mod-Grundgerüst, Item, Textur, Rezept und deutsche Namen.

Der Mod erstellt eine blockbasierte Nachbildung des Atomreaktors mit drei Türmen, Industriegerüst, Glasfassaden und beleuchteten Rohrleitungen. Sie ist an dein Bild angelehnt, aber keine pixelgenaue Kopie: Aus einem einzelnen Bild lassen sich die exakten Blöcke und Maße nicht bestimmen.

Im Survival: Stelle den Reaktoranlagen-Bausatz aus 4 poliertem Tiefenschiefer, 4 Eisenbarren und 1 Redstoneblock her. Benutze ihn auf einen Block in einem freien Bereich. Die Anlage wird darüber platziert; sie ist etwa 55 × 41 Blöcke groß und 42 Blöcke hoch und überschreibt Blöcke in ihrem Bauvolumen. Der Bausatz wird dabei nicht verbraucht.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
11 296
src/main/java/com/example/atomicreactor/AtomicReactorMod.java
package com.example.atomicreactor;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents;
import net.minecraft.core.Registry;
import net.minecraft.core.BlockPos;
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.world.InteractionResult;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;

public class AtomicReactorMod implements ModInitializer {
	public static final String MOD_ID = "atomicreactor";

	private static final ResourceKey<Item> REACTOR_KIT_KEY = ResourceKey.create(
		Registries.ITEM,
		Identifier.fromNamespaceAndPath(MOD_ID, "reactor_kit")
	);
	public static final Item REACTOR_KIT = Registry.register(
		BuiltInRegistries.ITEM,
		REACTOR_KIT_KEY,
		new ReactorKit(new Item.Properties().setId(REACTOR_KIT_KEY))
	);

	@Override
	public void onInitialize() {
		ResourceKey<CreativeModeTab> toolsTab = ResourceKey.create(
			Registries.CREATIVE_MODE_TAB,
			Identifier.fromNamespaceAndPath("minecraft", "tools_and_utilities")
		);
		CreativeModeTabEvents.modifyOutputEvent(toolsTab).register(entries -> entries.accept(REACTOR_KIT));
	}

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

		@Override
		public InteractionResult useOn(final UseOnContext context) {
			Level level = context.getLevel();
			if (!level.isClientSide()) {
				buildReactor(level, context.getClickedPos().above());
			}
			return InteractionResult.SUCCESS;
		}
	}

	private static void buildReactor(final Level level, final BlockPos origin) {
		for (int x = -27; x <= 27; x++) {
			for (int z = -18; z <= 22; z++) {
				put(level, origin, x, 0, z, Blocks.BLACKSTONE);
			}
		}

		for (int x = -23; x <= 23; x++) {
			for (int z = -13; z <= 9; z++) {
				put(level, origin, x, 1, z, Blocks.SMOOTH_STONE);
			}
		}

		for (int x = -23; x <= 23; x++) {
			for (int y = 2; y <= 8; y++) {
				if (x % 6 == 0 || x == -23 || x == 23) {
					put(level, origin, x, y, -13, Blocks.POLISHED_DEEPSLATE);
					put(level, origin, x, y, 9, Blocks.POLISHED_DEEPSLATE);
				} else if (y >= 3 && y <= 7) {
					put(level, origin, x, y, -13, Blocks.GLASS_PANE);
					put(level, origin, x, y, 9, Blocks.GLASS_PANE);
				}
			}
		}

		for (int z = -13; z <= 9; z++) {
			for (int y = 2; y <= 8; y++) {
				if (z % 5 == 0 || z == -13 || z == 9) {
					put(level, origin, -23, y, z, Blocks.POLISHED_DEEPSLATE);
					put(level, origin, 23, y, z, Blocks.POLISHED_DEEPSLATE);
				} else if (y >= 3 && y <= 7) {
					put(level, origin, -23, y, z, Blocks.GLASS_PANE);
					put(level, origin, 23, y, z, Blocks.GLASS_PANE);
				}
			}
		}

		for (int x = -24; x <= 24; x++) {
			put(level, origin, x, 2, -14, Blocks.BLACKSTONE);
			put(level, origin, x, 9, -14, Blocks.BLACKSTONE);
			put(level, origin, x, 2, 10, Blocks.BLACKSTONE);
			put(level, origin, x, 9, 10, Blocks.BLACKSTONE);
		}

		for (int x = -25; x <= 25; x++) {
			for (int z = -15; z <= 13; z++) {
				put(level, origin, x, 9, z, Blocks.POLISHED_ANDESITE);
			}
		}

		for (int x = -11; x <= 11; x++) {
			for (int z = 14; z <= 21; z++) {
				put(level, origin, x, 0, z, Blocks.POLISHED_ANDESITE);
			}
		}

		for (int x : new int[] {-17, 0, 17}) {
			buildTower(level, origin, x, -2);
		}

		for (int x : new int[] {-3, 0, 3}) {
			for (int z = 10; z <= 21; z++) {
				put(level, origin, x, 1, z, Blocks.IRON_BLOCK);
				put(level, origin, x, 2, z, Blocks.IRON_BARS);
			}
		}

		for (int z : new int[] {12, 16, 20}) {
			put(level, origin, -5, 3, z, Blocks.SEA_LANTERN);
			put(level, origin, 5, 3, z, Blocks.SEA_LANTERN);
		}

		for (int x : new int[] {-24, 24}) {
			for (int z = -12; z <= 8; z += 5) {
				put(level, origin, x, 5, z, Blocks.SEA_LANTERN);
			}
		}
	}

	private static void buildTower(final Level level, final BlockPos origin, final int centerX, final int centerZ) {
		for (int layer = 0; layer < 7; layer++) {
			int radius = 9 - layer / 2;
			int y = 10 + layer;
			for (int dx = -radius; dx <= radius; dx++) {
				for (int dz = -radius; dz <= radius; dz++) {
					boolean edge = Math.abs(dx) == radius || Math.abs(dz) == radius;
					put(level, origin, centerX + dx, y, centerZ + dz, edge ? Blocks.BLACKSTONE : Blocks.POLISHED_ANDESITE);
				}
			}
		}

		for (int y = 17; y <= 35; y++) {
			boolean band = y == 17 || y == 22 || y == 28 || y == 34 || y == 35;
			for (int dx = -7; dx <= 7; dx++) {
				for (int dz = -7; dz <= 7; dz++) {
					int distanceSquared = dx * dx + dz * dz;
					if (distanceSquared <= 49 && distanceSquared >= 34) {
						Block wall = band
							? Blocks.BLACKSTONE
							: Math.abs(dx) == 7 || Math.abs(dz) == 7 ? Blocks.POLISHED_DEEPSLATE : Blocks.GLASS_PANE;
						put(level, origin, centerX + dx, y, centerZ + dz, wall);
					}
				}
			}
		}

		for (int dx = -4; dx <= 4; dx++) {
			for (int dz = -4; dz <= 4; dz++) {
				if (dx * dx + dz * dz <= 16) {
					put(level, origin, centerX + dx, 36, centerZ + dz, Blocks.SMOOTH_STONE);
				}
			}
		}

		for (int y = 36; y <= 41; y++) {
			put(level, origin, centerX, y, centerZ, Blocks.IRON_BARS);
		}
		put(level, origin, centerX - 3, 36, centerZ, Blocks.SEA_LANTERN);
		put(level, origin, centerX + 3, 36, centerZ, Blocks.SEA_LANTERN);
	}

	private static void put(final Level level, final BlockPos origin, final int x, final int y, final int z, final Block block) {
		level.setBlock(origin.offset(x, y, z), block.defaultBlockState(), 3, 512);
	}
}