Skip to content

Commit

Permalink
Merge pull request #520 from P3pp3rF1y/1.21.x-dev
Browse files Browse the repository at this point in the history
Release merge
  • Loading branch information
P3pp3rF1y authored Nov 6, 2024
2 parents e0b3fee + f272a76 commit 80a3ea7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -55,19 +58,9 @@ private ModDataComponents() {
public static final Supplier<DataComponentType<Integer>> FIRST_INVENTORY_SLOT = DATA_COMPONENT_TYPES.register("first_inventory_slot",
() -> new DataComponentType.Builder<Integer>().persistent(Codec.INT).networkSynchronized(ByteBufCodecs.INT).build());

private static final Codec<Set<Direction>> DIRECTION_SET_CODEC = setCodec(Direction.CODEC);
public static <V> Codec<Set<V>> setCodec(Codec<V> elementCodec) {
return setOf(elementCodec);
}

public static <V> Codec<Set<V>> setOf(Codec<V> elementCodec) {
return setFromList(elementCodec.listOf());
}
private static final Codec<Set<Direction>> DIRECTION_SET_CODEC = CodecHelper.setOf(Direction.CODEC);

public static <V> Codec<Set<V>> setFromList(Codec<List<V>> listCodec) {
return listCodec.xmap(HashSet::new, ArrayList::new);
}
private static final StreamCodec<FriendlyByteBuf, Set<Direction>> DIRECTION_SET_STREAM_CODEC = new StreamCodec<>() {
private static final StreamCodec<FriendlyByteBuf, Set<Direction>> DIRECTION_SET_STREAM_CODEC = new StreamCodec<>() {
@Override
public Set<Direction> decode(FriendlyByteBuf buf) {
return buf.readCollection(HashSet::new, b -> b.readEnum(Direction.class));
Expand All @@ -85,12 +78,6 @@ public void encode(FriendlyByteBuf buf, Set<Direction> directions) {
public static final Supplier<DataComponentType<Set<Direction>>> PUSH_DIRECTIONS = DATA_COMPONENT_TYPES.register("push_directions",
() -> new DataComponentType.Builder<Set<Direction>>().persistent(DIRECTION_SET_CODEC).networkSynchronized(DIRECTION_SET_STREAM_CODEC).build());

public static final Supplier<DataComponentType<Boolean>> DIRECTIONS_INTIALIZED = DATA_COMPONENT_TYPES.register("directions_initialized",
() -> new DataComponentType.Builder<Boolean>().persistent(Codec.BOOL).networkSynchronized(ByteBufCodecs.BOOL).build());

public static final Supplier<DataComponentType<FilterAttributes>> INPUT_FILTER_ATTRIBUTES = DATA_COMPONENT_TYPES.register("input_filter_attributes",
() -> new DataComponentType.Builder<FilterAttributes>().persistent(FilterAttributes.CODEC).networkSynchronized(FilterAttributes.STREAM_CODEC).build());

public static final DeferredHolder<DataComponentType<?>, DataComponentType<FilterAttributes>> OUTPUT_FILTER_ATTRIBUTES = DATA_COMPONENT_TYPES.register("output_filter_attributes",
() -> new DataComponentType.Builder<FilterAttributes>().persistent(FilterAttributes.CODEC).networkSynchronized(FilterAttributes.STREAM_CODEC).build());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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ı",
Expand Down

0 comments on commit 80a3ea7

Please sign in to comment.