FACTO SHUBH
📎 1 file 1,212 chars
📄
pasted-code-1793691511499.txt
txt 13 lines
▶
Create a complete Fabric mod named **NGS Lucky Trees** for Minecraft Java 26.3. Convert leaves on all existing and newly generated Overworld trees into custom yellow Lucky Blocks with black question marks.

When broken, each block should randomly give:
- 💎 **Ores:** Diamond, emerald, gold, iron, netherite ingot (very rare).
- ⚔️ **Gear:** Enchanted swords, armor, bows, tools.
- 🍎 **Loot:** Golden apples, enchanted golden apples (ultra-rare), food, XP bottles.
- 💰 **Treasures:** Diamonds, emerald blocks, gold blocks, rare loot.
- 🐉 **Mobs:** Friendly animals, iron golems, or hostile mobs as surprises.
- 💥 **Events:** TNT surprise, lightning, random item showers, bonus loot.
- 🍀 **Jackpot:** Netherite gear, huge diamond rewards, or extremely rare treasure.
- 😂 **Funny surprises:** Chickens, falling anvils, harmless particle effects.

Include configurable chances, proper custom block textures/models, all Java source and Gradle files, and `fabric.mod.json`. Ensure compatibility with Minecraft Java 26.3 and provide a downloadable project ZIP plus exact Windows build/install instructions. Do not use fake or outdated APIs; state honestly if the mod has not been compiled and tested.
Kodari AI
KodariNov 3 at 7:42 am 1
LuckyTreeBlocks
Converts all Overworld tree leaves into custom yellow Lucky Blocks with black question marks. Breaking a block triggers random rewards including ores, enchanted gear, golden apples, treasure blocks, friendly or hostile mobs, TNT explosions, lightning strikes, item showers, jackpot netherite rewards, and funny surprises like chickens or falling anvils. Features configurable drop chances via JSON config, custom block textures and models, full Fabric mod structure with Java sources, Gradle build files, and fabric.mod.json targeting Minecraft Java 26.3. Provides exact Windows build and installation instructions with downloadable project ZIP. Honestly states the mod has not been compiled or tested against the actual 26.3 release.
  1. Add the Lucky Block, its custom texture/model, and a survival loot table.

  2. Convert Overworld leaves when chunks load, and add configurable weighted surprise outcomes.

  3. Set up the Fabric 26.3 Gradle project and mod metadata.

[Generation stopped]

FACTO SHUBH

done?

Kodari AI
KodariNov 3 at 7:44 am 1

Not done yet—the previous reply stopped at a plan and created no files.

  1. Implement the block, tree conversion, configurable rewards, and break events.

  2. Add the custom block art and required Minecraft resources.

  3. Add the Fabric 26.3 project files and explain how to compile in Kodari and install on Windows.

[Generation stopped]

FACTO SHUBH

now create again

Kodari AI
KodariNov 3 at 7:58 am 4
  1. Register a custom Lucky Leaves block and texture, and convert Overworld leaves as chunks load.

  2. Add configurable reward odds and randomized item, mob, and event surprises on break.

  3. Add the Fabric 26.3 project metadata/resources and provide Kodari compile and Windows install steps.The first pass identified the right chunk-load and block-break hooks. I’m checking the remaining 26.3 block, item, and resource formats before writing the project.

Implemented the NGS Lucky Trees Fabric 26.3 project in the workspace, including the custom Lucky Leaves texture, chunk-load conversion, randomized rewards and surprises, and configurable chances in config/ngsluckytrees.properties.

Build and install on Windows

  1. In Kodari, click Compile in the top bar. On a phone, tap ⋮ → Compile Project.

  2. Click Compile in the window that opens.

  3. When the build succeeds, click Download for the build or the Download ngsluckytrees.jar button in chat.

  4. Use a Minecraft 26.3 Fabric profile with Fabric Loader 0.19.5 and Fabric API 0.161.0+26.3. Press Win+R, enter %appdata%\.minecraft\mods, and copy the downloaded mod jar there. Put the Fabric API jar in that folder too if it isn’t already installed.

  5. Launch the Fabric 26.3 profile. Overworld tree leaves convert as their chunks load; breaking Lucky Leaves triggers the rewards.

I can’t attach a project ZIP from this chat; the source files are in the workspace, and Kodari’s build download provides the mod jar. I have not compiled or tested the mod in-game.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
11 355
src/main/java/com/ngs/ngsluckytrees/NgsLuckyTrees.java
package com.ngs.ngsluckytrees;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
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.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntitySpawnReason;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.sounds.AmbientLeavesBlockSoundPlayer;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.item.BlockItem;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;
import java.util.concurrent.ThreadLocalRandom;

public final class NgsLuckyTrees implements ModInitializer {
	public static final String MOD_ID = "ngsluckytrees";
	private static final Identifier LUCKY_LEAVES_ID = Identifier.fromNamespaceAndPath(MOD_ID, "lucky_leaves");
	private static final ResourceKey<Item> LUCKY_LEAVES_ITEM_KEY = ResourceKey.create(Registries.ITEM, LUCKY_LEAVES_ID);

	public static final Block LUCKY_LEAVES = Registry.register(
			BuiltInRegistries.BLOCK,
			LUCKY_LEAVES_ID,
			new LuckyLeavesBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES))
	);
	public static final Item LUCKY_LEAVES_ITEM = Registry.register(
			BuiltInRegistries.ITEM,
			LUCKY_LEAVES_ITEM_KEY,
			new BlockItem(LUCKY_LEAVES, new Item.Properties().setId(LUCKY_LEAVES_ITEM_KEY))
	);

	private static int jackpotChance = 1;
	private static int mobChance = 10;
	private static int eventChance = 15;

	@Override
	public void onInitialize() {
		loadConfig();

		ResourceKey<CreativeModeTab> naturalBlocks = ResourceKey.create(
				Registries.CREATIVE_MODE_TAB,
				Identifier.withDefaultNamespace("natural_blocks")
		);
		CreativeModeTabEvents.modifyOutputEvent(naturalBlocks).register(output -> output.accept(LUCKY_LEAVES_ITEM));

		ServerChunkEvents.CHUNK_LOAD.register(NgsLuckyTrees::convertLeaves);
		PlayerBlockBreakEvents.AFTER.register((level, player, pos, state, blockEntity) -> {
			if (state.getBlock() != LUCKY_LEAVES || !(level instanceof ServerLevel serverLevel)) {
				return;
			}

			ThreadLocalRandom random = ThreadLocalRandom.current();
			if (random.nextInt(100) < jackpotChance) {
				jackpot(serverLevel, pos, random);
			} else if (random.nextInt(100) < eventChance) {
				surpriseEvent(serverLevel, pos, random);
			} else if (random.nextInt(100) < mobChance) {
				mobSurprise(serverLevel, pos, random);
			} else {
				ordinaryReward(serverLevel, pos, random);
			}
		});
	}

	private static void convertLeaves(ServerLevel level, LevelChunk chunk, boolean generated) {
		if (!level.dimension().equals(Level.OVERWORLD)) {
			return;
		}

		ChunkPos chunkPos = chunk.getPos();
		BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
		for (int x = chunkPos.getMinBlockX(); x <= chunkPos.getMaxBlockX(); x++) {
			for (int z = chunkPos.getMinBlockZ(); z <= chunkPos.getMaxBlockZ(); z++) {
				for (int y = level.getMinY(); y <= level.getMaxY(); y++) {
					pos.set(x, y, z);
					BlockState state = chunk.getBlockState(pos);
					if (state.getBlock() instanceof LeavesBlock && state.getBlock() != LUCKY_LEAVES) {
						level.setBlock(pos, LUCKY_LEAVES.defaultBlockState(), 3, 512);
					}
				}
			}
		}
	}

	private static void loadConfig() {
		Path path = Path.of("config", MOD_ID + ".properties");
		Properties properties = new Properties();
		properties.setProperty("jackpot_chance_percent", "1");
		properties.setProperty("mob_surprise_chance_percent", "10");
		properties.setProperty("event_surprise_chance_percent", "15");

		try {
			Files.createDirectories(path.getParent());
			if (Files.exists(path)) {
				try (var reader = Files.newBufferedReader(path)) {
					properties.load(reader);
				}
			} else {
				try (var writer = Files.newBufferedWriter(path)) {
					properties.store(writer, "NGS Lucky Trees chances (0-100 percent)");
				}
			}
		} catch (IOException exception) {
			throw new UncheckedIOException("Could not read or create " + path, exception);
		}

		jackpotChance = readChance(properties, "jackpot_chance_percent", 1);
		mobChance = readChance(properties, "mob_surprise_chance_percent", 10);
		eventChance = readChance(properties, "event_surprise_chance_percent", 15);
	}

	private static int readChance(Properties properties, String key, int fallback) {
		try {
			return Math.max(0, Math.min(100, Integer.parseInt(properties.getProperty(key))));
		} catch (NumberFormatException exception) {
			return fallback;
		}
	}

	private static void ordinaryReward(ServerLevel level, BlockPos pos, ThreadLocalRandom random) {
		if (random.nextInt(1000) == 0) {
			drop(level, pos, new ItemStack(Items.ENCHANTED_GOLDEN_APPLE));
			return;
		}
		if (random.nextInt(200) == 0) {
			drop(level, pos, new ItemStack(Items.NETHERITE_INGOT));
			return;
		}

		ItemStack reward = switch (random.nextInt(12)) {
			case 0 -> new ItemStack(Items.DIAMOND, random.nextInt(1, 5));
			case 1 -> new ItemStack(Items.EMERALD, random.nextInt(2, 7));
			case 2 -> new ItemStack(Items.GOLD_INGOT, random.nextInt(3, 9));
			case 3 -> new ItemStack(Items.IRON_INGOT, random.nextInt(4, 13));
			case 4 -> new ItemStack(Items.GOLDEN_APPLE);
			case 5 -> new ItemStack(Items.EXPERIENCE_BOTTLE, random.nextInt(2, 6));
			case 6 -> new ItemStack(Items.BREAD, random.nextInt(2, 9));
			case 7 -> new ItemStack(Items.COOKED_BEEF, random.nextInt(2, 7));
			case 8 -> enchanted(level, Items.DIAMOND_SWORD, Enchantments.SHARPNESS, 2);
			case 9 -> enchanted(level, Items.DIAMOND_HELMET, Enchantments.PROTECTION, 2);
			case 10 -> enchanted(level, Items.BOW, Enchantments.POWER, 2);
			default -> enchanted(level, Items.DIAMOND_PICKAXE, Enchantments.EFFICIENCY, 2);
		};
		drop(level, pos, reward);
	}

	private static void jackpot(ServerLevel level, BlockPos pos, ThreadLocalRandom random) {
		switch (random.nextInt(3)) {
			case 0 -> drop(level, pos, new ItemStack(Items.DIAMOND, random.nextInt(32, 65)));
			case 1 -> {
				drop(level, pos, enchanted(level, Items.NETHERITE_SWORD, Enchantments.SHARPNESS, 4));
				drop(level, pos, enchanted(level, Items.NETHERITE_HELMET, Enchantments.PROTECTION, 4));
			}
			default -> {
				drop(level, pos, new ItemStack(Items.DIAMOND_BLOCK, 3));
				drop(level, pos, new ItemStack(Items.EMERALD_BLOCK, 2));
				drop(level, pos, new ItemStack(Items.NETHERITE_INGOT));
			}
		}
	}

	private static void mobSurprise(ServerLevel level, BlockPos pos, ThreadLocalRandom random) {
		EntityType<?> type = switch (random.nextInt(5)) {
			case 0 -> EntityTypes.CHICKEN;
			case 1 -> EntityTypes.COW;
			case 2 -> EntityTypes.IRON_GOLEM;
			case 3 -> EntityTypes.ZOMBIE;
			default -> EntityTypes.CREEPER;
		};
		spawn(level, pos, type);
	}

	private static void surpriseEvent(ServerLevel level, BlockPos pos, ThreadLocalRandom random) {