Added configuration for Coffee Maker

This commit is contained in:
OneEyeMaker 2017-10-04 08:17:30 +03:00
parent c84d6574f6
commit 2e9c79b832
4 changed files with 25 additions and 17 deletions

View file

@ -224,7 +224,7 @@ public final class InitBooklet{
new BookletChapter("batteryBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockBatteryBox), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBatteryBox).setNoText()).setSpecial();
new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFarmer), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemsToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemsToPage(new ItemStack(InitItems.itemCanolaSeed)), new PagePicture(3, "page_farmer_cactus", 105).addItemsToPage(new ItemStack(Blocks.CACTUS)), new PagePicture(4, "page_farmer_wart", 95).addItemsToPage(new ItemStack(Items.NETHER_WART)), new PagePicture(5, "page_farmer_reeds", 105).addItemsToPage(new ItemStack(Items.REEDS)), new PagePicture(6, "page_farmer_melons", 105).addItemsToPage(new ItemStack(Items.MELON), new ItemStack(Blocks.PUMPKIN), new ItemStack(Blocks.MELON_BLOCK)), new PagePicture(7, "page_farmer_enderlilly", 105), new PagePicture(8, "page_farmer_redorchid", 105), new PageCrafting(4, BlockCrafting.recipeFarmer).setWildcard().setNoText()).setImportant();
new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockMiner), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.VERTICAL_DIGGER_ENERGY_USE_PER_BLOCK.getValue()).addTextReplacement("<range>", ConfigIntValues.VERTICAL_DIGGER_WORK_RANGE.getValue()), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial();
new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("<rf>", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("<coffee>", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("<water>", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemsToPage(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant();
new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).addItemsToPage(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("<rf>", ConfigIntValues.COFFEE_MAKER_ENERGY_USE.getValue()).addTextReplacement("<coffee>", ConfigIntValues.COFFEE_MAKER_COFFEE_USE.getValue()).addTextReplacement("<water>", ConfigIntValues.COFFEE_MAKER_WATER_USE.getValue()), new PageTextOnly(2).addItemsToPage(new ItemStack(InitItems.itemCoffee)), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant();
new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntListValues.CRUSHER_ENERGY_USE.getValue()[0]), new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText(), new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText(), new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText(), new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("<rf>", ConfigIntValues.POWERED_FURNACE_ENERGY_USE.getValue()));
new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LAVA_FACTORY_ENERGY_USE.getValue()), new PagePicture(2, "page_lava_factory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText());

View file

@ -69,6 +69,13 @@ public enum ConfigIntValues{
COAL_GENERATOR_ENERGY_CAPACITY("Coal Generator: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 60000, 1000, 1000000000, "Amount of energy Coal Generator can store."),
COAL_GENERATOR_ENERGY_SEND("Coal Generator: Energy Send Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 80, 1, 1000000000, "Amount of energy Coal Generator can send per tick."),
COAL_GENERATOR_ENERGY_PRODUCTION("Coal Generator: Energy Production", ConfigCategories.MACHINE_ENERGY_VALUES, 30, 1, 1000000000, "Amount of energy Coal Generator can produces per tick."),
COFFEE_MAKER_ENERGY_CAPACITY("Coffee Maker: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 300000, 1000, 1000000000, "Amount of energy Coffee Maker can store."),
COFFEE_MAKER_ENERGY_RECEIVE("Coffee Maker: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 250, 1, 1000000000, "Amount of energy Coffee Maker can receive per tick."),
COFFEE_MAKER_ENERGY_USE("Coffee Maker: Energy Use", ConfigCategories.MACHINE_ENERGY_VALUES, 150, 1, 1000000000, "Amount of energy Coffee Maker uses per tick."),
COFFEE_MAKER_COFFEE_STORAGE("Coffee Maker: Coffee Storage", ConfigCategories.MACHINE_VALUES, 300, 1, 10000, "Amount of coffee Coffee Maker can store."),
COFFEE_MAKER_COFFEE_USE("Coffee Maker: Coffee Use", ConfigCategories.MACHINE_RECIPE_COSTS, 35, 1, 10000, "Amount of coffee Coffee Maker uses per cup."),
COFFEE_MAKER_WATER_USE("Coffee Maker: Water Use", ConfigCategories.MACHINE_RECIPE_COSTS, 500, 1, 4000, "Amount of water Coffee Maker uses per cup."),
COFFEE_MAKER_PROCESSING_DURATION("Coffee Maker: Processing Duration", ConfigCategories.MACHINE_RECIPE_COSTS, 50, 1, 72000, "Time in ticks required by Coffee Maker to make cup of coffee."),
CRUSHER_ENERGY_CAPACITY("Crusher: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 60000, 1000, 1000000000, "Amount of energy Crusher and Double Crusher can store."),
CRUSHER_ENERGY_RECEIVE("Crusher: Energy Receive Rate", ConfigCategories.MACHINE_ENERGY_VALUES, 100, 1, 1000000000, "Amount of energy Crusher and Double Crusher can receive per tick."),
DISPLAY_STAND_ENERGY_CAPACITY("Display Stand: Energy Capacity", ConfigCategories.MACHINE_ENERGY_VALUES, 80000, 1000, 1000000000, "Amount of energy Display Stand can store."),

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
@ -57,7 +58,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text2 = this.machine.coffeeCacheAmount+"/"+TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT+" "+StringUtil.localize("info."+ModUtil.MOD_ID+".gui.coffee");
String text2 = this.machine.coffeeCacheAmount+"/"+ ConfigIntValues.COFFEE_MAKER_COFFEE_STORAGE.getValue()+" "+StringUtil.localize("info."+ModUtil.MOD_ID+".gui.coffee");
if(x >= this.guiLeft+40 && y >= this.guiTop+25 && x <= this.guiLeft+49 && y <= this.guiTop+56){
this.drawHoveringText(Collections.singletonList(text2), x, y);
}

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
@ -35,12 +36,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
public static final int SLOT_COFFEE_BEANS = 0;
public static final int SLOT_INPUT = 1;
public static final int SLOT_OUTPUT = 2;
public static final int CACHE_USE = 35;
public static final int ENERGY_USED = 150;
public static final int WATER_USE = 500;
public static final int COFFEE_CACHE_MAX_AMOUNT = 300;
private static final int TIME_USED = 500;
public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 250, 0);
public final CustomEnergyStorage storage = new CustomEnergyStorage(ConfigIntValues.COFFEE_MAKER_ENERGY_CAPACITY.getValue(), ConfigIntValues.COFFEE_MAKER_ENERGY_RECEIVE.getValue(), 0);
public final FluidTank tank = new FluidTank(4*Util.BUCKET){
@Override
public boolean canDrain(){
@ -65,7 +61,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
@SideOnly(Side.CLIENT)
public int getCoffeeScaled(int i){
return this.coffeeCacheAmount*i/COFFEE_CACHE_MAX_AMOUNT;
return this.coffeeCacheAmount*i/ConfigIntValues.COFFEE_MAKER_COFFEE_STORAGE.getValue();
}
@SideOnly(Side.CLIENT)
@ -80,7 +76,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
@SideOnly(Side.CLIENT)
public int getBrewScaled(int i){
return this.brewTime*i/TIME_USED;
return this.brewTime*i/ConfigIntValues.COFFEE_MAKER_PROCESSING_DURATION.getValue();
}
@Override
@ -132,7 +128,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
public void storeCoffee(){
if(StackUtil.isValid(this.slots.getStackInSlot(SLOT_COFFEE_BEANS)) && this.slots.getStackInSlot(SLOT_COFFEE_BEANS).getItem() == InitItems.itemCoffeeBean){
int toAdd = 2;
if(toAdd <= COFFEE_CACHE_MAX_AMOUNT-this.coffeeCacheAmount){
if(toAdd <= ConfigIntValues.COFFEE_MAKER_COFFEE_STORAGE.getValue()-this.coffeeCacheAmount){
this.slots.setStackInSlot(SLOT_COFFEE_BEANS, StackUtil.addStackSize(this.slots.getStackInSlot(SLOT_COFFEE_BEANS), -1));
this.coffeeCacheAmount += toAdd;
}
@ -141,15 +137,19 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
public void brew(){
if(!this.world.isRemote){
if(StackUtil.isValid(this.slots.getStackInSlot(SLOT_INPUT)) && this.slots.getStackInSlot(SLOT_INPUT).getItem() == InitItems.itemMisc && this.slots.getStackInSlot(SLOT_INPUT).getItemDamage() == TheMiscItems.CUP.ordinal() && !StackUtil.isValid(this.slots.getStackInSlot(SLOT_OUTPUT)) && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid() != null && this.tank.getFluid().getFluid() == FluidRegistry.WATER && this.tank.getFluidAmount() >= WATER_USE){
if(this.storage.getEnergyStored() >= ENERGY_USED){
int energyUse = ConfigIntValues.COFFEE_MAKER_ENERGY_USE.getValue();
int waterUse = ConfigIntValues.COFFEE_MAKER_WATER_USE.getValue();
int coffeeUse = ConfigIntValues.COFFEE_MAKER_COFFEE_USE.getValue();
int processingDuration = ConfigIntValues.COFFEE_MAKER_PROCESSING_DURATION.getValue();
if(StackUtil.isValid(this.slots.getStackInSlot(SLOT_INPUT)) && this.slots.getStackInSlot(SLOT_INPUT).getItem() == InitItems.itemMisc && this.slots.getStackInSlot(SLOT_INPUT).getItemDamage() == TheMiscItems.CUP.ordinal() && !StackUtil.isValid(this.slots.getStackInSlot(SLOT_OUTPUT)) && this.coffeeCacheAmount >= coffeeUse && this.tank.getFluid() != null && this.tank.getFluid().getFluid() == FluidRegistry.WATER && this.tank.getFluidAmount() >= waterUse){
if(this.storage.getEnergyStored() >= energyUse){
if(this.brewTime%30 == 0){
this.world.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.coffeeMachine, SoundCategory.BLOCKS, 0.35F, 1.0F);
}
this.brewTime++;
this.storage.extractEnergyInternal(ENERGY_USED, false);
if(this.brewTime >= TIME_USED){
this.storage.extractEnergyInternal(energyUse, false);
if(this.brewTime >= processingDuration){
this.brewTime = 0;
ItemStack output = new ItemStack(InitItems.itemCoffee);
for(int i = 3; i < this.slots.getSlots(); i++){
@ -164,8 +164,8 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
}
this.slots.setStackInSlot(SLOT_OUTPUT, output.copy());
this.slots.setStackInSlot(SLOT_INPUT, StackUtil.addStackSize(this.slots.getStackInSlot(SLOT_INPUT), -1));
this.coffeeCacheAmount -= CACHE_USE;
this.tank.drainInternal(WATER_USE, true);
this.coffeeCacheAmount -= coffeeUse;
this.tank.drainInternal(waterUse, true);
}
}
}