From d53e9d703f09d7786b1391512bc957bf2fd2de2e Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sun, 22 Dec 2024 10:05:17 -0800 Subject: [PATCH 1/3] Fix new Expanded Remote buttons saving their settings --- gradle.properties | 2 +- .../storagenetwork/gui/ContainerNetwork.java | 4 ++++ .../item/remote/ItemRemote.java | 1 - .../network/SettingsSyncMessage.java | 20 ++++++------------- update.json | 3 ++- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7b8b74e0..1fd009c7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ org.gradle.daemon=false mod_id=storagenetwork curse_id=268495 -mod_version=1.12.1 +mod_version=1.12.2 mc_version=1.20.1 diff --git a/src/main/java/com/lothrazar/storagenetwork/gui/ContainerNetwork.java b/src/main/java/com/lothrazar/storagenetwork/gui/ContainerNetwork.java index 39007af5..30d993a4 100644 --- a/src/main/java/com/lothrazar/storagenetwork/gui/ContainerNetwork.java +++ b/src/main/java/com/lothrazar/storagenetwork/gui/ContainerNetwork.java @@ -63,6 +63,10 @@ public void setCraftMatrix(NetworkCraftingInventory matrixIn) { public abstract boolean isCrafting(); + public ItemStack getRemote() { // semi-abstract + return ItemStack.EMPTY; + } + public Slot getResultSlot() { return result; } diff --git a/src/main/java/com/lothrazar/storagenetwork/item/remote/ItemRemote.java b/src/main/java/com/lothrazar/storagenetwork/item/remote/ItemRemote.java index e6baacc8..f3ba2bd4 100644 --- a/src/main/java/com/lothrazar/storagenetwork/item/remote/ItemRemote.java +++ b/src/main/java/com/lothrazar/storagenetwork/item/remote/ItemRemote.java @@ -30,7 +30,6 @@ public class ItemRemote extends ItemFlib implements MenuProvider { public static final String NBT_JEI = TileRequest.NBT_JEI; - public static final String NBT_BOUND = "bound"; public static final String NBT_SORT = "sort"; public static final String NBT_DOWN = "down"; diff --git a/src/main/java/com/lothrazar/storagenetwork/network/SettingsSyncMessage.java b/src/main/java/com/lothrazar/storagenetwork/network/SettingsSyncMessage.java index 96e6018d..4c95440d 100644 --- a/src/main/java/com/lothrazar/storagenetwork/network/SettingsSyncMessage.java +++ b/src/main/java/com/lothrazar/storagenetwork/network/SettingsSyncMessage.java @@ -3,6 +3,7 @@ import java.util.function.Supplier; import com.lothrazar.storagenetwork.api.EnumSortType; import com.lothrazar.storagenetwork.api.ITileNetworkSync; +import com.lothrazar.storagenetwork.gui.ContainerNetwork; import com.lothrazar.storagenetwork.item.remote.ContainerNetworkCraftingRemote; import com.lothrazar.storagenetwork.item.remote.ContainerNetworkRemote; import com.lothrazar.storagenetwork.item.remote.ItemRemote; @@ -35,29 +36,20 @@ public SettingsSyncMessage(BlockPos pos, boolean direction, EnumSortType sort, b public static void handle(SettingsSyncMessage message, Supplier ctx) { ctx.get().enqueueWork(() -> { ServerPlayer player = ctx.get().getSender(); - //TODO: how to refactor this + /// is it a block? if (message.targetTileEntity) { BlockEntity tileEntity = player.level().getBlockEntity(message.pos); - if (tileEntity instanceof ITileNetworkSync) { - ITileNetworkSync tile = (ITileNetworkSync) tileEntity; + if (tileEntity instanceof ITileNetworkSync tile) { tile.setSort(message.sort); tile.setDownwards(message.direction); tile.setJeiSearchSynced(message.jeiSync); tile.setAutoFocus(message.autoFocus); tileEntity.setChanged(); } - } - else if (player.containerMenu instanceof ContainerNetworkCraftingRemote remoteContainer) { + } // else is it an item? + else if (player.containerMenu instanceof ContainerNetwork remoteContainer) { ItemStack stackPlayerHeld = remoteContainer.getRemote(); - if (stackPlayerHeld.getItem() instanceof ItemRemote) { - ItemRemote.setSort(stackPlayerHeld, message.sort); - ItemRemote.setDownwards(stackPlayerHeld, message.direction); - ItemRemote.setJeiSearchSynced(stackPlayerHeld, message.jeiSync); - ItemRemote.setAutoFocus(stackPlayerHeld, message.autoFocus); - } - } - else if (player.containerMenu instanceof ContainerNetworkRemote rcc) { - ItemStack stackPlayerHeld = rcc.getRemote(); + //if it passes the instanceof check, we also know it is not-Empty if (stackPlayerHeld.getItem() instanceof ItemRemote) { ItemRemote.setSort(stackPlayerHeld, message.sort); ItemRemote.setDownwards(stackPlayerHeld, message.direction); diff --git a/update.json b/update.json index 470cd88d..0a9b715d 100644 --- a/update.json +++ b/update.json @@ -1,7 +1,7 @@ { "homepage": "https://www.curseforge.com/minecraft/mc-mods/simple-storage-network", "promos": { - "1.20.1-latest": "1.12.1" + "1.20.1-latest": "1.12.2" }, "1.20.1": { "1.10.0":"Ported to 1.20.1, depends on flib-0.0.7+ . Fixed patchouli book. Port to new non-deprecated curios datapack tags. Includes pull requests merged into the 1.18 and 1.19 branches : Merge pull request #492 from IIpragmaII/trunk/1.18 @IIpragmaII @VasurTrekkson Improved performance for export node. fix priority german translation @lightlike . Fixed recipes not showing when pressing the JEI recipe key @Demerso. Create uk_ua.json @SKZGx " @@ -14,5 +14,6 @@ ,"1.11.3":"Fixed item tooltips not rendering in Storage Remote. Fixed visual rendering and text errors inside of import/export cables using the 'operation upgrade'" ,"1.12.0":"Added a new Expanded Request Table and the Expanded Remote to support GUI Scale 2 or larger for players on large monitors/resolutions. Internal refactoring for Import and Export cable capabilities: item transactions are now executed inside the cable tile-entities instead of the main node tile-entity (meaning the main root node is doing less processing work, and also the network overall should have fewer wasted cycles). " ,"1.12.1": "Fix JEI/EMI recipe autocomplete" + ,"1.12.2": "Fix new Expanded Remote buttons saving their settings" } } From 9455e39c6ddb49645bab995d10360fc3bef1b914 Mon Sep 17 00:00:00 2001 From: Dima Lisovenko Date: Tue, 4 Nov 2025 18:15:07 +0100 Subject: [PATCH 2/3] Resolve gradle.properties to tag version --- gradle.properties | 41 ++----------------- .../cable/export/ScreenCableExportFilter.java | 11 +++++ .../block/cable/export/TileCableExport.java | 3 +- .../CapabilityConnectableAutoIO.java | 36 ++++++++++++++++ 4 files changed, 52 insertions(+), 39 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1fd009c7..6a950751 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,37 +1,4 @@ -# Sets default memory used for gradle commands. Can be overridden by user or command line properties. -# This is required to provide enough memory for the Minecraft decompilation process. -org.gradle.jvmargs=-Xmx6G -org.gradle.daemon=false - - -#use this if the gradle build has ' Could not find tools.jar. Please check that _____ contains a valid JDK installation ' -#org.gradle.java.home=C:\\Program Files\\Eclipse Adoptium\\jdk-8.0.322.6-hotspot - -# as needed run/server.properties : online-mode=false -# implementation fg.deobf("curse.maven:simple-storage-network-268495:3163007") - - -mod_id=storagenetwork -curse_id=268495 -mod_version=1.12.2 - -mc_version=1.20.1 - -# NEO -forge_version=47.1.104 - -mod_name=storagenetwork -mod_group_id=com.lothrazar.storagenetwork - -mapping_channel=official -mapping_version=1.20.1 - - -flib_version=0.0.14 -flib_file=5495793 -patchouli_version=84 -jei_version=15.3.0.4 -emi_version=1.0.21 -curios_version=5.7.2 - - +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.configuration-cache=true +org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true \ No newline at end of file diff --git a/src/main/java/com/lothrazar/storagenetwork/block/cable/export/ScreenCableExportFilter.java b/src/main/java/com/lothrazar/storagenetwork/block/cable/export/ScreenCableExportFilter.java index 202f1f46..517f78e4 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/cable/export/ScreenCableExportFilter.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/cable/export/ScreenCableExportFilter.java @@ -36,6 +36,7 @@ public class ScreenCableExportFilter extends AbstractContainerScreen itemSlotsGhost; private ButtonRequest btnOperationToggle; @@ -73,6 +74,10 @@ public void init() { this.syncData(+1); }, DEFAULT_NARRATION)); btnPlus.setTextureId(TextureEnum.PLUS); + btnAllowIgn = addRenderableWidget(new ButtonRequest(leftPos + 152, topPos + 24, "", (p) -> { + this.isAllowlist = !this.isAllowlist; + this.syncData(0); + }, DEFAULT_NARRATION)); btnImport = addRenderableWidget(new ButtonRequest(leftPos + 80, topPos + 4, "", (p) -> { importFilterSlots(); }, DEFAULT_NARRATION)); @@ -115,6 +120,7 @@ public void render(GuiGraphics ms, int mouseX, int mouseY, float partialTicks) { btnRedstone.setTextureId(containerCableLink.cap.needsRedstone() ? TextureEnum.REDSTONETRUE : TextureEnum.REDSTONEFALSE); btnOperationToggle.visible = this.isOperationMode(); txtHeight.visible = btnOperationToggle.active = btnOperationToggle.visible; + btnAllowIgn.setTextureId(this.isAllowlist ? TextureEnum.ALLOWLIST : TextureEnum.IGNORELIST); } @Override @@ -142,6 +148,11 @@ private void drawTooltips(GuiGraphics ms, final int mouseX, final int mouseY) { ms.renderTooltip(font, Lists.newArrayList(Component.translatable("gui.storagenetwork.import")), Optional.empty(), mouseX - leftPos, mouseY - topPos); } + if (btnAllowIgn != null && btnAllowIgn.isMouseOver(mouseX, mouseY)) { + ms.renderTooltip(font, + Lists.newArrayList(Component.translatable(this.isAllowlist ? "gui.storagenetwork.allowlist" : "gui.storagenetwork.ignorelist")), + Optional.empty(), mouseX - leftPos, mouseY - topPos); + } if (btnMinus != null && btnMinus.isMouseOver(mouseX, mouseY)) { ms.renderTooltip(font, Lists.newArrayList(Component.translatable("gui.storagenetwork.priority.down")), Optional.empty(), mouseX - leftPos, mouseY - topPos); diff --git a/src/main/java/com/lothrazar/storagenetwork/block/cable/export/TileCableExport.java b/src/main/java/com/lothrazar/storagenetwork/block/cable/export/TileCableExport.java index 54d4f7f5..dad5bd50 100644 --- a/src/main/java/com/lothrazar/storagenetwork/block/cable/export/TileCableExport.java +++ b/src/main/java/com/lothrazar/storagenetwork/block/cable/export/TileCableExport.java @@ -26,7 +26,7 @@ public class TileCableExport extends TileCableWithFacing implements MenuProvider public TileCableExport(BlockPos pos, BlockState state) { super(SsnRegistry.Tiles.EXPORT_KABEL.get(), pos, state); this.ioStorage = new CapabilityConnectableAutoIO(this, EnumStorageDirection.OUT); - this.ioStorage.getFilter().isAllowList = true; + this.ioStorage.getFilter().isAllowList = true; // default only; let NBT override } @Override @@ -50,7 +50,6 @@ public void load(CompoundTag compound) { super.load(compound); this.ioStorage.deserializeNBT(compound.getCompound("ioStorage")); ioStorage.upgrades.deserializeNBT(compound.getCompound("upgrades")); - this.ioStorage.getFilter().isAllowList = true; } @Override diff --git a/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableAutoIO.java b/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableAutoIO.java index 388cb528..c23a0fa0 100644 --- a/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableAutoIO.java +++ b/src/main/java/com/lothrazar/storagenetwork/capability/CapabilityConnectableAutoIO.java @@ -190,6 +190,9 @@ public ItemStack insertStack(ItemStack stack, boolean simulate) { if (direction == EnumStorageDirection.IN) { return stack; } + if (stack != null && !stack.isEmpty() && filters != null && filters.isStackFiltered(stack)) { + return stack; + } if (inventoryFace == null) { return stack; } @@ -375,6 +378,39 @@ public RequestBatch runExport(TileMain main) { if (this.ioDirection() != EnumStorageDirection.OUT) { // TODO: redundant? return null; } + + // blacklist + if (!filters.isAllowList) { + RequestBatch batch = new RequestBatch(); + + for (ItemStack s : main.getNetwork().getStacks(true)) { + if (s == null || s.isEmpty()) continue; + if (filters.isStackFiltered(s)) continue; + + Request req = new Request(this); + + if (isStockMode()) { + try { + if (inventoryFace == null) continue; + DimPos invPos = connectable.getPos().offset(inventoryFace); + IItemHandler target = invPos.getCapability(ForgeCapabilities.ITEM_HANDLER, inventoryFace.getOpposite()); + int stillNeeds = UtilInventory.containsAtLeastHowManyNeeded(target, s, s.getCount()); + if (stillNeeds == 0) continue; + req.setCount(Math.min(stillNeeds, req.getCount())); + } catch (Throwable e) { + StorageNetworkMod.LOGGER.error("Error from connected block", e); + continue; + } + } + + if (req.getCount() > 0) { + batch.put(s.getItem(), req); + } + } + return batch; + } + + // whitelist RequestBatch requestBatch = new RequestBatch(); for (IItemStackMatcher matcher : this.getAutoExportList()) { if (matcher.getStack().isEmpty()) { From d0c0c5e505b39cadf295e4611705f29e55d3d817 Mon Sep 17 00:00:00 2001 From: Dima Lisovenko Date: Tue, 4 Nov 2025 19:01:46 +0100 Subject: [PATCH 3/3] Build: add missing props/deps; target 1.20.1 --- gradle.properties | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6a950751..ee2abb0a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,24 @@ -org.gradle.parallel=true -org.gradle.caching=true -org.gradle.configuration-cache=true -org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true \ No newline at end of file +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +org.gradle.jvmargs=-Xmx6G +org.gradle.daemon=false + +mod_id=storagenetwork +curse_id=268495 +mod_version=1.12.2 +mc_version=1.20.1 + +# NEO +forge_version=47.1.104 + +mod_name=storagenetwork +mod_group_id=com.lothrazar.storagenetwork + +mapping_channel=official +mapping_version=1.20.1 + +flib_version=0.0.14 +flib_file=5495793 +patchouli_version=84 +jei_version=15.3.0.4 +emi_version=1.0.21 +curios_version=5.7.2