Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

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

  • Author

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)

To your block state files you need to add your modid followed by a colon then the name of the block otherwise it defaults to looking in minecrafts directory

Did you really need to know?

  • Author

Thanks a ton! That was it, I had that done for all my other blocks/items, so idk how I missed it.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.