diff --git a/gradle.properties b/gradle.properties index 303fc18c..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.46 +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; } 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()); 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(); } 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ı",