Skip to content

Commit

Permalink
more Ra2 recipe conversions and some small fixes/improvements in GT r…
Browse files Browse the repository at this point in the history
…ecipe generation (#1994)

* oredict plate recipes

* oredict dust recipes

* ore processing recycling recipes

* shaping recipes

* more fixes

* fixes

* 2 fixes

* remove unnecessary qualifications
  • Loading branch information
chochem authored May 16, 2023
1 parent 7a8a216 commit 686a78b
Show file tree
Hide file tree
Showing 6 changed files with 1,223 additions and 681 deletions.
80 changes: 40 additions & 40 deletions src/main/java/gregtech/loaders/oreprocessing/ProcessingCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import gregtech.api.objects.MaterialStack;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_RecipeBuilder;
import gregtech.api.util.GT_Utility;

public class ProcessingCell implements IOreRecipeRegistrator {
Expand Down Expand Up @@ -103,41 +104,40 @@ public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDic
// Electrolyzer recipe
{
if (GT_Utility.getFluidForFilledItem(aStack, true) == null) {
int capsuleCount = tCapsuleCount <= 0L ? 0 : (int) tCapsuleCount;
ItemStack cells = capsuleCount <= 0 ? null
: ItemList.Cell_Empty.get(capsuleCount);
// dust stuffed cell e.g. Phosphate, Phosphorous Pentoxide
GT_Values.RA.stdBuilder()
.itemInputs(GT_Utility.copyAmount(tItemAmount, aStack), cells)
.itemOutputs(
tList.get(0),
tList.size() >= 2 ? tList.get(1) : null,
tList.size() >= 3 ? tList.get(2) : null,
tList.size() >= 4 ? tList.get(3) : null,
tList.size() >= 5 ? tList.get(4) : null,
tCapsuleCount >= 0L ? tList.size() >= 6 ? tList.get(5) : null
: ItemList.Cell_Empty.get(-tCapsuleCount))
GT_RecipeBuilder recipeBuilder = GT_Values.RA.stdBuilder();
if (tCapsuleCount > 0L) {
recipeBuilder.itemInputs(
GT_Utility.copyAmount(tItemAmount, aStack),
ItemList.Cell_Empty.get(tCapsuleCount));
} else {
recipeBuilder.itemInputs(GT_Utility.copyAmount(tItemAmount, aStack));
}
if (tCapsuleCount < 0L) {
tList.add(ItemList.Cell_Empty.get(-tCapsuleCount));
}
ItemStack[] outputsArray = tList
.toArray(new ItemStack[Math.min(tList.size(), 6)]);
recipeBuilder.itemOutputs(outputsArray)
.noFluidInputs()
.noFluidOutputs()
.duration(Math.max(1L, Math.abs(aMaterial.getProtons() * 2L * tItemAmount)))
.eut(Math.min(4, tList.size()) * 30)
.addTo(sElectrolyzerRecipes);
} else {
long tCellBalance = tCapsuleCount + tItemAmount - 1;
int capsuleCount = tCellBalance <= 0L ? 0 : (int) tCellBalance;
ItemStack cells = capsuleCount <= 0 ? null
: ItemList.Cell_Empty.get(capsuleCount);

GT_Values.RA.stdBuilder()
.itemInputs(aStack, cells)
.itemOutputs(
tList.get(0),
tList.size() >= 2 ? tList.get(1) : null,
tList.size() >= 3 ? tList.get(2) : null,
tList.size() >= 4 ? tList.get(3) : null,
tList.size() >= 5 ? tList.get(4) : null,
tCapsuleCount >= 0L ? tList.size() >= 6 ? tList.get(5) : null
: tCellBalance < 0 ? ItemList.Cell_Empty.get(-tCellBalance) : null)
GT_RecipeBuilder recipeBuilder = GT_Values.RA.stdBuilder();
if (tCellBalance > 0L) {
recipeBuilder.itemInputs(aStack, ItemList.Cell_Empty.get(tCellBalance));
} else {
recipeBuilder.itemInputs(GT_Utility.copyAmount(tItemAmount, aStack));
}
if (tCellBalance < 0L) {
tList.add(ItemList.Cell_Empty.get(-tCellBalance));
}
ItemStack[] outputsArray = tList
.toArray(new ItemStack[Math.min(tList.size(), 6)]);
recipeBuilder.itemOutputs(outputsArray)
.noFluidInputs()
.noFluidOutputs()
.duration(Math.max(1L, Math.abs(aMaterial.getProtons() * 8L * tItemAmount)))
Expand All @@ -147,19 +147,19 @@ public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDic
}
}
if ((aMaterial.mExtraData & 0x2) != 0) {
ItemStack emptyCells = tCapsuleCount > 0 ? ItemList.Cell_Empty.get(tCapsuleCount)
: null;

GT_Values.RA.stdBuilder()
.itemInputs(GT_Utility.copyAmount(tItemAmount, aStack), emptyCells)
.itemOutputs(
tList.get(0),
tList.size() >= 2 ? tList.get(1) : null,
tList.size() >= 3 ? tList.get(2) : null,
tList.size() >= 4 ? tList.get(3) : null,
tList.size() >= 5 ? tList.get(4) : null,
tCapsuleCount >= 0L ? tList.size() >= 6 ? tList.get(5) : null
: ItemList.Cell_Empty.get(-tCapsuleCount))
GT_RecipeBuilder recipeBuilder = GT_Values.RA.stdBuilder();
if (tCapsuleCount > 0L) {
recipeBuilder.itemInputs(
GT_Utility.copyAmount(tItemAmount, aStack),
ItemList.Cell_Empty.get(tCapsuleCount));
} else {
recipeBuilder.itemInputs(GT_Utility.copyAmount(tItemAmount, aStack));
}
if (tCapsuleCount < 0L) {
tList.add(ItemList.Cell_Empty.get(-tCapsuleCount));
}
ItemStack[] outputsArray = tList.toArray(new ItemStack[Math.min(tList.size(), 6)]);
recipeBuilder.itemOutputs(outputsArray)
.noFluidInputs()
.noFluidOutputs()
.duration(Math.max(1L, Math.abs(aMaterial.getMass() * 2L * tItemAmount)))
Expand Down
Loading

0 comments on commit 686a78b

Please sign in to comment.