Jump to content

Recommended Posts

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.

Posted

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...
Posted

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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