use of mekanism.api.chemical.merged.BoxedChemicalStack in project Mekanism by mekanism.
the class BoxedChemicalInputHandler method use.
/**
* Adds {@code operations} operations worth of {@code recipeInput} from the input.
*
* @param recipeInput Recipe input result.
* @param operations Operations to perform.
*/
public void use(BoxedChemicalStack recipeInput, long operations) {
if (operations == 0 || recipeInput.isEmpty()) {
// or if something went wrong, this if should never really be true if we got to finishProcessing
return;
}
BoxedChemicalStack inputGas = getInput();
if (!inputGas.isEmpty()) {
long amount = recipeInput.getChemicalStack().getAmount() * operations;
logMismatchedStackSize(chemicalTank.getTankForType(inputGas.getChemicalType()).shrinkStack(amount, Action.EXECUTE), amount);
}
}
use of mekanism.api.chemical.merged.BoxedChemicalStack in project Mekanism by mekanism.
the class ChemicalDissolutionRecipeCategory method setIngredients.
@Override
public void setIngredients(ChemicalDissolutionRecipe recipe, IIngredients ingredients) {
ingredients.setInputLists(VanillaTypes.ITEM, Collections.singletonList(recipe.getItemInput().getRepresentations()));
List<@NonNull GasStack> gasInputs = recipe.getGasInput().getRepresentations();
List<GasStack> scaledGases = gasInputs.stream().map(gas -> new GasStack(gas, gas.getAmount() * TileEntityChemicalDissolutionChamber.BASE_TICKS_REQUIRED)).collect(Collectors.toList());
ingredients.setInputLists(MekanismJEI.TYPE_GAS, Collections.singletonList(scaledGases));
BoxedChemicalStack outputDefinition = recipe.getOutputDefinition();
ChemicalType chemicalType = outputDefinition.getChemicalType();
if (chemicalType == ChemicalType.GAS) {
ingredients.setOutput(MekanismJEI.TYPE_GAS, (GasStack) outputDefinition.getChemicalStack());
} else if (chemicalType == ChemicalType.INFUSION) {
ingredients.setOutput(MekanismJEI.TYPE_INFUSION, (InfusionStack) outputDefinition.getChemicalStack());
} else if (chemicalType == ChemicalType.PIGMENT) {
ingredients.setOutput(MekanismJEI.TYPE_PIGMENT, (PigmentStack) outputDefinition.getChemicalStack());
} else if (chemicalType == ChemicalType.SLURRY) {
ingredients.setOutput(MekanismJEI.TYPE_SLURRY, (SlurryStack) outputDefinition.getChemicalStack());
} else {
throw new IllegalStateException("Unknown chemical type");
}
}
use of mekanism.api.chemical.merged.BoxedChemicalStack in project Mekanism by mekanism.
the class ChemicalDissolutionRecipeCategory method setRecipe.
@Override
public void setRecipe(IRecipeLayout recipeLayout, ChemicalDissolutionRecipe recipe, IIngredients ingredients) {
initItem(recipeLayout.getItemStacks(), 0, true, inputSlot, recipe.getItemInput().getRepresentations());
List<@NonNull GasStack> gasInputs = recipe.getGasInput().getRepresentations();
List<GasStack> scaledGases = gasInputs.stream().map(gas -> new GasStack(gas, gas.getAmount() * TileEntityChemicalDissolutionChamber.BASE_TICKS_REQUIRED)).collect(Collectors.toList());
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initChemical(gasStacks, 0, true, inputGauge, scaledGases);
BoxedChemicalStack outputDefinition = recipe.getOutputDefinition();
ChemicalType chemicalType = outputDefinition.getChemicalType();
if (chemicalType == ChemicalType.GAS) {
initChemicalOutput(recipeLayout, MekanismJEI.TYPE_GAS, (GasStack) outputDefinition.getChemicalStack());
} else if (chemicalType == ChemicalType.INFUSION) {
initChemicalOutput(recipeLayout, MekanismJEI.TYPE_INFUSION, (InfusionStack) outputDefinition.getChemicalStack());
} else if (chemicalType == ChemicalType.PIGMENT) {
initChemicalOutput(recipeLayout, MekanismJEI.TYPE_PIGMENT, (PigmentStack) outputDefinition.getChemicalStack());
} else if (chemicalType == ChemicalType.SLURRY) {
initChemicalOutput(recipeLayout, MekanismJEI.TYPE_SLURRY, (SlurryStack) outputDefinition.getChemicalStack());
} else {
throw new IllegalStateException("Unknown chemical type");
}
}
use of mekanism.api.chemical.merged.BoxedChemicalStack in project Mekanism by mekanism.
the class GuiChemicalCrystallizer method getScreenRenderStrings.
public static List<ITextComponent> getScreenRenderStrings(IOreInfo oreInfo) {
BoxedChemicalStack boxedChemical = oreInfo.getInputChemical();
if (!boxedChemical.isEmpty()) {
List<ITextComponent> ret = new ArrayList<>();
ret.add(boxedChemical.getTextComponent());
if (boxedChemical.getChemicalType() == ChemicalType.SLURRY && !oreInfo.getRenderStack().isEmpty()) {
ret.add(MekanismLang.GENERIC_PARENTHESIS.translate(oreInfo.getRenderStack()));
} else {
ChemicalCrystallizerRecipe recipe = oreInfo.getRecipe();
if (recipe == null) {
ret.add(MekanismLang.NO_RECIPE.translate());
} else {
ret.add(MekanismLang.GENERIC_PARENTHESIS.translate(recipe.getOutput(boxedChemical)));
}
}
return ret;
}
return Collections.emptyList();
}
Aggregations