diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/StorageState.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/StorageState.java new file mode 100644 index 000000000..339cb4c8e --- /dev/null +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/StorageState.java @@ -0,0 +1,49 @@ +package com.refinedmods.refinedstorage2.api.network.impl.node; + +import com.refinedmods.refinedstorage2.api.storage.Storage; +import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorage; + +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.3") +public enum StorageState { + /** + * There is no storage in the container. + */ + NONE, + /** + * There is a storage present in the container, but the container is inactive. + */ + INACTIVE, + /** + * The storage is active and has enough capacity to store more resources. + */ + NORMAL, + /** + * The storage is active and has less than 25% capacity left. + */ + NEAR_CAPACITY, + /** + * The storage is active and full. + */ + FULL; + + private static final double NEAR_CAPACITY_THRESHOLD = .75; + + public static StorageState compute(final Storage storage) { + if (storage instanceof LimitedStorage limitedStorage) { + return compute(limitedStorage.getCapacity(), storage.getStored()); + } + return StorageState.NORMAL; + } + + private static StorageState compute(final long capacity, final long stored) { + final double fullness = stored / (double) capacity; + if (fullness >= 1D) { + return FULL; + } else if (fullness >= NEAR_CAPACITY_THRESHOLD) { + return NEAR_CAPACITY; + } + return NORMAL; + } +} diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageInternalStorage.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageInternalStorage.java index c6e5a8e26..2d25d90fd 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageInternalStorage.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageInternalStorage.java @@ -1,11 +1,11 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.multistorage; import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.impl.node.StorageState; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.Actor; import com.refinedmods.refinedstorage2.api.storage.Storage; import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannelType; -import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorage; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorage; @@ -14,13 +14,11 @@ import javax.annotation.Nullable; public class MultiStorageInternalStorage implements TrackedStorage { - private static final double NEAR_CAPACITY_THRESHOLD = .75; - private final Storage delegate; private final StorageChannelType storageChannelType; @Nullable private final MultiStorageListener listener; - private MultiStorageStorageState state; + private StorageState state; public MultiStorageInternalStorage(final Storage delegate, final StorageChannelType storageChannelType, @@ -28,33 +26,19 @@ public MultiStorageInternalStorage(final Storage delegate, this.delegate = delegate; this.storageChannelType = storageChannelType; this.listener = listener; - this.state = computeState(); + this.state = getState(); } - public StorageChannelType getStorageChannelType() { - return storageChannelType; + StorageState getState() { + return StorageState.compute(delegate); } - public MultiStorageStorageState computeState() { - if (delegate instanceof LimitedStorage limitedStorage) { - return computeState(limitedStorage.getCapacity()); - } - return MultiStorageStorageState.NORMAL; - } - - private MultiStorageStorageState computeState(final long capacity) { - final double fullness = (double) delegate.getStored() / capacity; - if (fullness >= 1D) { - return MultiStorageStorageState.FULL; - } else if (fullness >= NEAR_CAPACITY_THRESHOLD) { - return MultiStorageStorageState.NEAR_CAPACITY; - } else { - return MultiStorageStorageState.NORMAL; - } + public StorageChannelType getStorageChannelType() { + return storageChannelType; } private void checkStateChanged() { - final MultiStorageStorageState currentState = computeState(); + final StorageState currentState = getState(); if (state != currentState) { this.state = currentState; notifyListener(); diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNode.java index fd767b6bf..6502eb383 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNode.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.multistorage; import com.refinedmods.refinedstorage2.api.network.component.StorageProvider; +import com.refinedmods.refinedstorage2.api.network.impl.node.StorageState; import com.refinedmods.refinedstorage2.api.network.node.AbstractStorageNetworkNode; import com.refinedmods.refinedstorage2.api.storage.Storage; import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannelType; @@ -169,17 +170,15 @@ public int getSize() { return cache.length; } - public MultiStorageStorageState getState(final int index) { - return computeState(cache[index]); - } - - private MultiStorageStorageState computeState(@Nullable final MultiStorageInternalStorage internalStorage) { - if (internalStorage == null) { - return MultiStorageStorageState.NONE; - } else if (!isActive()) { - return MultiStorageStorageState.INACTIVE; + public StorageState getState(final int index) { + final var storage = cache[index]; + if (storage == null) { + return StorageState.NONE; + } + if (!isActive()) { + return StorageState.INACTIVE; } - return internalStorage.computeState(); + return storage.getState(); } @Override diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageStorageState.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageStorageState.java deleted file mode 100644 index 2eb2532c1..000000000 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageStorageState.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.refinedmods.refinedstorage2.api.network.impl.node.multistorage; - -public enum MultiStorageStorageState { - NONE, - INACTIVE, - NORMAL, - NEAR_CAPACITY, - FULL -} diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNodeTest.java index 188cfafef..2b63381e8 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNodeTest.java @@ -3,6 +3,7 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.core.filter.FilterMode; import com.refinedmods.refinedstorage2.api.network.Network; +import com.refinedmods.refinedstorage2.api.network.impl.node.StorageState; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.AccessMode; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; @@ -124,7 +125,7 @@ void testInitialState(@InjectNetworkStorageChannel final StorageChannel assertThat(networkStorage.getStored()).isZero(); assertThat(sut.getSize()).isEqualTo(9); for (int i = 0; i < 9; ++i) { - assertThat(sut.getState(i)).isEqualTo(MultiStorageStorageState.NONE); + assertThat(sut.getState(i)).isEqualTo(StorageState.NONE); } } @@ -153,18 +154,14 @@ void testState(final boolean active) { sut.setActive(active); // Assert - assertThat(sut.getState(0)).isEqualTo(MultiStorageStorageState.NONE); - assertThat(sut.getState(1)).isEqualTo(MultiStorageStorageState.NONE); - assertThat(sut.getState(2)).isEqualTo( - active ? MultiStorageStorageState.NORMAL : MultiStorageStorageState.INACTIVE); - assertThat(sut.getState(3)).isEqualTo( - active ? MultiStorageStorageState.NORMAL : MultiStorageStorageState.INACTIVE); - assertThat(sut.getState(4)).isEqualTo(MultiStorageStorageState.NONE); - assertThat(sut.getState(5)).isEqualTo( - active ? MultiStorageStorageState.NEAR_CAPACITY : MultiStorageStorageState.INACTIVE); - assertThat(sut.getState(6)).isEqualTo(MultiStorageStorageState.NONE); - assertThat(sut.getState(7)).isEqualTo( - active ? MultiStorageStorageState.FULL : MultiStorageStorageState.INACTIVE); + assertThat(sut.getState(0)).isEqualTo(StorageState.NONE); + assertThat(sut.getState(1)).isEqualTo(StorageState.NONE); + assertThat(sut.getState(2)).isEqualTo(active ? StorageState.NORMAL : StorageState.INACTIVE); + assertThat(sut.getState(3)).isEqualTo(active ? StorageState.NORMAL : StorageState.INACTIVE); + assertThat(sut.getState(4)).isEqualTo(StorageState.NONE); + assertThat(sut.getState(5)).isEqualTo(active ? StorageState.NEAR_CAPACITY : StorageState.INACTIVE); + assertThat(sut.getState(6)).isEqualTo(StorageState.NONE); + assertThat(sut.getState(7)).isEqualTo(active ? StorageState.FULL : StorageState.INACTIVE); assertThat(sut.getEnergyUsage()).isEqualTo(BASE_USAGE + (USAGE_PER_STORAGE * 4)); } @@ -246,7 +243,7 @@ void shouldNotDetectStorageChangeInInvalidIndex() { // Assert assertThat(sut.getSize()).isEqualTo(9); for (int i = 0; i < 9; ++i) { - assertThat(sut.getState(i)).isEqualTo(MultiStorageStorageState.NONE); + assertThat(sut.getState(i)).isEqualTo(StorageState.NONE); } } diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/AbstractStorageContainerItem.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/AbstractStorageContainerItem.java index ea09277b1..91b7399e7 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/AbstractStorageContainerItem.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/AbstractStorageContainerItem.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage2.platform.api.storage; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.api.storage.TypedStorage; import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannelType; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageContainerItem.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageContainerItem.java index dae2a1f27..05e58b027 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageContainerItem.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageContainerItem.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage2.platform.api.storage; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.api.storage.TypedStorage; import java.util.Optional; diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageContainerItemHelper.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageContainerItemHelper.java index 41434304f..40f83750d 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageContainerItemHelper.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageContainerItemHelper.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage2.platform.api.storage; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import java.util.List; import java.util.Map; diff --git a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/StorageInfo.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageInfo.java similarity index 62% rename from refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/StorageInfo.java rename to refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageInfo.java index 7c8eb60cb..c9f7007b3 100644 --- a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/StorageInfo.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageInfo.java @@ -1,5 +1,6 @@ -package com.refinedmods.refinedstorage2.api.storage; +package com.refinedmods.refinedstorage2.platform.api.storage; +import com.refinedmods.refinedstorage2.api.storage.Storage; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorage; import org.apiguardian.api.API; @@ -8,10 +9,10 @@ public record StorageInfo(long stored, long capacity) { public static final StorageInfo UNKNOWN = new StorageInfo(0, 0); - public static StorageInfo of(final Storage storage) { + public static StorageInfo of(final Storage storage) { return new StorageInfo( storage.getStored(), - storage instanceof LimitedStorage limitedStorage ? limitedStorage.getCapacity() : 0L + storage instanceof LimitedStorage limitedStorage ? limitedStorage.getCapacity() : 0L ); } } diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageRepository.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageRepository.java index af3008343..015e6d478 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageRepository.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/storage/StorageRepository.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage2.platform.api.storage; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import java.util.Optional; import java.util.UUID; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/ClientStorageRepository.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/ClientStorageRepository.java index 330d2fa6a..fb446db0b 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/ClientStorageRepository.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/ClientStorageRepository.java @@ -2,7 +2,7 @@ import com.refinedmods.refinedstorage2.api.core.CoreValidations; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.storage.StorageRepository; import java.util.HashMap; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageContainerItemHelperImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageContainerItemHelperImpl.java index b93cc8c3d..dbe9bd476 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageContainerItemHelperImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageContainerItemHelperImpl.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedstorage2.platform.common.storage; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; import com.refinedmods.refinedstorage2.platform.api.storage.ItemTransferableStorageBlockEntity; import com.refinedmods.refinedstorage2.platform.api.storage.StorageContainerItemHelper; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.storage.StorageRepository; import java.util.Collections; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImpl.java index 34f75ae7f..c08e6d259 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImpl.java @@ -2,8 +2,8 @@ import com.refinedmods.refinedstorage2.api.core.CoreValidations; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.storage.SerializableStorage; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.storage.StorageRepository; import com.refinedmods.refinedstorage2.platform.api.storage.StorageType; import com.refinedmods.refinedstorage2.platform.api.support.registry.PlatformRegistry; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java index b5b8ecdd3..75cf6ea63 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedstorage2.platform.common.storage.diskdrive; +import com.refinedmods.refinedstorage2.api.network.impl.node.StorageState; import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageListener; import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageStorageState; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; import com.refinedmods.refinedstorage2.platform.common.Platform; import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; @@ -220,16 +220,16 @@ private void fromClientTag(final CompoundTag tag) { final CompoundTag diskTag = disksList.getCompound(i); disks[i] = BuiltInRegistries.ITEM.getHolder(diskTag.getInt(TAG_DISK_ITEM_ID)) .map(item -> new DiskDriveDisk(item.value(), getState(diskTag))) - .orElse(new DiskDriveDisk(null, MultiStorageStorageState.NONE)); + .orElse(new DiskDriveDisk(null, StorageState.NONE)); } onDriveStateUpdated(); } - private MultiStorageStorageState getState(final CompoundTag tag) { + private StorageState getState(final CompoundTag tag) { final int stateOrdinal = tag.getByte(TAG_DISK_STATE); - final MultiStorageStorageState[] values = MultiStorageStorageState.values(); + final StorageState[] values = StorageState.values(); if (stateOrdinal < 0 || stateOrdinal >= values.length) { - return MultiStorageStorageState.NONE; + return StorageState.NONE; } return values[stateOrdinal]; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntityRenderer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntityRenderer.java index d639de307..6b3010051 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntityRenderer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntityRenderer.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.storage.diskdrive; -import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageStorageState; +import com.refinedmods.refinedstorage2.api.network.impl.node.StorageState; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; import com.refinedmods.refinedstorage2.platform.common.support.render.CubeBuilder; @@ -94,7 +94,7 @@ private void renderDisk(final PoseStack poseStack, final int y, final int x, final DiskDriveDisk disk) { - if (disk.state() == MultiStorageStorageState.NONE) { + if (disk.state() == StorageState.NONE) { return; } final int color = getColor(disk.state()); @@ -119,7 +119,7 @@ private void renderDisk(final PoseStack poseStack, ); } - private int getColor(final MultiStorageStorageState state) { + private int getColor(final StorageState state) { return switch (state) { case NONE -> 0; case INACTIVE -> 0x323232; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveContainerMenu.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveContainerMenu.java index 077ef877a..9f9b2bf30 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveContainerMenu.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveContainerMenu.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedstorage2.platform.common.storage.diskdrive; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; import com.refinedmods.refinedstorage2.platform.api.storage.StorageContainerItem; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceContainer; import com.refinedmods.refinedstorage2.platform.common.content.Menus; import com.refinedmods.refinedstorage2.platform.common.storage.AbstractStorageContainerMenu; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveDisk.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveDisk.java index 1e7759a20..1353b3cc2 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveDisk.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/DiskDriveDisk.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedstorage2.platform.common.storage.diskdrive; -import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageStorageState; +import com.refinedmods.refinedstorage2.api.network.impl.node.StorageState; import javax.annotation.Nullable; import net.minecraft.world.item.Item; -public record DiskDriveDisk(@Nullable Item item, MultiStorageStorageState state) { +public record DiskDriveDisk(@Nullable Item item, StorageState state) { } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/EmptyStorageDiskInfoAccessor.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/EmptyStorageDiskInfoAccessor.java index b43cde2a9..0f6e45bf6 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/EmptyStorageDiskInfoAccessor.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/EmptyStorageDiskInfoAccessor.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.storage.diskdrive; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import java.util.Optional; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessor.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessor.java index 8e0c09bc4..41d729240 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessor.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessor.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.storage.diskdrive; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import java.util.Optional; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessorImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessorImpl.java index b7b49b413..2f29aaba9 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessorImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/StorageDiskInfoAccessorImpl.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.platform.common.storage.diskdrive; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.storage.StorageContainerItem; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.storage.StorageRepository; import java.util.Optional; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/ServerToClientCommunications.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/ServerToClientCommunications.java index 2aab8e7b1..59d2fda68 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/ServerToClientCommunications.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/ServerToClientCommunications.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.platform.common.support; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.storage.channel.PlatformStorageChannelType; import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceAmountTemplate; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterStatus; diff --git a/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/ClientStorageRepositoryTest.java b/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/ClientStorageRepositoryTest.java index 6ea4bc7ec..01219b777 100644 --- a/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/ClientStorageRepositoryTest.java +++ b/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/ClientStorageRepositoryTest.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.storage; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import java.util.ArrayList; import java.util.List; diff --git a/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImplTest.java b/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImplTest.java index b0a69ffb8..38b516789 100644 --- a/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImplTest.java +++ b/refinedstorage2-platform-common/src/test/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImplTest.java @@ -5,13 +5,13 @@ import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.api.storage.tracked.InMemoryTrackedStorageRepository; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorage; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageImpl; import com.refinedmods.refinedstorage2.platform.api.storage.PlayerActor; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.support.resource.ItemResource; import com.refinedmods.refinedstorage2.platform.common.PlatformTestFixtures; import com.refinedmods.refinedstorage2.platform.test.SetupMinecraft; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/packet/c2s/StorageInfoRequestPacket.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/packet/c2s/StorageInfoRequestPacket.java index 57ae43230..daecf8275 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/packet/c2s/StorageInfoRequestPacket.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/packet/c2s/StorageInfoRequestPacket.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.platform.fabric.packet.c2s; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.common.Platform; import java.util.UUID; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/packet/s2c/ServerToClientCommunicationsImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/packet/s2c/ServerToClientCommunicationsImpl.java index 7d4c0bde8..e0769e543 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/packet/s2c/ServerToClientCommunicationsImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/packet/s2c/ServerToClientCommunicationsImpl.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedstorage2.platform.fabric.packet.s2c; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.storage.channel.PlatformStorageChannelType; import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceAmountTemplate; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterStatus; diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java index b6d307d31..7649b29e0 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/storage/diskdrive/DiskDriveBakedModel.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.fabric.storage.diskdrive; -import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageStorageState; +import com.refinedmods.refinedstorage2.api.network.impl.node.StorageState; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveBlock; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveDisk; @@ -126,7 +126,7 @@ private void emitDiskQuads(final BlockAndTintGetter blockView, final RenderContext context, final DiskDriveDisk disk, final int index) { - if (disk.state() == MultiStorageStorageState.NONE) { + if (disk.state() == StorageState.NONE) { return; } final BakedModel model = diskModels.get(disk.item()); diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/packet/c2s/StorageInfoRequestPacket.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/packet/c2s/StorageInfoRequestPacket.java index 6671b7dc1..c6d5755ed 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/packet/c2s/StorageInfoRequestPacket.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/packet/c2s/StorageInfoRequestPacket.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.platform.forge.packet.c2s; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.common.Platform; import java.util.UUID; diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/packet/s2c/ServerToClientCommunicationsImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/packet/s2c/ServerToClientCommunicationsImpl.java index b825e0921..6c05e45f3 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/packet/s2c/ServerToClientCommunicationsImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/packet/s2c/ServerToClientCommunicationsImpl.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedstorage2.platform.forge.packet.s2c; -import com.refinedmods.refinedstorage2.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import com.refinedmods.refinedstorage2.platform.api.storage.StorageInfo; import com.refinedmods.refinedstorage2.platform.api.storage.channel.PlatformStorageChannelType; import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceAmountTemplate; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterStatus; diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java index 8f9b5d84e..9dd223a3d 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/storage/diskdrive/DiskDriveBakedModel.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.forge.storage.diskdrive; -import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageStorageState; +import com.refinedmods.refinedstorage2.api.network.impl.node.StorageState; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.AbstractDiskDriveBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveBlock; import com.refinedmods.refinedstorage2.platform.common.storage.diskdrive.DiskDriveDisk; @@ -195,7 +195,7 @@ public List load(final DiskDriveStateCacheKey key) { private List getDiskQuads(final DiskDriveStateCacheKey key, final DiskDriveDisk disk, final int index) { - if (disk.state() == MultiStorageStorageState.NONE) { + if (disk.state() == StorageState.NONE) { return Collections.emptyList(); } final var diskModelBakery = diskModelBakeries.get(disk.item());