chore: align ore drops and XP with vanilla 1.21 and add AGENTS.md guide

This commit is contained in:
felden.r@grenoble.archi.fr
2026-02-03 09:23:25 +01:00
parent 93bb4afb97
commit 7bd578797b
6 changed files with 315 additions and 50 deletions
+48 -5
View File
@@ -57,6 +57,7 @@ net.mcreator.customoregen/
├── block/ # Ore block classes (17 blocks)
├── item/ # Items (Diamond Shard, tools, armor, Paxel, OreBiomeFinder)
├── config/ # NeoForge configuration system (ModConfigs.java)
├── event/ # Event handlers (OreBreakEventHandler, EnchantabilityFix)
├── procedures/ # Game logic (ConfigurableOreDropsProcedure, OreexperienceProcedure)
└── init/
├── CustomOreGenModBlocks.java # Block registry (deferred register)
@@ -76,13 +77,13 @@ The mod uses **NeoForge** biome modifiers to distribute ores based on biome temp
- `tempered_biomes.json` - Temperate biomes (iron, concentrated coal)
- BOP biomes are included with `"required": false` for optional compatibility
2. **Biome Modifiers** (`src/main/resources/data/custom_ore_gen/forge/biome_modifier/`):
2. **Biome Modifiers** (`src/main/resources/data/custom_ore_gen/neoforge/biome_modifier/`):
- Each ore has a JSON file linking it to biome tags
- Special case: `deepslatesharddiamondore_biome_modifier.json` uses `"type": "forge:any"` for all biomes
- **JSON Structure**:
```json
{
"type": "forge:add_features",
"type": "neoforge:add_features",
"biomes": "custom_ore_gen:cold_biomes", // or {"type": "forge:any"} for all biomes
"features": "custom_ore_gen:deepslatesharddiamondore",
"step": "underground_ores"
@@ -111,10 +112,11 @@ Located in `src/main/java/net/mcreator/customoregen/config/`:
- Generated config file: `config/custom_ore_gen-common.toml` (created on first run)
**Current Implementation Status**:
- **✅ Ore Drops**: Fully implemented via `OreBreakEventHandler.java` which listens to `BlockEvent.BreakEvent` and calls `ConfigurableOreDropsProcedure.execute()` for all custom ores
- **⚠️ Tool Stats**: Config classes exist in `ModConfigs.java`, but tools currently have hardcoded values (e.g., `SharddiamondpickaxeItem.java:18` has `return 200` for durability). Config reading not yet implemented.
- **⚠️ Ore Drops**: `ConfigurableOreDropsProcedure.java` exists but requires MCreator integration to link to block loot tables
- **⚠️ Feature Toggles**: Defined in `FeatureToggleConfig` but not yet wired to block/item registration conditional logic
- **⚠️ Ore Generation**: Config values exist but worldgen JSON files still use hardcoded values
- **⚠️ Enchantability**: `EnchantabilityFix.java` exists but is commented out - enchantment values not yet applied to items
### Ore Biome Finder
@@ -131,12 +133,13 @@ The `OreBiomeFinderItem` (`item/OreBiomeFinderItem.java`) and `/ores` command (`
To add a new ore type (requires MCreator for full integration):
1. **Create the block** in MCreator with proper properties (sound type, harvest level, etc.)
2. **Add loot table** at `src/main/resources/data/custom_ore_gen/loot_tables/blocks/{orename}.json`
2. **Add loot table** at `src/main/resources/data/custom_ore_gen/loot_table/blocks/{orename}.json` (note: `loot_table` not `loot_tables`)
3. **Add configured_feature** JSON in `src/main/resources/data/custom_ore_gen/worldgen/configured_feature/`
4. **Add placed_feature** JSON in `src/main/resources/data/custom_ore_gen/worldgen/placed_feature/`
5. **Create biome_modifier** JSON in `src/main/resources/data/custom_ore_gen/forge/biome_modifier/` linking to a biome tag (or create a new tag in `tags/worldgen/biome/`)
5. **Create biome_modifier** JSON in `src/main/resources/data/custom_ore_gen/neoforge/biome_modifier/` linking to a biome tag (or create a new tag in `tags/worldgen/biome/`)
6. **Add BOP entries** (optional) to appropriate biome tag JSON files with `"required": false` wrapper
7. **Update `OreBiomeFinderItem.java`** to add the new ore to the appropriate category list
8. **Add ore type mapping** in `OreBreakEventHandler.java` if you want configurable drops via `ConfigurableOreDropsProcedure`
## User Code Sections
@@ -156,6 +159,36 @@ public static final Supplier<Item> ORE_BIOME_FINDER = REGISTRY.register("ore_bio
**Important**: Custom items like the Ore Biome Finder, Shard Diamond armor, and Paxel are registered in this protected section and will survive MCreator rebuilds.
## Event Handlers
The mod uses NeoForge's event system for ore processing:
### OreBreakEventHandler
- Listens to `BlockEvent.BreakEvent` with `@SubscribeEvent`
- Maps custom ore blocks to ore type strings (`shard_diamond`, `concentrated_coal`, `pure_golden`, etc.)
- Calls `ConfigurableOreDropsProcedure.execute()` with ore type when player breaks ore with correct tool
- Supports 10 ore types: shard_diamond, concentrated_coal, pure_golden, impure_iron, concentrated_diamond, lapis, redstone, emerald, copper
### EnchantabilityFix
- Uses `ModifyDefaultComponentsEvent` to set enchantability values on tools and armor
- Currently **commented out** - enchantability not yet applied
- When active, should set `DataComponents.ENCHANTABLE` with value 9 (tools) or 14 (armor)
## Loot Table Format
NeoForge 1.21 uses `loot_table` (singular) instead of `loot_tables` (plural):
- Location: `src/main/resources/data/custom_ore_gen/loot_table/blocks/{orename}.json`
- Includes Silk Touch support via `match_tool` condition
- Uses `random_sequence` for loot table randomization
- Example structure in `deepslatesharddiamondore.json` shows Silk Touch → drop block, otherwise drops handled by `OreBreakEventHandler`
## Vanilla Ore Removal
The mod removes vanilla ores via NeoForge biome modifiers (NOT KubeJS anymore):
- `src/main/resources/data/custom_ore_gen/neoforge/biome_modifier/remove_vanilla_ores.json`
- Uses `neoforge:remove_features` type to remove vanilla ore generation
- This replaces the old KubeJS automatic script system from Forge 1.20.1
## Biomes O' Plenty Integration
The mod includes BOP biome support through biome tag entries. BOP biomes are wrapped with:
@@ -175,6 +208,16 @@ After making changes:
2. Run `./gradlew runClient` to test in-game
3. Check logs in `run/logs/` for errors
## Enchantment Tags
The mod includes enchantment tags at `src/main/resources/data/minecraft/tags/item/enchantable/`:
- **armor.json** - Marks Shard Diamond armor pieces as enchantable
- **durability.json** - Marks tools and armor for durability enchantments
- **mining.json** - Marks pickaxes, shovels, and paxel as mining tools
- **weapon.json** - Marks axes as weapons
These tags enable proper enchantment behavior for custom items in the enchanting table and anvil.
## Important Notes
### README Disclaimer