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 471fc6b5f..c5bf4e390 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -174,7 +174,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().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("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("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/BlockCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java index afd9c3811..1f5045643 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java @@ -715,14 +715,14 @@ public final class BlockCrafting{ 'W', "plankWood")); recipeCrate = RecipeUtil.lastIRecipe(); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGiantChestMedium), + GameRegistry.addRecipe(new RecipeKeepDataShaped(new ItemStack(InitBlocks.blockGiantChestMedium), new ItemStack(InitBlocks.blockGiantChest), "CWC", "WDW", "CWC", 'C', new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()), 'D', new ItemStack(InitBlocks.blockGiantChest), 'W', "plankWood")); recipeCrateMedium = RecipeUtil.lastIRecipe(); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGiantChestLarge), + GameRegistry.addRecipe(new RecipeKeepDataShaped(new ItemStack(InitBlocks.blockGiantChestLarge), new ItemStack(InitBlocks.blockGiantChestMedium), "CWC", "WDW", "CWC", 'C', new ItemStack(InitBlocks.blockCrystalEmpowered, 1, TheCrystals.COAL.ordinal()), 'D', new ItemStack(InitBlocks.blockGiantChestMedium), 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 2f5700e5f..81c53ed26 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/InitCrafting.java @@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.util.ModUtil; 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{ @@ -33,8 +32,8 @@ 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()); + RecipeSorter.register(ModUtil.MOD_ID+":recipeKeepDataShaped", RecipeKeepDataShaped.class, RecipeSorter.Category.SHAPED, "after:minecraft:shaped"); + RecipeSorter.register(ModUtil.MOD_ID+":recipeKeepDataShapeless", RecipeKeepDataShapeless.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); } } 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 fc1233b3a..9ceb44039 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java @@ -39,6 +39,7 @@ public final class ItemCrafting{ public static final ArrayList RECIPES_MASHED_FOOD = new ArrayList(); public static final ArrayList RECIPES_POTION_RINGS = new ArrayList(); + public static final ArrayList RECIPES_DRILL_COLORING = new ArrayList(); public static IRecipe recipePhantomConnector; public static IRecipe recipeCoil; public static IRecipe recipeCoilAdvanced; @@ -236,13 +237,21 @@ public final class ItemCrafting{ //Drill if(ConfigCrafting.DRILL.isEnabled()){ - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), + ItemStack lightBlueDrill = new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()); + GameRegistry.addRecipe(new ShapedOreRecipe(lightBlueDrill.copy(), "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 RecipeKeepDataShapeless(new ItemStack(InitItems.itemDrill, 1, i), new ItemStack(InitItems.itemDrill, 1, Util.WILDCARD), lightBlueDrill.copy(), "dye"+TheColoredLampColors.values()[i].name)); + RECIPES_DRILL_COLORING.add(RecipeUtil.lastIRecipe()); + } + } } //Drill Core @@ -357,7 +366,7 @@ public final class ItemCrafting{ //Double Battery if(ConfigCrafting.DOUBLE_BATTERY.isEnabled()){ - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBatteryDouble), + GameRegistry.addRecipe(new RecipeKeepDataShaped(new ItemStack(InitItems.itemBatteryDouble), new ItemStack(InitItems.itemBattery), " R ", "ICI", "III", 'R', new ItemStack(InitItems.itemBattery), 'I', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), @@ -398,7 +407,7 @@ public final class ItemCrafting{ //Triple Battery if(ConfigCrafting.TRIPLE_BATTERY.isEnabled()){ - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBatteryTriple), + GameRegistry.addRecipe(new RecipeKeepDataShaped(new ItemStack(InitItems.itemBatteryTriple), new ItemStack(InitItems.itemBatteryDouble), " R ", "ICI", "III", 'R', new ItemStack(InitItems.itemBatteryDouble), 'I', new ItemStack(InitItems.itemCrystalEmpowered, 1, TheCrystals.IRON.ordinal()), @@ -408,7 +417,7 @@ public final class ItemCrafting{ //Quadruple Battery if(ConfigCrafting.QUADRUPLE_BATTERY.isEnabled()){ - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBatteryQuadruple), + GameRegistry.addRecipe(new RecipeKeepDataShaped(new ItemStack(InitItems.itemBatteryQuadruple), new ItemStack(InitItems.itemBatteryTriple), " R ", "ICI", "III", 'R', new ItemStack(InitItems.itemBatteryTriple), 'I', new ItemStack(InitItems.itemCrystalEmpowered, 1, TheCrystals.IRON.ordinal()), @@ -418,7 +427,7 @@ public final class ItemCrafting{ //Quintuple Battery if(ConfigCrafting.QUINTUPLE_BATTERY.isEnabled()){ - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBatteryQuintuple), + GameRegistry.addRecipe(new RecipeKeepDataShaped(new ItemStack(InitItems.itemBatteryQuintuple), new ItemStack(InitItems.itemBatteryQuadruple), " R ", "ICI", "III", 'R', new ItemStack(InitItems.itemBatteryQuadruple), 'I', new ItemStack(InitItems.itemCrystalEmpowered, 1, TheCrystals.DIAMOND.ordinal()), diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeDrillColor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeDrillColor.java deleted file mode 100644 index 94595068a..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeDrillColor.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java new file mode 100644 index 000000000..c6c898ad4 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShaped.java @@ -0,0 +1,42 @@ +/* + * This file ("RecipeKeepNBT.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.util.ItemUtil; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; + +public class RecipeKeepDataShaped extends ShapedOreRecipe{ + + private final ItemStack nbtCopyStack; + + public RecipeKeepDataShaped(ItemStack result, ItemStack nbtCopyStack, Object... recipe){ + super(result, recipe); + this.nbtCopyStack = nbtCopyStack; + } + + @Override + public ItemStack getCraftingResult(InventoryCrafting inventory){ + ItemStack stack = super.getCraftingResult(inventory); + if(stack != null){ + for(int i = 0; i < inventory.getSizeInventory(); i++){ + ItemStack input = inventory.getStackInSlot(i); + if(ItemUtil.areItemsEqual(this.nbtCopyStack, input, true)){ + stack.setTagCompound(input.getTagCompound()); + break; + } + } + } + return stack; + } + +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java new file mode 100644 index 000000000..80f4cc545 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/RecipeKeepDataShapeless.java @@ -0,0 +1,42 @@ +/* + * This file ("RecipeKeepNBTShapeless.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.util.ItemUtil; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapelessOreRecipe; + +public class RecipeKeepDataShapeless extends ShapelessOreRecipe{ + + private final ItemStack nbtCopyStack; + + public RecipeKeepDataShapeless(ItemStack result, ItemStack nbtCopyStack, Object... recipe){ + super(result, recipe); + this.nbtCopyStack = nbtCopyStack; + } + + @Override + public ItemStack getCraftingResult(InventoryCrafting inventory){ + ItemStack stack = super.getCraftingResult(inventory); + if(stack != null){ + for(int i = 0; i < inventory.getSizeInventory(); i++){ + ItemStack input = inventory.getStackInSlot(i); + if(ItemUtil.areItemsEqual(this.nbtCopyStack, input, true)){ + stack.setTagCompound(input.getTagCompound()); + break; + } + } + } + return stack; + } + +} diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 0e7c530a6..657a13752 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -781,7 +781,7 @@ booklet.actuallyadditions.chapter.compost.text.3=Bio-Mash can be crafte booklet.actuallyadditions.chapter.crate.name=Storage Crates booklet.actuallyadditions.chapter.crate.text.1=Storage Crates are big. Really big. They hold tons of items, more than 4 chests worth of them. Not only that, but they can be upgraded in size! View the following pages to get information on that and some other items regarding crates! -booklet.actuallyadditions.chapter.crate.text.4=Placing a Storage Crate Keeper inside the Storage Crate before breaking it will cause it to keep all of its items, however the Keeper will be destroyed in the process. Also note that using a filled crate for crafting will destroy its contents. +booklet.actuallyadditions.chapter.crate.text.4=Placing a Storage Crate Keeper inside the Storage Crate before breaking it will cause it to keep all of its items, however the Keeper will be destroyed in the process. Once upgraded via crafting, they will not lose their contents either. booklet.actuallyadditions.chapter.crate.text.5=The Chest To Storage Crate Upgrade allows you to convert any chest into a Storage Crate, retaining its items! Just shift-right-click onto the chest to apply it. booklet.actuallyadditions.chapter.crate.text.6=Similar to the Chest To Storage Crate Upgrade, the Small To Medium Storage Crate Upgrade will convert any Small Storage Crate into a Medium Storage Crate by simply shift-right-clicking it. It will retain its items. booklet.actuallyadditions.chapter.crate.text.7=Similar to the Chest To Storage Crate Upgrade, the Medium To Large Storage Crate Upgrade will convert any Medium Storage Crate into a Large Storage Crate by simply shift-right-clicking it. It will retain its items. @@ -843,7 +843,8 @@ 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. 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.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.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.