From 35da4594d47ac9546e43ff91cd58b91dd68dbebb Mon Sep 17 00:00:00 2001 From: Zailer43 Date: Sat, 14 Sep 2024 17:02:57 -0300 Subject: [PATCH] Add a "Difficult-to-remove entity" button to the Player Statue screen --- .../gui/player_statue/PlayerStatueScreen.java | 6 ++++++ .../gui/utils/InvisibleEntityWarning.java | 2 +- .../assets/fzmm/owo_ui/player_statue.xml | 20 +++++++++++++------ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/fzmm/zailer/me/client/gui/player_statue/PlayerStatueScreen.java b/src/main/java/fzmm/zailer/me/client/gui/player_statue/PlayerStatueScreen.java index 79ac95b5..9b1d52f8 100644 --- a/src/main/java/fzmm/zailer/me/client/gui/player_statue/PlayerStatueScreen.java +++ b/src/main/java/fzmm/zailer/me/client/gui/player_statue/PlayerStatueScreen.java @@ -8,8 +8,10 @@ import fzmm.zailer.me.client.gui.options.HorizontalDirectionOption; import fzmm.zailer.me.client.gui.player_statue.tabs.IPlayerStatueTab; import fzmm.zailer.me.client.gui.player_statue.tabs.PlayerStatueTabs; +import fzmm.zailer.me.client.gui.utils.InvisibleEntityWarning; import fzmm.zailer.me.client.gui.utils.memento.IMementoObject; import fzmm.zailer.me.client.gui.utils.memento.IMementoScreen; +import fzmm.zailer.me.client.logic.player_statue.StatuePart; import fzmm.zailer.me.utils.FzmmWikiConstants; import io.wispforest.owo.config.ui.component.ConfigTextBox; import io.wispforest.owo.ui.component.TextBoxComponent; @@ -86,6 +88,10 @@ protected void setup(FlowLayout rootComponent) { ButtonRow.setup(rootComponent, ButtonRow.getButtonId("faq"), true, this::faqExecute); this.executeButton = ButtonRow.setup(rootComponent, ButtonRow.getButtonId(EXECUTE_ID), true, this::execute); this.executeButton.active = this.getTab(selectedTab, IPlayerStatueTab.class).canExecute(); + + ButtonRow.setup(rootComponent, ButtonRow.getButtonId("difficult-to-remove-entity"), true, buttonComponent -> + InvisibleEntityWarning.addOverlay(true, true, Text.translatable("fzmm.snack_bar.entityDifficultToRemove.entity.playerStatue"), StatuePart.PLAYER_STATUE_TAG) + ); } private void faqExecute(ButtonWidget buttonWidget) { diff --git a/src/main/java/fzmm/zailer/me/client/gui/utils/InvisibleEntityWarning.java b/src/main/java/fzmm/zailer/me/client/gui/utils/InvisibleEntityWarning.java index ceacd136..b8ea626f 100644 --- a/src/main/java/fzmm/zailer/me/client/gui/utils/InvisibleEntityWarning.java +++ b/src/main/java/fzmm/zailer/me/client/gui/utils/InvisibleEntityWarning.java @@ -35,7 +35,7 @@ public static void add(boolean isArmorStand, boolean isInvisible, Text customEnt )); } - private static void addOverlay(boolean isArmorStand, boolean isInvisible, Text customEntity, String tag) { + public static void addOverlay(boolean isArmorStand, boolean isInvisible, Text customEntity, String tag) { if (!(MinecraftClient.getInstance().currentScreen instanceof BaseFzmmScreen baseFzmmScreen)) { FzmmClient.LOGGER.warn("[InvisibleEntityWarning] Failed to add overlay, root is not a FlowLayout"); return; diff --git a/src/main/resources/assets/fzmm/owo_ui/player_statue.xml b/src/main/resources/assets/fzmm/owo_ui/player_statue.xml index 0b374963..b5d9dd7d 100644 --- a/src/main/resources/assets/fzmm/owo_ui/player_statue.xml +++ b/src/main/resources/assets/fzmm/owo_ui/player_statue.xml @@ -99,23 +99,31 @@ + - + 4 + 100,0 + + + 3 + 3 +