Fixed items getting added to inventories, added horse armor -> raw materials crafting, leaf generator redstone control

This commit is contained in:
Ellpeck 2015-10-05 11:27:53 +02:00
parent 1590026ed3
commit 9dc5085fba
8 changed files with 77 additions and 39 deletions

View file

@ -73,7 +73,7 @@ public class InitBooklet{
//RF Using Blocks //RF Using Blocks
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 PageCrafting(3, BlockCrafting.recipeCoffeeMachine).setNoText(), new PageCrafting(4, ItemCrafting.recipeCup).setNoText()); 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 PageCrafting(3, BlockCrafting.recipeCoffeeMachine).setNoText(), new PageCrafting(4, ItemCrafting.recipeCup).setNoText());
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 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 BookletChapter("furnaceDouble", entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).addTextReplacement("<rf>", ConfigIntValues.FURNACE_ENERGY_USED.getValue())); new BookletChapter("furnaceDouble", entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).addTextReplacement("<rf>", ConfigIntValues.FURNACE_ENERGY_USED.getValue()));
new BookletChapter("miner", entryFunctionalRF, new ItemStack(InitBlocks.blockOreMagnet), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.ORE_MAGNET_ENERGY_USE.getValue()).addTextReplacement("<oil>", ConfigIntValues.ORE_MAGNET_OIL_USE.getValue()).addTextReplacement("<range>", ConfigIntValues.ORE_MAGNET_RANGE.getValue()), new PageCrafting(2, BlockCrafting.recipeMiner).setNoText(), new PageCrafting(3, BlockCrafting.recipeCasing).setNoText()); new BookletChapter("miner", entryFunctionalRF, new ItemStack(InitBlocks.blockOreMagnet), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.ORE_MAGNET_ENERGY_USE.getValue()).addTextReplacement("<oil>", ConfigIntValues.ORE_MAGNET_OIL_USE.getValue()).addTextReplacement("<range>", ConfigIntValues.ORE_MAGNET_RANGE.getValue()), new PageCrafting(2, BlockCrafting.recipeMiner).setNoText(), new PageCrafting(3, BlockCrafting.recipeCasing).setNoText());
new BookletChapter("lavaFactory", entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LAVA_FACTORY_ENERGY_USED.getValue()), new PageCrafting(2, BlockCrafting.recipeLavaFactory).setNoText()); new BookletChapter("lavaFactory", entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LAVA_FACTORY_ENERGY_USED.getValue()), new PageCrafting(2, BlockCrafting.recipeLavaFactory).setNoText());
@ -89,7 +89,7 @@ public class InitBooklet{
//No RF Using Items //No RF Using Items
new BookletChapter("wings", entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()); new BookletChapter("wings", entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())), new PageCrafting(2, ItemCrafting.recipeWings).setNoText());
new BookletChapter("foods", entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipePizza).setNoText(), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrusherRecipe(18, CrusherCrafting.recipeSugar).setNoText()); new BookletChapter("foods", entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipePizza).setNoText(), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal())).setNoText());
new BookletChapter("leafBlower", entryItemsNonRF, new ItemStack(InitItems.itemLeafBlowerAdvanced), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()); new BookletChapter("leafBlower", entryItemsNonRF, new ItemStack(InitItems.itemLeafBlowerAdvanced), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText());
ArrayList<BookletPage> aiotPages = new ArrayList<BookletPage>(); ArrayList<BookletPage> aiotPages = new ArrayList<BookletPage>();
aiotPages.add(new PageTextOnly(aiotPages.size()+1)); aiotPages.add(new PageTextOnly(aiotPages.size()+1));

View file

@ -108,7 +108,7 @@ public class PageCrusherRecipe extends BookletPage{
@Override @Override
public void updateScreen(int ticksElapsed){ public void updateScreen(int ticksElapsed){
if(ticksElapsed%5 == 0){ if(ticksElapsed%10 == 0){
if(this.inputPos+1 < this.recipe.getRecipeInputs().size()){ if(this.inputPos+1 < this.recipe.getRecipeInputs().size()){
this.inputPos++; this.inputPos++;
} }

View file

@ -141,6 +141,7 @@ public enum ConfigCrafting{
RICE_SUGAR("Rice -> Sugar", ConfigCategories.CRUSHER_RECIPES, "Crusher"), RICE_SUGAR("Rice -> Sugar", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
NICKEL("Nickel Ore -> Nickel Dust + Platinum Dust", ConfigCategories.CRUSHER_RECIPES, "Crusher"), NICKEL("Nickel Ore -> Nickel Dust + Platinum Dust", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
IRON("Iron Ore -> Iron Dust + Gold 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"),
TELE_STAFF("Tele Staff", ConfigCategories.ITEMS_CRAFTING), TELE_STAFF("Tele Staff", ConfigCategories.ITEMS_CRAFTING),
CASING("Casing", ConfigCategories.BLOCKS_CRAFTING), CASING("Casing", ConfigCategories.BLOCKS_CRAFTING),

View file

@ -18,6 +18,9 @@ import ellpeck.actuallyadditions.util.Util;
public class CrusherCrafting{ public class CrusherCrafting{
public static CrusherRecipeRegistry.CrusherRecipe recipeSugar; public static CrusherRecipeRegistry.CrusherRecipe recipeSugar;
public static CrusherRecipeRegistry.CrusherRecipe recipeIronHorseArmor;
public static CrusherRecipeRegistry.CrusherRecipe recipeGoldHorseArmor;
public static CrusherRecipeRegistry.CrusherRecipe recipeDiamondHorseArmor;
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Initializing Crusher Recipes..."); ModUtil.LOGGER.info("Initializing Crusher Recipes...");
@ -61,6 +64,16 @@ public class CrusherCrafting{
if(ConfigCrafting.IRON.isEnabled()){ if(ConfigCrafting.IRON.isEnabled()){
CrusherRecipeRegistry.addRecipe("oreIron", "dustIron", 2, "dustGold", 1, 20); CrusherRecipeRegistry.addRecipe("oreIron", "dustIron", 2, "dustGold", 1, 20);
} }
if(ConfigCrafting.HORSE_ARMORS.isEnabled()){
CrusherRecipeRegistry.addRecipe("armorHorseIron", "dustIron", 8);
recipeIronHorseArmor = Util.GetRecipes.lastCrusherRecipe();
CrusherRecipeRegistry.addRecipe("armorHorseGold", "dustGold", 8);
recipeGoldHorseArmor = Util.GetRecipes.lastCrusherRecipe();
CrusherRecipeRegistry.addRecipe("armorHorseDiamond", "dustDiamond", 8);
recipeDiamondHorseArmor = Util.GetRecipes.lastCrusherRecipe();
}
CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("oreNether", 6)); CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("oreNether", 6));
CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("orePoor", 4, "nugget")); CrusherRecipeRegistry.searchCases.add(new CrusherRecipeRegistry.SearchCase("orePoor", 4, "nugget"));

View file

@ -32,10 +32,13 @@ public class InitOreDict{
//Vanilla Ores //Vanilla Ores
addOre(Blocks.obsidian, "obsidian"); addOre(Blocks.obsidian, "obsidian");
addOre(new ItemStack(Items.coal), "coal"); addOre(Items.coal, "coal");
addOre(Items.flint, "flint"); addOre(Items.flint, "flint");
addOre(Blocks.gravel, "gravel"); addOre(Blocks.gravel, "gravel");
addOre(Items.sugar, "sugar"); addOre(Items.sugar, "sugar");
addOre(Items.diamond_horse_armor, "armorHorseDiamond");
addOre(Items.golden_horse_armor, "armorHorseGold");
addOre(Items.iron_horse_armor, "armorHorseIron");
//My Ores //My Ores
addOre(InitItems.itemDust, TheDusts.IRON.ordinal(), "dustIron"); addOre(InitItems.itemDust, TheDusts.IRON.ordinal(), "dustIron");

View file

@ -44,42 +44,44 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
if(!worldObj.isRemote){ if(!worldObj.isRemote){
if(!this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)){
if(this.nextUseCounter >= ConfigIntValues.LEAF_GENERATOR_COOLDOWN_TIME.getValue()){ if(this.nextUseCounter >= ConfigIntValues.LEAF_GENERATOR_COOLDOWN_TIME.getValue()){
this.nextUseCounter = 0; this.nextUseCounter = 0;
int energyProducedPerLeaf = ConfigIntValues.LEAF_GENERATOR_ENERGY_PRODUCED.getValue(); int energyProducedPerLeaf = ConfigIntValues.LEAF_GENERATOR_ENERGY_PRODUCED.getValue();
if(energyProducedPerLeaf <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){ if(energyProducedPerLeaf <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){
ArrayList<WorldPos> breakPositions = new ArrayList<WorldPos>(); ArrayList<WorldPos> breakPositions = new ArrayList<WorldPos>();
int range = ConfigIntValues.LEAF_GENERATOR_RANGE.getValue(); int range = ConfigIntValues.LEAF_GENERATOR_RANGE.getValue();
for(int reachX = -range; reachX < range+1; reachX++){ for(int reachX = -range; reachX < range+1; reachX++){
for(int reachZ = -range; reachZ < range+1; reachZ++){ for(int reachZ = -range; reachZ < range+1; reachZ++){
for(int reachY = -range; reachY < range+1; reachY++){ for(int reachY = -range; reachY < range+1; reachY++){
Block block = this.worldObj.getBlock(this.xCoord+reachX, this.yCoord+reachY, this.zCoord+reachZ); Block block = this.worldObj.getBlock(this.xCoord+reachX, this.yCoord+reachY, this.zCoord+reachZ);
if(block != null && block.isLeaves(this.worldObj, this.xCoord+reachX, this.yCoord+reachY, this.zCoord+reachZ)){ if(block != null && block.isLeaves(this.worldObj, this.xCoord+reachX, this.yCoord+reachY, this.zCoord+reachZ)){
breakPositions.add(new WorldPos(this.worldObj, this.xCoord+reachX, this.yCoord+reachY, this.zCoord+reachZ)); breakPositions.add(new WorldPos(this.worldObj, this.xCoord+reachX, this.yCoord+reachY, this.zCoord+reachZ));
}
} }
} }
} }
}
if(!breakPositions.isEmpty()){ if(!breakPositions.isEmpty()){
Collections.shuffle(breakPositions); Collections.shuffle(breakPositions);
WorldPos theCoord = breakPositions.get(0); WorldPos theCoord = breakPositions.get(0);
Block theBlock = this.worldObj.getBlock(theCoord.getX(), theCoord.getY(), theCoord.getZ()); Block theBlock = this.worldObj.getBlock(theCoord.getX(), theCoord.getY(), theCoord.getZ());
int meta = this.worldObj.getBlockMetadata(theCoord.getX(), theCoord.getY(), theCoord.getZ()); int meta = this.worldObj.getBlockMetadata(theCoord.getX(), theCoord.getY(), theCoord.getZ());
this.worldObj.playAuxSFX(2001, theCoord.getX(), theCoord.getY(), theCoord.getZ(), Block.getIdFromBlock(theBlock)+(meta << 12)); this.worldObj.playAuxSFX(2001, theCoord.getX(), theCoord.getY(), theCoord.getZ(), Block.getIdFromBlock(theBlock)+(meta << 12));
this.worldObj.setBlockToAir(theCoord.getX(), theCoord.getY(), theCoord.getZ()); this.worldObj.setBlockToAir(theCoord.getX(), theCoord.getY(), theCoord.getZ());
this.storage.receiveEnergy(energyProducedPerLeaf, false); this.storage.receiveEnergy(energyProducedPerLeaf, false);
}
} }
} }
} else{
else{ this.nextUseCounter++;
this.nextUseCounter++; }
} }
if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){ if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){

View file

@ -247,20 +247,39 @@ public class WorldUtil{
return blocks; return blocks;
} }
/**
* Add an ArrayList of ItemStacks to an Array of slots
* @param slots The slots to try to put the items into
* @param stacks The stacks to be put into the slots (Items don't actually get removed from there!)
* @param actuallyDo Do it or just test if it works?
* @return Does it work?
*/
public static boolean addToInventory(ItemStack[] slots, ArrayList<ItemStack> stacks, boolean actuallyDo){ public static boolean addToInventory(ItemStack[] slots, ArrayList<ItemStack> stacks, boolean actuallyDo){
ItemStack[] testSlots = new ItemStack[slots.length];
for(int i = 0; i < testSlots.length; i++){
if(slots[i] != null){
testSlots[i] = slots[i].copy();
}
}
int working = 0; int working = 0;
for(ItemStack stack : stacks){ for(ItemStack stackToPutIn : stacks){
for(int i = 0; i < slots.length; i++){ for(int i = 0; i < testSlots.length; i++){
if(slots[i] == null || (slots[i].isItemEqual(stack) && slots[i].stackSize <= stack.getMaxStackSize()-stack.stackSize)){ if(stackToPutIn != null && (testSlots[i] == null || (testSlots[i].isItemEqual(stackToPutIn) && testSlots[i].getMaxStackSize() >= testSlots[i].stackSize+stackToPutIn.stackSize))){
working++; if(testSlots[i] == null){
if(actuallyDo){ if(actuallyDo){
if(slots[i] == null){ slots[i] = stackToPutIn.copy();
slots[i] = stack.copy();
}
else{
slots[i].stackSize += stack.stackSize;
} }
testSlots[i] = stackToPutIn.copy();
} }
else{
if(actuallyDo){
slots[i].stackSize+=stackToPutIn.stackSize;
}
testSlots[i].stackSize+=stackToPutIn.stackSize;
}
working++;
break; break;
} }
} }

View file

@ -475,7 +475,7 @@ booklet.actuallyadditions.chapter.coffeeMachine.text.5=<item>Milk<r> is an impor
booklet.actuallyadditions.chapter.coffeeMachine.text.6=<i>The fact that you're reading this means that you either have <imp>HarvestCraft<r><i> installed, or that you're looking at the lang file. <rs><n>This does the same thing as <item>Milk<r>, but for veggie guys. booklet.actuallyadditions.chapter.coffeeMachine.text.6=<i>The fact that you're reading this means that you either have <imp>HarvestCraft<r><i> installed, or that you're looking at the lang file. <rs><n>This does the same thing as <item>Milk<r>, but for veggie guys.
booklet.actuallyadditions.chapter.crusher.name=Crusher and Double Crusher booklet.actuallyadditions.chapter.crusher.name=Crusher and Double Crusher
booklet.actuallyadditions.chapter.crusher.text.1=The <item>Crusher<r> turns every ore, ingot and gem into its corresponding <imp>dust<r> using <rf1> RF/t. <n>When you put in <imp>Ores<r> however, they will yield <imp>2 pieces of dust<r>. <n>The <item>Double Crusher<r> basically does the same, however it can crush two ores at a time and uses <rf2> RF/t. <n><n><i>He's my crush booklet.actuallyadditions.chapter.crusher.text.1=The <item>Crusher<r> turns every ore, ingot and gem into its corresponding <imp>dust<r> using <rf1> RF/t. <n>When you put in <imp>Ores<r> however, they will yield <imp>2 pieces of dust<r>. <n>The <item>Double Crusher<r> basically does the same, however it can crush two ores at a time and uses <rf2> RF/t. <n>On the following pages, you can see some additional useful recipes for inside the crusher. <n><n><i>He's my crush
booklet.actuallyadditions.chapter.furnaceDouble.name=Double Furnace booklet.actuallyadditions.chapter.furnaceDouble.name=Double Furnace
booklet.actuallyadditions.chapter.furnaceDouble.text.1=The <item>Double Furnace<r> works like a furnace, however, it uses <rf> RF/t and can smelt <imp>two items at a time<r>. booklet.actuallyadditions.chapter.furnaceDouble.text.1=The <item>Double Furnace<r> works like a furnace, however, it uses <rf> RF/t and can smelt <imp>two items at a time<r>.