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 apologize if this has been asked and solved before, but I did search and couldn't find anything useful.  I've got the basics of Java, but it's deep code that I'm not familiar with yet and I would like to ask for some help.

 

What I would like to do is be able to take my code for creating new creative tabs and for registering new recipes out of my central mod file and place them in their own separate files.  Will a simple 'Blah extends BlahBlah' in the separate files suffice, or will I need to put some code inside the central mod file to make load references to those separate files?  (Maybe import the separate files in the central mod file?)

 

Additionally, I do have a concern about the functionality of doing this with the creative tabs.  Will my items and blocks be allocated to their correct tabs if all the code is in a separate file?

 

Thanks for the help and the patience!

You will need some reference to the files (and no, a simple import will not do it.) As long as the blocks are allocating themselves to your tab, though, it will work.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

i do it also like that as recipes class you must have as example :

 

package invizzble.mods.nc.recipes;

 

import net.minecraft.item.ItemStack;

import invizzble.mods.nc.items.ModItems;

import invizzble.mods.nc.items.ModTools;

import cpw.mods.fml.common.registry.GameRegistry;

 

public class ShapedRecipes {

   

    public static void init(){

       

        GameRegistry.addRecipe(new ItemStack(ModItems.NightmareFuel), "xxx", "xyx", "xxx", Character.valueOf('x'), ModItems.NightMareDust, Character.valueOf('y'), ModItems.CreepyCoal);

        GameRegistry.addRecipe(new ItemStack(ModTools.NightmarePick), "xyx"," z " ," z ", Character.valueOf('x'), ModItems.DarkenedIngot, Character.valueOf('y'), ModItems.DarkOrb, Character.valueOf('z'), ModItems.DarkStick);

        GameRegistry.addRecipe(new ItemStack(ModItems.DarkOrb), "xxx", "xyx", "xxx", Character.valueOf('x'), ModItems.NightmareDiamond, Character.valueOf('y'), ModItems.NightMareDust);

    }

 

}

 

and then you just need to add in you init method

 

-your classname-.-name you called your method-

(in this example was it : ShapedRecipes.init();)

  • Author

Thank you for the help! :)

 

Just for clarification: I should have a separate file for both shaped and shapeless recipes?  Your code looks like you've got a package for recipes, but a single file for each type.

 

So, if that's the case, I should have two files in my Recipes package and in the @init in my coremod file I should have:

 

ShapedRecipes.init();

ShapelessRecipes.init();

 

+karma for you, too :)

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.