mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Closes #1194
This commit is contained in:
parent
45cef1b4cf
commit
a866ecac23
6 changed files with 13 additions and 9 deletions
|
@ -387,7 +387,7 @@ public final class BlockCrafting{
|
||||||
RecipeHandler.addOreDictRecipe(new ItemStack(InitBlocks.blockCoffeeMachine),
|
RecipeHandler.addOreDictRecipe(new ItemStack(InitBlocks.blockCoffeeMachine),
|
||||||
" C ", " S ", "AMA",
|
" C ", " S ", "AMA",
|
||||||
'M', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()),
|
'M', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()),
|
||||||
'C', InitItems.itemCoffeeBean,
|
'C', "cropCoffee",
|
||||||
'S', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
|
'S', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()),
|
||||||
'A', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()));
|
'A', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()));
|
||||||
recipeCoffeeMachine = RecipeUtil.lastIRecipe();
|
recipeCoffeeMachine = RecipeUtil.lastIRecipe();
|
||||||
|
|
|
@ -476,7 +476,7 @@ public final class ItemCrafting{
|
||||||
RecipeHandler.addOreDictRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()),
|
RecipeHandler.addOreDictRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()),
|
||||||
"S S", "SCS", "SSS",
|
"S S", "SCS", "SSS",
|
||||||
'S', "stone",
|
'S', "stone",
|
||||||
'C', InitItems.itemCoffeeBean);
|
'C', "cropCoffee");
|
||||||
recipeCup = RecipeUtil.lastIRecipe();
|
recipeCup = RecipeUtil.lastIRecipe();
|
||||||
|
|
||||||
//Resonant Rice
|
//Resonant Rice
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class ContainerCoffeeMachine extends Container{
|
||||||
return StackUtil.getEmpty();
|
return StackUtil.getEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(newStack.getItem() == InitItems.itemCoffeeBean){
|
else if(TileEntityCoffeeMachine.COFFEE.apply(newStack)){
|
||||||
if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS+1, false)){
|
if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS+1, false)){
|
||||||
return StackUtil.getEmpty();
|
return StackUtil.getEmpty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.jei.coffee;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import mezz.jei.api.IGuiHelper;
|
import mezz.jei.api.IGuiHelper;
|
||||||
|
@ -60,7 +61,7 @@ public class CoffeeMachineRecipeCategory implements IRecipeCategory<CoffeeMachin
|
||||||
recipeLayout.getItemStacks().set(1, wrapper.cup);
|
recipeLayout.getItemStacks().set(1, wrapper.cup);
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(2, true, 1, 38);
|
recipeLayout.getItemStacks().init(2, true, 1, 38);
|
||||||
recipeLayout.getItemStacks().set(2, wrapper.coffeeBeans);
|
recipeLayout.getItemStacks().set(2, Arrays.asList(TileEntityCoffeeMachine.COFFEE.getMatchingStacks()));
|
||||||
|
|
||||||
recipeLayout.getItemStacks().init(3, false, 44, 69);
|
recipeLayout.getItemStacks().init(3, false, 44, 69);
|
||||||
recipeLayout.getItemStacks().set(3, wrapper.theOutput);
|
recipeLayout.getItemStacks().set(3, wrapper.theOutput);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.ingredients.VanillaTypes;
|
import mezz.jei.api.ingredients.VanillaTypes;
|
||||||
|
@ -35,7 +36,6 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton {
|
||||||
public final CoffeeIngredient ingredient;
|
public final CoffeeIngredient ingredient;
|
||||||
public final ItemStack theOutput;
|
public final ItemStack theOutput;
|
||||||
public final ItemStack cup = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal());
|
public final ItemStack cup = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal());
|
||||||
public final ItemStack coffeeBeans = new ItemStack(InitItems.itemCoffeeBean);
|
|
||||||
|
|
||||||
public CoffeeMachineRecipeWrapper(CoffeeIngredient ingredient) {
|
public CoffeeMachineRecipeWrapper(CoffeeIngredient ingredient) {
|
||||||
this.ingredient = ingredient;
|
this.ingredient = ingredient;
|
||||||
|
@ -50,7 +50,8 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton {
|
||||||
for (ItemStack s : this.ingredient.getInput().getMatchingStacks())
|
for (ItemStack s : this.ingredient.getInput().getMatchingStacks())
|
||||||
list.add(s);
|
list.add(s);
|
||||||
list.add(this.cup);
|
list.add(this.cup);
|
||||||
list.add(this.coffeeBeans);
|
for(ItemStack s : TileEntityCoffeeMachine.COFFEE.getMatchingStacks())
|
||||||
|
list.add(s);
|
||||||
ingredients.setInputs(VanillaTypes.ITEM, list);
|
ingredients.setInputs(VanillaTypes.ITEM, list);
|
||||||
|
|
||||||
ingredients.setOutput(VanillaTypes.ITEM, this.theOutput);
|
ingredients.setOutput(VanillaTypes.ITEM, this.theOutput);
|
||||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidTank;
|
import net.minecraftforge.fluids.FluidTank;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraftforge.oredict.OreIngredient;
|
||||||
|
|
||||||
public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, ISharingFluidHandler {
|
public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, ISharingFluidHandler {
|
||||||
|
|
||||||
|
@ -41,7 +42,8 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
public static final int ENERGY_USED = 150;
|
public static final int ENERGY_USED = 150;
|
||||||
public static final int WATER_USE = 500;
|
public static final int WATER_USE = 500;
|
||||||
public static final int COFFEE_CACHE_MAX_AMOUNT = 300;
|
public static final int COFFEE_CACHE_MAX_AMOUNT = 300;
|
||||||
private static final int TIME_USED = 500;
|
public static final int TIME_USED = 500;
|
||||||
|
public static final OreIngredient COFFEE = new OreIngredient("cropCoffee");
|
||||||
public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 250, 0);
|
public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 250, 0);
|
||||||
public final FluidTank tank = new FluidTank(4 * Util.BUCKET) {
|
public final FluidTank tank = new FluidTank(4 * Util.BUCKET) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -128,7 +130,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAcceptor getAcceptor() {
|
public IAcceptor getAcceptor() {
|
||||||
return (slot, stack, automation) -> !automation || slot >= 3 && ItemCoffee.getIngredientFromStack(stack) != null || slot == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean || slot == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal();
|
return (slot, stack, automation) -> !automation || slot >= 3 && ItemCoffee.getIngredientFromStack(stack) != null || slot == SLOT_COFFEE_BEANS && COFFEE.apply(stack) || slot == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,7 +139,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void storeCoffee() {
|
public void storeCoffee() {
|
||||||
if (StackUtil.isValid(this.inv.getStackInSlot(SLOT_COFFEE_BEANS)) && this.inv.getStackInSlot(SLOT_COFFEE_BEANS).getItem() == InitItems.itemCoffeeBean) {
|
if (StackUtil.isValid(this.inv.getStackInSlot(SLOT_COFFEE_BEANS)) && COFFEE.apply(this.inv.getStackInSlot(SLOT_COFFEE_BEANS))) {
|
||||||
int toAdd = 2;
|
int toAdd = 2;
|
||||||
if (toAdd <= COFFEE_CACHE_MAX_AMOUNT - this.coffeeCacheAmount) {
|
if (toAdd <= COFFEE_CACHE_MAX_AMOUNT - this.coffeeCacheAmount) {
|
||||||
this.inv.setStackInSlot(SLOT_COFFEE_BEANS, StackUtil.shrink(this.inv.getStackInSlot(SLOT_COFFEE_BEANS), 1));
|
this.inv.setStackInSlot(SLOT_COFFEE_BEANS, StackUtil.shrink(this.inv.getStackInSlot(SLOT_COFFEE_BEANS), 1));
|
||||||
|
|
Loading…
Reference in a new issue