diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 9216935a1..926f1c39e 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -35,7 +35,7 @@ body: description: | If your Minecraft version isn't listed here, it means that it isn't supported. In that case, don't create an issue. options: - - Minecraft 1.21 + - Minecraft 1.21.1 validations: required: true - type: input diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed44fdb84..fa24ab46a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: types: [ opened, synchronize, reopened ] jobs: build: - uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.16.9 + uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.17.1 with: gametests: true secrets: inherit diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index d1b6a91d4..e21ed0371 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -17,7 +17,7 @@ on: type: string jobs: draft: - uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.16.9 + uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.17.1 with: release-type: ${{ inputs.release-type }} version-number-override: ${{ inputs.version-number-override }} diff --git a/.github/workflows/issue-for-unsupported-version.yml b/.github/workflows/issue-for-unsupported-version.yml index 054bce154..f8ce8650d 100644 --- a/.github/workflows/issue-for-unsupported-version.yml +++ b/.github/workflows/issue-for-unsupported-version.yml @@ -4,4 +4,4 @@ on: types: [ labeled, unlabeled, reopened ] jobs: unsupported-labeler: - uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.16.9 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.17.1 \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 153402dbf..864977bfc 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -7,7 +7,7 @@ on: - closed jobs: publish-release: - uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.16.9 + uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.17.1 secrets: inherit with: project-name: 'Refined Storage' diff --git a/.github/workflows/resolved-issue-locking.yml b/.github/workflows/resolved-issue-locking.yml index fdaa760cc..5c6c04a6f 100644 --- a/.github/workflows/resolved-issue-locking.yml +++ b/.github/workflows/resolved-issue-locking.yml @@ -4,4 +4,4 @@ on: - cron: '0 0 * * 1' jobs: lock: - uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.16.9 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.17.1 \ No newline at end of file diff --git a/.github/workflows/validate-branch-name.yml b/.github/workflows/validate-branch-name.yml index 944aa08bb..ce5e06ea5 100644 --- a/.github/workflows/validate-branch-name.yml +++ b/.github/workflows/validate-branch-name.yml @@ -2,4 +2,4 @@ name: Validate branch name on: [ pull_request ] jobs: validate-branch-name: - uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.16.9 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.17.1 \ No newline at end of file diff --git a/.github/workflows/validate-changelog.yml b/.github/workflows/validate-changelog.yml index 218f86e40..db04af17b 100644 --- a/.github/workflows/validate-changelog.yml +++ b/.github/workflows/validate-changelog.yml @@ -4,4 +4,4 @@ on: types: [ opened, synchronize, reopened, ready_for_review, labeled, unlabeled ] jobs: validate-changelog: - uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.16.9 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.17.1 \ No newline at end of file diff --git a/.github/workflows/validate-commit-messages.yml b/.github/workflows/validate-commit-messages.yml index b70a80db3..043dba24c 100644 --- a/.github/workflows/validate-commit-messages.yml +++ b/.github/workflows/validate-commit-messages.yml @@ -2,4 +2,4 @@ name: Validate commit messages on: [ pull_request ] jobs: validate-commit-messages: - uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.16.9 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.17.1 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 31adb75cf..1d316c5e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,27 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [2.0.0-milestone.4.7] - 2024-08-11 + +### 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. +- The Network Transmitter and Wireless Transmitter GUI now has an inactive and active GUI animation. +- The Wireless Transmitter now shows whether it's inactive in GUI instead of always showing the range. + +### Fixed + +- Use new slimeballs convention tag for Processor Binding. +- Portable Grid search bar texture being positioned in the wrong way. +- External Storage screen unnecessarily showing upgrade slots. +- Grid setting changes not persisting after restarting Minecraft. +- Fixed not being able to extract fluids from the Grid with an empty bucket or other empty fluid container. +- All blocks and items now correctly retain their custom name. + ## [2.0.0-milestone.4.6] - 2024-08-08 ### Added @@ -20,6 +41,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - When a Pattern is created for a recipe, the Pattern will have a different texture and name to differentiate between empty patterns. - The Pattern Grid now has additional support for encoding stonecutter and smithing table recipes. - The Pattern output is now always rendered in the Pattern Grid result slot. +- You can now search in the Pattern Grid alternatives screen. +- In the Pattern Grid alternatives screen, all resources belonging to a tag or no longer shown at once. You can expand or collapse them. +- The tag names in the Pattern Grid alternatives screen will now be translated. +- "Exact mode" in the Pattern Grid has been replaced with "Fuzzy mode" (inverse). ### Fixed @@ -712,7 +737,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - The Grid can now use smooth scrolling. - The Grid now has syntax highlighting for the search query. -[Unreleased]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.4.6...HEAD +[Unreleased]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.4.7...HEAD + +[2.0.0-milestone.4.7]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.4.6...v2.0.0-milestone.4.7 [2.0.0-milestone.4.6]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.4.5...v2.0.0-milestone.4.6 diff --git a/gradle.properties b/gradle.properties index 714a71d9d..4da18d71a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ -refinedarchitectVersion=0.16.9 +refinedarchitectVersion=0.17.1 # Gradle org.gradle.jvmargs=-Xmx1G diff --git a/refinedstorage-common-api/build.gradle.kts b/refinedstorage-common-api/build.gradle.kts index 14141ebd5..a0ab6c7e1 100644 --- a/refinedstorage-common-api/build.gradle.kts +++ b/refinedstorage-common-api/build.gradle.kts @@ -4,7 +4,6 @@ plugins { refinedarchitect { common() - testing() javadoc() publishing { maven = true @@ -22,9 +21,4 @@ dependencies { api(project(":refinedstorage-resource-api")) api(project(":refinedstorage-network-api")) api(project(":refinedstorage-grid-api")) - testImplementation(libs.junit.api) - testImplementation(libs.junit.params) - testImplementation(libs.assertj) - testImplementation(libs.equalsverifier) - testRuntimeOnly(libs.junit.engine) } diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java index 7d2ac7548..1894a2642 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java @@ -160,7 +160,7 @@ GridScrollingStrategy createGridScrollingStrategy(AbstractContainerMenu containe void registerResourceRendering(Class resourceClass, ResourceRendering rendering); - ResourceRendering getResourceRendering(ResourceKey resource); + ResourceRendering getResourceRendering(Class resourceClass); void addIngredientConverter(RecipeModIngredientConverter converter); diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java index d30707043..0d8e2e3d5 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java @@ -297,8 +297,8 @@ public void registerResourceRendering(final Class res } @Override - public ResourceRendering getResourceRendering(final ResourceKey resource) { - return ensureLoaded().getResourceRendering(resource); + public ResourceRendering getResourceRendering(final Class resourceClass) { + return ensureLoaded().getResourceRendering(resourceClass); } @Override diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/grid/GridSynchronizer.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/grid/GridSynchronizer.java index f3caa76fc..f20c54e6e 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/grid/GridSynchronizer.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/grid/GridSynchronizer.java @@ -18,9 +18,5 @@ public interface GridSynchronizer { @Nullable String getTextToSynchronizeToGrid(); - ResourceLocation getTextureIdentifier(); - - int getXTexture(); - - int getYTexture(); + ResourceLocation getSprite(); } diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/grid/view/PlatformGridResource.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/grid/view/PlatformGridResource.java index 40e9a03cd..0b062d6fd 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/grid/view/PlatformGridResource.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/grid/view/PlatformGridResource.java @@ -17,10 +17,13 @@ import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.item.ItemStack; import org.apiguardian.api.API; @API(status = API.Status.STABLE, since = "2.0.0-milestone.2.6") public interface PlatformGridResource extends GridResource { + boolean canExtract(ItemStack carriedStack, GridView view); + void onExtract(GridExtractMode extractMode, boolean cursor, GridExtractionStrategy extractionStrategy); @@ -42,7 +45,7 @@ void onScroll(GridScrollMode scrollMode, int getRegistryId(); - List getExtractionHints(GridView view); + List getExtractionHints(ItemStack carriedStack, GridView view); @Nullable @API(status = API.Status.INTERNAL) 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-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/AmountFormatting.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/AmountFormatting.java deleted file mode 100644 index 6997df638..000000000 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/AmountFormatting.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.refinedmods.refinedstorage.common.api.support; - -import java.math.RoundingMode; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.util.Locale; - -import org.apiguardian.api.API; - -@API(status = API.Status.STABLE, since = "2.0.0-milestone.1.0") -public final class AmountFormatting { - private static final DecimalFormat FORMATTER_WITH_UNITS = new DecimalFormat( - "####0.#", - DecimalFormatSymbols.getInstance(Locale.US) - ); - private static final DecimalFormat FORMATTER = new DecimalFormat( - "#,###", - DecimalFormatSymbols.getInstance(Locale.US) - ); - - static { - FORMATTER_WITH_UNITS.setRoundingMode(RoundingMode.FLOOR); - } - - private AmountFormatting() { - } - - public static String formatWithUnits(final long qty) { - if (qty >= 1_000_000_000) { - return formatBillion(qty); - } else if (qty >= 1_000_000) { - return formatMillion(qty); - } else if (qty >= 1000) { - return formatThousand(qty); - } - return String.valueOf(qty); - } - - private static String formatBillion(final long qty) { - return FORMATTER_WITH_UNITS.format(qty / 1_000_000_000D) + "B"; - } - - private static String formatMillion(final long qty) { - if (qty >= 100_000_000) { - return FORMATTER_WITH_UNITS.format(Math.floor(qty / 1_000_000D)) + "M"; - } - return FORMATTER_WITH_UNITS.format(qty / 1_000_000D) + "M"; - } - - private static String formatThousand(final long qty) { - if (qty >= 100_000) { - return FORMATTER_WITH_UNITS.format(Math.floor(qty / 1000D)) + "K"; - } - return FORMATTER_WITH_UNITS.format(qty / 1000D) + "K"; - } - - public static String format(final long qty) { - return FORMATTER.format(qty); - } -} diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/energy/AbstractNetworkEnergyItem.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/energy/AbstractNetworkEnergyItem.java index f9646e79d..171c7d7fd 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/energy/AbstractNetworkEnergyItem.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/energy/AbstractNetworkEnergyItem.java @@ -8,7 +8,9 @@ import java.util.List; import java.util.Optional; +import javax.annotation.Nullable; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; @@ -69,10 +71,13 @@ public void use(final ServerPlayer player, final ItemStack stack, final SlotRefe player, slotReference ); - use(player, slotReference, context); + use(stack.get(DataComponents.CUSTOM_NAME), player, slotReference, context); } - protected abstract void use(ServerPlayer player, SlotReference slotReference, NetworkItemContext context); + protected abstract void use(@Nullable Component name, + ServerPlayer player, + SlotReference slotReference, + NetworkItemContext context); public boolean isBound(final ItemStack stack) { return networkItemHelper.isBound(stack); diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/AbstractResourceType.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/AbstractResourceType.java deleted file mode 100644 index 6bd422fd7..000000000 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/AbstractResourceType.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.refinedmods.refinedstorage.common.api.support.resource; - -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; -import org.apiguardian.api.API; - -@API(status = API.Status.STABLE, since = "2.0.0-milestone.2.4") -public abstract class AbstractResourceType implements ResourceType { - private final String name; - private final MutableComponent title; - private final ResourceLocation textureIdentifier; - private final int textureX; - private final int textureY; - - protected AbstractResourceType(final String name, - final MutableComponent title, - final ResourceLocation textureIdentifier, - final int textureX, - final int textureY) { - this.name = name; - this.title = title; - this.textureIdentifier = textureIdentifier; - this.textureX = textureX; - this.textureY = textureY; - } - - @Override - public MutableComponent getTitle() { - return title; - } - - @Override - public ResourceLocation getTextureIdentifier() { - return textureIdentifier; - } - - @Override - public int getXTexture() { - return textureX; - } - - @Override - public int getYTexture() { - return textureY; - } - - @Override - public String toString() { - return name; - } -} diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceContainerInsertStrategy.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceContainerInsertStrategy.java index 139039666..007d8f8c2 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceContainerInsertStrategy.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceContainerInsertStrategy.java @@ -21,7 +21,7 @@ public interface ResourceContainerInsertStrategy { */ Optional insert(ItemStack container, ResourceAmount resourceAmount); - Optional getConversionInfo(ResourceKey resource); + Optional getConversionInfo(ResourceKey resource, ItemStack carriedStack); record InsertResult(ItemStack container, long inserted) { } diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceRendering.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceRendering.java index 1c50428d7..63722f40b 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceRendering.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceRendering.java @@ -13,7 +13,11 @@ @API(status = API.Status.STABLE, since = "2.0.0-milestone.2.13") public interface ResourceRendering { - String getDisplayedAmount(long amount, boolean withUnits); + default String formatAmount(long amount) { + return formatAmount(amount, false); + } + + String formatAmount(long amount, boolean withUnits); Component getDisplayName(ResourceKey resource); diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceType.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceType.java index 1e8d34bfa..4f02ddefa 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceType.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/support/resource/ResourceType.java @@ -23,11 +23,7 @@ public interface ResourceType { MutableComponent getTitle(); - ResourceLocation getTextureIdentifier(); - - int getXTexture(); - - int getYTexture(); + ResourceLocation getSprite(); long normalizeAmount(double amount); diff --git a/refinedstorage-common-api/src/test/java/com/refinedmods/refinedstorage/common/api/support/AmountFormattingTest.java b/refinedstorage-common-api/src/test/java/com/refinedmods/refinedstorage/common/api/support/AmountFormattingTest.java deleted file mode 100644 index faefd7d76..000000000 --- a/refinedstorage-common-api/src/test/java/com/refinedmods/refinedstorage/common/api/support/AmountFormattingTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.refinedmods.refinedstorage.common.api.support; - -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -class AmountFormattingTest { - @Test - void shouldFormatWithUnitsForSmallNumber() { - // Act & assert - assertThat(AmountFormatting.formatWithUnits(0)).isEqualTo("0"); - assertThat(AmountFormatting.formatWithUnits(1)).isEqualTo("1"); - assertThat(AmountFormatting.formatWithUnits(10)).isEqualTo("10"); - assertThat(AmountFormatting.formatWithUnits(105)).isEqualTo("105"); - } - - @Test - void shouldFormatWithUnitsForThousands() { - // Act & assert - assertThat(AmountFormatting.formatWithUnits(1000)).isEqualTo("1K"); - assertThat(AmountFormatting.formatWithUnits(1510)).isEqualTo("1.5K"); - - assertThat(AmountFormatting.formatWithUnits(10_000)).isEqualTo("10K"); - assertThat(AmountFormatting.formatWithUnits(10_510)).isEqualTo("10.5K"); - assertThat(AmountFormatting.formatWithUnits(99_999)).isEqualTo("99.9K"); - - assertThat(AmountFormatting.formatWithUnits(100_000)).isEqualTo("100K"); - assertThat(AmountFormatting.formatWithUnits(100_500)).isEqualTo("100K"); - assertThat(AmountFormatting.formatWithUnits(100_999)).isEqualTo("100K"); - - assertThat(AmountFormatting.formatWithUnits(101_000)).isEqualTo("101K"); - assertThat(AmountFormatting.formatWithUnits(101_500)).isEqualTo("101K"); - assertThat(AmountFormatting.formatWithUnits(101_999)).isEqualTo("101K"); - } - - @Test - void shouldFormatWithUnitsForMillions() { - // Act & assert - assertThat(AmountFormatting.formatWithUnits(1_000_000)).isEqualTo("1M"); - assertThat(AmountFormatting.formatWithUnits(1_510_000)).isEqualTo("1.5M"); - - assertThat(AmountFormatting.formatWithUnits(10_000_000)).isEqualTo("10M"); - assertThat(AmountFormatting.formatWithUnits(10_510_000)).isEqualTo("10.5M"); - assertThat(AmountFormatting.formatWithUnits(99_999_999)).isEqualTo("99.9M"); - - assertThat(AmountFormatting.formatWithUnits(100_000_000)).isEqualTo("100M"); - assertThat(AmountFormatting.formatWithUnits(100_510_000)).isEqualTo("100M"); - assertThat(AmountFormatting.formatWithUnits(100_999_000)).isEqualTo("100M"); - - assertThat(AmountFormatting.formatWithUnits(101_000_000)).isEqualTo("101M"); - assertThat(AmountFormatting.formatWithUnits(101_510_000)).isEqualTo("101M"); - assertThat(AmountFormatting.formatWithUnits(101_999_000)).isEqualTo("101M"); - } - - @Test - void shouldFormatWithUnitsForBillions() { - // Act & assert - assertThat(AmountFormatting.formatWithUnits(1_000_000_000)).isEqualTo("1B"); - assertThat(AmountFormatting.formatWithUnits(1_010_000_000)).isEqualTo("1B"); - assertThat(AmountFormatting.formatWithUnits(1_100_000_000)).isEqualTo("1.1B"); - assertThat(AmountFormatting.formatWithUnits(1_100_001_000)).isEqualTo("1.1B"); - assertThat(AmountFormatting.formatWithUnits(1_920_001_000)).isEqualTo("1.9B"); - } - - @Test - void shouldFormatWithoutUnits() { - // Act & assert - assertThat(AmountFormatting.format(0)).isEqualTo("0"); - assertThat(AmountFormatting.format(1)).isEqualTo("1"); - assertThat(AmountFormatting.format(10)).isEqualTo("10"); - assertThat(AmountFormatting.format(105)).isEqualTo("105"); - assertThat(AmountFormatting.format(1050)).isEqualTo("1,050"); - assertThat(AmountFormatting.format(10500)).isEqualTo("10,500"); - assertThat(AmountFormatting.format(100500)).isEqualTo("100,500"); - assertThat(AmountFormatting.format(1000500)).isEqualTo("1,000,500"); - } -} diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_cable.json index 648334b11..cff2dcaf0 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_constructor.json index 8be210c46..d58175384 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_controller.json index 8123a56fc..57f51d01a 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_crafting_grid.json index 8f0b69498..4ccc243cd 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_creative_controller.json index 5ec03bd97..0b2407503 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_destructor.json index a9a83086b..d37d81a3e 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_detector.json index 52898b736..8de1c722e 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_disk_interface.json index 24c802142..ac1f6222d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_grid.json index e574c4fdd..417539c4d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_network_receiver.json index c4384836c..23450acea 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_network_transmitter.json index a9ed752ae..ac3570184 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_pattern_grid.json index 1bbbc9cf6..4c1716fb9 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_relay.json index 8d07fbbd0..8c273d43e 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_security_manager.json index defbf005a..b02501bfe 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_wireless_transmitter.json index 3933a7c36..4f58d61be 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_cable.json index a58ea2e45..ef5e0dc34 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_constructor.json index 64d2af459..d1e4f8fed 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_controller.json index 56885102f..99625ac33 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_crafting_grid.json index 1bb7d29e5..a1c86a75d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_creative_controller.json index 12da65050..c33d112a4 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_destructor.json index d274f5fd8..0299f4905 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_detector.json index 0809791cb..8b81ed4cd 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_disk_interface.json index 18a317a93..8f7ea70cd 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_grid.json index a44f903cf..10d11d097 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_network_receiver.json index 217df93e6..78ec1a7f6 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_network_transmitter.json index 2cc41cc84..e0733074d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_pattern_grid.json index 1158b0064..77567bfce 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_relay.json index 96b197d1b..047bb9285 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_security_manager.json index e75eaaab8..2c674b682 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_wireless_transmitter.json index 984dcc955..97d86a90c 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_cable.json index 8a0b39f6a..4a937d211 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_constructor.json index 1ad80947f..baf5f28ef 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_controller.json index 9eae82c39..8df740050 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_crafting_grid.json index 428bae5fe..7bb8667fe 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_creative_controller.json index bd406e189..4cbb38ab1 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_destructor.json index 208ca71b7..99f1644ad 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_detector.json index c27e729d3..d49d59b87 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_disk_interface.json index 080a5f622..efd0a64b9 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_grid.json index a4f3fdc25..c7be84a60 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_network_receiver.json index 772cc7a3a..5a9f2e3aa 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_network_transmitter.json index 1e2dc8f4e..d576bf397 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_pattern_grid.json index 684d5e8c9..6c7e60827 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_relay.json index 866982400..f192c2d89 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_security_manager.json index efaa86333..8509f56ba 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_wireless_transmitter.json index 3312f0440..fe131ab2b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cable.json index f9956450f..9de758211 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/constructor.json index 04230b181..a1c6a199b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/controller.json index 6316da1bd..2c0663d27 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/crafting_grid.json index 757bac51c..5a184f330 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/creative_controller.json index c76ba2f3a..a2a00584c 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_cable.json index fd572122f..ddc65c136 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_constructor.json index 2a5f8ed8d..e53bdea0f 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_controller.json index efa1911f4..086edc8ad 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_crafting_grid.json index e412b1d4d..3b7b8e5d3 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_creative_controller.json index c105f081c..f53cd7d82 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_destructor.json index 9c36b7308..701bf64d2 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_detector.json index 5f9ae121e..661b2cf01 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_disk_interface.json index 1ae5ce2ee..9eb4a7244 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_grid.json index 7954e6cf2..80dae33d9 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_network_receiver.json index 3731c0cfb..0c67be32d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_network_transmitter.json index f8126882b..2ba0d682f 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_pattern_grid.json index 1e3e94404..6262e75af 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_relay.json index 0bb33a77e..7fecc7e70 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_security_manager.json index ccd1d4309..5158422a4 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_wireless_transmitter.json index d6e57fea8..3342c8af7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/destructor.json index 5aefe9504..667f0bc63 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/detector.json index 158f38e5e..2dbbfe44c 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/disk_interface.json index 05c0639bd..f74c4e015 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_controller.json index a2e7791ea..a28157f14 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_crafting_grid.json index 30b2c0f42..87dae7822 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_creative_controller.json index c09227605..aaef02567 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_detector.json index 91ad54b1f..91c3b84e4 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_disk_interface.json index 8f2ae3499..e21985760 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_grid.json index 6ee8c592e..03ac5621b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_network_receiver.json index ea905f0f9..b44cfe627 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_network_transmitter.json index 83b00cd87..efc4e740b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_pattern_grid.json index 8d9660d5a..74107f8aa 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_relay.json index 635106c6a..aa973e181 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_security_manager.json index c48615268..3c3fc36c8 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_wireless_transmitter.json index 244be7449..8336d76e9 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_cable.json index 49a2b9a72..5f427d6e7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_constructor.json index 75609629f..912f36bcb 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_controller.json index c8463fe0a..2707cceb7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_crafting_grid.json index 36d2e970e..d60e874c0 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_creative_controller.json index ca4cdc980..e807d7b32 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_destructor.json index 3adcf929a..fb5cf3e5c 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_detector.json index b0ce29372..283d00b40 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_disk_interface.json index efda445ca..9e03648c1 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_grid.json index 0c3640b49..f708ceffb 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_network_receiver.json index 3396f152f..1e1260028 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_network_transmitter.json index aeb7ec831..7c99588d7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_pattern_grid.json index 25e15cb87..da86ab6d7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_relay.json index effbee11b..d7f2f3be3 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_security_manager.json index 477a5def5..3d922ff62 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_wireless_transmitter.json index facfa38a7..85c96b81a 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/grid.json index 1d872c7a7..db92cf22e 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_cable.json index 0bf3d6281..e4f463207 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_constructor.json index 6ee100f09..bf53d4095 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_destructor.json index bf974dec0..0c4c29537 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_blue_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_cable.json index c02e7952f..cdbf59291 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_constructor.json index 1d8abc1d3..1a31e4852 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_controller.json index 73318448f..49da85264 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_crafting_grid.json index e923a22c8..1a6d9847c 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_creative_controller.json index fed9b9a50..baa00eff0 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_destructor.json index b560cf89d..56d16f0c7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_detector.json index d0ab4ca69..ab9611123 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_disk_interface.json index 36a02aace..f731a8306 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_grid.json index dbdf999f9..331fd5506 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_network_receiver.json index 2d160c49b..ea21ec792 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_network_transmitter.json index c650f9b12..d85e5fc30 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_pattern_grid.json index 9346120a7..08df7cc29 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_relay.json index 48a5e7f03..b00c24eeb 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_security_manager.json index 48e4e6b02..99bb7ac43 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_wireless_transmitter.json index ddf3e5d0a..ecbabafb3 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_cable.json index 9585b32c5..7b0c164b7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_constructor.json index 492673796..4cd4cbef9 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_controller.json index 1a2782e67..9a1ae5682 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_crafting_grid.json index 57cc8b57c..500445c85 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_creative_controller.json index fdd127086..fe43115a0 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_destructor.json index 258475a29..aa79f5191 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_detector.json index b56c8ee45..c1abb84bc 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_disk_interface.json index 50029864d..c2db65b4b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_grid.json index e3244476e..f401bfea7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_network_receiver.json index bb87854ee..51b360210 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_network_transmitter.json index 98678ab6d..1a691ebc3 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_pattern_grid.json index 4c5fd5b37..140079619 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_relay.json index 23d4b416b..cd66741f4 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_security_manager.json index 5a276b206..935b7cf5d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_wireless_transmitter.json index 7fa08e6be..fb710751d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_cable.json index 4518d8e9c..d55135e83 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_constructor.json index b9f46f2f0..82a724338 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_controller.json index 220e8f226..5607183c4 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_crafting_grid.json index 213e7070f..c23a6cb7a 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_creative_controller.json index 3386023c0..1becc21b3 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_destructor.json index 1e14318b7..aa222cef6 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_detector.json index 75cbfb2df..62f8a6725 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_disk_interface.json index ea4c18868..b5dee629e 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_grid.json index a3b9967da..cdd717286 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_network_receiver.json index 20c7c3fc7..8993c6fc4 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_network_transmitter.json index 519cc93c5..50cbf8a5b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_pattern_grid.json index d6da01e5b..ed4785574 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_relay.json index 9d5ae07c8..b289f16bf 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_security_manager.json index e99c042f4..dc682d150 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_wireless_transmitter.json index 98150a16a..1b69f90fd 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/network_receiver.json index a2b0583de..46604ffe0 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/network_transmitter.json index 54bd2e7c4..f248db369 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_cable.json index ec66f74f5..57f8e5760 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_constructor.json index 91775c6e6..53b95aaba 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_controller.json index bb1c56a6a..1852afc31 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_crafting_grid.json index 2d58ffded..719934716 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_creative_controller.json index d3288c66e..bd2050211 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_destructor.json index 3316fc948..09d5acb8a 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_detector.json index f606197b6..38bcb3bd0 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_disk_interface.json index d822a7f76..4fcca5dd7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_grid.json index 2f8450762..e748399bf 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_network_receiver.json index 06e007fd4..42dd39a14 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_network_transmitter.json index 66a257655..ad9f0777e 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_pattern_grid.json index 964916d38..d638e5327 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_relay.json index b39a4057a..b973a8456 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_security_manager.json index d38d3f6ae..8c4dfa5b8 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_wireless_transmitter.json index 45ebec51f..2366631ec 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pattern_grid.json index f395323e7..18266c1d1 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_cable.json index b64de0634..35bc6f384 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_constructor.json index b13ff1611..c44ac8e92 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_controller.json index cbbcd5491..92615ed53 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_crafting_grid.json index 56e94f59e..645ff2141 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_creative_controller.json index 614cbbfa5..b8487b1f2 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_destructor.json index 5372cc420..0d1753e6f 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_detector.json index cc9ef919e..20b43fba1 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_disk_interface.json index a4d9c7132..07aeba55b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_grid.json index 98a1a6cfe..233283357 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_network_receiver.json index 524b6f77d..2aaf630a4 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_network_transmitter.json index adfe359a8..e52d3b413 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_pattern_grid.json index 6bb450999..8581c6794 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_relay.json index f6287c8f7..31c251a8f 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_security_manager.json index 2b94afa0f..0a00660fd 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_wireless_transmitter.json index 732b922c0..fe614b525 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_cable.json index a60b36871..0fd1d1728 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_constructor.json index cfd9ff8a3..be70f60d9 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_controller.json index 312380c02..b46e03507 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_crafting_grid.json index 3c43045fd..4dce9422b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_creative_controller.json index 589ee2382..0e0c21dbd 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_destructor.json index 73d247b5a..04f550b5a 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_detector.json index 4ddd7f527..e02a40a65 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_disk_interface.json index e84dbb325..1e9de3dd5 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_grid.json index b4682e83f..765f18eef 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_network_receiver.json index bec3c2667..4f3c4902b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_network_transmitter.json index 482dfb63e..2ba2217f6 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_pattern_grid.json index 42404be9c..1ff9d8b8d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_relay.json index 6b816941d..e843dabe7 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_security_manager.json index e15d8cbe6..b99e6affc 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_wireless_transmitter.json index dc392f9d6..686d97323 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_cable.json index 1ccc97a34..e1eb6ff46 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_constructor.json index af687b3fd..514d23cf3 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_controller.json index ef8ab7d65..85282ec98 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_crafting_grid.json index 89def9c61..7d7afddbe 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_creative_controller.json index 421a8ed51..fe7f36243 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_destructor.json index 11226a220..98de66f73 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_detector.json index 56df24da6..f69cf07ce 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_disk_interface.json index 926cb0bc3..d08717af0 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_grid.json index c65e393fe..ace9a15e5 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_network_receiver.json index 5310dfc53..9807be0d2 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_network_transmitter.json index 3355b6793..250ec8938 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_pattern_grid.json index 25237dce7..3d3f603dd 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_relay.json index af0e1bf53..4ee4693b8 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_security_manager.json index dd4ffddcb..596c78385 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_wireless_transmitter.json index cb659bbb9..28c8eb932 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/relay.json index 2c727c13b..3dac491db 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/security_manager.json index af5ebe762..837b33925 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_cable.json index 8a7f09c24..b9fa781aa 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_constructor.json index dbe524878..5733edd79 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_controller.json index 56638f889..7cd7112ec 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_crafting_grid.json index 166c3a42b..b012f243d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_creative_controller.json index e8168fbc1..7212be8fe 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_destructor.json index 806585694..fd99115b1 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_detector.json index 44c0b1e6f..6932830ef 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_disk_interface.json index 1a39b9de4..307a75fb4 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_grid.json index 61361a837..bba29ff3a 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_network_receiver.json index 101a7f9f5..44ab9953a 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_network_transmitter.json index 34a4aeee6..89e7be9bd 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_pattern_grid.json index c059207d4..6179b0691 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_relay.json index d23e95892..6a1bd2c96 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_security_manager.json index 889a472bf..548f2af32 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_wireless_transmitter.json index 32a02bb65..bf1e7e4bd 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/wireless_transmitter.json index 968302c6f..d5d802148 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_cable.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_cable.json index 8f351c21d..589c38b0e 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_cable.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_cable.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_constructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_constructor.json index f91438fb8..9f4cfd260 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_constructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_constructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_controller.json index e4b17e966..bb51f0369 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_controller.json @@ -3,6 +3,13 @@ "functions": [ { "function": "refinedstorage:energy" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } ], "pools": [ diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_crafting_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_crafting_grid.json index a42021818..a629e836f 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_crafting_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_crafting_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_creative_controller.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_creative_controller.json index b280fb198..0a4585bcf 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_creative_controller.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_creative_controller.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_destructor.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_destructor.json index 473874387..a896c6b55 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_destructor.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_destructor.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_detector.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_detector.json index 4a969ba1e..345761b87 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_detector.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_detector.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_disk_interface.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_disk_interface.json index e67828299..394b00d00 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_disk_interface.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_disk_interface.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_grid.json index beea41b1d..22bfa898b 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_network_receiver.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_network_receiver.json index 1587bc1e1..689aab7fb 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_network_receiver.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_network_receiver.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_network_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_network_transmitter.json index 62262ec75..ff0dd2d84 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_network_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_network_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_pattern_grid.json index d2f5ce5e4..a1f9453a0 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_pattern_grid.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_pattern_grid.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_relay.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_relay.json index ee66221db..7a3e86c0d 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_relay.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_relay.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_security_manager.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_security_manager.json index 621bd69a4..e3077b1c4 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_security_manager.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_security_manager.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_wireless_transmitter.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_wireless_transmitter.json index 7ba60d977..02fc5f478 100644 --- a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_wireless_transmitter.json +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_wireless_transmitter.json @@ -1,5 +1,14 @@ { "type": "minecraft:block", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "pools": [ { "bonus_rolls": 0.0, diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractClientModInitializer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractClientModInitializer.java index b9d9c997b..d673c87fd 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractClientModInitializer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractClientModInitializer.java @@ -19,6 +19,7 @@ import com.refinedmods.refinedstorage.common.importer.ImporterScreen; import com.refinedmods.refinedstorage.common.networking.NetworkTransmitterScreen; import com.refinedmods.refinedstorage.common.networking.RelayScreen; +import com.refinedmods.refinedstorage.common.networking.WirelessTransmitterScreen; import com.refinedmods.refinedstorage.common.security.FallbackSecurityCardScreen; import com.refinedmods.refinedstorage.common.security.SecurityCardScreen; import com.refinedmods.refinedstorage.common.security.SecurityManagerScreen; @@ -36,7 +37,6 @@ import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import com.refinedmods.refinedstorage.common.support.resource.ItemResourceRendering; import com.refinedmods.refinedstorage.common.upgrade.RegulatorUpgradeScreen; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.WirelessTransmitterScreen; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; @@ -87,7 +87,9 @@ protected static void registerAlternativeGridHints() { protected static void registerResourceRendering() { RefinedStorageApi.INSTANCE.registerResourceRendering(ItemResource.class, new ItemResourceRendering()); - RefinedStorageApi.INSTANCE.registerResourceRendering(FluidResource.class, new FluidResourceRendering()); + RefinedStorageApi.INSTANCE.registerResourceRendering(FluidResource.class, new FluidResourceRendering( + Platform.INSTANCE.getBucketAmount() + )); } protected static void handleInputEvents() { 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 771447fdd..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 @@ -70,13 +70,19 @@ import com.refinedmods.refinedstorage.common.importer.ImporterContainerMenu; import com.refinedmods.refinedstorage.common.misc.ProcessorItem; import com.refinedmods.refinedstorage.common.misc.WrenchItem; +import com.refinedmods.refinedstorage.common.networking.BaseWirelessTransmitterRangeModifier; +import com.refinedmods.refinedstorage.common.networking.CreativeRangeUpgradeWirelessTransmitterRangeModifier; import com.refinedmods.refinedstorage.common.networking.NetworkCardItem; import com.refinedmods.refinedstorage.common.networking.NetworkReceiverBlockEntity; import com.refinedmods.refinedstorage.common.networking.NetworkTransmitterBlockEntity; import com.refinedmods.refinedstorage.common.networking.NetworkTransmitterContainerMenu; import com.refinedmods.refinedstorage.common.networking.NetworkTransmitterData; +import com.refinedmods.refinedstorage.common.networking.RangeUpgradeWirelessTransmitterRangeModifier; import com.refinedmods.refinedstorage.common.networking.RelayBlockEntity; import com.refinedmods.refinedstorage.common.networking.RelayContainerMenu; +import com.refinedmods.refinedstorage.common.networking.WirelessTransmitterBlockEntity; +import com.refinedmods.refinedstorage.common.networking.WirelessTransmitterContainerMenu; +import com.refinedmods.refinedstorage.common.networking.WirelessTransmitterData; import com.refinedmods.refinedstorage.common.security.BuiltinPermission; import com.refinedmods.refinedstorage.common.security.FallbackSecurityCardContainerMenu; import com.refinedmods.refinedstorage.common.security.PlatformSecurityNetworkComponentImpl; @@ -89,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; @@ -141,12 +149,6 @@ import com.refinedmods.refinedstorage.common.upgrade.SimpleUpgradeItem; import com.refinedmods.refinedstorage.common.upgrade.UpgradeDestinations; import com.refinedmods.refinedstorage.common.upgrade.UpgradeWithEnchantedBookRecipeSerializer; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.BaseWirelessTransmitterRangeModifier; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.CreativeRangeUpgradeWirelessTransmitterRangeModifier; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.RangeUpgradeWirelessTransmitterRangeModifier; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.WirelessTransmitterBlockEntity; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.WirelessTransmitterContainerMenu; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.WirelessTransmitterData; import java.util.Optional; import java.util.UUID; @@ -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/Platform.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Platform.java index d7c8baaa7..67245d029 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Platform.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Platform.java @@ -75,8 +75,6 @@ public interface Platform { Optional fillContainer(ItemStack container, ResourceAmount resourceAmount); - Optional getFilledBucket(FluidResource fluidResource); - TransferManager createTransferManager(AbstractContainerMenu containerMenu); long insertIntoContainer(Container container, ItemResource itemResource, long amount, Action action); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/PlatformProxy.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/PlatformProxy.java index 51e7a2660..ac5c84766 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/PlatformProxy.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/PlatformProxy.java @@ -118,11 +118,6 @@ public Optional fillContainer(final ItemStack container, return ensureLoaded().fillContainer(container, resourceAmount); } - @Override - public Optional getFilledBucket(final FluidResource fluidResource) { - return ensureLoaded().getFilledBucket(fluidResource); - } - @Override public TransferManager createTransferManager(final AbstractContainerMenu containerMenu) { return ensureLoaded().createTransferManager(containerMenu); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java index 6e0c4ebc5..6b75e9080 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java @@ -56,6 +56,7 @@ import com.refinedmods.refinedstorage.common.grid.strategy.CompositeGridExtractionStrategy; import com.refinedmods.refinedstorage.common.grid.strategy.CompositeGridInsertionStrategy; import com.refinedmods.refinedstorage.common.grid.strategy.CompositeGridScrollingStrategy; +import com.refinedmods.refinedstorage.common.networking.CompositeWirelessTransmitterRangeModifier; import com.refinedmods.refinedstorage.common.storage.ClientStorageRepository; import com.refinedmods.refinedstorage.common.storage.StorageContainerItemHelperImpl; import com.refinedmods.refinedstorage.common.storage.StorageRepositoryImpl; @@ -80,7 +81,6 @@ import com.refinedmods.refinedstorage.common.upgrade.UpgradeRegistryImpl; import com.refinedmods.refinedstorage.common.util.IdentifierUtil; import com.refinedmods.refinedstorage.common.util.ServerEventQueue; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.CompositeWirelessTransmitterRangeModifier; import java.util.ArrayList; import java.util.Arrays; @@ -456,8 +456,8 @@ public void registerResourceRendering(final Class res } @Override - public ResourceRendering getResourceRendering(final ResourceKey resource) { - return resourceRenderingMap.get(resource.getClass()); + public ResourceRendering getResourceRendering(final Class resourceClass) { + return resourceRenderingMap.get(resourceClass); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/AlternativesScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/AlternativesScreen.java index 7661de56f..e23aa3dcc 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/AlternativesScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/AlternativesScreen.java @@ -2,7 +2,7 @@ import com.refinedmods.refinedstorage.common.Platform; import com.refinedmods.refinedstorage.common.support.ResourceSlotRendering; -import com.refinedmods.refinedstorage.common.support.TextureIds; +import com.refinedmods.refinedstorage.common.support.Sprites; import com.refinedmods.refinedstorage.common.support.amount.AbstractAmountScreen; import com.refinedmods.refinedstorage.common.support.amount.AmountScreenConfiguration; import com.refinedmods.refinedstorage.common.support.amount.DoubleAmountOperations; @@ -30,7 +30,7 @@ import net.minecraft.world.entity.player.Inventory; import org.joml.Vector3f; -import static com.refinedmods.refinedstorage.common.support.TextureIds.SEARCH_SIZE; +import static com.refinedmods.refinedstorage.common.support.Sprites.SEARCH_SIZE; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; @@ -300,7 +300,7 @@ public void render(final GuiGraphics graphics, final int mouseX, final int mouse @Override protected void renderBg(final GuiGraphics graphics, final float delta, final int mouseX, final int mouseY) { super.renderBg(graphics, delta, mouseX, mouseY); - graphics.blitSprite(TextureIds.SEARCH, leftPos + 7, topPos + 107, SEARCH_SIZE, SEARCH_SIZE); + graphics.blitSprite(Sprites.SEARCH, leftPos + 7, topPos + 107, SEARCH_SIZE, SEARCH_SIZE); final int x = getInsetX(); final int y = getInsetY(); graphics.enableScissor(x, y, x + INSET_WIDTH, y + INSET_HEIGHT); @@ -365,7 +365,7 @@ private void renderMainSlotsBackground( if (y >= startY - ALTERNATIVE_ROW_HEIGHT && y < startY + INSET_HEIGHT) { for (int col = 0; col < Math.min(alternative.getResources().size(), RESOURCES_PER_ROW); ++col) { final int slotX = x + 1 + (col * 18); - graphics.blitSprite(TextureIds.SLOT, slotX, y, 18, 18); + graphics.blitSprite(Sprites.SLOT, slotX, y, 18, 18); } } } @@ -395,7 +395,7 @@ private int renderOverflowSlotsBackground(final GuiGraphics graphics, break; } final int slotX = x + 1 + (col * 18); - graphics.blitSprite(TextureIds.SLOT, slotX, rowY, 18, 18); + graphics.blitSprite(Sprites.SLOT, slotX, rowY, 18, 18); } } renderSlots(alternative.getOverflowSlots(), graphics, mouseX, mouseY); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternClientTooltipComponent.java index d9e0e869e..934acb854 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternClientTooltipComponent.java @@ -15,10 +15,10 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_HEIGHT; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_WIDTH; -import static com.refinedmods.refinedstorage.common.support.TextureIds.SLOT; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_HEIGHT; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_WIDTH; +import static com.refinedmods.refinedstorage.common.support.Sprites.SLOT; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static java.util.Objects.requireNonNullElse; @@ -100,7 +100,7 @@ private void renderInputSlot(final int x, final int y, final GuiGraphics graphic if (!inputs.isEmpty()) { final int idx = currentCycle % inputs.size(); final PlatformResourceKey resource = inputs.get(idx); - RefinedStorageApi.INSTANCE.getResourceRendering(resource).render( + RefinedStorageApi.INSTANCE.getResourceRendering(resource.getClass()).render( resource, graphics, x + sx * 18 + 1, diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlockEntity.java index 601aa36e3..6594c0590 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlockEntity.java @@ -215,7 +215,7 @@ void setPatternType(final PatternType patternType) { @Override public Component getDisplayName() { - return ContentNames.PATTERN_GRID; + return getName(ContentNames.PATTERN_GRID); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItem.java index 522a54053..dbb5295d8 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItem.java @@ -10,7 +10,7 @@ import com.refinedmods.refinedstorage.common.content.Items; import com.refinedmods.refinedstorage.common.support.RecipeMatrixContainer; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; -import com.refinedmods.refinedstorage.common.util.PlatformUtil; +import com.refinedmods.refinedstorage.common.util.ClientPlatformUtil; import java.util.ArrayList; import java.util.Arrays; @@ -86,7 +86,7 @@ public Optional getTooltipImage(final ItemStack stack) { if (state == null) { return Optional.of(new HelpTooltipComponent(HELP)); } - final Level level = PlatformUtil.getClientLevel(); + final Level level = ClientPlatformUtil.getClientLevel(); return switch (state.type()) { case CRAFTING -> { final CraftingPatternState craftingState = stack.get(DataComponents.INSTANCE.getCraftingPatternState()); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternRendering.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternRendering.java index 3c8108885..8f4ccc83e 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternRendering.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternRendering.java @@ -3,7 +3,7 @@ import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; import com.refinedmods.refinedstorage.common.api.autocrafting.PatternProviderItem; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; -import com.refinedmods.refinedstorage.common.util.PlatformUtil; +import com.refinedmods.refinedstorage.common.util.ClientPlatformUtil; import java.util.Optional; @@ -32,7 +32,7 @@ public static boolean canDisplayOutput(final ItemStack stack) { } public static Optional getOutput(final ItemStack stack) { - final Level level = PlatformUtil.getClientLevel(); + final Level level = ClientPlatformUtil.getClientLevel(); if (level == null) { return Optional.empty(); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTooltipCache.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTooltipCache.java index ca8602462..969a65217 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTooltipCache.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTooltipCache.java @@ -35,8 +35,7 @@ public static ClientTooltipComponent getComponent(final PatternItem.StonecutterP CACHE.clear(); } return CACHE.computeIfAbsent(key.id(), id -> new StonecutterPatternClientTooltipComponent( - key.stonecutterPattern().input(), - key.stonecutterPattern().output() + key.stonecutterPattern() )); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/ProcessingMatrixInputClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/ProcessingMatrixInputClientTooltipComponent.java index da3289b08..982a56aba 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/ProcessingMatrixInputClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/ProcessingMatrixInputClientTooltipComponent.java @@ -69,7 +69,7 @@ public void renderImage(final Font font, final int x, final int y, final GuiGrap final PlatformResourceKey resource = alternative.resources().get( currentCycle % alternative.resources().size() ); - final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(resource); + final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(resource.getClass()); rendering.render(resource, graphics, x, y + 9 + PADDING + i * 18); graphics.drawString( font, diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/ProcessingPatternClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/ProcessingPatternClientTooltipComponent.java index 2a5d22278..742cefdf6 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/ProcessingPatternClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/ProcessingPatternClientTooltipComponent.java @@ -15,10 +15,10 @@ import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.network.chat.Component; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_HEIGHT; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_WIDTH; -import static com.refinedmods.refinedstorage.common.support.TextureIds.SLOT; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_HEIGHT; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_WIDTH; +import static com.refinedmods.refinedstorage.common.support.Sprites.SLOT; import static java.util.Objects.requireNonNullElse; class ProcessingPatternClientTooltipComponent implements ClientTooltipComponent { @@ -77,12 +77,9 @@ private static List getOutputText(final ProcessingPatternState state) private static Component getOutputText(final ResourceAmount resourceAmount) { final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering( - resourceAmount.resource() - ); - final String displayAmount = rendering.getDisplayedAmount( - resourceAmount.amount(), - false + resourceAmount.resource().getClass() ); + final String displayAmount = rendering.formatAmount(resourceAmount.amount()); return Component.literal(String.format("%sx ", displayAmount)) .append(rendering.getDisplayName(resourceAmount.resource())) .withStyle(ChatFormatting.GRAY); @@ -152,10 +149,10 @@ private void renderMatrixSlot( } final ResourceAmount resourceAmount = possibilities.get(currentCycle % possibilities.size()); final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering( - resourceAmount.resource() + resourceAmount.resource().getClass() ); rendering.render(resourceAmount.resource(), graphics, slotX + 1, slotY + 1); - ResourceSlotRendering.render(graphics, slotX + 1, slotY + 1, resourceAmount.amount(), rendering); + ResourceSlotRendering.renderAmount(graphics, slotX + 1, slotY + 1, resourceAmount.amount(), rendering); } private void renderOutputText(final Font font, final int x, final int y, final GuiGraphics graphics) { diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePattern.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePattern.java index 48b5de368..97a1c4520 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePattern.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePattern.java @@ -1,10 +1,8 @@ package com.refinedmods.refinedstorage.common.autocrafting; import com.refinedmods.refinedstorage.common.api.autocrafting.Pattern; -import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; +import com.refinedmods.refinedstorage.common.support.resource.ItemResource; -record SmithingTablePattern(PlatformResourceKey template, - PlatformResourceKey base, - PlatformResourceKey addition, - PlatformResourceKey output) implements Pattern { +record SmithingTablePattern(ItemResource template, ItemResource base, ItemResource addition, ItemResource output) + implements Pattern { } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePatternClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePatternClientTooltipComponent.java index 67fbdcf70..312cc58e2 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePatternClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePatternClientTooltipComponent.java @@ -1,9 +1,9 @@ package com.refinedmods.refinedstorage.common.autocrafting; import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; -import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; import com.refinedmods.refinedstorage.common.api.support.resource.ResourceRendering; -import com.refinedmods.refinedstorage.common.support.TextureIds; +import com.refinedmods.refinedstorage.common.support.Sprites; +import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.Font; @@ -11,9 +11,9 @@ import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.network.chat.Component; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_HEIGHT; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_WIDTH; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_HEIGHT; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_WIDTH; import static java.util.Objects.requireNonNullElse; class SmithingTablePatternClientTooltipComponent implements ClientTooltipComponent { @@ -31,15 +31,13 @@ class SmithingTablePatternClientTooltipComponent implements ClientTooltipCompone public void renderImage(final Font font, final int x, final int y, final GuiGraphics graphics) { graphics.drawString(font, outputText, x, y, requireNonNullElse(ChatFormatting.GRAY.getColor(), 15)); final int slotsY = y + 9 + 2; - graphics.blitSprite(TextureIds.SLOT, x, slotsY, 18, 18); - RefinedStorageApi.INSTANCE.getResourceRendering(pattern.template()) - .render(pattern.template(), graphics, x + 1, slotsY + 1); - graphics.blitSprite(TextureIds.SLOT, x + 18, slotsY, 18, 18); - RefinedStorageApi.INSTANCE.getResourceRendering(pattern.base()) - .render(pattern.base(), graphics, x + 18 + 1, slotsY + 1); - graphics.blitSprite(TextureIds.SLOT, x + 18 + 18, slotsY, 18, 18); - RefinedStorageApi.INSTANCE.getResourceRendering(pattern.addition()) - .render(pattern.addition(), graphics, x + 18 + 18 + 1, slotsY + 1); + graphics.blitSprite(Sprites.SLOT, x, slotsY, 18, 18); + final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(ItemResource.class); + rendering.render(pattern.template(), graphics, x + 1, slotsY + 1); + graphics.blitSprite(Sprites.SLOT, x + 18, slotsY, 18, 18); + rendering.render(pattern.base(), graphics, x + 18 + 1, slotsY + 1); + graphics.blitSprite(Sprites.SLOT, x + 18 + 18, slotsY, 18, 18); + rendering.render(pattern.addition(), graphics, x + 18 + 18 + 1, slotsY + 1); graphics.blitSprite( LIGHT_ARROW, x + (18 * 3) + ARROW_SPACING, @@ -48,9 +46,8 @@ public void renderImage(final Font font, final int x, final int y, final GuiGrap LIGHT_ARROW_HEIGHT ); final int lastSlotX = x + (18 * 3) + ARROW_SPACING + LIGHT_ARROW_WIDTH + ARROW_SPACING; - graphics.blitSprite(TextureIds.SLOT, lastSlotX, slotsY, 18, 18); - RefinedStorageApi.INSTANCE.getResourceRendering(pattern.output()) - .render(pattern.output(), graphics, lastSlotX + 1, slotsY + 1); + graphics.blitSprite(Sprites.SLOT, lastSlotX, slotsY, 18, 18); + rendering.render(pattern.output(), graphics, lastSlotX + 1, slotsY + 1); } @Override @@ -66,10 +63,10 @@ public int getWidth(final Font font) { ); } - private static Component getOutputText(final PlatformResourceKey resource) { - final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(resource); + private static Component getOutputText(final ItemResource output) { + final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(ItemResource.class); return Component.literal("1x ") - .append(rendering.getDisplayName(resource)) + .append(rendering.getDisplayName(output)) .withStyle(ChatFormatting.GRAY); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePatternGridRenderer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePatternGridRenderer.java index 9628d7568..9008c9790 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePatternGridRenderer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/SmithingTablePatternGridRenderer.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage.common.autocrafting; -import com.refinedmods.refinedstorage.common.util.PlatformUtil; +import com.refinedmods.refinedstorage.common.util.ClientPlatformUtil; import java.util.List; import java.util.Optional; @@ -62,7 +62,7 @@ class SmithingTablePatternGridRenderer implements PatternGridRenderer { @Override public void addWidgets(final Consumer widgets, final Consumer renderables) { - final Level level = PlatformUtil.getClientLevel(); + final Level level = ClientPlatformUtil.getClientLevel(); if (level == null) { return; } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPattern.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPattern.java index 3b39fb08f..e325ac647 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPattern.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPattern.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage.common.autocrafting; import com.refinedmods.refinedstorage.common.api.autocrafting.Pattern; -import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; +import com.refinedmods.refinedstorage.common.support.resource.ItemResource; -record StonecutterPattern(PlatformResourceKey input, PlatformResourceKey output) implements Pattern { +record StonecutterPattern(ItemResource input, ItemResource output) implements Pattern { } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPatternClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPatternClientTooltipComponent.java index 80e0452c1..eeff7d187 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPatternClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPatternClientTooltipComponent.java @@ -3,6 +3,7 @@ import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; import com.refinedmods.refinedstorage.common.api.support.resource.ResourceRendering; +import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.Font; @@ -10,10 +11,10 @@ import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.network.chat.Component; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_HEIGHT; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_WIDTH; -import static com.refinedmods.refinedstorage.common.support.TextureIds.SLOT; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_HEIGHT; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_WIDTH; +import static com.refinedmods.refinedstorage.common.support.Sprites.SLOT; import static java.util.Objects.requireNonNullElse; class StonecutterPatternClientTooltipComponent implements ClientTooltipComponent { @@ -23,17 +24,18 @@ class StonecutterPatternClientTooltipComponent implements ClientTooltipComponent private final PlatformResourceKey input; private final PlatformResourceKey output; - StonecutterPatternClientTooltipComponent(final PlatformResourceKey input, final PlatformResourceKey output) { - this.outputText = getOutputText(output); - this.input = input; - this.output = output; + StonecutterPatternClientTooltipComponent(final StonecutterPattern pattern) { + this.outputText = getOutputText(pattern.output()); + this.input = pattern.input(); + this.output = pattern.output(); } @Override public void renderImage(final Font font, final int x, final int y, final GuiGraphics graphics) { graphics.drawString(font, outputText, x, y, requireNonNullElse(ChatFormatting.GRAY.getColor(), 15)); graphics.blitSprite(SLOT, x, y + 9 + 2, 18, 18); - RefinedStorageApi.INSTANCE.getResourceRendering(input).render(input, graphics, x + 1, y + 9 + 2 + 1); + final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(ItemResource.class); + rendering.render(input, graphics, x + 1, y + 9 + 2 + 1); graphics.blitSprite( LIGHT_ARROW, x + 18 + ARROW_SPACING, @@ -48,7 +50,7 @@ public void renderImage(final Font font, final int x, final int y, final GuiGrap 16, 18 ); - RefinedStorageApi.INSTANCE.getResourceRendering(output).render( + rendering.render( output, graphics, x + 18 + ARROW_SPACING + LIGHT_ARROW_WIDTH + ARROW_SPACING, @@ -56,10 +58,10 @@ public void renderImage(final Font font, final int x, final int y, final GuiGrap ); } - private static Component getOutputText(final PlatformResourceKey resource) { - final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(resource); + private static Component getOutputText(final ItemResource output) { + final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(ItemResource.class); return Component.literal("1x ") - .append(rendering.getDisplayName(resource)) + .append(rendering.getDisplayName(output)) .withStyle(ChatFormatting.GRAY); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPatternGridRenderer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPatternGridRenderer.java index cb7551b3c..b7b5beb04 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPatternGridRenderer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/StonecutterPatternGridRenderer.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage.common.autocrafting; import com.refinedmods.refinedstorage.common.support.widget.ScrollbarWidget; -import com.refinedmods.refinedstorage.common.util.PlatformUtil; +import com.refinedmods.refinedstorage.common.util.ClientPlatformUtil; import java.util.function.Consumer; import javax.annotation.Nullable; @@ -125,7 +125,7 @@ public void renderBackground(final GuiGraphics graphics, } graphics.blitSprite(buttonSprite, xx, yy, 16, 18); graphics.renderItem( - recipe.value().getResultItem(requireNonNull(PlatformUtil.getClientLevel()).registryAccess()), + recipe.value().getResultItem(requireNonNull(ClientPlatformUtil.getClientLevel()).registryAccess()), xx, yy + 1 ); @@ -145,7 +145,7 @@ public void renderTooltip(final Font font, for (int i = 0; i < menu.getStonecutterRecipes().size(); ++i) { final RecipeHolder recipe = menu.getStonecutterRecipes().get(i); final ItemStack result = recipe.value().getResultItem( - requireNonNull(PlatformUtil.getClientLevel()).registryAccess() + requireNonNull(ClientPlatformUtil.getClientLevel()).registryAccess() ); final int xx = getRecipeX(x, i); final int row = i / VanillaConstants.STONECUTTER_RECIPES_PER_ROW; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorBlockEntity.java index d27776517..9f7acea16 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorBlockEntity.java @@ -129,7 +129,7 @@ void setDropItems(final boolean dropItems) { @Override public Component getDisplayName() { - return ContentNames.CONSTRUCTOR; + return getName(ContentNames.CONSTRUCTOR); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorDropItemsSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorDropItemsSideButtonWidget.java index f27231ee6..33127f356 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorDropItemsSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/ConstructorDropItemsSideButtonWidget.java @@ -3,20 +3,18 @@ import com.refinedmods.refinedstorage.common.support.containermenu.ClientProperty; import com.refinedmods.refinedstorage.common.support.widget.AbstractYesNoSideButtonWidget; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; class ConstructorDropItemsSideButtonWidget extends AbstractYesNoSideButtonWidget { - ConstructorDropItemsSideButtonWidget(final ClientProperty property) { - super(property, createTranslation("gui", "constructor.drop_items")); - } + private static final MutableComponent TITLE = createTranslation("gui", "constructor.drop_items"); + private static final ResourceLocation YES = createIdentifier("widget/side_button/constructor_drop_items/yes"); + private static final ResourceLocation NO = createIdentifier("widget/side_button/constructor_drop_items/no"); - @Override - protected int getXTexture() { - return Boolean.TRUE.equals(property.getValue()) ? 80 : 64; - } - - @Override - protected int getYTexture() { - return 16; + ConstructorDropItemsSideButtonWidget(final ClientProperty property) { + super(property, TITLE, YES, NO); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorBlockEntity.java index 0381141d7..40b5c1833 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorBlockEntity.java @@ -128,7 +128,7 @@ public StreamEncoder getMenuCode @Override public Component getDisplayName() { - return ContentNames.DESTRUCTOR; + return getName(ContentNames.DESTRUCTOR); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorPickupItemsSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorPickupItemsSideButtonWidget.java index 3c80a1fc1..40f929a85 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorPickupItemsSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/constructordestructor/DestructorPickupItemsSideButtonWidget.java @@ -3,20 +3,18 @@ import com.refinedmods.refinedstorage.common.support.containermenu.ClientProperty; import com.refinedmods.refinedstorage.common.support.widget.AbstractYesNoSideButtonWidget; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; class DestructorPickupItemsSideButtonWidget extends AbstractYesNoSideButtonWidget { - DestructorPickupItemsSideButtonWidget(final ClientProperty property) { - super(property, createTranslation("gui", "destructor.pickup_items")); - } + private static final MutableComponent TITLE = createTranslation("gui", "destructor.pickup_items"); + private static final ResourceLocation YES = createIdentifier("widget/side_button/destructor_pickup_items/yes"); + private static final ResourceLocation NO = createIdentifier("widget/side_button/destructor_pickup_items/no"); - @Override - protected int getXTexture() { - return Boolean.TRUE.equals(property.getValue()) ? 64 : 80; - } - - @Override - protected int getYTexture() { - return 0; + DestructorPickupItemsSideButtonWidget(final ClientProperty property) { + super(property, TITLE, YES, NO); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/BlockEntities.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/BlockEntities.java index 52cbb5070..edf871ffa 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/BlockEntities.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/BlockEntities.java @@ -14,6 +14,7 @@ import com.refinedmods.refinedstorage.common.networking.NetworkReceiverBlockEntity; import com.refinedmods.refinedstorage.common.networking.NetworkTransmitterBlockEntity; import com.refinedmods.refinedstorage.common.networking.RelayBlockEntity; +import com.refinedmods.refinedstorage.common.networking.WirelessTransmitterBlockEntity; import com.refinedmods.refinedstorage.common.security.SecurityManagerBlockEntity; import com.refinedmods.refinedstorage.common.storage.FluidStorageVariant; import com.refinedmods.refinedstorage.common.storage.ItemStorageVariant; @@ -25,7 +26,6 @@ import com.refinedmods.refinedstorage.common.storage.storageblock.ItemStorageBlockBlockEntity; import com.refinedmods.refinedstorage.common.storagemonitor.StorageMonitorBlockEntity; import com.refinedmods.refinedstorage.common.support.network.BaseNetworkNodeContainerBlockEntity; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.WirelessTransmitterBlockEntity; import java.util.EnumMap; import java.util.Map; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Blocks.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Blocks.java index 2f9eaf37f..ee4512331 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Blocks.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Blocks.java @@ -19,6 +19,7 @@ import com.refinedmods.refinedstorage.common.networking.NetworkReceiverBlock; import com.refinedmods.refinedstorage.common.networking.NetworkTransmitterBlock; import com.refinedmods.refinedstorage.common.networking.RelayBlock; +import com.refinedmods.refinedstorage.common.networking.WirelessTransmitterBlock; import com.refinedmods.refinedstorage.common.security.SecurityManagerBlock; import com.refinedmods.refinedstorage.common.storage.FluidStorageVariant; import com.refinedmods.refinedstorage.common.storage.ItemStorageVariant; @@ -32,7 +33,6 @@ import com.refinedmods.refinedstorage.common.storagemonitor.StorageMonitorBlock; import com.refinedmods.refinedstorage.common.support.BaseBlockItem; import com.refinedmods.refinedstorage.common.support.SimpleBlock; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.WirelessTransmitterBlock; import java.util.EnumMap; import java.util.Map; 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/content/Menus.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Menus.java index b4c7642a2..328a7615c 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Menus.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Menus.java @@ -13,6 +13,7 @@ import com.refinedmods.refinedstorage.common.importer.ImporterContainerMenu; import com.refinedmods.refinedstorage.common.networking.NetworkTransmitterContainerMenu; import com.refinedmods.refinedstorage.common.networking.RelayContainerMenu; +import com.refinedmods.refinedstorage.common.networking.WirelessTransmitterContainerMenu; import com.refinedmods.refinedstorage.common.security.FallbackSecurityCardContainerMenu; import com.refinedmods.refinedstorage.common.security.SecurityCardContainerMenu; import com.refinedmods.refinedstorage.common.security.SecurityManagerContainerMenu; @@ -25,7 +26,6 @@ import com.refinedmods.refinedstorage.common.storage.storageblock.ItemStorageBlockContainerMenu; import com.refinedmods.refinedstorage.common.storagemonitor.StorageMonitorContainerMenu; import com.refinedmods.refinedstorage.common.upgrade.RegulatorUpgradeContainerMenu; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.WirelessTransmitterContainerMenu; import java.util.function.Supplier; import javax.annotation.Nullable; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/controller/ControllerBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/controller/ControllerBlockEntity.java index 455822a92..436e74356 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/controller/ControllerBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/controller/ControllerBlockEntity.java @@ -19,6 +19,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.codec.StreamEncoder; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -95,7 +96,10 @@ public void loadAdditional(final CompoundTag tag, final HolderLookup.Provider pr @Override public Component getDisplayName() { - return type == ControllerType.CREATIVE ? ContentNames.CREATIVE_CONTROLLER : ContentNames.CONTROLLER; + final MutableComponent defaultName = type == ControllerType.CREATIVE + ? ContentNames.CREATIVE_CONTROLLER + : ContentNames.CONTROLLER; + return getName(defaultName); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/detector/DetectorBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/detector/DetectorBlockEntity.java index f3e5606be..f78a38032 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/detector/DetectorBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/detector/DetectorBlockEntity.java @@ -151,7 +151,7 @@ public StreamEncoder getMenuCodec() { @Override public Component getDisplayName() { - return ContentNames.DETECTOR; + return getName(ContentNames.DETECTOR); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/detector/DetectorModeSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/detector/DetectorModeSideButtonWidget.java index 8e9da9084..c8bb167ad 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/detector/DetectorModeSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/detector/DetectorModeSideButtonWidget.java @@ -5,7 +5,9 @@ import com.refinedmods.refinedstorage.common.support.widget.AbstractSideButtonWidget; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; class DetectorModeSideButtonWidget extends AbstractSideButtonWidget { @@ -13,6 +15,9 @@ class DetectorModeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent SUBTEXT_EQUAL = createTranslation("gui", "detector.mode.equal"); private static final MutableComponent SUBTEXT_ABOVE = createTranslation("gui", "detector.mode.above"); private static final MutableComponent SUBTEXT_UNDER = createTranslation("gui", "detector.mode.under"); + private static final ResourceLocation EQUAL = createIdentifier("widget/side_button/detector_mode/equal"); + private static final ResourceLocation ABOVE = createIdentifier("widget/side_button/detector_mode/above"); + private static final ResourceLocation UNDER = createIdentifier("widget/side_button/detector_mode/under"); private final ClientProperty property; @@ -34,19 +39,14 @@ private static DetectorMode toggle(final DetectorMode detectorMode) { } @Override - protected int getXTexture() { + protected ResourceLocation getSprite() { return switch (property.getValue()) { - case UNDER -> 0; - case EQUAL -> 16; - case ABOVE -> 32; + case UNDER -> UNDER; + case EQUAL -> EQUAL; + case ABOVE -> ABOVE; }; } - @Override - protected int getYTexture() { - return 176; - } - @Override protected MutableComponent getTitle() { return TITLE; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/exporter/ExporterBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/exporter/ExporterBlockEntity.java index f4f69e761..7de0bd47e 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/exporter/ExporterBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/exporter/ExporterBlockEntity.java @@ -80,7 +80,7 @@ protected void setEnergyUsage(final long upgradeEnergyUsage) { @Override public Component getDisplayName() { - return ContentNames.EXPORTER; + return getName(ContentNames.EXPORTER); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridSynchronizer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridSynchronizer.java deleted file mode 100644 index 92cfb70f8..000000000 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridSynchronizer.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.refinedmods.refinedstorage.common.grid; - -import com.refinedmods.refinedstorage.common.api.grid.GridSynchronizer; -import com.refinedmods.refinedstorage.common.support.TextureIds; - -import net.minecraft.resources.ResourceLocation; - -public abstract class AbstractGridSynchronizer implements GridSynchronizer { - @Override - public ResourceLocation getTextureIdentifier() { - return TextureIds.SIDE_BUTTON_ICONS; - } - - @Override - public int getYTexture() { - return 96; - } -} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridBlockEntity.java index 1b00ec83d..fd5257c2c 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridBlockEntity.java @@ -75,7 +75,7 @@ public StreamEncoder getMenuCodec() { @Override public Component getDisplayName() { - return ContentNames.CRAFTING_GRID; + return getName(ContentNames.CRAFTING_GRID); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/GridBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/GridBlockEntity.java index 4f20e964f..32d2039b2 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/GridBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/GridBlockEntity.java @@ -32,7 +32,7 @@ public StreamEncoder getMenuCodec() { @Override public Component getDisplayName() { - return ContentNames.GRID; + return getName(ContentNames.GRID); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/NoopGridSynchronizer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/NoopGridSynchronizer.java index 92accb73c..556b9f591 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/NoopGridSynchronizer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/NoopGridSynchronizer.java @@ -1,17 +1,28 @@ package com.refinedmods.refinedstorage.common.grid; +import com.refinedmods.refinedstorage.common.api.grid.GridSynchronizer; + import javax.annotation.Nullable; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import org.apiguardian.api.API; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; -public class NoopGridSynchronizer extends AbstractGridSynchronizer { +public class NoopGridSynchronizer implements GridSynchronizer { public static final NoopGridSynchronizer INSTANCE = new NoopGridSynchronizer(); + @API(status = API.Status.INTERNAL) + public static final ResourceLocation ON = createIdentifier("widget/side_button/grid/synchronization_mode/on"); + @API(status = API.Status.INTERNAL) + public static final ResourceLocation ON_TWO_WAY = + createIdentifier("widget/side_button/grid/synchronization_mode/on_two_way"); - private static final MutableComponent TITLE = createTranslation("gui", "grid.synchronizer.off"); - private static final Component HELP = createTranslation("gui", "grid.synchronizer.off.help"); + private static final MutableComponent TITLE = createTranslation("gui", "grid.synchronization_mode.off"); + private static final Component HELP = createTranslation("gui", "grid.synchronization_mode.off.help"); + private static final ResourceLocation OFF = createIdentifier("widget/side_button/grid/synchronization_mode/off"); private NoopGridSynchronizer() { } @@ -38,7 +49,7 @@ public String getTextToSynchronizeToGrid() { } @Override - public int getXTexture() { - return 64; + public ResourceLocation getSprite() { + return OFF; } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/WirelessGridExtendedMenuProvider.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/WirelessGridExtendedMenuProvider.java index f66f2720c..74a8eb3c1 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/WirelessGridExtendedMenuProvider.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/WirelessGridExtendedMenuProvider.java @@ -15,10 +15,17 @@ import net.minecraft.world.inventory.AbstractContainerMenu; class WirelessGridExtendedMenuProvider implements ExtendedMenuProvider { + @Nullable + private final Component name; private final Grid grid; private final SlotReference slotReference; - WirelessGridExtendedMenuProvider(final Grid grid, final SlotReference slotReference) { + WirelessGridExtendedMenuProvider( + @Nullable final Component name, + final Grid grid, + final SlotReference slotReference + ) { + this.name = name; this.grid = grid; this.slotReference = slotReference; } @@ -38,7 +45,7 @@ public StreamEncoder getMenuCodec() { @Override public Component getDisplayName() { - return ContentNames.WIRELESS_GRID; + return name == null ? ContentNames.WIRELESS_GRID : name; } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/WirelessGridItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/WirelessGridItem.java index 16f203208..340059e20 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/WirelessGridItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/WirelessGridItem.java @@ -12,6 +12,9 @@ import com.refinedmods.refinedstorage.common.content.ContentNames; import com.refinedmods.refinedstorage.common.security.BuiltinPermission; +import javax.annotation.Nullable; + +import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -33,7 +36,8 @@ public EnergyStorage createEnergyStorage(final ItemStack stack) { } @Override - protected void use(final ServerPlayer player, + protected void use(@Nullable final Component name, + final ServerPlayer player, final SlotReference slotReference, final NetworkItemContext context) { final boolean isAllowed = context.resolveNetwork() @@ -44,6 +48,7 @@ protected void use(final ServerPlayer player, return; } final Grid grid = new WirelessGrid(context); - Platform.INSTANCE.getMenuOpener().openMenu(player, new WirelessGridExtendedMenuProvider(grid, slotReference)); + final var provider = new WirelessGridExtendedMenuProvider(name, grid, slotReference); + Platform.INSTANCE.getMenuOpener().openMenu(player, provider); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AbstractGridScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AbstractGridScreen.java index 27556d7d2..503a2926b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AbstractGridScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AbstractGridScreen.java @@ -13,7 +13,7 @@ import com.refinedmods.refinedstorage.common.grid.NoopGridSynchronizer; import com.refinedmods.refinedstorage.common.grid.view.ItemGridResource; import com.refinedmods.refinedstorage.common.support.ResourceSlotRendering; -import com.refinedmods.refinedstorage.common.support.TextureIds; +import com.refinedmods.refinedstorage.common.support.Sprites; import com.refinedmods.refinedstorage.common.support.containermenu.DisabledSlot; import com.refinedmods.refinedstorage.common.support.containermenu.PropertyTypes; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; @@ -45,7 +45,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static com.refinedmods.refinedstorage.common.support.TextureIds.SEARCH_SIZE; +import static com.refinedmods.refinedstorage.common.support.Sprites.SEARCH_SIZE; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; import static java.util.Objects.requireNonNullElse; @@ -55,7 +55,7 @@ public abstract class AbstractGridScreen ex private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGridScreen.class); - private static final ResourceLocation ROW_TEXTURE = createIdentifier("grid_row"); + private static final ResourceLocation ROW_SPRITE = createIdentifier("grid_row"); private static final int MODIFIED_JUST_NOW_MAX_SECONDS = 10; private static final int COLUMNS = 9; private static final int DISABLED_SLOT_COLOR = 0xFF5B5B5B; @@ -116,7 +116,7 @@ protected void init(final int rows) { .stream() .allMatch(synchronizer -> synchronizer == NoopGridSynchronizer.INSTANCE); if (!onlyHasNoopSynchronizer) { - addSideButton(new SynchronizationSideButtonWidget(getMenu())); + addSideButton(new SynchronizationModeSideButtonWidget(getMenu())); searchField.addListener(this::trySynchronizeFromGrid); } } @@ -158,7 +158,7 @@ private boolean isOverStorageArea(final int mouseX, final int mouseY) { @Override protected void renderBg(final GuiGraphics graphics, final float delta, final int mouseX, final int mouseY) { super.renderBg(graphics, delta, mouseX, mouseY); - graphics.blitSprite(TextureIds.SEARCH, leftPos + 79, topPos + 5, SEARCH_SIZE, SEARCH_SIZE); + graphics.blitSprite(Sprites.SEARCH, leftPos + 79, topPos + 5, SEARCH_SIZE, SEARCH_SIZE); } @Override @@ -228,7 +228,7 @@ private void renderRow(final GuiGraphics graphics, final int rowX, final int rowY, final int row) { - graphics.blitSprite(ROW_TEXTURE, rowX, rowY, 162, ROW_SIZE); + graphics.blitSprite(ROW_SPRITE, rowX, rowY, 162, ROW_SIZE); for (int column = 0; column < COLUMNS; ++column) { renderCell(graphics, mouseX, mouseY, rowX, rowY, (row * COLUMNS) + column, column); } @@ -349,7 +349,7 @@ private void renderHoveredResourceTooltip(final GuiGraphics graphics, addDetailedTooltip(view, platformResource, processedLines); } if (!platformResource.isZeroed()) { - processedLines.addAll(platformResource.getExtractionHints(getMenu().getView())); + processedLines.addAll(platformResource.getExtractionHints(getMenu().getCarried(), getMenu().getView())); } Platform.INSTANCE.renderTooltip(graphics, processedLines, mouseX, mouseY); } @@ -419,7 +419,7 @@ public boolean mouseClicked(final double mouseX, final double mouseY, final int final ItemStack carriedStack = getMenu().getCarried(); final PlatformGridResource resource = getCurrentGridResource(); - if (resource != null && carriedStack.isEmpty()) { + if (resource != null && resource.canExtract(carriedStack, getMenu().getView())) { mouseClickedInGrid(clickedButton, resource); return true; } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AutoSelectedSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AutoSelectedSideButtonWidget.java index 754bb73e2..43796c69a 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AutoSelectedSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AutoSelectedSideButtonWidget.java @@ -2,16 +2,19 @@ import com.refinedmods.refinedstorage.common.grid.AbstractGridContainerMenu; import com.refinedmods.refinedstorage.common.support.widget.AbstractSideButtonWidget; +import com.refinedmods.refinedstorage.common.util.IdentifierUtil; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; -import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.NO; -import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.YES; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; class AutoSelectedSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "grid.auto_selected"); + private static final ResourceLocation YES = createIdentifier("widget/side_button/grid/autoselected/yes"); + private static final ResourceLocation NO = createIdentifier("widget/side_button/grid/autoselected/no"); private static final Component HELP = createTranslation("gui", "grid.auto_selected.help"); private final AbstractGridContainerMenu menu; @@ -26,13 +29,8 @@ private static OnPress createPressAction(final AbstractGridContainerMenu menu) { } @Override - protected int getXTexture() { - return menu.isAutoSelected() ? 16 : 0; - } - - @Override - protected int getYTexture() { - return 96; + protected ResourceLocation getSprite() { + return menu.isAutoSelected() ? YES : NO; } @Override @@ -42,7 +40,7 @@ protected MutableComponent getTitle() { @Override protected MutableComponent getSubText() { - return menu.isAutoSelected() ? YES : NO; + return menu.isAutoSelected() ? IdentifierUtil.YES : IdentifierUtil.NO; } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/CraftingGridScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/CraftingGridScreen.java index ad92e2d24..0f6bd9878 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/CraftingGridScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/CraftingGridScreen.java @@ -38,6 +38,9 @@ public class CraftingGridScreen extends AbstractGridScreen 0; - case NAME -> 16; - case ID -> 32; - case LAST_MODIFIED -> 48; + case QUANTITY -> QUANTITY; + case NAME -> NAME; + case ID -> ID; + case LAST_MODIFIED -> LAST_MODIFIED; }; } - @Override - protected int getYTexture() { - return menu.getSortingType() == GridSortingTypes.LAST_MODIFIED ? 48 : 32; - } - @Override protected MutableComponent getTitle() { return TITLE; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/SynchronizationSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/SynchronizationModeSideButtonWidget.java similarity index 68% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/SynchronizationSideButtonWidget.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/SynchronizationModeSideButtonWidget.java index e1a1b2522..3f811f5ca 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/SynchronizationSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/SynchronizationModeSideButtonWidget.java @@ -9,12 +9,12 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; -class SynchronizationSideButtonWidget extends AbstractSideButtonWidget { - private static final MutableComponent TITLE = createTranslation("gui", "grid.synchronizer"); +class SynchronizationModeSideButtonWidget extends AbstractSideButtonWidget { + private static final MutableComponent TITLE = createTranslation("gui", "grid.synchronization_mode"); private final AbstractGridContainerMenu menu; - SynchronizationSideButtonWidget(final AbstractGridContainerMenu menu) { + SynchronizationModeSideButtonWidget(final AbstractGridContainerMenu menu) { super(createPressAction(menu)); this.menu = menu; } @@ -24,8 +24,8 @@ private static OnPress createPressAction(final AbstractGridContainerMenu menu) { } @Override - protected ResourceLocation getTextureIdentifier() { - return menu.getSynchronizer().getTextureIdentifier(); + protected ResourceLocation getSprite() { + return menu.getSynchronizer().getSprite(); } @Override @@ -42,14 +42,4 @@ protected MutableComponent getSubText() { protected Component getHelpText() { return menu.getSynchronizer().getHelpText(); } - - @Override - protected int getXTexture() { - return menu.getSynchronizer().getXTexture(); - } - - @Override - protected int getYTexture() { - return menu.getSynchronizer().getYTexture(); - } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/hint/FluidGridInsertionHint.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/hint/FluidGridInsertionHint.java index 8eaa8d5de..e0f04b3e7 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/hint/FluidGridInsertionHint.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/hint/FluidGridInsertionHint.java @@ -1,10 +1,10 @@ package com.refinedmods.refinedstorage.common.grid.screen.hint; import com.refinedmods.refinedstorage.common.Platform; +import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; import com.refinedmods.refinedstorage.common.api.grid.GridInsertionHint; import com.refinedmods.refinedstorage.common.api.support.resource.FluidOperationResult; import com.refinedmods.refinedstorage.common.support.resource.FluidResource; -import com.refinedmods.refinedstorage.common.support.resource.FluidResourceRendering; import com.refinedmods.refinedstorage.common.support.tooltip.MouseClientTooltipComponent; import java.util.Optional; @@ -24,7 +24,7 @@ private ClientTooltipComponent createComponent(final FluidOperationResult result (FluidResource) result.fluid(), result.amount() == Platform.INSTANCE.getBucketAmount() ? null - : FluidResourceRendering.format(result.amount()) + : RefinedStorageApi.INSTANCE.getResourceRendering(FluidResource.class).formatAmount(result.amount()) ); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/hint/ItemGridInsertionHint.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/hint/ItemGridInsertionHint.java index 819e6f36a..d405ff1b2 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/hint/ItemGridInsertionHint.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/hint/ItemGridInsertionHint.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage.common.grid.screen.hint; import com.refinedmods.refinedstorage.common.api.grid.GridInsertionHint; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; import com.refinedmods.refinedstorage.common.support.tooltip.MouseClientTooltipComponent; import java.util.Optional; @@ -9,13 +8,15 @@ import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.world.item.ItemStack; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.format; + public class ItemGridInsertionHint implements GridInsertionHint { @Override public Optional getHint(final ItemStack carried) { return Optional.of(MouseClientTooltipComponent.item( MouseClientTooltipComponent.Type.LEFT, carried, - carried.getCount() == 1 ? null : AmountFormatting.format(carried.getCount()) + carried.getCount() == 1 ? null : format(carried.getCount()) )); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/view/FluidGridResource.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/view/FluidGridResource.java index 9571ec6dc..63dae70de 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/view/FluidGridResource.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/view/FluidGridResource.java @@ -2,15 +2,18 @@ import com.refinedmods.refinedstorage.api.grid.operations.GridExtractMode; import com.refinedmods.refinedstorage.api.grid.view.GridView; +import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.common.Platform; +import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; import com.refinedmods.refinedstorage.common.api.grid.GridResourceAttributeKeys; import com.refinedmods.refinedstorage.common.api.grid.GridScrollMode; import com.refinedmods.refinedstorage.common.api.grid.strategy.GridExtractionStrategy; import com.refinedmods.refinedstorage.common.api.grid.strategy.GridScrollingStrategy; import com.refinedmods.refinedstorage.common.api.grid.view.AbstractPlatformGridResource; +import com.refinedmods.refinedstorage.common.api.support.resource.FluidOperationResult; +import com.refinedmods.refinedstorage.common.api.support.resource.ResourceRendering; import com.refinedmods.refinedstorage.common.api.support.resource.ResourceType; import com.refinedmods.refinedstorage.common.support.resource.FluidResource; -import com.refinedmods.refinedstorage.common.support.resource.FluidResourceRendering; import com.refinedmods.refinedstorage.common.support.resource.ResourceTypes; import com.refinedmods.refinedstorage.common.support.tooltip.MouseClientTooltipComponent; @@ -24,9 +27,14 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; public class FluidGridResource extends AbstractPlatformGridResource { + private static final ItemStack EMPTY_BUCKET = new ItemStack(Items.BUCKET); + private final int id; + private final ResourceRendering rendering; public FluidGridResource(final FluidResource resource, final String name, @@ -41,6 +49,7 @@ public FluidGridResource(final FluidResource resource, GridResourceAttributeKeys.TOOLTIP, Set.of(tooltip) )); this.id = BuiltInRegistries.FLUID.getId(resource.fluid()); + this.rendering = RefinedStorageApi.INSTANCE.getResourceRendering(FluidResource.class); } @Override @@ -49,12 +58,32 @@ public int getRegistryId() { } @Override - public List getExtractionHints(final GridView view) { - return Platform.INSTANCE.getFilledBucket(resource).map(bucket -> MouseClientTooltipComponent.item( - MouseClientTooltipComponent.Type.LEFT, - bucket, - null - )).stream().toList(); + public List getExtractionHints(final ItemStack carriedStack, final GridView view) { + return tryFillFluidContainer(carriedStack) + .filter(result -> result.amount() > 0) + .map(result -> MouseClientTooltipComponent.item( + MouseClientTooltipComponent.Type.LEFT, + result.container(), + null + )).stream().toList(); + } + + private Optional tryFillFluidContainer(final ItemStack carriedStack) { + final ResourceAmount toFill = new ResourceAmount(resource, Platform.INSTANCE.getBucketAmount()); + return carriedStack.isEmpty() + ? Platform.INSTANCE.fillContainer(EMPTY_BUCKET, toFill) + : Platform.INSTANCE.fillContainer(carriedStack, toFill); + } + + @Override + public boolean canExtract(final ItemStack carriedStack, final GridView view) { + if (carriedStack.isEmpty()) { + return true; + } + final ResourceAmount toFill = new ResourceAmount(resource, view.getAmount(resource)); + return Platform.INSTANCE.fillContainer(carriedStack, toFill) + .map(result -> result.amount() > 0) + .orElse(false); } @Override @@ -76,12 +105,12 @@ public void render(final GuiGraphics graphics, final int x, final int y) { @Override public String getDisplayedAmount(final GridView view) { - return FluidResourceRendering.formatWithUnits(getAmount(view)); + return rendering.formatAmount(getAmount(view), true); } @Override public String getAmountInTooltip(final GridView view) { - return FluidResourceRendering.format(getAmount(view)); + return rendering.formatAmount(getAmount(view)); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/view/ItemGridResource.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/view/ItemGridResource.java index 25912cab7..6abbfedfc 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/view/ItemGridResource.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/view/ItemGridResource.java @@ -7,7 +7,6 @@ import com.refinedmods.refinedstorage.common.api.grid.strategy.GridExtractionStrategy; import com.refinedmods.refinedstorage.common.api.grid.strategy.GridScrollingStrategy; import com.refinedmods.refinedstorage.common.api.grid.view.AbstractPlatformGridResource; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; import com.refinedmods.refinedstorage.common.api.support.resource.ResourceType; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import com.refinedmods.refinedstorage.common.support.resource.ResourceTypes; @@ -28,6 +27,9 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.format; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.formatWithUnits; + public class ItemGridResource extends AbstractPlatformGridResource { private final int id; private final ItemStack itemStack; @@ -65,7 +67,7 @@ public int getRegistryId() { } @Override - public List getExtractionHints(final GridView view) { + public List getExtractionHints(final ItemStack carriedStack, final GridView view) { final long amount = getAmount(view); final long extractableAmount = Math.min(amount, itemStack.getMaxStackSize()); final long halfExtractionAmount = extractableAmount == 1 ? 1 : extractableAmount / 2; @@ -73,16 +75,21 @@ public List getExtractionHints(final GridView view) { MouseClientTooltipComponent.itemWithDecorations( MouseClientTooltipComponent.Type.LEFT, itemStack, - extractableAmount == 1 ? null : AmountFormatting.format(extractableAmount) + extractableAmount == 1 ? null : format(extractableAmount) ), MouseClientTooltipComponent.itemWithDecorations( MouseClientTooltipComponent.Type.RIGHT, itemStack, - halfExtractionAmount == 1 ? null : AmountFormatting.format(halfExtractionAmount) + halfExtractionAmount == 1 ? null : format(halfExtractionAmount) ) ); } + @Override + public boolean canExtract(final ItemStack carriedStack, final GridView view) { + return carriedStack.isEmpty(); + } + @Override public void onExtract(final GridExtractMode extractMode, final boolean cursor, @@ -104,12 +111,12 @@ public void render(final GuiGraphics graphics, final int x, final int y) { @Override public String getDisplayedAmount(final GridView view) { - return AmountFormatting.formatWithUnits(getAmount(view)); + return formatWithUnits(getAmount(view)); } @Override public String getAmountInTooltip(final GridView view) { - return AmountFormatting.format(getAmount(view)); + return format(getAmount(view)); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/iface/InterfaceBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/iface/InterfaceBlockEntity.java index ddb9fde06..f9422b231 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/iface/InterfaceBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/iface/InterfaceBlockEntity.java @@ -173,7 +173,7 @@ public StreamEncoder getMenuCodec() { @Override public Component getDisplayName() { - return ContentNames.INTERFACE; + return getName(ContentNames.INTERFACE); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/importer/ImporterBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/importer/ImporterBlockEntity.java index 38ee56e23..d2f922a5c 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/importer/ImporterBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/importer/ImporterBlockEntity.java @@ -138,7 +138,7 @@ public StreamEncoder getMenuCode @Override public Component getDisplayName() { - return ContentNames.IMPORTER; + return getName(ContentNames.IMPORTER); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/BaseWirelessTransmitterRangeModifier.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/BaseWirelessTransmitterRangeModifier.java similarity index 88% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/BaseWirelessTransmitterRangeModifier.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/BaseWirelessTransmitterRangeModifier.java index 76b6cc3a4..e85aced1f 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/BaseWirelessTransmitterRangeModifier.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/BaseWirelessTransmitterRangeModifier.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.common.Platform; import com.refinedmods.refinedstorage.common.api.upgrade.UpgradeState; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/CompositeWirelessTransmitterRangeModifier.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/CompositeWirelessTransmitterRangeModifier.java similarity index 93% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/CompositeWirelessTransmitterRangeModifier.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/CompositeWirelessTransmitterRangeModifier.java index 1ac68976c..e2a89ea04 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/CompositeWirelessTransmitterRangeModifier.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/CompositeWirelessTransmitterRangeModifier.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.common.api.upgrade.UpgradeState; import com.refinedmods.refinedstorage.common.api.wirelesstransmitter.WirelessTransmitterRangeModifier; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/CreativeRangeUpgradeWirelessTransmitterRangeModifier.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/CreativeRangeUpgradeWirelessTransmitterRangeModifier.java similarity index 91% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/CreativeRangeUpgradeWirelessTransmitterRangeModifier.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/CreativeRangeUpgradeWirelessTransmitterRangeModifier.java index 5c1e8e8b7..8e8764fa4 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/CreativeRangeUpgradeWirelessTransmitterRangeModifier.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/CreativeRangeUpgradeWirelessTransmitterRangeModifier.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.common.api.upgrade.UpgradeState; import com.refinedmods.refinedstorage.common.api.wirelesstransmitter.WirelessTransmitterRangeModifier; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterBlockEntity.java index 5f32d3502..131ad3861 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterBlockEntity.java @@ -44,6 +44,7 @@ public class NetworkTransmitterBlockEntity private static final Logger LOGGER = LoggerFactory.getLogger(NetworkTransmitterBlockEntity.class); private static final NetworkTransmitterData INACTIVE = NetworkTransmitterData.message( + false, createTranslation("gui", "network_transmitter.status.inactive") ); private static final NetworkTransmitterData MISSING_NETWORK_CARD = NetworkTransmitterData.error( @@ -138,7 +139,7 @@ NetworkTransmitterData getStatus() { "gui", "network_transmitter.status.transmitting", receiverKey.getDistance(worldPosition)) : receiverKey.getDimensionName(); - return NetworkTransmitterData.message(message); + return NetworkTransmitterData.message(true, message); } @Override @@ -207,7 +208,7 @@ public StreamEncoder getMenuCod @Override public Component getDisplayName() { - return ContentNames.NETWORK_TRANSMITTER; + return getName(ContentNames.NETWORK_TRANSMITTER); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterContainerMenu.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterContainerMenu.java index 33538c0eb..b14de4e46 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterContainerMenu.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterContainerMenu.java @@ -60,7 +60,7 @@ public void broadcastChanges() { return; } final NetworkTransmitterData newStatus = blockEntity.getStatus(); - if (newStatus.message().equals(status.message())) { + if (newStatus.equals(status)) { return; } updateStatus(serverPlayer, newStatus); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterData.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterData.java index 3211a3423..79039c5af 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterData.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterData.java @@ -6,19 +6,20 @@ import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -public record NetworkTransmitterData(boolean error, Component message) { +public record NetworkTransmitterData(boolean error, boolean transmitting, Component message) { public static final StreamCodec STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.BOOL, NetworkTransmitterData::error, + ByteBufCodecs.BOOL, NetworkTransmitterData::transmitting, ComponentSerialization.STREAM_CODEC, NetworkTransmitterData::message, NetworkTransmitterData::new ); static NetworkTransmitterData error(final Component message) { - return new NetworkTransmitterData(true, message); + return new NetworkTransmitterData(true, false, message); } - static NetworkTransmitterData message(final Component message) { - return new NetworkTransmitterData(false, message); + static NetworkTransmitterData message(final boolean transmitting, final Component message) { + return new NetworkTransmitterData(false, transmitting, message); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterScreen.java index cbdcf1a19..84bd79eab 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterScreen.java @@ -9,13 +9,15 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; -import static com.refinedmods.refinedstorage.common.support.TextureIds.WARNING; -import static com.refinedmods.refinedstorage.common.support.TextureIds.WARNING_SIZE; +import static com.refinedmods.refinedstorage.common.support.Sprites.WARNING; +import static com.refinedmods.refinedstorage.common.support.Sprites.WARNING_SIZE; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; public class NetworkTransmitterScreen extends AbstractBaseScreen { private static final ResourceLocation TEXTURE = createIdentifier("textures/gui/network_transmitter.png"); + private final TransmittingIcon icon; + public NetworkTransmitterScreen(final NetworkTransmitterContainerMenu menu, final Inventory playerInventory, final Component text) { @@ -23,6 +25,7 @@ public NetworkTransmitterScreen(final NetworkTransmitterContainerMenu menu, this.inventoryLabelY = 42; this.imageWidth = 176; this.imageHeight = 137; + this.icon = new TransmittingIcon(isIconActive()); } @Override @@ -31,15 +34,31 @@ protected void init() { addSideButton(new RedstoneModeSideButtonWidget(getMenu().getProperty(PropertyTypes.REDSTONE_MODE))); } + @Override + protected void containerTick() { + super.containerTick(); + icon.tick(isIconActive()); + } + + private boolean isIconActive() { + return !getMenu().getStatus().error() && getMenu().getStatus().transmitting(); + } + + @Override + protected void renderBg(final GuiGraphics graphics, final float delta, final int mouseX, final int mouseY) { + super.renderBg(graphics, delta, mouseX, mouseY); + icon.render(graphics, leftPos + 29, topPos + 22); + } + @Override protected void renderLabels(final GuiGraphics graphics, final int mouseX, final int mouseY) { super.renderLabels(graphics, mouseX, mouseY); final NetworkTransmitterData status = getMenu().getStatus(); - final int displayTextX = 51; + final int x = 25 + 4 + icon.getWidth() + 4; if (status.error()) { - graphics.blitSprite(WARNING, displayTextX, 23, WARNING_SIZE, WARNING_SIZE); + graphics.blitSprite(WARNING, x, 23, WARNING_SIZE, WARNING_SIZE); } - graphics.drawString(font, status.message(), displayTextX + (status.error() ? (10 + 4) : 0), 25, 4210752, false); + graphics.drawString(font, status.message(), x + (status.error() ? (10 + 4) : 0), 25, 4210752, false); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/RangeUpgradeWirelessTransmitterRangeModifier.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RangeUpgradeWirelessTransmitterRangeModifier.java similarity index 91% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/RangeUpgradeWirelessTransmitterRangeModifier.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RangeUpgradeWirelessTransmitterRangeModifier.java index cf18efaaa..1686e6300 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/RangeUpgradeWirelessTransmitterRangeModifier.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RangeUpgradeWirelessTransmitterRangeModifier.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.common.Platform; import com.refinedmods.refinedstorage.common.api.upgrade.UpgradeState; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayBlockEntity.java index 6d8ff6b94..cacf099e2 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayBlockEntity.java @@ -203,7 +203,7 @@ public StreamEncoder getMenuCode @Override public Component getDisplayName() { - return ContentNames.RELAY; + return getName(ContentNames.RELAY); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassEnergySideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassEnergySideButtonWidget.java index 177a22d92..ff223bb27 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassEnergySideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassEnergySideButtonWidget.java @@ -7,25 +7,19 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; class RelayPassEnergySideButtonWidget extends AbstractYesNoSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "relay.pass_energy"); private static final MutableComponent HELP = createTranslation("gui", "relay.pass_energy.help"); + private static final ResourceLocation YES = createIdentifier("widget/side_button/relay/pass_energy/yes"); + private static final ResourceLocation NO = createIdentifier("widget/side_button/relay/pass_energy/no"); RelayPassEnergySideButtonWidget(final ClientProperty property) { - super(property, TITLE); - } - - @Override - protected int getXTexture() { - return Boolean.TRUE.equals(property.getValue()) ? 128 : 144; - } - - @Override - protected int getYTexture() { - return 0; + super(property, TITLE, YES, NO); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassSecuritySideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassSecuritySideButtonWidget.java index 0c920d309..475d1b10e 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassSecuritySideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassSecuritySideButtonWidget.java @@ -7,25 +7,19 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; class RelayPassSecuritySideButtonWidget extends AbstractYesNoSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "relay.pass_security"); private static final MutableComponent HELP = createTranslation("gui", "relay.pass_security.help"); + private static final ResourceLocation YES = createIdentifier("widget/side_button/relay/pass_security/yes"); + private static final ResourceLocation NO = createIdentifier("widget/side_button/relay/pass_security/no"); RelayPassSecuritySideButtonWidget(final ClientProperty property) { - super(property, TITLE); - } - - @Override - protected int getXTexture() { - return Boolean.TRUE.equals(property.getValue()) ? 128 : 144; - } - - @Override - protected int getYTexture() { - return 32; + super(property, TITLE, YES, NO); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassStorageSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassStorageSideButtonWidget.java index a472a33a0..4213785c3 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassStorageSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassStorageSideButtonWidget.java @@ -7,25 +7,19 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; class RelayPassStorageSideButtonWidget extends AbstractYesNoSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "relay.pass_storage"); private static final MutableComponent HELP = createTranslation("gui", "relay.pass_storage.help"); + private static final ResourceLocation YES = createIdentifier("widget/side_button/relay/pass_storage/yes"); + private static final ResourceLocation NO = createIdentifier("widget/side_button/relay/pass_storage/no"); RelayPassStorageSideButtonWidget(final ClientProperty property) { - super(property, TITLE); - } - - @Override - protected int getXTexture() { - return Boolean.TRUE.equals(property.getValue()) ? 128 : 144; - } - - @Override - protected int getYTexture() { - return 16; + super(property, TITLE, YES, NO); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassThroughSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassThroughSideButtonWidget.java index dde6d2149..ef6ae923a 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassThroughSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/RelayPassThroughSideButtonWidget.java @@ -7,25 +7,19 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; class RelayPassThroughSideButtonWidget extends AbstractYesNoSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "relay.pass_through"); private static final MutableComponent HELP = createTranslation("gui", "relay.pass_through.help"); + private static final ResourceLocation YES = createIdentifier("widget/side_button/relay/pass_through/yes"); + private static final ResourceLocation NO = createIdentifier("widget/side_button/relay/pass_through/no"); RelayPassThroughSideButtonWidget(final ClientProperty property) { - super(property, TITLE); - } - - @Override - protected int getXTexture() { - return Boolean.TRUE.equals(property.getValue()) ? 96 : 112; - } - - @Override - protected int getYTexture() { - return 0; + super(property, TITLE, YES, NO); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/TransmittingIcon.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/TransmittingIcon.java new file mode 100644 index 000000000..db062c2b2 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/TransmittingIcon.java @@ -0,0 +1,65 @@ +package com.refinedmods.refinedstorage.common.networking; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.resources.ResourceLocation; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; + +class TransmittingIcon { + private static final int WIDTH_0 = 11; + private static final int WIDTH_3 = 20; + private static final int TRANSMITTING_FRAMES = 20; + private static final ResourceLocation NOT_TRANSMITTING = createIdentifier("transmitting/0"); + private static final ResourceLocation TRANSMITTING_1 = createIdentifier("transmitting/1"); + private static final ResourceLocation TRANSMITTING_2 = createIdentifier("transmitting/2"); + private static final ResourceLocation TRANSMITTING_3 = createIdentifier("transmitting/3"); + + private int frames; + private int cycle; + private boolean active; + + TransmittingIcon(final boolean active) { + this.active = active; + } + + void tick(final boolean newActive) { + this.active = newActive; + doTick(); + } + + private void doTick() { + if (!active) { + frames = 0; + cycle = 0; + return; + } + ++frames; + if (frames == TRANSMITTING_FRAMES) { + frames = 0; + cycle++; + } + } + + void render(final GuiGraphics graphics, final int x3, final int y3) { + if (!active) { + graphics.blitSprite(NOT_TRANSMITTING, x3, y3 + 4, WIDTH_0, 4); + return; + } + final int frame = cycle % 3; + switch (frame) { + case 0: + graphics.blitSprite(TRANSMITTING_1, x3, y3 + 3, 14, 6); + break; + case 1: + graphics.blitSprite(TRANSMITTING_2, x3, y3 + 1, 17, 10); + break; + case 2: + graphics.blitSprite(TRANSMITTING_3, x3, y3, WIDTH_3, 12); + break; + } + } + + int getWidth() { + return active ? WIDTH_3 : WIDTH_0; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterBlock.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlock.java similarity index 98% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterBlock.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlock.java index 30603c483..9d3de8b2c 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterBlock.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlock.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.common.content.BlockColorMap; import com.refinedmods.refinedstorage.common.content.BlockConstants; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlockEntity.java similarity index 95% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterBlockEntity.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlockEntity.java index bdd78012a..ebc62600d 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterBlockEntity.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.api.network.impl.node.SimpleNetworkNode; import com.refinedmods.refinedstorage.common.Platform; @@ -84,7 +84,7 @@ public boolean addUpgradeItem(final Item upgradeItem) { @Override public Component getDisplayName() { - return ContentNames.WIRELESS_TRANSMITTER; + return getName(ContentNames.WIRELESS_TRANSMITTER); } @Nullable @@ -95,7 +95,7 @@ public AbstractContainerMenu createMenu(final int syncId, final Inventory invent @Override public WirelessTransmitterData getMenuData() { - return new WirelessTransmitterData(getRange()); + return new WirelessTransmitterData(getRange(), isActive()); } @Override @@ -127,4 +127,8 @@ protected boolean doesBlockStateChangeWarrantNetworkNodeUpdate(final BlockState final BlockState newBlockState) { return AbstractDirectionalBlock.doesBlockStateChangeWarrantNetworkNodeUpdate(oldBlockState, newBlockState); } + + boolean isActive() { + return mainNetworkNode.isActive(); + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterConnectionStrategy.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterConnectionStrategy.java similarity index 95% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterConnectionStrategy.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterConnectionStrategy.java index fbdc388d8..edceb9d8c 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterConnectionStrategy.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterConnectionStrategy.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.common.api.support.network.ConnectionSink; import com.refinedmods.refinedstorage.common.support.network.ColoredConnectionStrategy; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterContainerMenu.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterContainerMenu.java similarity index 86% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterContainerMenu.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterContainerMenu.java index 5bf934a6f..b853d3487 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterContainerMenu.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterContainerMenu.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; import com.refinedmods.refinedstorage.common.content.Menus; @@ -22,11 +22,13 @@ public class WirelessTransmitterContainerMenu extends AbstractBaseContainerMenu { private final RateLimiter rangeRateLimiter = RateLimiter.create(4); - private int range; @Nullable private final WirelessTransmitterBlockEntity wirelessTransmitter; private final Player player; + private int range; + private boolean active; + public WirelessTransmitterContainerMenu(final int syncId, final Inventory playerInventory, final WirelessTransmitterData data) { @@ -37,6 +39,7 @@ public WirelessTransmitterContainerMenu(final int syncId, )); registerProperty(new ClientProperty<>(PropertyTypes.REDSTONE_MODE, RedstoneMode.IGNORE)); this.range = data.range(); + this.active = data.active(); this.wirelessTransmitter = null; this.player = playerInventory.player; } @@ -53,6 +56,7 @@ public WirelessTransmitterContainerMenu(final int syncId, wirelessTransmitter::setRedstoneMode )); this.range = wirelessTransmitter.getRange(); + this.active = wirelessTransmitter.isActive(); this.wirelessTransmitter = wirelessTransmitter; this.player = playerInventory.player; } @@ -72,10 +76,12 @@ public void broadcastChanges() { return; } final int newRange = wirelessTransmitter.getRange(); - final boolean changed = range != newRange; + final boolean newActive = wirelessTransmitter.isActive(); + final boolean changed = range != newRange || active != newActive; if (changed && rangeRateLimiter.tryAcquire()) { this.range = newRange; - S2CPackets.sendWirelessTransmitterRange((ServerPlayer) player, range); + this.active = newActive; + S2CPackets.sendWirelessTransmitterData((ServerPlayer) player, range, active); } } @@ -83,7 +89,15 @@ int getRange() { return range; } + boolean isActive() { + return active; + } + public void setRange(final int range) { this.range = range; } + + public void setActive(final boolean active) { + this.active = active; + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterData.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterData.java similarity index 67% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterData.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterData.java index a0e60942b..374d274a5 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterData.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterData.java @@ -1,13 +1,14 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -public record WirelessTransmitterData(int range) { +public record WirelessTransmitterData(int range, boolean active) { public static final StreamCodec STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.INT, WirelessTransmitterData::range, + ByteBufCodecs.BOOL, WirelessTransmitterData::active, WirelessTransmitterData::new ); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterNetworkNodeContainer.java similarity index 96% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterNetworkNodeContainer.java index 4e211ab69..5d2ab78d7 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterNetworkNodeContainer.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage.common.api.support.network.item.NetworkItemPlayerValidator; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterScreen.java similarity index 67% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterScreen.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterScreen.java index 85ba735f4..a65823bfd 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/WirelessTransmitterScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/WirelessTransmitterScreen.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.wirelesstransmitter; +package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.common.support.AbstractBaseScreen; import com.refinedmods.refinedstorage.common.support.containermenu.PropertyTypes; @@ -6,6 +6,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; @@ -13,8 +14,11 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; public class WirelessTransmitterScreen extends AbstractBaseScreen { + private static final MutableComponent INACTIVE = createTranslation("gui", "wireless_transmitter.inactive"); private static final ResourceLocation TEXTURE = createIdentifier("textures/gui/wireless_transmitter.png"); + private final TransmittingIcon icon; + public WirelessTransmitterScreen(final WirelessTransmitterContainerMenu containerMenu, final Inventory inventory, final Component title) { @@ -22,6 +26,7 @@ public WirelessTransmitterScreen(final WirelessTransmitterContainerMenu containe this.inventoryLabelY = 43; this.imageWidth = 211; this.imageHeight = 137; + this.icon = new TransmittingIcon(getMenu().isActive()); } @Override @@ -30,18 +35,35 @@ protected void init() { addSideButton(new RedstoneModeSideButtonWidget(getMenu().getProperty(PropertyTypes.REDSTONE_MODE))); } + @Override + protected void containerTick() { + super.containerTick(); + icon.tick(getMenu().isActive()); + } + @Override protected ResourceLocation getTexture() { return TEXTURE; } + @Override + protected void renderBg(final GuiGraphics graphics, final float delta, final int mouseX, final int mouseY) { + super.renderBg(graphics, delta, mouseX, mouseY); + + icon.render(graphics, leftPos + 7, topPos + 22); + } + @Override protected void renderLabels(final GuiGraphics graphics, final int mouseX, final int mouseY) { super.renderLabels(graphics, mouseX, mouseY); + if (!getMenu().isActive()) { + graphics.drawString(font, INACTIVE, 7 + icon.getWidth() + 4, 25, 4210752, false); + return; + } graphics.drawString( font, createTranslation("gui", "wireless_transmitter.distance", getMenu().getRange()), - 28, + 7 + icon.getWidth() + 4, 25, 4210752, false diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/FallbackSecurityCardExtendedMenuProvider.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/FallbackSecurityCardExtendedMenuProvider.java index 6559f4408..9b9bad6f2 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/FallbackSecurityCardExtendedMenuProvider.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/FallbackSecurityCardExtendedMenuProvider.java @@ -16,12 +16,18 @@ import net.minecraft.world.inventory.AbstractContainerMenu; class FallbackSecurityCardExtendedMenuProvider extends AbstractSecurityCardExtendedMenuProvider { + @Nullable + private final Component name; private final SlotReference slotReference; - FallbackSecurityCardExtendedMenuProvider(final SlotReference slotReference, - final SecurityPolicy securityPolicy, - final Set dirtyPermissions) { + FallbackSecurityCardExtendedMenuProvider( + @Nullable final Component name, + final SlotReference slotReference, + final SecurityPolicy securityPolicy, + final Set dirtyPermissions + ) { super(securityPolicy, dirtyPermissions); + this.name = name; this.slotReference = slotReference; } @@ -37,7 +43,7 @@ public StreamEncoder getMenuCodec() { @Override public Component getDisplayName() { - return ContentNames.FALLBACK_SECURITY_CARD; + return name == null ? ContentNames.FALLBACK_SECURITY_CARD : name; } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/FallbackSecurityCardItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/FallbackSecurityCardItem.java index 05d452800..dc2438d8b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/FallbackSecurityCardItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/FallbackSecurityCardItem.java @@ -10,6 +10,7 @@ import java.util.Optional; import java.util.Set; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.server.MinecraftServer; import net.minecraft.world.inventory.tooltip.TooltipComponent; @@ -33,7 +34,12 @@ AbstractSecurityCardExtendedMenuProvider createMenuProvider( final Set dirtyPermissions, final ItemStack stack ) { - return new FallbackSecurityCardExtendedMenuProvider(slotReference, policy, dirtyPermissions); + return new FallbackSecurityCardExtendedMenuProvider( + stack.get(DataComponents.CUSTOM_NAME), + slotReference, + policy, + dirtyPermissions + ); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityCardExtendedMenuProvider.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityCardExtendedMenuProvider.java index 20c98b8a3..d79933035 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityCardExtendedMenuProvider.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityCardExtendedMenuProvider.java @@ -17,16 +17,22 @@ import net.minecraft.world.inventory.AbstractContainerMenu; class SecurityCardExtendedMenuProvider extends AbstractSecurityCardExtendedMenuProvider { + @Nullable + private final Component name; private final MinecraftServer server; private final SlotReference slotReference; private final SecurityCardBoundPlayer boundPlayer; - SecurityCardExtendedMenuProvider(final MinecraftServer server, - final SlotReference slotReference, - final SecurityPolicy securityPolicy, - final Set dirtyPermissions, - final SecurityCardBoundPlayer boundPlayer) { + SecurityCardExtendedMenuProvider( + @Nullable final Component name, + final MinecraftServer server, + final SlotReference slotReference, + final SecurityPolicy securityPolicy, + final Set dirtyPermissions, + final SecurityCardBoundPlayer boundPlayer + ) { super(securityPolicy, dirtyPermissions); + this.name = name; this.server = server; this.slotReference = slotReference; this.boundPlayer = boundPlayer; @@ -48,7 +54,7 @@ public StreamEncoder getMe @Override public Component getDisplayName() { - return ContentNames.SECURITY_CARD; + return name == null ? ContentNames.SECURITY_CARD : name; } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityCardItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityCardItem.java index 2feabe88b..cb3c1bba9 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityCardItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityCardItem.java @@ -78,6 +78,7 @@ AbstractSecurityCardExtendedMenuProvider createMenu final ItemStack stack ) { return new SecurityCardExtendedMenuProvider( + stack.get(net.minecraft.core.component.DataComponents.CUSTOM_NAME), server, slotReference, policy, diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityManagerBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityManagerBlockEntity.java index 0efa12921..b546d1bc5 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityManagerBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/SecurityManagerBlockEntity.java @@ -163,7 +163,7 @@ static boolean isValidFallbackSecurityCard(final ItemStack stack) { @Override public Component getDisplayName() { - return ContentNames.SECURITY_MANAGER; + return getName(ContentNames.SECURITY_MANAGER); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AbstractProgressStorageScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AbstractProgressStorageScreen.java index ab13cec1c..8019428f9 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AbstractProgressStorageScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AbstractProgressStorageScreen.java @@ -39,10 +39,10 @@ private List createProgressTooltip() { tooltip, menu.getStored(), menu.getCapacity(), - this::formatQuantity + this::formatAmount ); } else { - StorageTooltipHelper.addAmountStoredWithoutCapacity(tooltip, menu.getStored(), this::formatQuantity); + StorageTooltipHelper.addAmountStoredWithoutCapacity(tooltip, menu.getStored(), this::formatAmount); } return tooltip; } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AbstractStorageScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AbstractStorageScreen.java index 3ea7a7ea6..6b5fa984d 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AbstractStorageScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AbstractStorageScreen.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage.common.storage; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; import com.refinedmods.refinedstorage.common.support.AbstractBaseScreen; import com.refinedmods.refinedstorage.common.support.containermenu.PropertyTypes; import com.refinedmods.refinedstorage.common.support.widget.FuzzyModeSideButtonWidget; @@ -12,6 +11,7 @@ import net.minecraft.world.entity.player.Inventory; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.format; public abstract class AbstractStorageScreen extends AbstractBaseScreen { private static final Component ALLOW_FILTER_MODE_HELP = createTranslation("gui", "storage.filter_mode.allow.help"); @@ -69,7 +69,7 @@ protected void containerTick() { } } - protected String formatQuantity(final long qty) { - return AmountFormatting.format(qty); + protected String formatAmount(final long qty) { + return format(qty); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AccessModeSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AccessModeSideButtonWidget.java index 3692dde22..54ea2f77b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AccessModeSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/AccessModeSideButtonWidget.java @@ -6,7 +6,9 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; public class AccessModeSideButtonWidget extends AbstractSideButtonWidget { @@ -21,6 +23,10 @@ public class AccessModeSideButtonWidget extends AbstractSideButtonWidget { createTranslation("gui", "access_mode.extract.help"); private static final Component HELP_INSERT_EXTRACT = createTranslation("gui", "access_mode.insert_extract.help"); + private static final ResourceLocation INSERT = createIdentifier("widget/side_button/storage/access_mode/insert"); + private static final ResourceLocation EXTRACT = createIdentifier("widget/side_button/storage/access_mode/extract"); + private static final ResourceLocation INSERT_EXTRACT = + createIdentifier("widget/side_button/storage/access_mode/insert_extract"); private final ClientProperty property; @@ -42,19 +48,14 @@ private static AccessMode toggle(final AccessMode accessMode) { } @Override - protected int getXTexture() { + protected ResourceLocation getSprite() { return switch (property.getValue()) { - case INSERT_EXTRACT -> 0; - case INSERT -> 16; - case EXTRACT -> 32; + case INSERT_EXTRACT -> INSERT_EXTRACT; + case INSERT -> INSERT; + case EXTRACT -> EXTRACT; }; } - @Override - protected int getYTexture() { - return 240; - } - @Override protected MutableComponent getTitle() { return TITLE; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/BucketPlayerInventoryInsertableStorage.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/BucketPlayerInventoryInsertableStorage.java index 48fab8ce3..5410e0773 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/BucketPlayerInventoryInsertableStorage.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/BucketPlayerInventoryInsertableStorage.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.common.storage; import com.refinedmods.refinedstorage.api.core.Action; +import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.InsertableStorage; @@ -37,9 +38,10 @@ public long insert(final ResourceKey resource, final long amount, final Action a if (amount != Platform.INSTANCE.getBucketAmount()) { return 0; } - return Platform.INSTANCE.getFilledBucket(fluidResource).map( - filledBucketStack -> insert(filledBucketStack, amount, action, actor) - ).orElse(0L); + final ResourceAmount toFill = new ResourceAmount(fluidResource, amount); + return Platform.INSTANCE.fillContainer(EMPTY_BUCKET_STACK, toFill) + .map(result -> insert(result.container(), amount, action, actor)) + .orElse(0L); } private long insert(final ItemStack filledBucketStack, final long amount, final Action action, final Actor actor) { 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/FilterModeSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/FilterModeSideButtonWidget.java index c67ebc4ae..3fe64c6fe 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/FilterModeSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/FilterModeSideButtonWidget.java @@ -6,7 +6,9 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; public class FilterModeSideButtonWidget extends AbstractSideButtonWidget { @@ -14,6 +16,8 @@ public class FilterModeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent SUBTEXT_BLOCK = createTranslation("gui", "filter_mode.block"); private static final MutableComponent SUBTEXT_ALLOW = createTranslation("gui", "filter_mode.allow"); private static final Component FILTER_MODE_WARNING = createTranslation("gui", "storage.filter_mode.empty_warning"); + private static final ResourceLocation ALLOW = createIdentifier("widget/side_button/storage/filter_mode/allow"); + private static final ResourceLocation BLOCK = createIdentifier("widget/side_button/storage/filter_mode/block"); private final ClientProperty property; private final Component helpAllow; @@ -45,13 +49,8 @@ private static FilterMode toggle(final FilterMode filterMode) { } @Override - protected int getXTexture() { - return property.getValue() == FilterMode.BLOCK ? 16 : 0; - } - - @Override - protected int getYTexture() { - return 64; + protected ResourceLocation getSprite() { + return property.getValue() == FilterMode.BLOCK ? BLOCK : ALLOW; } @Override 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/PrioritySideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/PrioritySideButtonWidget.java index b8be92e20..f55e3874e 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/PrioritySideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/PrioritySideButtonWidget.java @@ -8,13 +8,16 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; public class PrioritySideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "priority"); private static final Component HELP = createTranslation("gui", "priority.storage_help"); + private static final ResourceLocation SPRITE = createIdentifier("widget/side_button/priority"); private final ClientProperty property; @@ -32,13 +35,8 @@ private static OnPress createPressAction(final ClientProperty property, } @Override - protected int getXTexture() { - return 0; - } - - @Override - protected int getYTexture() { - return 208; + protected ResourceLocation getSprite() { + return SPRITE; } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/SameTypeStorageType.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/SameTypeStorageType.java index f571efe2a..37e3083fe 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/SameTypeStorageType.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/SameTypeStorageType.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage.common.storage; import com.refinedmods.refinedstorage.api.resource.ResourceKey; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.api.storage.tracked.InMemoryTrackedStorageRepository; import com.refinedmods.refinedstorage.api.storage.tracked.TrackedStorageImpl; @@ -64,7 +64,7 @@ public long getDiskInterfaceTransferQuota(final boolean stackUpgrade) { private SerializableStorage createStorage(final StorageCodecs.StorageData data, final Runnable listener) { final TrackedStorageRepository trackingRepository = new InMemoryTrackedStorageRepository(); final TrackedStorageImpl tracked = new TrackedStorageImpl( - new InMemoryStorageImpl(), + new StorageImpl(), trackingRepository, System::currentTimeMillis ); 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/VoidExcessSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/VoidExcessSideButtonWidget.java index 20a3174b6..294a06ae6 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/VoidExcessSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/VoidExcessSideButtonWidget.java @@ -6,7 +6,10 @@ import javax.annotation.Nullable; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; public class VoidExcessSideButtonWidget extends AbstractYesNoSideButtonWidget { @@ -15,9 +18,12 @@ public class VoidExcessSideButtonWidget extends AbstractYesNoSideButtonWidget { "gui", "void_excess.allowlist_warning" ); + private static final MutableComponent TITLE = createTranslation("gui", "void_excess"); + private static final ResourceLocation YES = createIdentifier("widget/side_button/storage/void_excess/yes"); + private static final ResourceLocation NO = createIdentifier("widget/side_button/storage/void_excess/no"); public VoidExcessSideButtonWidget(final ClientProperty property) { - super(property, createTranslation("gui", "void_excess")); + super(property, TITLE, YES, NO); } public void setWarningVisible(final boolean visible) { @@ -28,16 +34,6 @@ public void setWarningVisible(final boolean visible) { } } - @Override - protected int getXTexture() { - return Boolean.TRUE.equals(property.getValue()) ? 16 : 0; - } - - @Override - protected int getYTexture() { - return 240 - 15; - } - @Override @Nullable protected Component getHelpText() { diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java index d315ff0e7..1f90f44fa 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java @@ -64,7 +64,7 @@ public void writeConfiguration(final CompoundTag tag, final HolderLookup.Provide @Override public Component getDisplayName() { - return ContentNames.DISK_DRIVE; + return getName(ContentNames.DISK_DRIVE); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java index 29e6cada4..666161d25 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/AbstractDiskInterfaceBlockEntity.java @@ -137,7 +137,7 @@ public boolean addUpgradeItem(final Item upgradeItem) { @Override public Component getDisplayName() { - return ContentNames.DISK_INTERFACE; + return getName(ContentNames.DISK_INTERFACE); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/TransferModeSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/TransferModeSideButtonWidget.java index f497c1db6..c7de37a81 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/TransferModeSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/diskinterface/TransferModeSideButtonWidget.java @@ -6,7 +6,9 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; class TransferModeSideButtonWidget extends AbstractSideButtonWidget { @@ -19,6 +21,10 @@ class TransferModeSideButtonWidget extends AbstractSideButtonWidget { createTranslation("gui", "disk_interface.transfer_mode.insert_into_network.help"); private static final Component HELP_EXTRACT_FROM_NETWORK = createTranslation("gui", "disk_interface.transfer_mode.extract_from_network.help"); + private static final ResourceLocation INSERT_INTO_NETWORK = + createIdentifier("widget/side_button/disk_interface_transfer_mode/insert_into_network"); + private static final ResourceLocation EXTRACT_FROM_NETWORK = + createIdentifier("widget/side_button/disk_interface_transfer_mode/extract_from_network"); private final ClientProperty property; @@ -39,18 +45,13 @@ private static StorageTransferMode toggle(final StorageTransferMode accessMode) } @Override - protected int getXTexture() { + protected ResourceLocation getSprite() { return switch (property.getValue()) { - case INSERT_INTO_NETWORK -> 16; - case EXTRACT_FROM_NETWORK -> 0; + case INSERT_INTO_NETWORK -> INSERT_INTO_NETWORK; + case EXTRACT_FROM_NETWORK -> EXTRACT_FROM_NETWORK; }; } - @Override - protected int getYTexture() { - return 160; - } - @Override protected MutableComponent getTitle() { return TITLE; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/externalstorage/ExternalStorageBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/externalstorage/ExternalStorageBlockEntity.java index 580c8ea61..0ff1d8cdc 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/externalstorage/ExternalStorageBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/externalstorage/ExternalStorageBlockEntity.java @@ -157,7 +157,7 @@ public StreamEncoder getMenuCode @Override public Component getDisplayName() { - return ContentNames.EXTERNAL_STORAGE; + return getName(ContentNames.EXTERNAL_STORAGE); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/externalstorage/ExternalStorageScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/externalstorage/ExternalStorageScreen.java index abb6475ac..bd1399d87 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/externalstorage/ExternalStorageScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/externalstorage/ExternalStorageScreen.java @@ -13,7 +13,7 @@ public ExternalStorageScreen(final ExternalStorageContainerMenu menu, final Component title) { super(menu, inventory, title); this.inventoryLabelY = 42; - this.imageWidth = 210; + this.imageWidth = 176; this.imageHeight = 137; } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/AbstractPortableGridBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/AbstractPortableGridBlockEntity.java index b00adf832..1e406e393 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/AbstractPortableGridBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/AbstractPortableGridBlockEntity.java @@ -29,6 +29,8 @@ import com.google.common.util.concurrent.RateLimiter; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.network.RegistryFriendlyByteBuf; @@ -55,9 +57,12 @@ public abstract class AbstractPortableGridBlockEntity extends BlockEntity private static final String TAG_DISK_INVENTORY = "inv"; private static final String TAG_DISKS = "disks"; private static final String TAG_REDSTONE_MODE = "rm"; + private static final String TAG_CUSTOM_NAME = "CustomName"; @Nullable protected Disk disk; + @Nullable + private Component name; private final DiskInventory diskInventory; private final DiskStateChangeListener diskStateListener = new DiskStateChangeListener(this); @@ -169,6 +174,9 @@ public void readConfiguration(final CompoundTag tag, final HolderLookup.Provider if (tag.contains(TAG_REDSTONE_MODE)) { redstoneMode = RedstoneModeSettings.getRedstoneMode(tag.getInt(TAG_REDSTONE_MODE)); } + if (tag.contains(TAG_CUSTOM_NAME, Tag.TAG_STRING)) { + this.name = parseCustomNameSafe(tag.getString(TAG_CUSTOM_NAME), provider); + } } private void fromClientTag(final CompoundTag tag) { @@ -194,6 +202,21 @@ public void saveAdditional(final CompoundTag tag, final HolderLookup.Provider pr @Override public void writeConfiguration(final CompoundTag tag, final HolderLookup.Provider provider) { tag.putInt(TAG_REDSTONE_MODE, RedstoneModeSettings.getRedstoneMode(redstoneMode)); + if (name != null) { + tag.putString(TAG_CUSTOM_NAME, Component.Serializer.toJson(name, provider)); + } + } + + @Override + protected void applyImplicitComponents(final BlockEntity.DataComponentInput componentInput) { + super.applyImplicitComponents(componentInput); + this.name = componentInput.get(DataComponents.CUSTOM_NAME); + } + + @Override + protected void collectImplicitComponents(final DataComponentMap.Builder components) { + super.collectImplicitComponents(components); + components.set(DataComponents.CUSTOM_NAME, name); } @Override @@ -219,7 +242,7 @@ public void setRedstoneMode(final RedstoneMode redstoneMode) { @Override public Component getDisplayName() { - return ContentNames.PORTABLE_GRID; + return name == null ? ContentNames.PORTABLE_GRID : name; } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/PortableGridBlockItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/PortableGridBlockItem.java index 5ce20f07b..3c0bd225a 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/PortableGridBlockItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/PortableGridBlockItem.java @@ -139,6 +139,7 @@ public void use(final ServerPlayer player, final ItemStack stack, final SlotRefe energyStorage.portableGrid = portableGrid; portableGrid.updateStorage(); Platform.INSTANCE.getMenuOpener().openMenu(player, new PortableGridItemExtendedMenuProvider( + stack.get(DataComponents.CUSTOM_NAME), portableGrid, energyStorage, diskInventory, diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/PortableGridItemExtendedMenuProvider.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/PortableGridItemExtendedMenuProvider.java index 362cb3939..89f6c70d7 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/PortableGridItemExtendedMenuProvider.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/portablegrid/PortableGridItemExtendedMenuProvider.java @@ -20,15 +20,21 @@ import net.minecraft.world.inventory.AbstractContainerMenu; class PortableGridItemExtendedMenuProvider implements ExtendedMenuProvider { + @Nullable + private final Component name; private final Grid grid; private final EnergyStorage energyStorage; private final DiskInventory diskInventory; private final SlotReference slotReference; - PortableGridItemExtendedMenuProvider(final Grid grid, - final EnergyStorage energyStorage, - final DiskInventory diskInventory, - final SlotReference slotReference) { + PortableGridItemExtendedMenuProvider( + @Nullable final Component name, + final Grid grid, + final EnergyStorage energyStorage, + final DiskInventory diskInventory, + final SlotReference slotReference + ) { + this.name = name; this.grid = grid; this.energyStorage = energyStorage; this.diskInventory = diskInventory; @@ -52,7 +58,7 @@ public StreamEncoder getMenuCodec() { @Override public Component getDisplayName() { - return ContentNames.PORTABLE_GRID; + return name == null ? ContentNames.PORTABLE_GRID : name; } @Nullable 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..33034dbf4 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,12 +50,12 @@ 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 public Component getDisplayName() { - return displayName; + return getName(displayName); } @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 7c334447c..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,12 +2,16 @@ import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; import com.refinedmods.refinedstorage.common.api.storage.AbstractStorageContainerBlockItem; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; +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.support.resource.FluidResourceRendering; +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; import javax.annotation.Nullable; @@ -22,8 +26,10 @@ import net.minecraft.world.level.block.state.BlockState; 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; @@ -43,21 +49,27 @@ private static Component getHelpText(final FluidStorageVariant variant) { if (variant.getCapacityInBuckets() == null) { return CREATIVE_HELP; } - return createTranslation( - "item", - "fluid_storage_block.help", - AmountFormatting.format(variant.getCapacityInBuckets()) - ); + 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 protected String formatAmount(final long amount) { - return FluidResourceRendering.format(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 @@ -90,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/FluidStorageBlockScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockScreen.java index e9e9e344d..75493ff6c 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storage/storageblock/FluidStorageBlockScreen.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.common.storage.storageblock; -import com.refinedmods.refinedstorage.common.support.resource.FluidResourceRendering; +import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; +import com.refinedmods.refinedstorage.common.support.resource.FluidResource; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; @@ -13,7 +14,7 @@ public FluidStorageBlockScreen(final AbstractStorageBlockContainerMenu menu, } @Override - protected String formatQuantity(final long qty) { - return FluidResourceRendering.format(qty); + protected String formatAmount(final long amount) { + return RefinedStorageApi.INSTANCE.getResourceRendering(FluidResource.class).formatAmount(amount); } } 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..8f6147b83 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,12 +46,12 @@ 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 public Component getDisplayName() { - return displayName; + return getName(displayName); } @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 99cdb125a..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,11 +2,15 @@ import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; import com.refinedmods.refinedstorage.common.api.storage.AbstractStorageContainerBlockItem; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; +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; @@ -21,8 +25,10 @@ import net.minecraft.world.level.block.state.BlockState; 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; @@ -35,19 +41,33 @@ public ItemStorageBlockBlockItem(final Block block, final ItemStorageVariant var RefinedStorageApi.INSTANCE.getStorageContainerItemHelper() ); this.variant = variant; - this.helpText = variant.getCapacity() == null + this.helpText = getHelpText(variant); + } + + private static Component getHelpText(final ItemStorageVariant variant) { + return variant.getCapacity() == null ? CREATIVE_HELP - : createTranslation("item", "storage_block.help", AmountFormatting.format(variant.getCapacity())); + : createTranslation("item", "storage_block.help", format(variant.getCapacity())); } + @Nullable @Override - protected boolean hasCapacity() { - return variant.hasCapacity(); + protected Long getCapacity() { + return variant.getCapacity(); } @Override protected String formatAmount(final long amount) { - return AmountFormatting.format(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 @@ -81,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 7a76aa02a..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 @@ -4,12 +4,13 @@ import com.refinedmods.refinedstorage.common.api.storage.AbstractStorageContainerItem; import com.refinedmods.refinedstorage.common.api.storage.SerializableStorage; import com.refinedmods.refinedstorage.common.api.storage.StorageRepository; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; import com.refinedmods.refinedstorage.common.api.support.HelpTooltipComponent; 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.support.resource.FluidResourceRendering; +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; import javax.annotation.Nullable; @@ -20,8 +21,9 @@ import net.minecraft.world.item.ItemStack; 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; @@ -40,21 +42,18 @@ private static Component getHelpText(final FluidStorageVariant variant) { if (variant.getCapacityInBuckets() == null) { return CREATIVE_HELP; } - return createTranslation( - "item", - "fluid_storage_disk.help", - AmountFormatting.format(variant.getCapacityInBuckets()) - ); + 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 protected String formatAmount(final long amount) { - return FluidResourceRendering.format(amount); + return RefinedStorageApi.INSTANCE.getResourceRendering(FluidResource.class).formatAmount(amount); } @Override @@ -80,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 8b72454ee..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 @@ -4,11 +4,12 @@ import com.refinedmods.refinedstorage.common.api.storage.AbstractStorageContainerItem; import com.refinedmods.refinedstorage.common.api.storage.SerializableStorage; import com.refinedmods.refinedstorage.common.api.storage.StorageRepository; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; import com.refinedmods.refinedstorage.common.api.support.HelpTooltipComponent; 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; @@ -19,8 +20,9 @@ import net.minecraft.world.item.ItemStack; 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; @@ -32,19 +34,24 @@ public ItemStorageDiskItem(final ItemStorageVariant variant) { RefinedStorageApi.INSTANCE.getStorageContainerItemHelper() ); this.variant = variant; - this.helpText = variant.getCapacity() == null + this.helpText = getHelpText(variant); + } + + private static Component getHelpText(final ItemStorageVariant variant) { + return variant.getCapacity() == null ? CREATIVE_HELP - : createTranslation("item", "storage_disk.help", AmountFormatting.format(variant.getCapacity())); + : createTranslation("item", "storage_disk.help", format(variant.getCapacity())); } + @Nullable @Override - protected boolean hasCapacity() { - return variant.hasCapacity(); + protected Long getCapacity() { + return variant.getCapacity(); } @Override protected String formatAmount(final long amount) { - return AmountFormatting.format(amount); + return format(amount); } @Override @@ -70,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/java/com/refinedmods/refinedstorage/common/storagemonitor/StorageMonitorBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storagemonitor/StorageMonitorBlockEntity.java index 052685ee9..3d7d2700b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storagemonitor/StorageMonitorBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storagemonitor/StorageMonitorBlockEntity.java @@ -295,7 +295,7 @@ public StreamEncoder getMenuCode @Override public Component getDisplayName() { - return ContentNames.STORAGE_MONITOR; + return getName(ContentNames.STORAGE_MONITOR); } @Nullable diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storagemonitor/StorageMonitorBlockEntityRenderer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storagemonitor/StorageMonitorBlockEntityRenderer.java index 519001ddf..582990291 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storagemonitor/StorageMonitorBlockEntityRenderer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/storagemonitor/StorageMonitorBlockEntityRenderer.java @@ -61,14 +61,14 @@ private void doRender(final Level level, final BiDirection direction, final ResourceKey resource, final long amount) { - final ResourceRendering resourceRendering = RefinedStorageApi.INSTANCE.getResourceRendering(resource); + final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(resource.getClass()); doRender( poseStack, vertexConsumers, direction.getQuaternion(), - resourceRendering.getDisplayedAmount(amount, false), + rendering.formatAmount(amount), level, - resourceRendering, + rendering, resource ); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/AbstractBaseScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/AbstractBaseScreen.java index 5cf47b3a0..743bfa0b0 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/AbstractBaseScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/AbstractBaseScreen.java @@ -209,7 +209,7 @@ private List getResourceSlotHelpTooltip(final ItemStack private List getTooltipForResource(final ResourceKey resource, final ResourceSlot resourceSlot) { final List tooltip = RefinedStorageApi.INSTANCE - .getResourceRendering(resource) + .getResourceRendering(resource.getClass()) .getTooltip(resource) .stream() .map(Component::getVisualOrderText) @@ -221,7 +221,7 @@ private List getTooltipForResource(final ResourceKey res if (resourceSlot.supportsItemSlotInteractions()) { RefinedStorageApi.INSTANCE.getResourceContainerInsertStrategies() .stream() - .flatMap(strategy -> strategy.getConversionInfo(resource).stream()) + .flatMap(strategy -> strategy.getConversionInfo(resource, getMenu().getCarried()).stream()) .map(conversionInfo -> MouseClientTooltipComponent.itemConversion( MouseClientTooltipComponent.Type.LEFT, conversionInfo.from(), diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/ResourceSlotRendering.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/ResourceSlotRendering.java index f351c64c3..96a3c1420 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/ResourceSlotRendering.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/ResourceSlotRendering.java @@ -41,23 +41,23 @@ private static void render(final GuiGraphics graphics, final ResourceKey resource, final long amount, final boolean renderAmount) { - final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(resource); + final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering(resource.getClass()); rendering.render(resource, graphics, x, y); if (renderAmount) { - render(graphics, x, y, amount, rendering); + renderAmount(graphics, x, y, amount, rendering); } } - public static void render(final GuiGraphics graphics, - final int x, - final int y, - final long amount, - final ResourceRendering rendering) { + public static void renderAmount(final GuiGraphics graphics, + final int x, + final int y, + final long amount, + final ResourceRendering rendering) { renderAmount( graphics, x, y, - rendering.getDisplayedAmount(amount, true), + rendering.formatAmount(amount, true), requireNonNullElse(ChatFormatting.WHITE.getColor(), 15), true ); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/TextureIds.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/Sprites.java similarity index 80% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/TextureIds.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/Sprites.java index 00a2bb383..0acc1419b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/TextureIds.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/Sprites.java @@ -4,8 +4,7 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; -public final class TextureIds { - public static final ResourceLocation SIDE_BUTTON_ICONS = createIdentifier("textures/side_button_icons.png"); +public final class Sprites { public static final ResourceLocation LIGHT_ARROW = createIdentifier("light_arrow"); public static final ResourceLocation SLOT = createIdentifier("slot"); public static final int LIGHT_ARROW_WIDTH = 22; @@ -15,6 +14,6 @@ public final class TextureIds { public static final ResourceLocation SEARCH = createIdentifier("search"); public static final int SEARCH_SIZE = 12; - private TextureIds() { + private Sprites() { } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java index 10a83f4e3..941729598 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java @@ -2,7 +2,6 @@ import com.refinedmods.refinedstorage.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage.common.Platform; -import com.refinedmods.refinedstorage.common.api.configurationcard.ConfigurationCardTarget; import com.refinedmods.refinedstorage.common.support.PlayerAwareBlockEntity; import com.refinedmods.refinedstorage.common.support.RedstoneMode; import com.refinedmods.refinedstorage.common.support.RedstoneModeSettings; @@ -20,7 +19,7 @@ import net.minecraft.world.level.block.state.BlockState; public abstract class AbstractRedstoneModeNetworkNodeContainerBlockEntity - extends BaseNetworkNodeContainerBlockEntity implements PlayerAwareBlockEntity, ConfigurationCardTarget { + extends BaseNetworkNodeContainerBlockEntity implements PlayerAwareBlockEntity { private static final String TAG_REDSTONE_MODE = "rm"; private static final String TAG_PLACED_BY_PLAYER_ID = "pbpid"; @@ -45,7 +44,6 @@ protected boolean calculateActive() { @Override public void saveAdditional(final CompoundTag tag, final HolderLookup.Provider provider) { super.saveAdditional(tag, provider); - writeConfiguration(tag, provider); if (placedByPlayerId != null) { tag.putUUID(TAG_PLACED_BY_PLAYER_ID, placedByPlayerId); } @@ -53,13 +51,13 @@ public void saveAdditional(final CompoundTag tag, final HolderLookup.Provider pr @Override public void writeConfiguration(final CompoundTag tag, final HolderLookup.Provider provider) { + super.writeConfiguration(tag, provider); tag.putInt(TAG_REDSTONE_MODE, RedstoneModeSettings.getRedstoneMode(getRedstoneMode())); } @Override public void loadAdditional(final CompoundTag tag, final HolderLookup.Provider provider) { super.loadAdditional(tag, provider); - readConfiguration(tag, provider); if (tag.hasUUID(TAG_PLACED_BY_PLAYER_ID)) { placedByPlayerId = tag.getUUID(TAG_PLACED_BY_PLAYER_ID); } @@ -67,6 +65,7 @@ public void loadAdditional(final CompoundTag tag, final HolderLookup.Provider pr @Override public void readConfiguration(final CompoundTag tag, final HolderLookup.Provider provider) { + super.readConfiguration(tag, provider); if (tag.contains(TAG_REDSTONE_MODE)) { redstoneMode = RedstoneModeSettings.getRedstoneMode(tag.getInt(TAG_REDSTONE_MODE)); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/network/BaseNetworkNodeContainerBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/network/BaseNetworkNodeContainerBlockEntity.java index 1149a0177..b58d133d1 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/network/BaseNetworkNodeContainerBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/network/BaseNetworkNodeContainerBlockEntity.java @@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage.api.network.energy.EnergyNetworkComponent; import com.refinedmods.refinedstorage.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; +import com.refinedmods.refinedstorage.common.api.configurationcard.ConfigurationCardTarget; import com.refinedmods.refinedstorage.common.api.support.network.AbstractNetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage.common.api.support.network.InWorldNetworkNodeContainer; import com.refinedmods.refinedstorage.common.api.support.network.item.NetworkItemTargetBlockEntity; @@ -12,6 +13,13 @@ import com.google.common.util.concurrent.RateLimiter; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponents; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BooleanProperty; @@ -19,11 +27,16 @@ import org.slf4j.LoggerFactory; public class BaseNetworkNodeContainerBlockEntity - extends AbstractNetworkNodeContainerBlockEntity implements NetworkItemTargetBlockEntity { + extends AbstractNetworkNodeContainerBlockEntity + implements NetworkItemTargetBlockEntity, ConfigurationCardTarget { + private static final String TAG_CUSTOM_NAME = "CustomName"; private static final Logger LOGGER = LoggerFactory.getLogger(BaseNetworkNodeContainerBlockEntity.class); private final RateLimiter activenessChangeRateLimiter = RateLimiter.create(1); + @Nullable + private Component name; + public BaseNetworkNodeContainerBlockEntity(final BlockEntityType type, final BlockPos pos, final BlockState state, @@ -113,4 +126,46 @@ public void setBlockState(final BlockState newBlockState) { public Network getNetworkForItem() { return mainNetworkNode.getNetwork(); } + + @Override + public void saveAdditional(final CompoundTag tag, final HolderLookup.Provider provider) { + super.saveAdditional(tag, provider); + writeConfiguration(tag, provider); + } + + @Override + public void loadAdditional(final CompoundTag tag, final HolderLookup.Provider provider) { + super.loadAdditional(tag, provider); + readConfiguration(tag, provider); + } + + @Override + public void writeConfiguration(final CompoundTag tag, final HolderLookup.Provider provider) { + if (name != null) { + tag.putString(TAG_CUSTOM_NAME, Component.Serializer.toJson(name, provider)); + } + } + + @Override + public void readConfiguration(final CompoundTag tag, final HolderLookup.Provider provider) { + if (tag.contains(TAG_CUSTOM_NAME, Tag.TAG_STRING)) { + this.name = parseCustomNameSafe(tag.getString(TAG_CUSTOM_NAME), provider); + } + } + + @Override + protected void applyImplicitComponents(final BlockEntity.DataComponentInput componentInput) { + super.applyImplicitComponents(componentInput); + this.name = componentInput.get(DataComponents.CUSTOM_NAME); + } + + @Override + protected void collectImplicitComponents(final DataComponentMap.Builder components) { + super.collectImplicitComponents(components); + components.set(DataComponents.CUSTOM_NAME, name); + } + + protected final Component getName(final Component defaultName) { + return name == null ? defaultName : name; + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/NetworkTransmitterStatusPacket.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/NetworkTransmitterStatusPacket.java index e38accfb6..7a6a65925 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/NetworkTransmitterStatusPacket.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/NetworkTransmitterStatusPacket.java @@ -14,13 +14,15 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; -public record NetworkTransmitterStatusPacket(boolean error, Component message) implements CustomPacketPayload { +public record NetworkTransmitterStatusPacket(boolean error, boolean transmitting, Component message) + implements CustomPacketPayload { public static final Type PACKET_TYPE = new Type<>( createIdentifier("network_transmitter_status") ); public static final StreamCodec STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.BOOL, NetworkTransmitterStatusPacket::error, + ByteBufCodecs.BOOL, NetworkTransmitterStatusPacket::transmitting, ComponentSerialization.STREAM_CODEC, NetworkTransmitterStatusPacket::message, NetworkTransmitterStatusPacket::new ); @@ -28,7 +30,7 @@ public record NetworkTransmitterStatusPacket(boolean error, Component message) i public static void handle(final NetworkTransmitterStatusPacket packet, final PacketContext ctx) { final AbstractContainerMenu menu = ctx.getPlayer().containerMenu; if (menu instanceof NetworkTransmitterContainerMenu containerMenu) { - containerMenu.setStatus(new NetworkTransmitterData(packet.error, packet.message)); + containerMenu.setStatus(new NetworkTransmitterData(packet.error, packet.transmitting, packet.message)); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/NoPermissionPacket.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/NoPermissionPacket.java index 0e2908da0..3c63a0f49 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/NoPermissionPacket.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/NoPermissionPacket.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage.common.support.packet.s2c; -import com.refinedmods.refinedstorage.common.util.SecurityToastUtil; +import com.refinedmods.refinedstorage.common.util.ClientPlatformUtil; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -18,7 +18,7 @@ public record NoPermissionPacket(Component component) implements CustomPacketPay ); public static void handle(final NoPermissionPacket packet) { - SecurityToastUtil.addNoPermissionToast(packet.component); + ClientPlatformUtil.addNoPermissionToast(packet.component); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/S2CPackets.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/S2CPackets.java index c293ca956..1059b66c2 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/S2CPackets.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/S2CPackets.java @@ -24,8 +24,8 @@ public static void sendEnergyInfo(final ServerPlayer player, final long stored, Platform.INSTANCE.sendPacketToClient(player, new EnergyInfoPacket(stored, capacity)); } - public static void sendWirelessTransmitterRange(final ServerPlayer player, final int range) { - Platform.INSTANCE.sendPacketToClient(player, new WirelessTransmitterRangePacket(range)); + public static void sendWirelessTransmitterData(final ServerPlayer player, final int range, final boolean active) { + Platform.INSTANCE.sendPacketToClient(player, new WirelessTransmitterDataPacket(range, active)); } public static void sendGridActiveness(final ServerPlayer player, final boolean active) { @@ -68,7 +68,7 @@ public static void sendStorageInfoResponse(final ServerPlayer player, public static void sendNetworkTransmitterStatus(final ServerPlayer player, final NetworkTransmitterData status) { Platform.INSTANCE.sendPacketToClient( player, - new NetworkTransmitterStatusPacket(status.error(), status.message()) + new NetworkTransmitterStatusPacket(status.error(), status.transmitting(), status.message()) ); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/WirelessTransmitterRangePacket.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/WirelessTransmitterDataPacket.java similarity index 54% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/WirelessTransmitterRangePacket.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/WirelessTransmitterDataPacket.java index 993a67aa9..a02cd501d 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/WirelessTransmitterRangePacket.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/s2c/WirelessTransmitterDataPacket.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage.common.support.packet.s2c; +import com.refinedmods.refinedstorage.common.networking.WirelessTransmitterContainerMenu; import com.refinedmods.refinedstorage.common.support.packet.PacketContext; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.WirelessTransmitterContainerMenu; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; @@ -10,20 +10,22 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; -public record WirelessTransmitterRangePacket(int range) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - createIdentifier("wireless_transmitter_range") +public record WirelessTransmitterDataPacket(int range, boolean active) implements CustomPacketPayload { + public static final Type PACKET_TYPE = new Type<>( + createIdentifier("wireless_transmitter_data") ); - public static final StreamCodec STREAM_CODEC = + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( - ByteBufCodecs.INT, WirelessTransmitterRangePacket::range, - WirelessTransmitterRangePacket::new + ByteBufCodecs.INT, WirelessTransmitterDataPacket::range, + ByteBufCodecs.BOOL, WirelessTransmitterDataPacket::active, + WirelessTransmitterDataPacket::new ); - public static void handle(final WirelessTransmitterRangePacket packet, final PacketContext ctx) { + public static void handle(final WirelessTransmitterDataPacket packet, final PacketContext ctx) { if (ctx.getPlayer().containerMenu instanceof WirelessTransmitterContainerMenu containerMenu) { containerMenu.setRange(packet.range); + containerMenu.setActive(packet.active); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceContainerInsertStrategy.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceContainerInsertStrategy.java index 06582a71c..56bd74479 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceContainerInsertStrategy.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceContainerInsertStrategy.java @@ -21,13 +21,14 @@ public Optional insert(final ItemStack container, final ResourceAm } @Override - public Optional getConversionInfo(final ResourceKey resource) { + public Optional getConversionInfo(final ResourceKey resource, final ItemStack carriedStack) { if (!(resource instanceof FluidResource fluidResource)) { return Optional.empty(); } - return Platform.INSTANCE.getFilledBucket(fluidResource).map(filledBucket -> new ConversionInfo( - EMPTY_BUCKET, - filledBucket - )); + final ItemStack container = carriedStack.isEmpty() ? EMPTY_BUCKET : carriedStack; + final ResourceAmount toFill = new ResourceAmount(fluidResource, Platform.INSTANCE.getBucketAmount()); + return Platform.INSTANCE.fillContainer(container, toFill) + .filter(result -> result.amount() > 0) + .map(result -> new ConversionInfo(container, result.container())); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceRendering.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceRendering.java index 7086a8d1f..57506c10b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceRendering.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceRendering.java @@ -2,8 +2,8 @@ import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.common.Platform; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; import com.refinedmods.refinedstorage.common.api.support.resource.ResourceRendering; +import com.refinedmods.refinedstorage.common.util.IdentifierUtil; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; @@ -23,12 +23,18 @@ public class FluidResourceRendering implements ResourceRendering { private static final DecimalFormat FORMATTER = new DecimalFormat("#,###.#", DecimalFormatSymbols.getInstance(Locale.US)); + private final long bucketAmount; + + public FluidResourceRendering(final long bucketAmount) { + this.bucketAmount = bucketAmount; + } + @Override - public String getDisplayedAmount(final long amount, final boolean withUnits) { + public String formatAmount(final long amount, final boolean withUnits) { if (!withUnits) { - return format(amount); + return format(amount, bucketAmount); } - return formatWithUnits(amount); + return formatWithUnits(amount, bucketAmount); } @Override @@ -67,21 +73,21 @@ public void render(final ResourceKey resource, Platform.INSTANCE.getFluidRenderer().render(poseStack, renderTypeBuffer, light, fluidResource); } - public static String formatWithUnits(final long droplets) { - final double buckets = convertToBuckets(droplets); + private static String formatWithUnits(final long droplets, final long bucketAmount) { + final double buckets = convertToBuckets(droplets, bucketAmount); if (buckets >= 1) { - return AmountFormatting.formatWithUnits((long) Math.floor(buckets)); + return IdentifierUtil.formatWithUnits((long) Math.floor(buckets)); } else { return LESS_THAN_1_BUCKET_FORMATTER.format(buckets); } } - public static String format(final long droplets) { - final double buckets = convertToBuckets(droplets); + private static String format(final long droplets, final long bucketAmount) { + final double buckets = convertToBuckets(droplets, bucketAmount); return FORMATTER.format(buckets); } - private static double convertToBuckets(final long droplets) { - return droplets / (double) Platform.INSTANCE.getBucketAmount(); + private static double convertToBuckets(final long droplets, final long bucketAmount) { + return droplets / (double) bucketAmount; } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceType.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceType.java index acfbf46b4..dc1bb66c3 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceType.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceType.java @@ -7,28 +7,23 @@ import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.root.RootStorage; import com.refinedmods.refinedstorage.common.Platform; -import com.refinedmods.refinedstorage.common.api.support.resource.AbstractResourceType; import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; -import com.refinedmods.refinedstorage.common.support.TextureIds; +import com.refinedmods.refinedstorage.common.api.support.resource.ResourceType; import java.util.Optional; import com.mojang.serialization.MapCodec; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; -class FluidResourceType extends AbstractResourceType { - FluidResourceType() { - super( - "FLUID", - createTranslation("misc", "resource_type.fluid"), - TextureIds.SIDE_BUTTON_ICONS, - 16, - 128 - ); - } +class FluidResourceType implements ResourceType { + private static final MutableComponent TITLE = createTranslation("misc", "resource_type.fluid"); + private static final ResourceLocation SPRITE = createIdentifier("widget/side_button/resource_type/fluid"); @Override public Optional toGridResource(final ResourceKey resource) { @@ -71,4 +66,14 @@ public MapCodec getMapCodec() { public StreamCodec getStreamCodec() { return (StreamCodec) ResourceCodecs.FLUID_STREAM_CODEC; } + + @Override + public MutableComponent getTitle() { + return TITLE; + } + + @Override + public ResourceLocation getSprite() { + return SPRITE; + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceRendering.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceRendering.java index 7ea0b9e85..d4b107f7c 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceRendering.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceRendering.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage.common.support.resource; import com.refinedmods.refinedstorage.api.resource.ResourceKey; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; import com.refinedmods.refinedstorage.common.api.support.resource.ResourceRendering; import java.util.Collections; @@ -23,6 +22,9 @@ import net.minecraft.world.level.Level; import org.joml.Matrix4f; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.format; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.formatWithUnits; + public class ItemResourceRendering implements ResourceRendering { public static final Matrix4f IN_WORLD_SCALE = new Matrix4f().scale(0.3F, 0.3F, 0.001f); private final Map stackCache = new HashMap<>(); @@ -32,14 +34,11 @@ private ItemStack getStack(final ItemResource itemResource) { } @Override - public String getDisplayedAmount(final long amount, final boolean withUnits) { + public String formatAmount(final long amount, final boolean withUnits) { if (!withUnits) { - return AmountFormatting.format(amount); - } - if (amount == 1) { - return ""; + return format(amount); } - return AmountFormatting.formatWithUnits(amount); + return formatWithUnits(amount); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceType.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceType.java index be6006f86..6c32328e0 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceType.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceType.java @@ -7,28 +7,23 @@ import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.root.RootStorage; import com.refinedmods.refinedstorage.common.Platform; -import com.refinedmods.refinedstorage.common.api.support.resource.AbstractResourceType; import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; -import com.refinedmods.refinedstorage.common.support.TextureIds; +import com.refinedmods.refinedstorage.common.api.support.resource.ResourceType; import java.util.Optional; import com.mojang.serialization.MapCodec; import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; -class ItemResourceType extends AbstractResourceType { - ItemResourceType() { - super( - "ITEM", - createTranslation("misc", "resource_type.item"), - TextureIds.SIDE_BUTTON_ICONS, - 0, - 128 - ); - } +class ItemResourceType implements ResourceType { + private static final MutableComponent TITLE = createTranslation("misc", "resource_type.item"); + private static final ResourceLocation SPRITE = createIdentifier("widget/side_button/resource_type/item"); @Override public Optional toGridResource(final ResourceKey resource) { @@ -73,4 +68,19 @@ public MapCodec getMapCodec() { public StreamCodec getStreamCodec() { return (StreamCodec) ResourceCodecs.ITEM_STREAM_CODEC; } + + @Override + public MutableComponent getTitle() { + return TITLE; + } + + @Override + public ResourceLocation getSprite() { + return SPRITE; + } + + @Override + public String toString() { + return "ITEM"; + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/stretching/ScreenSizeSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/stretching/ScreenSizeSideButtonWidget.java index dccbbeb9c..168e523d8 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/stretching/ScreenSizeSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/stretching/ScreenSizeSideButtonWidget.java @@ -4,17 +4,22 @@ import com.refinedmods.refinedstorage.common.support.widget.AbstractSideButtonWidget; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; public class ScreenSizeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "screen_size"); - private static final MutableComponent SUBTEXT_STRETCH = createTranslation("gui", "screen_size.stretch"); private static final MutableComponent SUBTEXT_SMALL = createTranslation("gui", "screen_size.small"); private static final MutableComponent SUBTEXT_MEDIUM = createTranslation("gui", "screen_size.medium"); private static final MutableComponent SUBTEXT_LARGE = createTranslation("gui", "screen_size.large"); private static final MutableComponent SUBTEXT_EXTRA_LARGE = createTranslation("gui", "screen_size.extra_large"); + private static final ResourceLocation STRETCH = createIdentifier("widget/side_button/screen_size/stretch"); + private static final ResourceLocation SMALL = createIdentifier("widget/side_button/screen_size/small"); + private static final ResourceLocation MEDIUM = createIdentifier("widget/side_button/screen_size/medium"); + private static final ResourceLocation EXTRA_LARGE = createIdentifier("widget/side_button/screen_size/extra_large"); public ScreenSizeSideButtonWidget(final AbstractStretchingScreen stretchingScreen) { super(createPressAction(stretchingScreen)); @@ -28,21 +33,16 @@ private static OnPress createPressAction(final AbstractStretchingScreen stret } @Override - protected int getXTexture() { + protected ResourceLocation getSprite() { final ScreenSize screenSize = Platform.INSTANCE.getConfig().getScreenSize(); return switch (screenSize) { - case STRETCH -> 64 + 48; - case SMALL -> 64; - case MEDIUM -> 64 + 16; - case LARGE, EXTRA_LARGE -> 64 + 32; + case STRETCH -> STRETCH; + case SMALL -> SMALL; + case MEDIUM -> MEDIUM; + case LARGE, EXTRA_LARGE -> EXTRA_LARGE; }; } - @Override - protected int getYTexture() { - return 64; - } - @Override protected MutableComponent getTitle() { return TITLE; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/HelpClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/HelpClientTooltipComponent.java index e6f13f107..4fde25b56 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/HelpClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/HelpClientTooltipComponent.java @@ -19,7 +19,7 @@ import static net.minecraft.client.gui.screens.Screen.hasShiftDown; public class HelpClientTooltipComponent implements ClientTooltipComponent { - private static final ResourceLocation TEXTURE = createIdentifier("help"); + private static final ResourceLocation SPRITE = createIdentifier("help"); private static final ClientTooltipComponent PRESS_SHIFT_FOR_HELP = new SmallTextClientTooltipComponent( createTranslationAsHeading("misc", "press_shift_for_help") ); @@ -77,7 +77,7 @@ public void renderText(final Font font, @Override public void renderImage(final Font font, final int x, final int y, final GuiGraphics graphics) { - graphics.blitSprite(TEXTURE, x, y + 2, 20, 20); + graphics.blitSprite(SPRITE, x, y + 2, 20, 20); } public static ClientTooltipComponent create(final Component text) { diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/MouseClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/MouseClientTooltipComponent.java index a835b7643..8ddf14d05 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/MouseClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/MouseClientTooltipComponent.java @@ -15,9 +15,9 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_HEIGHT; -import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_WIDTH; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_HEIGHT; +import static com.refinedmods.refinedstorage.common.support.Sprites.LIGHT_ARROW_WIDTH; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; public class MouseClientTooltipComponent implements ClientTooltipComponent { @@ -102,7 +102,7 @@ public static ClientTooltipComponent resource(final Type type, @Nullable final String amount) { return new MouseClientTooltipComponent( type, - (graphics, x, y) -> RefinedStorageApi.INSTANCE.getResourceRendering(resource) + (graphics, x, y) -> RefinedStorageApi.INSTANCE.getResourceRendering(resource.getClass()) .render(resource, graphics, x, y), amount ); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/ResourceClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/ResourceClientTooltipComponent.java index 4a43b83f1..ecff0219d 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/ResourceClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/ResourceClientTooltipComponent.java @@ -33,7 +33,7 @@ public int getWidth(final Font font) { @Override public void renderImage(final Font font, final int x, final int y, final GuiGraphics graphics) { - RefinedStorageApi.INSTANCE.getResourceRendering(resourceAmount.resource()).render( + RefinedStorageApi.INSTANCE.getResourceRendering(resourceAmount.resource().getClass()).render( resourceAmount.resource(), graphics, x, @@ -50,13 +50,10 @@ public void renderImage(final Font font, final int x, final int y, final GuiGrap private static Component getNameWithAmount(final ResourceAmount resourceAmount) { final ResourceRendering rendering = RefinedStorageApi.INSTANCE.getResourceRendering( - resourceAmount.resource() + resourceAmount.resource().getClass() ); - final String amount = rendering.getDisplayedAmount(resourceAmount.amount(), true); + final String amount = rendering.formatAmount(resourceAmount.amount()); final Component displayName = rendering.getDisplayName(resourceAmount.resource()); - if (amount.isEmpty()) { - return displayName; - } return displayName.copy().append(" (").append(amount).append(")"); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractSideButtonWidget.java index 4eae21cc4..55b159c29 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractSideButtonWidget.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage.common.support.widget; import com.refinedmods.refinedstorage.common.support.AbstractBaseScreen; -import com.refinedmods.refinedstorage.common.support.TextureIds; import com.refinedmods.refinedstorage.common.support.tooltip.HelpClientTooltipComponent; import com.refinedmods.refinedstorage.common.support.tooltip.SmallTextClientTooltipComponent; @@ -21,32 +20,26 @@ import net.minecraft.resources.ResourceLocation; import org.lwjgl.opengl.GL11; -import static com.refinedmods.refinedstorage.common.support.TextureIds.WARNING; -import static com.refinedmods.refinedstorage.common.support.TextureIds.WARNING_SIZE; +import static com.refinedmods.refinedstorage.common.support.Sprites.WARNING; +import static com.refinedmods.refinedstorage.common.support.Sprites.WARNING_SIZE; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; public abstract class AbstractSideButtonWidget extends Button { - private static final ResourceLocation TEXTURE = createIdentifier("widget/side_button"); - private static final ResourceLocation HOVERED_TEXTURE = createIdentifier("widget/side_button_hovered"); - private static final ResourceLocation HOVER_OVERLAY_TEXTURE = createIdentifier("widget/side_button_hover_overlay"); + private static final ResourceLocation SPRITE = createIdentifier("widget/side_button/base"); + private static final ResourceLocation HOVERED_SPRITE = createIdentifier("widget/side_button/hovered"); + private static final ResourceLocation HOVER_OVERLAY_SPRITE = createIdentifier("widget/side_button/hover_overlay"); - private static final int WIDTH = 18; - private static final int HEIGHT = 18; + private static final int SIZE = 18; + private static final int ICON_SIZE = 16; @Nullable private ClientTooltipComponent warning; protected AbstractSideButtonWidget(final OnPress pressAction) { - super(-1, -1, WIDTH, HEIGHT, Component.empty(), pressAction, DEFAULT_NARRATION); + super(-1, -1, SIZE, SIZE, Component.empty(), pressAction, DEFAULT_NARRATION); } - protected abstract int getXTexture(); - - protected abstract int getYTexture(); - - protected ResourceLocation getTextureIdentifier() { - return TextureIds.SIDE_BUTTON_ICONS; - } + protected abstract ResourceLocation getSprite(); public void setWarning(@Nullable final Component text) { if (text == null) { @@ -58,21 +51,19 @@ public void setWarning(@Nullable final Component text) { @Override public void renderWidget(final GuiGraphics graphics, final int mouseX, final int mouseY, final float partialTicks) { - graphics.blitSprite(isHovered ? HOVERED_TEXTURE : TEXTURE, getX(), getY(), WIDTH, HEIGHT); - graphics.blit( - getTextureIdentifier(), + graphics.blitSprite(isHovered ? HOVERED_SPRITE : SPRITE, getX(), getY(), SIZE, SIZE); + graphics.blitSprite( + getSprite(), getX() + 1, getY() + 1, - getXTexture(), - getYTexture(), - WIDTH - 2, - HEIGHT - 2 + ICON_SIZE, + ICON_SIZE ); if (isHovered) { RenderSystem.enableBlend(); RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 0.5f); - graphics.blitSprite(HOVER_OVERLAY_TEXTURE, getX(), getY(), WIDTH, HEIGHT); + graphics.blitSprite(HOVER_OVERLAY_SPRITE, getX(), getY(), SIZE, SIZE); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); final Screen screen = Minecraft.getInstance().screen; @@ -90,8 +81,8 @@ private void renderWarning(final GuiGraphics graphics) { graphics.pose().translate(0, 0, 200); graphics.blitSprite( WARNING, - getX() + WIDTH - WARNING_SIZE + 2, - getY() + HEIGHT - WARNING_SIZE + 2, + getX() + SIZE - WARNING_SIZE + 2, + getY() + SIZE - WARNING_SIZE + 2, WARNING_SIZE, WARNING_SIZE ); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractYesNoSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractYesNoSideButtonWidget.java index 8aa44b9be..eb1d5ee19 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractYesNoSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractYesNoSideButtonWidget.java @@ -3,24 +3,37 @@ import com.refinedmods.refinedstorage.common.support.containermenu.ClientProperty; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.NO; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.YES; public abstract class AbstractYesNoSideButtonWidget extends AbstractSideButtonWidget { - protected final ClientProperty property; + private final ClientProperty property; private final MutableComponent title; + private final ResourceLocation yesSprite; + private final ResourceLocation noSprite; - protected AbstractYesNoSideButtonWidget(final ClientProperty property, final MutableComponent title) { + protected AbstractYesNoSideButtonWidget(final ClientProperty property, + final MutableComponent title, + final ResourceLocation yesSprite, + final ResourceLocation noSprite) { super(createPressAction(property)); this.property = property; this.title = title; + this.yesSprite = yesSprite; + this.noSprite = noSprite; } private static OnPress createPressAction(final ClientProperty property) { return btn -> property.setValue(!property.getValue()); } + @Override + protected ResourceLocation getSprite() { + return Boolean.TRUE.equals(property.getValue()) ? yesSprite : noSprite; + } + @Override protected MutableComponent getTitle() { return title; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/FuzzyModeSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/FuzzyModeSideButtonWidget.java index 5beb1160e..f8ed65a81 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/FuzzyModeSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/FuzzyModeSideButtonWidget.java @@ -6,13 +6,17 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; public class FuzzyModeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "fuzzy_mode"); private static final MutableComponent SUBTEXT_ON = createTranslation("gui", "fuzzy_mode.on"); private static final MutableComponent SUBTEXT_OFF = createTranslation("gui", "fuzzy_mode.off"); + private static final ResourceLocation ON = createIdentifier("widget/side_button/fuzzy_mode/on"); + private static final ResourceLocation OFF = createIdentifier("widget/side_button/fuzzy_mode/off"); private final ClientProperty property; private final Supplier typeSupplier; @@ -28,13 +32,8 @@ private static OnPress createPressAction(final ClientProperty property) } @Override - protected int getXTexture() { - return Boolean.TRUE.equals(property.getValue()) ? 16 : 0; - } - - @Override - protected int getYTexture() { - return 192; + protected ResourceLocation getSprite() { + return Boolean.TRUE.equals(property.getValue()) ? ON : OFF; } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ProgressWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ProgressWidget.java index 59937b74f..aa50a0374 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ProgressWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ProgressWidget.java @@ -15,7 +15,7 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; public class ProgressWidget extends AbstractWidget { - private static final ResourceLocation TEXTURE = createIdentifier("widget/progress_bar"); + private static final ResourceLocation SPRITE = createIdentifier("widget/progress_bar"); private final DoubleSupplier progressSupplier; private final Supplier> tooltipSupplier; @@ -42,7 +42,7 @@ public void renderWidget(final GuiGraphics graphics, final int mouseX, final int final int correctedY = getY() + height - correctedHeight; final int u = 0; final int v = height - correctedHeight; - graphics.blitSprite(TEXTURE, 16, 70, u, v, getX(), correctedY, width, correctedHeight); + graphics.blitSprite(SPRITE, 16, 70, u, v, getX(), correctedY, width, correctedHeight); if (isHovered) { graphics.renderComponentTooltip(Minecraft.getInstance().font, tooltipSupplier.get(), mouseX, mouseY); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/RedstoneModeSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/RedstoneModeSideButtonWidget.java index ebe96e777..d24739d26 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/RedstoneModeSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/RedstoneModeSideButtonWidget.java @@ -7,7 +7,9 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; public class RedstoneModeSideButtonWidget extends AbstractSideButtonWidget { @@ -18,6 +20,9 @@ public class RedstoneModeSideButtonWidget extends AbstractSideButtonWidget { private static final Component HELP_IGNORE = createTranslation("gui", "redstone_mode.ignore.help"); private static final Component HELP_HIGH = createTranslation("gui", "redstone_mode.high.help"); private static final Component HELP_LOW = createTranslation("gui", "redstone_mode.low.help"); + private static final ResourceLocation IGNORE = createIdentifier("widget/side_button/redstone_mode/ignore"); + private static final ResourceLocation HIGH = createIdentifier("widget/side_button/redstone_mode/high"); + private static final ResourceLocation LOW = createIdentifier("widget/side_button/redstone_mode/low"); private final ClientProperty property; private final Component helpIgnore; @@ -42,19 +47,14 @@ private static OnPress createPressAction(final ClientProperty prop } @Override - protected int getXTexture() { + protected ResourceLocation getSprite() { return switch (property.getValue()) { - case IGNORE -> 0; - case HIGH -> 16; - case LOW -> 32; + case IGNORE -> IGNORE; + case HIGH -> HIGH; + case LOW -> LOW; }; } - @Override - protected int getYTexture() { - return 0; - } - @Override protected MutableComponent getTitle() { return TITLE; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/SchedulingModeSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/SchedulingModeSideButtonWidget.java index ae54ec655..4127b10c3 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/SchedulingModeSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/SchedulingModeSideButtonWidget.java @@ -5,11 +5,17 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; public class SchedulingModeSideButtonWidget extends AbstractSideButtonWidget { private static final MutableComponent TITLE = createTranslation("gui", "scheduling_mode"); + private static final ResourceLocation DEFAULT = createIdentifier("widget/side_button/scheduling_mode/default"); + private static final ResourceLocation ROUND_ROBIN = + createIdentifier("widget/side_button/scheduling_mode/round_robin"); + private static final ResourceLocation RANDOM = createIdentifier("widget/side_button/scheduling_mode/random"); private final ClientProperty property; @@ -31,19 +37,14 @@ private static SchedulingModeType toggle(final SchedulingModeType modeSettings) } @Override - protected int getXTexture() { + protected ResourceLocation getSprite() { return switch (property.getValue()) { - case DEFAULT -> 0; - case ROUND_ROBIN -> 16; - case RANDOM -> 32; + case DEFAULT -> DEFAULT; + case ROUND_ROBIN -> ROUND_ROBIN; + case RANDOM -> RANDOM; }; } - @Override - protected int getYTexture() { - return 144; - } - @Override protected MutableComponent getTitle() { return TITLE; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/upgrade/RegulatorUpgradeItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/upgrade/RegulatorUpgradeItem.java index 8f93f191f..64987928b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/upgrade/RegulatorUpgradeItem.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/upgrade/RegulatorUpgradeItem.java @@ -53,6 +53,7 @@ public InteractionResultHolder use(final Level level, final Player pl RegulatorUpgradeState.EMPTY ); Platform.INSTANCE.getMenuOpener().openMenu(serverPlayer, new ExtendedMenuProviderImpl( + stack.get(net.minecraft.core.component.DataComponents.CUSTOM_NAME), createResourceFilterContainer(stack, initialState), initialState.amount(), newAmount -> setAmount(stack, newAmount), @@ -130,7 +131,8 @@ public record RegulatorTooltipComponent(Component helpText, @Nullable ResourceAm implements TooltipComponent { } - private record ExtendedMenuProviderImpl(ResourceContainer resourceContainer, + private record ExtendedMenuProviderImpl(@Nullable Component name, + ResourceContainer resourceContainer, double amount, Consumer amountAcceptor, SlotReference slotReference) @@ -151,7 +153,7 @@ public StreamEncoder getMenuCodec() { @Override public Component getDisplayName() { - return ContentNames.REGULATOR_UPGRADE; + return name == null ? ContentNames.REGULATOR_UPGRADE : name; } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/SecurityToastUtil.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/ClientPlatformUtil.java similarity index 57% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/SecurityToastUtil.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/ClientPlatformUtil.java index a92ef1557..72bf0d0dd 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/SecurityToastUtil.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/ClientPlatformUtil.java @@ -1,22 +1,32 @@ package com.refinedmods.refinedstorage.common.util; +import javax.annotation.Nullable; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.toasts.SystemToast; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.level.Level; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; -public final class SecurityToastUtil { +public final class ClientPlatformUtil { private static final SystemToast.SystemToastId NO_PERMISSION_TOAST_ID = new SystemToast.SystemToastId(); + private static final MutableComponent NO_PERMISSION = createTranslation("misc", "no_permission"); + + private ClientPlatformUtil() { + } - private SecurityToastUtil() { + @Nullable + public static Level getClientLevel() { // avoids classloading issues + return Minecraft.getInstance().level; } public static void addNoPermissionToast(final Component message) { SystemToast.add( Minecraft.getInstance().getToasts(), NO_PERMISSION_TOAST_ID, - createTranslation("misc", "no_permission"), + NO_PERMISSION, message ); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/IdentifierUtil.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/IdentifierUtil.java index f9fcd40ae..2c074cd29 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/IdentifierUtil.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/IdentifierUtil.java @@ -1,6 +1,9 @@ package com.refinedmods.refinedstorage.common.util; -import com.refinedmods.refinedstorage.common.api.support.AmountFormatting; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; @@ -14,6 +17,19 @@ public final class IdentifierUtil { public static final MutableComponent YES = Component.translatable("gui.yes"); public static final MutableComponent NO = Component.translatable("gui.no"); + private static final DecimalFormat FORMATTER_WITH_UNITS = new DecimalFormat( + "####0.#", + DecimalFormatSymbols.getInstance(Locale.US) + ); + private static final DecimalFormat FORMATTER = new DecimalFormat( + "#,###", + DecimalFormatSymbols.getInstance(Locale.US) + ); + + static { + FORMATTER_WITH_UNITS.setRoundingMode(RoundingMode.FLOOR); + } + private IdentifierUtil() { } @@ -41,10 +57,8 @@ public static MutableComponent createStoredWithCapacityTranslation( return createTranslation( "misc", "stored_with_capacity", - Component.literal(stored == Long.MAX_VALUE ? "∞" : AmountFormatting.format(stored)) - .withStyle(ChatFormatting.WHITE), - Component.literal(capacity == Long.MAX_VALUE ? "∞" : AmountFormatting.format(capacity)) - .withStyle(ChatFormatting.WHITE), + Component.literal(stored == Long.MAX_VALUE ? "∞" : format(stored)).withStyle(ChatFormatting.WHITE), + Component.literal(capacity == Long.MAX_VALUE ? "∞" : format(capacity)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf((int) (pct * 100D))) ).withStyle(ChatFormatting.GRAY); } @@ -73,4 +87,37 @@ private static String getTagTranslationKey(final String prefix, final ResourceLo final String fixedPath = id.getPath().replace('/', '.'); return prefix + id.getNamespace() + "." + fixedPath; } + + public static String formatWithUnits(final long qty) { + if (qty >= 1_000_000_000) { + return formatBillion(qty); + } else if (qty >= 1_000_000) { + return formatMillion(qty); + } else if (qty >= 1000) { + return formatThousand(qty); + } + return String.valueOf(qty); + } + + private static String formatBillion(final long qty) { + return FORMATTER_WITH_UNITS.format(qty / 1_000_000_000D) + "B"; + } + + private static String formatMillion(final long qty) { + if (qty >= 100_000_000) { + return FORMATTER_WITH_UNITS.format(Math.floor(qty / 1_000_000D)) + "M"; + } + return FORMATTER_WITH_UNITS.format(qty / 1_000_000D) + "M"; + } + + private static String formatThousand(final long qty) { + if (qty >= 100_000) { + return FORMATTER_WITH_UNITS.format(Math.floor(qty / 1000D)) + "K"; + } + return FORMATTER_WITH_UNITS.format(qty / 1000D) + "K"; + } + + public static String format(final long qty) { + return FORMATTER.format(qty); + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/PlatformUtil.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/PlatformUtil.java deleted file mode 100644 index 24072c78e..000000000 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/PlatformUtil.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.refinedmods.refinedstorage.common.util; - -import javax.annotation.Nullable; - -import net.minecraft.client.Minecraft; -import net.minecraft.world.level.Level; - -public final class PlatformUtil { - private PlatformUtil() { - } - - @Nullable - public static Level getClientLevel() { // avoids classloading issues - return Minecraft.getInstance().level; - } -} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/package-info.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/package-info.java deleted file mode 100644 index dff267fde..000000000 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/wirelesstransmitter/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -@ParametersAreNonnullByDefault -@FieldsAndMethodsAreNonnullByDefault -package com.refinedmods.refinedstorage.common.wirelesstransmitter; - -import com.refinedmods.refinedstorage.api.core.FieldsAndMethodsAreNonnullByDefault; - -import javax.annotation.ParametersAreNonnullByDefault; 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 bc6c34463..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 @@ -54,9 +54,9 @@ "gui.refinedstorage.grid.sorting.type.last_modified": "Last modified", "gui.refinedstorage.grid.auto_selected": "Auto-selected", "gui.refinedstorage.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", - "gui.refinedstorage.grid.synchronizer": "Synchronization mode", - "gui.refinedstorage.grid.synchronizer.off": "Off", - "gui.refinedstorage.grid.synchronizer.off.help": "Don't sync the search box text.", + "gui.refinedstorage.grid.synchronization_mode": "Synchronization mode", + "gui.refinedstorage.grid.synchronization_mode.off": "Off", + "gui.refinedstorage.grid.synchronization_mode.off.help": "Don't sync the search box text.", "gui.refinedstorage.grid.resource_type": "Resource type", "gui.refinedstorage.grid.resource_type.all": "All", "gui.refinedstorage.grid.resource_type.help": "Filter specific resource types.", @@ -98,6 +98,7 @@ "gui.refinedstorage.importer.filter_mode.allow.help": "Only allow resources into the storage network that are configured in the filters.", "gui.refinedstorage.importer.filter_mode.block.help": "Disallow resources into the storage network that are configured in the filters.", "gui.refinedstorage.wireless_transmitter.distance": "%d block(s)", + "gui.refinedstorage.wireless_transmitter.inactive": "Inactive", "gui.refinedstorage.storage_monitor.filter_help": "The resource to display.", "gui.refinedstorage.redstone_mode": "Redstone mode", "gui.refinedstorage.redstone_mode.ignore": "Ignore", @@ -213,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/assets/refinedstorage/textures/gui/crafting.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting.png deleted file mode 100644 index b776a8a76..000000000 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting.png and /dev/null differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting_grid.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting_grid.png index f27b0beac..99e3f3874 100644 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting_grid.png and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting_grid.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/network_transmitter.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/network_transmitter.png index 1d25ea190..f1cb4e781 100644 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/network_transmitter.png and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/network_transmitter.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/portable_grid.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/portable_grid.png index 5e9695c55..63c67373a 100644 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/portable_grid.png and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/portable_grid.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/crafting_grid/crafting_matrix_filtering_slot_highlight.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/crafting_grid/crafting_matrix_filtering_slot_highlight.png new file mode 100644 index 000000000..a740a03c2 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/crafting_grid/crafting_matrix_filtering_slot_highlight.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/0.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/0.png new file mode 100644 index 000000000..e9de0e716 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/0.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/1.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/1.png new file mode 100644 index 000000000..04448e774 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/1.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/2.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/2.png new file mode 100644 index 000000000..822413dfc Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/2.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/3.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/3.png new file mode 100644 index 000000000..166cd463e Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/transmitting/3.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/base.png similarity index 100% rename from refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button.png rename to refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/base.png diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/constructor_drop_items/no.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/constructor_drop_items/no.png new file mode 100644 index 000000000..bcd2dde83 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/constructor_drop_items/no.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/constructor_drop_items/yes.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/constructor_drop_items/yes.png new file mode 100644 index 000000000..6c5ed18e0 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/constructor_drop_items/yes.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/destructor_pickup_items/no.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/destructor_pickup_items/no.png new file mode 100644 index 000000000..5f770f86b Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/destructor_pickup_items/no.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/destructor_pickup_items/yes.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/destructor_pickup_items/yes.png new file mode 100644 index 000000000..a483d31d7 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/destructor_pickup_items/yes.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/detector_mode/above.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/detector_mode/above.png new file mode 100644 index 000000000..bcd486876 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/detector_mode/above.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/detector_mode/equal.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/detector_mode/equal.png new file mode 100644 index 000000000..3d69127bc Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/detector_mode/equal.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/detector_mode/under.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/detector_mode/under.png new file mode 100644 index 000000000..389fbd729 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/detector_mode/under.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/disk_interface_transfer_mode/extract_from_network.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/disk_interface_transfer_mode/extract_from_network.png new file mode 100644 index 000000000..b723e78b9 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/disk_interface_transfer_mode/extract_from_network.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/disk_interface_transfer_mode/insert_into_network.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/disk_interface_transfer_mode/insert_into_network.png new file mode 100644 index 000000000..74abcfa07 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/disk_interface_transfer_mode/insert_into_network.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/fuzzy_mode/off.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/fuzzy_mode/off.png new file mode 100644 index 000000000..7536ac3f1 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/fuzzy_mode/off.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/fuzzy_mode/on.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/fuzzy_mode/on.png new file mode 100644 index 000000000..1bb554fef Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/fuzzy_mode/on.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/autoselected/no.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/autoselected/no.png new file mode 100644 index 000000000..8e1ec9574 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/autoselected/no.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/autoselected/yes.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/autoselected/yes.png new file mode 100644 index 000000000..b7916189b Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/autoselected/yes.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_direction/ascending.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_direction/ascending.png new file mode 100644 index 000000000..36c49fee0 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_direction/ascending.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_direction/descending.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_direction/descending.png new file mode 100644 index 000000000..45df9be63 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_direction/descending.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/id.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/id.png new file mode 100644 index 000000000..3c71ea586 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/id.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/last_modified.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/last_modified.png new file mode 100644 index 000000000..072b35811 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/last_modified.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/name.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/name.png new file mode 100644 index 000000000..3c8a25d3c Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/name.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/quantity.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/quantity.png new file mode 100644 index 000000000..db0e873a6 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/sorting_type/quantity.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/synchronization_mode/off.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/synchronization_mode/off.png new file mode 100644 index 000000000..255123522 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/synchronization_mode/off.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/synchronization_mode/on.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/synchronization_mode/on.png new file mode 100644 index 000000000..0df47c950 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/synchronization_mode/on.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/synchronization_mode/on_two_way.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/synchronization_mode/on_two_way.png new file mode 100644 index 000000000..30d152323 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/grid/synchronization_mode/on_two_way.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hover_overlay.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/hover_overlay.png similarity index 100% rename from refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hover_overlay.png rename to refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/hover_overlay.png diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hovered.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/hovered.png similarity index 100% rename from refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hovered.png rename to refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/hovered.png diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/priority.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/priority.png new file mode 100644 index 000000000..87a8ab9fd Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/priority.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/redstone_mode/high.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/redstone_mode/high.png new file mode 100644 index 000000000..6c564068e Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/redstone_mode/high.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/redstone_mode/ignore.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/redstone_mode/ignore.png new file mode 100644 index 000000000..92321bdd2 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/redstone_mode/ignore.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/redstone_mode/low.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/redstone_mode/low.png new file mode 100644 index 000000000..d31bf43ba Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/redstone_mode/low.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_energy/no.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_energy/no.png new file mode 100644 index 000000000..bf8a591e3 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_energy/no.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_energy/yes.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_energy/yes.png new file mode 100644 index 000000000..09a73762c Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_energy/yes.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_security/no.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_security/no.png new file mode 100644 index 000000000..89a1d1152 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_security/no.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_security/yes.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_security/yes.png new file mode 100644 index 000000000..12320e47e Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_security/yes.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_storage/no.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_storage/no.png new file mode 100644 index 000000000..8f69c275e Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_storage/no.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_storage/yes.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_storage/yes.png new file mode 100644 index 000000000..f3b3d6ac2 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_storage/yes.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_through/no.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_through/no.png new file mode 100644 index 000000000..30d152323 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_through/no.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_through/yes.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_through/yes.png new file mode 100644 index 000000000..255123522 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/relay/pass_through/yes.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/resource_type/all.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/resource_type/all.png new file mode 100644 index 000000000..afd9d1d77 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/resource_type/all.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/resource_type/fluid.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/resource_type/fluid.png new file mode 100644 index 000000000..501a3621e Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/resource_type/fluid.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/resource_type/item.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/resource_type/item.png new file mode 100644 index 000000000..f3b3d6ac2 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/resource_type/item.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/scheduling_mode/default.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/scheduling_mode/default.png new file mode 100644 index 000000000..ccdf27720 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/scheduling_mode/default.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/scheduling_mode/random.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/scheduling_mode/random.png new file mode 100644 index 000000000..e33c06fcf Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/scheduling_mode/random.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/scheduling_mode/round_robin.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/scheduling_mode/round_robin.png new file mode 100644 index 000000000..9a99e5427 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/scheduling_mode/round_robin.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/extra_large.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/extra_large.png new file mode 100644 index 000000000..4ce444c4b Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/extra_large.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/medium.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/medium.png new file mode 100644 index 000000000..a9f8a08ac Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/medium.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/small.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/small.png new file mode 100644 index 000000000..67113bc4d Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/small.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/stretch.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/stretch.png new file mode 100644 index 000000000..c63f2bf80 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/screen_size/stretch.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/access_mode/extract.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/access_mode/extract.png new file mode 100644 index 000000000..5e4674fc5 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/access_mode/extract.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/access_mode/insert.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/access_mode/insert.png new file mode 100644 index 000000000..3fbcc2f8f Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/access_mode/insert.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/access_mode/insert_extract.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/access_mode/insert_extract.png new file mode 100644 index 000000000..c5bd9f06d Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/access_mode/insert_extract.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/filter_mode/allow.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/filter_mode/allow.png new file mode 100644 index 000000000..4b72e7d04 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/filter_mode/allow.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/filter_mode/block.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/filter_mode/block.png new file mode 100644 index 000000000..7e8195ea6 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/filter_mode/block.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/void_excess/no.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/void_excess/no.png new file mode 100644 index 000000000..1237cd20b Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/void_excess/no.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/void_excess/yes.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/void_excess/yes.png new file mode 100644 index 000000000..4c185541c Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button/storage/void_excess/yes.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/wireless_transmitter.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/wireless_transmitter.png index bd9fe3393..0e140b6de 100644 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/wireless_transmitter.png and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/wireless_transmitter.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/side_button_icons.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/side_button_icons.png deleted file mode 100644 index 505efb56a..000000000 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/side_button_icons.png and /dev/null differ diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/1024b_fluid_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/1024b_fluid_storage_block.json index e1249ca23..ff654b764 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/1024b_fluid_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/1024b_fluid_storage_block.json @@ -6,12 +6,19 @@ "entries": [ { "type": "minecraft:item", - "name": "refinedstorage:1024b_fluid_storage_block", "functions": [ { "function": "refinedstorage:storage_block" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } - ] + ], + "name": "refinedstorage:1024b_fluid_storage_block" } ] } diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/16k_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/16k_storage_block.json index f1382ec5f..2d2244772 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/16k_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/16k_storage_block.json @@ -6,13 +6,20 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "refinedstorage:storage_block" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:16k_storage_block" } - ], - "functions": [ - { - "function": "refinedstorage:storage_block" - } ] } ] diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/1k_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/1k_storage_block.json index a29c5192d..108660613 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/1k_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/1k_storage_block.json @@ -6,13 +6,20 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "refinedstorage:storage_block" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:1k_storage_block" } - ], - "functions": [ - { - "function": "refinedstorage:storage_block" - } ] } ] diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/256b_fluid_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/256b_fluid_storage_block.json index a5424a30f..1dc789be1 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/256b_fluid_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/256b_fluid_storage_block.json @@ -6,12 +6,19 @@ "entries": [ { "type": "minecraft:item", - "name": "refinedstorage:256b_fluid_storage_block", "functions": [ { "function": "refinedstorage:storage_block" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } - ] + ], + "name": "refinedstorage:256b_fluid_storage_block" } ] } diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/4096b_fluid_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/4096b_fluid_storage_block.json index 2ff734543..37f043124 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/4096b_fluid_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/4096b_fluid_storage_block.json @@ -6,12 +6,19 @@ "entries": [ { "type": "minecraft:item", - "name": "refinedstorage:4096b_fluid_storage_block", "functions": [ { "function": "refinedstorage:storage_block" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } - ] + ], + "name": "refinedstorage:4096b_fluid_storage_block" } ] } diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/4k_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/4k_storage_block.json index c30f61de3..d11a6a1ce 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/4k_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/4k_storage_block.json @@ -6,13 +6,20 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "refinedstorage:storage_block" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:4k_storage_block" } - ], - "functions": [ - { - "function": "refinedstorage:storage_block" - } ] } ] diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/64b_fluid_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/64b_fluid_storage_block.json index 3912817f5..d66c49028 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/64b_fluid_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/64b_fluid_storage_block.json @@ -6,12 +6,19 @@ "entries": [ { "type": "minecraft:item", - "name": "refinedstorage:64b_fluid_storage_block", "functions": [ { "function": "refinedstorage:storage_block" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } - ] + ], + "name": "refinedstorage:64b_fluid_storage_block" } ] } diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/64k_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/64k_storage_block.json index aa8bbd677..2933388f5 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/64k_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/64k_storage_block.json @@ -6,13 +6,20 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "refinedstorage:storage_block" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:64k_storage_block" } - ], - "functions": [ - { - "function": "refinedstorage:storage_block" - } ] } ] diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_fluid_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_fluid_storage_block.json index 829e9de35..821d302aa 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_fluid_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_fluid_storage_block.json @@ -6,12 +6,19 @@ "entries": [ { "type": "minecraft:item", - "name": "refinedstorage:creative_fluid_storage_block", "functions": [ { "function": "refinedstorage:storage_block" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } - ] + ], + "name": "refinedstorage:creative_fluid_storage_block" } ] } diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_portable_grid.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_portable_grid.json index 8847a0627..522276677 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_portable_grid.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_portable_grid.json @@ -6,12 +6,19 @@ "entries": [ { "type": "minecraft:item", - "name": "refinedstorage:creative_portable_grid", "functions": [ { "function": "refinedstorage:portable_grid" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } - ] + ], + "name": "refinedstorage:creative_portable_grid" } ] } diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_storage_block.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_storage_block.json index 1472b7692..f0a6e5c36 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_storage_block.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/creative_storage_block.json @@ -6,6 +6,15 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:creative_storage_block" } ], diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/disk_drive.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/disk_drive.json index 99c8c6f34..36e190a89 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/disk_drive.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/disk_drive.json @@ -6,6 +6,15 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:disk_drive" } ], diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/exporter.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/exporter.json index b27651dc7..dd36f78e9 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/exporter.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/exporter.json @@ -6,6 +6,15 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:exporter" } ], diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/external_storage.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/external_storage.json index 3b8bb9058..51ba468e4 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/external_storage.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/external_storage.json @@ -6,6 +6,15 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:external_storage" } ], diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/importer.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/importer.json index 0b7e38e4f..ed6ba2686 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/importer.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/importer.json @@ -6,6 +6,15 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:importer" } ], diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/interface.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/interface.json index 123a5f704..b87c07cbd 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/interface.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/interface.json @@ -6,6 +6,15 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:interface" } ], diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/portable_grid.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/portable_grid.json index 3970f8e98..83b268878 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/portable_grid.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/portable_grid.json @@ -6,12 +6,19 @@ "entries": [ { "type": "minecraft:item", - "name": "refinedstorage:portable_grid", "functions": [ { "function": "refinedstorage:portable_grid" + }, + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" } - ] + ], + "name": "refinedstorage:portable_grid" } ] } diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/storage_monitor.json b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/storage_monitor.json index 6e79b8f3c..2d589a4bb 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/storage_monitor.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/loot_table/blocks/storage_monitor.json @@ -6,6 +6,15 @@ "entries": [ { "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_components", + "include": [ + "minecraft:custom_name" + ], + "source": "block_entity" + } + ], "name": "refinedstorage:storage_monitor" } ], 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 diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/processor_binding.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/processor_binding.json index f2802cdb8..76a268adc 100644 --- a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/processor_binding.json +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/processor_binding.json @@ -10,7 +10,7 @@ "tag": "c:strings" }, "L": { - "tag": "c:slimeballs" + "tag": "c:slime_balls" } }, "result": { diff --git a/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/TestPlatform.java b/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/TestPlatform.java deleted file mode 100644 index e15c86a2f..000000000 --- a/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/TestPlatform.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.refinedmods.refinedstorage.common; - -import com.refinedmods.refinedstorage.api.core.Action; -import com.refinedmods.refinedstorage.api.grid.view.GridResourceFactory; -import com.refinedmods.refinedstorage.api.network.energy.EnergyStorage; -import com.refinedmods.refinedstorage.api.resource.ResourceAmount; -import com.refinedmods.refinedstorage.common.api.grid.strategy.GridInsertionStrategyFactory; -import com.refinedmods.refinedstorage.common.api.support.network.NetworkNodeContainerProvider; -import com.refinedmods.refinedstorage.common.api.support.resource.FluidOperationResult; -import com.refinedmods.refinedstorage.common.support.containermenu.MenuOpener; -import com.refinedmods.refinedstorage.common.support.containermenu.TransferManager; -import com.refinedmods.refinedstorage.common.support.render.FluidRenderer; -import com.refinedmods.refinedstorage.common.support.resource.FluidResource; -import com.refinedmods.refinedstorage.common.support.resource.ItemResource; - -import java.io.File; -import java.util.List; -import java.util.Optional; -import java.util.UUID; -import java.util.function.BiConsumer; -import javax.annotation.Nullable; - -import net.minecraft.client.KeyMapping; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.EditBox; -import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.HolderLookup; -import net.minecraft.core.NonNullList; -import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.Container; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.inventory.CraftingContainer; -import net.minecraft.world.inventory.Slot; -import net.minecraft.world.inventory.tooltip.TooltipComponent; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingInput; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelReader; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.LiquidBlock; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.saveddata.SavedData; -import net.minecraft.world.phys.BlockHitResult; - -public class TestPlatform implements Platform { - private final long bucketAmount; - - public TestPlatform(final long bucketAmount) { - this.bucketAmount = bucketAmount; - } - - @Override - public MenuOpener getMenuOpener() { - throw new UnsupportedOperationException(); - } - - @Override - public long getBucketAmount() { - return bucketAmount; - } - - @Override - public Config getConfig() { - throw new UnsupportedOperationException(); - } - - @Override - public boolean canEditBoxLoseFocus(final EditBox editBox) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean isKeyDown(final KeyMapping keyMapping) { - throw new UnsupportedOperationException(); - } - - @Override - public GridResourceFactory getItemGridResourceFactory() { - throw new UnsupportedOperationException(); - } - - @Override - public GridResourceFactory getFluidGridResourceFactory() { - throw new UnsupportedOperationException(); - } - - @Override - public GridInsertionStrategyFactory getDefaultGridInsertionStrategyFactory() { - throw new UnsupportedOperationException(); - } - - @Override - public FluidRenderer getFluidRenderer() { - throw new UnsupportedOperationException(); - } - - @Override - public Optional drainContainer(final ItemStack container) { - throw new UnsupportedOperationException(); - } - - @Override - public Optional fillContainer(final ItemStack container, - final ResourceAmount resourceAmount) { - throw new UnsupportedOperationException(); - } - - @Override - public Optional getFilledBucket(final FluidResource fluidResource) { - throw new UnsupportedOperationException(); - } - - @Override - public TransferManager createTransferManager(final AbstractContainerMenu containerMenu) { - throw new UnsupportedOperationException(); - } - - @Override - public long insertIntoContainer(final Container container, final ItemResource itemResource, final long amount, - final Action action) { - throw new UnsupportedOperationException(); - } - - @Override - public ItemStack getCloneItemStack(final BlockState state, final Level level, final BlockHitResult hitResult, - final Player player) { - throw new UnsupportedOperationException(); - } - - @Override - public NonNullList getRemainingCraftingItems(final Player player, final CraftingRecipe craftingRecipe, - final CraftingInput input) { - throw new UnsupportedOperationException(); - } - - @Override - public void onItemCrafted(final Player player, final ItemStack craftedStack, final CraftingContainer container) { - throw new UnsupportedOperationException(); - } - - @Override - public Player getFakePlayer(final ServerLevel level, @Nullable final UUID playerId) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean canBreakBlock(final Level level, final BlockPos pos, final BlockState state, final Player player) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean placeBlock(final Level level, final BlockPos pos, final Direction direction, final Player player, - final ItemStack stack) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean placeFluid(final Level level, final BlockPos pos, final Direction direction, final Player player, - final FluidResource fluidResource) { - throw new UnsupportedOperationException(); - } - - @Override - public ItemStack getBlockAsItemStack(final Block block, final BlockState state, final Direction direction, - final LevelReader level, - final BlockPos pos, final Player player) { - throw new UnsupportedOperationException(); - } - - @Override - public Optional getBucketPickupSound(final LiquidBlock liquidBlock, final BlockState state) { - throw new UnsupportedOperationException(); - } - - @Override - public List processTooltipComponents(final ItemStack stack, final GuiGraphics graphics, - final int mouseX, - final Optional imageComponent, - final List components) { - throw new UnsupportedOperationException(); - } - - @Override - public void renderTooltip(final GuiGraphics graphics, final List components, final int x, - final int y) { - throw new UnsupportedOperationException(); - } - - @Override - public Optional getEnergyStorage(final ItemStack stack) { - throw new UnsupportedOperationException(); - } - - @Override - public void sendPacketToServer(final T packet) { - throw new UnsupportedOperationException(); - } - - @Override - public void sendPacketToClient(final ServerPlayer player, final T packet) { - throw new UnsupportedOperationException(); - } - - @Override - public void saveSavedData(final SavedData savedData, final File file, final HolderLookup.Provider provider, - final BiConsumer defaultSaveFunction) { - throw new UnsupportedOperationException(); - } - - @Nullable - @Override - public NetworkNodeContainerProvider getContainerProvider(final Level level, final BlockPos pos, - @Nullable final Direction direction) { - throw new UnsupportedOperationException(); - } - - @Nullable - @Override - public NetworkNodeContainerProvider getContainerProviderSafely(final Level level, final BlockPos pos, - @Nullable final Direction direction) { - throw new UnsupportedOperationException(); - } - - @Override - public int getItemColor(final ItemStack stack, final int tintIndex) { - throw new UnsupportedOperationException(); - } - - @Override - public void setSlotY(final Slot slot, final int y) { - throw new UnsupportedOperationException(); - } -} diff --git a/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/storage/ClientStorageRepositoryTest.java b/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/storage/ClientStorageRepositoryTest.java deleted file mode 100644 index 548c59d95..000000000 --- a/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/storage/ClientStorageRepositoryTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.refinedmods.refinedstorage.common.storage; - -import com.refinedmods.refinedstorage.common.api.storage.StorageInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -class ClientStorageRepositoryTest { - private List uuidsRequested; - private ClientStorageRepository sut; - - @BeforeEach - void setup() { - uuidsRequested = new ArrayList<>(); - sut = new ClientStorageRepository(uuidsRequested::add); - } - - @Test - void shouldSendRequestWhenRetrievingInfo() { - // Arrange - final UUID a = UUID.randomUUID(); - final UUID b = UUID.randomUUID(); - - // Act - final StorageInfo aInfo = sut.getInfo(a); - final StorageInfo bInfo = sut.getInfo(b); - - // Assert - assertThat(uuidsRequested).containsExactly(a); - assertThat(aInfo).usingRecursiveComparison().isEqualTo(StorageInfo.UNKNOWN); - assertThat(bInfo).usingRecursiveComparison().isEqualTo(StorageInfo.UNKNOWN); - } - - @Test - void shouldRetrieveInfo() { - // Arrange - final UUID a = UUID.randomUUID(); - sut.setInfo(a, 10, 100); - - final UUID b = UUID.randomUUID(); - - // Act - final StorageInfo aInfo = sut.getInfo(a); - final StorageInfo bInfo = sut.getInfo(b); - - // Assert - assertThat(uuidsRequested).containsExactly(a); - assertThat(aInfo).usingRecursiveComparison().isEqualTo(new StorageInfo(10, 100)); - assertThat(bInfo).usingRecursiveComparison().isEqualTo(StorageInfo.UNKNOWN); - } -} diff --git a/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceRenderingTest.java b/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceRenderingTest.java index e72d9b78a..29a6295ad 100644 --- a/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceRenderingTest.java +++ b/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceRenderingTest.java @@ -1,9 +1,5 @@ package com.refinedmods.refinedstorage.common.support.resource; -import com.refinedmods.refinedstorage.common.PlatformProxy; -import com.refinedmods.refinedstorage.common.TestPlatform; - -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -11,37 +7,34 @@ class FluidResourceRenderingTest { private static final long BUCKET_AMOUNT = 1000; - @BeforeAll - static void setUp() { - PlatformProxy.loadPlatform(new TestPlatform(BUCKET_AMOUNT)); - } + private final FluidResourceRendering sut = new FluidResourceRendering(BUCKET_AMOUNT); @Test void shouldFormatWithUnitsForCompleteBuckets() { - assertThat(FluidResourceRendering.formatWithUnits(BUCKET_AMOUNT)).isEqualTo("1"); - assertThat(FluidResourceRendering.formatWithUnits(BUCKET_AMOUNT * 2)).isEqualTo("2"); - assertThat(FluidResourceRendering.formatWithUnits(BUCKET_AMOUNT * 3)).isEqualTo("3"); - assertThat(FluidResourceRendering.formatWithUnits(BUCKET_AMOUNT * 1000)).isEqualTo("1K"); + assertThat(sut.formatAmount(BUCKET_AMOUNT, true)).isEqualTo("1"); + assertThat(sut.formatAmount(BUCKET_AMOUNT * 2, true)).isEqualTo("2"); + assertThat(sut.formatAmount(BUCKET_AMOUNT * 3, true)).isEqualTo("3"); + assertThat(sut.formatAmount(BUCKET_AMOUNT * 1000, true)).isEqualTo("1K"); } @Test void shouldFormatWithUnitsForPartialBuckets() { - assertThat(FluidResourceRendering.formatWithUnits(BUCKET_AMOUNT + (BUCKET_AMOUNT / 2))).isEqualTo("1"); - assertThat(FluidResourceRendering.formatWithUnits(BUCKET_AMOUNT + 1)).isEqualTo("1"); + assertThat(sut.formatAmount(BUCKET_AMOUNT + (BUCKET_AMOUNT / 2), true)).isEqualTo("1"); + assertThat(sut.formatAmount(BUCKET_AMOUNT + 1, true)).isEqualTo("1"); } @Test void shouldFormatWithUnitsForLessThan1Bucket() { - assertThat(FluidResourceRendering.formatWithUnits(BUCKET_AMOUNT / 2)).isEqualTo("0.5"); - assertThat(FluidResourceRendering.formatWithUnits(BUCKET_AMOUNT / 3)).isEqualTo("0.3"); + assertThat(sut.formatAmount(BUCKET_AMOUNT / 2, true)).isEqualTo("0.5"); + assertThat(sut.formatAmount(BUCKET_AMOUNT / 3, true)).isEqualTo("0.3"); } @Test void shouldFormatWithoutUnits() { - assertThat(FluidResourceRendering.format(BUCKET_AMOUNT)).isEqualTo("1"); - assertThat(FluidResourceRendering.format(BUCKET_AMOUNT + (BUCKET_AMOUNT / 2))).isEqualTo("1.5"); - assertThat(FluidResourceRendering.format(BUCKET_AMOUNT + (BUCKET_AMOUNT / 3))).isEqualTo("1.3"); - assertThat(FluidResourceRendering.format(BUCKET_AMOUNT * 1000)).isEqualTo("1,000"); - assertThat(FluidResourceRendering.format((BUCKET_AMOUNT * 1000) + (BUCKET_AMOUNT / 3))).isEqualTo("1,000.3"); + assertThat(sut.formatAmount(BUCKET_AMOUNT)).isEqualTo("1"); + assertThat(sut.formatAmount(BUCKET_AMOUNT + (BUCKET_AMOUNT / 2))).isEqualTo("1.5"); + assertThat(sut.formatAmount(BUCKET_AMOUNT + (BUCKET_AMOUNT / 3))).isEqualTo("1.3"); + assertThat(sut.formatAmount(BUCKET_AMOUNT * 1000)).isEqualTo("1,000"); + assertThat(sut.formatAmount((BUCKET_AMOUNT * 1000) + (BUCKET_AMOUNT / 3))).isEqualTo("1,000.3"); } } diff --git a/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/util/IdentifierUtilTest.java b/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/util/IdentifierUtilTest.java new file mode 100644 index 000000000..27c5c828a --- /dev/null +++ b/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/util/IdentifierUtilTest.java @@ -0,0 +1,90 @@ +package com.refinedmods.refinedstorage.common.util; + +import net.minecraft.resources.ResourceLocation; +import org.junit.jupiter.api.Test; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.MOD_ID; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.format; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.formatWithUnits; +import static org.assertj.core.api.Assertions.assertThat; + +class IdentifierUtilTest { + @Test + void verifyModId() { + assertThat(MOD_ID).isEqualTo("refinedstorage"); + assertThat(createIdentifier("test")).isEqualTo( + ResourceLocation.fromNamespaceAndPath("refinedstorage", "test") + ); + } + + @Test + void shouldFormatWithUnitsForSmallNumber() { + // Act & assert + assertThat(formatWithUnits(0)).isEqualTo("0"); + assertThat(formatWithUnits(1)).isEqualTo("1"); + assertThat(formatWithUnits(10)).isEqualTo("10"); + assertThat(formatWithUnits(105)).isEqualTo("105"); + } + + @Test + void shouldFormatWithUnitsForThousands() { + // Act & assert + assertThat(formatWithUnits(1000)).isEqualTo("1K"); + assertThat(formatWithUnits(1510)).isEqualTo("1.5K"); + + assertThat(formatWithUnits(10_000)).isEqualTo("10K"); + assertThat(formatWithUnits(10_510)).isEqualTo("10.5K"); + assertThat(formatWithUnits(99_999)).isEqualTo("99.9K"); + + assertThat(formatWithUnits(100_000)).isEqualTo("100K"); + assertThat(formatWithUnits(100_500)).isEqualTo("100K"); + assertThat(formatWithUnits(100_999)).isEqualTo("100K"); + + assertThat(formatWithUnits(101_000)).isEqualTo("101K"); + assertThat(formatWithUnits(101_500)).isEqualTo("101K"); + assertThat(formatWithUnits(101_999)).isEqualTo("101K"); + } + + @Test + void shouldFormatWithUnitsForMillions() { + // Act & assert + assertThat(formatWithUnits(1_000_000)).isEqualTo("1M"); + assertThat(formatWithUnits(1_510_000)).isEqualTo("1.5M"); + + assertThat(formatWithUnits(10_000_000)).isEqualTo("10M"); + assertThat(formatWithUnits(10_510_000)).isEqualTo("10.5M"); + assertThat(formatWithUnits(99_999_999)).isEqualTo("99.9M"); + + assertThat(formatWithUnits(100_000_000)).isEqualTo("100M"); + assertThat(formatWithUnits(100_510_000)).isEqualTo("100M"); + assertThat(formatWithUnits(100_999_000)).isEqualTo("100M"); + + assertThat(formatWithUnits(101_000_000)).isEqualTo("101M"); + assertThat(formatWithUnits(101_510_000)).isEqualTo("101M"); + assertThat(formatWithUnits(101_999_000)).isEqualTo("101M"); + } + + @Test + void shouldFormatWithUnitsForBillions() { + // Act & assert + assertThat(formatWithUnits(1_000_000_000)).isEqualTo("1B"); + assertThat(formatWithUnits(1_010_000_000)).isEqualTo("1B"); + assertThat(formatWithUnits(1_100_000_000)).isEqualTo("1.1B"); + assertThat(formatWithUnits(1_100_001_000)).isEqualTo("1.1B"); + assertThat(formatWithUnits(1_920_001_000)).isEqualTo("1.9B"); + } + + @Test + void shouldFormatWithoutUnits() { + // Act & assert + assertThat(format(0)).isEqualTo("0"); + assertThat(format(1)).isEqualTo("1"); + assertThat(format(10)).isEqualTo("10"); + assertThat(format(105)).isEqualTo("105"); + assertThat(format(1050)).isEqualTo("1,050"); + assertThat(format(10500)).isEqualTo("10,500"); + assertThat(format(100500)).isEqualTo("100,500"); + assertThat(format(1000500)).isEqualTo("1,000,500"); + } +} diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ClientModInitializerImpl.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ClientModInitializerImpl.java index 976d51f7a..9dbd105d8 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ClientModInitializerImpl.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ClientModInitializerImpl.java @@ -29,7 +29,7 @@ import com.refinedmods.refinedstorage.common.support.packet.s2c.PatternGridAllowedAlternativesUpdatePacket; import com.refinedmods.refinedstorage.common.support.packet.s2c.ResourceSlotUpdatePacket; import com.refinedmods.refinedstorage.common.support.packet.s2c.StorageInfoResponsePacket; -import com.refinedmods.refinedstorage.common.support.packet.s2c.WirelessTransmitterRangePacket; +import com.refinedmods.refinedstorage.common.support.packet.s2c.WirelessTransmitterDataPacket; import com.refinedmods.refinedstorage.common.support.tooltip.CompositeClientTooltipComponent; import com.refinedmods.refinedstorage.common.support.tooltip.HelpClientTooltipComponent; import com.refinedmods.refinedstorage.common.support.tooltip.ResourceClientTooltipComponent; @@ -255,8 +255,8 @@ private void registerPacketHandlers() { wrapHandler(EnergyInfoPacket::handle) ); ClientPlayNetworking.registerGlobalReceiver( - WirelessTransmitterRangePacket.PACKET_TYPE, - wrapHandler(WirelessTransmitterRangePacket::handle) + WirelessTransmitterDataPacket.PACKET_TYPE, + wrapHandler(WirelessTransmitterDataPacket::handle) ); ClientPlayNetworking.registerGlobalReceiver( ResourceSlotUpdatePacket.PACKET_TYPE, diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java index 49a6866f2..d0608612f 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java @@ -59,7 +59,7 @@ import com.refinedmods.refinedstorage.common.support.packet.s2c.PatternGridAllowedAlternativesUpdatePacket; import com.refinedmods.refinedstorage.common.support.packet.s2c.ResourceSlotUpdatePacket; import com.refinedmods.refinedstorage.common.support.packet.s2c.StorageInfoResponsePacket; -import com.refinedmods.refinedstorage.common.support.packet.s2c.WirelessTransmitterRangePacket; +import com.refinedmods.refinedstorage.common.support.packet.s2c.WirelessTransmitterDataPacket; import com.refinedmods.refinedstorage.common.support.resource.FluidResource; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import com.refinedmods.refinedstorage.common.upgrade.RegulatorUpgradeItem; @@ -400,8 +400,8 @@ private void registerPackets() { private void registerServerToClientPackets() { PayloadTypeRegistry.playS2C().register(EnergyInfoPacket.PACKET_TYPE, EnergyInfoPacket.STREAM_CODEC); PayloadTypeRegistry.playS2C().register( - WirelessTransmitterRangePacket.PACKET_TYPE, - WirelessTransmitterRangePacket.STREAM_CODEC + WirelessTransmitterDataPacket.PACKET_TYPE, + WirelessTransmitterDataPacket.STREAM_CODEC ); PayloadTypeRegistry.playS2C().register(GridActivePacket.PACKET_TYPE, GridActivePacket.STREAM_CODEC); PayloadTypeRegistry.playS2C().register(GridClearPacket.PACKET_TYPE, GridClearPacket.STREAM_CODEC); diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/PlatformImpl.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/PlatformImpl.java index 840267efc..421083629 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/PlatformImpl.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/PlatformImpl.java @@ -195,9 +195,8 @@ public Optional fillContainer(final ItemStack container, } } - @Override - public Optional getFilledBucket(final FluidResource fluidResource) { - final SimpleSingleStackStorage interceptingStorage = SimpleSingleStackStorage.forEmptyBucket(); + private Optional getFilledItemStack(final FluidResource fluidResource, + final SimpleSingleStackStorage interceptingStorage) { final Storage destination = FluidStorage.ITEM.find( interceptingStorage.getStack(), ContainerItemContext.ofSingleSlot(interceptingStorage) diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/grid/strategy/FluidGridExtractionStrategy.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/grid/strategy/FluidGridExtractionStrategy.java index fab9c3b53..c03d12a42 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/grid/strategy/FluidGridExtractionStrategy.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/grid/strategy/FluidGridExtractionStrategy.java @@ -18,9 +18,11 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; import net.fabricmc.fabric.api.transfer.v1.item.PlayerInventoryStorage; +import net.fabricmc.fabric.api.transfer.v1.storage.StorageView; import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import static com.refinedmods.refinedstorage.fabric.support.resource.VariantUtil.toFluidVariant; @@ -48,9 +50,12 @@ public boolean onExtract(final PlatformResourceKey resource, final GridExtractMode extractMode, final boolean cursor) { if (resource instanceof FluidResource fluidResource) { + final boolean containerOnCursor = isFluidContainerOnCursor(); final boolean bucketInInventory = hasBucketInInventory(); final boolean bucketInStorage = hasBucketInStorage(); - if (bucketInInventory) { + if (containerOnCursor) { + extractWithContainerOnCursor(fluidResource, extractMode); + } else if (bucketInInventory) { extractWithBucketInInventory(fluidResource, extractMode, cursor); } else if (bucketInStorage) { extractWithBucketInStorage(fluidResource, extractMode, cursor); @@ -60,6 +65,49 @@ public boolean onExtract(final PlatformResourceKey resource, return false; } + private void extractWithContainerOnCursor(final FluidResource fluidResource, final GridExtractMode mode) { + try (Transaction tx = Transaction.openOuter()) { + final ItemStack stack = extractContainerFromCursor(tx); + final SimpleSingleStackStorage interceptingStorage = SimpleSingleStackStorage.forStack(stack); + final net.fabricmc.fabric.api.transfer.v1.storage.Storage dest = FluidStorage.ITEM.find( + interceptingStorage.getStack(), + ContainerItemContext.ofSingleSlot(interceptingStorage) + ); + if (dest == null) { + return; + } + gridOperations.extract(fluidResource, mode, (resource2, amount, action, source) -> { + if (!(resource2 instanceof FluidResource fluidResource2)) { + return 0; + } + try (Transaction innerTx = tx.openNested()) { + final long inserted = dest.insert(toFluidVariant(fluidResource2), amount, innerTx); + final boolean couldInsertContainer = insertResultingContainerIntoInventory( + interceptingStorage, + true, + innerTx + ); + if (!couldInsertContainer) { + return 0; + } + if (action == Action.EXECUTE) { + innerTx.commit(); + tx.commit(); + } + return inserted; + } + }); + } + } + + private ItemStack extractContainerFromCursor(final Transaction tx) { + final StorageView view = playerCursorStorage.iterator().next(); + final ItemVariant variant = view.getResource(); + final ItemStack stack = variant.toStack((int) view.getAmount()); + playerCursorStorage.extract(variant, 1, tx); + return stack; + } + private void extractWithBucketInStorage(final FluidResource fluidResource, final GridExtractMode mode, final boolean cursor) { @@ -77,7 +125,8 @@ private void extractWithBucketInStorage(final FluidResource fluidResource, } try (Transaction tx = Transaction.openOuter()) { final long inserted = destination.insert(toFluidVariant(fluidResource2), amount, tx); - final boolean couldInsertBucket = insertResultingBucketIntoInventory(interceptingStorage, cursor, tx); + final boolean couldInsertBucket = + insertResultingContainerIntoInventory(interceptingStorage, cursor, tx); if (!couldInsertBucket) { return 0; } @@ -109,7 +158,7 @@ private void extractWithBucketInInventory(final FluidResource fluidResource, } try (Transaction innerTx = tx.openNested()) { final long inserted = dest.insert(toFluidVariant(fluidResource2), amount, innerTx); - final boolean couldInsertBucket = insertResultingBucketIntoInventory( + final boolean couldInsertBucket = insertResultingContainerIntoInventory( interceptingStorage, cursor, innerTx @@ -127,9 +176,9 @@ private void extractWithBucketInInventory(final FluidResource fluidResource, } } - private boolean insertResultingBucketIntoInventory(final SimpleSingleStackStorage interceptingStorage, - final boolean cursor, - final Transaction innerTx) { + private boolean insertResultingContainerIntoInventory(final SimpleSingleStackStorage interceptingStorage, + final boolean cursor, + final Transaction innerTx) { final net.fabricmc.fabric.api.transfer.v1.storage.Storage relevantStorage = cursor ? playerCursorStorage : playerInventoryStorage; @@ -137,6 +186,14 @@ private boolean insertResultingBucketIntoInventory(final SimpleSingleStackStorag return relevantStorage.insert(itemVariant, 1, innerTx) != 0; } + private boolean isFluidContainerOnCursor() { + final StorageView view = playerCursorStorage.iterator().next(); + final ItemVariant variant = view.getResource(); + final ItemStack stack = variant.toStack((int) view.getAmount()); + final ContainerItemContext ctx = ContainerItemContext.withConstant(stack); + return FluidStorage.ITEM.find(stack, ctx) != null; + } + private boolean hasBucketInInventory() { try (Transaction tx = Transaction.openOuter()) { return playerInventoryStorage.extract(BUCKET_ITEM_VARIANT, 1, tx) == 1; diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/AbstractDiskContainerBakedModel.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/AbstractDiskContainerBakedModel.java index 03d3c9728..ee6ac9069 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/AbstractDiskContainerBakedModel.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/AbstractDiskContainerBakedModel.java @@ -3,7 +3,7 @@ import com.refinedmods.refinedstorage.api.storage.StorageState; import com.refinedmods.refinedstorage.common.storage.AbstractDiskContainerBlockEntity; import com.refinedmods.refinedstorage.common.storage.Disk; -import com.refinedmods.refinedstorage.common.util.PlatformUtil; +import com.refinedmods.refinedstorage.common.util.ClientPlatformUtil; import com.refinedmods.refinedstorage.fabric.support.render.QuadTranslator; import java.util.Map; @@ -58,7 +58,7 @@ public void emitBlockQuads(final BlockAndTintGetter blockView, public void emitItemQuads(final ItemStack stack, final Supplier randomSupplier, final RenderContext context) { - final Level level = PlatformUtil.getClientLevel(); + final Level level = ClientPlatformUtil.getClientLevel(); final CustomData customData = stack.get(DataComponents.BLOCK_ENTITY_DATA); if (customData == null || level == null) { return; diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/portablegrid/PortableGridBakedModel.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/portablegrid/PortableGridBakedModel.java index 2c490a217..e0e3658d9 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/portablegrid/PortableGridBakedModel.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/portablegrid/PortableGridBakedModel.java @@ -6,7 +6,7 @@ import com.refinedmods.refinedstorage.common.storage.portablegrid.PortableGridBlockItem; import com.refinedmods.refinedstorage.common.storage.portablegrid.PortableGridBlockItemRenderInfo; import com.refinedmods.refinedstorage.common.support.direction.BiDirection; -import com.refinedmods.refinedstorage.common.util.PlatformUtil; +import com.refinedmods.refinedstorage.common.util.ClientPlatformUtil; import com.refinedmods.refinedstorage.fabric.support.render.QuadRotators; import com.refinedmods.refinedstorage.fabric.support.render.QuadTranslator; @@ -56,7 +56,7 @@ public boolean isVanillaAdapter() { public void emitItemQuads(final ItemStack stack, final Supplier randomSupplier, final RenderContext context) { - final Level level = PlatformUtil.getClientLevel(); + final Level level = ClientPlatformUtil.getClientLevel(); if (level == null) { return; } diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/util/SimpleSingleStackStorage.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/util/SimpleSingleStackStorage.java index 73b1513a7..3372127c5 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/util/SimpleSingleStackStorage.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/util/SimpleSingleStackStorage.java @@ -12,7 +12,11 @@ public SimpleSingleStackStorage(final ItemStack stack) { } public static SimpleSingleStackStorage forEmptyBucket() { - return new SimpleSingleStackStorage(new ItemStack(Items.BUCKET)); + return forStack(new ItemStack(Items.BUCKET)); + } + + public static SimpleSingleStackStorage forStack(final ItemStack stack) { + return new SimpleSingleStackStorage(stack); } @Override diff --git a/refinedstorage-fabric/src/main/resources/fabric.mod.json b/refinedstorage-fabric/src/main/resources/fabric.mod.json index dfc5a06b2..c214d273c 100644 --- a/refinedstorage-fabric/src/main/resources/fabric.mod.json +++ b/refinedstorage-fabric/src/main/resources/fabric.mod.json @@ -38,14 +38,13 @@ ], "depends": { "fabricloader": ">=0.14.6", - "fabric-api": "*", - "minecraft": "1.21", + "fabric-api": ">=0.101.0", + "minecraft": "~1.21", "java": ">=21", "cloth-config2": "*", "team_reborn_energy": "*" }, "suggests": { - "roughlyenoughitems": "*", "modmenu": "*" } } diff --git a/refinedstorage-grid-api/src/test/java/com/refinedmods/refinedstorage/api/grid/watcher/GridWatcherManagerImplTest.java b/refinedstorage-grid-api/src/test/java/com/refinedmods/refinedstorage/api/grid/watcher/GridWatcherManagerImplTest.java index 77e0b2814..c7c8ecb91 100644 --- a/refinedstorage-grid-api/src/test/java/com/refinedmods/refinedstorage/api/grid/watcher/GridWatcherManagerImplTest.java +++ b/refinedstorage-grid-api/src/test/java/com/refinedmods/refinedstorage/api/grid/watcher/GridWatcherManagerImplTest.java @@ -2,7 +2,7 @@ import com.refinedmods.refinedstorage.api.core.Action; import com.refinedmods.refinedstorage.api.storage.Actor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.root.RootStorage; import com.refinedmods.refinedstorage.api.storage.root.RootStorageImpl; @@ -30,7 +30,7 @@ class GridWatcherManagerImplTest { void setUp() { sut = new GridWatcherManagerImpl(); rootStorage = new RootStorageImpl(); - rootStorage.addSource(new InMemoryStorageImpl()); + rootStorage.addSource(new StorageImpl()); } @Test diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ConfigImpl.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ConfigImpl.java index 1fe2b5685..504c04be9 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ConfigImpl.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ConfigImpl.java @@ -119,7 +119,10 @@ public int getMaxRowsStretch() { @Override public void setScreenSize(final ScreenSize screenSize) { - this.screenSize.set(screenSize); + if (screenSize != this.screenSize.get()) { + this.screenSize.set(screenSize); + this.spec.save(); + } } @Override @@ -427,7 +430,10 @@ public boolean isAutoSelected() { @Override public void setAutoSelected(final boolean autoSelected) { - this.autoSelected.set(autoSelected); + if (autoSelected != this.autoSelected.get()) { + this.autoSelected.set(autoSelected); + ConfigImpl.this.spec.save(); + } } @Override @@ -440,12 +446,18 @@ public Optional getSynchronizer() { @Override public void setSynchronizer(final ResourceLocation synchronizerId) { - this.synchronizer.set(synchronizerId.toString()); + if (!synchronizerId.toString().equals(this.synchronizer.get())) { + this.synchronizer.set(synchronizerId.toString()); + ConfigImpl.this.spec.save(); + } } @Override public void clearSynchronizer() { - this.synchronizer.set(""); + if (!synchronizer.get().isEmpty()) { + this.synchronizer.set(""); + ConfigImpl.this.spec.save(); + } } @Override @@ -455,7 +467,10 @@ public GridSortingDirection getSortingDirection() { @Override public void setSortingDirection(final GridSortingDirection sortingDirection) { - this.sortingDirection.set(sortingDirection); + if (sortingDirection != this.sortingDirection.get()) { + this.sortingDirection.set(sortingDirection); + ConfigImpl.this.spec.save(); + } } @Override @@ -465,7 +480,10 @@ public GridSortingTypes getSortingType() { @Override public void setSortingType(final GridSortingTypes sortingType) { - this.sortingType.set(sortingType); + if (sortingType != this.sortingType.get()) { + this.sortingType.set(sortingType); + ConfigImpl.this.spec.save(); + } } @Override @@ -478,12 +496,18 @@ public Optional getResourceType() { @Override public void setResourceType(final ResourceLocation resourceTypeId) { - this.resourceType.set(resourceTypeId.toString()); + if (!resourceTypeId.toString().equals(this.resourceType.get())) { + this.resourceType.set(resourceTypeId.toString()); + ConfigImpl.this.spec.save(); + } } @Override public void clearResourceType() { - this.resourceType.set(""); + if (!resourceType.get().isEmpty()) { + this.resourceType.set(""); + ConfigImpl.this.spec.save(); + } } } diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java index 176b5a7d0..78cd28929 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java @@ -59,7 +59,7 @@ import com.refinedmods.refinedstorage.common.support.packet.s2c.PatternGridAllowedAlternativesUpdatePacket; import com.refinedmods.refinedstorage.common.support.packet.s2c.ResourceSlotUpdatePacket; import com.refinedmods.refinedstorage.common.support.packet.s2c.StorageInfoResponsePacket; -import com.refinedmods.refinedstorage.common.support.packet.s2c.WirelessTransmitterRangePacket; +import com.refinedmods.refinedstorage.common.support.packet.s2c.WirelessTransmitterDataPacket; import com.refinedmods.refinedstorage.common.upgrade.RegulatorUpgradeItem; import com.refinedmods.refinedstorage.common.util.IdentifierUtil; import com.refinedmods.refinedstorage.common.util.ServerEventQueue; @@ -597,9 +597,9 @@ private static void registerServerToClientPackets(final PayloadRegistrar registr wrapHandler((packet, ctx) -> StorageInfoResponsePacket.handle(packet)) ); registrar.playToClient( - WirelessTransmitterRangePacket.PACKET_TYPE, - WirelessTransmitterRangePacket.STREAM_CODEC, - wrapHandler(WirelessTransmitterRangePacket::handle) + WirelessTransmitterDataPacket.PACKET_TYPE, + WirelessTransmitterDataPacket.STREAM_CODEC, + wrapHandler(WirelessTransmitterDataPacket::handle) ); registrar.playToClient( NoPermissionPacket.PACKET_TYPE, diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/PlatformImpl.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/PlatformImpl.java index 1e91d7032..a533b9629 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/PlatformImpl.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/PlatformImpl.java @@ -54,7 +54,6 @@ import net.minecraft.world.inventory.Slot; import net.minecraft.world.inventory.tooltip.TooltipComponent; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.CraftingRecipe; @@ -165,19 +164,6 @@ public Optional fillContainer(final ItemStack container, }); } - @Override - public Optional getFilledBucket(final FluidResource fluidResource) { - return Optional.ofNullable( - new ItemStack(Items.BUCKET).getCapability(Capabilities.FluidHandler.ITEM) - ).map(dest -> { - dest.fill( - toFluidStack(fluidResource, FluidType.BUCKET_VOLUME), - IFluidHandler.FluidAction.EXECUTE - ); - return dest.getContainer(); - }); - } - @Override public TransferManager createTransferManager(final AbstractContainerMenu containerMenu) { return new TransferManager(containerMenu, ContainerTransferDestination::new); diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/ItemModelProviderImpl.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/ItemModelProviderImpl.java index 3eb2074d0..72ae46e81 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/ItemModelProviderImpl.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/ItemModelProviderImpl.java @@ -9,8 +9,8 @@ import com.refinedmods.refinedstorage.common.networking.CableBlock; import com.refinedmods.refinedstorage.common.networking.NetworkReceiverBlock; import com.refinedmods.refinedstorage.common.networking.NetworkTransmitterBlock; +import com.refinedmods.refinedstorage.common.networking.WirelessTransmitterBlock; import com.refinedmods.refinedstorage.common.storage.externalstorage.ExternalStorageBlock; -import com.refinedmods.refinedstorage.common.wirelesstransmitter.WirelessTransmitterBlock; import net.minecraft.data.PackOutput; import net.minecraft.resources.ResourceLocation; diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/loot/BlockDropProvider.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/loot/BlockDropProvider.java index 801c31c73..ebff81162 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/loot/BlockDropProvider.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/loot/BlockDropProvider.java @@ -8,9 +8,11 @@ import java.util.Set; import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; import net.minecraft.data.loot.BlockLootSubProvider; import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.storage.loot.functions.CopyComponentsFunction; public class BlockDropProvider extends BlockLootSubProvider { public BlockDropProvider(final HolderLookup.Provider provider) { @@ -19,24 +21,36 @@ public BlockDropProvider(final HolderLookup.Provider provider) { @Override protected void generate() { - Blocks.INSTANCE.getCable().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getGrid().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getCraftingGrid().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getPatternGrid().forEach((color, id, block) -> dropSelf(block.get())); + Blocks.INSTANCE.getCable().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getGrid().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getCraftingGrid().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getPatternGrid().forEach((color, id, block) -> drop(block.get())); Blocks.INSTANCE.getController().forEach((color, id, block) -> add( block.get(), - createSingleItemTable(block.get()).apply(EnergyLootItemFunction::new) + createSingleItemTable(block.get()) + .apply(EnergyLootItemFunction::new) + .apply(copyName()) )); - Blocks.INSTANCE.getCreativeController().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getDetector().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getConstructor().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getDestructor().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getWirelessTransmitter().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getNetworkReceiver().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getNetworkTransmitter().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getSecurityManager().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getRelay().forEach((color, id, block) -> dropSelf(block.get())); - Blocks.INSTANCE.getDiskInterface().forEach((color, id, block) -> dropSelf(block.get())); + Blocks.INSTANCE.getCreativeController().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getDetector().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getConstructor().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getDestructor().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getWirelessTransmitter().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getNetworkReceiver().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getNetworkTransmitter().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getSecurityManager().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getRelay().forEach((color, id, block) -> drop(block.get())); + Blocks.INSTANCE.getDiskInterface().forEach((color, id, block) -> drop(block.get())); + } + + private void drop(final Block block) { + add(block, createSingleItemTable(block) + .apply(copyName())); + } + + private static CopyComponentsFunction.Builder copyName() { + return CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY) + .include(DataComponents.CUSTOM_NAME); } @Override diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/grid/strategy/FluidGridExtractionStrategy.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/grid/strategy/FluidGridExtractionStrategy.java index f73c3eb51..c12bb4721 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/grid/strategy/FluidGridExtractionStrategy.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/grid/strategy/FluidGridExtractionStrategy.java @@ -50,9 +50,12 @@ public boolean onExtract(final PlatformResourceKey resource, final GridExtractMode extractMode, final boolean cursor) { if (resource instanceof FluidResource fluidResource) { + final boolean containerOnCursor = isFluidContainerOnCursor(); final boolean bucketInInventory = hasBucketInInventory(); final boolean bucketInStorage = hasBucketInStorage(); - if (bucketInInventory) { + if (containerOnCursor) { + extractWithContainerOnCursor(fluidResource, extractMode); + } else if (bucketInInventory) { extract(fluidResource, extractMode, cursor, true); } else if (bucketInStorage) { extract(fluidResource, extractMode, cursor, false); @@ -67,6 +70,24 @@ private IFluidHandlerItem getFluidStorage(final ItemStack stack) { return stack.getCapability(Capabilities.FluidHandler.ITEM); } + private void extractWithContainerOnCursor(final FluidResource fluidResource, + final GridExtractMode mode) { + gridOperations.extract(fluidResource, mode, (resource, amount, action, source) -> { + if (!(resource instanceof FluidResource fluidResource2)) { + return 0; + } + final IFluidHandlerItem destination = getFluidStorage(menu.getCarried()); + if (destination == null) { + return 0; + } + final int inserted = destination.fill(toFluidStack(fluidResource2, amount), toFluidAction(action)); + if (inserted > 0 && action == Action.EXECUTE) { + menu.setCarried(destination.getContainer()); + } + return inserted; + }); + } + private void extract(final FluidResource fluidResource, final GridExtractMode mode, final boolean cursor, @@ -121,6 +142,10 @@ private boolean insertResultingBucket(final boolean cursor, final IFluidHandlerI } } + private boolean isFluidContainerOnCursor() { + return getFluidStorage(menu.getCarried()) != null; + } + private boolean hasBucketInStorage() { return itemStorage.extract(BUCKET_ITEM_RESOURCE, 1, Action.SIMULATE, EmptyActor.INSTANCE) == 1; } diff --git a/refinedstorage-neoforge/src/main/resources/META-INF/neoforge.mods.toml b/refinedstorage-neoforge/src/main/resources/META-INF/neoforge.mods.toml index 296fa69fb..19353f8ec 100644 --- a/refinedstorage-neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/refinedstorage-neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -15,6 +15,6 @@ Refined Storage is a mass storage mod for Minecraft that offers the player a net [[dependencies.refinedstorage]] modId = "neoforge" type = "required" -versionRange = "[21.0.112-beta,)" +versionRange = "[21.0.153,)" ordering = "NONE" side = "BOTH" diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/GameTestUtil.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/GameTestUtil.java index 2c68b9160..d822d237a 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/GameTestUtil.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/GameTestUtil.java @@ -6,6 +6,8 @@ import com.refinedmods.refinedstorage.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.resource.ResourceKey; +import com.refinedmods.refinedstorage.api.resource.list.ResourceList; +import com.refinedmods.refinedstorage.api.resource.list.ResourceListImpl; import com.refinedmods.refinedstorage.api.storage.EmptyActor; import com.refinedmods.refinedstorage.common.api.support.network.AbstractNetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage.common.api.support.resource.ResourceContainer; @@ -16,9 +18,9 @@ import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import java.util.Arrays; +import java.util.Collection; import java.util.Iterator; import java.util.function.Consumer; -import java.util.stream.IntStream; import javax.annotation.Nullable; import net.minecraft.core.BlockPos; @@ -129,7 +131,6 @@ public static void assertItemEntityPresentExactly(final GameTestHelper helper, throw new GameTestAssertException("Expected " + itemStack.getItem().getDescription().getString() + " item at: " + blockpos + " with count: " + itemStack.getCount()); } - itemEntity = entityIterator.next(); } while (!itemEntity.getItem().getItem().equals(itemStack.getItem()) || itemEntity.getItem().getCount() != itemStack.getCount()); @@ -138,18 +139,17 @@ public static void assertItemEntityPresentExactly(final GameTestHelper helper, public static Runnable assertInterfaceEmpty(final GameTestHelper helper, final BlockPos pos) { final var interfaceBlockEntity = requireBlockEntity(helper, pos, InterfaceBlockEntity.class); - - return assertResourceContainerEmpty(interfaceBlockEntity.getDisplayName(), - interfaceBlockEntity.getExportedResources()); + return assertResourceContainerEmpty( + interfaceBlockEntity.getDisplayName(), + interfaceBlockEntity.getExportedResources() + ); } private static Runnable assertResourceContainerEmpty(final Component displayName, final ResourceContainer container) { return () -> { - for (int i = 0; i < container.size(); i++) { - if (!container.isEmpty(i)) { - throw new GameTestAssertException(displayName.getString() + " should be empty"); - } + if (!container.isEmpty()) { + throw new GameTestAssertException(displayName.getString() + " should be empty"); } }; } @@ -158,41 +158,21 @@ public static Runnable interfaceContainsExactly(final GameTestHelper helper, final BlockPos pos, final ResourceAmount... expected) { final var interfaceBlockEntity = requireBlockEntity(helper, pos, InterfaceBlockEntity.class); - - return resourceContainerContainsExactly(helper, interfaceBlockEntity.getDisplayName(), - interfaceBlockEntity.getExportedResources(), expected); + return resourceContainerContainsExactly(interfaceBlockEntity.getExportedResources(), expected); } - private static Runnable resourceContainerContainsExactly(final GameTestHelper helper, - final Component displayName, - final ResourceContainer container, + private static Runnable resourceContainerContainsExactly(final ResourceContainer container, final ResourceAmount... expected) { + final ResourceList expectedList = toResourceList(expected); return () -> { - // todo: investigate issue with EnderIO integration - // TODO: This does not take duplicate ResourceAmount into account - for (final ResourceAmount expectedStack : expected) { - final boolean contains = IntStream.range(0, container.size()) - .mapToObj(container::get) - .anyMatch(resource -> resource != null - && resource.resource().equals(expectedStack.resource()) - && resource.amount() == expectedStack.amount()); - - helper.assertTrue(contains, "Expected resource is missing from " + displayName.getString() + ": " - + expectedStack + " with count: " + expectedStack.amount()); - } - + final ResourceList given = ResourceListImpl.create(); for (int i = 0; i < container.size(); i++) { - final ResourceAmount resource = container.get(i); - if (resource != null) { - final boolean wasExpected = Arrays.stream(expected).anyMatch( - expectedResource -> expectedResource.resource().equals(resource.resource()) - && expectedResource.amount() == resource.amount() - ); - - helper.assertTrue(wasExpected, "Unexpected resource found in " + displayName.getString() + ": " - + resource.resource() + " with count: " + resource.amount()); + final ResourceAmount item = container.get(i); + if (item != null) { + given.add(item); } } + listContainsExactly(given, expectedList); }; } @@ -200,52 +180,58 @@ public static Runnable containerContainsExactly(final GameTestHelper helper, final BlockPos pos, final ResourceAmount... expected) { final var containerBlockEntity = requireBlockEntity(helper, pos, BaseContainerBlockEntity.class); - + final ResourceList expectedList = toResourceList(expected); return () -> { - // TODO: This does not take duplicate ResourceAmount into account - for (final ResourceAmount expectedStack : expected) { - final boolean contains = IntStream.range(0, containerBlockEntity.getContainerSize()) - .mapToObj(containerBlockEntity::getItem) - .anyMatch(inContainer -> asResource(inContainer).equals(expectedStack.resource()) - && inContainer.getCount() == expectedStack.amount()); - helper.assertTrue(contains, "Expected resource is missing from container: " - + expectedStack + " with count: " + expectedStack.amount()); - } + final ResourceList given = ResourceListImpl.create(); for (int i = 0; i < containerBlockEntity.getContainerSize(); i++) { - final ItemStack inContainer = containerBlockEntity.getItem(i); - - if (!inContainer.isEmpty()) { - final boolean wasExpected = Arrays.stream(expected).anyMatch( - expectedStack -> expectedStack.resource().equals(asResource(inContainer)) - && expectedStack.amount() == inContainer.getCount() - ); - helper.assertTrue(wasExpected, "Unexpected resource found in container: " - + inContainer.getDescriptionId() + " with count: " + inContainer.getCount()); + final ItemStack itemStack = containerBlockEntity.getItem(i); + if (!itemStack.isEmpty()) { + given.add(asResource(itemStack), itemStack.getCount()); } } + listContainsExactly(given, expectedList); }; } public static Runnable storageContainsExactly(final GameTestHelper helper, final BlockPos networkPos, final ResourceAmount... expected) { + final ResourceList expectedList = toResourceList(expected); return networkIsAvailable(helper, networkPos, network -> { final StorageNetworkComponent storage = network.getComponent(StorageNetworkComponent.class); - for (final ResourceAmount expectedResource : expected) { - final boolean contains = storage.getAll() - .stream() - .anyMatch(inStorage -> inStorage.resource().equals(expectedResource.resource()) - && inStorage.amount() == expectedResource.amount()); - helper.assertTrue(contains, "Expected resource is missing from storage: " + expectedResource); + listContainsExactly(toResourceList(storage.getAll()), expectedList); + }); + } + + private static ResourceList toResourceList(final ResourceAmount... resources) { + return toResourceList(Arrays.asList(resources)); + } + + private static ResourceList toResourceList(final Collection resources) { + final ResourceList list = ResourceListImpl.create(); + for (final ResourceAmount resource : resources) { + list.add(resource); + } + return list; + } + + private static void listContainsExactly(final ResourceList given, final ResourceList expected) { + for (final ResourceAmount expectedItem : expected.copyState()) { + final long givenAmount = given.get(expectedItem.resource()); + if (givenAmount != expectedItem.amount()) { + throw new GameTestAssertException( + "Expected " + expectedItem.amount() + " of " + expectedItem.resource() + ", but was " + givenAmount + ); } - for (final ResourceAmount inStorage : storage.getAll()) { - final boolean wasExpected = Arrays.stream(expected).anyMatch( - expectedResource -> expectedResource.resource().equals(inStorage.resource()) - && expectedResource.amount() == inStorage.amount() + } + for (final ResourceAmount givenItem : given.copyState()) { + final long expectedAmount = expected.get(givenItem.resource()); + if (expectedAmount != givenItem.amount()) { + throw new GameTestAssertException( + "Expected " + expectedAmount + " of " + givenItem.resource() + ", but was " + givenItem.amount() ); - helper.assertTrue(wasExpected, "Unexpected resource found in storage: " + inStorage); } - }); + } } public static ItemResource asResource(final Item item) { diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/PriorityNetworkBuilderImplTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/PriorityNetworkBuilderImplTest.java index 7920bfef2..7b1ef3c53 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/PriorityNetworkBuilderImplTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/PriorityNetworkBuilderImplTest.java @@ -10,7 +10,7 @@ import com.refinedmods.refinedstorage.api.network.node.container.NetworkNodeContainer; import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.network.test.fake.FakeActor; import java.util.Optional; @@ -117,7 +117,7 @@ void shouldRespectPriorityWhenMerging() { private NetworkSide createNetworkSide(final MasterSlave side, final Supplier networkFactory) { final StorageNetworkNode nodeA = new StorageNetworkNode(0, 0, 1); - final InMemoryStorageImpl storage = new InMemoryStorageImpl(); + final StorageImpl storage = new StorageImpl(); storage.insert(side, 10, Action.EXECUTE, FakeActor.INSTANCE); nodeA.setProvider(index -> Optional.of(storage)); final NetworkNodeContainer a = createContainerWithNetwork( diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/detector/DetectorNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/detector/DetectorNetworkNodeTest.java index b2e1d165a..bce2d6535 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/detector/DetectorNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/detector/DetectorNetworkNodeTest.java @@ -3,7 +3,7 @@ import com.refinedmods.refinedstorage.api.core.Action; import com.refinedmods.refinedstorage.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage.network.test.NetworkTest; @@ -34,7 +34,7 @@ class DetectorNetworkNodeTest { @BeforeEach void setUp(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); sut.setAmountStrategy(new DetectorAmountStrategyImpl()); } diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/AbstractExporterNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/AbstractExporterNetworkNodeTest.java index fa57ebdce..6d82477d0 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/AbstractExporterNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/AbstractExporterNetworkNodeTest.java @@ -9,9 +9,9 @@ import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.InsertableStorage; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetworkEnergyComponent; @@ -58,7 +58,7 @@ void shouldUseFirstSuccessfulStrategy( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); @@ -90,7 +90,7 @@ void shouldUseFirstSuccessfulResourceInTheStrategy( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); @@ -145,11 +145,11 @@ void shouldNotTransferWithoutTaskExecutor( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); sut.setFilters(List.of(A, B)); sut.setTransferStrategy(createTransferStrategy(destination, 1)); @@ -169,11 +169,11 @@ void shouldNotTransferWithoutTaskExecutor( @Test void shouldNotTransferWithoutStrategy(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); sut.setFilters(List.of(A, B)); @@ -191,11 +191,11 @@ void shouldNotTransferWithoutStrategy(@InjectNetworkStorageComponent final Stora @Test void shouldNotTransferIfInactive(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 1); sut.setTransferStrategy(strategy); @@ -216,11 +216,11 @@ void shouldNotTransferIfInactive(@InjectNetworkStorageComponent final StorageNet @Test void shouldNotTransferWithoutFilters(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 1); sut.setTransferStrategy(strategy); @@ -242,7 +242,7 @@ void shouldNotTransferIfNoResourcesAreAvailable( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 10); sut.setTransferStrategy(strategy); @@ -263,7 +263,7 @@ void shouldTransferWithLimitedSpaceInDestination( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(C, 100, Action.EXECUTE, EmptyActor.INSTANCE); @@ -308,7 +308,7 @@ void shouldNotTransferIfThereIsNoSpaceInTheDestination( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); @@ -338,11 +338,11 @@ void shouldTransferSingleResourceEvenIfTransferQuotaHasNotBeenMet( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 6, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 7, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 10); sut.setTransferStrategy(strategy); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/FirstAvailableExporterNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/FirstAvailableExporterNetworkNodeTest.java index ea89e9214..db9bf6b7f 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/FirstAvailableExporterNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/FirstAvailableExporterNetworkNodeTest.java @@ -10,8 +10,8 @@ import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage.api.storage.tracked.TrackedStorageImpl; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; @@ -35,11 +35,11 @@ protected TaskExecutor createTaskExecutor() { @Test void shouldTransfer(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storage.addSource(new TrackedStorageImpl(new InMemoryStorageImpl(), () -> 1L)); + storage.addSource(new TrackedStorageImpl(new StorageImpl(), () -> 1L)); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 1); sut.setTransferStrategy(strategy); @@ -68,10 +68,10 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(B, 7, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 10); sut.setTransferStrategy(strategy); @@ -92,12 +92,12 @@ void shouldUseNextResourceIfFirstOneIsNotAcceptedInSameCycle( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(C, 10, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl() { + final Storage destination = new StorageImpl() { @Override public long insert(final ResourceKey resource, final long amount, final Action action, final Actor actor) { if (A.equals(resource)) { diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/RandomExporterNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/RandomExporterNetworkNodeTest.java index 57c7d9446..e357f7218 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/RandomExporterNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/RandomExporterNetworkNodeTest.java @@ -7,8 +7,8 @@ import com.refinedmods.refinedstorage.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; import java.util.List; @@ -32,11 +32,11 @@ protected TaskExecutor createTaskExecutor() { @Test void shouldTransfer(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 5); sut.setTransferStrategy(strategy); @@ -69,10 +69,10 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(B, 7, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 10); sut.setTransferStrategy(strategy); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/RoundRobinExporterNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/RoundRobinExporterNetworkNodeTest.java index 8b0f7cc98..5dbdb29c3 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/RoundRobinExporterNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/exporter/RoundRobinExporterNetworkNodeTest.java @@ -7,8 +7,8 @@ import com.refinedmods.refinedstorage.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; import java.util.List; @@ -44,11 +44,11 @@ protected TaskExecutor createTaskExecutor() { @Test void shouldTransfer(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 5); sut.setTransferStrategy(strategy); @@ -97,7 +97,7 @@ void shouldTransfer(@InjectNetworkStorageComponent final StorageNetworkComponent @Test void shouldNotTransferIfThereAreNoResourcesInSource() { // Arrange - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 5); sut.setTransferStrategy(strategy); @@ -113,11 +113,11 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(D, 9, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 10); sut.setTransferStrategy(strategy); @@ -189,12 +189,12 @@ void shouldResetRoundRobinStateAfterChangingFilters( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(C, 100, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage destination = new InMemoryStorageImpl(); + final Storage destination = new StorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 5); sut.setTransferStrategy(strategy); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/externalstorage/ExternalStorageNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/externalstorage/ExternalStorageNetworkNodeTest.java index 89489c30e..1f52e431f 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/externalstorage/ExternalStorageNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/externalstorage/ExternalStorageNetworkNodeTest.java @@ -7,8 +7,8 @@ import com.refinedmods.refinedstorage.api.resource.filter.FilterMode; import com.refinedmods.refinedstorage.api.storage.AccessMode; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.external.ExternalStorageProvider; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.api.storage.tracked.TrackedResource; @@ -68,7 +68,7 @@ void testInitialState(@InjectNetworkStorageComponent final StorageNetworkCompone @Test void shouldInitialize(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); // Act @@ -84,10 +84,10 @@ void shouldBeAbleToInitializeMultipleTimes( @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - final Storage storage1 = new InMemoryStorageImpl(); + final Storage storage1 = new StorageImpl(); final ExternalStorageProvider provider1 = new StorageExternalStorageProvider(storage1); - final Storage storage2 = new InMemoryStorageImpl(); + final Storage storage2 = new StorageImpl(); final ExternalStorageProvider provider2 = new StorageExternalStorageProvider(storage2); // Act @@ -113,7 +113,7 @@ void shouldBeAbleToInitializeMultipleTimes( @Test void shouldInsert(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); sut.initialize(new ExternalStorageProviderFactoryImpl(provider)); @@ -134,7 +134,7 @@ void shouldInsert(@InjectNetworkStorageComponent final StorageNetworkComponent n @Test void shouldExtract(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); sut.initialize(new ExternalStorageProviderFactoryImpl(provider)); @@ -160,7 +160,7 @@ void shouldRespectAllowlistWhenInserting( sut.getStorageConfiguration().setFilterMode(FilterMode.ALLOW); sut.getStorageConfiguration().setFilters(Set.of(A, B)); - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); sut.initialize(new ExternalStorageProviderFactoryImpl(provider)); @@ -183,7 +183,7 @@ void shouldRespectEmptyAllowlistWhenInserting( sut.getStorageConfiguration().setFilterMode(FilterMode.ALLOW); sut.getStorageConfiguration().setFilters(Set.of()); - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); sut.initialize(new ExternalStorageProviderFactoryImpl(provider)); @@ -205,7 +205,7 @@ void shouldRespectBlocklistWhenInserting( sut.getStorageConfiguration().setFilterMode(FilterMode.BLOCK); sut.getStorageConfiguration().setFilters(Set.of(A, B)); - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); sut.initialize(new ExternalStorageProviderFactoryImpl(provider)); @@ -227,7 +227,7 @@ void shouldRespectEmptyBlocklistWhenInserting( sut.getStorageConfiguration().setFilterMode(FilterMode.BLOCK); sut.getStorageConfiguration().setFilters(Set.of()); - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); sut.initialize(new ExternalStorageProviderFactoryImpl(provider)); @@ -251,7 +251,7 @@ void shouldRespectAccessModeWhenInserting(final AccessMode accessMode, // Arrange sut.getStorageConfiguration().setAccessMode(accessMode); - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); sut.initialize(new ExternalStorageProviderFactoryImpl(provider)); @@ -274,7 +274,7 @@ void shouldRespectAccessModeWhenExtracting(final AccessMode accessMode, // Arrange sut.getStorageConfiguration().setAccessMode(accessMode); - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); storage.insert(A, 20, Action.EXECUTE, EmptyActor.INSTANCE); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); @@ -293,7 +293,7 @@ void shouldRespectAccessModeWhenExtracting(final AccessMode accessMode, @Test void shouldNotInsertWhenInactive(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); sut.initialize(new ExternalStorageProviderFactoryImpl(provider)); @@ -309,7 +309,7 @@ void shouldNotInsertWhenInactive(@InjectNetworkStorageComponent final StorageNet @Test void shouldNotExtractWhenInactive(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - final Storage storage = new InMemoryStorageImpl(); + final Storage storage = new StorageImpl(); storage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/grid/GridNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/grid/GridNetworkNodeTest.java index b8407205c..9223a2105 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/grid/GridNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/grid/GridNetworkNodeTest.java @@ -7,7 +7,7 @@ import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage.api.storage.tracked.TrackedStorageImpl; @@ -55,7 +55,7 @@ void setUp( storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 200, Action.EXECUTE, EmptyActor.INSTANCE); - otherStorage.addSource(new TrackedStorageImpl(new InMemoryStorageImpl(), () -> 3L)); + otherStorage.addSource(new TrackedStorageImpl(new StorageImpl(), () -> 3L)); } @Test diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/ClearSlotInterfaceNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/ClearSlotInterfaceNetworkNodeTest.java index e99fa2e1a..39c114372 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/ClearSlotInterfaceNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/ClearSlotInterfaceNetworkNodeTest.java @@ -2,7 +2,7 @@ import com.refinedmods.refinedstorage.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; @@ -37,7 +37,7 @@ void shouldClearSlotWhenNoLongerRequestingAnything( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); exportState.setCurrentlyExported(1, A, 7); exportState.setCurrentlyExported(2, B, 2); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/ExportToEmptySlotInterfaceNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/ExportToEmptySlotInterfaceNetworkNodeTest.java index e8e52f5e4..73200d251 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/ExportToEmptySlotInterfaceNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/ExportToEmptySlotInterfaceNetworkNodeTest.java @@ -4,7 +4,7 @@ import com.refinedmods.refinedstorage.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage.network.test.NetworkTest; @@ -58,7 +58,7 @@ void shouldExportToEmptySlotWhenRequestedIsNotEntirelyAvailable( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 10); @@ -82,7 +82,7 @@ void shouldExportToEmptySlotWhenRequestedIsLessThanTransferQuota( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 1); @@ -106,7 +106,7 @@ void shouldExportToEmptySlot( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); @@ -136,7 +136,7 @@ void shouldExportResourceFuzzilyToEmptySlot( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A_ALTERNATIVE, 10, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(A_ALTERNATIVE2, 10, Action.EXECUTE, EmptyActor.INSTANCE); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/InterfaceNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/InterfaceNetworkNodeTest.java index 421a724a6..365c23c95 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/InterfaceNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/InterfaceNetworkNodeTest.java @@ -5,7 +5,7 @@ import com.refinedmods.refinedstorage.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetworkEnergyComponent; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; @@ -50,7 +50,7 @@ void shouldExportAllWithDefaultTransferQuota( @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, Long.MAX_VALUE, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, Long.MAX_VALUE); @@ -72,7 +72,7 @@ void shouldNotExportAnythingWithoutBeingActive( @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 1); @@ -98,7 +98,7 @@ void shouldNotExportAnythingWithoutNetwork( @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 1); @@ -124,7 +124,7 @@ void shouldNotExportAnythingWithoutExportState( @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); sut.setExportState(null); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/KeepExportingInterfaceNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/KeepExportingInterfaceNetworkNodeTest.java index a8b780434..f9f4b7540 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/KeepExportingInterfaceNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/KeepExportingInterfaceNetworkNodeTest.java @@ -4,7 +4,7 @@ import com.refinedmods.refinedstorage.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; @@ -41,7 +41,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReached( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 7); @@ -95,7 +95,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReachedAndNetworkHasEnoughRes @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 7, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 10); @@ -145,7 +145,7 @@ void shouldKeepExportingResourceFuzzilyUntilWantedAmountIsReached( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A_ALTERNATIVE, 10, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(A_ALTERNATIVE2, 10, Action.EXECUTE, EmptyActor.INSTANCE); @@ -180,7 +180,7 @@ void shouldKeepExportingResourceFuzzilyUntilWantedAmountIsReachedEvenIfTheResour @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A_ALTERNATIVE, 1, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 1); @@ -204,7 +204,7 @@ void shouldReturnResourceToNetworkUntilWantedAmountIsReached( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); exportState.setRequestedResource(1, A, 7); exportState.setCurrentlyExported(1, A, 10); @@ -280,7 +280,7 @@ void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecified( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, B, 3); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/externalstorage/IoLoopInterfaceExternalStorageProviderImplTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/externalstorage/IoLoopInterfaceExternalStorageProviderImplTest.java index 08c862be6..2119d07e7 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/externalstorage/IoLoopInterfaceExternalStorageProviderImplTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/iface/externalstorage/IoLoopInterfaceExternalStorageProviderImplTest.java @@ -10,8 +10,8 @@ import com.refinedmods.refinedstorage.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetwork; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; @@ -76,12 +76,12 @@ void setUp(@InjectNetworkStorageComponent final StorageNetworkComponent networkS regularInterface.setExportState(regularInterfaceState); regularInterface.setTransferQuotaProvider(resource -> 100); - regularStorageInNetwork = new InMemoryStorageImpl(); + regularStorageInNetwork = new StorageImpl(); regularStorageInNetwork.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.addSource(regularStorageInNetwork); externalStorageWithNonInterfaceConnection.initialize(new ExternalStorageProviderFactoryImpl( - new StorageExternalStorageProvider(new InMemoryStorageImpl()) + new StorageExternalStorageProvider(new StorageImpl()) )); } diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/importer/FakeImporterSource.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/importer/FakeImporterSource.java index 5c89ea603..4a2f4419b 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/importer/FakeImporterSource.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/importer/FakeImporterSource.java @@ -5,7 +5,7 @@ import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import java.util.Arrays; import java.util.Collection; @@ -14,7 +14,7 @@ public class FakeImporterSource implements ImporterSource { private final List resources; - private final InMemoryStorageImpl storage = new InMemoryStorageImpl(); + private final StorageImpl storage = new StorageImpl(); public FakeImporterSource(final ResourceKey... resources) { this.resources = Arrays.stream(resources).toList(); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/importer/ImporterNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/importer/ImporterNetworkNodeTest.java index 9bb000da5..c37a31d61 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/importer/ImporterNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/importer/ImporterNetworkNodeTest.java @@ -9,7 +9,7 @@ import com.refinedmods.refinedstorage.api.resource.filter.FilterMode; import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetworkEnergyComponent; @@ -89,7 +89,7 @@ void shouldNotWorkOrExtractEnergyWithoutBeingActive( @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B) .add(A, 100) @@ -113,7 +113,7 @@ void shouldNotWorkOrExtractEnergyWithoutBeingActive( @Test void testTransfer(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B, A) .add(A, 100) @@ -139,7 +139,7 @@ void shouldUseFirstSuccessfulTransferStrategy( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource emptySource = new FakeImporterSource(); final FakeImporterSource outdatedSource = new FakeImporterSource(C) @@ -202,7 +202,7 @@ void testTransferDifferentResourceOverMultipleSlots( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B, A, B) .add(A, 11) @@ -228,7 +228,7 @@ void testTransferSameResourceOverMultipleSlots( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, A, A, B) .add(A, 20) @@ -255,7 +255,7 @@ void testTransferWhereResourceIsNotAccepted( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl() { + storage.addSource(new StorageImpl() { @Override public long insert(final ResourceKey resource, final long amount, final Action action, final Actor actor) { if (A.equals(resource)) { @@ -289,7 +289,7 @@ void testTransferWithoutAnyResourcesInSource( @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(); final ImporterTransferStrategy strategy = new ImporterTransferStrategyImpl(source, 10); @@ -309,7 +309,7 @@ void shouldRespectAllowlist(@InjectNetworkStorageComponent final StorageNetworkC sut.setFilterMode(FilterMode.ALLOW); sut.setFilters(Set.of(A)); - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(B, A) .add(B, 10) @@ -345,7 +345,7 @@ void shouldRespectAllowlistWithNormalizer( return resource; }); - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(B, A_ALTERNATIVE, A_ALTERNATIVE2) .add(B, 10) @@ -377,7 +377,7 @@ void shouldRespectAllowlistWithoutAlternative( sut.setFilterMode(FilterMode.ALLOW); sut.setFilters(Set.of(A)); - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(B) .add(B, 10); @@ -401,7 +401,7 @@ void shouldRespectEmptyAllowlist(@InjectNetworkStorageComponent final StorageNet sut.setFilterMode(FilterMode.ALLOW); sut.setFilters(Set.of()); - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(B, A) .add(B, 10) @@ -427,7 +427,7 @@ void shouldRespectBlocklist(@InjectNetworkStorageComponent final StorageNetworkC sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of(A)); - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B) .add(A, 10) @@ -457,7 +457,7 @@ void shouldRespectBlocklistWithoutAlternative( sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of(A)); - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(A) .add(A, 10); @@ -481,7 +481,7 @@ void shouldRespectEmptyBlocklist(@InjectNetworkStorageComponent final StorageNet sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of()); - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B) .add(A, 10) diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/relay/RelayNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/relay/RelayNetworkNodeTest.java index 3c766ecf3..7a396353a 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/relay/RelayNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/relay/RelayNetworkNodeTest.java @@ -10,7 +10,7 @@ import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.storage.AccessMode; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetwork; import com.refinedmods.refinedstorage.network.test.InjectNetworkEnergyComponent; @@ -259,12 +259,12 @@ void shouldResetComponentsIfNetworkIsChanged( RelayComponentType.STORAGE )); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.extract(B, 3, Action.EXECUTE, EmptyActor.INSTANCE); - inputAlternativeStorage.addSource(new InMemoryStorageImpl()); + inputAlternativeStorage.addSource(new StorageImpl()); inputAlternativeStorage.insert(A, 33, Action.EXECUTE, EmptyActor.INSTANCE); addSecurityPolicy(inputSecurity, FakePermissions.OTHER); @@ -400,7 +400,7 @@ static void addSecurityPolicy(final SecurityNetworkComponent security, final Fak } static void addStorageSource(final StorageNetworkComponent storage) { - storage.addSource(new InMemoryStorageImpl()); + storage.addSource(new StorageImpl()); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); } } diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/relay/RelayStorageNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/relay/RelayStorageNetworkNodeTest.java index 12464d396..f7f095ff8 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/relay/RelayStorageNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/relay/RelayStorageNetworkNodeTest.java @@ -9,8 +9,8 @@ import com.refinedmods.refinedstorage.api.resource.filter.FilterMode; import com.refinedmods.refinedstorage.api.storage.AccessMode; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.composite.PriorityStorage; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; @@ -62,7 +62,7 @@ void shouldPassStorageComponent( addSecurityPolicy(inputSecurity, FakePermissions.OTHER); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); // Act @@ -100,7 +100,7 @@ void shouldRemoveStorageWhenNetworkIsRemoved( input.setActive(true); input.setOutputNode(output); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); inputStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); @@ -136,7 +136,7 @@ void shouldNotNotifyOldOutputNetworkWhenOutputNetworkHasChanged( input.setActive(true); input.setOutputNode(output); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); @@ -165,7 +165,7 @@ void shouldInsertResourcesIntoInputStorageFromOutputStorage( input.setOutputNode(output); input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); // Act @@ -195,7 +195,7 @@ void shouldExtractResourcesFromInputStorageIntoOutputStorage( input.setOutputNode(output); input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); // Act @@ -224,7 +224,7 @@ void shouldNotInsertInExtractOnlyMode( input.setAccessMode(AccessMode.EXTRACT); input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); // Act @@ -255,7 +255,7 @@ void shouldNotExtractInInsertOnlyMode( input.setAccessMode(AccessMode.INSERT); input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); // Act @@ -287,14 +287,14 @@ void shouldRespectPriorityOfOutput( input.setOutputNode(output); input.setPriority(3); input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage fallbackStorage1 = PriorityStorage.of(new InMemoryStorageImpl(), 2); + final Storage fallbackStorage1 = PriorityStorage.of(new StorageImpl(), 2); fallbackStorage1.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); outputStorage.addSource(fallbackStorage1); - final Storage fallbackStorage2 = PriorityStorage.of(new InMemoryStorageImpl(), 1); + final Storage fallbackStorage2 = PriorityStorage.of(new StorageImpl(), 1); fallbackStorage2.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); outputStorage.addSource(fallbackStorage2); @@ -364,7 +364,7 @@ void shouldRespectBlocklistFilter( input.setOutputNode(output); input.setFilters(Set.of(A, B)); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); @@ -414,7 +414,7 @@ void shouldRespectAllowlistFilter( input.setFilters(Set.of(A, B)); input.setFilterMode(FilterMode.ALLOW); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); @@ -471,7 +471,7 @@ void shouldRespectFilterNormalizer( return resource; }); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(A_ALTERNATIVE, 3, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); @@ -530,7 +530,7 @@ void shouldUpdateOutputStorageWhenFiltersAreChanged( input.setFilters(Set.of(A)); input.setFilterMode(FilterMode.BLOCK); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); @@ -565,7 +565,7 @@ void shouldUpdateOutputStorageWhenFilterModeIsChanged( input.setFilters(Set.of(A)); input.setFilterMode(FilterMode.BLOCK); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); inputStorage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); @@ -609,7 +609,7 @@ void shouldDetectStorageCycles( cycleOutputAlternative.setNetwork(inputAlternativeNetwork); inputAlternativeNetwork.addContainer(() -> cycleOutputAlternative); - inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.addSource(new StorageImpl()); // Assert final long inserted1 = inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/storage/StorageNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/storage/StorageNetworkNodeTest.java index b7045a0e6..7e21a3da7 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/storage/StorageNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/storage/StorageNetworkNodeTest.java @@ -8,9 +8,9 @@ import com.refinedmods.refinedstorage.api.resource.filter.FilterMode; import com.refinedmods.refinedstorage.api.storage.AccessMode; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.StateTrackedStorage; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.StorageState; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.api.storage.tracked.TrackedStorageImpl; @@ -153,7 +153,7 @@ void testState(final boolean active) { final Storage fullStorage = new LimitedStorageImpl(100); fullStorage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage unlimitedStorage = new InMemoryStorageImpl(); + final Storage unlimitedStorage = new StorageImpl(); provider.set(2, unlimitedStorage); provider.set(3, normalStorage); diff --git a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/storagetransfer/StorageTransferNetworkNodeTest.java b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/storagetransfer/StorageTransferNetworkNodeTest.java index 9ee64fdf1..685591a0d 100644 --- a/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/storagetransfer/StorageTransferNetworkNodeTest.java +++ b/refinedstorage-network/src/test/java/com/refinedmods/refinedstorage/api/network/impl/node/storagetransfer/StorageTransferNetworkNodeTest.java @@ -9,8 +9,8 @@ import com.refinedmods.refinedstorage.api.resource.list.ResourceListImpl; import com.refinedmods.refinedstorage.api.storage.Actor; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.network.test.AddNetworkNode; import com.refinedmods.refinedstorage.network.test.InjectNetworkStorageComponent; @@ -54,9 +54,9 @@ void setUp() { @Test void shouldNotTransferWithoutNetwork(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); - final Storage source = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source = new StorageImpl(ResourceListImpl.orderPreserving()); source.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(0, source); @@ -75,9 +75,9 @@ void shouldNotTransferWithoutNetwork(@InjectNetworkStorageComponent final Storag @Test void shouldNotTransferWhenInactive(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); - final Storage source = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source = new StorageImpl(ResourceListImpl.orderPreserving()); source.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(0, source); @@ -100,10 +100,10 @@ void shouldNotTransferWithoutTransferQuotaProvider( @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); networkStorage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage source = new InMemoryStorageImpl(); + final Storage source = new StorageImpl(); source.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(0, source); @@ -125,7 +125,7 @@ void shouldNotTransferWithoutTransferQuotaProvider( @Test void shouldInsert(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); final Storage source0 = new LimitedStorageImpl(1) { @Override @@ -139,14 +139,14 @@ public long extract(final ResourceKey resource, source0.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(0, source0); - final Storage source1 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source1 = new StorageImpl(ResourceListImpl.orderPreserving()); source1.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(C, 35, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(1, source1); - final Storage source2 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source2 = new StorageImpl(ResourceListImpl.orderPreserving()); source2.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(2, source2); @@ -178,16 +178,16 @@ public long extract(final ResourceKey resource, @Test void shouldInsertAllowlist(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); - final Storage source1 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source1 = new StorageImpl(ResourceListImpl.orderPreserving()); source1.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(C, 35, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set((sut.getSize() / 2) - 2, source1); - final Storage source2 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source2 = new StorageImpl(ResourceListImpl.orderPreserving()); source2.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set((sut.getSize() / 2) - 1, source2); @@ -217,16 +217,16 @@ void shouldInsertAllowlist(@InjectNetworkStorageComponent final StorageNetworkCo @Test void shouldInsertBlocklist(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); - final Storage source1 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source1 = new StorageImpl(ResourceListImpl.orderPreserving()); source1.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(C, 35, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(0, source1); - final Storage source2 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source2 = new StorageImpl(ResourceListImpl.orderPreserving()); source2.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(1, source2); @@ -257,7 +257,7 @@ void shouldInsertBlocklist(@InjectNetworkStorageComponent final StorageNetworkCo @Test void shouldNotifyListenerWhenReadyInsertingBecauseStorageWasAlreadyEmpty() { // Arrange - final Storage source = new InMemoryStorageImpl(); + final Storage source = new StorageImpl(); provider.set(0, source); sut.setProvider(provider); @@ -275,9 +275,9 @@ void shouldNotifyListenerWhenReadyInsertingAllResources( @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); - final Storage source = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source = new StorageImpl(ResourceListImpl.orderPreserving()); source.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); source.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); source.insert(C, 5, Action.EXECUTE, EmptyActor.INSTANCE); @@ -297,12 +297,12 @@ void shouldNotifyListenerWhenReadyInsertingAllResources( @Test void shouldNotifyListenerWhenReadyInsertingAllResourcesAndUsingFilterButInsertedNothing() { // Arrange - final Storage source1 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source1 = new StorageImpl(ResourceListImpl.orderPreserving()); source1.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(C, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(0, source1); - final Storage source2 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source2 = new StorageImpl(ResourceListImpl.orderPreserving()); source2.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(1, source2); @@ -330,15 +330,15 @@ void shouldNotifyListenerWhenReadyInsertingAllResourcesAndUsingFilterButStillIns @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); - final Storage source1 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source1 = new StorageImpl(ResourceListImpl.orderPreserving()); source1.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(C, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(0, source1); - final Storage source2 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source2 = new StorageImpl(ResourceListImpl.orderPreserving()); source2.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(1, source2); @@ -368,14 +368,14 @@ void shouldNotNotifyListenerWhenReadyInsertingAllResourcesAndNetworkIsFull( // Arrange networkStorage.addSource(new LimitedStorageImpl(15)); - final Storage source1 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source1 = new StorageImpl(ResourceListImpl.orderPreserving()); source1.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(C, 5, Action.EXECUTE, EmptyActor.INSTANCE); source1.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(0, source1); - final Storage source2 = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source2 = new StorageImpl(ResourceListImpl.orderPreserving()); source2.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(1, source2); @@ -404,7 +404,7 @@ void shouldNotNotifyListenerWhenReadyInsertingAllResourcesAndNetworkIsFull( @Test void shouldExtract(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); networkStorage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(C, 35, Action.EXECUTE, EmptyActor.INSTANCE); @@ -413,7 +413,7 @@ void shouldExtract(@InjectNetworkStorageComponent final StorageNetworkComponent final Storage source1 = new LimitedStorageImpl(0); provider.set(0, source1); - final Storage source2 = new InMemoryStorageImpl(); + final Storage source2 = new StorageImpl(); provider.set(1, source2); sut.setProvider(provider); @@ -440,16 +440,16 @@ void shouldExtract(@InjectNetworkStorageComponent final StorageNetworkComponent @Test void shouldExtractAllowlist(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); networkStorage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(C, 35, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage source1 = new InMemoryStorageImpl(); + final Storage source1 = new StorageImpl(); provider.set(0, source1); - final Storage source2 = new InMemoryStorageImpl(); + final Storage source2 = new StorageImpl(); provider.set(1, source2); sut.setProvider(provider); @@ -477,16 +477,16 @@ void shouldExtractAllowlist(@InjectNetworkStorageComponent final StorageNetworkC @Test void shouldExtractBlocklist(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); networkStorage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(C, 35, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage source1 = new InMemoryStorageImpl(); + final Storage source1 = new StorageImpl(); provider.set(0, source1); - final Storage source2 = new InMemoryStorageImpl(); + final Storage source2 = new StorageImpl(); provider.set(1, source2); sut.setProvider(provider); @@ -515,7 +515,7 @@ void shouldExtractBlocklist(@InjectNetworkStorageComponent final StorageNetworkC @Test void shouldNotifyListenerWhenReadyExtractingBecauseStorageWasAlreadyEmpty() { // Arrange - final Storage source = new InMemoryStorageImpl(); + final Storage source = new StorageImpl(); provider.set(0, source); sut.setProvider(provider); @@ -534,12 +534,12 @@ void shouldNotifyListenerWhenReadyExtractingAllResources( @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); networkStorage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(C, 5, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage source = new InMemoryStorageImpl(); + final Storage source = new StorageImpl(); provider.set(0, source); sut.setProvider(provider); @@ -564,12 +564,12 @@ void shouldNotifyListenerWhenReadyExtractingAllResourcesAndUsingFilterButInserte @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); networkStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(C, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(D, 5, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage source = new InMemoryStorageImpl(); + final Storage source = new StorageImpl(); provider.set(0, source); sut.setProvider(provider); @@ -596,12 +596,12 @@ void shouldNotifyListenerWhenReadyExtractingAllResourcesAndUsingFilterButStillEx @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl(ResourceListImpl.orderPreserving())); + networkStorage.addSource(new StorageImpl(ResourceListImpl.orderPreserving())); networkStorage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(C, 5, Action.EXECUTE, EmptyActor.INSTANCE); - final Storage source = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source = new StorageImpl(ResourceListImpl.orderPreserving()); provider.set(0, source); sut.setProvider(provider); @@ -629,7 +629,7 @@ void shouldNotifyListenerWhenExtractingAllResourcesAndReachingCapacity( @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); networkStorage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); networkStorage.insert(C, 5, Action.EXECUTE, EmptyActor.INSTANCE); @@ -660,9 +660,9 @@ void shouldRespectNormalizer( @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); - final Storage source = new InMemoryStorageImpl(ResourceListImpl.orderPreserving()); + final Storage source = new StorageImpl(ResourceListImpl.orderPreserving()); source.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); source.insert(A_ALTERNATIVE, 5, Action.EXECUTE, EmptyActor.INSTANCE); source.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); @@ -695,9 +695,9 @@ void shouldNotTransferAtIndexHigherThanHalf( @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange - networkStorage.addSource(new InMemoryStorageImpl()); + networkStorage.addSource(new StorageImpl()); - final Storage source = new InMemoryStorageImpl(); + final Storage source = new StorageImpl(); source.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); provider.set(sut.getSize() / 2, source); diff --git a/refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/InMemoryStorageImpl.java b/refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/StorageImpl.java similarity index 88% rename from refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/InMemoryStorageImpl.java rename to refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/StorageImpl.java index e21e42836..d82909000 100644 --- a/refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/InMemoryStorageImpl.java +++ b/refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/StorageImpl.java @@ -11,18 +11,18 @@ import org.apiguardian.api.API; /** - * An implementation of a {@link Storage} which has an in-memory resource list as a backing list. + * An implementation of a {@link Storage} which has a resource list as a backing list. */ @API(status = API.Status.STABLE, since = "2.0.0-milestone.1.0") -public class InMemoryStorageImpl implements Storage { +public class StorageImpl implements Storage { private final ResourceList list; private long stored; - public InMemoryStorageImpl(final ResourceList list) { + public StorageImpl(final ResourceList list) { this.list = list; } - public InMemoryStorageImpl() { + public StorageImpl() { this(ResourceListImpl.create()); } diff --git a/refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/limited/LimitedStorageImpl.java b/refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/limited/LimitedStorageImpl.java index c14b1a5cc..d03f7e58f 100644 --- a/refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/limited/LimitedStorageImpl.java +++ b/refinedstorage-storage-api/src/main/java/com/refinedmods/refinedstorage/api/storage/limited/LimitedStorageImpl.java @@ -5,9 +5,9 @@ import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.AbstractProxyStorage; import com.refinedmods.refinedstorage.api.storage.Actor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.InsertableStorage; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import org.apiguardian.api.API; @@ -30,12 +30,12 @@ public LimitedStorageImpl(final Storage delegate, final long capacity) { } /** - * Constructs the limited storage with a {@link InMemoryStorageImpl} storage. + * Constructs the limited storage with a {@link StorageImpl} storage. * * @param capacity the capacity, must be 0 or larger than 0 */ public LimitedStorageImpl(final long capacity) { - this(new InMemoryStorageImpl(), capacity); + this(new StorageImpl(), capacity); } @Override diff --git a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/LimitedStorageImplTest.java b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/LimitedStorageImplTest.java index 810f793a3..7aa757696 100644 --- a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/LimitedStorageImplTest.java +++ b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/LimitedStorageImplTest.java @@ -20,7 +20,7 @@ class LimitedStorageImplTest { @BeforeEach void setUp() { - backed = new ActorCapturingStorage(new InMemoryStorageImpl()); + backed = new ActorCapturingStorage(new StorageImpl()); sut = new LimitedStorageImpl(backed, 100); } diff --git a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/ProxyStorageTest.java b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/ProxyStorageTest.java index cfb314432..7fe11e2c1 100644 --- a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/ProxyStorageTest.java +++ b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/ProxyStorageTest.java @@ -18,7 +18,7 @@ class ProxyStorageTest { @BeforeEach void setUp() { - backed = new ActorCapturingStorage(new InMemoryStorageImpl()); + backed = new ActorCapturingStorage(new StorageImpl()); sut = new AbstractProxyStorage(backed) { }; } diff --git a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/StateTrackedStorageTest.java b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/StateTrackedStorageTest.java index 243556d66..bdfe2e6c0 100644 --- a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/StateTrackedStorageTest.java +++ b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/StateTrackedStorageTest.java @@ -51,7 +51,7 @@ private static Stream states() { void shouldSetInitialState() { // Arrange final StateTrackedStorage.Listener listener = mock(StateTrackedStorage.Listener.class); - final Storage underlyingStorage = new InMemoryStorageImpl(); + final Storage underlyingStorage = new StorageImpl(); underlyingStorage.insert(TestResource.A, 75, Action.EXECUTE, EmptyActor.INSTANCE); final StateTrackedStorage sut = new StateTrackedStorage(underlyingStorage, listener); diff --git a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/InMemoryStorageImplTest.java b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/StorageImplTest.java similarity index 98% rename from refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/InMemoryStorageImplTest.java rename to refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/StorageImplTest.java index 0f7447f95..1221c742e 100644 --- a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/InMemoryStorageImplTest.java +++ b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/StorageImplTest.java @@ -11,8 +11,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -class InMemoryStorageImplTest { - private final Storage sut = new InMemoryStorageImpl(); +class StorageImplTest { + private final Storage sut = new StorageImpl(); @ParameterizedTest @EnumSource(Action.class) diff --git a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/TransferHelperTest.java b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/TransferHelperTest.java index d25d33057..395abc09f 100644 --- a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/TransferHelperTest.java +++ b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/TransferHelperTest.java @@ -199,7 +199,7 @@ public long insert(final ResourceKey resource, final long amount, final Action a @Test void shouldRefundLeftoversToFallbackWhenEventualExecutedInsertToDestinationFailedEvenIfFallbackDoesNotAcceptAll() { // Arrange - final InMemoryStorageImpl underlyingSource = new InMemoryStorageImpl(); + final StorageImpl underlyingSource = new StorageImpl(); final Storage source = new LimitedStorageImpl(underlyingSource, 100) { @Override public long insert(final ResourceKey resource, final long amount, final Action action, final Actor actor) { diff --git a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/composite/CompositeStorageImplTest.java b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/composite/CompositeStorageImplTest.java index f956e531d..985ca196a 100644 --- a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/composite/CompositeStorageImplTest.java +++ b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/composite/CompositeStorageImplTest.java @@ -5,8 +5,8 @@ import com.refinedmods.refinedstorage.api.resource.list.ResourceListImpl; import com.refinedmods.refinedstorage.api.storage.EmptyActor; import com.refinedmods.refinedstorage.api.storage.FakeActors; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage.api.storage.tracked.TrackedStorage; @@ -210,8 +210,8 @@ void shouldFindMostRecentChange() { // Arrange final AtomicLong clock = new AtomicLong(0L); - final TrackedStorage a = new TrackedStorageImpl(new InMemoryStorageImpl(), clock::get); - final TrackedStorage b = new TrackedStorageImpl(new InMemoryStorageImpl(), clock::get); + final TrackedStorage a = new TrackedStorageImpl(new StorageImpl(), clock::get); + final TrackedStorage b = new TrackedStorageImpl(new StorageImpl(), clock::get); // Test if it uses the latest across 2 different storages a.insert(A, 1, Action.EXECUTE, FakeActors.FakeActor1.INSTANCE); diff --git a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/composite/SubCompositeCompositeStorageImplTest.java b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/composite/SubCompositeCompositeStorageImplTest.java index 9e3cd603d..fc051b6b1 100644 --- a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/composite/SubCompositeCompositeStorageImplTest.java +++ b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/composite/SubCompositeCompositeStorageImplTest.java @@ -4,8 +4,8 @@ import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.resource.list.ResourceListImpl; import com.refinedmods.refinedstorage.api.storage.EmptyActor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage.api.storage.Storage; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -26,7 +26,7 @@ void setUp() { void testAddingSubCompositeShouldAddAllResourcesToParent() { // Arrange final CompositeStorage subComposite = new CompositeStorageImpl(ResourceListImpl.create()); - subComposite.addSource(new InMemoryStorageImpl()); + subComposite.addSource(new StorageImpl()); subComposite.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); // Act @@ -42,12 +42,12 @@ void testAddingSubCompositeShouldAddAllResourcesToParent() { void testRemovingSubCompositeShouldRemoveAllResourcesFromParent() { // Arrange final CompositeStorage subComposite = new CompositeStorageImpl(ResourceListImpl.create()); - subComposite.addSource(new InMemoryStorageImpl()); + subComposite.addSource(new StorageImpl()); subComposite.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); sut.addSource(subComposite); - final Storage subCompositeStorage = new InMemoryStorageImpl(); + final Storage subCompositeStorage = new StorageImpl(); subCompositeStorage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); // Act @@ -63,13 +63,13 @@ void testRemovingSubCompositeShouldRemoveAllResourcesFromParent() { void testAddingSourceToSubCompositeShouldNotifyParent() { // Arrange final CompositeStorage subComposite = new CompositeStorageImpl(ResourceListImpl.create()); - final Storage subStorage = new InMemoryStorageImpl(); + final Storage subStorage = new StorageImpl(); subStorage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); sut.addSource(subComposite); sut.addSource(subStorage); - final Storage subCompositeStorage = new InMemoryStorageImpl(); + final Storage subCompositeStorage = new StorageImpl(); subCompositeStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); // Act @@ -90,13 +90,13 @@ void testAddingSourceToSubCompositeShouldNotifyParent() { void testRemovingSourceFromSubCompositeShouldNotifyParent() { // Arrange final CompositeStorage subComposite = new CompositeStorageImpl(ResourceListImpl.create()); - final Storage subStorage = new InMemoryStorageImpl(); + final Storage subStorage = new StorageImpl(); subStorage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); sut.addSource(subComposite); sut.addSource(subStorage); - final Storage subCompositeStorage = new InMemoryStorageImpl(); + final Storage subCompositeStorage = new StorageImpl(); subCompositeStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); subComposite.addSource(subCompositeStorage); diff --git a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/external/TransformingStorage.java b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/external/TransformingStorage.java index 54301376d..2b57dac0f 100644 --- a/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/external/TransformingStorage.java +++ b/refinedstorage-storage-api/src/test/java/com/refinedmods/refinedstorage/api/storage/external/TransformingStorage.java @@ -4,14 +4,14 @@ import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.api.storage.AbstractProxyStorage; import com.refinedmods.refinedstorage.api.storage.Actor; -import com.refinedmods.refinedstorage.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage.api.storage.StorageImpl; import static com.refinedmods.refinedstorage.api.storage.external.ExternalTestResource.A_ALTERNATIVE; import static com.refinedmods.refinedstorage.api.storage.external.ExternalTestResource.A_TRANSFORMED; class TransformingStorage extends AbstractProxyStorage { TransformingStorage() { - super(new InMemoryStorageImpl()); + super(new StorageImpl()); } private ResourceKey transform(final ResourceKey resource) {