-
Notifications
You must be signed in to change notification settings - Fork 205
Port Covers to Mui2 Part 2 #2700
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
Conversation
cff6b7a to
33ff2bb
Compare
33ff2bb to
fa60a77
Compare
edf6474 to
37f6808
Compare
1fd1101 to
66a15f3
Compare
dc706c2 to
3c4a0e0
Compare
3c4a0e0 to
60ade55
Compare
ALongStringOfNumbers
left a comment
There was a problem hiding this 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.
src/main/java/gregtech/common/covers/detector/CoverDetectorBase.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java
Show resolved
Hide resolved
src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java
Outdated
Show resolved
Hide resolved
| public @NotNull RichTooltip tooltip() { | ||
| tooltipOverride = true; | ||
| return super.tooltip(); | ||
| } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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;
}
src/main/java/gregtech/common/mui/widget/GTTextFieldWidget.java
Outdated
Show resolved
Hide resolved
| import java.util.function.Supplier; | ||
| import java.util.regex.Pattern; | ||
|
|
||
| public class GTTextFieldWidget extends BaseTextFieldWidget<GTTextFieldWidget> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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 |
There was a problem hiding this 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.
src/main/java/gregtech/common/covers/CoverDigitalInterface.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/covers/detector/CoverDetectorItemAdvanced.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
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.
what methods are you talking about exactly?
I use |
Methods like |
remove old ui code
improve advanced energy create GTTextFieldWidget for postfix
improve cursor positioning slightly
create common ui method in detector base
delete old ui code simplify setters
move parse
add postfix for conveyor and pump
fix CoverItemFilter filtermode syncing
use slotValue directly as value
bb1658c to
93d5038
Compare
ALongStringOfNumbers
left a comment
There was a problem hiding this 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.
src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java
Outdated
Show resolved
Hide resolved
| .overlay(new DynamicDrawable(() -> itemDrawable.setItem(stack.get()))) | ||
| .size(16) | ||
| .marginRight(4)) | ||
| .child(IKey.dynamic(() -> stack.get().getDisplayName()) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java
Outdated
Show resolved
Hide resolved
src/main/java/gregtech/common/covers/detector/CoverDetectorFluidAdvanced.java
Outdated
Show resolved
Hide resolved
move locking call into sync handlers' handle click method on server
prevent redundant sets
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
can you elaborate on this? i don't know exactly what you're trying to do |
implement tank interface instead of extending add todo
src/main/java/gregtech/api/util/virtualregistry/VirtualEnderRegistry.java
Show resolved
Hide resolved
|
|
||
| @Override | ||
| public boolean canAttach(@NotNull CoverableView coverable, @NotNull EnumFacing side) { | ||
| return coverable.getCapability(GregtechCapabilities.CAPABILITY_ENERGY_CONTAINER, null) != null || |
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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
src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java
Outdated
Show resolved
Hide resolved
| panel.closePanel(); | ||
| } | ||
| if (client) { | ||
| manager.callSyncedAction("update_filter_panel", packetBuffer -> {}); |
There was a problem hiding this comment.
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.
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