From 38f4824757ee9b3cd7961ea349bc0cef5341c9b3 Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:59:34 -0600 Subject: [PATCH] Sack finished i think? for now... --- .../actuallyadditions/mod/inventory/SackContainer.java | 9 ++++----- .../mod/inventory/gui/FilterSettingsGui.java | 10 ++++++++-- .../actuallyadditions/mod/inventory/gui/SackGui.java | 2 +- .../resources/assets/actuallyadditions/lang/en_us.json | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java index 60ddd5955..08bc0026e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java @@ -25,6 +25,7 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.ContainerListener; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; import net.neoforged.api.distmarker.Dist; @@ -105,13 +106,12 @@ public class SackContainer extends AbstractContainerMenu implements IButtonReact } } - @Override +/* @Override public void broadcastChanges() { // TODO is this needed anymore? super.broadcastChanges(); if (this.filter.needsUpdateSend() || this.autoInsert != this.oldAutoInsert) { - /* - for (IContainerListener listener : this.containerListeners) { + for (ContainerListener listener : this..containerListeners) { listener.setContainerData(this, 0, this.filter.isWhitelist ? 1 : 0); @@ -129,7 +129,6 @@ public class SackContainer extends AbstractContainerMenu implements IButtonReact ? 1 : 0); } - */ this.filter.updateLasts(); this.oldAutoInsert = this.autoInsert; } @@ -145,7 +144,7 @@ public class SackContainer extends AbstractContainerMenu implements IButtonReact } else if (id == 2) { this.filter.respectMod = data == 1; } - } + }*/ @Override public ItemStack quickMoveStack(@Nonnull Player player, int slot) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java index 6aeb821dc..04cde3a98 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/FilterSettingsGui.java @@ -41,11 +41,17 @@ public class FilterSettingsGui { public FilterSettingsGui(FilterSettings settings, int x, int y, Consumer buttonConsumer, int idOffset) { this.theSettings = settings; - this.whitelistButton = Button.builder(Component.literal("WH"), $ -> buttonClicked(idOffset)) + this.whitelistButton = Button.builder(Component.literal("WH"), $ -> { + theSettings.isWhitelist = !theSettings.isWhitelist; + buttonClicked(idOffset); + }) .bounds(x, y, 16, 12).build(); buttonConsumer.accept(this.whitelistButton); y += 14; - this.modButton = Button.builder(Component.literal("MO"), $ -> buttonClicked(idOffset + 1)) + this.modButton = Button.builder(Component.literal("MO"), $ -> { + theSettings.respectMod = !theSettings.respectMod; + buttonClicked(idOffset + 1); + }) .bounds(x, y, 16, 12).build(); buttonConsumer.accept(this.modButton); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java index 224c6e674..e9587e942 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java @@ -52,7 +52,7 @@ public class SackGui extends AAScreen { public void init() { super.init(); - this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 138, this.topPos + 10, this::addRenderableWidget, 1); + this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 137, this.topPos + 10, this::addRenderableWidget, 1); this.buttonAutoInsert = Button.builder( Component.literal("I") diff --git a/src/main/resources/assets/actuallyadditions/lang/en_us.json b/src/main/resources/assets/actuallyadditions/lang/en_us.json index 5f890bf84..39c9412c6 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_us.json +++ b/src/main/resources/assets/actuallyadditions/lang/en_us.json @@ -382,7 +382,7 @@ "item.actuallyadditions.biocoal": "Bio Coal (wip)", "item.actuallyadditions.player_probe": "Player Probe (wip)", "item.actuallyadditions.worm": "Worm", - "item.actuallyadditions.travelers_sack": "Traveler's Sack (wip)", + "item.actuallyadditions.travelers_sack": "Traveler's Sack", "item.actuallyadditions.bag.storage": "filled slots (wip)", "item.actuallyadditions.void_sack": "Void Sack (wip)", "item.actuallyadditions.crystallized_canola_seed": "Crystallized Canola Seed",