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.

Feofile

Members
  • Joined

  • Last visited

  1. I still can't understand where must I call these registry events.. A new class or in one of the Proxy's init methods? Edit: I think I can find all the answers in the tutorial from shadowfacts.. maybe
  2. I'm really sorry but I have no idea what events does Forge has for mod's things registration..
  3. what do you mean (im scared of this)
  4. I'm trying to make a new corn crop... I'm following this tutorial: https://shadowfacts.net/tutorials/forge-modding-112/crops/ Closer th the problem, I have next classes: BlockCropCorn extends BlockCrops, ItemCronSeed extends ItemSeeds. Also I have just an item "corn", which is basically an instance of ItemEdible extends ItemFood. In game, everything is ok if I plant corn by setting the block, but when i try to plant it using seeds, everything dies... Everything next will be explained. Crash report: java.lang.NullPointerException: Unexpected error at net.minecraft.item.ItemSeeds.getPlant(ItemSeeds.java:61) at net.minecraft.block.Block.canSustainPlant(Block.java:1931) at net.minecraft.item.ItemSeeds.onItemUse(ItemSeeds.java:34) at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:201) at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:509) at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1693) at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2380) at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2146) at net.minecraft.client.Minecraft.runTick(Minecraft.java:1934) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1187) at net.minecraft.client.Minecraft.run(Minecraft.java:441) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:25) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at net.minecraft.item.ItemSeeds.getPlant(ItemSeeds.java:61) at net.minecraft.block.Block.canSustainPlant(Block.java:1931) at net.minecraft.item.ItemSeeds.onItemUse(ItemSeeds.java:34) at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:201) at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:509) at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1693) at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2380) at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2146) Class for registering all the items(except block items) : public class ItemsRegistry { public static final Map<String, Item> MOD_ITEMS = new HashMap<String, Item>(); static { //MOD_ITEMS.put("heart", new ItemBase("heart")); //MOD_ITEMS.put("bpcookie", new ItemEdible("bpcookie", 2, 2, true, false, true, 10, 100)); MOD_ITEMS.put("cornSeed", new ItemCornSeed()); MOD_ITEMS.put("corn", new ItemEdible("corn", 2, 1, false, false, false, 0, 0)); } @SideOnly(Side.CLIENT) public static void registerItems() { ForgeRegistries.ITEMS.registerAll(MOD_ITEMS.values().toArray(new Item[0])); } public static void registerRender() { for(Item modItem : MOD_ITEMS.values()) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(modItem, 0, new ModelResourceLocation(modItem.getRegistryName(), "inventory")); } } } Class for registering all the blocks: public class BlocksRegistry { public static final Map<String, Block> MOD_BLOCKS = new HashMap<String, Block>(); static { //MOD_BLOCKS.put("strangeblock", new BlockBase("strangeblock", Material.IRON)); MOD_BLOCKS.put("cropCorn", new BlockCropCorn()); } public static void registerBlocks() { for(Block block : MOD_BLOCKS.values()) { ForgeRegistries.BLOCKS.register(block); ForgeRegistries.ITEMS.register(new ItemBlock(block).setRegistryName(block.getRegistryName())); } } @SideOnly(Side.CLIENT) public static void registerRender() { for(Block block : MOD_BLOCKS.values()) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); } } } Class BlockCropCorn: public class BlockCropCorn extends BlockCrops{ public BlockCropCorn() { setRegistryName("crop_corn"); setUnlocalizedName("crop_corn"); } @Override protected Item getSeed() { return ItemsRegistry.MOD_ITEMS.get("cornSeed"); } @Override protected Item getCrop() { return ItemsRegistry.MOD_ITEMS.get("corn"); } } Class ItemCornSeed: public class ItemCornSeed extends ItemSeeds{ public ItemCornSeed() { super(BlocksRegistry.MOD_BLOCKS.get("cornCrop"), Blocks.FARMLAND); setRegistryName("corn_seed"); setUnlocalizedName("corn_seed"); } } preInit() in class CommonProxy: public void preInit(FMLPreInitializationEvent event) { ItemsRegistry.registerItems(); BlocksRegistry.registerBlocks(); } I tried many many many things: overriding getPlant() or getPlantType(); replacing getSeed() and getCrop() between ItemCornSeed and BlockCropCorn; replacing blocks and items registry in preInit(). Nothing helps(maybe i did some of these incorrect, idk) And please don't call me the stupidest idiot in the universe, because I don't know Java in details, I don't know how Minecraft works and I started learning how to write mods only 2 days ago..

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.