VisualOverhaul 5.1.0 - Code overhaul!

- Update to 1.20.4
- Switch Forge version to NeoForge
- Update resourcepacks & add round relic disc (thanks to @SuperNoobYT)
- Furnaces will now show results when finished (closes #61)
- Fix crash related to sound events (closes #60, #52)
- Fix crash related to button icons (closes #59, #55, #54, likely #49)
- Fix log spam when mod is only present on server (closes #33)
- Fix jukeboxes staying powered after playback has finished (closes #53)
This commit is contained in:
Martin Prokoph
2024-02-23 20:43:30 +01:00
parent ca9b7a0357
commit 680d2a3a8b
46 changed files with 464 additions and 339 deletions

View File

@@ -23,13 +23,12 @@ public class IconicButtons {
private String buttonId;
private Text prevText;
private Identifier iconId;
public IconicButtons(ClickableWidget widget) {
init(widget);
}
public IconicButtons() {}
public void init(ClickableWidget widget) {
if (widget == null || widget.getMessage() == null || widget.getMessage().getContent() == null) return;
prevText = widget.getMessage();
buttonId = (widget.getMessage().getContent() instanceof TranslatableTextContent translatableTextContent) ? translatableTextContent.getKey().toLowerCase() : "";
if (VOConfig.buttonIcons && !buttonId.equals("")) {
if (VOConfig.buttonIcons && !buttonId.isEmpty()) {
if (VOConfig.debug) System.out.println(buttonId);
iconId = Identifier.tryParse("iconic:textures/gui/icons/" + buttonId.toLowerCase()+".png");
if (buttonId.endsWith(".midnightconfig.title"))
@@ -55,7 +54,7 @@ public class IconicButtons {
}
}
public void renderIcons(DrawContext context, ClickableWidget widget, float alpha) {
if (widget.getMessage() == null) return;
if (widget.getMessage() == null || widget.getWidth() <= 20) return;
if (prevText != widget.getMessage()) init(widget);
if (VOConfig.buttonIcons && !buttonId.equals("") && iconId != null) {
int scaledWidth = client.getWindow().getScaledWidth();