Package appeng.api.stacks
Class AEKeyType
java.lang.Object
appeng.api.stacks.AEKeyType
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract com.mojang.serialization.MapCodec
<? extends AEKey> codec()
A codec used to encode keys of this type.final boolean
Returns whether the key is part of this key space.final AEKeyFilter
filter()
static AEKeyType
fluids()
final String
formatAmount
(long amount, AmountFormat format) Format the amount into a user-readable string.static @Nullable AEKeyType
fromRawId
(int id) int
The amount of this key type that can be stored per byte used in a storage cell.int
How much of this key will be transferred as part of a transfer operation.int
net.minecraft.network.chat.Component
Get the translated name of this key space.final net.minecraft.resources.ResourceLocation
getId()
final byte
getRawId()
Stream
<net.minecraft.tags.TagKey<?>> Returns all tags that apply to keys of this type.@Nullable String
I.e.static AEKeyType
items()
@Nullable AEKey
loadKeyFromTag
(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.nbt.CompoundTag tag) Attempts to load a key of this type from the given tag.abstract @Nullable AEKey
readFromPacket
(net.minecraft.network.RegistryFriendlyByteBuf input) Attempts to load a key of this type from the given packet buffer.boolean
True to indicate that theAEKey
class used by this storage channel supports range-based fuzzy search usingAEKey.getFuzzySearchValue()
andAEKey.getFuzzySearchMaxValue()
.toString()
final @Nullable AEKey
Does this key belong to this storage channel.
-
Field Details
-
Constructor Details
-
AEKeyType
-
-
Method Details
-
codec
A codec used to encode keys of this type. -
items
- Returns:
- AE2's key space for
AEItemKey
.
-
fromRawId
- Returns:
- See
getRawId()
-
fluids
- Returns:
- AE2's key space for
AEFluidKey
.
-
getId
public final net.minecraft.resources.ResourceLocation getId()- Returns:
- The unique ID of this storage channel.
-
getKeyClass
-
getRawId
public final byte getRawId() -
getAmountPerOperation
public int getAmountPerOperation()How much of this key will be transferred as part of a transfer operation. Used to balance item vs. fluids transfers.E.g. used by IO Ports to transfer 1000 mB, not 1 mB to match the item channel transferring a full bucket per operation.
-
getAmountPerByte
public int getAmountPerByte()The amount of this key type that can be stored per byte used in a storage cell. Standard value for items is 8, and for fluids it's 8000. -
readFromPacket
@Nullable public abstract @Nullable AEKey readFromPacket(net.minecraft.network.RegistryFriendlyByteBuf input) Attempts to load a key of this type from the given packet buffer. -
loadKeyFromTag
@Nullable public @Nullable AEKey loadKeyFromTag(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.nbt.CompoundTag tag) Attempts to load a key of this type from the given tag. -
tryCast
Does this key belong to this storage channel. -
contains
Returns whether the key is part of this key space.- Returns:
- whether the key is part of this key space
-
supportsFuzzyRangeSearch
public boolean supportsFuzzyRangeSearch()True to indicate that theAEKey
class used by this storage channel supports range-based fuzzy search usingAEKey.getFuzzySearchValue()
andAEKey.getFuzzySearchMaxValue()
. For items this is used for damage-based search and filtering. -
filter
- Returns:
- A filter matching all keys of this type.
-
toString
-
getDescription
public net.minecraft.network.chat.Component getDescription()Get the translated name of this key space. -
getUnitSymbol
I.e. "B" for Buckets. -
getAmountPerUnit
public int getAmountPerUnit() -
formatAmount
Format the amount into a user-readable string. SeeAmountFormat
for an explanation of the different formats. Includes the unit if applicable. -
getTagNames
Returns all tags that apply to keys of this type. Is an optional operation is keys of this type cannot have tags, andAEKey.isTagged(TagKey)
is not implemented for this key type.- See Also:
-