Kotlin for Forge

Kotlin for Forge

54M Downloads

Missing block variant

RealYusufIsmail opened this issue ยท 10 comments

commented

The version being used : 3.9.0

I keep getting this error

[14:14:57] [Worker-Main-4/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'armourandtoolsmod:blockstates/ruby_ore.json' missing model for variant: 'armourandtoolsmod:ruby_ore#facing=north'
[14:14:57] [Worker-Main-4/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'armourandtoolsmod:blockstates/ruby_ore.json' missing model for variant: 'armourandtoolsmod:ruby_ore#facing=west'
[14:14:57] [Worker-Main-4/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'armourandtoolsmod:blockstates/ruby_ore.json' missing model for variant: 'armourandtoolsmod:ruby_ore#facing=south'
[14:14:57] [Worker-Main-4/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'armourandtoolsmod:blockstates/ruby_ore.json' missing model for variant: 'armourandtoolsmod:ruby_ore#facing=east'

When I used this type of texture with forge in Java it worked. I have no idea why it is not working.

class ModBlockStateProvider(output: PackOutput, exFileHelper: ExistingFileHelper) :
    BlockStateProvider(output, MOD_ID, exFileHelper) {

    override fun getName(): String {
        return "Armour and Tools Mod Blockstates"
    }

    override fun registerStatesAndModels() {
        normalBlock(BlockInit.RUBY_ORE.get())
}

  private fun normalBlock(block: Block) {
        val name: ResourceLocation? = ForgeRegistries.BLOCKS.getKey(block)
        if (name == null) {
            getLogger().error("Could not find block key for " + block.name)
            return
        }
        val builder = models().withExistingParent(name.path, "block/cube_all")
        builder.texture("all", modLoc("block/" + name.path))
        simpleBlock(block, builder)
        simpleBlockItem(block, builder)
    }
}
{
  "variants": {
    "": {
      "model": "armourandtoolsmod:block/ruby_ore"
    }
  }
}
{
  "parent": "minecraft:block/cube_all",
  "textures": {
    "all": "armourandtoolsmod:block/ruby_ore"
  }
}
{
  "parent": "armourandtoolsmod:block/ruby_ore"
}
commented

It worked with a project that was using 1.19.3 in java

commented

I think there issue with the datagen itself as the lang is not even generating. I don't know if it is an issue with the mod id or something

commented

We don't have anything that may influence datagen and it's not caused by us.
Perhaps there was changes between Mc/Forge version?

commented

Your models are incorrect. If there's a direction property on the block, you need to specify the model for each direction the block can face.

commented

Your models are incorrect. If there's a direction property on the block, you need to specify the model for each direction the block can face.

How would I fix it. My blocks are normal blocks. https://github.com/RealYusufIsmail/Armour-and-Tools-Mod/blob/main/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/BlockInit.kt#LL50C2-L50C2

commented

I think i found the problem. Its saying Missing metadata in pack mod:armourandtoolsmod which makes no sense as a I have mods.toml file

commented

This would be easier to address on Discord. Link is in the README

commented

No, you need to add a pack.mcmeta to your mod's resources folder

commented

Your models are incorrect. If there's a direction property on the block, you need to specify the model for each direction the block can face.

How would I fix it. My blocks are normal blocks. https://github.com/RealYusufIsmail/Armour-and-Tools-Mod/blob/main/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/init/BlockInit.kt#LL50C2-L50C2

According to the logs they are not normal blocks.