Package net.minecraft.component.type
Class ContainerComponent
java.lang.Object
net.minecraft.component.type.ContainerComponent
- All Implemented Interfaces:
TooltipAppender
A component that stores a list of item stacks.
- Mappings:
Namespace Name named net/minecraft/component/type/ContainerComponentintermediary net/minecraft/class_9288official ddc
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intstatic final com.mojang.serialization.Codec<ContainerComponent> static final ContainerComponentAn empty container component.private final intprivate static final intstatic final PacketCodec<RegistryByteBuf, ContainerComponent> private final DefaultedList<ItemStack> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateContainerComponent(int size) privateContainerComponent(List<ItemStack> stacks) privateContainerComponent(DefaultedList<ItemStack> stacks) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendTooltip(Item.TooltipContext context, Consumer<Text> textConsumer, TooltipType type, ComponentsAccess components) private List<ContainerComponent.Slot> Returns a copy of the first contained stack in this component.voidcopyTo(DefaultedList<ItemStack> stacks) Copies the contents of this component to a list of item stacks.booleanprivate static intfindLastNonEmptyIndex(List<ItemStack> stacks) private static ContainerComponentfromSlots(List<ContainerComponent.Slot> slots) static ContainerComponentfromStacks(List<ItemStack> stacks) Creates a container component from a list of item stacks.inthashCode()Returns an iterable over this component's non-empty item stacks.Returns an iterable over copies of this component's non-empty item stacks.stream()Returns a stream over copies of this component's stored item stacks.Returns a stream over copies of this component's non-empty item stacks.
-
Field Details
-
ALL_SLOTS_EMPTY
private static final int ALL_SLOTS_EMPTY- See Also:
- Mappings:
Namespace Name Mixin selector named ALL_SLOTS_EMPTYLnet/minecraft/component/type/ContainerComponent;ALL_SLOTS_EMPTY:Iintermediary field_51410Lnet/minecraft/class_9288;field_51410:Iofficial dLddc;d:I
-
MAX_SLOTS
private static final int MAX_SLOTS- See Also:
- Mappings:
Namespace Name Mixin selector named MAX_SLOTSLnet/minecraft/component/type/ContainerComponent;MAX_SLOTS:Iintermediary field_49337Lnet/minecraft/class_9288;field_49337:Iofficial eLddc;e:I
-
DEFAULT
An empty container component.- Mappings:
Namespace Name Mixin selector named DEFAULTLnet/minecraft/component/type/ContainerComponent;DEFAULT:Lnet/minecraft/component/type/ContainerComponent;intermediary field_49334Lnet/minecraft/class_9288;field_49334:Lnet/minecraft/class_9288;official aLddc;a:Lddc;
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODECLnet/minecraft/component/type/ContainerComponent;CODEC:Lcom/mojang/serialization/Codec;intermediary field_49335Lnet/minecraft/class_9288;field_49335:Lcom/mojang/serialization/Codec;official bLddc;b:Lcom/mojang/serialization/Codec;
-
PACKET_CODEC
- Mappings:
Namespace Name Mixin selector named PACKET_CODECLnet/minecraft/component/type/ContainerComponent;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;intermediary field_49336Lnet/minecraft/class_9288;field_49336:Lnet/minecraft/class_9139;official cLddc;c:Lze;
-
stacks
- Mappings:
Namespace Name Mixin selector named stacksLnet/minecraft/component/type/ContainerComponent;stacks:Lnet/minecraft/util/collection/DefaultedList;intermediary field_49338Lnet/minecraft/class_9288;field_49338:Lnet/minecraft/class_2371;official fLddc;f:Ljp;
-
hashCode
private final int hashCode- Mappings:
Namespace Name Mixin selector named hashCodeLnet/minecraft/component/type/ContainerComponent;hashCode:Iintermediary field_51511Lnet/minecraft/class_9288;field_51511:Iofficial gLddc;g:I
-
-
Constructor Details
-
ContainerComponent
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/component/type/ContainerComponent;<init>(Lnet/minecraft/util/collection/DefaultedList;)Vintermediary <init>Lnet/minecraft/class_9288;<init>(Lnet/minecraft/class_2371;)Vofficial <init>Lddc;<init>(Ljp;)V
-
ContainerComponent
private ContainerComponent(int size) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/component/type/ContainerComponent;<init>(I)Vintermediary <init>Lnet/minecraft/class_9288;<init>(I)Vofficial <init>Lddc;<init>(I)V
-
ContainerComponent
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/component/type/ContainerComponent;<init>(Ljava/util/List;)Vintermediary <init>Lnet/minecraft/class_9288;<init>(Ljava/util/List;)Vofficial <init>Lddc;<init>(Ljava/util/List;)V
-
-
Method Details
-
fromSlots
- Mappings:
Namespace Name Mixin selector named fromSlotsLnet/minecraft/component/type/ContainerComponent;fromSlots(Ljava/util/List;)Lnet/minecraft/component/type/ContainerComponent;intermediary method_57496Lnet/minecraft/class_9288;method_57496(Ljava/util/List;)Lnet/minecraft/class_9288;official bLddc;b(Ljava/util/List;)Lddc;
-
fromStacks
Creates a container component from a list of item stacks. The stacks are copied into the component, which will contain copies of all stacks up to the last non-empty stack.- Parameters:
stacks- the list of stacks to copy- Returns:
- the created component
- Mappings:
Namespace Name Mixin selector named fromStacksLnet/minecraft/component/type/ContainerComponent;fromStacks(Ljava/util/List;)Lnet/minecraft/component/type/ContainerComponent;intermediary method_57493Lnet/minecraft/class_9288;method_57493(Ljava/util/List;)Lnet/minecraft/class_9288;official aLddc;a(Ljava/util/List;)Lddc;
-
findLastNonEmptyIndex
- Mappings:
Namespace Name Mixin selector named findLastNonEmptyIndexLnet/minecraft/component/type/ContainerComponent;findLastNonEmptyIndex(Ljava/util/List;)Iintermediary method_59713Lnet/minecraft/class_9288;method_59713(Ljava/util/List;)Iofficial cLddc;c(Ljava/util/List;)I
-
collectSlots
- Mappings:
Namespace Name Mixin selector named collectSlotsLnet/minecraft/component/type/ContainerComponent;collectSlots()Ljava/util/List;intermediary method_57494Lnet/minecraft/class_9288;method_57494()Ljava/util/List;official fLddc;f()Ljava/util/List;
-
copyTo
Copies the contents of this component to a list of item stacks.If the list has a larger size than this component, the remaining slots will be filled with empty stacks.
- Parameters:
stacks- the target list of item stacks- Mappings:
Namespace Name Mixin selector named copyToLnet/minecraft/component/type/ContainerComponent;copyTo(Lnet/minecraft/util/collection/DefaultedList;)Vintermediary method_57492Lnet/minecraft/class_9288;method_57492(Lnet/minecraft/class_2371;)Vofficial aLddc;a(Ljp;)V
-
copyFirstStack
Returns a copy of the first contained stack in this component.If this component is empty, returns an empty stack.
- Returns:
- a copy of the first contained stack in this component
- Mappings:
Namespace Name Mixin selector named copyFirstStackLnet/minecraft/component/type/ContainerComponent;copyFirstStack()Lnet/minecraft/item/ItemStack;intermediary method_58114Lnet/minecraft/class_9288;method_58114()Lnet/minecraft/class_1799;official aLddc;a()Ldak;
-
stream
Returns a stream over copies of this component's stored item stacks.- Returns:
- a stream over copies of this component's stored item stacks
- Mappings:
Namespace Name Mixin selector named streamLnet/minecraft/component/type/ContainerComponent;stream()Ljava/util/stream/Stream;intermediary method_57489Lnet/minecraft/class_9288;method_57489()Ljava/util/stream/Stream;official bLddc;b()Ljava/util/stream/Stream;
-
streamNonEmpty
Returns a stream over copies of this component's non-empty item stacks.- Returns:
- a stream over copies of this component's non-empty item stacks
- Mappings:
Namespace Name Mixin selector named streamNonEmptyLnet/minecraft/component/type/ContainerComponent;streamNonEmpty()Ljava/util/stream/Stream;intermediary method_59712Lnet/minecraft/class_9288;method_59712()Ljava/util/stream/Stream;official cLddc;c()Ljava/util/stream/Stream;
-
iterateNonEmpty
Returns an iterable over this component's non-empty item stacks.The stacks should not be modified to keep this component immutable. Use
iterateNonEmptyCopy()or the stream methods for getting freely modifiable copies of the stacks.- Returns:
- an iterable over this component's non-empty item stacks
- Mappings:
Namespace Name Mixin selector named iterateNonEmptyLnet/minecraft/component/type/ContainerComponent;iterateNonEmpty()Ljava/lang/Iterable;intermediary method_59714Lnet/minecraft/class_9288;method_59714()Ljava/lang/Iterable;official dLddc;d()Ljava/lang/Iterable;
-
iterateNonEmptyCopy
Returns an iterable over copies of this component's non-empty item stacks.- Returns:
- an iterable over copies of this component's non-empty item stacks
- Mappings:
Namespace Name Mixin selector named iterateNonEmptyCopyLnet/minecraft/component/type/ContainerComponent;iterateNonEmptyCopy()Ljava/lang/Iterable;intermediary method_59715Lnet/minecraft/class_9288;method_59715()Ljava/lang/Iterable;official eLddc;e()Ljava/lang/Iterable;
-
equals
-
hashCode
public int hashCode() -
appendTooltip
public void appendTooltip(Item.TooltipContext context, Consumer<Text> textConsumer, TooltipType type, ComponentsAccess components) - Specified by:
appendTooltipin interfaceTooltipAppender- Mappings:
Namespace Name Mixin selector named appendTooltipLnet/minecraft/item/tooltip/TooltipAppender;appendTooltip(Lnet/minecraft/item/Item$TooltipContext;Ljava/util/function/Consumer;Lnet/minecraft/item/tooltip/TooltipType;Lnet/minecraft/component/ComponentsAccess;)Vintermediary method_57409Lnet/minecraft/class_9299;method_57409(Lnet/minecraft/class_1792$class_9635;Ljava/util/function/Consumer;Lnet/minecraft/class_1836;Lnet/minecraft/class_9473;)Vofficial aLddp;a(Ldag$b;Ljava/util/function/Consumer;Ldbz;Lkg;)V
-