Jump to content

[1.8] [Solved] Model Definition not found


muukrls

Recommended Posts

Hello,

 

I am trying to figure out the new rendering stuff for blocks and items. My objective is to create a ladder that allows you to go faster when powered by redstone. However, I get the following error:

[FML]: Model definition for location sonic_ladders:block_sonic_ladder#facing=north not found
[FML]: Model definition for location sonic_ladders:block_sonic_ladder#facing=south not found
[FML]: Model definition for location sonic_ladders:block_sonic_ladder#facing=east not found
[FML]: Model definition for location sonic_ladders:block_sonic_ladder#facing=inventory not found
[FML]: Model definition for location sonic_ladders:block_sonic_ladder#facing=west not found

 

I think it means it can't find the json files associated with the block, but I can't figure out what I have to do to fix it.

My mod id: sonic_ladders

 

src/resources/assets/sonic_ladders/blockstates/block_sonic_ladder.json

{
    "variants": {
        "facing=north": { "model": "sonic_ladders:block_sonic_ladder" },
        "facing=east":  { "model": "sonic_ladders:block_sonic_ladder", "y": 90 },
        "facing=south": { "model": "sonic_ladders:block_sonic_ladder", "y": 180 },
        "facing=west":  { "model": "sonic_ladders:block_sonic_ladder", "y": 270 }
    }
}

 

src/resources/assets/sonic_ladders/models/block/block_sonic_ladder.json

{
  "parent": "ladder",
  "ambientocclusion": false,
  "textures": {
    "all": "sonic_ladders:blocks/block_sonic_ladder"
  },
  "elements": [
    {   "from": [ 0, 0, 15.2 ],
      "to": [ 16, 16, 15.2 ],
      "shade": false,
      "faces": {
        "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
        "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" }
      }
    }
  ]
}

 

BlockSonicLadder.java

public class BlockSonicLadder extends BlockLadder
{
public BlockSonicLadder()
{
	super();

	setUnlocalizedName("block_sonic_ladder");
}
}

 

ModBlocks.java

public class ModBlocks
{
public static Block block_sonic_ladder;

public static void init()
{
	block_sonic_ladder = new BlockSonicLadder();
}

public static void register()
{
	GameRegistry.registerBlock(block_sonic_ladder, getUnlocalizedName(block_sonic_ladder));
}

public static void registerRenderers()
{
	registerRenderer(block_sonic_ladder);
}

public static void registerRenderer(Block block)
{
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.RESOURCE_LOCATION + getUnlocalizedName(item), "inventory")); // Reference.RESOURCE_LOCATION = modid + ":"
}

private static String getUnlocalizedName(Block block)
{
	return block.getUnlocalizedName().substring(5);
}

private static String getUnlocalizedName(Item item)
{
	return item.getUnlocalizedName().substring(5);
}
}

 

Then init() and register() are called in preinit and the registerRenderers() is called in the client proxy on init()

 

Thanks for any help in advance.

Link to comment
Share on other sites

Are you using IntelliJ14?

 

If so you need to add a line to the end of your build.gradle file

sourceSets { main { output.resourcesDir = output.classesDir } }

or

idea { module { inheritOutputDirs = true } }

see here http://www.minecraftforge.net/forum/index.php/topic,21354.0.html

 

Otherwise, you could try putting a breakpoint into

ModelLoader.VanillaLoader.loadModel

to see why it couldn't find your file - the exception e will have more information.

 

           try
            {
                return loader.new VanillaModelWrapper(modelLocation, loader.loadModel(modelLocation));
            }
            catch(IOException e)
            {
                if(loader.isLoading) // breakpoint here
                {
                    // holding error until onPostBakeEvent
                }
                else FMLLog.log(Level.ERROR, e, "Exception loading model %s with vanilla loader, skipping", modelLocation);
                return loader.getMissingModel();
            }

 

-TGG

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

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