Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Tutorials for modding Minecraft using Minecraftforge use a constant called BuiltInRegistries.CONFIGURED_FEATURE to allow a mod to register a custom feature. This constant is missing from Minecraft 1.19.3.

Does anyone know what this has been replaced with in 1.19.3 or know of an updated tutorial. Here's what we're doing:

 

final Block MY_ORE_BLOCK = Registry.register(BuiltInRegistries.BLOCK, "my_ore", new DropExperienceBlock(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(3.0F, 3.0F), UniformInt.of(3, 7))); final ResourceKey<ConfiguredFeature<?, ?>> MY_ORE_LARGE = FeatureUtils.createKey("my_ore_large"); List<OreConfiguration.TargetBlockState> list = List.of(OreConfiguration.target(ruletest1, MY_ORE_BLOCK.defaultBlockState())); ConfiguredFeature<?,?> feature = new ConfiguredFeature(Feature.ORE, new OreConfiguration(list, 4, 0.5F)); Registry.register(BuiltInRegistries.CONFIGURED_FEATURE, MY_ORE_LARGE, feature);

 

The purpose of the code being to create a new type of Ore and to register it as a feature so that the world generator generates deposits of it.

We tried to compile, but BuiltInRegistries doesn't have a CONFIGURED_FEATURE constant in 1.19.3 so that doesn't compile. We also tried to use FeatureUtils.register() to register the feature but couldn't find how to get a BootstapContext to pass to its first parameter.

  • Author

I found the solution to my problem:

In net.minecraftforge.common.world.ForgeBiomeModifiers there is a description of a json format used to add features to any existing biomes. I created a add_my_ore.json file in data/MYMOD/forge/biome_modifier/:

{
  "type": "forge:add_features",
  "biomes": "#minecraft:is_overworld",
  "features": ["examplemod:ore_mine","examplemod:ore_mine_large"],
  "step": "underground_ores"
}

I then add jsons to describe my ore feature in data/MYMOD/worldgen/configured_feature/ and data/MYMOD/worldgen/placed_feature/

For example, in configured feature: ore_mine.json

{
  "type": "minecraft:ore",
  "config": {
    "discard_chance_on_air_exposure": 0.0,
    "size": 20,
    "targets": [
      {
        "state": {
          "Name": "MYMOD:my_ore"
        },
        "target": {
          "predicate_type": "minecraft:tag_match",
          "tag": "minecraft:stone_ore_replaceables"
        }
      },
      {
        "state": {
          "Name": "MYMOD:my_ore"
        },
        "target": {
          "predicate_type": "minecraft:tag_match",
          "tag": "minecraft:deepslate_ore_replaceables"
        }
      }
    ]
  }
}

And in placed_feature: ore_mine.json

{
  "feature": "examplemod:ore_mine",
  "placement": [
    {
      "type": "minecraft:count",
      "count": 16
    },
    {
      "type": "minecraft:in_square"
    },
    {
      "type": "minecraft:height_range",
      "height": {
        "type": "minecraft:trapezoid",
        "max_inclusive": {
          "absolute": 112
        },
        "min_inclusive": {
          "absolute": -16
        }
      }
    },
    {
      "type": "minecraft:biome"
    }
  ]
}

This combination of files causes forge to create a ConfiguredFeature to add my custom ore using the same built-in class that places built-in ores, and adds this feature to all Biomes. Of course, I still needed to write the code to define my custom ore, but this solved the world-gen part.

  • 4 weeks later...

Hello, I'm trying to add ore generation as well and have used this for help, and am very new to java. do you know how to define the custom ore in forge 1.19.3? 

I think I've got the solution, but @CodingNoob52, what do i import to make the "java class work. aka what imports make 

 "final Block MY_ORE_BLOCK = Registry.register(BuiltInRegistries.BLOCK, "my_ore", new DropExperienceBlock(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(3.0F, 3.0F), UniformInt.of(3, 7))); final ResourceKey<ConfiguredFeature<?, ?>> MY_ORE_LARGE = FeatureUtils.createKey("my_ore_large"); List<OreConfiguration.TargetBlockState> list = List.of(OreConfiguration.target(ruletest1, MY_ORE_BLOCK.defaultBlockState())); ConfiguredFeature<?,?> feature = new ConfiguredFeature(Feature.ORE, new OreConfiguration(list, 4, 0.5F)); Registry.register(BuiltInRegistries.CONFIGURED_FEATURE, MY_ORE_LARGE, feature);" 

work.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.