From b57c8f03b9f8566ddebed3aad75c550779a892cc Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 1 Dec 2015 18:27:40 +0100 Subject: [PATCH] Colorable Drills~ --- .../booklet/InitBooklet.java | 2 +- .../crafting/ItemCrafting.java | 27 ++++++------------- .../actuallyadditions/items/ItemDrill.java | 21 +++++++-------- .../recipe/ReconstructorRecipeHandler.java | 19 +++++++++++-- .../actuallyadditions/util/AssetUtil.java | 18 ------------- .../assets/actuallyadditions/lang/en_US.lang | 2 +- 6 files changed, 37 insertions(+), 52 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java index 8ff94e4e7..f3c77e742 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java @@ -131,7 +131,7 @@ public class InitBooklet{ new BookletChapter("potionRings", entryItemsNonRF, new ItemStack(InitItems.itemPotionRing), potionRingPages.toArray(new BookletPage[potionRingPages.size()])); //RF Using Items - new BookletChapter("drill", entryItemsRF, new ItemStack(InitItems.itemDrill), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeDrill, ItemCrafting.recipeDrillEmerald, ItemCrafting.recipeDrillPurple).setPageStacksWildcard(), new PageCrafting(3, ItemCrafting.recipeDrillCore).setNoText(), new PageCrafting(4, ItemCrafting.recipeDrillSpeedI).setNoText(), new PageCrafting(5, ItemCrafting.recipeDrillSpeedII).setNoText(), new PageCrafting(6, ItemCrafting.recipeDrillSpeedIII).setNoText(), new PageCrafting(7, ItemCrafting.recipeDrillFortuneI).setNoText(), new PageCrafting(8, ItemCrafting.recipeDrillFortuneII).setNoText(), new PageCrafting(9, ItemCrafting.recipeDrillSilk).setNoText(), new PageCrafting(10, ItemCrafting.recipeDrillThree).setNoText(), new PageCrafting(11, ItemCrafting.recipeDrillFive).setNoText(), new PageCrafting(12, ItemCrafting.recipeDrillPlacing).setNoText()).setSpecial(); + new BookletChapter("drill", entryItemsRF, new ItemStack(InitItems.itemDrill), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeDrill).setNoText(), new PageCrafting(3, ItemCrafting.recipesDrillColoring).setPageStacksWildcard(), new PageCrafting(4, ItemCrafting.recipeDrillCore).setNoText(), new PageCrafting(5, ItemCrafting.recipeDrillSpeedI).setNoText(), new PageCrafting(6, ItemCrafting.recipeDrillSpeedII).setNoText(), new PageCrafting(7, ItemCrafting.recipeDrillSpeedIII).setNoText(), new PageCrafting(8, ItemCrafting.recipeDrillFortuneI).setNoText(), new PageCrafting(9, ItemCrafting.recipeDrillFortuneII).setNoText(), new PageCrafting(10, ItemCrafting.recipeDrillSilk).setNoText(), new PageCrafting(11, ItemCrafting.recipeDrillThree).setNoText(), new PageCrafting(12, ItemCrafting.recipeDrillFive).setNoText(), new PageCrafting(13, ItemCrafting.recipeDrillPlacing).setNoText()).setSpecial(); new BookletChapter("staff", entryItemsRF, new ItemStack(InitItems.itemTeleStaff), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant(); new BookletChapter("magnetRing", entryItemsRF, new ItemStack(InitItems.itemMagnetRing), new PageCrafting(1, ItemCrafting.recipeMagnetRing)); new BookletChapter("growthRing", entryItemsRF, new ItemStack(InitItems.itemGrowthRing), new PageCrafting(1, ItemCrafting.recipeGrowthRing)); diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 04f8dc32d..07c402034 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.crafting; import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.blocks.metalists.TheColoredLampColors; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting; @@ -42,8 +43,7 @@ public class ItemCrafting{ public static IRecipe recipeTinyChar; public static ArrayList recipesMashedFood = new ArrayList(); public static IRecipe recipeDrill; - public static IRecipe recipeDrillEmerald; - public static IRecipe recipeDrillPurple; + public static IRecipe[] recipesDrillColoring = new IRecipe[16]; public static IRecipe recipeDrillSpeedI; public static IRecipe recipeDrillSpeedII; public static IRecipe recipeDrillSpeedIII; @@ -146,7 +146,8 @@ public class ItemCrafting{ //Drill if(ConfigCrafting.DRILL.isEnabled()){ - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrill), + ItemStack lightBlueDrill = new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()); + GameRegistry.addRecipe(new ShapedOreRecipe(lightBlueDrill.copy(), "DDD", "CRC", "III", 'D', "crystalLightBlue", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), @@ -154,22 +155,10 @@ public class ItemCrafting{ 'I', "blockCrystalWhite")); recipeDrill = Util.GetRecipes.lastIRecipe(); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrill, 1, 1), - "DDD", "CRC", "III", - 'D', "crystalGreen", - 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), - 'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DRILL_CORE.ordinal()), - 'I', "blockCrystalWhite")); - recipeDrillEmerald = Util.GetRecipes.lastIRecipe(); - - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrill, 1, 2), - "DFD", "CRC", "III", - 'F', "blockCrystalRed", - 'D', "crystalLightBlue", - 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), - 'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DRILL_CORE.ordinal()), - 'I', "blockCrystalWhite")); - recipeDrillPurple = Util.GetRecipes.lastIRecipe(); + for(int i = 0; i < recipesDrillColoring.length; i++){ + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemDrill, 1, i), lightBlueDrill.copy(), "dye"+TheColoredLampColors.values()[i].name)); + recipesDrillColoring[i] = Util.GetRecipes.lastIRecipe(); + } } //Drill Core diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java index e7241ebc9..3a7b23306 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java @@ -51,21 +51,20 @@ import java.util.Set; public class ItemDrill extends ItemEnergy{ @SideOnly(Side.CLIENT) - private IIcon emeraldIcon; - @SideOnly(Side.CLIENT) - private IIcon purpleIcon; + private IIcon[] allDemDamnIconsMaan; private static final int ENERGY_USE = 100; public ItemDrill(){ super(500000, 5000); this.setMaxDamage(0); + this.setHasSubtypes(true); } @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int par1){ - return par1 == 0 ? this.itemIcon : (par1 == 2 ? this.purpleIcon : this.emeraldIcon); + return par1 >= this.allDemDamnIconsMaan.length ? null : this.allDemDamnIconsMaan[par1]; } @Override @@ -77,10 +76,9 @@ public class ItemDrill extends ItemEnergy{ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs tabs, List list){ - super.getSubItems(item, tabs, list); - - this.addDrillStack(list, 1); - this.addDrillStack(list, 2); + for(int i = 0; i < this.allDemDamnIconsMaan.length; i++){ + this.addDrillStack(list, i); + } } private void addDrillStack(List list, int meta){ @@ -232,9 +230,10 @@ public class ItemDrill extends ItemEnergy{ @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconReg){ - this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); - this.emeraldIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Emerald"); - this.purpleIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+"Purple"); + this.allDemDamnIconsMaan = new IIcon[16]; + for(int i = 0; i < this.allDemDamnIconsMaan.length; i++){ + this.allDemDamnIconsMaan[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()+(i+1)); + } } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/ReconstructorRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/recipe/ReconstructorRecipeHandler.java index 7ae611d88..d07192564 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/ReconstructorRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/ReconstructorRecipeHandler.java @@ -12,7 +12,6 @@ package ellpeck.actuallyadditions.recipe; import ellpeck.actuallyadditions.blocks.metalists.TheColoredLampColors; import ellpeck.actuallyadditions.config.values.ConfigCrafting; -import ellpeck.actuallyadditions.util.AssetUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -178,7 +177,7 @@ public class ReconstructorRecipeHandler{ public float[] getColor(){ if(this == COLOR){ - float[] colors = AssetUtil.RGB_WOOL_COLORS[Util.RANDOM.nextInt(AssetUtil.RGB_WOOL_COLORS.length)]; + float[] colors = possibleColorLensColors[Util.RANDOM.nextInt(possibleColorLensColors.length)]; return new float[]{colors[0]/255F, colors[1]/255F, colors[2]/255F}; } else if(this == DETONATION){ @@ -197,6 +196,22 @@ public class ReconstructorRecipeHandler{ public int getDistance(){ return this == DETONATION ? 30 : (this == JUST_DAMAGE ? 15 : 10); } + + //Thanks to xdjackiexd for this, as I couldn't be bothered + private static final float[][] possibleColorLensColors = { + {158F, 43F, 39F}, //Red + {234F, 126F, 53F}, //Orange + {194F, 181F, 28F}, //Yellow + {57F, 186F, 46F}, //Lime Green + {54F, 75F, 24F}, //Green + {99F, 135F, 210F}, //Light Blue + {38F, 113F, 145F}, //Cyan + {37F, 49F, 147F}, //Blue + {126F, 52F, 191F}, //Purple + {190F, 73F, 201F}, //Magenta + {217F, 129F, 153F}, //Pink + {86F, 51F, 28F}, //Brown + }; } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java b/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java index 61317a86c..e31cd3dff 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/AssetUtil.java @@ -38,24 +38,6 @@ public class AssetUtil{ public static int laserRelayRenderId; public static int bookletStandRenderId; - /** - * Thanks to xdjackiexd for this, as I couldn't be bothered - */ - public static final float[][] RGB_WOOL_COLORS = { - {158F, 43F, 39F}, //Red - {234F, 126F, 53F}, //Orange - {194F, 181F, 28F}, //Yellow - {57F, 186F, 46F}, //Lime Green - {54F, 75F, 24F}, //Green - {99F, 135F, 210F}, //Light Blue - {38F, 113F, 145F}, //Cyan - {37F, 49F, 147F}, //Blue - {126F, 52F, 191F}, //Purple - {190F, 73F, 201F}, //Magenta - {217F, 129F, 153F}, //Pink - {86F, 51F, 28F}, //Brown - }; - public static ResourceLocation getGuiLocation(String file){ return new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/gui/"+file+".png"); } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 8e91ebb34..6ae7d8a05 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -560,7 +560,7 @@ booklet.actuallyadditions.chapter.potionRings.text.1=The Potion Rings h booklet.actuallyadditions.chapter.drill.name=Drills booklet.actuallyadditions.chapter.drill.text.1=The Drill works like a Pickaxe and a Shovel. It uses RF per block. It can be charged in an Energizer and upgraded by right-clicking with it in your hand. There is a lot of upgrades, but here is an explanation of some of them: The Mining Uprgades enlarge the hole which the Drill digs. The Placement Upgrade, after you right-click it in any slot of your hotbar, will make the Drill able to place a block from that slot by right-clicking. You can also put a Battery inside the Drill to give it more charge. -booklet.actuallyadditions.chapter.drill.text.2=The Drill can be crafted from either Diamond, Emerald or Redstone and Diamond. Its color will change accordingly. +booklet.actuallyadditions.chapter.drill.text.3=The Drill can also be dyed in Minecraft's 16 colors. It's only cosmetic and won't have any effect other than it looking different, however. booklet.actuallyadditions.chapter.staff.name=Staff booklet.actuallyadditions.chapter.staff.text.1=The Teleport Staff, when charged in an Energizer, can be right-clicked to teleport you to where you're looking. When you are looking at a block, it will teleport you there, however, when you aren't looking at a block, you can only be looking upwards up to 5 degrees, otherwise the teleport will fail.