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

So when I was first creating the items in forge, I stuck in the recipes directly into the CraftingManager.java file in the correct location. I now want to remove the recipes and add them to my main class file. For some reason, when I remove the recipes from CraftingManager.java the mod refuses to load at all.

This is my first time on the forums posting for help after hours of trying to figure this out.

Also, how would I let people see my code on this forum?

 

Any help or insight would be appreciated.

Thanks.

  • Author

Ive seen people post very organized code on the forums so im not sure how it will look.

 

This is the main class.

package SwiggitySwooty;

 

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.common.Mod.PostInit;

import cpw.mods.fml.common.Mod.PreInit;

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

import net.minecraft.block.Block;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.src.BaseMod;

import net.minecraft.world.World;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.Event.Result;

 

public class StoneRods extends BaseMod{

 

//creates a creative tab for the mod

 

public static CreativeTabs tabStoneRods = new CreativeTabs("tabStoneRods")

{

        public ItemStack getIconItemStack() {

                return new ItemStack(StoneRods.Orb, 1, 0);

        }

};

 

 

//initializes the items

public final static Item CobbleStoneRod = new ItemCobbleStoneRod(2066).setTextureName("StoneRods:CobbleStoneRod").setUnlocalizedName("cobbleRod").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1);

public final static Item StoneRod = new ItemStoneRod(2067).setTextureName("StoneRods:StoneRod").setUnlocalizedName("stoneRod").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1);

public final static Item ChiseledStoneRod = new ItemChiseledStoneRod(2068).setTextureName("StoneRods:ChiseledStoneRod").setUnlocalizedName("chiseledStoneRod").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1);

public final static Item EnderWand = new ItemEnderWand(2071).setTextureName("StoneRods:Ender_Wand").setUnlocalizedName("enderWand").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1).setMaxDamage(256);

public final static Item Orb = new ItemOrb(2073).setTextureName("StoneRods:Orb").setUnlocalizedName("orb").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(64);

public final static Item LavaWand = new ItemLavaWand(2072,0).setTextureName("StoneRods:Lava_Wand").setUnlocalizedName("lavaWand").setCreativeTab(StoneRods.tabStoneRods).setMaxStackSize(1);

 

 

 

 

//enabling crafting of mod items and all vanilla items with ItemStacks

 

 

    //initializes the blocks

 

 

 

 

 

 

 

 

 

 

//Overrides the getVersion() Method

@Override

public String getVersion() {

return "1.1.1";

}

 

 

 

//Overrides the load() method

@Override

public void load() {

 

//This registers all names of objects not sure if actually works, but it shouldn't affect anything

 

// LanguageRegistry.addName(CobbleStoneRod, "Rod of Cobble");

// LanguageRegistry.addName(StoneRod, "Rod of Stone");

// LanguageRegistry.addName(ChiseledStoneRod, "Rod of Stone Bricks");

// LanguageRegistry.addName(EnderWand, "Ender Wand");

// LanguageRegistry.addName(Orb, "Orb");

 

ItemStack OrbStack = new ItemStack(StoneRods.Orb);

ItemStack DiamondStack = new ItemStack(Item.diamond);

ItemStack GlassStack = new ItemStack(Block.glass);

 

//This adds recipes without having the code in the client classes

//GameRegistry.addShapedRecipe(new ItemStack(StoneRods.Orb), new Object[] {"GGG", "GDG", "GGG", 'G', Block.glass, 'D', Item.diamond});

//GameRegistry.addRecipe(

//GameRegistry.addRecipe(

GameRegistry.addRecipe(new ItemStack(StoneRods.Orb), new Object[] {"GGG", "GDG", "GGG", 'G', GlassStack, 'D', DiamondStack});

}

}

 

The CraftingManager class just adds the initialized items shown here to a crafting recipe.

If I leave at least 1 of those recipes, the mod loads.

If I dont have any listed, the mod doesnt.

 

Mod doesnt load:

//this.addRecipe(new ItemStack(StoneRods.CobbleStoneRod), new Object[] {"OBO", "LCW", "OBO", 'O', Block.obsidian, 'B', Item.blazeRod, 'L', Item.bucketLava, 'C', Block.cobblestone, 'W', Item.bucketWater});

        //this.addRecipe(new ItemStack(StoneRods.StoneRod), new Object[] {"FSF", "LCL", "FSF", 'S', Block.furnaceIdle, 'L', Item.bucketLava, 'C', StoneRods.CobbleStoneRod, 'F', Block.obsidian});

        //this.addRecipe(new ItemStack(StoneRods.ChiseledStoneRod), new Object[] {"SS", "SS", 'S', StoneRods.StoneRod});

        //this.addRecipe(new ItemStack(StoneRods.Orb), new Object[] {"GGG", "GDG", "GGG", 'G', Block.glass, 'D', Item.diamond});

 

Mod Loads:

this.addRecipe(new ItemStack(StoneRods.CobbleStoneRod), new Object[] {"OBO", "LCW", "OBO", 'O', Block.obsidian, 'B', Item.blazeRod, 'L', Item.bucketLava, 'C', Block.cobblestone, 'W', Item.bucketWater});

  //this.addRecipe(new ItemStack(StoneRods.StoneRod), new Object[] {"FSF", "LCL", "FSF", 'S', Block.furnaceIdle, 'L', Item.bucketLava, 'C', StoneRods.CobbleStoneRod, 'F', Block.obsidian});

        //this.addRecipe(new ItemStack(StoneRods.ChiseledStoneRod), new Object[] {"SS", "SS", 'S', StoneRods.StoneRod});

        //this.addRecipe(new ItemStack(StoneRods.Orb), new Object[] {"GGG", "GDG", "GGG", 'G', Block.glass, 'D', Item.diamond});

Don't extend the BaseMod class, use the @Mod annotation provided by forge. Link: http://www.minecraftforge.net/wiki/Basic_Modding

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

  • Author

Thank you very much!

 

I did not realize that the basemod wasn't as good as the @mod.

The @mod is a lot better when I took a look at 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.