Fabric API

Fabric API

106M Downloads

1.19.3 Ore Generation

rshchekotov opened this issue ยท 2 comments

commented

I was following this tutorial series and got to the point for ConfiguredFeatures or specifically in layman's terms: Ore Gen.

The issue is that the code shown in the tutorial is specific to the 1.19.2 (and below) and that some classes / constants are not available in the new update. I have seen the 1.19.3 Blogpost, and, if I understood it correctly, then the OreGen is now implemented with JSON files exclusively (as implied by the FabricDynamicRegistryProvider/DataGeneratorEntrypoint-examples in the blog).

I have checked the Wiki, which sadly isn't updated to 1.19.3 yet.
If there'll be a Wiki Update before this issue is answered, I'll close this with a link to the Wiki Page.

Given two

  • net.minecraft.block.Block's (say: XOre and XDeepslateOre)
  • net.minecraft.registry.RegistryKey<net.minecraft.block.Block>
  • net.minecraft.util.Identifier

(choose one, whichever is more convenient) could someone provide a minimal example of the required DataGen class for the OreGen (ideally with the init-call in DataGeneratorEntrypoint#onInitializeDataGenerator).

A link to a mod, which already implements the OreGen in 1.19.3 would also work.

Thank you very much in advance.
~ Doom

commented

Perhaps this would help to understand where I'm stuck, as of my understanding, you can generate stuctures, including ores with JSON Files.

I expected this to happen in a similar fashion as I would do with Block Tags (I use Kotlin btw):

package a.b.c.datagen.tag

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider.BlockTagProvider
import net.minecraft.registry.Registries
import net.minecraft.registry.RegistryWrapper
import net.minecraft.registry.tag.BlockTags
import a.b.c.registry.ModBlocks
import java.util.concurrent.CompletableFuture
import java.util.stream.Stream

class CustomBlockTagProvider(output: FabricDataOutput):
    BlockTagProvider(output, CompletableFuture.completedFuture(
        RegistryWrapper.WrapperLookup.of(Stream.of(Registries.BLOCK.tagCreatingWrapper))
    )) {

    override fun configure(arg: RegistryWrapper.WrapperLookup) {
        this.getOrCreateTagBuilder(BlockTags.LOGS)
            .setReplace(false)
            .add(ModBlocks.EXAMPLE_LOG)

        this.getOrCreateTagBuilder(BlockTags.LOGS_THAT_BURN)
            .setReplace(false)
            .add(ModBlocks.EXAMPLE_LOG)
    }
}

(the above works as I expect, it generated the proper tag-json's)

So, I tried:

@file:Suppress("UnstableApiUsage")

package a.b.c.datagen.feature.ore

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider
import net.minecraft.registry.Registries
import net.minecraft.registry.RegistryWrapper
import java.util.concurrent.CompletableFuture
import java.util.stream.Stream

class OreFeatureProvider(output: FabricDataOutput):
    FabricDynamicRegistryProvider(output, CompletableFuture.completedFuture(
        RegistryWrapper.WrapperLookup.of(Stream.of(Registries.FEATURE.tagCreatingWrapper))
    )) {
    override fun getName(): String {
        return "Features for minecraft:ore"
    }

    override fun configure(registries: RegistryWrapper.WrapperLookup, entries: Entries) {
        // TODO: Add ore features
    }
}

which fails with java.lang.IllegalStateException: Registry minecraft:dimension_type not found.

It seems that I have misunderstood something, so I hope for a clarification.

commented

๐Ÿ‘‹ We use the issue tracker exclusively for final bug reports and feature requests. However, this issue appears to be better suited for either a discussion thread, or a message on our discord server. Please post your request on one of these, and the conversation can continue there.