net.minecraft.component.type

public record PotionContentsComponent

implements Consumable, TooltipAppender

net.minecraft.world.item.alchemy.PotionContents
net.minecraft.class_1844
net.minecraft.component.type.PotionContentsComponent

Field summary

Modifier and TypeField
private final Optional<RegistryEntry<Potion>>
potion
comp_2378
potion
private final Optional<Integer>
customColor
comp_2379
customColor
private final List<StatusEffectInstance>
customEffects
comp_2380
customEffects
private final Optional<String>
customName
comp_3209
customName
public static final PotionContentsComponent
EMPTY
field_49274
DEFAULT
private static final Text
NO_EFFECT
field_25817
NONE_TEXT
public static final int
BASE_POTION_COLOR
field_49277
EFFECTLESS_COLOR
private static final com.mojang.serialization.Codec<PotionContentsComponent>
FULL_CODEC
field_49749
BASE_CODEC
public static final com.mojang.serialization.Codec<PotionContentsComponent>
CODEC
field_49275
CODEC
public static final PacketCodec<RegistryByteBuf, PotionContentsComponent>
STREAM_CODEC
field_49276
PACKET_CODEC

Constructor summary

ModifierConstructor
public (RegistryEntry<Potion> potion)
public (Optional<RegistryEntry<Potion>> potion, Optional<Integer> customColor, List<StatusEffectInstance> customEffects, Optional<String> customName)

Method summary

Modifier and TypeMethod
public static ItemStack
createItemStack(Item item, Holder<Potion> potion)
method_57400(class_1792 arg0, class_6880<class_1842> arg1)
createStack(Item item, RegistryEntry<Potion> potion)
public boolean
is(Holder<Potion> potion)
method_57401(class_6880<class_1842> arg0)
matches(RegistryEntry<Potion> potion)
public Iterable<StatusEffectInstance>
getAllEffects()
method_57397()
getEffects()
public void
forEachEffect(Consumer<MobEffectInstance> consumer, float durationScale)
method_57402(Consumer<class_1293> arg0, float arg1)
forEachEffect(Consumer<StatusEffectInstance> effectConsumer, float durationMultiplier)
public PotionContentsComponent
withPotion(Holder<Potion> potion)
method_57403(class_6880<class_1842> arg0)
with(RegistryEntry<Potion> potion)
public PotionContentsComponent
withEffectAdded(MobEffectInstance effect)
method_57398(class_1293 arg0)
with(StatusEffectInstance customEffect)
public int
getColor()
method_8064()
getColor()
public int
getColorOr(int defaultColor)
method_65361(int arg0)
getColor(int defaultColor)
public Text
getName(String prefix)
method_64195(String arg0)
getName(String prefix)
public static OptionalInt
getColorOptional(Iterable<MobEffectInstance> effects)
method_58111(Iterable<class_1293> arg0)
mixColors(Iterable<StatusEffectInstance> effects)
public boolean
hasEffects()
method_57405()
hasEffects()
public List<StatusEffectInstance>
customEffects()
comp_2380()
customEffects()
public void
applyToLivingEntity(LivingEntity entity, float durationScale)
method_62839(class_1309 arg0, float arg1)
apply(LivingEntity user, float durationMultiplier)
public static void
addPotionTooltip(Iterable<MobEffectInstance> effects, Consumer<Component> lines, float durationScale, float tickrate)
method_8065(Iterable<class_1293> arg0, Consumer<class_2561> arg1, float arg2, float arg3)
buildTooltip(Iterable<StatusEffectInstance> effects, Consumer<Text> textConsumer, float durationMultiplier, float tickRate)
public static MutableText
getPotionDescription(Holder<MobEffect> mobEffect, int amplifier)
method_66698(class_6880<class_1291> arg0, int arg1)
getEffectText(RegistryEntry<StatusEffect> effect, int amplifier)
public void
onConsume(Level level, LivingEntity user, ItemStack stack, Consumable consumable)
method_62831(class_1937 arg0, class_1309 arg1, class_1799 arg2, class_10124 arg3)
onConsume(World arg0, LivingEntity arg1, ItemStack arg2, ConsumableComponent arg3)
public void
addToTooltip(Item$TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components)
method_57409(class_1792$class_9635 arg0, Consumer<class_2561> arg1, class_1836 arg2, class_9473 arg3)
appendTooltip(Item$TooltipContext arg0, Consumer<Text> arg1, TooltipType arg2, ComponentsAccess arg3)
public Optional<RegistryEntry<Potion>>
potion()
comp_2378()
potion()
public Optional<Integer>
customColor()
comp_2379()
customColor()
public Optional<String>
customName()
comp_3209()
customName()
private static void
lambda$addPotionTooltip$0(List arg0, Holder arg1, AttributeModifier arg2)
method_55762(List arg0, class_6880 arg1, class_1322 arg2)
method_55762(List arg0, RegistryEntry attribute, EntityAttributeModifier modifier)
private static void
lambda$applyToLivingEntity$0(ServerLevel arg0, Player arg1, LivingEntity arg2, MobEffectInstance arg3)
method_62840(class_3218 arg0, class_1657 arg1, class_1309 arg2, class_1293 arg3)
method_62840(ServerWorld arg0, PlayerEntity arg1, LivingEntity arg2, StatusEffectInstance effect)
private Optional
lambda$getName$0()
method_64197()
method_64197()
private static String
lambda$getName$1(Holder arg0)
method_64196(class_6880 arg0)
method_64196(RegistryEntry potionEntry)
private static com.mojang.datafixers.kinds.App
lambda$static$0(com.mojang.serialization.codecs.RecordCodecBuilder$Instance arg0)
method_57399(com.mojang.serialization.codecs.RecordCodecBuilder$Instance arg0)
method_57399(com.mojang.serialization.codecs.RecordCodecBuilder$Instance instance)