Jump to content

Recommended Posts

Posted

Hello, I'm pretty new to minecraft modding and am currently trying to add my own crop that grows cookies. Most tutorials I find seem to still be for 1.7 so I'm having a hard time on some stuff, rendering for the most part. I've been struggling to get these crops to render correctly, as this is the first time I've had to deal with variants, as a reference I've been looking at how wheat is currently set up, so here is what I've got so far:

 

My blockstates, "cookieFlower.json" file:

{
    "variants": {
        "age=0": { "model": "cookieFlower_stage0" },
        "age=1": { "model": "cookieFlower_stage1" },
        "age=2": { "model": "cookieFlower_stage2" },
        "age=3": { "model": "cookieFlower_stage3" },
        "age=4": { "model": "cookieFlower_stage4" }
    }
}

 

My block model: "cookieFlower_state0.json" file: (there are 5 states in all)

{
    "parent": "block/crop",
    "textures": {
        "crop": "cookiemod:blocks/cookieFlower_stage_0"
    }
}

 

My item model "cookieFlower.json" file (which I'm unsure is even needed, since you never have the crop block in your inventory, but just to be safe...)

{
    "parent": "cookiemod:block/cookieFlower_stage_4",
    "display": {
        "thirdperson": {
            "rotation": [ 10, -45, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
        }
    }
}

 

Registration:

//inside PreInit()
ModelBakery.addVariantName(Item.getItemFromBlock(cookieFlower), new String[]{modid+":"+"cookieFlower_stage0",modid+":" +"cookieFlower_stage1",modid+":"+"cookieFlower_stage2",modid+":"+"cookieFlower_stage3",modid+":"+"cookieFlower_stage4"});

//inside Init()
renderItem.getItemModelMesher().register(Item.getItemFromBlock(cookieFlower), 0, new ModelResourceLocation(modid + ":" + ((CookieFlower) cookieFlower).getName(), "inventory"));

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(cookieFlower), new ItemMeshDefinition()
	     {
	    	 public ModelResourceLocation getModelLocation(ItemStack stack) {
	    		 return new ModelResourceLocation(modid+"cookieFlower", "inventory");
	    	 }
	     });

 

I'm reasonably sure that I did all the .json files correctly, but I'm a little lost about all the registration, I took the time to read through http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html, but honestly I found it a bit over my head on the parts concerning variance..

 

The current error I'm getting is:

[13:06:50] [Client thread/ERROR] [FML]: Model definition for location cookiemod:cookieFlower_stage1#inventory not found
[13:06:50] [Client thread/ERROR] [FML]: Model definition for location cookiemod:cookieFlower_stage0#inventory not found
[13:06:50] [Client thread/ERROR] [FML]: Model definition for location cookiemod:cookieFlower_stage2#inventory not found
[13:06:50] [Client thread/ERROR] [FML]: Model definition for location cookiemod:cookieFlower_stage4#inventory not found
[13:06:50] [Client thread/ERROR] [FML]: Model definition for location cookiemod:cookieFlower_stage3#inventory not found

 

This error began when I added the ModelBakery.addVariantName() line; before then I had no errors, but no textures either, so I'm probably using the method incorrectly.

 

Any and all help will be greatly appreciated.

 

EDIT: I have since removed the ModelBakery.addVariantName() line as I realized that was for item variants rather than block variants, so I'm back to no errors and no textures.

Posted

You  need to copy model files to src/main/resources/assets/<MODNAME>/models/blocks for blocks and

src/main/resources/assets/<MODNAME>/models/item for items

Sorry for my English

Posted

That is where I've had them. I have other,more basic blocks and Items that are working. I have since realized that this error message came from the ModelBakery.addVariantName() method, as that for registering variants of item models, but what I have is multiple block models, so I removed it. I'm now back to having no errors and still no textures on my crop.

 

I believe it's also worth showing my CookieFlower class:

public class CookieFlower extends BlockCrops {

private final String name = "cookieFlower";

public CookieFlower() {
	super();
	setUnlocalizedName(name);
	setCreativeTab(CookieMod.cookieTab);
	GameRegistry.registerBlock(this,name);
}

public String getName() {
	return name;
}
}

(I left out a few methods to save space)

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.