diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..0c4cf3113 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,140 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +Custom Ore Gem is a Minecraft Forge 1.20.1 mod (mod ID: `custom_ore_gen`) that modifies ore distribution and adds Diamond Shard-tier tools and armor. This is an **MCreator project** - code in `src/main/java` is partially regenerated on each build. + +**Key**: This mod is designed to work with KubeJS and is not meant to be used standalone. + +## Build Commands + +```bash +# Build the mod (generates .jar in build/libs/) +./gradlew build + +# Run client for testing +./gradlew runClient + +# Run server for testing +./gradlew runServer + +# Clean build artifacts +./gradlew clean +``` + +The built JAR is named `custom_ore_gen-{version}.jar` and appears in `build/libs/`. + +## Architecture + +### MCreator Workflow + +This project uses MCreator. Important files contain regeneration markers: + +```java +// Start of user code block [name] +// End of user code block [name] +``` + +**Always preserve code between these markers** when editing. The file header notes which files are regenerated (e.g., `CustomOreGenModItems.java`). + +### Package Structure + +``` +net.mcreator.customoregen/ +├── CustomOreGenMod.java # Main mod class, registers event bus +├── OresCommand.java # /ores command implementation +├── block/ # Ore block classes (16 blocks) +├── item/ # Items (Diamond Shard, tools, armor, Paxel, OreBiomeFinder) +├── config/ # Forge configuration system (ModConfigs.java) +├── procedures/ # Game logic (ConfigurableOreDropsProcedure, OreexperienceProcedure) +└── init/ + ├── CustomOreGenModBlocks.java # Block registry (deferred register) + ├── CustomOreGenModItems.java # Item registry (REGENERATED) + └── CustomOreGenModTabs.java # Creative tabs registry +``` + +### Ore Generation System + +The mod uses Forge biome modifiers to distribute ores based on biome temperature tags. The architecture: + +1. **Biome Tags** (`src/main/resources/data/custom_ore_gen/tags/worldgen/biome/`): + - `cold_biomes.json` - Cold biomes (lapis, concentrated diamond) + - `hot_biomes.json` - Hot biomes (pure gold, copper, redstone) + - `mountain_biomes.json` - Mountain biomes (high emerald) + - `rare_biomes.json` - Rare biomes (lower emerald) + - `tempered_biomes.json` - Temperate biomes (iron, concentrated coal) + +2. **Biome Modifiers** (`src/main/resources/data/custom_ore_gen/forge/biome_modifier/`): + - Each ore has a JSON file linking it to biome tags + - Special case: `deepslatesharddiamondore_biome_modifier.json` uses `forge:any` for all biomes + +3. **Worldgen Features** (`src/main/resources/data/custom_ore_gen/worldgen/`): + - `configured_feature/` - Defines ore vein size and height range + - `placed_feature/` - Places the feature in the world + +### Diamond Shard Progression Tier + +Diamond Shards are an intermediate tier between Iron and Diamond: + +- **Items**: Diamond Shard (`diamondshard`) - craft 9 shards into 1 diamond +- **Tools**: Pickaxe, Shovel, Axe (200 durability), Paxel (1000 durability, combines all three) +- **Armor**: Helmet (3), Chestplate (7), Leggings (5), Boots (2) - Total 17 protection, 1060 durability +- **Repair**: All Diamond Shard equipment uses Diamond Shards + +### Configuration System + +Located in `src/main/java/net/mcreator/customoregen/config/`: + +- `ModConfigs.java` - Forge configuration with 4 sections: `ore_generation`, `tool_stats`, `drops`, `features` +- Generated config file: `config/custom_ore_gen-common.toml` (created on first run) + +**Note**: As documented in `CONFIG_INTEGRATION_GUIDE.md`, the configuration system is partially implemented. Tool stats read from config, but ore drops require MCreator procedure integration to fully use config values. + +### Ore Biome Finder + +The `OreBiomeFinderItem` (`item/OreBiomeFinderItem.java`) and `/ores` command (`OresCommand.java`) detect which mod tags apply to the current biome and list findable ores. This works by checking if the biome is in any of the custom biome tags. + +## Adding a New Ore + +To add a new ore type (requires MCreator for full integration): + +1. **Create the block** in MCreator +2. **Add loot table** at `src/main/resources/data/custom_ore_gen/loot_tables/blocks/{orename}.json` +3. **Add configured_feature** JSON in `worldgen/configured_feature/` +4. **Add placed_feature** JSON in `worldgen/placed_feature/` +5. **Create biome_modifier** JSON linking to a biome tag (or create a new tag in `tags/worldgen/biome/`) +6. **Register** in `CustomOreGenModBlocks.java` + +## Biomes O' Plenty Integration + +The mod includes BOP biome support through additional biome tags. When adding BOP biomes, add them to the appropriate category tag JSON files in `tags/worldgen/biome/`. + +## User Code Sections + +When editing MCreator-generated files, only modify code between: +```java +// Start of user code block [section_name] +// End of user code block [section_name] +``` + +For example, in `CustomOreGenModItems.java`: +```java +// Start of user code block custom items +// End of user code block custom items +``` + +## Testing + +After making changes: +1. Run `./gradlew build` to verify compilation +2. Run `./gradlew runClient` to test in-game +3. Check logs in `run/logs/` for errors + +## Version Info + +- Minecraft: 1.20.1 +- Forge: 47.3.0 +- Java: 17 +- Current mod version: 2.0.8 (defined in `build.gradle`) diff --git a/src/main/java/net/mcreator/customoregen/item/ShardDiamondArmorMaterial.java b/src/main/java/net/mcreator/customoregen/item/ShardDiamondArmorMaterial.java new file mode 100644 index 000000000..ec2e8c605 --- /dev/null +++ b/src/main/java/net/mcreator/customoregen/item/ShardDiamondArmorMaterial.java @@ -0,0 +1,56 @@ +package net.mcreator.customoregen.item; + +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterial; +import net.minecraft.world.item.crafting.Ingredient; +import net.mcreator.customoregen.init.CustomOreGenModItems; +import net.mcreator.customoregen.CustomOreGenMod; + +public class ShardDiamondArmorMaterial implements ArmorMaterial { + public static final ShardDiamondArmorMaterial INSTANCE = new ShardDiamondArmorMaterial(); + + private static final int[] DURABILITY_PER_SLOT = new int[]{250, 300, 280, 230}; + private static final int[] PROTECTION_PER_SLOT = new int[]{3, 7, 5, 2}; + + @Override + public int getDurabilityForType(ArmorItem.Type type) { + return DURABILITY_PER_SLOT[type.getSlot().getIndex()]; + } + + @Override + public int getDefenseForType(ArmorItem.Type type) { + return PROTECTION_PER_SLOT[type.getSlot().getIndex()]; + } + + @Override + public int getEnchantmentValue() { + return 14; + } + + @Override + public SoundEvent getEquipSound() { + return SoundEvents.ARMOR_EQUIP_DIAMOND; + } + + @Override + public Ingredient getRepairIngredient() { + return Ingredient.of(CustomOreGenModItems.DIAMONDSHARD.get()); + } + + @Override + public String getName() { + return CustomOreGenMod.MODID + ":shard_diamond"; + } + + @Override + public float getToughness() { + return 1.0f; + } + + @Override + public float getKnockbackResistance() { + return 0.0f; + } +} diff --git a/src/main/java/net/mcreator/customoregen/item/SharddiamondbootsItem.java b/src/main/java/net/mcreator/customoregen/item/SharddiamondbootsItem.java index 393b5705c..1caccbb4a 100644 --- a/src/main/java/net/mcreator/customoregen/item/SharddiamondbootsItem.java +++ b/src/main/java/net/mcreator/customoregen/item/SharddiamondbootsItem.java @@ -1,49 +1,10 @@ package net.mcreator.customoregen.item; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Item; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; - -import net.mcreator.customoregen.init.CustomOreGenModItems; public class SharddiamondbootsItem extends ArmorItem { public SharddiamondbootsItem() { - super(new ArmorMaterial() { - public int getDurabilityForType(ArmorItem.Type type) { - return 230; // Bottes - } - - public int getDefenseForType(ArmorItem.Type type) { - return 2; // Protection - } - - public int getEnchantmentValue() { - return 14; - } - - public SoundEvent getEquipSound() { - return SoundEvents.ARMOR_EQUIP_DIAMOND; - } - - public Ingredient getRepairIngredient() { - return Ingredient.of(new ItemStack(CustomOreGenModItems.DIAMONDSHARD.get())); - } - - public String getName() { - return "shard_diamond"; - } - - public float getToughness() { - return 1.0f; - } - - public float getKnockbackResistance() { - return 0.0f; - } - }, ArmorItem.Type.BOOTS, new Item.Properties()); + super(ShardDiamondArmorMaterial.INSTANCE, ArmorItem.Type.BOOTS, new Item.Properties()); } } diff --git a/src/main/java/net/mcreator/customoregen/item/SharddiamondchestplateItem.java b/src/main/java/net/mcreator/customoregen/item/SharddiamondchestplateItem.java index 457a38c69..9a1119d63 100644 --- a/src/main/java/net/mcreator/customoregen/item/SharddiamondchestplateItem.java +++ b/src/main/java/net/mcreator/customoregen/item/SharddiamondchestplateItem.java @@ -1,49 +1,10 @@ package net.mcreator.customoregen.item; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Item; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; - -import net.mcreator.customoregen.init.CustomOreGenModItems; public class SharddiamondchestplateItem extends ArmorItem { public SharddiamondchestplateItem() { - super(new ArmorMaterial() { - public int getDurabilityForType(ArmorItem.Type type) { - return 300; // Plastron - } - - public int getDefenseForType(ArmorItem.Type type) { - return 7; // Protection - } - - public int getEnchantmentValue() { - return 14; - } - - public SoundEvent getEquipSound() { - return SoundEvents.ARMOR_EQUIP_DIAMOND; - } - - public Ingredient getRepairIngredient() { - return Ingredient.of(new ItemStack(CustomOreGenModItems.DIAMONDSHARD.get())); - } - - public String getName() { - return "shard_diamond"; - } - - public float getToughness() { - return 1.0f; - } - - public float getKnockbackResistance() { - return 0.0f; - } - }, ArmorItem.Type.CHESTPLATE, new Item.Properties()); + super(ShardDiamondArmorMaterial.INSTANCE, ArmorItem.Type.CHESTPLATE, new Item.Properties()); } } diff --git a/src/main/java/net/mcreator/customoregen/item/SharddiamondhelmetItem.java b/src/main/java/net/mcreator/customoregen/item/SharddiamondhelmetItem.java index 034ce5f24..211c70a49 100644 --- a/src/main/java/net/mcreator/customoregen/item/SharddiamondhelmetItem.java +++ b/src/main/java/net/mcreator/customoregen/item/SharddiamondhelmetItem.java @@ -1,49 +1,10 @@ package net.mcreator.customoregen.item; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Item; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; - -import net.mcreator.customoregen.init.CustomOreGenModItems; public class SharddiamondhelmetItem extends ArmorItem { public SharddiamondhelmetItem() { - super(new ArmorMaterial() { - public int getDurabilityForType(ArmorItem.Type type) { - return 250; // Casque - } - - public int getDefenseForType(ArmorItem.Type type) { - return 3; // Protection - } - - public int getEnchantmentValue() { - return 14; - } - - public SoundEvent getEquipSound() { - return SoundEvents.ARMOR_EQUIP_DIAMOND; - } - - public Ingredient getRepairIngredient() { - return Ingredient.of(new ItemStack(CustomOreGenModItems.DIAMONDSHARD.get())); - } - - public String getName() { - return "shard_diamond"; - } - - public float getToughness() { - return 1.0f; - } - - public float getKnockbackResistance() { - return 0.0f; - } - }, ArmorItem.Type.HELMET, new Item.Properties()); + super(ShardDiamondArmorMaterial.INSTANCE, ArmorItem.Type.HELMET, new Item.Properties()); } } diff --git a/src/main/java/net/mcreator/customoregen/item/SharddiamondleggingsItem.java b/src/main/java/net/mcreator/customoregen/item/SharddiamondleggingsItem.java index c6281edc9..f8a627065 100644 --- a/src/main/java/net/mcreator/customoregen/item/SharddiamondleggingsItem.java +++ b/src/main/java/net/mcreator/customoregen/item/SharddiamondleggingsItem.java @@ -1,49 +1,10 @@ package net.mcreator.customoregen.item; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Item; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; - -import net.mcreator.customoregen.init.CustomOreGenModItems; public class SharddiamondleggingsItem extends ArmorItem { public SharddiamondleggingsItem() { - super(new ArmorMaterial() { - public int getDurabilityForType(ArmorItem.Type type) { - return 280; // Jambières - } - - public int getDefenseForType(ArmorItem.Type type) { - return 5; // Protection - } - - public int getEnchantmentValue() { - return 14; - } - - public SoundEvent getEquipSound() { - return SoundEvents.ARMOR_EQUIP_DIAMOND; - } - - public Ingredient getRepairIngredient() { - return Ingredient.of(new ItemStack(CustomOreGenModItems.DIAMONDSHARD.get())); - } - - public String getName() { - return "shard_diamond"; - } - - public float getToughness() { - return 1.0f; - } - - public float getKnockbackResistance() { - return 0.0f; - } - }, ArmorItem.Type.LEGGINGS, new Item.Properties()); + super(ShardDiamondArmorMaterial.INSTANCE, ArmorItem.Type.LEGGINGS, new Item.Properties()); } } diff --git a/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondboots.png b/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondboots.png index 7b0c2c941..0e0918720 100644 Binary files a/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondboots.png and b/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondboots.png differ diff --git a/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondchestplate.png b/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondchestplate.png index 15cf585b9..4c6f02131 100644 Binary files a/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondchestplate.png and b/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondchestplate.png differ diff --git a/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondhelmet.png b/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondhelmet.png index b9a01f630..ce68e8f3d 100644 Binary files a/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondhelmet.png and b/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondhelmet.png differ diff --git a/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondleggings.png b/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondleggings.png index d74c77677..6e54ae1e8 100644 Binary files a/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondleggings.png and b/src/main/resources/assets/custom_ore_gen/textures/item/sharddiamondleggings.png differ diff --git a/src/main/resources/assets/custom_ore_gen/textures/models/armor/shard_diamond_layer_1.png b/src/main/resources/assets/custom_ore_gen/textures/models/armor/shard_diamond_layer_1.png index 7458059ed..8175e7909 100644 Binary files a/src/main/resources/assets/custom_ore_gen/textures/models/armor/shard_diamond_layer_1.png and b/src/main/resources/assets/custom_ore_gen/textures/models/armor/shard_diamond_layer_1.png differ diff --git a/src/main/resources/assets/custom_ore_gen/textures/models/armor/shard_diamond_layer_2.png b/src/main/resources/assets/custom_ore_gen/textures/models/armor/shard_diamond_layer_2.png index 2888cd240..b0e247da5 100644 Binary files a/src/main/resources/assets/custom_ore_gen/textures/models/armor/shard_diamond_layer_2.png and b/src/main/resources/assets/custom_ore_gen/textures/models/armor/shard_diamond_layer_2.png differ