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'm having a really odd issue with adding a new recipe. When I try and add a shapeless recipe using my blocks, it won't work. When I try and do it using my items, it works fine. Here are my shapeless recipe adds. The one with asterisks doesn't work. Anyone know why?

 

//Recipe Stuff
            ItemStack bowl = new ItemStack(Item.getItemById(281)); //bowl
            ItemStack redMush = new ItemStack(Block.getBlockById(40)); //red
            ItemStack brownMush = new ItemStack(Block.getBlockById(39)); //brown
            ItemStack yellowMush = new ItemStack(lemoncup);
            ItemStack orangeMush = new ItemStack(orangecap);
            ItemStack mushroomStew = new ItemStack(Item.getItemById(282)); //mushroomstew

            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, yellowMush, orangeMush});
            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, yellowMush, redMush});
            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, yellowMush, brownMush});
            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, redMush, orangeMush});
            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, brownMush, orangeMush});
            
            **GameRegistry.addShapelessRecipe(new ItemStack(this.lemoncupPlanks), new ItemStack(this.lemoncupTrunk));**       
            GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Blocks.acacia_stairs));

 

EDIT: Solved it! Finally. Like was said below, you have to use the accessor classes Blocks and Items to call vanilla items and blocks to ItemStacks going forward. For some reason, I had to set up my own accessor class to get my blocks to work in ItemStacks as well. I can reference item instances just fine, but I have to reference blocks through my own personal Blocks class (I called it ModBlocks) which included nothing but a bunch of variables for each block (public static block Name = (Block)BlockRegistry.Name;). It somehow changes the accessibility of the block. Don't know why.

You are modding for Minecraft 1.7.2, no? Item ids (and block ids) are a no-no. Don't use them for that. Items.itemName and Blocks.blockName are the proper methods to refer to vanilla blocks and items.

 

Also, your recipes are not coded sensibly. You do not need array notation to call a var-args method.

GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, yellowMush, orangeMush});

should be

GameRegistry.addShapelessRecipe(mushroomStew, bowl, yellowMush, orangeMush);

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.