Misc Crusher Recipes

This commit is contained in:
Ellpeck 2015-11-10 21:26:28 +01:00
parent fb73b2b568
commit 1209aa7d29
6 changed files with 107 additions and 18 deletions

View file

@ -0,0 +1,39 @@
/*
* This file ("BookletChapterCrusher.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.booklet;
import ellpeck.actuallyadditions.booklet.page.BookletPage;
import ellpeck.actuallyadditions.booklet.page.PageCrusherRecipe;
import ellpeck.actuallyadditions.crafting.CrusherCrafting;
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
public class BookletChapterCrusher extends BookletChapter{
public BookletChapterCrusher(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){
super(unlocalizedName, entry, displayStack, getPages(pages));
}
@SuppressWarnings("unchecked")
private static BookletPage[] getPages(BookletPage... pages){
ArrayList<BookletPage> allPages = new ArrayList<BookletPage>();
allPages.addAll(Arrays.asList(pages));
for(CrusherRecipeRegistry.CrusherRecipe recipe : CrusherCrafting.miscRecipes){
allPages.add(new PageCrusherRecipe(allPages.size()+1, recipe).setNoText());
}
return allPages.toArray(new BookletPage[allPages.size()]);
}
}

View file

@ -78,7 +78,7 @@ public class InitBooklet{
//RF Using Blocks
new BookletChapter("laserRelays", entryFunctionalRF, new ItemStack(InitBlocks.blockLaserRelay), new PageTextOnly(1).addTextReplacement("<range>", ConfigIntValues.LASER_RELAY_MAX_DISTANCE.getValue()).addTextReplacement("<loss>", ConfigIntValues.LASER_RELAY_LOSS.getValue()), new PagePicture(2, "pageLaserRelay", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLaserRelay).setNoText(), new PageCrafting(4, ItemCrafting.recipeLaserWrench).setNoText()).setImportant();
new BookletChapterCoffee("coffeeMachine", entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("<rf>", ConfigIntValues.COFFEE_MACHINE_ENERGY_USED.getValue()).addTextReplacement("<coffee>", ConfigIntValues.COFFEE_CACHE_USED_PER_ITEM.getValue()).addTextReplacement("<water>", ConfigIntValues.COFFEE_MACHINE_WATER_USED.getValue()), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "pageCoffeeMachine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant();
new BookletChapter("crusher", entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("<rf1>", ConfigIntValues.GRINDER_ENERGY_USED.getValue()).addTextReplacement("<rf2>", ConfigIntValues.GRINDER_DOUBLE_ENERGY_USED.getValue()), new PageCrafting(2, BlockCrafting.recipeCrusher).setNoText(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setNoText(), new PageCrusherRecipe(4, CrusherCrafting.recipeSugar).setNoText(), new PageCrusherRecipe(5, CrusherCrafting.recipeIronHorseArmor).setNoText(), new PageCrusherRecipe(6, CrusherCrafting.recipeGoldHorseArmor).setNoText(), new PageCrusherRecipe(7, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
new BookletChapterCrusher("crusher", entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("<rf1>", ConfigIntValues.GRINDER_ENERGY_USED.getValue()).addTextReplacement("<rf2>", ConfigIntValues.GRINDER_DOUBLE_ENERGY_USED.getValue()), new PageCrafting(2, BlockCrafting.recipeCrusher).setNoText(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setNoText(), new PageCrusherRecipe(4, CrusherCrafting.recipeSugar).setNoText(), new PageCrusherRecipe(5, CrusherCrafting.recipeIronHorseArmor).setNoText(), new PageCrusherRecipe(6, CrusherCrafting.recipeGoldHorseArmor).setNoText(), new PageCrusherRecipe(7, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
new BookletChapter("furnaceDouble", entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).addTextReplacement("<rf>", ConfigIntValues.FURNACE_ENERGY_USED.getValue()));
new BookletChapter("lavaFactory", entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LAVA_FACTORY_ENERGY_USED.getValue()), new PagePicture(2, "pageLavaFactory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText());
new BookletChapter("energizer", entryFunctionalRF, new ItemStack(InitBlocks.blockEnergizer), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator));

View file

@ -26,9 +26,7 @@ public class PageCrusherRecipe extends BookletPage{
public CrusherRecipeRegistry.CrusherRecipe recipe;
private int inputPos;
private int outOnePos;
private int outTwoPos;
private int recipePos;
public PageCrusherRecipe(int id, CrusherRecipeRegistry.CrusherRecipe recipe){
super(id);
@ -71,14 +69,14 @@ public class PageCrusherRecipe extends BookletPage{
ItemStack stack;
switch(j){
case 0:
stack = this.recipe.getRecipeInputs().get(this.inputPos);
stack = this.recipe.getRecipeInputs().get(Math.min(this.recipe.getRecipeInputs().size()-1, this.recipePos));
break;
case 1:
stack = this.recipe.getRecipeOutputOnes().get(this.outOnePos);
stack = this.recipe.getRecipeOutputOnes().get(Math.min(this.recipe.getRecipeOutputOnes().size()-1, this.recipePos));
break;
default:
ArrayList<ItemStack> outputTwos = this.recipe.getRecipeOutputTwos();
stack = outputTwos == null ? null : outputTwos.get(this.outTwoPos);
stack = outputTwos == null ? null : outputTwos.get(Math.min(outputTwos.size()-1, this.recipePos));
break;
}
@ -109,19 +107,12 @@ public class PageCrusherRecipe extends BookletPage{
@Override
public void updateScreen(int ticksElapsed){
if(ticksElapsed%10 == 0){
if(this.inputPos+1 < this.recipe.getRecipeInputs().size()){
this.inputPos++;
}
else if(this.outOnePos+1 < this.recipe.getRecipeOutputOnes().size()){
this.outOnePos++;
}
else if(this.recipe.getRecipeOutputTwos() != null && this.outTwoPos+1 < this.recipe.getRecipeOutputTwos().size()){
this.outTwoPos++;
ArrayList<ItemStack> outputTwos = this.recipe.getRecipeOutputTwos();
if(this.recipePos+1 >= Math.max(this.recipe.getRecipeInputs().size(), Math.max(this.recipe.getRecipeOutputOnes().size(), outputTwos == null ? 0 : outputTwos.size()))){
this.recipePos = 0;
}
else{
this.inputPos = 0;
this.outOnePos = 0;
this.outTwoPos = 0;
this.recipePos++;
}
}
}

View file

@ -144,6 +144,7 @@ public enum ConfigCrafting{
NICKEL("Nickel Ore -> Nickel Dust + Platinum Dust", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
IRON("Iron Ore -> Iron Dust + Gold Dust", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
HORSE_ARMORS("Horse Armor -> Raw Materials", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
CRUSHER_MISC("Misc. Crusher Recipes like Bone Meal & Dyes", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
TELE_STAFF("Tele Staff", ConfigCategories.ITEMS_CRAFTING),
CASING("Casing", ConfigCategories.BLOCKS_CRAFTING),

View file

@ -15,16 +15,55 @@ import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import java.util.ArrayList;
public class CrusherCrafting{
public static CrusherRecipeRegistry.CrusherRecipe recipeSugar;
public static CrusherRecipeRegistry.CrusherRecipe recipeIronHorseArmor;
public static CrusherRecipeRegistry.CrusherRecipe recipeGoldHorseArmor;
public static CrusherRecipeRegistry.CrusherRecipe recipeDiamondHorseArmor;
public static ArrayList<CrusherRecipeRegistry.CrusherRecipe> miscRecipes = new ArrayList<CrusherRecipeRegistry.CrusherRecipe>();
public static void init(){
ModUtil.LOGGER.info("Initializing Crusher Recipes...");
if(ConfigCrafting.CRUSHER_MISC.isEnabled()){
CrusherRecipeRegistry.addRecipe("itemBone", "boneMeal", 6);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("sugarCane", "sugar", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerDandelion", "dyeYellow", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerPoppy", "dyeRed", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerOrchid", "dyeLightBlue", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerAllium", "dyeMagenta", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerBluet", "dyeLightGray", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerRedTulip", "dyeRed", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerOrangeTulip", "dyeOrange", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerWhiteTulip", "dyeLightGray", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerPinkTulip", "dyePink", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerDaisy", "dyeLightGray", 3);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerSunflower", "dyeYellow", 4);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerLilac", "dyeMagenta", 4);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerRoseBush", "dyeRed", 4);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe("flowerPeony", "dyePink", 4);
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
}
if(ConfigCrafting.REDSTONE.isEnabled()){
CrusherRecipeRegistry.addRecipe("oreRedstone", "dustRedstone", 10);
}

View file

@ -39,6 +39,25 @@ public class InitOreDict{
addOre(Items.diamond_horse_armor, "armorHorseDiamond");
addOre(Items.golden_horse_armor, "armorHorseGold");
addOre(Items.iron_horse_armor, "armorHorseIron");
addOre(Items.bone, "itemBone");
addOre(Items.dye, 15, "boneMeal");
addOre(Items.sugar, "sugar");
addOre(Items.reeds, "sugarCane");
addOre(Blocks.yellow_flower, "flowerDandelion");
addOre(Blocks.red_flower, "flowerPoppy");
addOre(Blocks.red_flower, 1, "flowerOrchid");
addOre(Blocks.red_flower, 2, "flowerAllium");
addOre(Blocks.red_flower, 3, "flowerBluet");
addOre(Blocks.red_flower, 4, "flowerRedTulip");
addOre(Blocks.red_flower, 5, "flowerOrangeTulip");
addOre(Blocks.red_flower, 6, "flowerWhiteTulip");
addOre(Blocks.red_flower, 7, "flowerPinkTulip");
addOre(Blocks.red_flower, 8, "flowerDaisy");
addOre(Blocks.double_plant, 0, "flowerSunflower");
addOre(Blocks.double_plant, 1, "flowerLilac");
addOre(Blocks.double_plant, 4, "flowerRoseBush");
addOre(Blocks.double_plant, 5, "flowerPeony");
//My Ores
addOre(InitItems.itemDust, TheDusts.IRON.ordinal(), "dustIron");