Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master authored Jan 11, 2025
2 parents d830d40 + 7784cf7 commit 049cc3e
Show file tree
Hide file tree
Showing 20 changed files with 400 additions and 567 deletions.
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))
.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

0 comments on commit 049cc3e

Please sign in to comment.