Jump to content

Recommended Posts

Posted

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.

Posted

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

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.