Jump to content

[Solved]1.11.2 Problem with new crop (corn tutorial)


aw_wolfe

Recommended Posts

I am trying to do the basic corn tutorial (https://shadowfacts.net/tutorials/forge-modding-1112/crops)

So I have a BlockCornCrop extends BlockCrops, ItemSeedCorn, ItemCorn.

I am also implementing the IModelProvider (again, basic for many tuts). In my ModItems, I am registering the ItemSeedCorn and ItemCorn. In my ModBlocks I am registering the BlockCornCrop

 

Here's the issue:

in my mod class if I do:

@Mod.EventHandler
	public void init(FMLInitializationEvent event){
		
		ModItems.init(); //registers corn, corn seed
		
		ModBlocks.init();//registers corn crop
		
	}

The seeds are plantable, they grow and can be harvested (Which seems to indicate my corn blocks, json mappings, textures, etc are good), BUT the textures for corn seeds and corn are not loaded (pink square thing).

if I do:

@Mod.EventHandler
	public void preInit(FMLPreInitializationEvent even){
		
		ModItems.init();
		
		ModBlocks.init();
		
	}

OR:

@Mod.EventHandler
	public void init(FMLInitializationEvent event){
		
		ModBlocks.init();
		
		
		
	}

@Mod.EventHandler
	public void preInit(FMLPreInitializationEvent even){
		
		ModItems.init();	
		
		
	}

 

Then the seed and corn textures load (so tells me I think I have all the textures and json files in the correct spots. But when I go to plant the corn seeds MC crashes.

Quote

java.lang.NullPointerException: Unexpected error
        at net.minecraft.item.ItemSeeds.getPlant(ItemSeeds.java:53)
        at net.minecraft.block.Block.canSustainPlant(Block.java:1840)
        at net.minecraft.item.ItemSeeds.onItemUse(ItemSeeds.java:32)
        at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:180)
        at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:486)

 

I'm assuming it is an issue with where the init/registration takes place and not with the actual corn code, json files, directory structure.  I can put those up if what I'm doing looks like it should work.

Edited by aw_wolfe
Link to comment
Share on other sites

Blocks, then items, in preInit.

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

4,962 other people have had the same problem and posted here about it.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Well, thanks for taking the time, not everyone does or would for a question asked/answered so often.

 

I did search first and browsed through the titles  (albiet not every single one of them) and a few postings that might have been related but didn't see anything that matched what I thought my issue was. Most that I saw were about file/directory structure issues, which by my testing, I did not believe was my issue. Google searches for 1.11 crop tutorials were very limited.

 

Thanks again for your time.

Tony

Link to comment
Share on other sites

This isn't a 1.11 specific issue. People have been having this problem since at least 1.7

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.