Record Class SlotDisplay.OnlyWithComponent
java.lang.Object
java.lang.Record
net.minecraft.world.item.crafting.display.SlotDisplay.OnlyWithComponent
- All Implemented Interfaces:
SlotDisplay
- Enclosing interface:
SlotDisplay
public static record SlotDisplay.OnlyWithComponent(SlotDisplay source, DataComponentType<?> component)
extends Record
implements SlotDisplay
-
Nested Class Summary
Nested classes/interfaces inherited from interface SlotDisplay
SlotDisplay.AnyFuel, SlotDisplay.Composite, SlotDisplay.DyedSlotDemo, SlotDisplay.Empty, SlotDisplay.ItemSlotDisplay, SlotDisplay.ItemStackContentsFactory, SlotDisplay.ItemStackSlotDisplay, SlotDisplay.OnlyWithComponent, SlotDisplay.SmithingTrimDemoSlotDisplay, SlotDisplay.TagSlotDisplay, SlotDisplay.Type<T>, SlotDisplay.WithAnyPotion, SlotDisplay.WithRemainder -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataComponentType<?> The field for thecomponentrecord component.static final com.mojang.serialization.MapCodec<SlotDisplay.OnlyWithComponent> private final SlotDisplayThe field for thesourcerecord component.static final StreamCodec<RegistryFriendlyByteBuf, SlotDisplay.OnlyWithComponent> static final SlotDisplay.Type<SlotDisplay.OnlyWithComponent> Fields inherited from interface SlotDisplay
CODEC -
Constructor Summary
ConstructorsConstructorDescriptionOnlyWithComponent(SlotDisplay source, DataComponentType<?> component) Creates an instance of aOnlyWithComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecomponentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.<T> Stream<T> resolve(ContextMap context, DisplayContentsFactory<T> builder) source()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.type()Methods inherited from interface SlotDisplay
isEnabled, resolveForFirstStack, resolveForStacks
-
Field Details
-
source
The field for thesourcerecord component. -
component
The field for thecomponentrecord component. -
MAP_CODEC
-
STREAM_CODEC
public static final StreamCodec<RegistryFriendlyByteBuf, SlotDisplay.OnlyWithComponent> STREAM_CODEC -
TYPE
-
-
Constructor Details
-
OnlyWithComponent
Creates an instance of aOnlyWithComponentrecord class.- Parameters:
source- the value for thesourcerecord componentcomponent- the value for thecomponentrecord component
-
-
Method Details
-
resolve
- Specified by:
resolvein interfaceSlotDisplay
-
type
- Specified by:
typein interfaceSlotDisplay
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
source
Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-
component
Returns the value of thecomponentrecord component.- Returns:
- the value of the
componentrecord component
-