mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-22 05:02:34 +00:00
Improve Brewery JEI representation
This commit is contained in:
1 parent
d0dffe7edd
commit
159dc804a2
6 files changed
+57
-24
No files matched your search
@@ -19,6 +19,8 @@ import binnie.extratrees.machines.fruitpress.FruitPressRecipes;
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -87,9 +89,9 @@ public class ModuleAlcohol implements IInitializable {
|
||||
}
|
||||
for (final Alcohol alcohol : Alcohol.values()) {
|
||||
for (final String fermentLiquid : alcohol.fermentationLiquid) {
|
||||
final FluidStack fluid = Binnie.Liquid.getFluidStack(fermentLiquid, 5);
|
||||
final FluidStack fluid = Binnie.Liquid.getFluidStack(fermentLiquid, Fluid.BUCKET_VOLUME);
|
||||
if (fluid != null) {
|
||||
BreweryRecipes.addRecipe(fluid, alcohol.get(5));
|
||||
BreweryRecipes.addRecipe(fluid, alcohol.get(Fluid.BUCKET_VOLUME));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BreweryRecipeCategory extends BlankRecipeCategory<BreweryRecipeWrapper> {
|
||||
private final IDrawableAnimated arrowAnimated;
|
||||
@@ -41,29 +45,51 @@ public class BreweryRecipeCategory extends BlankRecipeCategory<BreweryRecipeWrap
|
||||
tank.draw(minecraft, 112, 0);
|
||||
|
||||
IDrawable arrow = ExtraTreesJeiPlugin.drawables.getArrow();
|
||||
arrow.draw(minecraft, 69, 25);
|
||||
arrowAnimated.draw(minecraft, 69, 25);
|
||||
arrow.draw(minecraft, 90, 25);
|
||||
arrowAnimated.draw(minecraft, 90, 25);
|
||||
|
||||
IDrawable slot = ExtraTreesJeiPlugin.guiHelper.getSlotDrawable();
|
||||
|
||||
// ingredients (hops)
|
||||
slot.draw(minecraft, 21, 42);
|
||||
|
||||
// grain
|
||||
slot.draw(minecraft, 42, 0);
|
||||
slot.draw(minecraft, 42, 21);
|
||||
slot.draw(minecraft, 42, 42);
|
||||
|
||||
// yeast
|
||||
slot.draw(minecraft, 63, 42);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, BreweryRecipeWrapper recipeWrapper, IIngredients ingredients) {
|
||||
IDrawable tankOverlay = ExtraTreesJeiPlugin.drawables.getTankOverlay();
|
||||
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
|
||||
fluidStacks.init(BreweryMachine.TANK_INPUT, true, 1, 1, 16, 58, 10, false, tankOverlay);
|
||||
fluidStacks.init(BreweryMachine.TANK_OUTPUT, false, 113, 1, 16, 58, 10, false, tankOverlay);
|
||||
fluidStacks.init(BreweryMachine.TANK_INPUT, true, 1, 1, 16, 58, Fluid.BUCKET_VOLUME, false, tankOverlay);
|
||||
fluidStacks.init(BreweryMachine.TANK_OUTPUT, false, 113, 1, 16, 58, Fluid.BUCKET_VOLUME, false, tankOverlay);
|
||||
fluidStacks.set(ingredients);
|
||||
|
||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
itemStacks.init(0, true, 42, 0);
|
||||
itemStacks.init(1, true, 42, 21);
|
||||
itemStacks.init(2, true, 42, 42);
|
||||
itemStacks.set(ingredients);
|
||||
// ingredients (hops)
|
||||
itemStacks.init(0, true, 21, 42);
|
||||
|
||||
// grain
|
||||
itemStacks.init(1, true, 42, 0);
|
||||
itemStacks.init(2, true, 42, 21);
|
||||
itemStacks.init(3, true, 42, 42);
|
||||
|
||||
// yeast
|
||||
itemStacks.init(4, true, 63, 42);
|
||||
|
||||
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
|
||||
itemStacks.set(0, inputs.get(0));
|
||||
|
||||
itemStacks.set(1, inputs.get(1));
|
||||
itemStacks.set(2, inputs.get(1));
|
||||
itemStacks.set(3, inputs.get(1));
|
||||
|
||||
itemStacks.set(4, inputs.get(2));
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import binnie.core.util.OreDictionaryUtil;
|
||||
import binnie.extratrees.alcohol.Alcohol;
|
||||
import binnie.extratrees.item.ExtraTreeItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -13,7 +14,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BrewedGrainRecipe implements IBreweryRecipe {
|
||||
public static final FluidStack WATER = Binnie.Liquid.getFluidStack("water", 5);
|
||||
public static final FluidStack WATER = Binnie.Liquid.getFluidStack("water", Fluid.BUCKET_VOLUME);
|
||||
|
||||
private final FluidStack output;
|
||||
private final int grainOreId;
|
||||
@@ -30,7 +31,7 @@ public class BrewedGrainRecipe implements IBreweryRecipe {
|
||||
}
|
||||
|
||||
public BrewedGrainRecipe(Alcohol output, int grainOreId, @Nullable Integer ingredientOreId, @Nullable ItemStack specificYeast) {
|
||||
this.output = output.get(5);
|
||||
this.output = output.get(Fluid.BUCKET_VOLUME);
|
||||
this.grainOreId = grainOreId;
|
||||
this.ingredientOreId = ingredientOreId;
|
||||
if (specificYeast != null) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import binnie.core.machines.power.IProcess;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
@@ -50,12 +51,15 @@ public class BreweryLogic extends ComponentProcessSetCost implements IProcess, I
|
||||
if (this.currentCrafting == null) {
|
||||
return new ErrorState("Brewery Empty", "No liquid in Brewery");
|
||||
}
|
||||
if (!this.getUtil().spaceInTank(BreweryMachine.TANK_OUTPUT, 1000)) {
|
||||
if (!this.getUtil().spaceInTank(BreweryMachine.TANK_OUTPUT, Fluid.BUCKET_VOLUME)) {
|
||||
return new ErrorState.TankSpace("No Space for Fermented Liquid", BreweryMachine.TANK_OUTPUT);
|
||||
}
|
||||
FluidStack outputFluid = this.getUtil().getFluid(BreweryMachine.TANK_OUTPUT);
|
||||
if (outputFluid != null && !outputFluid.isFluidEqual(BreweryRecipes.getOutput(this.currentCrafting))) {
|
||||
return new ErrorState.TankSpace("Different fluid in tank", BreweryMachine.TANK_OUTPUT);
|
||||
if (outputFluid != null) {
|
||||
FluidStack craftingOutputFluid = BreweryRecipes.getOutput(this.currentCrafting);
|
||||
if (!outputFluid.isFluidEqual(craftingOutputFluid)) {
|
||||
return new ErrorState.TankSpace("Different fluid in tank", BreweryMachine.TANK_OUTPUT);
|
||||
}
|
||||
}
|
||||
return super.canProgress();
|
||||
}
|
||||
@@ -64,8 +68,6 @@ public class BreweryLogic extends ComponentProcessSetCost implements IProcess, I
|
||||
protected void onFinishTask() {
|
||||
FluidStack output = BreweryRecipes.getOutput(this.currentCrafting);
|
||||
if (output != null) {
|
||||
output = output.copy();
|
||||
output.amount = 1000;
|
||||
this.getUtil().fillTank(BreweryMachine.TANK_OUTPUT, output);
|
||||
this.currentCrafting = null;
|
||||
}
|
||||
@@ -74,8 +76,8 @@ public class BreweryLogic extends ComponentProcessSetCost implements IProcess, I
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if (this.canWork() == null && this.currentCrafting == null && this.getUtil().getTank(BreweryMachine.TANK_INPUT).getFluidAmount() >= 1000) {
|
||||
final FluidStack stack = this.getUtil().drainTank(BreweryMachine.TANK_INPUT, 1000);
|
||||
if (this.canWork() == null && this.currentCrafting == null && this.getUtil().getTank(BreweryMachine.TANK_INPUT).getFluidAmount() >= Fluid.BUCKET_VOLUME) {
|
||||
final FluidStack stack = this.getUtil().drainTank(BreweryMachine.TANK_INPUT, Fluid.BUCKET_VOLUME);
|
||||
this.currentCrafting = this.getInputCrafting();
|
||||
this.currentCrafting.inputFluid = stack;
|
||||
this.getUtil().removeIngredients(new int[]{0, 1, 2, 3, 4}, BreweryMachine.SLOTS_INVENTORY);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class BreweryRecipe implements IBreweryRecipe {
|
||||
return null;
|
||||
}
|
||||
if (this.input.isFluidEqual(crafting.inputFluid)) {
|
||||
return this.output;
|
||||
return this.output.copy();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,9 @@ public class BreweryRecipes {
|
||||
public static FluidStack getOutput(final FluidStack stack) {
|
||||
final BreweryCrafting crafting = new BreweryCrafting(stack, null, null, null);
|
||||
for (final IBreweryRecipe recipe : recipes) {
|
||||
if (recipe.getOutput(crafting) != null) {
|
||||
return recipe.getOutput(crafting);
|
||||
FluidStack output = recipe.getOutput(crafting);
|
||||
if (output != null) {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -52,8 +53,9 @@ public class BreweryRecipes {
|
||||
public static FluidStack getOutput(final BreweryCrafting crafting) {
|
||||
if (crafting.inputFluid != null && crafting.yeast != null) {
|
||||
for (final IBreweryRecipe recipe : recipes) {
|
||||
if (recipe.getOutput(crafting) != null) {
|
||||
return recipe.getOutput(crafting);
|
||||
FluidStack output = recipe.getOutput(crafting);
|
||||
if (output != null) {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user