mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-14 01:04:16 +00:00
Merge pull request #943 from Lazersmoke/patch-1
Copy/Paste from previous pull for Helm Crafting
This commit is contained in:
commit
2060ba2a26
3 files changed
+117
-7
No files matched your search
@@ -1727,11 +1727,10 @@ public final class ModCraftingRecipes {
|
||||
|
||||
// Revealing Helmet Recipes
|
||||
if(Botania.thaumcraftLoaded) {
|
||||
Item goggles = (Item) Item.itemRegistry.getObject("Thaumcraft:ItemGoggles");
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.manasteelHelmRevealing), new ItemStack(ModItems.manasteelHelm), new ItemStack(goggles));
|
||||
recipeHelmetOfRevealing = BotaniaAPI.getLatestAddedRecipe();
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.terrasteelHelmRevealing), new ItemStack(ModItems.terrasteelHelm), new ItemStack(goggles));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.elementiumHelmRevealing), new ItemStack(ModItems.elementiumHelm), new ItemStack(goggles));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.manasteelHelmRevealing), new ItemStack(ModItems.manasteelHelm), (Item) Item.itemRegistry.getObject("Thaumcraft:ItemGoggles"));
|
||||
recipeHelmetOfRevealing = BotaniaAPI.getLatestAddedRecipe(); //We want manasteel to show in the Lexicon
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.terrasteelHelmRevealing), new ItemStack(ModItems.terrasteelHelm), (Item) Item.itemRegistry.getObject("Thaumcraft:ItemGoggles"));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.elementiumHelmRevealing), new ItemStack(ModItems.elementiumHelm), (Item) Item.itemRegistry.getObject("Thaumcraft:ItemGoggles"));
|
||||
}
|
||||
|
||||
// Slab & Stair Recipes
|
||||
@@ -1819,4 +1818,4 @@ public final class ModCraftingRecipes {
|
||||
private static void addShapelessOreDictRecipe(ItemStack output, Object... recipe) {
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(output, recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* This class was created by <Lazersmoke>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [May 6, 2015, 9:45:56 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.crafting.recipe;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class HelmRevealingRecipe implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting var1, World var2) {
|
||||
|
||||
boolean foundGoggles = false;
|
||||
boolean foundHelm = false;
|
||||
for(int i = 0; i < var1.getSizeInventory(); i++) {
|
||||
ItemStack stack = var1.getStackInSlot(i);
|
||||
if(stack != null) {
|
||||
if(checkHelm(stack))
|
||||
foundHelm = true;
|
||||
|
||||
else if(stack.getItem() == (Item) Item.itemRegistry.getObject("Thaumcraft:ItemGoggles"))
|
||||
foundGoggles = true;
|
||||
|
||||
else return false; // Found an invalid item, breaking the recipe
|
||||
}
|
||||
}
|
||||
return foundGoggles && foundHelm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting var1) {
|
||||
ItemStack helm = null;
|
||||
|
||||
for(int i = 0; i < var1.getSizeInventory(); i++) {
|
||||
ItemStack stack = var1.getStackInSlot(i);
|
||||
if(stack != null && checkHelm(stack))
|
||||
helm = stack;
|
||||
}
|
||||
|
||||
if(helm == null)
|
||||
return null;
|
||||
|
||||
ItemStack helmCopy = helm.copy();
|
||||
Item helmItem = helmCopy.getItem();
|
||||
|
||||
ItemStack newHelm;
|
||||
|
||||
if(helmItem == ModItems.manasteelHelm){
|
||||
newHelm = new ItemStack(ModItems.manasteelHelmRevealing);
|
||||
}
|
||||
|
||||
else if(helmItem == ModItems.terrasteelHelm){
|
||||
newHelm = new ItemStack(ModItems.terrasteelHelmRevealing);
|
||||
}
|
||||
|
||||
else if(helmItem == ModItems.elementiumHelm){
|
||||
newHelm = new ItemStack(ModItems.elementiumHelmRevealing);
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
}
|
||||
|
||||
//Copy Ancient Wills
|
||||
for(int i = 0; i < 6; i++){
|
||||
if(ItemNBTHelper.getBoolean(helmCopy, "AncientWill" + i, false))
|
||||
ItemNBTHelper.setBoolean(newHelm, "AncientWill" + i, true);
|
||||
}
|
||||
//Copy Enchantments
|
||||
NBTTagList enchList = ItemNBTHelper.getList(helmCopy, "ench", 10, true);
|
||||
if(enchList != null)
|
||||
ItemNBTHelper.setList(newHelm, "ench", enchList);
|
||||
|
||||
return newHelm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return new ItemStack(ModItems.manasteelHelmRevealing);
|
||||
}
|
||||
|
||||
private boolean checkHelm(ItemStack helmStack) {
|
||||
Item helmItem = helmStack.getItem();
|
||||
return (helmItem == ModItems.manasteelHelm || helmItem == ModItems.terrasteelHelm || helmItem == ModItems.elementiumHelm);
|
||||
}
|
||||
|
||||
}
|
||||
+7
-1
@@ -12,12 +12,16 @@ package vazkii.botania.common.item.interaction.thaumcraft;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
import thaumcraft.api.IGoggles;
|
||||
import thaumcraft.api.nodes.IRevealer;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.crafting.recipe.HelmRevealingRecipe;
|
||||
import vazkii.botania.common.item.equipment.armor.manasteel.ItemManasteelHelm;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.IGoggles", striprefs = true),
|
||||
@@ -26,6 +30,8 @@ public class ItemManasteelHelmRevealing extends ItemManasteelHelm implements IGo
|
||||
|
||||
public ItemManasteelHelmRevealing() {
|
||||
super(LibItemNames.MANASTEEL_HELM_R);
|
||||
GameRegistry.addRecipe(new HelmRevealingRecipe()); //Manasteel is the base so it gets the recipe added in its constructor so that ModItems can call it
|
||||
RecipeSorter.register("botania:helmRevealing", HelmRevealingRecipe.class, Category.SHAPELESS, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,4 +49,4 @@ public class ItemManasteelHelmRevealing extends ItemManasteelHelm implements IGo
|
||||
return LibResources.MODEL_MANASTEEL_2;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user