From 06ede0c82210a589a1240cb9b9a07494f7fac598 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 5 May 2016 19:50:59 +0200 Subject: [PATCH] Made color lens more modular by adding a way to colorize items to the API. API Version bumped to 9. --- .../api/ActuallyAdditionsAPI.java | 24 ++++++-- .../api/recipe/ColorLensChangerByDyeMeta.java | 23 ++++++++ .../api/recipe/IColorLensChanger.java | 24 ++++++++ .../mod/ActuallyAdditions.java | 4 +- .../mod/booklet/InitBooklet.java | 9 ++- .../mod/items/lens/LensColor.java | 56 ++++++++++--------- .../mod/items/lens/LensNone.java | 4 +- ...ipeHandler.java => LensRecipeHandler.java} | 16 +++++- 8 files changed, 118 insertions(+), 42 deletions(-) create mode 100644 src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java create mode 100644 src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java rename src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/{LensNoneRecipeHandler.java => LensRecipeHandler.java} (85%) diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java index 0e27aa6fd..986594a0d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java @@ -12,27 +12,28 @@ package de.ellpeck.actuallyadditions.api; import de.ellpeck.actuallyadditions.api.booklet.BookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; -import de.ellpeck.actuallyadditions.api.recipe.BallOfFurReturn; -import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; -import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe; -import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot; +import de.ellpeck.actuallyadditions.api.recipe.*; import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class ActuallyAdditionsAPI{ public static final String MOD_ID = "actuallyadditions"; public static final String API_ID = MOD_ID+"api"; - public static final String API_VERSION = "8"; + public static final String API_VERSION = "9"; public static List crusherRecipes = new ArrayList(); public static List ballOfFurReturnItems = new ArrayList(); public static List treasureChestLoot = new ArrayList(); public static List reconstructorLensNoneRecipes = new ArrayList(); + public static Map reconstructorLensColorChangers = new HashMap(); public static List coffeeMachineIngredients = new ArrayList(); public static List bookletEntries = new ArrayList(); @@ -159,6 +160,19 @@ public class ActuallyAdditionsAPI{ reconstructorLensNoneRecipes.add(new LensNoneRecipe(input, output, energyUse)); } + /** + * Adds an item and the way it is modified to the Atomic Reconstructor's color lens. + * This also works for blocks, but they have to be in their item form. + * The way it is modified is an instance of IColorLensChanger. When modifying the item, + * its modifyItem() method will be called with a stack containing the item. + * + * @param item The item (or block's item) to add + * @param changer The change mechanism + */ + public static void addReconstructorLensColorChangeItem(Item item, IColorLensChanger changer){ + reconstructorLensColorChangers.put(item, changer); + } + /** * Adds an ingredient to the Coffee Machine ingredient list * diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java new file mode 100644 index 000000000..18849a55e --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/ColorLensChangerByDyeMeta.java @@ -0,0 +1,23 @@ +package de.ellpeck.actuallyadditions.api.recipe; + +import net.minecraft.item.ItemStack; + +/** + * Changes an item's color by changing its metadata. + * Much like dye and wool, 0 is white and 15 is black and it will cycle around. + */ +public class ColorLensChangerByDyeMeta implements IColorLensChanger{ + + @Override + public ItemStack modifyItem(ItemStack stack){ + ItemStack newStack = stack.copy(); + int meta = newStack.getItemDamage(); + if(meta >= 15){ + newStack.setItemDamage(0); + } + else{ + newStack.setItemDamage(meta+1); + } + return newStack; + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java new file mode 100644 index 000000000..2edc0f386 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/IColorLensChanger.java @@ -0,0 +1,24 @@ +package de.ellpeck.actuallyadditions.api.recipe; + +import net.minecraft.item.ItemStack; + +/** + * Used for the Atomic Reconstructor's Color Lens changing algorythm. + * When registering a new item to be changed, it needs an IColorLensChanger which + * is the method with which the item will be changed. + * + * See ColorLensChangerByDyeMeta for reference. + */ +public interface IColorLensChanger{ + + /** + * Modifies the given item. + * Will only be called with stacks containing items that are registered with + * this IColorLensChanger. + * + * @param stack the stack to modify + * @return the modified stack. Please make sure to return a modified COPY of the input stack. + */ + ItemStack modifyItem(ItemStack stack); + +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index 0c4202df6..ca3b1340d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -25,7 +25,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.items.InitForeignPaxels; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; -import de.ellpeck.actuallyadditions.mod.items.lens.LensNoneRecipeHandler; +import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials; import de.ellpeck.actuallyadditions.mod.material.InitToolMaterials; import de.ellpeck.actuallyadditions.mod.misc.*; @@ -105,7 +105,7 @@ public class ActuallyAdditions{ ItemCrafting.initMashedFoodRecipes(); HairyBallHandler.init(); TreasureChestHandler.init(); - LensNoneRecipeHandler.init(); + LensRecipeHandler.init(); InitForeignPaxels.init(); InitBooklet.postInit(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index d23c114a1..0c7524dba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.booklet; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; @@ -26,7 +25,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.crafting.*; import de.ellpeck.actuallyadditions.mod.gen.OreGen; import de.ellpeck.actuallyadditions.mod.items.InitItems; -import de.ellpeck.actuallyadditions.mod.items.lens.LensNoneRecipeHandler; +import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.tile.*; @@ -60,14 +59,14 @@ public class InitBooklet{ //Getting Started chapterIntro = new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3)); new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemBooklet), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook)); - new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setPageStacksWildcard(), new PageCrafting(7, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(8, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(9, LensNoneRecipeHandler.mainPageRecipes).setNoText()).setSpecial(); + new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setPageStacksWildcard(), new PageCrafting(7, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(8, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(9, LensRecipeHandler.mainPageRecipes).setNoText()).setSpecial(); new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("", TileEntityCoalGenerator.PRODUCE).setPageStacksWildcard()); new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(7, ItemCrafting.recipeRing).setNoText(), new PageCrafting(8, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(11, ItemCrafting.recipeDough).setNoText(), new PageCrafting(12, ItemCrafting.recipeRiceDough).setNoText(), new PageCrafting(13, BlockCrafting.recipeIronCase).setNoText()).setImportant(); new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1)); //Miscellaneous - new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeColorLens), new PageReconstructor(4, LensNoneRecipeHandler.recipeExplosionLens), new PageReconstructor(5, LensNoneRecipeHandler.recipeDamageLens), new PageReconstructor(6, LensNoneRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(7, LensNoneRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(8, LensNoneRecipeHandler.recipeNetherWart).setNoText()).setImportant(); - new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensNoneRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeGreenWall).setNoText()); + new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeColorLens), new PageReconstructor(4, LensRecipeHandler.recipeExplosionLens), new PageReconstructor(5, LensRecipeHandler.recipeDamageLens), new PageReconstructor(6, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(7, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(8, LensRecipeHandler.recipeNetherWart).setNoText()).setImportant(); + new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeGreenWall).setNoText()); new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("", OreGen.QUARTZ_MIN).addTextReplacement("", OreGen.QUARTZ_MAX), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText()); new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText().setPageStacksWildcard()).setSpecial(); new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java index 3d23f2748..2aa839191 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java @@ -11,8 +11,10 @@ package de.ellpeck.actuallyadditions.mod.items.lens; +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; +import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.Util; @@ -21,25 +23,19 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import java.util.ArrayList; +import java.util.Map; public class LensColor extends Lens{ public static final int ENERGY_USE = 200; - public static final Object[] CONVERTABLE_BLOCKS = new Object[]{ - Items.DYE, - Blocks.WOOL, - Blocks.STAINED_GLASS, - Blocks.STAINED_GLASS_PANE, - Blocks.STAINED_HARDENED_CLAY, - Blocks.CARPET, - InitBlocks.blockColoredLamp, - InitBlocks.blockColoredLampOn - }; + //Thanks to xdjackiexd for this, as I couldn't be bothered private static final float[][] POSSIBLE_COLORS = { {158F, 43F, 39F}, //Red @@ -60,30 +56,21 @@ public class LensColor extends Lens{ @Override public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ if(hitBlock != null){ - if(Util.arrayContains(CONVERTABLE_BLOCKS, PosUtil.getBlock(hitBlock, tile.getWorldObject())) >= 0 && tile.getEnergy() >= ENERGY_USE){ + if(tile.getEnergy() >= ENERGY_USE){ int meta = PosUtil.getMetadata(hitBlock, tile.getWorldObject()); - if(meta >= 15){ - PosUtil.setMetadata(hitBlock, tile.getWorldObject(), 0, 2); + ItemStack returnStack = this.tryConvert(new ItemStack(PosUtil.getBlock(hitBlock, tile.getWorldObject()), 1, meta)); + if(returnStack != null && returnStack.getItem() instanceof ItemBlock){ + PosUtil.setBlock(hitBlock, tile.getWorldObject(), Block.getBlockFromItem(returnStack.getItem()), returnStack.getItemDamage(), 2); + + tile.extractEnergy(ENERGY_USE); } - else{ - PosUtil.setMetadata(hitBlock, tile.getWorldObject(), meta+1, 2); - } - tile.extractEnergy(ENERGY_USE); } ArrayList items = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); for(EntityItem item : items){ if(!item.isDead && item.getEntityItem() != null && tile.getEnergy() >= ENERGY_USE){ - if(Util.arrayContains(CONVERTABLE_BLOCKS, item.getEntityItem().getItem()) >= 0 || Util.arrayContains(CONVERTABLE_BLOCKS, Block.getBlockFromItem(item.getEntityItem().getItem())) >= 0){ - ItemStack newStack = item.getEntityItem().copy(); - int meta = newStack.getItemDamage(); - if(meta >= 15){ - newStack.setItemDamage(0); - } - else{ - newStack.setItemDamage(meta+1); - } - + ItemStack newStack = this.tryConvert(item.getEntityItem()); + if(newStack != null){ item.setDead(); EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, newStack); @@ -97,6 +84,21 @@ public class LensColor extends Lens{ return false; } + private ItemStack tryConvert(ItemStack stack){ + if(stack != null){ + Item item = stack.getItem(); + if(item != null){ + for(Map.Entry changer : ActuallyAdditionsAPI.reconstructorLensColorChangers.entrySet()){ + if(item == changer.getKey()){ + return changer.getValue().modifyItem(stack); + } + } + } + } + + return null; + } + @Override public float[] getColor(){ float[] colors = POSSIBLE_COLORS[Util.RANDOM.nextInt(POSSIBLE_COLORS.length)]; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java index e751cb020..f3a9e5bd9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java @@ -40,7 +40,7 @@ public class LensNone extends Lens{ for(int reachZ = -range; reachZ < range+1; reachZ++){ for(int reachY = -range; reachY < range+1; reachY++){ BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ); - List recipes = LensNoneRecipeHandler.getRecipesFor(new ItemStack(PosUtil.getBlock(pos, tile.getWorldObject()), 1, PosUtil.getMetadata(pos, tile.getWorldObject()))); + List recipes = LensRecipeHandler.getRecipesFor(new ItemStack(PosUtil.getBlock(pos, tile.getWorldObject()), 1, PosUtil.getMetadata(pos, tile.getWorldObject()))); for(LensNoneRecipe recipe : recipes){ if(recipe != null && tile.getEnergy() >= recipe.energyUse){ List outputs = recipe.getOutputs(); @@ -70,7 +70,7 @@ public class LensNone extends Lens{ for(EntityItem item : items){ ItemStack stack = item.getEntityItem(); if(!item.isDead && stack != null){ - List recipes = LensNoneRecipeHandler.getRecipesFor(stack); + List recipes = LensRecipeHandler.getRecipesFor(stack); for(LensNoneRecipe recipe : recipes){ if(recipe != null && tile.getEnergy() >= recipe.energyUse){ List outputs = recipe.getOutputs(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNoneRecipeHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java similarity index 85% rename from src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNoneRecipeHandler.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java index 848dad922..160a5a385 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNoneRecipeHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensRecipeHandler.java @@ -11,6 +11,8 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.recipe.ColorLensChangerByDyeMeta; +import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger; import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting; @@ -21,11 +23,12 @@ import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.RecipeUtil; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import java.util.ArrayList; -public class LensNoneRecipeHandler{ +public class LensRecipeHandler{ public static ArrayList mainPageRecipes = new ArrayList(); public static LensNoneRecipe recipeColorLens; @@ -96,6 +99,17 @@ public class LensNoneRecipeHandler{ recipeWhiteWall = RecipeUtil.lastReconstructorRecipe(); ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10); recipeGreenWall = RecipeUtil.lastReconstructorRecipe(); + + IColorLensChanger changer = new ColorLensChangerByDyeMeta(); + ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Items.DYE, changer); + ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(Blocks.WOOL), changer); + ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(Blocks.STAINED_GLASS), changer); + ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(Blocks.STAINED_GLASS_PANE), changer); + ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(Blocks.STAINED_HARDENED_CLAY), changer); + ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(Blocks.CARPET), changer); + ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(InitBlocks.blockColoredLamp), changer); + ActuallyAdditionsAPI.addReconstructorLensColorChangeItem(Item.getItemFromBlock(InitBlocks.blockColoredLampOn), changer); + } public static ArrayList getRecipesFor(ItemStack input){