Skip to content

Conversation

@ghzdude
Copy link
Contributor

@ghzdude ghzdude commented Jan 18, 2025

What

Ports the rest of the covers to MUI2

Implementation Details

ALL covers now use MUI2

Outcome

Covers use MUI2, and old ui code will be removed

@ghzdude ghzdude added the type: refactor Suggestion to refactor a section of code label Jan 18, 2025
@ghzdude ghzdude force-pushed the gh/mui2-cover-port-2 branch from cff6b7a to 33ff2bb Compare April 7, 2025 04:53
@ghzdude ghzdude force-pushed the gh/mui2-cover-port-2 branch from 33ff2bb to fa60a77 Compare June 13, 2025 06:27
@ghzdude ghzdude force-pushed the gh/mui2-cover-port-2 branch from edf6474 to 37f6808 Compare October 24, 2025 05:48
@ghzdude ghzdude marked this pull request as ready for review October 24, 2025 09:13
@ghzdude ghzdude requested a review from a team as a code owner October 24, 2025 09:13
@ghzdude ghzdude force-pushed the gh/mui2-cover-port-2 branch from 1fd1101 to 66a15f3 Compare October 30, 2025 01:44
@ghzdude ghzdude force-pushed the gh/mui2-cover-port-2 branch from dc706c2 to 3c4a0e0 Compare November 9, 2025 02:00
@ghzdude ghzdude force-pushed the gh/mui2-cover-port-2 branch from 3c4a0e0 to 60ade55 Compare November 17, 2025 01:19
Copy link
Contributor

@ALongStringOfNumbers ALongStringOfNumbers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltip of the continuous/latched mode in the Advanced Fluid Detector needs a new line, it is much too long.

Similar to a previous issue brought up, configuring the filter and then removing it will apply its configuration status to any new filter put in the Advanced Fluid Detector Cover.

Some how I was able to have filter configuration not saved when I exited the GUI of the Advanced Fluid Detection cover. This only happened once and I could not repeat it.

This error is back:
[20:43:41] [Client thread/INFO] [modularui]: unit WIDTH of widget Column was already used and will be overwritten with unit RIGHT
So maybe we need more debug names

Same filter issues with item filters in the Advanced Item detector. Putting in a smart filter, removing it and putting in an oredict filter, and then opening the filter UI still opens the smart filter.

Just a little weird math probably, when placing an advanced energy detection cover on a creative emitter, the default value for max is 488%

The Ender Link Cover does not work with the Creative Tank in my testing.

public @NotNull RichTooltip tooltip() {
tooltipOverride = true;
return super.tooltip();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this special method with a tooltip override? As far as I can see, this special method isn't even used at all. Also, doesn't calling the regular tooltip builder entry just add things to the tooltip already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's used in onInit() to add a tooltip if it isn't specified by the user, based off of mui2's TextFieldWidget:

if (!hasTooltip() && !tooltipOverride) {
    tooltipBuilder(tooltip -> tooltip.addLine(IKey.str(getText())));
    tooltipOverride = false;
}

import java.util.function.Supplier;
import java.util.regex.Pattern;

public class GTTextFieldWidget extends BaseTextFieldWidget<GTTextFieldWidget> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A decent amount of this class is unused. Do we need to keep any of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the methods are there to match mui2's TextFieldWidget. I could extend TextFieldWidget and remove the redundant methods, but then builder calls become more complicated due to methods returning TextFieldWidget instead of GTTextFieldWidget

@ghzdude
Copy link
Contributor Author

ghzdude commented Nov 17, 2025

Similar to a previous issue brought up, configuring the filter and then removing it will apply its configuration status to any new filter put in the Advanced Fluid Detector Cover.

Same filter issues with item filters in the Advanced Item detector. Putting in a smart filter, removing it and putting in an oredict filter, and then opening the filter UI still opens the smart filter.

both of these are caused by the same problem; synced panel handlers only open their panel once. any further attempts to open them will just reopen the cached panel. deleting the cached panel is not an option because SimpleItemFilter uses phantom item slots, which throws an exception. I can't use a client only panel handler unless i replace the phantom item slots with something else. I could use a different mapkey

Copy link
Member

@Zorbatron Zorbatron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a few methods in covers to build repetitive widgets, and they have GuiData instead of PosGuiData.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding a progress bar at the top that shows the % fullness of the energy container the cover is attached to, and two markers where the low/high positions are?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did have ideas like that for a while, something like create. it's best in a future pr though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing about the filled % bar as the advanced energy detector for the advanced fluid detector. It could also be done to the advanced item detector.

@ghzdude
Copy link
Contributor Author

ghzdude commented Nov 30, 2025

I see a few methods in covers to build repetitive widgets,

what methods are you talking about exactly?

and they have GuiData instead of PosGuiData.

I use GuiData in case we want to build the widgets in a different context, see #2658

@Zorbatron
Copy link
Member

what methods are you talking about exactly?

Methods like createWidgets(GuiData data, PanelSyncManager syncManager) { ... }, but I didn't know about #2658, so you can ignore that comment.

@ghzdude ghzdude force-pushed the gh/mui2-cover-port-2 branch from bb1658c to 93d5038 Compare November 30, 2025 06:01
Copy link
Contributor

@ALongStringOfNumbers ALongStringOfNumbers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also want to make the item/fluid detectors not able to attach to their respective creative sources, to mimic the energy cover.

When clicking on a slot in a fluid filter with a filled bucket, if the slot is already configured to a different fluid, the first click with the bucket will instead remove the configured fluid. You then have to click again to set the fluid in the slot to the one in the bucket. This should be condensed to one operation. If you are clicking on a configured fluid slot with a bucket that contains a different fluid, that fluid slot should just be set to the fluid in the bucket.

Testing this in the Advanced Fluid Detector cover. If you have a filter open, click on an item to open JEI for an item, close JEI, then you can no longer close the filter with the gear button in the main GUI, you have to use the x in the filter GUI. When the filter is in this state, I also cannot configure it using fluids from the inventory, only with JEI drag ghosts. However, after closing and reopening the filter, none of these ghost drags made when the filter was in this state are saved. Also you can't click to remove configured fluids.

In the Advanced Energy Detector cover, switching from the default discrete mode to percentage mode and then back sets the min EU value to -1. This was on the UHV 8x Battery Buffer. We should probably validate that the EU value in the text field cannot be negative.

Just noticed that the Quantum Network "Not Connected" TOP infor displays when looking at covers on the quantum tank/chest. That can be fixed in a different PR though.

When holding a stack of filters, right clicking a filter slot in a GUI to deposit 1 filter sets the NBT on the entire stack. instead of just the one that went in the slot. Not sure if anything can be done about this one.

.overlay(new DynamicDrawable(() -> itemDrawable.setItem(stack.get())))
.size(16)
.marginRight(4))
.child(IKey.dynamic(() -> stack.get().getDisplayName())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the name need to be dynamic? The only case I can think of for this is changing langs, but you have to close the UI to do that so the UI would get rebuilt with the correct lang even if it was not dynamic right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was part of my attempts to fix the filter popup panel before settling with the current solution

since the panel is only built once, it needs to update based on what's in the filter slot, therefore it needs a supplier

i could revert this change, though i'd probably add it back later in a different pr

@ghzdude
Copy link
Contributor Author

ghzdude commented Dec 2, 2025

Testing this in the Advanced Fluid Detector cover. If you have a filter open, click on an item to open JEI for an item, close JEI, then you can no longer close the filter with the gear button in the main GUI, you have to use the x in the filter GUI. When the filter is in this state, I also cannot configure it using fluids from the inventory, only with JEI drag ghosts. However, after closing and reopening the filter, none of these ghost drags made when the filter was in this state are saved. Also you can't click to remove configured fluids.

Looking into this, this happens because the panel handler on the client thinks the panel isn't opened. However, trying to open the panel again never sets open to true, so it can't close the panel. also in this state, the popup panel is essentially nonfunctional as it cannot receive packet updates on the server (it no longer exists in ModularSyncManager). the x button works because it calls closePanel directly.

in short, mui2 desync issue

When holding a stack of filters, right clicking a filter slot in a GUI to deposit 1 filter sets the NBT on the entire stack. instead of just the one that went in the slot. Not sure if anything can be done about this one.

can you elaborate on this? i don't know exactly what you're trying to do

implement tank interface instead of extending
add todo

@Override
public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing side) {
return coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the below TODO be done now? ("check this", plz write descriptive todos smh (not that you wrote that one ghz))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc, that todo was added by maya, idk what she means by it

panel.closePanel();
}
if (client) {
manager.callSyncedAction("update_filter_panel", packetBuffer -> {});
Copy link
Member

@Zorbatron Zorbatron Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't commit it since it would invalidate an approval from me, but once MUI 3.0.6 releases pr 183 merges, the empty lambda can be removed.

@ghzdude ghzdude merged commit c214f00 into master Dec 9, 2025
3 checks passed
@ghzdude ghzdude deleted the gh/mui2-cover-port-2 branch December 9, 2025 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: refactor Suggestion to refactor a section of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants