Skip to content

Commit

Permalink
Waterline tweaks (GTNewHorizons#3256)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <[email protected]>
  • Loading branch information
NotAPenguin0 and Dream-Master authored Sep 22, 2024
1 parent e35caba commit e14fd93
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 41 deletions.
2 changes: 2 additions & 0 deletions src/main/java/gregtech/api/gui/modularui/GTUITextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ public class GTUITextures {
public static final UITexture PROGRESSBAR_OZONATION = UITexture.fullImage(GregTech.ID, "gui/progressbar/ozonation");
public static final UITexture PROGRESSBAR_PLASMA_HEATER = UITexture
.fullImage(GregTech.ID, "gui/progressbar/water_plasma_heater");
public static final UITexture PROGRESSBAR_UV_TREATMENT = UITexture
.fullImage(GregTech.ID, "gui/progressbar/uvtreatment");

public static FallbackableUITexture fallbackableProgressbar(String name, UITexture fallback) {
return new FallbackableUITexture(UITexture.fullImage(GregTech.ID, "gui/progressbar/" + name), fallback);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/gregtech/api/recipe/RecipeMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ && isArrayEmptyOrNull(b.getFluidOutputs())
recipe -> recipe.getMetadataOrDefault(PurificationPlantBaseChanceKey.INSTANCE, 0.0f))
.thenComparing(GTRecipe::compareTo))
.frontend(PurificationUnitOzonationFrontend::new)
.neiHandlerInfo(builder -> builder.setMaxRecipesPerPage(1))
.disableOptimize()
.build();
public static final RecipeMap<RecipeMapBackend> purificationFlocculationRecipes = RecipeMapBuilder
Expand Down Expand Up @@ -1184,7 +1185,7 @@ && isArrayEmptyOrNull(b.getFluidOutputs())
.build();
public static final RecipeMap<RecipeMapBackend> purificationUVTreatmentRecipes = RecipeMapBuilder
.of("gt.recipe.purificationplantuvtreatment")
.maxIO(9, 0, 1, 1)
.maxIO(0, 0, 1, 1)
.minInputs(0, 1)
.progressBar(GTUITextures.PROGRESSBAR_ARROW)
.frontend(PurificationUnitLaserFrontend::new)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,23 @@ public List<String> handleNEIItemTooltip(ItemStack stack, List<String> currentTi
@Override
public void drawNEIOverlays(GTNEIDefaultHandler.CachedDefaultRecipe neiCachedRecipe) {
super.drawNEIOverlays(neiCachedRecipe);
// Just to make sure these are only added once, otherwise these keep getting added every display tick
if (neiCachedRecipe.mInputs.size() == 1) {
// Display flocculation chemical
neiCachedRecipe.mInputs.add(
new PositionedStack(
GTUtility.getFluidDisplayStack(Materials.PolyAluminiumChloride.getFluid(100000L), true),
5,
-1,
false));

// Display flocculation chemical
neiCachedRecipe.mInputs.add(
new PositionedStack(
GTUtility.getFluidDisplayStack(Materials.PolyAluminiumChloride.getFluid(100000L), true),
5,
-1,
false));

// Display waste output
neiCachedRecipe.mOutputs.add(
new PositionedStack(
GTUtility.getFluidDisplayStack(Materials.FlocculationWasteLiquid.getFluid(100000L), true),
147,
48,
false));
// Display waste output
neiCachedRecipe.mOutputs.add(
new PositionedStack(
GTUtility.getFluidDisplayStack(Materials.FlocculationWasteLiquid.getFluid(100000L), true),
147,
48,
false));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,64 @@

import net.minecraft.item.ItemStack;

import org.jetbrains.annotations.NotNull;

import com.google.common.collect.ImmutableList;
import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture;
import com.gtnewhorizons.modularui.api.math.Pos2d;
import com.gtnewhorizons.modularui.api.math.Size;

import codechicken.nei.PositionedStack;
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.recipe.BasicUIPropertiesBuilder;
import gregtech.api.recipe.NEIRecipePropertiesBuilder;
import gregtech.api.recipe.RecipeMapFrontend;
import gregtech.common.gui.modularui.UIHelper;
import gregtech.common.tileentities.machines.multi.purification.MTEPurificationUnitUVTreatment;
import gregtech.nei.GTNEIDefaultHandler;

public class PurificationUnitLaserFrontend extends RecipeMapFrontend {
public class PurificationUnitLaserFrontend extends PurificationUnitRecipeMapFrontend {

public PurificationUnitLaserFrontend(BasicUIPropertiesBuilder uiPropertiesBuilder,
NEIRecipePropertiesBuilder neiPropertiesBuilder) {
super(uiPropertiesBuilder, neiPropertiesBuilder);
super(
120,
uiPropertiesBuilder.logoPos(new Pos2d(147, 102))
.progressBarTexture(new FallbackableUITexture(GTUITextures.PROGRESSBAR_UV_TREATMENT)),
neiPropertiesBuilder.recipeBackgroundSize(new Size(170, 120)));
}

@Override
public @NotNull List<Pos2d> getFluidInputPositions(int fluidInputCount) {
return ImmutableList.of(new Pos2d(10, 89));
}

@Override
public @NotNull List<Pos2d> getFluidOutputPositions(int fluidOutputCount) {
return ImmutableList.of(new Pos2d(147, 89));
}

@Override
public void drawNEIOverlays(GTNEIDefaultHandler.CachedDefaultRecipe neiCachedRecipe) {
final int numLenses = MTEPurificationUnitUVTreatment.LENS_ITEMS.size();
List<Pos2d> positions = UIHelper.getGridPositions(numLenses, 12, -4, 3, 3);
// Put in lens items
for (int i = 0; i < numLenses; ++i) {
Pos2d position = positions.get(i);
ItemStack lens = MTEPurificationUnitUVTreatment.LENS_ITEMS.get(i);
neiCachedRecipe.mInputs.add(new PositionedStack(lens, position.x, position.y, false));
List<Pos2d> positions = ImmutableList.of(
new Pos2d(62, -6),
new Pos2d(40, -1),
new Pos2d(32, 20),
new Pos2d(52, 27),
new Pos2d(75, 29),
new Pos2d(98, 27),
new Pos2d(118, 20),
new Pos2d(110, -1),
new Pos2d(88, -6));

if (neiCachedRecipe.mInputs.size() < numLenses) {
// Put in lens items
for (int i = 0; i < numLenses; ++i) {
Pos2d position = positions.get(i);
ItemStack lens = MTEPurificationUnitUVTreatment.LENS_ITEMS.get(i);
neiCachedRecipe.mInputs.add(new PositionedStack(lens, position.x, position.y, false));
}
}

super.drawNEIOverlays(neiCachedRecipe);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ public List<String> handleNEIItemTooltip(ItemStack stack, List<String> currentTi

@Override
public void drawNEIOverlays(GTNEIDefaultHandler.CachedDefaultRecipe neiCachedRecipe) {
neiCachedRecipe.mInputs.add(new PositionedStack(Materials.SodiumHydroxide.getDust(64), 3, 1, false));
neiCachedRecipe.mInputs.add(
new PositionedStack(
GTUtility.getFluidDisplayStack(Materials.HydrochloricAcid.getFluid(1000L), true),
147,
1,
false));
if (neiCachedRecipe.mInputs.size() == 1) {
neiCachedRecipe.mInputs.add(new PositionedStack(Materials.SodiumHydroxide.getDust(64), 3, 1, false));
neiCachedRecipe.mInputs.add(
new PositionedStack(
GTUtility.getFluidDisplayStack(Materials.HydrochloricAcid.getFluid(1000L), true),
147,
1,
false));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ public List<Pos2d> getFluidOutputPositions(int fluidOutputCount) {

@Override
public void drawNEIOverlays(GTNEIDefaultHandler.CachedDefaultRecipe neiCachedRecipe) {
neiCachedRecipe.mInputs.add(
new PositionedStack(GTUtility.getFluidDisplayStack(Materials.Helium.getPlasma(10L), true), 26, 53, false));
neiCachedRecipe.mInputs.add(
new PositionedStack(
GTUtility.getFluidDisplayStack(Materials.SuperCoolant.getFluid(100L), true),
107,
52,
false));
if (neiCachedRecipe.mInputs.size() == 1) {
neiCachedRecipe.mInputs.add(
new PositionedStack(
GTUtility.getFluidDisplayStack(Materials.Helium.getPlasma(10L), true),
26,
53,
false));
neiCachedRecipe.mInputs.add(
new PositionedStack(
GTUtility.getFluidDisplayStack(Materials.SuperCoolant.getFluid(100L), true),
107,
52,
false));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ protected MultiblockTooltipBuilder createTooltip() {
.addInfo("Removing a lens too early will fail the recipe.")
.addInfo("Find the order of lenses in the recipe in NEI,")
.addInfo("or use a portable scanner to view the currently requested lens.")
.addInfo("The recipe always starts at the Orundum Lens")
.addSeparator()
.addInfo(
EnumChatFormatting.AQUA + ""
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e14fd93

Please sign in to comment.