Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Biovat and Radio Hatches #3728

Merged
merged 25 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5fc8994
make bio vat use metadata
StaffiX Dec 27, 2024
1e17402
Merge branch 'GTNewHorizons:master' into biovat
StaffiX Dec 27, 2024
abf1a9e
remove special value, duration and eu/t usage for decay time, mass an…
StaffiX Dec 27, 2024
929b796
make radio hatch stop using eu/t and duration data for sievert and mass
StaffiX Dec 29, 2024
c01c9a8
remove unused lang key
StaffiX Dec 29, 2024
cffdc0a
fix sievert bug
StaffiX Dec 29, 2024
99e5f04
Merge branch 'master' into biovat
Dream-Master Dec 29, 2024
e3e9942
Merge branch 'master' into biovat
serenibyss Dec 30, 2024
1ae1214
address review
StaffiX Dec 30, 2024
c0967de
Merge branch 'master' into biovat
Dream-Master Dec 30, 2024
37b7e8e
Remove comment
StaffiX Dec 30, 2024
aacb7b5
Merge branch 'master' into biovat
Dream-Master Dec 30, 2024
4b20b75
Merge branch 'master' into biovat
Dream-Master Dec 30, 2024
04fd2a4
fix uranium fuel cell
StaffiX Dec 30, 2024
59d46cd
Merge branch 'master' into biovat
Dream-Master Dec 31, 2024
7711e1b
Merge branch 'master' into biovat
Dream-Master Jan 3, 2025
d67c7ff
Merge branch 'master' into biovat
Dream-Master Jan 4, 2025
79980de
Merge branch 'master' into biovat
Dream-Master Jan 5, 2025
1b96d21
Merge branch 'master' into biovat
Dream-Master Jan 8, 2025
ec31068
Merge branch 'master' into biovat
Dream-Master Jan 9, 2025
d105b9d
Merge branch 'master' into biovat
Dream-Master Jan 9, 2025
a46f227
Merge branch 'master' into biovat
Dream-Master Jan 10, 2025
b59091c
Merge branch 'master' into biovat
Dream-Master Jan 11, 2025
90f590e
Merge branch 'master' into biovat
Dream-Master Jan 11, 2025
60a1d42
spotless
serenibyss Jan 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions src/main/java/bartworks/API/recipe/BacterialVatFrontend.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package bartworks.API.recipe;

import java.util.Arrays;
import static gregtech.api.util.GTRecipeConstants.GLASS;

import java.util.List;

import javax.annotation.ParametersAreNonnullByDefault;
Expand All @@ -10,25 +11,23 @@

import com.gtnewhorizons.modularui.api.math.Alignment;

import bartworks.common.tileentities.multis.MTEBioVat;
import gregtech.api.enums.GTValues;
import gregtech.api.recipe.BasicUIPropertiesBuilder;
import gregtech.api.recipe.NEIRecipePropertiesBuilder;
import gregtech.api.recipe.RecipeMapFrontend;
import gregtech.api.util.GTRecipeConstants;
import gregtech.api.util.MethodsReturnNonnullByDefault;
import gregtech.api.util.recipe.Sievert;
import gregtech.nei.GTNEIDefaultHandler;
import gregtech.nei.RecipeDisplayInfo;
import gregtech.nei.formatter.INEISpecialInfoFormatter;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class BacterialVatFrontend extends RecipeMapFrontend {

public BacterialVatFrontend(BasicUIPropertiesBuilder uiPropertiesBuilder,
NEIRecipePropertiesBuilder neiPropertiesBuilder) {
super(
uiPropertiesBuilder,
neiPropertiesBuilder.neiSpecialInfoFormatter(new BacterialVatSpecialValueFormatter()));
super(uiPropertiesBuilder, neiPropertiesBuilder);
}

@Override
Expand Down Expand Up @@ -75,21 +74,19 @@ private void drawFluidOverlay(GTNEIDefaultHandler.FixedPositionedStack stack) {
super.drawNEIOverlayForOutput(stack);
}

private static class BacterialVatSpecialValueFormatter implements INEISpecialInfoFormatter {

@Override
public List<String> format(RecipeDisplayInfo recipeInfo) {
int[] tSpecialA = MTEBioVat.specialValueUnpack(recipeInfo.recipe.mSpecialValue);
String glassTier = StatCollector.translateToLocalFormatted("nei.biovat.0.name", GTValues.VN[tSpecialA[0]]);
String sievert = "";
if (!(tSpecialA[3] == 0)) {
if (tSpecialA[2] == 1) {
sievert = StatCollector.translateToLocalFormatted("nei.biovat.1.name", tSpecialA[3]);
} else {
sievert = StatCollector.translateToLocalFormatted("nei.biovat.2.name", tSpecialA[3]);
}
@Override
protected void drawEnergyInfo(RecipeDisplayInfo recipeInfo) {
int glassTier = recipeInfo.recipe.getMetadataOrDefault(GLASS, 3);
Sievert data = recipeInfo.recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0, false));
int sievert = data.sievert;
boolean isExact = data.isExact;
recipeInfo.drawText(StatCollector.translateToLocalFormatted("nei.biovat.0.name", GTValues.VN[glassTier]));
if (sievert != 0) {
if (!isExact) {
recipeInfo.drawText(StatCollector.translateToLocalFormatted("nei.biovat.1.name", sievert));
} else {
recipeInfo.drawText(StatCollector.translateToLocalFormatted("nei.biovat.2.name", sievert));
}
return Arrays.asList(glassTier, sievert);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class BartWorksRecipeMaps {
.specialSlotSensitive()
.progressBar(GTUITextures.PROGRESSBAR_CIRCUIT_ASSEMBLER)
.build();
public static final RecipeMap<RecipeMapBackend> radioHatchRecipes = RecipeMapBuilder.of("bw.recipe.radhatch")
public static final RecipeMap<RecipeMapBackend> radioHatchFakeRecipes = RecipeMapBuilder.of("bw.recipe.radhatch")
.maxIO(1, 0, 0, 0)
.minInputs(1, 0)
.slotOverlays((index, isFluid, isOutput, isSpecial) -> BWUITextures.OVERLAY_SLOT_ROD)
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/bartworks/API/recipe/RadioHatchFrontend.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

import net.minecraft.util.StatCollector;

import bartworks.common.tileentities.tiered.GT_MetaTileEntity_RadioHatch;
import gregtech.api.recipe.BasicUIPropertiesBuilder;
import gregtech.api.recipe.NEIRecipePropertiesBuilder;
import gregtech.api.recipe.RecipeMapFrontend;
import gregtech.api.util.GTRecipeConstants;
import gregtech.api.util.MethodsReturnNonnullByDefault;
import gregtech.api.util.recipe.Sievert;
import gregtech.nei.RecipeDisplayInfo;
import gregtech.nei.formatter.INEISpecialInfoFormatter;

Expand All @@ -33,13 +36,14 @@ private static class RadioHatchSpecialInfoFormatter implements INEISpecialInfoFo

@Override
public List<String> format(RecipeDisplayInfo recipeInfo) {
int radioLevel = recipeInfo.recipe.mEUt;
int amount = recipeInfo.recipe.mDuration;
long time = recipeInfo.recipe.mSpecialValue;
Sievert data = recipeInfo.recipe.getMetadataOrDefault(GTRecipeConstants.SIEVERT, new Sievert(0));
int radioLevel = data.sievert;
int mass = recipeInfo.recipe.getMetadataOrDefault(GTRecipeConstants.MASS, 0);
long time = GT_MetaTileEntity_RadioHatch.calcDecayTicks(radioLevel);
return Arrays.asList(
StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.0", radioLevel),
StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.1", amount),
StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.2", time * amount / 20.0));
StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.1", mass),
StatCollector.translateToLocalFormatted("BW.NEI.display.radhatch.2", time * mass / 20.0));
}
}
}
15 changes: 7 additions & 8 deletions src/main/java/bartworks/common/loaders/BioRecipeLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@

import static bartworks.API.recipe.BartWorksRecipeMaps.bacterialVatRecipes;
import static bartworks.API.recipe.BartWorksRecipeMaps.bioLabRecipes;
import static bartworks.util.BWRecipes.computeSieverts;
import static gregtech.api.enums.Mods.CropsPlusPlus;
import static gregtech.api.util.GTRecipeBuilder.MINUTES;
import static gregtech.api.util.GTRecipeBuilder.SECONDS;
import static gregtech.api.util.GTRecipeBuilder.TICKS;
import static gregtech.api.util.GTRecipeConstants.SIEVERTS;
import static gregtech.api.util.GTRecipeConstants.GLASS;

import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
Expand Down Expand Up @@ -132,7 +131,7 @@ public static void registerWaterBasedBacterialVatRecipes() {
.special(BioItemList.getPetriDish(BioCultureLoader.CommonYeast))
.fluidInputs(new FluidStack(fluidStack, 100))
.fluidOutputs(FluidRegistry.getFluidStack("potion.ghp", 1))
.metadata(SIEVERTS, computeSieverts(0, 3, false, false, false))
StaffiX marked this conversation as resolved.
Show resolved Hide resolved
.metadata(GLASS, 3)
.duration(17 * SECONDS + 10 * TICKS)
.eut(TierEU.RECIPE_EV)
.noOptimize()
Expand All @@ -144,7 +143,7 @@ public static void registerWaterBasedBacterialVatRecipes() {
.special(BioItemList.getPetriDish(BioCultureLoader.WhineYeast))
.fluidInputs(new FluidStack(fluidStack, 100))
.fluidOutputs(FluidRegistry.getFluidStack("potion.wine", 12))
.metadata(SIEVERTS, computeSieverts(0, 3, false, false, false))
.metadata(GLASS, 3)
.duration(10 * SECONDS)
.eut(TierEU.RECIPE_MV)
.noOptimize()
Expand All @@ -158,7 +157,7 @@ public static void registerWaterBasedBacterialVatRecipes() {
.special(BioItemList.getPetriDish(BioCultureLoader.BeerYeast))
.fluidInputs(new FluidStack(fluidStack, 100))
.fluidOutputs(FluidRegistry.getFluidStack("potion.beer", 5))
.metadata(SIEVERTS, computeSieverts(0, 3, false, false, false))
.metadata(GLASS, 3)
.duration(30 * SECONDS)
.eut(TierEU.RECIPE_LV)
.noOptimize()
Expand All @@ -169,7 +168,7 @@ public static void registerWaterBasedBacterialVatRecipes() {
.special(BioItemList.getPetriDish(BioCultureLoader.BeerYeast))
.fluidInputs(new FluidStack(fluidStack, 100))
.fluidOutputs(FluidRegistry.getFluidStack("potion.darkbeer", 10))
.metadata(SIEVERTS, computeSieverts(0, 3, false, false, false))
.metadata(GLASS, 3)
.duration(30 * SECONDS)
.eut(TierEU.RECIPE_LV)
.noOptimize()
Expand All @@ -184,7 +183,7 @@ public static void registerBacterialVatRecipes() {
.special(BioItemList.getPetriDish(BioCultureLoader.WhineYeast))
.fluidInputs(FluidRegistry.getFluidStack("potion.grapejuice", 100))
.fluidOutputs(FluidRegistry.getFluidStack("potion.wine", 12))
.metadata(SIEVERTS, computeSieverts(0, 3, false, false, false))
.metadata(GLASS, 3)
.duration(20 * SECONDS)
.eut(TierEU.RECIPE_LV)
.noOptimize()
Expand All @@ -194,7 +193,7 @@ public static void registerBacterialVatRecipes() {
.special(BioItemList.getPetriDish(BioCultureLoader.anaerobicOil))
.fluidInputs(Materials.FermentedBiomass.getFluid(10000))
.fluidOutputs(new FluidStack(FluidLoader.fulvicAcid, 1000))
.metadata(SIEVERTS, computeSieverts(0, 3, false, false, false))
.metadata(GLASS, 3)
.duration(2 * MINUTES + 17 * SECONDS + 8 * TICKS)
.eut(TierEU.RECIPE_LV)
.noOptimize()
Expand Down
Loading
Loading