Package net.minecraft.world.item.alchemy
Record Class PotionContents
java.lang.Object
java.lang.Record
net.minecraft.world.item.alchemy.PotionContents
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intstatic final com.mojang.serialization.Codec<PotionContents> The field for thecustomColorrecord component.private final List<MobEffectInstance> The field for thecustomEffectsrecord component.static final PotionContentsprivate static final com.mojang.serialization.Codec<PotionContents> private static final ComponentThe field for thepotionrecord component.static final StreamCodec<RegistryFriendlyByteBuf, PotionContents> -
Constructor Summary
ConstructorsConstructorDescriptionPotionContents(Optional<Holder<Potion>> potion, Optional<Integer> customColor, List<MobEffectInstance> customEffects) Creates an instance of aPotionContentsrecord class.PotionContents(Holder<Potion> p_331208_) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddPotionTooltip(Iterable<MobEffectInstance> p_331825_, Consumer<Component> p_331296_, float p_332038_, float p_332014_) voidaddPotionTooltip(Consumer<Component> p_331688_, float p_330466_, float p_332190_) static ItemStackcreateItemStack(Item p_330388_, Holder<Potion> p_331030_) Returns the value of thecustomColorrecord component.Returns the value of thecustomEffectsrecord component.final booleanIndicates whether some other object is "equal to" this one.voidforEachEffect(Consumer<MobEffectInstance> p_331190_) intgetColor()static intgetColor(Iterable<MobEffectInstance> p_331934_) static intstatic OptionalIntgetColorOptional(Iterable<MobEffectInstance> p_332699_) booleanfinal inthashCode()Returns a hash code value for this object.booleanpotion()Returns the value of thepotionrecord component.final StringtoString()Returns a string representation of this record class.withEffectAdded(MobEffectInstance p_332083_) withPotion(Holder<Potion> p_330288_)
-
Field Details
-
potion
The field for thepotionrecord component. -
customColor
The field for thecustomColorrecord component. -
customEffects
The field for thecustomEffectsrecord component. -
EMPTY
-
NO_EFFECT
-
BASE_POTION_COLOR
private static final int BASE_POTION_COLOR- See Also:
-
FULL_CODEC
-
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
PotionContents
-
PotionContents
public PotionContents(Optional<Holder<Potion>> potion, Optional<Integer> customColor, List<MobEffectInstance> customEffects) Creates an instance of aPotionContentsrecord class.- Parameters:
potion- the value for thepotionrecord componentcustomColor- the value for thecustomColorrecord componentcustomEffects- the value for thecustomEffectsrecord component
-
-
Method Details
-
createItemStack
-
is
-
getAllEffects
-
forEachEffect
-
withPotion
-
withEffectAdded
-
getColor
public int getColor() -
getColor
-
getColor
-
getColorOptional
-
hasEffects
public boolean hasEffects() -
customEffects
Returns the value of thecustomEffectsrecord component.- Returns:
- the value of the
customEffectsrecord component
-
addPotionTooltip
-
addPotionTooltip
public static void addPotionTooltip(Iterable<MobEffectInstance> p_331825_, Consumer<Component> p_331296_, float p_332038_, float p_332014_) -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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). -
potion
Returns the value of thepotionrecord component.- Returns:
- the value of the
potionrecord component
-
customColor
Returns the value of thecustomColorrecord component.- Returns:
- the value of the
customColorrecord component
-