Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
dbefb45
remove ldlib item renderers
gustovafing Apr 8, 2026
4c0dbe1
remove more unused things
gustovafing Apr 9, 2026
14b5f8a
remove mixin
gustovafing Apr 10, 2026
6051ef9
switch to use mui recipe handler/entry classes
gustovafing Apr 10, 2026
364104c
fully remove ldlib machine uis and editor
gustovafing Apr 10, 2026
38c3468
i love reorganising things
gustovafing Apr 10, 2026
99c561c
Merge branch 'gus/more-ldlib-removals' into gus/mui-recipeviewer
gustovafing Apr 10, 2026
ce5bb5b
start working on mui recipe viewer stuff
gustovafing Apr 10, 2026
00fc130
update mui
gustovafing Apr 10, 2026
dd53a18
more work on ore vein widgets
gustovafing Apr 10, 2026
992352b
switch to latest mui
gustovafing Apr 11, 2026
9e09856
some more mui recipe viewer displays
gustovafing Apr 22, 2026
3c98a35
ore proc
gustovafing Apr 22, 2026
a9f2b22
recipe ui modifier
gustovafing Apr 22, 2026
905a340
recipe condition stuff
gustovafing Apr 24, 2026
83d2848
make GTGuiTextures an interface like mui gui textures
gustovafing Apr 24, 2026
acdeb53
Make recipe iterator hasNext work properly (#4770)
gustovafing Apr 6, 2026
84adf48
rewrite get backed slots row
gustovafing Apr 24, 2026
a7c20fe
spotless
gustovafing Apr 24, 2026
80c277f
remove recipe viewer function
gustovafing Apr 24, 2026
d75149e
Merge branch 'gus/mui-fixes' into gus/mui-recipeviewer
gustovafing Apr 24, 2026
79eb7d4
split up capability ui stuff
gustovafing Apr 24, 2026
f40e88f
clean up ui functions
gustovafing Apr 24, 2026
2e1a408
a
gustovafing Apr 24, 2026
245aee1
Merge branch 'gus/mui-fixes' into gus/mui-recipeviewer
gustovafing Apr 25, 2026
9b0efda
singleblock machine recipe type ui stuff
gustovafing Apr 27, 2026
7a56da6
reorganise some stuff
gustovafing Apr 27, 2026
0e506ab
spotless
gustovafing Apr 27, 2026
a6160ab
more rt ui work
gustovafing Apr 28, 2026
f2e6cce
move recipe ui modifiers
gustovafing Apr 28, 2026
706f5a3
getters
gustovafing Apr 28, 2026
5d40e47
fix progress bar
gustovafing Apr 28, 2026
1f9fb58
emi widgets
gustovafing May 4, 2026
78eb8e1
more recipe ui work
gustovafing May 4, 2026
e810cb7
fix slot backgrounds & sizing
gustovafing May 4, 2026
5ff284b
add functions for mapping content to slots
gustovafing May 4, 2026
c01b6b2
fix emi recipe inputs/outputs not being registered
gustovafing May 4, 2026
9f208fc
tear out the majority of remaining ldlib ui
gustovafing May 4, 2026
f865024
fix slot sizing when a slot group has a single slot
gustovafing May 4, 2026
2c4646d
few more small ui fixes
gustovafing May 4, 2026
dca4395
text sizing
gustovafing May 4, 2026
a0343ae
more ui fixes
gustovafing May 5, 2026
aa32c38
fix dimension condition rendering
gustovafing May 5, 2026
4b804a2
display computation properly
gustovafing May 5, 2026
647ba9f
fix display duration and widget alignment
gustovafing May 5, 2026
53f400c
change eu and comp recipe viewer display
gustovafing May 6, 2026
7e5c21d
fix display bug
gustovafing May 6, 2026
4a7e129
fix eu display
gustovafing May 6, 2026
9ccb031
skip eu widgets when no eu slot
gustovafing May 6, 2026
b945d5c
fix some sizing bugs
gustovafing May 6, 2026
29ea77b
temporary fix for content row sizing
gustovafing May 7, 2026
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
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
compileOnly(libs.evalEx.get())

// MUI
jarJar(modImplementation(forge.mui.get()))
jarJar(implementation(files("libs/modularui-mc1.20.1-3.2.0-dev.jar")))

// Mixin (& Extras)
annotationProcessor(variantOf(libs.mixin) { classifier("processor") })
Expand Down
12 changes: 6 additions & 6 deletions docs/content/Development/MUI2/Syncing/Sync-Basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ The first method is using dynamic widgets, which update every frame regardless o
This method is easiest if you just need to sync some data over and display or edit it in a single widget.
Some examples are:

- `IKey.dynamic(Supplier<Component>)` - Queries the supplier every frame to retrieve the component to display
- `Text.dynamic(Supplier<Component>)` - Queries the supplier every frame to retrieve the component to display
- `new DynamicDrawable(Supplier<IDrawable>)` - Queries the supplier every frame to retrieve the drawable to display


!!! Note
To convert IKeys or Drawables to Widgets, you need to chain `.asWidget()`
To convert Texts or Drawables to Widgets, you need to chain `.asWidget()`

```java
public class MuiTestMachine extends MetaMachine implements IMuiMachine {
Expand All @@ -52,7 +52,7 @@ public class MuiTestMachine extends MetaMachine implements IMuiMachine {

var column = Flow.column();

column.child(IKey.dynamic(() -> Component.literal("Ticks: " + this.ticks)) // note that this is a Supplier<Component> instead of a Component
column.child(Text.dynamic(() -> Component.literal("Ticks: " + this.ticks)) // note that this is a Supplier<Component> instead of a Component
.asWidget()
.margin(4));

Expand Down Expand Up @@ -112,7 +112,7 @@ public class MuiTestMachine extends MetaMachine implements IMuiMachine {
int tickValue = intSyncHandler.getValue(); // It is also possible to just reference this.ticks directly
int amountOfItems = 1 + (tickValue % 200) / 20;
for (int i = 0; i < amountOfItems; i++) {
list.child(IKey.str("Value nr. " + (i + 1)).asWidget()); // No need for IKey.dynamic since we have the value as a variable here, inside the lambda
list.child(Text.str("Value nr. " + (i + 1)).asWidget()); // No need for Text.dynamic since we have the value as a variable here, inside the lambda
}
return list;
});
Expand Down Expand Up @@ -159,7 +159,7 @@ public class MuiTestMachine extends MetaMachine implements IMuiMachine {
var column = Flow.column().paddingTop(3);

column.child(
IKey.dynamic(() -> Component.literal("Pressed: " + this.buttonPressed))
Text.dynamic(() -> Component.literal("Pressed: " + this.buttonPressed))
.asWidget());

var buttonSyncValue = new BooleanSyncValue(() -> this.buttonPressed, (newValue) -> this.buttonPressed = newValue);
Expand Down Expand Up @@ -220,7 +220,7 @@ public class MuiTestMachine extends MetaMachine implements IMuiMachine {
for (int rowNr = 0; rowNr < this.rows; rowNr++) {
Flow row = Flow.row();
for (int columnNr = 0; columnNr < this.columns; columnNr++) {
row.child(IKey.str(rowNr + ", " + columnNr).asWidget().width(20));
row.child(Text.str(rowNr + ", " + columnNr).asWidget().width(20));
}
grid.child(row);
}
Expand Down
4 changes: 2 additions & 2 deletions docs/content/Development/MUI2/Syncing/Synced-Actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public class MuiTestMachine extends MetaMachine implements IMuiMachine {
});

Column contents = new Column();
contents.child(IKey.dynamic(() -> Component.literal("Number: " + number))
contents.child(Text.dynamic(() -> Component.literal("Number: " + number))
.asWidget()
.width(100)
.height(16)
.margin(4));

contents.child(new ButtonWidget<>()
.onMousePressed((x, y, button) -> {
.onMousePressed((context, button) -> {
if (button == 0) {
syncManager.callSyncedAction("randomButtonPressed");
}
Expand Down
2 changes: 1 addition & 1 deletion docs/content/Development/MUI2/Test-Machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MuiTestMachine extends MetaMachine implements IMuiMachine {
var panel = GTGuis.createPanel(this, 176, 168);
// Do stuff with your panel here, add children, etc.
// For example:
panel.child(IKey.str("Test machine")
panel.child(Text.str("Test machine")
.asWidget()
.margin(4));

Expand Down
4 changes: 2 additions & 2 deletions docs/content/Development/MUI2/Widget-Layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ Flow column = Flow.column()
.widthRel(1f)
.padding(10)
.crossAxisAlignment(Alignment.CrossAxis.START)
.child(new TextWidget<>(IKey.str("Title")).marginBottom(4))
.child(new TextWidget<>(IKey.str("Body")));
.child(new TextWidget<>(Text.str("Title")).marginBottom(4))
.child(new TextWidget<>(Text.str("Body")));
```

### Slot grid using absolute positioning
Expand Down
4 changes: 2 additions & 2 deletions gradle/forge.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ mixinExtras = "0.5.0-rc.3"

jei = "15.20.0.115"
rei = "12.1.785"
emi = "1.1.13+1.20.1"
emi = "1.1.22+1.20.1"
ae2 = "15.0.18"
mui = "3.1.5"
mui = "3.2.0-SNAPSHOT"
kubejs = "2001.6.5-build.16"
rhino = "2001.2.3-build.10"
architectury = "9.2.14"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
package com.gregtechceu.gtceu.api.capability.recipe;

import com.gregtechceu.gtceu.api.recipe.GTRecipe;
import com.gregtechceu.gtceu.api.recipe.content.Content;
import com.gregtechceu.gtceu.api.recipe.content.ContentModifier;
import com.gregtechceu.gtceu.api.recipe.content.SerializerInteger;
import com.gregtechceu.gtceu.utils.FormattingUtil;

import com.lowdragmc.lowdraglib.gui.widget.LabelWidget;
import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup;
import com.lowdragmc.lowdraglib.utils.LocalizationUtils;

import org.apache.commons.lang3.mutable.MutableInt;

import java.util.List;

public class CWURecipeCapability extends RecipeCapability<Integer> {

Expand All @@ -32,18 +21,4 @@ public Integer copyWithModifier(Integer content, ContentModifier modifier) {
return modifier.apply(content);
}

@Override
public void addXEIInfo(WidgetGroup group, int xOffset, GTRecipe recipe, List<Content> contents, boolean perTick,
boolean isInput, MutableInt yOffset) {
if (perTick) {
int cwu = contents.stream().map(Content::getContent).mapToInt(CWURecipeCapability.CAP::of).sum();
group.addWidget(new LabelWidget(3 - xOffset, yOffset.addAndGet(10),
LocalizationUtils.format("gtceu.recipe.computation_per_tick", FormattingUtil.formatNumbers(cwu))));
}
if (recipe.data.getBoolean("duration_is_total_cwu")) {
group.addWidget(new LabelWidget(3 - xOffset, yOffset.addAndGet(10),
LocalizationUtils.format("gtceu.recipe.total_computation",
FormattingUtil.formatNumbers(recipe.duration))));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public int limitMaxParallelByOutput(IRecipeCapabilityHolder holder, GTRecipe rec
int maxMultiplier = multiplier;

long totalEU = 0L;
for (var content : outputs) totalEU += of(content.content).getTotalEU();
for (var content : outputs) totalEU += of(content.content()).getTotalEU();
if (totalEU != 0 && multiplier > Long.MAX_VALUE / totalEU) {
maxMultiplier = multiplier = GTMath.saturatedCast(Long.MAX_VALUE / totalEU);
}
Expand Down Expand Up @@ -104,8 +104,8 @@ public int getMaxParallelByInput(IRecipeCapabilityHolder holder, GTRecipe recipe
long nonConsumable = 0;
long consumable = 0;
for (Content content : inputs) {
EnergyStack s = of(content.content);
if (content.chance == 0) nonConsumable += s.getTotalEU();
EnergyStack s = of(content.content());
if (content.chance() == 0) nonConsumable += s.getTotalEU();
else consumable += s.getTotalEU();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.gregtechceu.gtceu.api.capability.recipe;

import com.gregtechceu.gtceu.api.gui.widget.TankWidget;
import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroup;
import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroupDistinctness;
import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerList;
import com.gregtechceu.gtceu.api.machine.MetaMachine;
import com.gregtechceu.gtceu.api.machine.trait.*;
import com.gregtechceu.gtceu.api.recipe.GTRecipe;
import com.gregtechceu.gtceu.api.recipe.GTRecipeType;
import com.gregtechceu.gtceu.api.recipe.content.Content;
import com.gregtechceu.gtceu.api.recipe.content.ContentModifier;
import com.gregtechceu.gtceu.api.recipe.content.SerializerFluidIngredient;
Expand All @@ -14,36 +11,20 @@
import com.gregtechceu.gtceu.api.recipe.lookup.ingredient.AbstractMapIngredient;
import com.gregtechceu.gtceu.api.recipe.lookup.ingredient.fluid.*;
import com.gregtechceu.gtceu.api.recipe.modifier.ParallelLogic;
import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI;
import com.gregtechceu.gtceu.client.TooltipsHandler;
import com.gregtechceu.gtceu.common.valueprovider.*;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.fluid.FluidEntryList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.fluid.FluidStackList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.fluid.FluidTagList;
import com.gregtechceu.gtceu.integration.recipeviewer.handlers.fluid.CycleFluidEntryHandler;
import com.gregtechceu.gtceu.integration.recipeviewer.widgets.GTRecipeWidget;
import com.gregtechceu.gtceu.utils.GTMath;

import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture;
import com.lowdragmc.lowdraglib.gui.widget.Widget;
import com.lowdragmc.lowdraglib.jei.IngredientIO;

import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.util.valueproviders.IntProvider;
import net.minecraft.world.item.TooltipFlag;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;

import brachy.modularui.integration.recipeviewer.entry.fluid.FluidEntryList;
import brachy.modularui.integration.recipeviewer.entry.fluid.FluidStackList;
import brachy.modularui.integration.recipeviewer.entry.fluid.FluidTagList;
import it.unimi.dsi.fastutil.objects.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.UnknownNullability;
import org.jetbrains.annotations.Unmodifiable;

import java.util.*;
import java.util.stream.Collectors;

import static com.gregtechceu.gtceu.api.recipe.RecipeHelper.addToRecipeHandlerMap;

Expand Down Expand Up @@ -146,7 +127,7 @@ public int limitMaxParallelByOutput(IRecipeCapabilityHolder holder, GTRecipe rec
int maxAmount = 0;
List<FluidIngredient> ingredients = new ArrayList<>(outputContents.size());
for (var content : outputContents) {
var ing = this.of(content.content);
var ing = this.of(content.content());
maxAmount = Math.max(maxAmount, ing.getAmount());
ingredients.add(ing);
}
Expand Down Expand Up @@ -191,13 +172,13 @@ public int getMaxParallelByInput(IRecipeCapabilityHolder holder, GTRecipe recipe
var nonConsumables = new Object2LongOpenHashMap<FluidIngredient>();
var consumables = new Object2LongOpenHashMap<FluidIngredient>();
for (Content content : inputs) {
FluidIngredient ing = of(content.content);
FluidIngredient ing = of(content.content());

int amount;
if (ing instanceof IntProviderFluidIngredient provider) amount = provider.getCountProvider().getMaxValue();
else amount = ing.getAmount();

if (content.chance == 0) {
if (content.chance() == 0) {
nonConsumables.addTo(ing, amount);
} else {
boolean has = false;
Expand Down Expand Up @@ -326,89 +307,8 @@ private static List<Object2LongMap<FluidStack>> getInputContents(IRecipeCapabili
return invs;
}

@Override
public @NotNull List<Object> createXEIContainerContents(List<Content> contents, GTRecipe recipe, IO io) {
List<Object> entryLists = contents.stream()
.map(Content::getContent)
.map(this::of)
.map(FluidRecipeCapability::mapFluid)
.collect(Collectors.toList());

while (entryLists.size() < recipe.recipeType.getMaxOutputs(this)) entryLists.add(null);
return entryLists;
}

public Object createXEIContainer(List<?> contents) {
// cast is safe if you don't pass the wrong thing.
// noinspection unchecked
return new CycleFluidEntryHandler((List<FluidEntryList>) contents);
}

@NotNull
@Override
public Widget createWidget() {
TankWidget tank = new TankWidget();
tank.initTemplate();
tank.setFillDirection(ProgressTexture.FillDirection.ALWAYS_FULL);
return tank;
}

@NotNull
@Override
public Class<? extends Widget> getWidgetClass() {
return TankWidget.class;
}

@Override
public void applyWidgetInfo(@NotNull Widget widget,
int index,
boolean isXEI,
IO io,
GTRecipeTypeUI.@UnknownNullability("null when storage == null") RecipeHolder recipeHolder,
@NotNull GTRecipeType recipeType,
@UnknownNullability("null when content == null") GTRecipe recipe,
@Nullable Content content,
@Nullable Object storage, int recipeTier, int chanceTier) {
if (widget instanceof TankWidget tank) {
if (storage instanceof IFluidHandler fluidHandler) {
tank.setFluidTank(fluidHandler, index);
}
tank.setIngredientIO(io == IO.IN ? IngredientIO.INPUT : IngredientIO.OUTPUT);
tank.setAllowClickFilled(!isXEI);
tank.setAllowClickDrained(!isXEI && io.support(IO.IN));
if (isXEI) tank.setShowAmount(false);
if (content != null) {
float chance = (float) recipeType.getChanceFunction()
.getBoostedChance(content, recipeTier, chanceTier) / content.maxChance;
tank.setXEIChance(chance);
tank.setOnAddedTooltips((w, tooltips) -> {
FluidIngredient ingredient = FluidRecipeCapability.CAP.of(content.content);
if (!isXEI && ingredient.getStacks().length > 0) {
FluidStack stack = ingredient.getStacks()[0];
TooltipsHandler.appendFluidTooltips(stack, tooltips::add, TooltipFlag.NORMAL);
}
if (ingredient instanceof IntProviderFluidIngredient provider) {
IntProvider countProvider = provider.getCountProvider();
tooltips.add(Component.translatable("gtceu.gui.content.fluid_range",
countProvider.getMinValue(), countProvider.getMaxValue())
.withStyle(ChatFormatting.GOLD));
}
GTRecipeWidget.setConsumedChance(content,
recipe.getChanceLogicForCapability(this, io, isTickSlot(index, io, recipe)),
tooltips, recipeTier, chanceTier, recipeType.getChanceFunction());
if (isTickSlot(index, io, recipe)) {
tooltips.add(Component.translatable("gtceu.gui.content.per_tick"));
}
});
if (io == IO.IN && (content.chance == 0)) {
tank.setIngredientIO(IngredientIO.CATALYST);
}
}
}
}

// Maps fluids to a FluidEntryList for XEI: either a FluidTagList or a FluidStackList
public static FluidEntryList mapFluid(FluidIngredient ingredient) {
public static FluidEntryList mapIngredientToEntryList(FluidIngredient ingredient) {
int amount;
if (ingredient instanceof IntProviderFluidIngredient) {
amount = 1;
Expand Down Expand Up @@ -456,4 +356,9 @@ public interface ICustomParallel {
public boolean shouldBypassDistinct() {
return false;
}

public @Nullable NotifiableFluidTank getCapabilityHandler(MetaMachine machine, IO io) {
var handlers = machine.getTraitHolder().getTraits(NotifiableFluidTank.TYPE);
return handlers.stream().filter(v -> v.handlerIO == io).findFirst().orElse(null);
}
}
Loading
Loading