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

Hello guys i've a problem with 1.5 coding. Some time ago, i made a simple mod that able you to "repair " damaged items, look at this piece of code:

 

GameRegistry.addRecipe(new ItemStack(Item.swordWood), new Object[] {" Y ", " X ", "  ", 'X', new ItemStack(Item.swordWood, 1, -1), 'Y', Block.planks});

 

Well, with this code you can craft one brand new wooden sword with one damaged wooden sword and whatever block of planks, this works well in 1.4.7, but not in 1.5.1.

 

Anybody can help me please.

 

Thanks.

Hello there,

  I would like to first say that I am by no means what you could even call a moder as I have a million questions my self.

 

  I decided to try and solve this issue, and at my level, I found that it is not quite as easy as what you had shown.

 

This is the code that would be put in the @Init part of your main class.

 

GameRegistry.addRecipe(new ItemStack(Item.swordWood, 1), 
    new Object[]
        {
            "XYX",
            'X', Block.planks, 'Y', new Item.swordWood
        });

 

However, the problem with this is that it does not accept a damaged item.  While I have some suspicions as to ways you could go about this, I lack the experience with the base classes and forge classes to figure it out yet.

 

On a positive note, I believe that you can use an Anvil to do the same thing that you are trying to make a recipe for.

 

With a quick google search: [lmgtfy]minecraft anvil[/lmgtfy], I was able to come up with the following results.

 

http://www.minecraftwiki.net/wiki/Anvil

 

http://www.minecraftwiki.net/wiki/Anvil_mechanics

 

On a final thought, you may be able to make a modified crafting table, with functionality of the anvil.

 

Good luck to you.

The damage value wildcard for ItemStacks has changed, but I can't remember what it changed to...

I think it changed to Integer.MIN_VALUE but I'm not certain...

xD. I made whole Mod which is makeing a lots of repair/damage recipes.

I used Forloops for this.

 

like this:

for(int i = 0; i < yourItem.getMaxItemDamage(); i++)
{
      GameRegistry.addRecipe(new ItemStack(yourItem, 1, i - extradamage), new Object [] {"XY", 'X', new ItemStack(yourItem, 1, i), 'Y', new ItemStack(repairItem, 1, 0)});
}

and the forloops was about 10k. And it was about 2,5mio recipes. and the game starts to lag.

  • 2 weeks later...
  • Author

Thanks to all the code that for now works for me is

 

    public static final int WILDCARD_VALUE = Short.MAX_VALUE;

 

then

 

GameRegistry.addShapelessRecipe(new ItemStack(Item.swordIron), new ItemStack(Item.swordIron, 1, WILDCARD_VALUE), Item.ingotIron);

I also have a hint for you. never make too much forloops!

 

Why. I made with forloops about 2 Mio recipes.

 

and then after coding i tried to craft a workbench and the framerate goes down to 6 everytime i put a Item/Block in the craftingmatrix!

 

This lagging starts at 100k recipes! (Tested!)

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.