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 have a class for an Item (in this case it extends ArmorItem) with some boolean values. I want to have a recipe that will switch these boolean values, and it depends on the actual Items in the recipe. The main Item is something like a piece of armor, the other is some item that will change the properties of the armor (through the use of the booleans) but keep everything else: durability, enchantments, ect.

I am realizing the class will only be instantiated once for all ItemStacks of this Item, so I suppose I would need to store the information in the ItemStack NBT data or something, but I still need to do something when the crafting takes place.

 

I'm fairly certain the json recipes won't do anything like this, so I need to have it in code. How can this be done?

In the future, for Minecraft 1.16+, I would like to use the smithing table in sort of the same way where the item is upgraded but I don't want another Item, the Item will be the same because there will be many variations and they won't be that much different.

Edited by Invilis

this should help:

 

 I will make fun of you if you are not able to look into the (vanilla-) code.

  • Author

That's good, but not quite there yet. I need some way to tell what Item I am using in the recipe because it will have a specific effect. Using getContainerItem I can change the resulting Item but I need the change to depend on what the secondary Item was.

 

The only thing I can think of is to make a custom crafting table block, that way I could have complete control over the ItemStacks involved, at least that's my theory. A game theory.

Edited by Invilis

I believe you'll need to subclass net.minecraft.item.crafting.SpecialRecipe to create a special crafting recipe (look at ArmorDyeRecipe)

 

Then you need to register a recipe serializer for said SpecialRecipe.

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.