-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from FTBTeam/dev
Dev
- Loading branch information
Showing
10 changed files
with
146 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [2101.1.2] | ||
|
||
### Fixed | ||
* Fixed `/ftblibrary clientconfig` command not being usable without op perms | ||
|
||
## [2101.1.1] | ||
|
||
### Fixed | ||
* Fixed a couple of minor GUI drawing artifacts in some screens | ||
|
||
## [2101.1.0] | ||
|
||
### Changed | ||
* Updated to MC 1.21.1 | ||
|
||
### Added | ||
* Sidebar buttons (from FTB Library and all mods which add buttons) are now all repositionable and toggleable | ||
* New sidebar button to open client config for FTB Library (can be used to hide sidebar entirely) | ||
* Client config can also be opened via `/ftblibrary clientconfig` command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
common/src/main/java/dev/ftb/mods/ftblibrary/ui/ToggleableButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package dev.ftb.mods.ftblibrary.ui; | ||
|
||
import dev.ftb.mods.ftblibrary.icon.Icon; | ||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.network.chat.Component; | ||
|
||
public class ToggleableButton extends SimpleButton { | ||
|
||
private Component enabledText; | ||
private Component disabledText; | ||
|
||
private boolean state; | ||
|
||
public ToggleableButton(Panel panel, boolean defaultState, Icon enabled, Icon disabled, ToggleableCallback toggleableCallback) { | ||
super(panel, Component.empty(), defaultState ? enabled : disabled, null); | ||
this.state = defaultState; | ||
this.setConsumer((widget, button) -> { | ||
this.state = !this.state; | ||
widget.setIcon(this.state ? enabled : disabled); | ||
updateTitle(); | ||
toggleableCallback.onClicked(widget, this.state); | ||
}); | ||
this.enabledText = Component.translatable("ftblibrary.gui.enabled").withStyle(ChatFormatting.GREEN); | ||
this.disabledText = Component.translatable("ftblibrary.gui.disabled").withStyle(ChatFormatting.RED); | ||
updateTitle(); | ||
} | ||
|
||
public Component getEnabledText() { | ||
return enabledText; | ||
} | ||
|
||
public ToggleableButton setEnabledText(Component enabledText) { | ||
this.enabledText = enabledText; | ||
updateTitle(); | ||
return this; | ||
} | ||
|
||
public Component getDisabledText() { | ||
return disabledText; | ||
} | ||
|
||
public ToggleableButton setDisabledText(Component disabledText) { | ||
this.disabledText = disabledText; | ||
updateTitle(); | ||
return this; | ||
} | ||
|
||
private void updateTitle() { | ||
setTitle(state ? enabledText : disabledText); | ||
} | ||
|
||
public interface ToggleableCallback { | ||
void onClicked(SimpleButton widget, boolean newState); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
...src/main/java/dev/ftb/mods/ftblibrary/core/mixin/fabric/AbstractContainerScreenMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
"PlayerMixin" | ||
], | ||
"client": [ | ||
"AbstractContainerScreenMixin", | ||
"KeyMappingAccessor" | ||
], | ||
"injectors": { | ||
|
Oops, something went wrong.