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

MUI cover skeleton and Machine Controller Cover port #2312

Merged
merged 10 commits into from
Jan 1, 2024

Conversation

serenibyss
Copy link
Member

  • Creates a new default theme for covers
  • Adds several helper methods on CoverWithUI for creating similar looking cover UIs

Two API fixes/changes:

  • Swaps the order of holder.addCover() and cover.onAttachment() so that onAttachment() can set up some state that can then properly sync to the client for initial state
  • Adds getStackForm() method onto CoverableView. Technically breaking but who is actually implementing this interface already

Machine Controller Cover

image

  • Removes the min redstone value slider since I think its not useful enough for how much it obscured and overcomplicated setting up machine controller covers

@serenibyss serenibyss added the type: feature New feature or request label Dec 19, 2023
@serenibyss serenibyss requested a review from a team as a code owner December 19, 2023 00:25
Comment on lines +115 to +125
default <T extends Enum<T>> BoolValue.Dynamic boolValueOf(EnumSyncValue<T> syncValue, T value) {
return new BoolValue.Dynamic(() -> syncValue.getValue() == value, $ -> syncValue.setValue(value));
}

/**
* Get a BoolValue for use with toggle buttons which are "linked together,"
* meaning only one of them can be pressed at a time.
*/
default BoolValue.Dynamic boolValueOf(IntSyncValue syncValue, int value) {
return new BoolValue.Dynamic(() -> syncValue.getValue() == value, $ -> syncValue.setValue(value));
}
Copy link
Member

Choose a reason for hiding this comment

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

These should probably move to a general MUI2 utils class instead, and also be made static.

@@ -268,6 +270,19 @@ public static class IDs {
.canApplyTheme()
.build();

public static final UITexture MC_BUTTON = new UITexture.Builder()
.location("modularui", "gui/widgets/mc_button.png") // todo
Copy link
Member

Choose a reason for hiding this comment

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

What needs addressing for this todo and the one for the disabled button?

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically could be nothing, but I left the todo since its using a texture file from MUI that we might want to just copy over to GT for stability/later modification

public void writeInitialSyncData(@NotNull PacketBuffer packetBuffer) {
super.writeInitialSyncData(packetBuffer);
packetBuffer.writeBoolean(isInverted);
packetBuffer.writeShort(controllerMode.ordinal());
Copy link
Member

Choose a reason for hiding this comment

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

This can be written and read from as a byte instead of short.

@@ -1300,18 +1300,19 @@ cover.fluid_regulator.transfer_mode.description=§eTransfer Any§r - in this mod
cover.fluid_regulator.supply_exact=Supply Exact: %s
cover.fluid_regulator.keep_exact=Keep Exact: %s

cover.machine_controller.title=Machine Controller Settings
cover.machine_controller.normal=Normal
Copy link
Contributor

Choose a reason for hiding this comment

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

This lang entry is used in some other covers, like the Advanced Energy Detector. So removing it causes there to be a missing lang entry for that cover.

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.

Besides the lang issue, everything looks good to me

@ALongStringOfNumbers ALongStringOfNumbers merged commit 79f179c into master Jan 1, 2024
4 checks passed
@ALongStringOfNumbers ALongStringOfNumbers deleted the sb-mui-cover-start branch January 1, 2024 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants