From e91616657a9ce40639912b6ac0000c36cd2f3f49 Mon Sep 17 00:00:00 2001 From: RuyaSavascisi Date: Tue, 24 Sep 2024 21:29:54 +0300 Subject: [PATCH 1/4] Correction for tr_tr.json --- src/main/resources/assets/sophisticatedstorage/lang/tr_tr.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/sophisticatedstorage/lang/tr_tr.json b/src/main/resources/assets/sophisticatedstorage/lang/tr_tr.json index 98228b14..71e6de9d 100644 --- a/src/main/resources/assets/sophisticatedstorage/lang/tr_tr.json +++ b/src/main/resources/assets/sophisticatedstorage/lang/tr_tr.json @@ -10,7 +10,7 @@ "wood_name.sophisticatedstorage.warped": "Çarpık", "wood_name.sophisticatedstorage.cherry": "Kiraz Ağacı", "wood_name.sophisticatedstorage.bamboo": "Bambu", - "itemGroup.sophisticatedstorage": "Sophisticated Depo", + "itemGroup.sophisticatedstorage": "Sophisticated Storage", "item.sophisticatedstorage.packing_tape": "Paketleme Bandı", "item.sophisticatedstorage.packing_tape.tooltip": "Kalan kullanım: %s", "item.sophisticatedstorage.packing_tape.tooltip.disabled": "Devre dışı - yapılandırma tüm depoları paketlenmiş olarak bırakmaya ayarlı", From 6883da9738c62425a676facb022c674f0dacc0bf Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Tue, 5 Nov 2024 01:23:50 +0100 Subject: [PATCH 2/4] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20Polish=20l?= =?UTF-8?q?ist/set=20data=20component=20types=20a=20bit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../init/ModDataComponents.java | 25 +++++-------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/gradle.properties b/gradle.properties index 303fc18c..5b9fa3e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version_range=[4,) mod_id=sophisticatedstorage mod_name=Sophisticated Storage mod_license=GNU General Public License v3.0 -mod_version=0.10.46 +mod_version=0.10.47 mod_group_id=sophisticatedstorage mod_authors=P3pp3rF1y, Ridanisaurus mod_description=Fancy and functional storage containers. diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedstorage/init/ModDataComponents.java b/src/main/java/net/p3pp3rf1y/sophisticatedstorage/init/ModDataComponents.java index 34360617..62aedf93 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedstorage/init/ModDataComponents.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedstorage/init/ModDataComponents.java @@ -14,13 +14,16 @@ import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; import net.p3pp3rf1y.sophisticatedcore.upgrades.FilterAttributes; +import net.p3pp3rf1y.sophisticatedcore.util.CodecHelper; import net.p3pp3rf1y.sophisticatedstorage.SophisticatedStorage; import net.p3pp3rf1y.sophisticatedstorage.block.BarrelMaterial; import net.p3pp3rf1y.sophisticatedstorage.item.BarrelBlockItem; import net.p3pp3rf1y.sophisticatedstorage.item.StorageToolItem; import net.p3pp3rf1y.sophisticatedstorage.item.WoodStorageBlockItem; -import java.util.*; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import java.util.function.Supplier; public class ModDataComponents { @@ -55,19 +58,9 @@ private ModDataComponents() { public static final Supplier> FIRST_INVENTORY_SLOT = DATA_COMPONENT_TYPES.register("first_inventory_slot", () -> new DataComponentType.Builder().persistent(Codec.INT).networkSynchronized(ByteBufCodecs.INT).build()); - private static final Codec> DIRECTION_SET_CODEC = setCodec(Direction.CODEC); - public static Codec> setCodec(Codec elementCodec) { - return setOf(elementCodec); - } - - public static Codec> setOf(Codec elementCodec) { - return setFromList(elementCodec.listOf()); - } + private static final Codec> DIRECTION_SET_CODEC = CodecHelper.setOf(Direction.CODEC); - public static Codec> setFromList(Codec> listCodec) { - return listCodec.xmap(HashSet::new, ArrayList::new); - } - private static final StreamCodec> DIRECTION_SET_STREAM_CODEC = new StreamCodec<>() { + private static final StreamCodec> DIRECTION_SET_STREAM_CODEC = new StreamCodec<>() { @Override public Set decode(FriendlyByteBuf buf) { return buf.readCollection(HashSet::new, b -> b.readEnum(Direction.class)); @@ -85,12 +78,6 @@ public void encode(FriendlyByteBuf buf, Set directions) { public static final Supplier>> PUSH_DIRECTIONS = DATA_COMPONENT_TYPES.register("push_directions", () -> new DataComponentType.Builder>().persistent(DIRECTION_SET_CODEC).networkSynchronized(DIRECTION_SET_STREAM_CODEC).build()); - public static final Supplier> DIRECTIONS_INTIALIZED = DATA_COMPONENT_TYPES.register("directions_initialized", - () -> new DataComponentType.Builder().persistent(Codec.BOOL).networkSynchronized(ByteBufCodecs.BOOL).build()); - - public static final Supplier> INPUT_FILTER_ATTRIBUTES = DATA_COMPONENT_TYPES.register("input_filter_attributes", - () -> new DataComponentType.Builder().persistent(FilterAttributes.CODEC).networkSynchronized(FilterAttributes.STREAM_CODEC).build()); - public static final DeferredHolder, DataComponentType> OUTPUT_FILTER_ATTRIBUTES = DATA_COMPONENT_TYPES.register("output_filter_attributes", () -> new DataComponentType.Builder().persistent(FilterAttributes.CODEC).networkSynchronized(FilterAttributes.STREAM_CODEC).build()); From 9d42dbbde9326a0ce994690f32d22c18f3197baa Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Wed, 6 Nov 2024 22:21:51 +0100 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20Make=20sur?= =?UTF-8?q?e=20to=20set=20immutable=20Sets=20when=20updating=20component?= =?UTF-8?q?=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../upgrades/hopper/HopperUpgradeWrapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedstorage/upgrades/hopper/HopperUpgradeWrapper.java b/src/main/java/net/p3pp3rf1y/sophisticatedstorage/upgrades/hopper/HopperUpgradeWrapper.java index 02902101..0a573232 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedstorage/upgrades/hopper/HopperUpgradeWrapper.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedstorage/upgrades/hopper/HopperUpgradeWrapper.java @@ -226,12 +226,12 @@ public void setPushingTo(Direction direction, boolean isPushing) { } private void serializePullDirections() { - upgrade.set(ModDataComponents.PULL_DIRECTIONS, pullDirections); + upgrade.set(ModDataComponents.PULL_DIRECTIONS, Set.copyOf(pullDirections)); save(); } private void serializePushDirections() { - upgrade.set(ModDataComponents.PUSH_DIRECTIONS, pushDirections); + upgrade.set(ModDataComponents.PUSH_DIRECTIONS, Set.copyOf(pushDirections)); save(); } From f272a76e99ab71353e5eea15fe2b97457ba3ce61 Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Wed, 6 Nov 2024 23:42:43 +0100 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fixed=20sorting=20to?= =?UTF-8?q?=20trigger=20when=20cursor=20is=20anywhere=20outside=20of=20sto?= =?UTF-8?q?rage=20slots.=20Fixes=20the=20behavior=20where=20sorting=20mods?= =?UTF-8?q?=20would=20sort=20sophisticated=20inventories=20when=20middle?= =?UTF-8?q?=20click=20is=20used=20with=20cursor=20outside=20of=20any=20slo?= =?UTF-8?q?t=20which=20caused=20item=20loss=20for=20example=20when=20stack?= =?UTF-8?q?=20upgrades=20were=20used.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../sophisticatedstorage/client/ClientEventHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5b9fa3e3..cc7800b7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version_range=[4,) mod_id=sophisticatedstorage mod_name=Sophisticated Storage mod_license=GNU General Public License v3.0 -mod_version=0.10.47 +mod_version=0.10.48 mod_group_id=sophisticatedstorage mod_authors=P3pp3rF1y, Ridanisaurus mod_description=Fancy and functional storage containers. diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedstorage/client/ClientEventHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedstorage/client/ClientEventHandler.java index 19894f18..72f8e422 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedstorage/client/ClientEventHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedstorage/client/ClientEventHandler.java @@ -217,7 +217,7 @@ private static boolean tryCallSort(Screen gui) { double mouseX = mh.xpos() * mc.getWindow().getGuiScaledWidth() / mc.getWindow().getScreenWidth(); double mouseY = mh.ypos() * mc.getWindow().getGuiScaledHeight() / mc.getWindow().getScreenHeight(); Slot selectedSlot = screen.findSlot(mouseX, mouseY); - if (selectedSlot != null && container.isNotPlayersInventorySlot(selectedSlot.index)) { + if (selectedSlot == null || container.isNotPlayersInventorySlot(selectedSlot.index)) { container.sort(); return true; }