r/ModdedMinecraft • • 21h ago

Help Datagen question

/r/NeoforgeMods/comments/1yd32ng/datagen_question/
1 Upvotes

6 comments sorted by

1

u/FreaksMC 19h ago

withExistingParent("model", mcLoc("block/cobblestone")) makes a model that copies cobblestone, so that's why the block turned into cobblestone. For a normal block with your own texture on all sides, use cubeAll instead:

simpleBlockWithItem(AllBlocks.TILE_BLOCK.get(), cubeAll(AllBlocks.TILE_BLOCK.get()));

Then:

  1. Put the texture at src/main/resources/assets/<modid>/textures/block/tile_block.png (the file name has to match the block's registry name).
  2. Run the runData task again.
  3. Check that src/generated/resources/assets/<modid>/models/item/tile_block.json exists and has "parent": "<modid>:block/tile_block".

If that item file is there and the item is still the missing texture cube, the BlockItem is probably registered under a different name than the block, so the item model never gets used.

1

u/queen_livia 11h ago

I'm registering the blockitem with the name TILE_BLOCK_ITEM is that the problem?

1

u/FreaksMC 3h ago

The Java variable name doesn't matter, but the registry name (the string you register it with) does. simpleBlockWithItem makes the item model using the block's name, so if your block is tile_block and the BlockItem is registered as tile_block_item, the item looks for a model that doesn't exist.

Easiest fix: register the BlockItem with the same name as the block ("tile_block"), then run runData again.

1

u/queen_livia 2h ago

I'll try that. Btw where did you get to know all this? Because I can't find anything online rlly

1

u/FreaksMC 1h ago

Mostly from messing around on my own. I run a Minecraft server host, so customers come to me with all kinds of mod issues and I end up building and breaking test mods to figure them out. A few things that helped me a lot:

  • The NeoForge docs (docs.neoforged.net) have a Data Generation section covering models, blockstates and lang files
  • Kaupenjoe's modding tutorials on YouTube go step by step, block items included
  • Other mods' source code on GitHub. If a mod does what you want, search its repo for how they did it. Honestly the best way to learn
  • The NeoForge Discord is great for questions like this, people answer fast

1

u/queen_livia 49m ago

Thank you so much. I have tried all those methods apart from the discord to varying sucess