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.

CodingNoob52

Members
  • Joined

  • Last visited

Everything posted by CodingNoob52

  1. We were attempting to make an ore only drop an item when broken by a netherite pickaxe. At first, we tried adding in the register .requiresCorrectToolForDrops() but we didn't know how to define which tool is required. Then we tried adding tags like NEEDS_DIAMOND_TOOL but realized that there is no tag for netherite pickaxe. Even if we wanted to use the diamond tool tag, we still didn't know how to add a tag to this ore. Finally, we tried to just use a .json file with "match_tool" but that didn't work either. We also tried to add the tag MINEABLE_WITH_PICKAXE but still couldn't figure out how to add it. Here is the json file we tried. { "type": "minecraft:block", "pools": [ { "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", "conditions": [ { "condition": "minecraft:match_tool", "predicate": { "enchantments": [ { "enchantment": "minecraft:silk_touch", "levels": { "min": 1 } } ] } } ], "name": "examplemod:my_ore" }, { "type": "minecraft:item", "functions": [ { "enchantment": "minecraft:fortune", "formula": "minecraft:ore_drops", "function": "minecraft:apply_bonus" }, { "function": "minecraft:explosion_decay" } ], "name": "examplemod:my_ingot" } ] } ], "rolls": 1.0 } ] } We expected it to only drop the item when broken by a netherite pickaxe. However, it never dropped unless the pickaxe had silk touch and would then drop the ore as a block.
  2. 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.
  3. 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.

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.