Skip to content

Commit

Permalink
Add a "Difficult-to-remove entity" button to the Player Statue screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Zailer43 committed Sep 14, 2024
1 parent e36b2ce commit 35da459
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 14 additions & 6 deletions src/main/resources/assets/fzmm/owo_ui/player_statue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,31 @@

<fzmm.styled-flow-layout direction="horizontal">
<children>
<button id="difficult-to-remove-entity-button">
<text translate="true">fzmm.snack_bar.entityDifficultToRemove.title</text>

<sizing>
<vertical method="fixed">16</vertical>
</sizing>
</button>

<button id="faq-button">
<text translate="true">fzmm.gui.button.faq</text>

<margins>
<right>3</right>
<top>3</top>
</margins>

<sizing>
<vertical method="fixed">16</vertical>
</sizing>
</button>

</children>

<gap>4</gap>

<positioning type="relative">100,0</positioning>

<padding>
<right>3</right>
<top>3</top>
</padding>
</fzmm.styled-flow-layout>
</children>

Expand Down

0 comments on commit 35da459

Please sign in to comment.