Jump to content

Mod texture could not load


Jar36

Recommended Posts

Minecraft version:1.16.5(STABLE)

Forge version:36.2.34

IDE:Intellij 2022.3

Project REPO : https://www.github.com/lucaiyu/TouhouCraft

I tried to add a block with 2 blocks but the texture not render at all.

This is the block code

package com.lucaiyu.touhoucraft.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer;

public class ShrineToriiTitle extends Block {
    private static IntegerProperty STATE = IntegerProperty.create("char", 0, 1);

    public ShrineToriiTitle() {
        super(Properties.of(Material.STONE).sound(SoundType.STONE).strength(5.0F,5.0F));

        this.registerDefaultState(this.stateDefinition.any().setValue(STATE, 0));
    }

    @Override
    protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) {
        builder.add(STATE);
    }
}

This is the block registry

package com.lucaiyu.touhoucraft.blocks;

import com.lucaiyu.touhoucraft.TouHouCraft;
import net.minecraft.block.Block;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class BlockRegistry {
    public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, TouHouCraft.MOD_ID);
    public static RegistryObject<Block> touhou_crystal_ore = BLOCKS.register("touhou_crystal_ore", () -> {
        return new TouhouCrystalOre();
    });
    public static RegistryObject<Block> magic_ore = BLOCKS.register("magic_ore",()->{
        return new MagicOre();
    });
    public static RegistryObject<Block> shrine_torii_title = BLOCKS.register("shrine_torii_title",()->{
        return new ShrineToriiTitle();
    });
    public static RegistryObject<Block> touhou_crystal_ore_in_nether = BLOCKS.register("touhou_crystal_ore_in_nether",()->{
        return new TouhouCrystalOreInNether();
    });
    public static RegistryObject<Block> magic_ore_in_nether = BLOCKS.register("magic_ore_in_nether",()->{
        return new MagicOreInNether();
    });
}

This is the main class

package com.lucaiyu.touhoucraft;

import com.lucaiyu.touhoucraft.blocks.BlockRegistry;
import com.lucaiyu.touhoucraft.items.ItemRegistry;

import com.lucaiyu.touhoucraft.world.gen.OreGeneration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;


@Mod("touhoucraft")
public class TouHouCraft{
    public static String MOD_ID = "touhoucraft";
    public TouHouCraft() {
        ItemRegistry.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
        BlockRegistry.BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
        MinecraftForge.EVENT_BUS.addListener(EventPriority.HIGH, OreGeneration::generateOres);
    }


}

this is the texture pack blockstates

{
  "variants": {
    "": {
      "char=0": {
        "model": "shrine_torii_title_model_0"
      },
      "char=1": {
        "model": "shrine_torii_title_model_1"
      }
    }
  }
}

These are 

{
  "parent": "minecraft:block/cube_column",
  "textures": {
    "end": "touhoucraft:block/blank",
    "side": "touhoucraft:block/char0"
  }
}
/*these are two files*/
{
  "parent": "minecraft:block/cube_column",
  "textures": {
    "end": "touhoucraft:block/blank",
    "side": "touhoucraft:block/char1"
  }
}

 

Link to comment
Share on other sites

Look at the warnings on your console or in the log. It should tell you what is "missing".

One problem I can see is 

  "model": "shrine_torii_title_model_0"

Should probably be something like:

  "model": "touhoucraft:block/shrine_torii_title_model_0"

But only you know the correct names.

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

Something wrong

The texture still not loaded

[21:14:33] [Worker-Main-6/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'touhoucraft:blockstates/shrine_torii_title.json' missing model for variant: 'touhoucraft:shrine_torii_title#char=1'
[21:14:33] [Worker-Main-6/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'touhoucraft:blockstates/shrine_torii_title.json' missing model for variant: 'touhoucraft:shrine_torii_title#char=0'
[21:14:33] [Worker-Main-6/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'touhoucraft:blockstates/shrine_torii_title.json' in resourcepack: 'Mod Resources': Missing model, expected to find a string
[21:14:34] [Worker-Main-6/WARN] [minecraft/ModelBakery]: Unable to load model: 'touhoucraft:block/shrine_torii_title_model' referenced from: touhoucraft:shrine_torii_title#inventory: java.io.FileNotFoundException: touhoucraft:models/block/shrine_torii_title_model.json
[21:14:36] [Worker-Main-6/WARN] [minecraft/ModelBakery]: Unable to resolve texture reference: #missingno in touhoucraft:item/shrine_torii_title

This is the blockstate code

{
  "variants": {
    "": {
      "char=0": {
        "model": "touhoucraft:block/shrine_torii_title_model_0"
      },
      "char=1": {
        "model": "touhoucraft:block/shrine_torii_title_model_1"
      }
    }
  }
}

Blockstate in my code is int format and includes 0 and 1

I think something wrong in the resource pack

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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