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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

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