From 40191b840af4536b1b56b3d5f5d3407dd03e2e2f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 4 Dec 2015 12:59:37 +0100 Subject: [PATCH] Made the Color Lens use energy & Added NEI Recipes for the color conversion recipes & Changed booklet pages a bit --- .../items/lens/LensColor.java | 11 ++++-- .../nei/NEIReconstructorRecipe.java | 37 ++++++++++++++++++ .../assets/actuallyadditions/lang/en_US.lang | 10 ++--- ...ue.png => blockColoredLampOnLightBlue.png} | Bin 4 files changed, 50 insertions(+), 8 deletions(-) rename src/main/resources/assets/actuallyadditions/textures/blocks/{blockColoredLampLightOnBlue.png => blockColoredLampOnLightBlue.png} (100%) diff --git a/src/main/java/ellpeck/actuallyadditions/items/lens/LensColor.java b/src/main/java/ellpeck/actuallyadditions/items/lens/LensColor.java index b6e82edf9..ef248a9ec 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/lens/LensColor.java +++ b/src/main/java/ellpeck/actuallyadditions/items/lens/LensColor.java @@ -40,12 +40,15 @@ public class LensColor extends Lens{ {86F, 51F, 28F}, //Brown }; - private static final Object[] CONVERTABLE_BLOCKS = new Object[]{ + 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 }; @@ -54,7 +57,7 @@ public class LensColor extends Lens{ @Override public boolean invoke(WorldPos hitBlock, TileEntityAtomicReconstructor tile){ if(hitBlock != null){ - if(Util.arrayContains(CONVERTABLE_BLOCKS, hitBlock.getBlock()) >= 0){ + if(Util.arrayContains(CONVERTABLE_BLOCKS, hitBlock.getBlock()) >= 0 && tile.storage.getEnergyStored() >= ENERGY_USE){ int meta = hitBlock.getMetadata(); if(meta >= 15){ hitBlock.setMetadata(0, 2); @@ -62,11 +65,12 @@ public class LensColor extends Lens{ else{ hitBlock.setMetadata(meta+1, 2); } + tile.storage.extractEnergy(ENERGY_USE, false); } ArrayList items = (ArrayList)tile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); for(EntityItem item : items){ - if(item.getEntityItem() != null){ + if(item.getEntityItem() != null && tile.storage.getEnergyStored() >= ENERGY_USE){ if(Util.arrayContains(CONVERTABLE_BLOCKS, item.getEntityItem().getItem()) >= 0 || Util.arrayContains(CONVERTABLE_BLOCKS, Block.getBlockFromItem(item.getEntityItem().getItem())) >= 0){ int meta = item.getEntityItem().getItemDamage(); if(meta >= 15){ @@ -75,6 +79,7 @@ public class LensColor extends Lens{ else{ item.getEntityItem().setItemDamage(meta+1); } + tile.storage.extractEnergy(ENERGY_USE, false); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEIReconstructorRecipe.java b/src/main/java/ellpeck/actuallyadditions/nei/NEIReconstructorRecipe.java index 2a9b5fb72..6deedaf9a 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEIReconstructorRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEIReconstructorRecipe.java @@ -17,12 +17,16 @@ import codechicken.nei.recipe.TemplateRecipeHandler; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.booklet.BookletUtils; import ellpeck.actuallyadditions.booklet.page.BookletPage; +import ellpeck.actuallyadditions.items.lens.LensColor; import ellpeck.actuallyadditions.items.lens.LensNoneRecipeHandler; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; +import ellpeck.actuallyadditions.util.Util; +import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; @@ -58,10 +62,27 @@ public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INE @Override public void loadCraftingRecipes(String outputId, Object... results){ if(outputId.equals(NAME) && getClass() == NEIReconstructorRecipe.class){ + //Default Recipes ArrayList recipes = LensNoneRecipeHandler.recipes; for(LensNoneRecipeHandler.Recipe recipe : recipes){ arecipes.add(new CachedReconstructorRecipe(recipe)); } + //Color Recipes + for(Object o : LensColor.CONVERTABLE_BLOCKS){ + ItemStack stack; + if(o instanceof Block){ + stack = new ItemStack((Block)o); + } + else{ + stack = new ItemStack((Item)o); + } + for(int i = 0; i < 16; i++){ + ItemStack stackCopy = stack.copy(); + stackCopy.setItemDamage(i >= 15 ? 0 : i+1); + stack.setItemDamage(i); + arecipes.add(new CachedReconstructorRecipe(new LensNoneRecipeHandler.Recipe(stack, stackCopy, LensColor.ENERGY_USE))); + } + } } else{ super.loadCraftingRecipes(outputId, results); @@ -71,16 +92,25 @@ public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INE @Override public void loadCraftingRecipes(ItemStack result){ ArrayList recipes = LensNoneRecipeHandler.recipes; + //Default Recipes for(LensNoneRecipeHandler.Recipe recipe : recipes){ if(ItemUtil.contains(recipe.getOutputs(), result, true)){ arecipes.add(new CachedReconstructorRecipe(recipe)); } } + //Color Recipes + if(result.getItem() != null && (Util.arrayContains(LensColor.CONVERTABLE_BLOCKS, result.getItem()) >= 0 || Util.arrayContains(LensColor.CONVERTABLE_BLOCKS, Block.getBlockFromItem(result.getItem())) >= 0)){ + int meta = result.getItemDamage(); + ItemStack input = result.copy(); + input.setItemDamage(meta <= 0 ? 15 : meta-1); + arecipes.add(new CachedReconstructorRecipe(new LensNoneRecipeHandler.Recipe(input, result, LensColor.ENERGY_USE))); + } } @Override public void loadUsageRecipes(ItemStack ingredient){ ArrayList recipes = LensNoneRecipeHandler.recipes; + //Default Recipes for(LensNoneRecipeHandler.Recipe recipe : recipes){ if(ItemUtil.contains(recipe.getInputs(), ingredient, true)){ CachedReconstructorRecipe theRecipe = new CachedReconstructorRecipe(recipe); @@ -88,6 +118,13 @@ public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INE arecipes.add(theRecipe); } } + //Color Recipes + if(ingredient.getItem() != null && (Util.arrayContains(LensColor.CONVERTABLE_BLOCKS, ingredient.getItem()) >= 0 || Util.arrayContains(LensColor.CONVERTABLE_BLOCKS, Block.getBlockFromItem(ingredient.getItem())) >= 0)){ + int meta = ingredient.getItemDamage(); + ItemStack output = ingredient.copy(); + output.setItemDamage(meta >= 15 ? 0 : meta+1); + arecipes.add(new CachedReconstructorRecipe(new LensNoneRecipeHandler.Recipe(ingredient, output, LensColor.ENERGY_USE))); + } } @Override diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 1c039561a..b995b27c0 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -605,7 +605,7 @@ booklet.actuallyadditions.chapter.blackLotus.text.2=No, not that one, Vaz booklet.actuallyadditions.chapter.crystals.name=Crystals and Reconstructor booklet.actuallyadditions.chapter.crystals.text.1=The Atomic Reconstructor is used to craft Crystals, which are the main crafting ingredient in most items from Actually Additions. Upon being supplied with power, it shoots out a Laser. When the Laser hits a block, it will convert all surrounding items and blocks, provided they can be converted. When shooting a laser, it uses RF, but additional rates vary depending on the conversion. -booklet.actuallyadditions.chapter.crystals.text.2=The Reconstructor can be upgraded, however, by the use of Lenses. They can be applied to the Reconstructor by right-clicking with one in hand, and taken out again when right-clicking with an empty hand. When looking at Recipes, the Lens needed for the operation will also be shown. The Crafting Recipes for the Lenses can also be found on the following pages. Lenses are also attachable. See the booklet's Miscellaneous section for more information. +booklet.actuallyadditions.chapter.crystals.text.2=There are various Lenses that can be attached to the Reconstructor that don't all follow the default behavior of the Reconstructor and are able to do some neat things. See the "Reconstructor Lenses & Misc" chapter in the booklet's Miscellaneous section for more information. booklet.actuallyadditions.chapter.crystals.text.4=When you have crafted a couple of items, you might want to find a way to automate this. There is a very simple way to do accomplish this: Place the Atomic Reconstructor down facing into a Precision Dropper (to find it, look it up in the All Items and Search Entry!). Next, place a Ranged Collector in the area that has the converted items set as a whitelist. Now you can just chuck your raw materials into the Dropper to convert them! booklet.actuallyadditions.chapter.bookTutorial.name=Intro to the Manual @@ -618,10 +618,10 @@ booklet.actuallyadditions.chapter.bookStand.text.1=The Manual Stand is booklet.actuallyadditions.chapter.bookStand.text.2=Stand on it booklet.actuallyadditions.chapter.reconstructorLenses.name=Reconstructor Lenses & Misc -booklet.actuallyadditions.chapter.reconstructorLenses.text.1=The Atomic Reconstructor, by default, can only convert some blocks. This can be changed, however, with Lenses. They can be, once crafted, attached to the Reconstructor via right-clicking the Reconstructor with them in hand. To remove them, right-click it with an empty hand. Lenses have lots of different features and uses, as you can see on the following pages. However, there is also some other useful recipes to be found there too. -booklet.actuallyadditions.chapter.reconstructorLenses.text.3=The Lens of Color can mainly be used to change the colors of Wool, Stained Clay, Stained Glass and Dye, as you can see on the following pages. It has some other uses, too, though. -booklet.actuallyadditions.chapter.reconstructorLenses.text.5=The Lens of Detonation will create a firey explosion around the block the laser hits. Be careful with this. Seriously. (With this lens, the laser also goes 3 times as far!) -booklet.actuallyadditions.chapter.reconstructorLenses.text.6=The Lens of Certain Death will, instead of converting or exploding blocks, do nothing to the environment, but deal lots of damage, enough, in fact, to kill a player in a single hit. +booklet.actuallyadditions.chapter.reconstructorLenses.text.1=The Atomic Reconstructor, by default, can only convert some blocks. This can be changed, however, with Lenses. They can be, once crafted, attached to the Reconstructor via right-clicking the Reconstructor with them in hand. To remove them, right-click it with an empty hand. Lenses have lots of different features and uses, as you can see on the following pages. However, there is also some other useful recipes to be found there too. +booklet.actuallyadditions.chapter.reconstructorLenses.text.3=The Lens of Color changes the color of Stained Glass and Panes, Stained Clay, Carpetet, Dye, Lamps, Wool in its sight. Contrary to using no lens, it goes through blocks and only converts blocks it touches. +booklet.actuallyadditions.chapter.reconstructorLenses.text.4=The Lens of Detonation will create a firey explosion around the block the laser hits. Be careful with this. Seriously. (With this lens, the laser also goes 3 times as far!) +booklet.actuallyadditions.chapter.reconstructorLenses.text.5=The Lens of Certain Death will, deal lots of damage to whatever steps into it, enough, in fact, to kill a player in a single hit. booklet.actuallyadditions.chapter.miscDecorStuffsAndThings.name=Some Decor booklet.actuallyadditions.chapter.miscDecorStuffsAndThings.text.1=Sometimes, when you build, you notice there is just not enough decor blocks. Well, we present to you: Ethetic Blocks! These are some quartz-like decor blocks with lovely patterns that can also be converted into Stairs, Slabs and Walls using the usual, well-known recipe patterns. \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockColoredLampLightOnBlue.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockColoredLampOnLightBlue.png similarity index 100% rename from src/main/resources/assets/actuallyadditions/textures/blocks/blockColoredLampLightOnBlue.png rename to src/main/resources/assets/actuallyadditions/textures/blocks/blockColoredLampOnLightBlue.png