Jump to content

Exception loading blockstate definition


yusufgamer

Recommended Posts

I keep erros like this 

Exception loading blockstate definition: 'armourandtoolsmod:blockstates/ruby_ore.json' missing model for variant: 'armourandtoolsmod:ruby_ore#facing=north'

I dont know the cause. Here is my block state data gen code

public class ModBlockStateProvider extends BlockStateProvider {
    public ModBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) {
        super(output, MOD_ID, exFileHelper);
    }

    @Override
    public @NotNull String getName() {
        return "Armour and Tools Mod Blockstates";
    }

    @Override
    protected void registerStatesAndModels() {
        normalBlock(BlockInit.RUBY_ORE.get());
        normalBlock(BlockInit.RAINBOW_ORE.get());
        normalBlock(BlockInit.SAPPHIRE_ORE.get());
        normalBlock(BlockInit.GRAPHITE_ORE.get());
        normalBlock(BlockInit.AQUMARINE_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_RUBY_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_RAINBOW_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_SAPPHIRE_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_GRAPHITE_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_AQUMARINE_ORE.get());
        normalBlock(BlockInit.RUBY_BLOCK.get());
        normalBlock(BlockInit.RAINBOW_BLOCK.get());
        normalBlock(BlockInit.SAPPHIRE_BLOCK.get());
        normalBlock(BlockInit.GRAPHITE_BLOCK.get());
        normalBlock(BlockInit.AQUMARINE_BLOCK.get());
    }

    public void normalBlock(Block block) {
        ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block);

        if (name == null) {
            ArmourAndToolsMod.logger.error("Could not find block key for " + block.getName());
            return;
        }

        BlockModelBuilder builder =
                this.models().withExistingParent(name.getPath(), "block/cube_all");
        builder.texture("all", modLoc("block/" + name.getPath()));
        this.simpleBlockItem(block, builder);
        this.simpleBlock(block, builder);
    }
}

 

Link to comment
Share on other sites

None of generated resource's work


My main class

 

@Mod(MOD_ID)
public class ArmourAndToolsMod {
    public static final Logger logger = LoggerFactory.getLogger(ArmourAndToolsMod.class);
    public static final String MOD_ID = "armourandtoolsmod";

    public ArmourAndToolsMod() {
        var bus = FMLJavaModLoadingContext.get().getModEventBus();
        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);

        // Register the item to a creative tab
        bus.addListener(ArmourAndToolsGroup::registerCreativeTab);
        // Register the data generators
        bus.addListener(DataGenerators::gatherData);

        // Register the mod to the event bus
        MinecraftForge.EVENT_BUS.register(this);
        logger.info("Hello from RealYusufismail's Armour and Tools Mod!");
    }
}

 

Edited by yusufgamer
Link to comment
Share on other sites

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Quote

Missing metadata in pack

i.e. your resource/datapack metadata

 

You have a invalid space (%20) at the beginning of the file name.

https://github.com/RealYusufIsmail/Armour-and-Tools-Mod/blob/changed_to_java/src/main/resources/ pack.mcmeta

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

I tried adding the varient but still get the same error

My gh repo url : https://github.com/RealYusufIsmail/Armour-and-Tools-Mod/tree/changed_to_java/src/main/java/io/github/realyusufismail/armourandtoolsmod

public class ModBlockStateProvider extends BlockStateProvider {
    public ModBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) {
        super(output, MOD_ID, exFileHelper);
    }

    @Override
    public @NotNull String getName() {
        return "Armour and Tools Mod Blockstates";
    }

    @Override
    protected void registerStatesAndModels() {
        normalBlock(BlockInit.RUBY_ORE.get());
        normalBlock(BlockInit.RAINBOW_ORE.get());
        normalBlock(BlockInit.SAPPHIRE_ORE.get());
        normalBlock(BlockInit.GRAPHITE_ORE.get());
        normalBlock(BlockInit.AQUMARINE_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_RUBY_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_RAINBOW_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_SAPPHIRE_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_GRAPHITE_ORE.get());
        normalBlock(BlockInit.DEEPSLATE_AQUMARINE_ORE.get());
        normalBlock(BlockInit.RUBY_BLOCK.get());
        normalBlock(BlockInit.RAINBOW_BLOCK.get());
        normalBlock(BlockInit.SAPPHIRE_BLOCK.get());
        normalBlock(BlockInit.GRAPHITE_BLOCK.get());
        normalBlock(BlockInit.AQUMARINE_BLOCK.get());
    }

    public void normalBlock(Block block) {
        ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block);

        if (name == null) {
            ArmourAndToolsMod.logger.error("Could not find block key for " + block.getName());
            return;
        }

        String path = name.getPath();

        BlockModelBuilder builder = models().cubeAll(path, modLoc("block/" + path));
        getVariantBuilder(block)
            .forAllStates(state -> ConfiguredModel.builder().modelFile(builder).build());
    }
}

 

Edited by yusufgamer
Link to comment
Share on other sites

People that;

* post "it doesn't work" instead of showing the actual error.

* don't include all the information  https://github.com/RealYusufIsmail/Armour-and-Tools-Mod/blob/f8f865ef0c94cfe54d3847d398ee9f533cf94379/src/main/java/io/github/realyusufismail/armourandtoolsmod/core/init/BlockInit.java#L21

* spend less than 30 minutes trying to figure it out for themselves and instead expect others to do their work for them

will usually just be ignored. 

I could try to guess what the problem is, but with such incomplete information I would likely be wrong, so I won't.

 

I've answered a number of your problems recently and the last few were trivial typos in your code which tells me you are putting little effort into trying to debug it for yourself.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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