Skip to content
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

Port many blocks to MUI2 #2624

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

Zorbatron
Copy link
Member

@Zorbatron Zorbatron commented Sep 19, 2024

What

Ports a few machines and multiblock parts to use MUI2
Currently has:

  • Muffler Hatch
  • Battery Buffer
  • Processing Array Machine Hatch
  • Block breaker
  • Research station Object Holder (Also fixes them allowing you to insert items while something is being researched)
  • Reservoir Hatch
  • Fisher
  • Primitive Pump Hatch
  • Steam Hatch
  • Buffers
  • Rotor holders

Todo:

  • Change the position of the machine name widgets when it's standardized
  • Retest blocks using GTFluidSlot once Update MUI2 dep to RC2 #2622 is merged (currently is not syncing properly)

Outcome

Progress on moving to MUI2!

@TechLord22 TechLord22 added the type: refactor Suggestion to refactor a section of code label Sep 19, 2024
@Zorbatron Zorbatron marked this pull request as ready for review January 22, 2025 01:32
@Zorbatron Zorbatron requested a review from a team as a code owner January 22, 2025 01:32
Fix being able to insert items into an object holder while research is in progress.
Copy link
Contributor

@ghzdude ghzdude left a comment

Choose a reason for hiding this comment

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

most of the mui2 code lgtm, just a few things

Comment on lines +83 to +90
.child(new ItemSlot() {

// Don't draw tooltip if the slot is blocked
@Override
public void drawForeground(ModularGuiContext context) {
if (!isSlotBlocked()) super.drawForeground(context);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

you can do:

.tooltip(t -> t.setAutoUpdate(false))
.onUpdateListener(itemSlot -> {
    RichTooltip tooltip = itemSlot.tooltip();
    if (isSlotBlocked()) {
        tooltip.buildTooltip();
        tooltip.clearText();
    } else if (tooltip.isEmpty()) {
        tooltip.markDirty();
    }
})

to mimic and replace the tooltip override


import java.util.function.Supplier;

public class DrawableColorOverlay implements IDrawable {
Copy link
Contributor

Choose a reason for hiding this comment

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

imho, usages of this class could just be a DynamicDrawable or lambda, maybe placed in GTGuiTextures.

Comment on lines +12 to +13
private final Supplier<Boolean> drawOverlay;
private final Supplier<Integer> OVERLAY_COLOR;
Copy link
Contributor

Choose a reason for hiding this comment

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

if this class is kept, these should be primitive suppliers, and OVERLAY_COLOR needs to be camel case format and marked nullable.

Comment on lines +25 to +29
public void draw(GuiContext context, int x, int y, int width, int height, WidgetTheme widgetTheme) {
if (drawOverlay.get()) {
GuiDraw.drawRect(x, y, width, height, OVERLAY_COLOR.get());
}
}
Copy link
Contributor

@ghzdude ghzdude Jan 25, 2025

Choose a reason for hiding this comment

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

if OVERLAY_COLOR is null, the color from the widget theme should be used

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.

5 participants