This repository has been archived by the owner on Jul 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
squash
- Loading branch information
Showing
4 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
src/main/java/com/bigbass/recex/recipes/exporters/GTPPRecipeExporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.bigbass.recex.recipes.exporters; | ||
|
||
import com.bigbass.recex.recipes.Fluid; | ||
import com.bigbass.recex.recipes.Item; | ||
import com.bigbass.recex.recipes.Machine; | ||
import com.bigbass.recex.recipes.Mod; | ||
import com.bigbass.recex.recipes.gregtech.GregtechRecipe; | ||
import com.bigbass.recex.recipes.gregtech.RecipeUtil; | ||
import gregtech.api.util.GTPP_Recipe; | ||
import gregtech.api.util.GT_LanguageManager; | ||
import gregtech.api.util.GT_Recipe; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class GTPPRecipeExporter implements RecipeExporter { | ||
|
||
@Override | ||
public Mod getRecipes() { | ||
List<Machine> machines = new ArrayList<>(); | ||
for (GTPP_Recipe.GTPP_Recipe_Map map : GTPP_Recipe.GTPP_Recipe_Map.sMappings) { | ||
Machine machine = new Machine(GT_LanguageManager.getTranslation(map.mUnlocalizedName)); | ||
|
||
// machine name retrieval | ||
if (machine.name == null || machine.name.isEmpty()) { | ||
machine.name = map.mUnlocalizedName; | ||
} | ||
|
||
for (GT_Recipe rec : map.mRecipeList) { | ||
GregtechRecipe gtr = new GregtechRecipe(); | ||
gtr.en = rec.mEnabled; | ||
gtr.dur = rec.mDuration; | ||
gtr.eut = rec.mEUt; | ||
|
||
// item inputs | ||
for(ItemStack stack : rec.mInputs){ | ||
Item item = RecipeUtil.formatGregtechItemStack(stack); | ||
if(item == null){ | ||
continue; | ||
} | ||
gtr.iI.add(item); | ||
} | ||
|
||
// item outputs | ||
for(ItemStack stack : rec.mOutputs){ | ||
Item item = RecipeUtil.formatGregtechItemStack(stack); | ||
if(item == null){ | ||
continue; | ||
} | ||
gtr.iO.add(item); | ||
} | ||
|
||
// fluid inputs | ||
for(FluidStack stack : rec.mFluidInputs){ | ||
Fluid fluid = RecipeUtil.formatGregtechFluidStack(stack); | ||
if(fluid == null){ | ||
continue; | ||
} | ||
gtr.fI.add(fluid); | ||
} | ||
|
||
// fluid outputs | ||
for(FluidStack stack : rec.mFluidOutputs){ | ||
Fluid fluid = RecipeUtil.formatGregtechFluidStack(stack); | ||
if(fluid == null){ | ||
continue; | ||
} | ||
gtr.fO.add(fluid); | ||
} | ||
machine.recipes.add(gtr); | ||
} | ||
machines.add(machine); | ||
} | ||
return new Mod("gt++", machines); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/bigbass/recex/recipes/exporters/RecipeExporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.bigbass.recex.recipes.exporters; | ||
|
||
import com.bigbass.recex.recipes.Mod; | ||
|
||
public interface RecipeExporter { | ||
Mod getRecipes(); | ||
} |