Jump to content

[1.8] Get Info About ItemStacks in Crafting Table Inventory


cclloyd9785

Recommended Posts

I want to make it so that you can craft any potion with any piece of my custom armor (8 variants from 1 class) and create a new instance of the armor based on the item in the crafting inventory.

 

I want them to be able to craft any of the 8 possible variants of armor with any vanilla potion and have the recipe output be a new ItemStack using the potion constructor.  But how would I get which potion is in the crafting?

 

Default constructor for armor:

public ItemArmorObsidian(int type, boolean reinforced) { 
	super(ItemRegistry.armorObsidianReinforced, 0, type);
	this.reinforced = reinforced;
	this.type = type;
	setName(type, reinforced);
}

 

Constructor when potion available:

public ItemArmorObsidian(int type, boolean reinforced, Potion potion) { 
	super(ItemRegistry.armorObsidianReinforced, 0, type);
	this.type = type;
	this.reinforced = reinforced;
	this.potion = potion;
	setName(type, reinforced);
}

Link to comment
Share on other sites

Use IRecipe for that.

You can make your IRecipe consume any piece of the custom armor and any potion, and give the potion-ed armor.

After creating the recipe, register the recipe with GameRegistry#addRecipe(IRecipe).

 

EDIT: Also giving potion as parameter in constructor would be no use.

  Instead save the potion id to the NBT of the armor, and get the Potion instance from Potion class whenever you want.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.



×
×
  • Create New...

Important Information

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