Skip to content

Side buttons rework#4990

Merged
KnightMiner merged 14 commits into
SlimeKnights:1.18.2from
kirderf1:side_buttons_rework
Sep 18, 2022
Merged

Side buttons rework#4990
KnightMiner merged 14 commits into
SlimeKnights:1.18.2from
kirderf1:side_buttons_rework

Conversation

@kirderf1

Copy link
Copy Markdown
Contributor

Related to #4841 and #4988.

Reworks SideButtonsScreen to not use ModuleScreen, and does some minor additional cleanup.

  • The class no longer uses any inheritance to function. Because it no longer extends AbstractContainerScreen or Screen, it will no longer be treated as a screen by other mods. For example, the side buttons will no longer have an InitScreenEvent posted for it. THIS FIXES Inventory Locks show up twice in Tinkers' Construct GUI kirderf1/InventoryFree#9.
  • The side buttons widget implements Widget and GuiEventListener but is not added to the parent screen as a screen widget. Instead, render and mouse input functions are called by the parent class directly.
  • The parent class no longer has its size (as defined by leftPos and imageWidth etc) expanded to include the the side buttons that normally happens in MultiModuleScreen.updateSubmodule(). With how MultiModuleScreen.render() works, this will not affect any render functions. The size of the widget is still accounted for jei and when dropping items from the screen.
  • The side buttons widget now get recreated during the screen.init() call, instead of created in the constructor. This is more inline with how vanilla widgets are handled, and allows us to make the position immutable (which has not been done at this time).
  • To remove somenot strictly neccessary instanceof checks and casts in TinkerStationButtonsWidget, SideButtonsWidgetwas made generic for the button type.
  • TinkerStationButtonsWidget.selected was replaced by instead checking TinkerStationScreen.currentLayout. Doing so removed any need to copy over data when the widget was recreated during a window resize.

@KnightMiner KnightMiner added Bug Issue describes unintended or broken behavior 1.18 Issue affects 1.18 labels Sep 15, 2022

@KnightMiner KnightMiner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a couple of minor things until I have a chance to test this in game.

@KnightMiner KnightMiner merged commit 9729035 into SlimeKnights:1.18.2 Sep 18, 2022
@kirderf1 kirderf1 deleted the side_buttons_rework branch September 19, 2022 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.18 Issue affects 1.18 Bug Issue describes unintended or broken behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inventory Locks show up twice in Tinkers' Construct GUI

2 participants