Fix world crash, restore custom ores, fix armor textures (NeoForge 1.21.1)
This commit is contained in:
@@ -4,9 +4,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
|
||||
## 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.
|
||||
Custom Ore Gem is a Minecraft **NeoForge** 1.21.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.
|
||||
**Note**: This mod replaces vanilla ore distribution with custom biome-based ore generation. For full functionality, it's recommended to use with KubeJS to remove vanilla ores (manual setup required).
|
||||
|
||||
## Build Commands
|
||||
|
||||
@@ -22,6 +22,9 @@ Custom Ore Gem is a Minecraft Forge 1.20.1 mod (mod ID: `custom_ore_gen`) that m
|
||||
|
||||
# Clean build artifacts
|
||||
./gradlew clean
|
||||
|
||||
# Generate resources (data generation for assets/resources)
|
||||
./gradlew runData
|
||||
```
|
||||
|
||||
The built JAR is named `custom_ore_gen-{version}.jar` and appears in `build/libs/`.
|
||||
@@ -30,14 +33,19 @@ The built JAR is named `custom_ore_gen-{version}.jar` and appears in `build/libs
|
||||
|
||||
### MCreator Workflow
|
||||
|
||||
This project uses MCreator. Important files contain regeneration markers:
|
||||
This project uses MCreator. Files marked with `MCreator note: This file will be REGENERATED on each build.` at the top will be completely overwritten on each build. These include:
|
||||
- `src/main/java/net/mcreator/customoregen/init/CustomOreGenModBlocks.java`
|
||||
- `src/main/java/net/mcreator/customoregen/init/CustomOreGenModItems.java`
|
||||
- `src/main/java/net/mcreator/customoregen/init/CustomOreGenModTabs.java`
|
||||
|
||||
**Protected User Code Blocks**: Only `CustomOreGenModItems.java` contains protected user code blocks:
|
||||
|
||||
```java
|
||||
// Start of user code block [name]
|
||||
// End of user code block [name]
|
||||
// Start of user code block custom items
|
||||
// End of user code block custom items
|
||||
```
|
||||
|
||||
**Always preserve code between these markers** when editing. The file header notes which files are regenerated (e.g., `CustomOreGenModItems.java`).
|
||||
**Always preserve code between these markers** when editing. All custom items (Ore Biome Finder, Shard Diamond armor, Paxel) are registered in this section.
|
||||
|
||||
### Package Structure
|
||||
|
||||
@@ -45,9 +53,10 @@ This project uses MCreator. Important files contain regeneration markers:
|
||||
net.mcreator.customoregen/
|
||||
├── CustomOreGenMod.java # Main mod class, registers event bus
|
||||
├── OresCommand.java # /ores command implementation
|
||||
├── block/ # Ore block classes (16 blocks)
|
||||
├── ShardDiamondArmorMaterial.java # Armor material class for Shard Diamond armor
|
||||
├── block/ # Ore block classes (17 blocks)
|
||||
├── item/ # Items (Diamond Shard, tools, armor, Paxel, OreBiomeFinder)
|
||||
├── config/ # Forge configuration system (ModConfigs.java)
|
||||
├── config/ # NeoForge configuration system (ModConfigs.java)
|
||||
├── procedures/ # Game logic (ConfigurableOreDropsProcedure, OreexperienceProcedure)
|
||||
└── init/
|
||||
├── CustomOreGenModBlocks.java # Block registry (deferred register)
|
||||
@@ -57,7 +66,7 @@ net.mcreator.customoregen/
|
||||
|
||||
### Ore Generation System
|
||||
|
||||
The mod uses Forge biome modifiers to distribute ores based on biome temperature tags. The architecture:
|
||||
The mod uses **NeoForge** 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)
|
||||
@@ -65,14 +74,24 @@ The mod uses Forge biome modifiers to distribute ores based on biome temperature
|
||||
- `mountain_biomes.json` - Mountain biomes (high emerald)
|
||||
- `rare_biomes.json` - Rare biomes (lower emerald)
|
||||
- `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/`):
|
||||
- Each ore has a JSON file linking it to biome tags
|
||||
- Special case: `deepslatesharddiamondore_biome_modifier.json` uses `forge:any` for all biomes
|
||||
- Special case: `deepslatesharddiamondore_biome_modifier.json` uses `"type": "forge:any"` for all biomes
|
||||
- **JSON Structure**:
|
||||
```json
|
||||
{
|
||||
"type": "forge:add_features",
|
||||
"biomes": "custom_ore_gen:cold_biomes", // or {"type": "forge:any"} for all biomes
|
||||
"features": "custom_ore_gen:deepslatesharddiamondore",
|
||||
"step": "underground_ores"
|
||||
}
|
||||
```
|
||||
|
||||
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
|
||||
- `placed_feature/` - Places the feature in the world with vertical anchors
|
||||
|
||||
### Diamond Shard Progression Tier
|
||||
|
||||
@@ -87,29 +106,37 @@ Diamond Shards are an intermediate tier between Iron and Diamond:
|
||||
|
||||
Located in `src/main/java/net/mcreator/customoregen/config/`:
|
||||
|
||||
- `ModConfigs.java` - Forge configuration with 4 sections: `ore_generation`, `tool_stats`, `drops`, `features`
|
||||
- `ModConfigs.java` - NeoForge configuration with 4 nested config classes: `OreGenConfig`, `ToolStatsConfig`, `DropsConfig`, `FeatureToggleConfig`
|
||||
- `ConfigHelper.java` - Utility class for accessing config values
|
||||
- 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.
|
||||
**Current Implementation Status**:
|
||||
- **⚠️ 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
|
||||
|
||||
### 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.
|
||||
The `OreBiomeFinderItem` (`item/OreBiomeFinderItem.java`) and `/ores` command (`OresCommand.java`) detect which mod tags apply to the current biome and list findable ores.
|
||||
|
||||
**Implementation Details**:
|
||||
- Uses `TagKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath("custom_ore_gen", "..."))` to define biome tags
|
||||
- Checks `level.getBiome(pos()).is()` to test tag membership
|
||||
- Displays biome ID, applicable tags, and ore list with height ranges
|
||||
- Hardcoded ore lists by category (COLD_ORES, HOT_ORES, etc.) in `OreBiomeFinderItem.java`
|
||||
|
||||
## Adding a New Ore
|
||||
|
||||
To add a new ore type (requires MCreator for full integration):
|
||||
|
||||
1. **Create the block** in MCreator
|
||||
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`
|
||||
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/`.
|
||||
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/`)
|
||||
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
|
||||
|
||||
## User Code Sections
|
||||
|
||||
@@ -119,12 +146,28 @@ When editing MCreator-generated files, only modify code between:
|
||||
// End of user code block [section_name]
|
||||
```
|
||||
|
||||
For example, in `CustomOreGenModItems.java`:
|
||||
For example, in `CustomOreGenModItems.java` (lines 67-78):
|
||||
```java
|
||||
// Start of user code block custom items
|
||||
public static final Supplier<Item> ORE_BIOME_FINDER = REGISTRY.register("ore_biome_finder", () -> new OreBiomeFinderItem());
|
||||
// ... armor, paxel registrations
|
||||
// End of user code block custom items
|
||||
```
|
||||
|
||||
**Important**: Custom items like the Ore Biome Finder, Shard Diamond armor, and Paxel are registered in this protected section and will survive MCreator rebuilds.
|
||||
|
||||
## Biomes O' Plenty Integration
|
||||
|
||||
The mod includes BOP biome support through biome tag entries. BOP biomes are wrapped with:
|
||||
```json
|
||||
{
|
||||
"id": "biomesoplenty:biome_name",
|
||||
"required": false
|
||||
}
|
||||
```
|
||||
|
||||
The `"required": false` flag ensures the game doesn't crash if BOP isn't installed. When adding new BOP biomes, add them to the appropriate category tag JSON files in `tags/worldgen/biome/`.
|
||||
|
||||
## Testing
|
||||
|
||||
After making changes:
|
||||
@@ -132,9 +175,41 @@ After making changes:
|
||||
2. Run `./gradlew runClient` to test in-game
|
||||
3. Check logs in `run/logs/` for errors
|
||||
|
||||
## Version Info
|
||||
## Important Notes
|
||||
|
||||
- Minecraft: 1.20.1
|
||||
- Forge: 47.3.0
|
||||
- Java: 17
|
||||
- Current mod version: 2.0.8 (defined in `build.gradle`)
|
||||
### README Disclaimer
|
||||
The `README.md` file contains outdated information referring to Forge 1.20.1. The current codebase uses **NeoForge 1.21.1**. Always trust `gradle.properties` and this file for accurate version information.
|
||||
|
||||
### Recipe Compatibility
|
||||
The mod includes recipes for:
|
||||
- **Mekanism**: Enriching recipes for concentrated ores and shard diamond
|
||||
- **Create**: Crushing and milling recipes for ore processing
|
||||
- **Sculk Catalyst**: Diamond shard to sculk catalyst conversion
|
||||
|
||||
### Version Information
|
||||
- **Minecraft**: 1.21.1
|
||||
- **NeoForge**: 21.1.219 (defined in `gradle.properties` as `neo_version`)
|
||||
- **Java**: 21 (configured via Java toolchain in build.gradle)
|
||||
- **Mod Version**: 3.0 (defined in `gradle.properties` as `mod_version`)
|
||||
|
||||
### Mod Registration Order
|
||||
In `CustomOreGenMod` constructor, registration order is:
|
||||
1. `CustomOreGenModBlocks.REGISTRY.register(modEventBus)` - Blocks must be registered first
|
||||
2. `CustomOreGenModItems.REGISTRY.register(modEventBus)` - Items depend on blocks for BlockItems
|
||||
3. `CustomOreGenModTabs.REGISTRY.register(modEventBus)` - Creative tabs depend on items
|
||||
|
||||
### Server Work Queue Pattern
|
||||
The mod includes a server tick work queue (`CustomOreGenMod.java:52-69`) for deferring execution:
|
||||
- `queueServerWork(int tick, Runnable action)` - Schedule work to run after N server ticks
|
||||
- Only executes on server thread (`SidedThreadGroups.SERVER`)
|
||||
- Processed during `ServerTickEvent.Post`
|
||||
- Use this for operations that need to happen after a delay or during gameplay
|
||||
|
||||
### DeferredRegister Pattern
|
||||
All registries use NeoForge's `DeferredRegister.create(Registries.X, CustomOreGenMod.MODID)` pattern. This is the modern NeoForge 1.21 registration method replacing the old Forge registry system.
|
||||
|
||||
### NeoForge 1.21 Tool Tier Implementation
|
||||
When creating custom tool items (Tier), you must implement `getIncorrectBlocksForDrops()`:
|
||||
- Returns `TagKey<Block>` or `null`
|
||||
- If `null`, all blocks can be dropped (current implementation in `SharddiamondpickaxeItem.java:38-40`)
|
||||
- This replaces the old Forge 1.20 `getTier()` and incorrect blocks logic
|
||||
|
||||
Reference in New Issue
Block a user