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

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

Blocks, then items, in preInit.

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.

  • Author

Thanks! Makes sense since the seed class creation needs the crop block.  For some reason, I was thinking the other way around.

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.

  • Author

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

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.

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.