From 6e76079a4442925c71ddbaf4027f70d190b74e6e Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Sat, 10 Aug 2024 18:52:46 +0200 Subject: [PATCH] feat: upgrading storage disks and storage blocks --- CHANGELOG.md | 4 + .../AbstractStorageContainerBlockItem.java | 18 ++- .../storage/AbstractStorageContainerItem.java | 11 +- .../storage/StorageContainerItemHelper.java | 16 ++- .../common/api/storage/StorageRepository.java | 7 ++ .../common/AbstractModInitializer.java | 44 +++++++ .../common/content/DataComponents.java | 10 ++ .../storage/ClientStorageRepository.java | 5 + .../common/storage/FluidStorageVariant.java | 21 +++- .../common/storage/ItemStorageVariant.java | 22 +++- .../StorageContainerItemHelperImpl.java | 89 +++++++++++--- .../StorageContainerUpgradeRecipe.java | 112 ++++++++++++++++++ ...orageContainerUpgradeRecipeSerializer.java | 44 +++++++ .../common/storage/StorageRepositoryImpl.java | 9 +- .../common/storage/StorageVariant.java | 13 ++ .../storage/UpgradeableStorageContainer.java | 9 ++ .../FluidStorageBlockBlockEntity.java | 3 +- .../FluidStorageBlockBlockItem.java | 32 ++++- .../ItemStorageBlockBlockEntity.java | 3 +- .../ItemStorageBlockBlockItem.java | 32 ++++- .../storagedisk/FluidStorageDiskItem.java | 19 ++- .../storagedisk/ItemStorageDiskItem.java | 19 ++- .../assets/refinedstorage/lang/en_us.json | 4 +- .../1024b_fluid_storage_block_upgrade.json | 4 + .../1024b_fluid_storage_disk_upgrade.json | 4 + .../recipe/16k_storage_block_upgrade.json | 4 + .../recipe/16k_storage_disk_upgrade.json | 4 + .../256b_fluid_storage_block_upgrade.json | 4 + .../256b_fluid_storage_disk_upgrade.json | 4 + .../4096b_fluid_storage_block_upgrade.json | 4 + .../4096b_fluid_storage_disk_upgrade.json | 4 + .../recipe/4k_storage_block_upgrade.json | 4 + .../recipe/4k_storage_disk_upgrade.json | 4 + .../recipe/64k_storage_block_upgrade.json | 4 + .../recipe/64k_storage_disk_upgrade.json | 4 + 35 files changed, 543 insertions(+), 51 deletions(-) create mode 100644 refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerUpgradeRecipe.java create mode 100644 refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerUpgradeRecipeSerializer.java create mode 100644 refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageVariant.java create mode 100644 refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/UpgradeableStorageContainer.java create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/1024b_fluid_storage_block_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/1024b_fluid_storage_disk_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/16k_storage_block_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/16k_storage_disk_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/256b_fluid_storage_block_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/256b_fluid_storage_disk_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4096b_fluid_storage_block_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4096b_fluid_storage_disk_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4k_storage_block_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4k_storage_disk_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/64k_storage_block_upgrade.json create mode 100644 refinedstorage-common/src/main/resources/data/refinedstorage/recipe/64k_storage_disk_upgrade.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 0972b19ff..48a4de402 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + +- You can now upgrade Storage Disks and Storage Blocks to a higher tier by combining with a higher tier Storage Part. The original Storage Part will be returned. + ### Changed - Updated to Minecraft 1.21.1. diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/AbstractStorageContainerBlockItem.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/AbstractStorageContainerBlockItem.java index b913b0651..a2307429f 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/AbstractStorageContainerBlockItem.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/AbstractStorageContainerBlockItem.java @@ -9,6 +9,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; @@ -35,6 +36,16 @@ protected AbstractStorageContainerBlockItem( this.helper = helper; } + @Override + public void inventoryTick(final ItemStack stack, + final Level level, + final Entity entity, + final int slotId, + final boolean isSelected) { + super.inventoryTick(stack, level, entity, slotId, isSelected); + helper.transferStorageIfNecessary(stack, level, entity, this::createStorage); + } + @Override public InteractionResultHolder use(final Level level, final Player player, final InteractionHand hand) { final ItemStack stack = player.getItemInHand(hand); @@ -76,13 +87,16 @@ public void appendHoverText(final ItemStack stack, final TooltipFlag flag) { super.appendHoverText(stack, context, tooltip, flag); final StorageRepository storageRepository = RefinedStorageApi.INSTANCE.getClientStorageRepository(); - helper.appendToTooltip(stack, storageRepository, tooltip, flag, this::formatAmount, hasCapacity()); + helper.appendToTooltip(stack, storageRepository, tooltip, flag, this::formatAmount, getCapacity()); } - protected abstract boolean hasCapacity(); + @Nullable + protected abstract Long getCapacity(); protected abstract String formatAmount(long amount); + protected abstract SerializableStorage createStorage(StorageRepository storageRepository); + protected abstract ItemStack createPrimaryDisassemblyByproduct(int count); @Nullable diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/AbstractStorageContainerItem.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/AbstractStorageContainerItem.java index e1a45b760..efbd55d78 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/AbstractStorageContainerItem.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/AbstractStorageContainerItem.java @@ -51,10 +51,8 @@ public void inventoryTick(final ItemStack stack, final int slot, final boolean selected) { super.inventoryTick(stack, level, entity, slot, selected); - if (!level.isClientSide() && !helper.hasStorage(stack) && entity instanceof Player) { - final StorageRepository storageRepository = RefinedStorageApi.INSTANCE.getStorageRepository(level); - helper.setStorage(storageRepository, stack, createStorage(storageRepository)); - } + helper.transferStorageIfNecessary(stack, level, entity, this::createStorage); + helper.loadStorageIfNecessary(stack, level, entity, this::createStorage); } @Override @@ -64,10 +62,11 @@ public void appendHoverText(final ItemStack stack, final TooltipFlag flag) { super.appendHoverText(stack, context, tooltip, flag); final StorageRepository storageRepository = RefinedStorageApi.INSTANCE.getClientStorageRepository(); - helper.appendToTooltip(stack, storageRepository, tooltip, flag, this::formatAmount, hasCapacity()); + helper.appendToTooltip(stack, storageRepository, tooltip, flag, this::formatAmount, getCapacity()); } - protected abstract boolean hasCapacity(); + @Nullable + protected abstract Long getCapacity(); protected abstract String formatAmount(long amount); diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/StorageContainerItemHelper.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/StorageContainerItemHelper.java index 0ac5f8798..ff50d513d 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/StorageContainerItemHelper.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/StorageContainerItemHelper.java @@ -4,12 +4,14 @@ import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.function.Function; import java.util.function.LongFunction; import javax.annotation.Nullable; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -21,9 +23,15 @@ public interface StorageContainerItemHelper { Optional resolveStorage(StorageRepository storageRepository, ItemStack stack); - void setStorage(StorageRepository storageRepository, ItemStack stack, SerializableStorage storage); + void loadStorageIfNecessary(ItemStack stack, + Level level, + Entity entity, + Function factory); - boolean hasStorage(ItemStack stack); + void transferStorageIfNecessary(ItemStack stack, + Level level, + Entity entity, + Function factory); Optional getInfo(StorageRepository storageRepository, ItemStack stack); @@ -38,7 +46,7 @@ void appendToTooltip(ItemStack stack, List tooltip, TooltipFlag context, LongFunction amountFormatter, - boolean hasCapacity); + @Nullable Long capacity); void transferToBlockEntity(ItemStack stack, StorageBlockEntity blockEntity); @@ -49,4 +57,6 @@ void appendToTooltip(ItemStack stack, Set getDiskModels(); Map getDiskModelsByItem(); + + void markAsToTransfer(ItemStack from, ItemStack to); } diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/StorageRepository.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/StorageRepository.java index e66e6823a..0b4c6b218 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/StorageRepository.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/storage/StorageRepository.java @@ -31,6 +31,13 @@ public interface StorageRepository { */ Optional removeIfEmpty(UUID id); + /** + * Removes a storage by ID. + * + * @param id the id + */ + void remove(UUID id); + /** * Retrieves info for a given storage ID. * diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractModInitializer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractModInitializer.java index 2e4819340..c548d7ce8 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractModInitializer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractModInitializer.java @@ -95,6 +95,8 @@ import com.refinedmods.refinedstorage.common.security.SecurityManagerContainerMenu; import com.refinedmods.refinedstorage.common.storage.FluidStorageVariant; import com.refinedmods.refinedstorage.common.storage.ItemStorageVariant; +import com.refinedmods.refinedstorage.common.storage.StorageContainerUpgradeRecipe; +import com.refinedmods.refinedstorage.common.storage.StorageContainerUpgradeRecipeSerializer; import com.refinedmods.refinedstorage.common.storage.StorageTypes; import com.refinedmods.refinedstorage.common.storage.diskdrive.AbstractDiskDriveBlockEntity; import com.refinedmods.refinedstorage.common.storage.diskdrive.DiskDriveBlock; @@ -815,6 +817,42 @@ protected final void registerRecipeSerializers(final RegistryCallback new StorageContainerUpgradeRecipeSerializer<>( + ItemStorageVariant.values(), + to -> new StorageContainerUpgradeRecipe<>( + ItemStorageVariant.values(), to, Items.INSTANCE::getItemStorageDisk + ) + ) + ); + callback.register( + createIdentifier("fluid_storage_disk_upgrade"), + () -> new StorageContainerUpgradeRecipeSerializer<>( + FluidStorageVariant.values(), + to -> new StorageContainerUpgradeRecipe<>( + FluidStorageVariant.values(), to, Items.INSTANCE::getFluidStorageDisk + ) + ) + ); + callback.register( + createIdentifier("storage_block_upgrade"), + () -> new StorageContainerUpgradeRecipeSerializer<>( + ItemStorageVariant.values(), + to -> new StorageContainerUpgradeRecipe<>( + ItemStorageVariant.values(), to, Blocks.INSTANCE::getItemStorageBlock + ) + ) + ); + callback.register( + createIdentifier("fluid_storage_block_upgrade"), + () -> new StorageContainerUpgradeRecipeSerializer<>( + FluidStorageVariant.values(), + to -> new StorageContainerUpgradeRecipe<>( + FluidStorageVariant.values(), to, Blocks.INSTANCE::getFluidStorageBlock + ) + ) + ); } protected final void registerDataComponents(final RegistryCallback> callback) { @@ -833,6 +871,12 @@ protected final void registerDataComponents(final RegistryCallback DataComponentType.builder() + .persistent(UUIDUtil.CODEC) + .networkSynchronized(UUIDUtil.STREAM_CODEC) + .build())); DataComponents.INSTANCE.setRegulatorUpgradeState( callback.register(createIdentifier("regulator_upgrade_state"), () -> DataComponentType.builder() diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DataComponents.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DataComponents.java index ca50bba6f..09bf3c6d3 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DataComponents.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DataComponents.java @@ -29,6 +29,8 @@ public final class DataComponents { @Nullable private Supplier> storageReference; @Nullable + private Supplier> storageReferenceToBeTransferred; + @Nullable private Supplier> regulatorUpgradeState; @Nullable private Supplier> securityCardBoundPlayer; @@ -74,6 +76,14 @@ public void setStorageReference(@Nullable final Supplier this.storageReference = supplier; } + public DataComponentType getStorageReferenceToBeTransferred() { + return requireNonNull(storageReferenceToBeTransferred).get(); + } + + public void setStorageReferenceToBeTransferred(@Nullable final Supplier> supplier) { + this.storageReferenceToBeTransferred = supplier; + } + public DataComponentType getRegulatorUpgradeState() { return requireNonNull(regulatorUpgradeState).get(); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/ClientStorageRepository.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/ClientStorageRepository.java index 5eaf0826d..1ee18a51c 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/ClientStorageRepository.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/ClientStorageRepository.java @@ -44,6 +44,11 @@ public Optional removeIfEmpty(final UUID id) { throw new UnsupportedOperationException(); } + @Override + public void remove(final UUID id) { + throw new UnsupportedOperationException(); + } + public void setInfo(final UUID id, final long stored, final long capacity) { info.put(id, new StorageInfo(stored, capacity)); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/FluidStorageVariant.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/FluidStorageVariant.java index 91b7698b0..55a292f27 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/FluidStorageVariant.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/FluidStorageVariant.java @@ -1,10 +1,14 @@ package com.refinedmods.refinedstorage.common.storage; import com.refinedmods.refinedstorage.common.Platform; +import com.refinedmods.refinedstorage.common.content.Items; import javax.annotation.Nullable; -public enum FluidStorageVariant { +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.item.Item; + +public enum FluidStorageVariant implements StringRepresentable, StorageVariant { SIXTY_FOUR_B("64b", 64L), TWO_HUNDRED_FIFTY_SIX_B("256b", 256L), THOUSAND_TWENTY_FOUR_B("1024b", 1024L), @@ -29,6 +33,7 @@ public Long getCapacityInBuckets() { return capacityInBuckets; } + @Override @Nullable public Long getCapacity() { if (capacityInBuckets == null) { @@ -37,7 +42,17 @@ public Long getCapacity() { return capacityInBuckets * Platform.INSTANCE.getBucketAmount(); } - public boolean hasCapacity() { - return capacityInBuckets != null; + @Nullable + @Override + public Item getStoragePart() { + if (this == CREATIVE) { + return null; + } + return Items.INSTANCE.getFluidStoragePart(this); + } + + @Override + public String getSerializedName() { + return name; } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/ItemStorageVariant.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/ItemStorageVariant.java index ae0d5a8b1..6bacf5b65 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/ItemStorageVariant.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/ItemStorageVariant.java @@ -1,8 +1,13 @@ package com.refinedmods.refinedstorage.common.storage; +import com.refinedmods.refinedstorage.common.content.Items; + import javax.annotation.Nullable; -public enum ItemStorageVariant { +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.item.Item; + +public enum ItemStorageVariant implements StringRepresentable, StorageVariant { ONE_K("1k", 1024L), FOUR_K("4k", 1024 * 4L), SIXTEEN_K("16k", 1024 * 4 * 4L), @@ -22,12 +27,23 @@ public String getName() { return name; } + @Override @Nullable public Long getCapacity() { return capacity; } - public boolean hasCapacity() { - return capacity != null; + @Nullable + @Override + public Item getStoragePart() { + if (this == CREATIVE) { + return null; + } + return Items.INSTANCE.getItemStoragePart(this); + } + + @Override + public String getSerializedName() { + return name; } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerItemHelperImpl.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerItemHelperImpl.java index 891288483..85d8f9fc3 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerItemHelperImpl.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerItemHelperImpl.java @@ -1,6 +1,8 @@ package com.refinedmods.refinedstorage.common.storage; +import com.refinedmods.refinedstorage.api.core.Action; 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.api.storage.StorageBlockEntity; import com.refinedmods.refinedstorage.common.api.storage.StorageContainerItemHelper; @@ -16,6 +18,7 @@ import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.function.Function; import java.util.function.LongFunction; import javax.annotation.Nullable; @@ -25,6 +28,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; @@ -47,19 +51,63 @@ public Optional resolveStorage(final StorageRepository stor } @Override - public void setStorage(final StorageRepository storageRepository, - final ItemStack stack, - final SerializableStorage storage) { + public void loadStorageIfNecessary(final ItemStack stack, + final Level level, + final Entity entity, + final Function factory) { + if (!level.isClientSide() && !hasStorage(stack) && entity instanceof Player) { + final StorageRepository storageRepository = RefinedStorageApi.INSTANCE.getStorageRepository(level); + setStorage(storageRepository, stack, factory.apply(storageRepository)); + } + } + + @Override + public void transferStorageIfNecessary(final ItemStack stack, + final Level level, + final Entity entity, + final Function factory) { + if (!level.isClientSide() + && !hasStorage(stack) + && hasStorageToBeTransferred(stack) + && entity instanceof Player player) { + getIdToBeTransferred(stack).ifPresent(id -> doTransfer(level, factory, player, id, stack)); + } + } + + private void doTransfer(final Level level, + final Function factory, + final Player player, + final UUID originalId, + final ItemStack stack) { + final StorageRepository storageRepository = RefinedStorageApi.INSTANCE.getStorageRepository(level); + final PlayerActor actor = new PlayerActor(player); + storageRepository.get(originalId).ifPresent(originalStorage -> { + final SerializableStorage transferStorage = factory.apply(storageRepository); + originalStorage.getAll().forEach( + original -> transferStorage.insert(original.resource(), original.amount(), Action.EXECUTE, actor) + ); + setStorage(storageRepository, stack, transferStorage); + storageRepository.remove(originalId); + markAsTransferred(stack); + }); + } + + private void setStorage(final StorageRepository storageRepository, + final ItemStack stack, + final SerializableStorage storage) { final UUID id = UUID.randomUUID(); setId(stack, id); storageRepository.set(id, storage); } - @Override - public boolean hasStorage(final ItemStack stack) { + private boolean hasStorage(final ItemStack stack) { return stack.has(DataComponents.INSTANCE.getStorageReference()); } + private boolean hasStorageToBeTransferred(final ItemStack stack) { + return stack.has(DataComponents.INSTANCE.getStorageReferenceToBeTransferred()); + } + @Override public Optional getInfo(final StorageRepository storageRepository, final ItemStack stack) { return getId(stack).map(storageRepository::getInfo); @@ -108,13 +156,15 @@ public void appendToTooltip(final ItemStack stack, final List tooltip, final TooltipFlag context, final LongFunction amountFormatter, - final boolean hasCapacity) { - getInfo(storageRepository, stack).ifPresent(info -> { - if (hasCapacity) { + @Nullable final Long capacity) { + final boolean transferring = hasStorageToBeTransferred(stack); + getId(stack).or(() -> getIdToBeTransferred(stack)).ifPresent(id -> { + final StorageInfo info = storageRepository.getInfo(id); + if (capacity != null) { StorageTooltipHelper.addAmountStoredWithCapacity( tooltip, info.stored(), - info.capacity(), + transferring ? capacity : info.capacity(), amountFormatter ); } else { @@ -124,13 +174,11 @@ public void appendToTooltip(final ItemStack stack, amountFormatter ); } - }); - if (context.isAdvanced()) { - getId(stack).ifPresent(id -> { + if (context.isAdvanced()) { final MutableComponent idComponent = Component.literal(id.toString()).withStyle(ChatFormatting.GRAY); tooltip.add(idComponent); - }); - } + } + }); } @Override @@ -168,10 +216,23 @@ public Map getDiskModelsByItem() { return Collections.unmodifiableMap(diskModelsByItem); } + @Override + public void markAsToTransfer(final ItemStack from, final ItemStack to) { + getId(from).ifPresent(id -> to.set(DataComponents.INSTANCE.getStorageReferenceToBeTransferred(), id)); + } + private Optional getId(final ItemStack stack) { return Optional.ofNullable(stack.get(DataComponents.INSTANCE.getStorageReference())); } + private Optional getIdToBeTransferred(final ItemStack stack) { + return Optional.ofNullable(stack.get(DataComponents.INSTANCE.getStorageReferenceToBeTransferred())); + } + + private void markAsTransferred(final ItemStack stack) { + stack.remove(DataComponents.INSTANCE.getStorageReferenceToBeTransferred()); + } + private void setId(final ItemStack stack, final UUID id) { stack.set(DataComponents.INSTANCE.getStorageReference(), id); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerUpgradeRecipe.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerUpgradeRecipe.java new file mode 100644 index 000000000..de1c4ab58 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerUpgradeRecipe.java @@ -0,0 +1,112 @@ +package com.refinedmods.refinedstorage.common.storage; + +import java.util.Arrays; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; + +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.ShapelessRecipe; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.Level; + +public class StorageContainerUpgradeRecipe extends ShapelessRecipe { + private final Set validSourceContainers; + private final T[] variants; + private final T to; + + public StorageContainerUpgradeRecipe(final T[] variants, + final T to, + final Function containerProvider) { + super( + "", + CraftingBookCategory.MISC, + containerProvider.apply(to).asItem().getDefaultInstance(), + NonNullList.of( + Ingredient.of(getValidSourceContainers(to, variants, containerProvider) + .stream().map(ItemLike::asItem).map(Item::getDefaultInstance)), + Ingredient.of(to.getStoragePart()) + ) + ); + this.validSourceContainers = getValidSourceContainers(to, variants, containerProvider); + this.variants = variants; + this.to = to; + } + + public T[] getVariants() { + return variants; + } + + public T getTo() { + return to; + } + + private static Set getValidSourceContainers( + final T destination, + final T[] variants, + final Function containerProvider + ) { + if (destination.getCapacity() == null) { + return Set.of(); + } + return Arrays.stream(variants) + .filter(variant -> variant.getCapacity() != null && variant.getCapacity() < destination.getCapacity()) + .map(containerProvider) + .map(ItemLike::asItem) + .collect(Collectors.toSet()); + } + + @Override + public ItemStack assemble(final CraftingInput input, final HolderLookup.Provider provider) { + for (int i = 0; i < input.size(); ++i) { + final ItemStack fromDisk = input.getItem(i); + if (fromDisk.getItem() instanceof UpgradeableStorageContainer from + && validSourceContainers.contains(fromDisk.getItem())) { + final ItemStack toDisk = getResultItem(provider).copy(); + from.transferTo(fromDisk, toDisk); + return toDisk; + } + } + return ItemStack.EMPTY; + } + + @Override + public boolean matches(final CraftingInput input, final Level level) { + int diskCount = 0; + int partCount = 0; + for (int i = 0; i < input.size(); ++i) { + final ItemStack inputStack = input.getItem(i); + if (validSourceContainers.contains(inputStack.getItem())) { + diskCount++; + } else if (inputStack.getItem() == to.getStoragePart()) { + partCount++; + } + if (diskCount == 1 && partCount == 1) { + return true; + } + } + return false; + } + + @Override + public NonNullList getRemainingItems(final CraftingInput input) { + final NonNullList remainingItems = NonNullList.withSize(input.size(), ItemStack.EMPTY); + for (int i = 0; i < input.size(); ++i) { + final ItemStack stack = input.getItem(i); + if (stack.getItem() instanceof UpgradeableStorageContainer from + && validSourceContainers.contains(stack.getItem())) { + final Item storagePart = from.getVariant().getStoragePart(); + if (storagePart != null) { + remainingItems.set(i, storagePart.getDefaultInstance()); + } + } + } + return remainingItems; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerUpgradeRecipeSerializer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerUpgradeRecipeSerializer.java new file mode 100644 index 000000000..0f0af81d0 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageContainerUpgradeRecipeSerializer.java @@ -0,0 +1,44 @@ +package com.refinedmods.refinedstorage.common.storage; + +import java.util.function.Function; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.item.crafting.RecipeSerializer; + +import static com.refinedmods.refinedstorage.common.util.PacketUtil.enumStreamCodec; + +public class StorageContainerUpgradeRecipeSerializer & StorageVariant & StringRepresentable> + implements RecipeSerializer> { + private final MapCodec> codec; + private final StreamCodec> streamCodec; + + public StorageContainerUpgradeRecipeSerializer( + final T[] variants, + final Function> instanceFactory + ) { + this.codec = RecordCodecBuilder.mapCodec( + instance -> instance.group( + StringRepresentable.fromValues(() -> variants).fieldOf("to") + .forGetter(StorageContainerUpgradeRecipe::getTo) + ).apply(instance, instanceFactory) + ); + this.streamCodec = StreamCodec.composite( + enumStreamCodec(variants), StorageContainerUpgradeRecipe::getTo, + instanceFactory + ); + } + + @Override + public MapCodec> codec() { + return codec; + } + + @Override + public StreamCodec> streamCodec() { + return streamCodec; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageRepositoryImpl.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageRepositoryImpl.java index 5a1d50769..102d1248a 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageRepositoryImpl.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageRepositoryImpl.java @@ -57,14 +57,19 @@ public void set(final UUID id, final SerializableStorage storage) { public Optional removeIfEmpty(final UUID id) { return get(id).map(storage -> { if (storage.getStored() == 0) { - entries.remove(id); - setDirty(); + remove(id); return storage; } return null; }); } + @Override + public void remove(final UUID id) { + entries.remove(id); + setDirty(); + } + @Override public StorageInfo getInfo(final UUID id) { return get(id).map(StorageInfo::of).orElse(StorageInfo.UNKNOWN); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageVariant.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageVariant.java new file mode 100644 index 000000000..28864d17b --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/StorageVariant.java @@ -0,0 +1,13 @@ +package com.refinedmods.refinedstorage.common.storage; + +import javax.annotation.Nullable; + +import net.minecraft.world.item.Item; + +public interface StorageVariant { + @Nullable + Long getCapacity(); + + @Nullable + Item getStoragePart(); +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/UpgradeableStorageContainer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/UpgradeableStorageContainer.java new file mode 100644 index 000000000..4253b580a --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/UpgradeableStorageContainer.java @@ -0,0 +1,9 @@ +package com.refinedmods.refinedstorage.common.storage; + +import net.minecraft.world.item.ItemStack; + +public interface UpgradeableStorageContainer { + StorageVariant getVariant(); + + void transferTo(ItemStack from, ItemStack to); +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockBlockEntity.java index 675d27996..68cb63b5c 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockBlockEntity.java @@ -6,7 +6,6 @@ import com.refinedmods.refinedstorage.common.api.storage.SerializableStorage; import com.refinedmods.refinedstorage.common.content.BlockEntities; import com.refinedmods.refinedstorage.common.storage.FluidStorageVariant; -import com.refinedmods.refinedstorage.common.storage.StorageTypes; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; @@ -51,7 +50,7 @@ private static long getEnergyUsage(final FluidStorageVariant variant) { @Override protected SerializableStorage createStorage(final Runnable listener) { - return StorageTypes.FLUID.create(variant.getCapacity(), listener); + return FluidStorageBlockBlockItem.createStorage(variant, listener); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockBlockItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockBlockItem.java index f46eb4e6b..253ede466 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockBlockItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockBlockItem.java @@ -2,10 +2,15 @@ import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; import com.refinedmods.refinedstorage.common.api.storage.AbstractStorageContainerBlockItem; +import com.refinedmods.refinedstorage.common.api.storage.SerializableStorage; +import com.refinedmods.refinedstorage.common.api.storage.StorageRepository; import com.refinedmods.refinedstorage.common.api.support.HelpTooltipComponent; import com.refinedmods.refinedstorage.common.content.Blocks; import com.refinedmods.refinedstorage.common.content.Items; import com.refinedmods.refinedstorage.common.storage.FluidStorageVariant; +import com.refinedmods.refinedstorage.common.storage.StorageTypes; +import com.refinedmods.refinedstorage.common.storage.StorageVariant; +import com.refinedmods.refinedstorage.common.storage.UpgradeableStorageContainer; import com.refinedmods.refinedstorage.common.support.resource.FluidResource; import java.util.Optional; @@ -23,7 +28,8 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.format; -public class FluidStorageBlockBlockItem extends AbstractStorageContainerBlockItem { +public class FluidStorageBlockBlockItem extends AbstractStorageContainerBlockItem + implements UpgradeableStorageContainer { private static final Component CREATIVE_HELP = createTranslation("item", "creative_fluid_storage_block.help"); private final FluidStorageVariant variant; @@ -46,9 +52,10 @@ private static Component getHelpText(final FluidStorageVariant variant) { return createTranslation("item", "fluid_storage_block.help", format(variant.getCapacityInBuckets())); } + @Nullable @Override - protected boolean hasCapacity() { - return variant.hasCapacity(); + protected Long getCapacity() { + return variant.getCapacity(); } @Override @@ -56,6 +63,15 @@ protected String formatAmount(final long amount) { return RefinedStorageApi.INSTANCE.getResourceRendering(FluidResource.class).formatAmount(amount); } + @Override + protected SerializableStorage createStorage(final StorageRepository storageRepository) { + return createStorage(variant, storageRepository::markAsChanged); + } + + static SerializableStorage createStorage(final FluidStorageVariant variant, final Runnable listener) { + return StorageTypes.FLUID.create(variant.getCapacity(), listener); + } + @Override protected ItemStack createPrimaryDisassemblyByproduct(final int count) { return new ItemStack(Blocks.INSTANCE.getMachineCasing(), count); @@ -86,4 +102,14 @@ protected boolean placeBlock(final BlockPlaceContext ctx, final BlockState state public Optional getTooltipImage(final ItemStack stack) { return Optional.of(new HelpTooltipComponent(helpText)); } + + @Override + public StorageVariant getVariant() { + return variant; + } + + @Override + public void transferTo(final ItemStack from, final ItemStack to) { + helper.markAsToTransfer(from, to); + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/ItemStorageBlockBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/ItemStorageBlockBlockEntity.java index 4c2507d88..55409495d 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/ItemStorageBlockBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/ItemStorageBlockBlockEntity.java @@ -6,7 +6,6 @@ import com.refinedmods.refinedstorage.common.api.storage.SerializableStorage; import com.refinedmods.refinedstorage.common.content.BlockEntities; import com.refinedmods.refinedstorage.common.storage.ItemStorageVariant; -import com.refinedmods.refinedstorage.common.storage.StorageTypes; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; @@ -47,7 +46,7 @@ private static long getEnergyUsage(final ItemStorageVariant variant) { @Override protected SerializableStorage createStorage(final Runnable listener) { - return StorageTypes.ITEM.create(variant.getCapacity(), listener); + return ItemStorageBlockBlockItem.createStorage(variant, listener); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/ItemStorageBlockBlockItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/ItemStorageBlockBlockItem.java index c19cab55a..42ce05c54 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/ItemStorageBlockBlockItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/ItemStorageBlockBlockItem.java @@ -2,10 +2,15 @@ import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; import com.refinedmods.refinedstorage.common.api.storage.AbstractStorageContainerBlockItem; +import com.refinedmods.refinedstorage.common.api.storage.SerializableStorage; +import com.refinedmods.refinedstorage.common.api.storage.StorageRepository; import com.refinedmods.refinedstorage.common.api.support.HelpTooltipComponent; import com.refinedmods.refinedstorage.common.content.Blocks; import com.refinedmods.refinedstorage.common.content.Items; import com.refinedmods.refinedstorage.common.storage.ItemStorageVariant; +import com.refinedmods.refinedstorage.common.storage.StorageTypes; +import com.refinedmods.refinedstorage.common.storage.StorageVariant; +import com.refinedmods.refinedstorage.common.storage.UpgradeableStorageContainer; import java.util.Optional; import javax.annotation.Nullable; @@ -22,7 +27,8 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.format; -public class ItemStorageBlockBlockItem extends AbstractStorageContainerBlockItem { +public class ItemStorageBlockBlockItem extends AbstractStorageContainerBlockItem + implements UpgradeableStorageContainer { private static final Component CREATIVE_HELP = createTranslation("item", "creative_storage_block.help"); private final ItemStorageVariant variant; @@ -44,9 +50,10 @@ private static Component getHelpText(final ItemStorageVariant variant) { : createTranslation("item", "storage_block.help", format(variant.getCapacity())); } + @Nullable @Override - protected boolean hasCapacity() { - return variant.hasCapacity(); + protected Long getCapacity() { + return variant.getCapacity(); } @Override @@ -54,6 +61,15 @@ protected String formatAmount(final long amount) { return format(amount); } + @Override + protected SerializableStorage createStorage(final StorageRepository storageRepository) { + return createStorage(variant, storageRepository::markAsChanged); + } + + static SerializableStorage createStorage(final ItemStorageVariant variant, final Runnable listener) { + return StorageTypes.ITEM.create(variant.getCapacity(), listener); + } + @Override protected ItemStack createPrimaryDisassemblyByproduct(final int count) { return new ItemStack(Blocks.INSTANCE.getMachineCasing(), count); @@ -85,4 +101,14 @@ protected boolean placeBlock(final BlockPlaceContext ctx, final BlockState state public Optional getTooltipImage(final ItemStack stack) { return Optional.of(new HelpTooltipComponent(helpText)); } + + @Override + public StorageVariant getVariant() { + return variant; + } + + @Override + public void transferTo(final ItemStack from, final ItemStack to) { + helper.markAsToTransfer(from, to); + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storagedisk/FluidStorageDiskItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storagedisk/FluidStorageDiskItem.java index eb5f9b939..c26266938 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storagedisk/FluidStorageDiskItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storagedisk/FluidStorageDiskItem.java @@ -8,6 +8,8 @@ import com.refinedmods.refinedstorage.common.content.Items; import com.refinedmods.refinedstorage.common.storage.FluidStorageVariant; import com.refinedmods.refinedstorage.common.storage.StorageTypes; +import com.refinedmods.refinedstorage.common.storage.StorageVariant; +import com.refinedmods.refinedstorage.common.storage.UpgradeableStorageContainer; import com.refinedmods.refinedstorage.common.support.resource.FluidResource; import java.util.Optional; @@ -21,7 +23,7 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.format; -public class FluidStorageDiskItem extends AbstractStorageContainerItem { +public class FluidStorageDiskItem extends AbstractStorageContainerItem implements UpgradeableStorageContainer { private static final Component CREATIVE_HELP = createTranslation("item", "creative_fluid_storage_disk.help"); private final FluidStorageVariant variant; @@ -43,9 +45,10 @@ private static Component getHelpText(final FluidStorageVariant variant) { return createTranslation("item", "fluid_storage_disk.help", format(variant.getCapacityInBuckets())); } + @Nullable @Override - protected boolean hasCapacity() { - return variant.hasCapacity(); + protected Long getCapacity() { + return variant.getCapacity(); } @Override @@ -76,4 +79,14 @@ protected ItemStack createSecondaryDisassemblyByproduct(final int count) { public Optional getTooltipImage(final ItemStack stack) { return Optional.of(new HelpTooltipComponent(helpText)); } + + @Override + public StorageVariant getVariant() { + return variant; + } + + @Override + public void transferTo(final ItemStack from, final ItemStack to) { + helper.markAsToTransfer(from, to); + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storagedisk/ItemStorageDiskItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storagedisk/ItemStorageDiskItem.java index 7ba29e021..f6ebba444 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storagedisk/ItemStorageDiskItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storagedisk/ItemStorageDiskItem.java @@ -8,6 +8,8 @@ import com.refinedmods.refinedstorage.common.content.Items; import com.refinedmods.refinedstorage.common.storage.ItemStorageVariant; import com.refinedmods.refinedstorage.common.storage.StorageTypes; +import com.refinedmods.refinedstorage.common.storage.StorageVariant; +import com.refinedmods.refinedstorage.common.storage.UpgradeableStorageContainer; import java.util.Optional; import javax.annotation.Nullable; @@ -20,7 +22,7 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.format; -public class ItemStorageDiskItem extends AbstractStorageContainerItem { +public class ItemStorageDiskItem extends AbstractStorageContainerItem implements UpgradeableStorageContainer { private static final Component CREATIVE_HELP = createTranslation("item", "creative_storage_disk.help"); private final ItemStorageVariant variant; @@ -41,9 +43,10 @@ private static Component getHelpText(final ItemStorageVariant variant) { : createTranslation("item", "storage_disk.help", format(variant.getCapacity())); } + @Nullable @Override - protected boolean hasCapacity() { - return variant.hasCapacity(); + protected Long getCapacity() { + return variant.getCapacity(); } @Override @@ -74,4 +77,14 @@ protected ItemStack createSecondaryDisassemblyByproduct(final int count) { public Optional getTooltipImage(final ItemStack stack) { return Optional.of(new HelpTooltipComponent(helpText)); } + + @Override + public StorageVariant getVariant() { + return variant; + } + + @Override + public void transferTo(final ItemStack from, final ItemStack to) { + helper.markAsToTransfer(from, to); + } } diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/lang/en_us.json b/refinedstorage-common/src/main/resources/assets/refinedstorage/lang/en_us.json index 155d1e882..bd293288c 100644 --- a/refinedstorage-common/src/main/resources/assets/refinedstorage/lang/en_us.json +++ b/refinedstorage-common/src/main/resources/assets/refinedstorage/lang/en_us.json @@ -214,8 +214,8 @@ "item.refinedstorage.4k_storage_disk": "4K Storage Disk", "item.refinedstorage.16k_storage_disk": "16K Storage Disk", "item.refinedstorage.64k_storage_disk": "64K Storage Disk", - "item.refinedstorage.storage_disk.help": "Stores %s items.", - "item.refinedstorage.storage_block.help": "Stores %s items.", + "item.refinedstorage.storage_disk.help": "Stores %s items. When empty, use while holding to return the Storage Part. Upgradeable to a higher tier by combining with a Storage Part.", + "item.refinedstorage.storage_block.help": "Stores %s items. When empty, use while holding to return the Storage Part and Machine Casing. Upgradeable to a higher tier by combining with a Storage Part.", "item.refinedstorage.creative_storage_disk": "Creative Storage Disk", "item.refinedstorage.creative_storage_disk.help": "Stores an infinite amount of items.", "item.refinedstorage.creative_storage_block.help": "Stores an infinite amount of items.", diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/1024b_fluid_storage_block_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/1024b_fluid_storage_block_upgrade.json new file mode 100644 index 000000000..34170c281 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/1024b_fluid_storage_block_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:fluid_storage_block_upgrade", + "to": "1024b" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/1024b_fluid_storage_disk_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/1024b_fluid_storage_disk_upgrade.json new file mode 100644 index 000000000..16c64c2da --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/1024b_fluid_storage_disk_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:fluid_storage_disk_upgrade", + "to": "1024b" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/16k_storage_block_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/16k_storage_block_upgrade.json new file mode 100644 index 000000000..7706f28b0 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/16k_storage_block_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:storage_block_upgrade", + "to": "16k" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/16k_storage_disk_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/16k_storage_disk_upgrade.json new file mode 100644 index 000000000..0aef38c37 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/16k_storage_disk_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:storage_disk_upgrade", + "to": "16k" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/256b_fluid_storage_block_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/256b_fluid_storage_block_upgrade.json new file mode 100644 index 000000000..1180d3724 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/256b_fluid_storage_block_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:fluid_storage_block_upgrade", + "to": "256b" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/256b_fluid_storage_disk_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/256b_fluid_storage_disk_upgrade.json new file mode 100644 index 000000000..5ed429e0d --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/256b_fluid_storage_disk_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:fluid_storage_disk_upgrade", + "to": "256b" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4096b_fluid_storage_block_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4096b_fluid_storage_block_upgrade.json new file mode 100644 index 000000000..873908785 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4096b_fluid_storage_block_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:fluid_storage_block_upgrade", + "to": "4096b" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4096b_fluid_storage_disk_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4096b_fluid_storage_disk_upgrade.json new file mode 100644 index 000000000..e917eeee7 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4096b_fluid_storage_disk_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:fluid_storage_disk_upgrade", + "to": "4096b" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4k_storage_block_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4k_storage_block_upgrade.json new file mode 100644 index 000000000..1decc2cc6 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4k_storage_block_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:storage_block_upgrade", + "to": "4k" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4k_storage_disk_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4k_storage_disk_upgrade.json new file mode 100644 index 000000000..9c2ba3627 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/4k_storage_disk_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:storage_disk_upgrade", + "to": "4k" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/64k_storage_block_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/64k_storage_block_upgrade.json new file mode 100644 index 000000000..2df69d790 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/64k_storage_block_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:storage_block_upgrade", + "to": "64k" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/64k_storage_disk_upgrade.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/64k_storage_disk_upgrade.json new file mode 100644 index 000000000..1cead442a --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/64k_storage_disk_upgrade.json @@ -0,0 +1,4 @@ +{ + "type": "refinedstorage:storage_disk_upgrade", + "to": "64k" +} \ No newline at end of file