Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Mod texture could not load


Jar36
 Share

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.

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

The version you are using is no longer supported on this forum.

Please update to a modern version of Minecraft to receive support.

Currently supported versions are 1.19 (Latest) and 1.18.2 (LTS).

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



×
×
  • Create New...

Important Information

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