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 852e908b8..8f51a654b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -150,7 +150,7 @@ public final class InitBooklet{ new BookletChapter("itemFilter", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitItems.itemFilter), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFilter).setNoText()).setImportant(); //RF Using Items - new BookletChapter("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeDrill).setNoText(), new PageCrafting(4, ItemCrafting.RECIPES_DRILL_COLORING), 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("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeDrill).setNoText(), 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", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemTeleStaff), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant(); new BookletChapter("magnetRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemMagnetRing), new PageCrafting(1, ItemCrafting.recipeMagnetRing)); new BookletChapter("growthRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemGrowthRing), new PageCrafting(1, ItemCrafting.recipeGrowthRing)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java index 557820a78..4af7432bb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java @@ -11,11 +11,15 @@ package de.ellpeck.actuallyadditions.mod.crafting; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import de.ellpeck.actuallyadditions.mod.util.RecipeUtil; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.registry.GameRegistry; +import net.minecraftforge.oredict.RecipeSorter; public final class InitCrafting{ @@ -30,6 +34,9 @@ public final class InitCrafting{ ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(InitItems.itemMisc, 10, TheMiscItems.MASHED_FOOD.ordinal()), Blocks.LEAVES, new ItemStack(InitItems.itemFertilizer, 10), Blocks.DIRT); ActuallyAdditionsAPI.addCompostRecipe(new ItemStack(InitItems.itemCanolaSeed, 20), Blocks.DIRT, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BIOMASS.ordinal()), Blocks.SOUL_SAND); + + RecipeSorter.register(ModUtil.MOD_ID+":drillColoring", RecipeDrillColor.class, RecipeSorter.Category.SHAPELESS, ""); + GameRegistry.addRecipe(new RecipeDrillColor()); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java index 2ad63e56a..0a5ece827 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java @@ -37,7 +37,6 @@ import java.util.ArrayList; public final class ItemCrafting{ public static final ArrayList RECIPES_MASHED_FOOD = new ArrayList(); - public static final ArrayList RECIPES_DRILL_COLORING = new ArrayList(); public static final ArrayList RECIPES_POTION_RINGS = new ArrayList(); public static IRecipe recipePhantomConnector; public static IRecipe recipeCoil; @@ -181,21 +180,13 @@ public final class ItemCrafting{ //Drill if(ConfigCrafting.DRILL.isEnabled()){ - ItemStack lightBlueDrill = new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()); - GameRegistry.addRecipe(new ShapedOreRecipe(lightBlueDrill.copy(), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), "DDD", "CRC", "III", 'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DRILL_CORE.ordinal()), 'I', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()))); recipeDrill = RecipeUtil.lastIRecipe(); - - for(int i = 0; i < 16; i++){ - if(i != TheColoredLampColors.LIGHT_BLUE.ordinal()){ - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemDrill, 1, i), lightBlueDrill.copy(), "dye"+TheColoredLampColors.values()[i].name)); - RECIPES_DRILL_COLORING.add(RecipeUtil.lastIRecipe()); - } - } } //Drill Core diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeDrillColor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeDrillColor.java new file mode 100644 index 000000000..94595068a --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeDrillColor.java @@ -0,0 +1,121 @@ +/* + * This file ("RecipeDrillColor.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.crafting; + +import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; +import de.ellpeck.actuallyadditions.mod.items.ItemDrill; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.oredict.OreDictionary; + +import javax.annotation.Nullable; + +public class RecipeDrillColor implements IRecipe{ + + @Override + public boolean matches(InventoryCrafting inv, World worldIn){ + boolean hasDrill = false; + boolean hasColor = false; + + for(int i = 0; i < inv.getSizeInventory(); i++){ + ItemStack stack = inv.getStackInSlot(i); + if(stack != null && stack.getItem() != null){ + if(stack.getItem() instanceof ItemDrill){ + if(!hasDrill){ + hasDrill = true; + } + else{ + return false; + } + } + else{ + int[] ids = OreDictionary.getOreIDs(stack); + if(ids != null){ + for(int id : ids){ + String name = OreDictionary.getOreName(id); + if(name != null){ + TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name); + if(color != null){ + if(!hasColor){ + hasColor = true; + } + else{ + return false; + } + } + } + } + } + } + } + } + + return hasDrill && hasColor; + } + + @Nullable + @Override + public ItemStack getCraftingResult(InventoryCrafting inv){ + ItemStack drillStack = null; + ItemStack colorStack = null; + + for(int i = 0; i < inv.getSizeInventory(); i++){ + ItemStack stack = inv.getStackInSlot(i); + if(stack != null && stack.getItem() != null){ + if(stack.getItem() instanceof ItemDrill){ + drillStack = stack.copy(); + } + else{ + colorStack = stack.copy(); + } + } + } + + if(drillStack != null && colorStack != null){ + int[] ids = OreDictionary.getOreIDs(colorStack); + if(ids != null){ + for(int id : ids){ + String name = OreDictionary.getOreName(id); + if(name != null){ + TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name); + if(color != null){ + if(color.ordinal() != drillStack.getItemDamage()){ + drillStack.setItemDamage(color.ordinal()); + return drillStack; + } + } + } + } + } + } + + return null; + } + + @Override + public int getRecipeSize(){ + return 2; + } + + @Nullable + @Override + public ItemStack getRecipeOutput(){ + return null; + } + + @Override + public ItemStack[] getRemainingItems(InventoryCrafting inv){ + return ForgeHooks.defaultRecipeGetRemainingItems(inv); + } +} diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 19eabdd86..f26aaf7dc 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -812,8 +812,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=It should be noted that, in fact, the Speed, Mining and Fortune Upgrades need their previous tiers to be installed for them to work. This means that, if you want Speed III in the Drill, it needs Speed II and Speed I inside it as well. -booklet.actuallyadditions.chapter.drill.text.4=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.drill.text.2=It should be noted that, in fact, the Speed, Mining and Fortune Upgrades need their previous tiers to be installed for them to work. This means that, if you want Speed III in the Drill, it needs Speed II and Speed I inside it as well. Additionally, the Drill can also be dyed in Minecraft's 16 colors by crafting it together with one. 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.