Jump to content

[1.6.2+] Adding properties while crafting...


Ernio

Recommended Posts

Hello,

Does anybody know any opensource or where should I look for Methods that'll allow me to add different properties to item, while I am crafting it?

What I mean is for example: We take out 4x5 Grid and craft an Axe (This grid/crafting works - that's not my problem) and we make basic Axe, BUT when we add something to specific SlotID it will change our CraftResult.

2ajqhyv.jpg

Where Gold Slot is out custom item (which will add special effect).

Our goal is to:

*Make one recipe for multiple crafting. - PRIMAL

*Save this data to NBT, not to Item ID (item Id stays the same for all)

*Make sure that saved data (let's say we added fire gem to an axe recipe) will be called everytime we hit something and will set it on fire.

Structure would look like:

Axe.class:

-Main stuff (constructor, blah blah)

-Function 1, 2, 3, ..., n,  that will be called if an item has ,,this" NBT.

-Textures that are loaded depending on what this item is: So if we got Fire axe, we get FireAxeTexture, not AxeTexture.

 

And yes, I know - NBT items can be only crafted, since they don't have specific ID.

And if this stuff is just pointless to put into NBT's we can just use MetaData. Most important here is this crafting thing.

 

 

EDIT

This grid has custom CraftingManager, RecipeSorter and Shaped/ShapelessRecipe.class - based on vanillia ones, so you are free to edit them (they are nearly same as vanilia).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

I'm totally ignoring your crafting system and writing it from a perspective of vanilla crafting (if you are doing it same/similar way all of this should apply).

 

To make a recipe you implement

IRecipe 

and register it - e.g.

GameRegistry.addRecipe(new MyRecipe(params))

. In this custom recipe you can specify what is a result of crafting depending on a current crafting matrix (input items = ItemStacks). Then you simply copy generic crafting result and add/modify needed NBT tags. example

 

I haven't tried it, but if you override

public Icon getIconIndex(ItemStack par1ItemStack)

you should be able to get icons depending on NBT.

 

-Function 1, 2, 3, ..., n,  that will be called if an item has ,,this" NBT.

I'm not sure what this mean. If you want initialize the item, you can do it from recipe. If you want custom damage or other attribute you can change/set it in recipe when creating item as well.

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

And yes, I know - NBT items can be only crafted, since they don't have specific ID.

You are wrong.

Granted, they are specific areas where vanilla doesn't support NBT (i think of vanilla furnace entries) because they don't support ItemStack.

But, as long as you have an ItemStack, you can put NBT in it. (drops, furnace results...)

Which also means that all methods in Item that have a ItemStack as argument will work with NBT.

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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