Skip to content

Commit

Permalink
feat: resolve errors
Browse files Browse the repository at this point in the history
  • Loading branch information
starforcraft committed Sep 10, 2024
1 parent c2c242f commit 0359770
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import com.refinedmods.refinedstorage.api.core.Action;
import com.refinedmods.refinedstorage.api.resource.ResourceAmount;
import com.refinedmods.refinedstorage.api.storage.Storage;
import com.refinedmods.refinedstorage.common.api.RefinedStorageApi;
import com.refinedmods.refinedstorage.common.api.storage.PlayerActor;
import com.refinedmods.refinedstorage.common.api.storage.SerializableStorage;
import com.refinedmods.refinedstorage.common.content.Items;
import com.refinedmods.refinedstorage.common.storage.ItemStorageVariant;
import com.refinedmods.refinedstorage.common.support.FilteredContainer;
import com.refinedmods.refinedstorage.common.support.direction.BiDirection;

import java.util.Optional;

import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.gametest.framework.GameTestAssertException;
Expand Down Expand Up @@ -50,7 +48,7 @@ static void addDiskToDiskInterface(final GameTestHelper helper,
final ItemStack diskItem = new ItemStack(Items.INSTANCE.getItemStorageDisk(ItemStorageVariant.SIXTY_FOUR_K));
diskItem.inventoryTick(helper.getLevel(), helper.makeMockPlayer(GameType.SURVIVAL), 0, false);

final SerializableStorage storage = getSerializableStorageFromDisk(helper, diskItem);
final Storage storage = getStorageFromDisk(helper, diskItem);
if (resources.length > 0) {
final PlayerActor actor = new PlayerActor(helper.makeMockPlayer(GameType.SURVIVAL));
for (final ResourceAmount resource : resources) {
Expand All @@ -74,19 +72,18 @@ static void isDiskInOutputWithAmount(final GameTestHelper helper,
final FilteredContainer diskInterfaceContainer = diskInterfaceBlockEntity.getDiskInventory();

final ItemStack diskItem = diskInterfaceContainer.getItem(3);
final SerializableStorage storage = getSerializableStorageFromDisk(helper, diskItem);
final Storage storage = getStorageFromDisk(helper, diskItem);

helper.assertTrue(!diskItem.isEmpty(), "Could not find a Storage Disk in the output slot");
helper.assertTrue(storage.getStored() == storedAmount, "Expected Storage Disk stored amount "
+ storedAmount + ", but was " + storage.getStored());
}

private static Storage getStorageFromDisk(final GameTestHelper helper,
final ItemStack diskItem) {
final ItemStack diskItem) {
return RefinedStorageApi.INSTANCE
.getStorageContainerItemHelper()
.resolveStorage(RefinedStorageApi.INSTANCE.getStorageRepository(helper.getLevel()), diskItem)
.orElseThrow(() -> new GameTestAssertException("Couldn't find SerializableStorage from Storage Disk"));

}
}

0 comments on commit 0359770

Please sign in to comment.