mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-13 16:54:06 +00:00
Fixed dying Composite Lenses removing the composite component. Took me long enough. Closes #260
This commit is contained in:
1 parent
0dcc56a9c0
commit
4801313df0
5 files changed
+107
-19
No files matched your search
@@ -43,8 +43,6 @@ public final class ModCraftingRecipes {
|
||||
public static List<IRecipe> recipesApothecary;
|
||||
public static List<IRecipe> recipesSpreader;
|
||||
public static IRecipe recipeManaLens;
|
||||
public static List<IRecipe> recipesLensDying;
|
||||
public static IRecipe recipeRainbowLens;
|
||||
public static IRecipe recipePool;
|
||||
public static List<IRecipe> recipesRuneAltar;
|
||||
public static IRecipe recipeLensVelocity;
|
||||
@@ -274,21 +272,6 @@ public final class ModCraftingRecipes {
|
||||
'G', new ItemStack(Blocks.glass_pane));
|
||||
recipeManaLens = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
// Mana Lens Dying Recipes
|
||||
for(int j = 0; j < 16; j++)
|
||||
addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens), j), new ItemStack(ModItems.lens), LibOreDict.DYE[j]);
|
||||
recipesLensDying = BotaniaAPI.getLatestAddedRecipes(16);
|
||||
|
||||
for(int i = 1; i < ItemLens.SUBTYPES; i++)
|
||||
for(int j = 0; j < 16; j++)
|
||||
addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens, 1, i), j), new ItemStack(ModItems.lens, 1, i), LibOreDict.DYE[j]);
|
||||
|
||||
// Rainbow Lens Recipe
|
||||
addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens), 16), new ItemStack(ModItems.lens), LibOreDict.MANA_PEARL);
|
||||
recipeRainbowLens = BotaniaAPI.getLatestAddedRecipe();
|
||||
for(int i = 1; i < ItemLens.SUBTYPES; i++)
|
||||
addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens, 1, i), 16), new ItemStack(ModItems.lens, 1, i), LibOreDict.MANA_PEARL);
|
||||
|
||||
// Mana Pool Recipe
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.pool, 1, 2),
|
||||
"R R", "RRR",
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 23, 2015, 4:10:24 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.crafting.recipe;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.mana.ILens;
|
||||
import vazkii.botania.common.item.ItemLens;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
|
||||
public class LensDyingRecipe implements IRecipe {
|
||||
|
||||
private static final List<String> DYES = Arrays.asList(new String[] {
|
||||
"dyeWhite", "dyeOrange", "dyeMagenta", "dyeLightBlue", "dyeYellow", "dyeLime", "dyePink", "dyeGray", "dyeLightGray", "dyeCyan", "dyePurple", "dyeBlue", "dyeBrown", "dyeGreen", "dyeRed", "dyeBlack", LibOreDict.MANA_PEARL
|
||||
});
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting var1, World var2) {
|
||||
boolean foundLens = false;
|
||||
boolean foundDye = false;
|
||||
|
||||
for(int i = 0; i < var1.getSizeInventory(); i++) {
|
||||
ItemStack stack = var1.getStackInSlot(i);
|
||||
if(stack != null) {
|
||||
if(stack.getItem() instanceof ILens && !foundLens)
|
||||
foundLens = true;
|
||||
else if(!foundDye) {
|
||||
int color = getStackColor(stack);
|
||||
if(color > -1)
|
||||
foundDye = true;
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return foundLens && foundDye;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting var1) {
|
||||
ItemStack lens = null;
|
||||
int color = -1;
|
||||
|
||||
for(int i = 0; i < var1.getSizeInventory(); i++) {
|
||||
ItemStack stack = var1.getStackInSlot(i);
|
||||
if(stack != null) {
|
||||
if(stack.getItem() instanceof ILens && lens == null)
|
||||
lens = stack;
|
||||
else color = getStackColor(stack);
|
||||
}
|
||||
}
|
||||
|
||||
if(lens.getItem() instanceof ILens) {
|
||||
ILens lensItem = (ILens) lens.getItem();
|
||||
ItemStack lensCopy = lens.copy();
|
||||
((ItemLens) ModItems.lens).setLensColor(lensCopy, color);
|
||||
|
||||
return lensCopy;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return null;
|
||||
}
|
||||
|
||||
int getStackColor(ItemStack stack) {
|
||||
int[] ids = OreDictionary.getOreIDs(stack);
|
||||
for(int i : ids) {
|
||||
int index = DYES.indexOf(OreDictionary.getOreName(i));
|
||||
if(index > 0)
|
||||
return index;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -58,6 +58,7 @@ import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.crafting.recipe.CompositeLensRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.LensDyingRecipe;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@@ -138,7 +139,9 @@ public class ItemLens extends ItemMod implements ILens {
|
||||
setHasSubtypes(true);
|
||||
|
||||
GameRegistry.addRecipe(new CompositeLensRecipe());
|
||||
GameRegistry.addRecipe(new LensDyingRecipe());
|
||||
RecipeSorter.register("botania:compositeLens", CompositeLensRecipe.class, Category.SHAPELESS, "");
|
||||
RecipeSorter.register("botania:lensDying", CompositeLensRecipe.class, Category.SHAPELESS, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -272,7 +272,7 @@ public final class LexiconData {
|
||||
rfGenerator.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeRFGenerator));
|
||||
|
||||
lenses = new BLexiconEntry(LibLexicon.MANA_LENSES, categoryMana);
|
||||
lenses.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeManaLens), new PageCraftingRecipe("2", ModCraftingRecipes.recipesLensDying), new PageCraftingRecipe("3", ModCraftingRecipes.recipeRainbowLens), new PageText("4"), new PageText("5"),
|
||||
lenses.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeManaLens), new PageText("4"), new PageText("5"),
|
||||
new PageText("6"), new PageCraftingRecipe("7", ModCraftingRecipes.recipeLensVelocity),
|
||||
new PageText("8"), new PageCraftingRecipe("9", ModCraftingRecipes.recipeLensPotency),
|
||||
new PageText("10"), new PageCraftingRecipe("11", ModCraftingRecipes.recipeLensResistance),
|
||||
|
||||
Reference in new issue
Block a user