From 0e870a06e0af67753fc051e81d842ce9c1310222 Mon Sep 17 00:00:00 2001 From: modmuss Date: Sun, 8 Oct 2023 13:01:41 +0100 Subject: [PATCH] [1.20.3] Make Transfer API stable & remove previously deprecated API. (#3364) * Remove deprecated transfer APIs. * Make Transfer API stable. --- .../fluid/FluidVariantRenderHandler.java | 5 -- .../client/fluid/FluidVariantRendering.java | 5 -- .../v1/context/ContainerItemContext.java | 33 ---------- .../v1/fluid/CauldronFluidContent.java | 5 -- .../api/transfer/v1/fluid/FluidConstants.java | 6 -- .../api/transfer/v1/fluid/FluidStorage.java | 11 +--- .../transfer/v1/fluid/FluidStorageUtil.java | 6 -- .../api/transfer/v1/fluid/FluidVariant.java | 4 -- .../fluid/FluidVariantAttributeHandler.java | 5 -- .../v1/fluid/FluidVariantAttributes.java | 5 -- .../v1/fluid/base/EmptyItemFluidStorage.java | 6 -- .../v1/fluid/base/FullItemFluidStorage.java | 6 -- .../v1/fluid/base/SingleFluidStorage.java | 6 -- .../transfer/v1/item/InventoryStorage.java | 4 -- .../api/transfer/v1/item/ItemStorage.java | 5 -- .../api/transfer/v1/item/ItemVariant.java | 4 -- .../v1/item/PlayerInventoryStorage.java | 4 -- .../v1/item/base/SingleItemStorage.java | 6 -- .../v1/item/base/SingleStackStorage.java | 6 -- .../transfer/v1/storage/SlottedStorage.java | 7 +- .../api/transfer/v1/storage/Storage.java | 47 -------------- .../v1/storage/StoragePreconditions.java | 6 -- .../api/transfer/v1/storage/StorageUtil.java | 5 -- .../api/transfer/v1/storage/StorageView.java | 6 -- .../transfer/v1/storage/TransferVariant.java | 5 -- .../v1/storage/base/BlankVariantView.java | 6 -- .../storage/base/CombinedSlottedStorage.java | 6 -- .../v1/storage/base/CombinedStorage.java | 6 -- .../storage/base/ExtractionOnlyStorage.java | 6 -- .../v1/storage/base/FilteringStorage.java | 18 ------ .../v1/storage/base/InsertionOnlyStorage.java | 6 -- .../v1/storage/base/ResourceAmount.java | 6 -- .../v1/storage/base/SingleSlotStorage.java | 6 -- .../base/SingleVariantItemStorage.java | 6 -- .../v1/storage/base/SingleVariantStorage.java | 6 -- .../transfer/v1/transaction/Transaction.java | 4 -- .../v1/transaction/TransactionContext.java | 4 -- .../transaction/base/SnapshotParticipant.java | 6 -- .../InitialContentsContainerItemContext.java | 64 ------------------- .../src/main/resources/fabric.mod.json | 2 +- 40 files changed, 5 insertions(+), 355 deletions(-) delete mode 100644 fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/impl/transfer/context/InitialContentsContainerItemContext.java diff --git a/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRenderHandler.java b/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRenderHandler.java index e23d708cae..7649c3122d 100644 --- a/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRenderHandler.java +++ b/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRenderHandler.java @@ -18,7 +18,6 @@ import java.util.List; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import net.minecraft.client.item.TooltipContext; @@ -34,11 +33,7 @@ /** * Defines how {@linkplain FluidVariant fluid variants} of a given Fluid should be displayed to clients. * Register with {@link FluidVariantRendering#register}. - * - *

Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface FluidVariantRenderHandler { /** * Append additional tooltips to the passed list if additional information is contained in the fluid variant. diff --git a/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRendering.java b/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRendering.java index 9c0bc4e29b..edf9a907e2 100644 --- a/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRendering.java +++ b/fabric-transfer-api-v1/src/client/java/net/fabricmc/fabric/api/transfer/v1/client/fluid/FluidVariantRendering.java @@ -20,7 +20,6 @@ import java.util.List; import java.util.Objects; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import net.minecraft.client.MinecraftClient; @@ -39,11 +38,7 @@ /** * Client-side display of fluid variants. - * - *

Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class FluidVariantRendering { private static final ApiProviderMap HANDLERS = ApiProviderMap.create(); private static final FluidVariantRenderHandler DEFAULT_HANDLER = new FluidVariantRenderHandler() { }; diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/context/ContainerItemContext.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/context/ContainerItemContext.java index af7da921ec..b0e1a8de62 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/context/ContainerItemContext.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/context/ContainerItemContext.java @@ -18,7 +18,6 @@ import java.util.List; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnmodifiableView; @@ -39,7 +38,6 @@ import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext; import net.fabricmc.fabric.impl.transfer.context.ConstantContainerItemContext; import net.fabricmc.fabric.impl.transfer.context.CreativeInteractionContainerItemContext; -import net.fabricmc.fabric.impl.transfer.context.InitialContentsContainerItemContext; import net.fabricmc.fabric.impl.transfer.context.PlayerContainerItemContext; import net.fabricmc.fabric.impl.transfer.context.SingleSlotContainerItemContext; @@ -85,11 +83,7 @@ *

  • Exchange some of the current variant with another variant through {@link #exchange}. * In the water bucket example, this function can be used to combine steps 1, 2 and 3.
  • * - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface ContainerItemContext { /** * Returns a context for interaction with a player's hand. This is recommended for item use interactions. @@ -168,33 +162,6 @@ static ContainerItemContext withConstant(ItemVariant constantVariant, long const return new ConstantContainerItemContext(constantVariant, constantAmount); } - /** - * Return a context that can accept anything, and will accept (and destroy) any overflow items, with some initial content. - * This can typically be used to check if a stack provides an API, or simulate operations on the returned API, - * for example to simulate how much fluid could be extracted from the stack. - * - *

    Note that the stack can never be mutated by this function: its contents are copied directly. - * - * @deprecated Use {@link #withConstant(ItemStack)} instead. - */ - @Deprecated(forRemoval = true) - static ContainerItemContext withInitial(ItemStack initialContent) { - return withInitial(ItemVariant.of(initialContent), initialContent.getCount()); - } - - /** - * Return a context that can accept anything, and will accept (and destroy) any overflow items, with some initial variant and amount. - * This can typically be used to check if a variant provides an API, or simulate operations on the returned API, - * for example to simulate how much fluid could be extracted from the variant and amount. - * - * @deprecated Use {@link #withConstant(ItemVariant, long)} instead. - */ - @Deprecated(forRemoval = true) - static ContainerItemContext withInitial(ItemVariant initialVariant, long initialAmount) { - StoragePreconditions.notNegative(initialAmount); - return new InitialContentsContainerItemContext(initialVariant, initialAmount); - } - /** * Try to find an API instance for the passed lookup and return it, or {@code null} if there is none. * The API is queried for the current variant, if it's not blank. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/CauldronFluidContent.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/CauldronFluidContent.java index 04de88e569..157eee86ef 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/CauldronFluidContent.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/CauldronFluidContent.java @@ -18,7 +18,6 @@ import java.util.Collection; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import net.minecraft.block.Block; @@ -47,11 +46,7 @@ * *

  • {@code amountPerLevel} defines how much fluid (in droplets) there is in one level of the cauldron.
  • * - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class CauldronFluidContent { /** * Block of the cauldron. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidConstants.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidConstants.java index a845098cff..319560aeca 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidConstants.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidConstants.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.api.transfer.v1.fluid; -import org.jetbrains.annotations.ApiStatus; - import net.minecraft.fluid.FlowableFluid; /** @@ -25,11 +23,7 @@ * *

    If you don't know how many droplets you should pick for a specific resource that has a block form, * the convention is to use 81000 droplets for what is worth one block of that resource. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class FluidConstants { /////////////////////////// // ==== FLUID UNITS ==== // diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorage.java index 084ef40100..1cc89bdaa1 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorage.java @@ -16,15 +16,14 @@ package net.fabricmc.fabric.api.transfer.v1.fluid; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; import net.minecraft.item.BucketItem; import net.minecraft.item.Item; -import net.minecraft.item.Items; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.potion.PotionUtil; import net.minecraft.potion.Potions; import net.minecraft.util.Identifier; @@ -33,24 +32,20 @@ import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup; import net.fabricmc.fabric.api.lookup.v1.item.ItemApiLookup; -import net.fabricmc.fabric.api.transfer.v1.storage.base.SidedStorageBlockEntity; import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext; import net.fabricmc.fabric.api.transfer.v1.fluid.base.EmptyItemFluidStorage; import net.fabricmc.fabric.api.transfer.v1.fluid.base.FullItemFluidStorage; import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; import net.fabricmc.fabric.api.transfer.v1.storage.Storage; -import net.fabricmc.fabric.impl.transfer.fluid.EmptyBucketStorage; +import net.fabricmc.fabric.api.transfer.v1.storage.base.SidedStorageBlockEntity; import net.fabricmc.fabric.impl.transfer.fluid.CombinedProvidersImpl; +import net.fabricmc.fabric.impl.transfer.fluid.EmptyBucketStorage; import net.fabricmc.fabric.impl.transfer.fluid.WaterPotionStorage; import net.fabricmc.fabric.mixin.transfer.BucketItemAccessor; /** * Access to {@link Storage Storage<FluidVariant>} instances. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class FluidStorage { /** * Sided block access to fluid variant storages. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java index 393fd56c08..f4b6ac6023 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java @@ -18,8 +18,6 @@ import java.util.Objects; -import org.jetbrains.annotations.ApiStatus; - import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluids; import net.minecraft.item.Item; @@ -39,11 +37,7 @@ /** * Helper functions to work with fluid storages. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class FluidStorageUtil { /** * Try to make the item in a player hand "interact" with a fluid storage. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariant.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariant.java index a43e4d79e0..c13316aea5 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariant.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariant.java @@ -36,11 +36,7 @@ * *

    Fluid variants must always be compared with {@code equals}, never by reference! * {@code hashCode} is guaranteed to be correct and constant time independently of the size of the NBT. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental @ApiStatus.NonExtendable public interface FluidVariant extends TransferVariant { /** diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariantAttributeHandler.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariantAttributeHandler.java index 5d7018d1a5..66f12cb8a6 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariantAttributeHandler.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariantAttributeHandler.java @@ -18,7 +18,6 @@ import java.util.Optional; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import net.minecraft.block.Block; @@ -35,11 +34,7 @@ /** * Defines the common attributes of {@linkplain FluidVariant fluid variants} of a given Fluid. * Register with {@link FluidVariantAttributes#register}. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface FluidVariantAttributeHandler { /** * Return the name that should be used for the passed fluid variant. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariantAttributes.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariantAttributes.java index 49d49de23a..186aa7a64e 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariantAttributes.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariantAttributes.java @@ -18,7 +18,6 @@ import java.util.Optional; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import net.minecraft.block.Blocks; @@ -37,11 +36,7 @@ /** * Common fluid variant attributes, accessible both client-side and server-side. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class FluidVariantAttributes { private static final ApiProviderMap HANDLERS = ApiProviderMap.create(); private static final FluidVariantAttributeHandler DEFAULT_HANDLER = new FluidVariantAttributeHandler() { }; diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/EmptyItemFluidStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/EmptyItemFluidStorage.java index 0ec6de704c..cb50e45a10 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/EmptyItemFluidStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/EmptyItemFluidStorage.java @@ -20,8 +20,6 @@ import java.util.List; import java.util.function.Function; -import org.jetbrains.annotations.ApiStatus; - import net.minecraft.fluid.Fluid; import net.minecraft.item.Item; @@ -55,11 +53,7 @@ * (This is just for illustration purposes! In practice, Fabric API already registers storages for most buckets, * and it is inefficient to have one storage registered per fluid * so Fabric API has a storage that accepts any fluid with a corresponding full bucket). - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class EmptyItemFluidStorage implements InsertionOnlyStorage { private final ContainerItemContext context; private final Item emptyItem; diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/FullItemFluidStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/FullItemFluidStorage.java index 25cceffc95..c97cecdc05 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/FullItemFluidStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/FullItemFluidStorage.java @@ -18,8 +18,6 @@ import java.util.function.Function; -import org.jetbrains.annotations.ApiStatus; - import net.minecraft.item.Item; import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext; @@ -37,11 +35,7 @@ * however there is a second constructor that allows customizing the mapping. * *

    This is used similarly to {@link EmptyItemFluidStorage}. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class FullItemFluidStorage implements ExtractionOnlyStorage, SingleSlotStorage { private final ContainerItemContext context; private final Item fullItem; diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/SingleFluidStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/SingleFluidStorage.java index ddbd44cd45..1bd9f8f2bf 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/SingleFluidStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/base/SingleFluidStorage.java @@ -18,8 +18,6 @@ import java.util.Objects; -import org.jetbrains.annotations.ApiStatus; - import net.minecraft.nbt.NbtCompound; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; @@ -34,11 +32,7 @@ * *

    This is a convenient specialization of {@link SingleVariantStorage} for fluids that additionally offers methods * to read the contents of the storage from NBT. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public abstract class SingleFluidStorage extends SingleVariantStorage { /** * Create a fluid storage with a fixed capacity and a change handler. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/InventoryStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/InventoryStorage.java index aee3a6e3ec..291c693228 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/InventoryStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/InventoryStorage.java @@ -45,11 +45,7 @@ * *

    Important note: This wrapper assumes that the inventory owns its slots. * If the inventory does not own its slots, for example because it delegates to another inventory, this wrapper should not be used! - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental @ApiStatus.NonExtendable public interface InventoryStorage extends SlottedStorage { /** diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/ItemStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/ItemStorage.java index 7a399f9f69..84389bc90a 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/ItemStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/ItemStorage.java @@ -18,7 +18,6 @@ import java.util.List; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import net.minecraft.block.Blocks; @@ -43,11 +42,7 @@ /** * Access to {@link Storage Storage<ItemVariant>} instances. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class ItemStorage { /** * Sided block access to item variant storages. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/ItemVariant.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/ItemVariant.java index 0eda7a8411..2c8399775a 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/ItemVariant.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/ItemVariant.java @@ -33,11 +33,7 @@ * An immutable count-less ItemStack, i.e. an immutable association of an item and an optional NBT compound tag. * *

    Do not implement, use the static {@code of(...)} functions instead. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental @ApiStatus.NonExtendable public interface ItemVariant extends TransferVariant { /** diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/PlayerInventoryStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/PlayerInventoryStorage.java index 8713784a01..4e1ae2adf2 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/PlayerInventoryStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/PlayerInventoryStorage.java @@ -38,11 +38,7 @@ * However, {@link #insert} is overridden to behave like {@link #offer}. * For simple insertions, {@link #offer} or {@link #offerOrDrop} is recommended. * {@link #getSlots} can also be used and combined with {@link CombinedStorage} to retrieve a wrapper around a specific range of slots. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental @ApiStatus.NonExtendable // TODO: Consider explicitly syncing stacks by sending a ScreenHandlerSlotUpdateS2CPacket if that proves to be necessary. // TODO: Vanilla doesn't seem to be doing it reliably, so we ignore it for now. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/base/SingleItemStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/base/SingleItemStorage.java index 4d32066877..a6d83b903c 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/base/SingleItemStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/base/SingleItemStorage.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.api.transfer.v1.item.base; -import org.jetbrains.annotations.ApiStatus; - import net.minecraft.nbt.NbtCompound; import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; @@ -31,11 +29,7 @@ * *

    This is a convenient specialization of {@link SingleVariantStorage} for items that additionally offers methods * to read the contents of the storage from NBT. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public abstract class SingleItemStorage extends SingleVariantStorage { @Override protected final ItemVariant getBlankVariant() { diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/base/SingleStackStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/base/SingleStackStorage.java index 5c13c4a67d..ff87da9986 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/base/SingleStackStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/item/base/SingleStackStorage.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.api.transfer.v1.item.base; -import org.jetbrains.annotations.ApiStatus; - import net.minecraft.item.ItemStack; import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; @@ -35,11 +33,7 @@ * If one of these two functions is overridden to always return false, implementors may also wish to override * {@link #supportsInsertion} and/or {@link #supportsExtraction}. * {@link #getCapacity(ItemVariant)} can be overridden to change the maximum capacity depending on the item variant. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public abstract class SingleStackStorage extends SnapshotParticipant implements SingleSlotStorage { /** * Return the stack of this storage. It will be modified directly sometimes to avoid needless copies. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/SlottedStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/SlottedStorage.java index bb8cc60f90..0860b37645 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/SlottedStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/SlottedStorage.java @@ -18,11 +18,10 @@ import java.util.List; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.UnmodifiableView; -import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleSlotStorage; import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext; +import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleSlotStorage; import net.fabricmc.fabric.impl.transfer.TransferApiImpl; /** @@ -33,11 +32,7 @@ * Checking whether a storage is slotted can be done using {@code instanceof}. * * @param The type of the stored resources. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface SlottedStorage extends Storage { /** * Retrieve the number of slots in this storage. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/Storage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/Storage.java index 7398140fb0..6bab9d0c8d 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/Storage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/Storage.java @@ -18,9 +18,6 @@ import java.util.Iterator; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; - import net.fabricmc.fabric.api.transfer.v1.storage.base.CombinedStorage; import net.fabricmc.fabric.api.transfer.v1.storage.base.ExtractionOnlyStorage; import net.fabricmc.fabric.api.transfer.v1.storage.base.InsertionOnlyStorage; @@ -61,11 +58,7 @@ * * @param The type of the stored resources. * @see Transaction - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface Storage extends Iterable> { /** * Return an empty storage. @@ -212,44 +205,4 @@ default long getVersion() { static Class> asClass() { return (Class>) (Object) Storage.class; } - - /** - * Convenient helper to simulate an insertion, i.e. get the result of insert without modifying any state. - * The passed transaction may be null if a new transaction should be opened for the simulation. - * @see #insert - * @deprecated Either use transactions directly, or use {@link StorageUtil#simulateInsert}. - */ - @Deprecated(forRemoval = true) - default long simulateInsert(T resource, long maxAmount, @Nullable TransactionContext transaction) { - return StorageUtil.simulateInsert(this, resource, maxAmount, transaction); - } - - /** - * Convenient helper to simulate an extraction, i.e. get the result of extract without modifying any state. - * The passed transaction may be null if a new transaction should be opened for the simulation. - * @see #extract - * @deprecated Either use transactions directly, or use {@link StorageUtil#simulateExtract}. - */ - @Deprecated(forRemoval = true) - default long simulateExtract(T resource, long maxAmount, @Nullable TransactionContext transaction) { - return StorageUtil.simulateExtract(this, resource, maxAmount, transaction); - } - - /** - * Return a view over this storage, for a specific resource, or {@code null} if none is quickly available. - * - *

    This function should only return a non-null view if this storage can provide it quickly, - * for example with a hashmap lookup. - * If returning the requested view would require iteration through a potentially large number of views, - * {@code null} should be returned instead. - * - * @param resource The resource for which a storage view is requested. May be blank, for example to estimate capacity. - * @return A view over this storage for the passed resource, or {@code null} if none is quickly available. - * @deprecated Deprecated for removal without direct replacement. Use {@link #insert}, {@link #extract} or {@link #iterator} instead. - */ - @Deprecated(forRemoval = true) - @Nullable - default StorageView exactView(T resource) { - return null; - } } diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StoragePreconditions.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StoragePreconditions.java index f0ad7950af..dd197141ac 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StoragePreconditions.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StoragePreconditions.java @@ -16,18 +16,12 @@ package net.fabricmc.fabric.api.transfer.v1.storage; -import org.jetbrains.annotations.ApiStatus; - /** * Preconditions that can be used when working with storages. * *

    In particular, {@link #notNegative} or {@link #notBlankNotNegative} can be used by implementations of * {@link Storage#insert} and {@link Storage#extract} to fail-fast if the arguments are invalid. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class StoragePreconditions { /** * Ensure that the passed transfer variant is not blank. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StorageUtil.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StorageUtil.java index 2c69f78f11..6ad1cd7d9f 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StorageUtil.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StorageUtil.java @@ -20,7 +20,6 @@ import java.util.Objects; import java.util.function.Predicate; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import net.minecraft.inventory.Inventory; @@ -39,11 +38,7 @@ * *

    Note that the functions that take a predicate iterate over the entire inventory in the worst case. * If the resource is known, there will generally be a more performance efficient way. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public final class StorageUtil { private StorageUtil() { } diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StorageView.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StorageView.java index 5761db4874..168c1c86fd 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StorageView.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/StorageView.java @@ -16,19 +16,13 @@ package net.fabricmc.fabric.api.transfer.v1.storage; -import org.jetbrains.annotations.ApiStatus; - import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext; /** * A view of a single stored resource in a {@link Storage}, for use with {@link Storage#iterator}. * * @param The type of the stored resource. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface StorageView { /** * Try to extract a resource from this view. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/TransferVariant.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/TransferVariant.java index 4e3aae710d..508ffd5b7f 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/TransferVariant.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/TransferVariant.java @@ -18,7 +18,6 @@ import java.util.Objects; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import net.minecraft.nbt.NbtCompound; @@ -34,11 +33,7 @@ * {@code hashCode} is guaranteed to be correct and constant time independently of the size of the NBT. * * @param The type of the immutable object instance, for example {@code Item} or {@code Fluid}. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface TransferVariant { /** * Return true if this variant is blank, and false otherwise. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/BlankVariantView.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/BlankVariantView.java index 1d070310f0..fade2d80cb 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/BlankVariantView.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/BlankVariantView.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.api.transfer.v1.storage.base; -import org.jetbrains.annotations.ApiStatus; - import net.fabricmc.fabric.api.transfer.v1.storage.StorageView; import net.fabricmc.fabric.api.transfer.v1.storage.TransferVariant; import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext; @@ -25,11 +23,7 @@ /** * A transfer variant storage view that contains a blank variant all the time (it's always empty), but may have a nonzero capacity. * This can be used to give capacity hints even if the storage is empty. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public class BlankVariantView> implements StorageView { private final T blankVariant; private final long capacity; diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/CombinedSlottedStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/CombinedSlottedStorage.java index fdaef82ca8..b38d344ada 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/CombinedSlottedStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/CombinedSlottedStorage.java @@ -19,8 +19,6 @@ import java.util.List; import java.util.StringJoiner; -import org.jetbrains.annotations.ApiStatus; - import net.fabricmc.fabric.api.transfer.v1.storage.SlottedStorage; import net.fabricmc.fabric.api.transfer.v1.storage.Storage; @@ -30,11 +28,7 @@ * * @param The type of the stored resources. * @param The class of every part. {@code ? extends Storage} can be used if the parts are of different types. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public class CombinedSlottedStorage> extends CombinedStorage implements SlottedStorage { public CombinedSlottedStorage(List parts) { super(parts); diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/CombinedStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/CombinedStorage.java index f9614677d0..30dcc67746 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/CombinedStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/CombinedStorage.java @@ -21,8 +21,6 @@ import java.util.NoSuchElementException; import java.util.StringJoiner; -import org.jetbrains.annotations.ApiStatus; - import net.fabricmc.fabric.api.transfer.v1.storage.Storage; import net.fabricmc.fabric.api.transfer.v1.storage.StoragePreconditions; import net.fabricmc.fabric.api.transfer.v1.storage.StorageView; @@ -35,11 +33,7 @@ * * @param The type of the stored resources. * @param The class of every part. {@code ? extends Storage} can be used if the parts are of different types. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public class CombinedStorage> implements Storage { public List parts; diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/ExtractionOnlyStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/ExtractionOnlyStorage.java index c89e742da1..88649d1824 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/ExtractionOnlyStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/ExtractionOnlyStorage.java @@ -16,18 +16,12 @@ package net.fabricmc.fabric.api.transfer.v1.storage.base; -import org.jetbrains.annotations.ApiStatus; - import net.fabricmc.fabric.api.transfer.v1.storage.Storage; import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext; /** * A {@link Storage} that supports extraction, and not insertion. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface ExtractionOnlyStorage extends Storage { @Override default boolean supportsInsertion() { diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/FilteringStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/FilteringStorage.java index 708ce21150..c9b5e11284 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/FilteringStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/FilteringStorage.java @@ -20,8 +20,6 @@ import java.util.function.Supplier; import com.google.common.collect.Iterators; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; import net.fabricmc.fabric.api.transfer.v1.storage.Storage; import net.fabricmc.fabric.api.transfer.v1.storage.StorageView; @@ -37,11 +35,7 @@ *

    The static functions can be used when insertion or/and extraction should be blocked entirely. * * @param The type of the stored resources. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public abstract class FilteringStorage implements Storage { /** * Return a wrapper over the passed storage that prevents extraction. @@ -165,18 +159,6 @@ public Iterator> iterator() { return Iterators.transform(backingStorage.get().iterator(), FilteringStorageView::new); } - @Override - @Nullable - public StorageView exactView(T resource) { - StorageView exact = backingStorage.get().exactView(resource); - - if (exact != null) { - return new FilteringStorageView(exact); - } else { - return null; - } - } - @Override public long getVersion() { return backingStorage.get().getVersion(); diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/InsertionOnlyStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/InsertionOnlyStorage.java index 79b29d7295..c6581df4ac 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/InsertionOnlyStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/InsertionOnlyStorage.java @@ -19,19 +19,13 @@ import java.util.Collections; import java.util.Iterator; -import org.jetbrains.annotations.ApiStatus; - import net.fabricmc.fabric.api.transfer.v1.storage.Storage; import net.fabricmc.fabric.api.transfer.v1.storage.StorageView; import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext; /** * A {@link Storage} that supports insertion, and not extraction. By default, it doesn't have any storage view either. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface InsertionOnlyStorage extends Storage { @Override default boolean supportsExtraction() { diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/ResourceAmount.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/ResourceAmount.java index f7e2b02dd8..4a0a9b5d66 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/ResourceAmount.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/ResourceAmount.java @@ -16,15 +16,9 @@ package net.fabricmc.fabric.api.transfer.v1.storage.base; -import org.jetbrains.annotations.ApiStatus; - /** * An immutable object storing both a resource and an amount, provided for convenience. * @param The type of the stored resource. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public record ResourceAmount (T resource, long amount) { } diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleSlotStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleSlotStorage.java index 1b53cf330b..cea45ee4d3 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleSlotStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleSlotStorage.java @@ -18,8 +18,6 @@ import java.util.Iterator; -import org.jetbrains.annotations.ApiStatus; - import net.fabricmc.fabric.api.transfer.v1.storage.SlottedStorage; import net.fabricmc.fabric.api.transfer.v1.storage.StorageView; import net.fabricmc.fabric.impl.transfer.TransferApiImpl; @@ -29,11 +27,7 @@ * It can be used in APIs for storages that are wrappers around a single "slot", or for slightly more convenient implementation. * * @param The type of the stored resource. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public interface SingleSlotStorage extends SlottedStorage, StorageView { @Override default Iterator> iterator() { diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleVariantItemStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleVariantItemStorage.java index 50d52b135a..82199ddec5 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleVariantItemStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleVariantItemStorage.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.api.transfer.v1.storage.base; -import org.jetbrains.annotations.ApiStatus; - import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -46,11 +44,7 @@ * * * @param The type of the stored transfer variant. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public abstract class SingleVariantItemStorage> implements SingleSlotStorage { /** * Reference to the context. diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleVariantStorage.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleVariantStorage.java index d7922206f0..17e9996e3f 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleVariantStorage.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/storage/base/SingleVariantStorage.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.api.transfer.v1.storage.base; -import org.jetbrains.annotations.ApiStatus; - import net.minecraft.nbt.NbtCompound; import net.fabricmc.fabric.api.transfer.v1.storage.StoragePreconditions; @@ -34,13 +32,9 @@ * If one of these two functions is overridden to always return false, implementors may also wish to override * {@link #supportsInsertion} and/or {@link #supportsExtraction}. * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. - * * @see net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage SingleFluidStorage for fluid variants. * @see net.fabricmc.fabric.api.transfer.v1.item.base.SingleItemStorage SingleItemStorage for item variants. */ -@ApiStatus.Experimental public abstract class SingleVariantStorage> extends SnapshotParticipant> implements SingleSlotStorage { public T variant = getBlankVariant(); public long amount = 0; diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/Transaction.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/Transaction.java index 9b1aea033d..5e3fa89fba 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/Transaction.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/Transaction.java @@ -73,11 +73,7 @@ *

    Every transaction is only valid on the thread it was opened on, * and attempts to use it on another thread will throw an exception. * Consequently, transactions can be concurrent across multiple threads, as long as they don't share any state. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental @ApiStatus.NonExtendable public interface Transaction extends AutoCloseable, TransactionContext { /** diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/TransactionContext.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/TransactionContext.java index 17065e158b..7be7ace660 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/TransactionContext.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/TransactionContext.java @@ -21,11 +21,7 @@ /** * A subset of a {@link Transaction} that lets participants properly take part in transactions, manage their state, * or open nested transactions, but does not allow them to close the transaction they are passed. - * - *

    Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental @ApiStatus.NonExtendable public interface TransactionContext { /** diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/base/SnapshotParticipant.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/base/SnapshotParticipant.java index ed55f30a42..75a6200a67 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/base/SnapshotParticipant.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/transaction/base/SnapshotParticipant.java @@ -20,8 +20,6 @@ import java.util.List; import java.util.Objects; -import org.jetbrains.annotations.ApiStatus; - import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext; @@ -53,11 +51,7 @@ * and {@link #onFinalCommit} will be called after the transaction is closed. * * @param The objects that this participant uses to save its state snapshots. - * - * Experimental feature, we reserve the right to remove or change it without further notice. - * The transfer API is a complex addition, and we want to be able to correct possible design mistakes. */ -@ApiStatus.Experimental public abstract class SnapshotParticipant implements Transaction.CloseCallback, Transaction.OuterCloseCallback { private final List snapshots = new ArrayList<>(); diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/impl/transfer/context/InitialContentsContainerItemContext.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/impl/transfer/context/InitialContentsContainerItemContext.java deleted file mode 100644 index 664feaf836..0000000000 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/impl/transfer/context/InitialContentsContainerItemContext.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018, 2019 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.impl.transfer.context; - -import java.util.Collections; -import java.util.List; - -import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext; -import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant; -import net.fabricmc.fabric.api.transfer.v1.storage.StoragePreconditions; -import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleSlotStorage; -import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleVariantStorage; -import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext; - -@Deprecated(forRemoval = true) -public class InitialContentsContainerItemContext implements ContainerItemContext { - private final SingleVariantStorage backingSlot = new SingleVariantStorage<>() { - @Override - protected ItemVariant getBlankVariant() { - return ItemVariant.blank(); - } - - @Override - protected long getCapacity(ItemVariant variant) { - return Long.MAX_VALUE; - } - }; - - public InitialContentsContainerItemContext(ItemVariant initialVariant, long initialAmount) { - backingSlot.variant = initialVariant; - backingSlot.amount = initialAmount; - } - - @Override - public SingleSlotStorage getMainSlot() { - return backingSlot; - } - - @Override - public long insertOverflow(ItemVariant itemVariant, long maxAmount, TransactionContext transactionContext) { - StoragePreconditions.notBlankNotNegative(itemVariant, maxAmount); - // Always allow anything to be inserted. - return maxAmount; - } - - @Override - public List> getAdditionalSlots() { - return Collections.emptyList(); - } -} diff --git a/fabric-transfer-api-v1/src/main/resources/fabric.mod.json b/fabric-transfer-api-v1/src/main/resources/fabric.mod.json index 5fb9be2792..198b8f6ec8 100644 --- a/fabric-transfer-api-v1/src/main/resources/fabric.mod.json +++ b/fabric-transfer-api-v1/src/main/resources/fabric.mod.json @@ -25,6 +25,6 @@ "fabric-transfer-api-v1.mixins.json" ], "custom": { - "fabric-api:module-lifecycle": "experimental" + "fabric-api:module-lifecycle": "stable" } }