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.