use of mekanism.common.integration.projecte.IngredientHelper in project Mekanism by mekanism.
the class ItemStackGasToItemStackRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof ItemStackGasToItemStackRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
ItemStackGasToItemStackRecipe recipe = (ItemStackGasToItemStackRecipe) iRecipe;
List<@NonNull ItemStack> itemRepresentations = recipe.getItemInput().getRepresentations();
List<@NonNull GasStack> gasRepresentations = recipe.getChemicalInput().getRepresentations();
for (GasStack gasRepresentation : gasRepresentations) {
NSSGas nssGas = NSSGas.createGas(gasRepresentation);
long gasAmount = gasRepresentation.getAmount() * TileEntityAdvancedElectricMachine.BASE_TICKS_REQUIRED;
for (ItemStack itemRepresentation : itemRepresentations) {
ItemStack output = recipe.getOutput(itemRepresentation, gasRepresentation);
if (!output.isEmpty()) {
IngredientHelper ingredientHelper = new IngredientHelper(mapper);
ingredientHelper.put(itemRepresentation);
ingredientHelper.put(nssGas, gasAmount);
if (ingredientHelper.addAsConversion(output)) {
handled = true;
}
}
}
}
return handled;
}
use of mekanism.common.integration.projecte.IngredientHelper in project Mekanism by mekanism.
the class ItemStackToItemStackRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof ItemStackToItemStackRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
ItemStackToItemStackRecipe recipe = (ItemStackToItemStackRecipe) iRecipe;
for (ItemStack representation : recipe.getInput().getRepresentations()) {
ItemStack output = recipe.getOutput(representation);
if (!output.isEmpty()) {
IngredientHelper ingredientHelper = new IngredientHelper(mapper);
ingredientHelper.put(representation);
if (ingredientHelper.addAsConversion(output)) {
handled = true;
}
}
}
return handled;
}
use of mekanism.common.integration.projecte.IngredientHelper in project Mekanism by mekanism.
the class MetallurgicInfuserRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof MetallurgicInfuserRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
MetallurgicInfuserRecipe recipe = (MetallurgicInfuserRecipe) iRecipe;
List<@NonNull InfusionStack> infuseTypeRepresentations = recipe.getChemicalInput().getRepresentations();
List<@NonNull ItemStack> itemRepresentations = recipe.getItemInput().getRepresentations();
for (InfusionStack infuseTypeRepresentation : infuseTypeRepresentations) {
NormalizedSimpleStack nssInfuseType = NSSInfuseType.createInfuseType(infuseTypeRepresentation);
for (ItemStack itemRepresentation : itemRepresentations) {
ItemStack output = recipe.getOutput(itemRepresentation, infuseTypeRepresentation);
if (!output.isEmpty()) {
IngredientHelper ingredientHelper = new IngredientHelper(mapper);
ingredientHelper.put(nssInfuseType, infuseTypeRepresentation.getAmount());
ingredientHelper.put(itemRepresentation);
if (ingredientHelper.addAsConversion(output)) {
handled = true;
}
}
}
}
return handled;
}
use of mekanism.common.integration.projecte.IngredientHelper in project Mekanism by mekanism.
the class PaintingMachineRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof PaintingRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
PaintingRecipe recipe = (PaintingRecipe) iRecipe;
List<@NonNull PigmentStack> pigmentRepresentations = recipe.getChemicalInput().getRepresentations();
List<@NonNull ItemStack> itemRepresentations = recipe.getItemInput().getRepresentations();
for (PigmentStack pigmentRepresentation : pigmentRepresentations) {
NormalizedSimpleStack nssPigment = NSSPigment.createPigment(pigmentRepresentation);
for (ItemStack itemRepresentation : itemRepresentations) {
ItemStack output = recipe.getOutput(itemRepresentation, pigmentRepresentation);
if (!output.isEmpty()) {
IngredientHelper ingredientHelper = new IngredientHelper(mapper);
ingredientHelper.put(nssPigment, pigmentRepresentation.getAmount());
ingredientHelper.put(itemRepresentation);
if (ingredientHelper.addAsConversion(output)) {
handled = true;
}
}
}
}
return handled;
}
use of mekanism.common.integration.projecte.IngredientHelper in project Mekanism by mekanism.
the class PigmentMixerRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof PigmentMixingRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
PigmentMixingRecipe recipe = (PigmentMixingRecipe) iRecipe;
List<@NonNull PigmentStack> leftInputRepresentations = recipe.getLeftInput().getRepresentations();
List<@NonNull PigmentStack> rightInputRepresentations = recipe.getRightInput().getRepresentations();
for (PigmentStack leftRepresentation : leftInputRepresentations) {
NormalizedSimpleStack nssLeft = NSSPigment.createPigment(leftRepresentation);
for (PigmentStack rightRepresentation : rightInputRepresentations) {
PigmentStack output = recipe.getOutput(leftRepresentation, rightRepresentation);
if (!output.isEmpty()) {
IngredientHelper ingredientHelper = new IngredientHelper(mapper);
ingredientHelper.put(nssLeft, leftRepresentation.getAmount());
ingredientHelper.put(rightRepresentation);
if (ingredientHelper.addAsConversion(output)) {
handled = true;
}
}
}
}
return handled;
}
Aggregations