Jump to content

Recommended Posts

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.

Posted

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.

Posted

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...
Posted

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);

Posted

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.