记录类 PotionContents
java.lang.Object
java.lang.Record
net.minecraft.world.item.alchemy.PotionContents
- 所有已实现的接口:
ConsumableListener
-
字段概要
字段修饰符和类型字段说明static final int
static final com.mojang.serialization.Codec
<PotionContents> customColor
记录组件的字段。private final List
<MobEffectInstance> customEffects
记录组件的字段。customName
记录组件的字段。static final PotionContents
private static final com.mojang.serialization.Codec
<PotionContents> private static final Component
potion
记录组件的字段。static final StreamCodec
<RegistryFriendlyByteBuf, PotionContents> -
构造器概要
构造器构造器说明PotionContents
(Optional<Holder<Potion>> potion, Optional<Integer> customColor, List<MobEffectInstance> customEffects, Optional<String> customName) 创建PotionContents
记录类的实例。PotionContents
(Holder<Potion> p_335062_) -
方法概要
修饰符和类型方法说明static void
addPotionTooltip
(Iterable<MobEffectInstance> p_328255_, Consumer<Component> p_336197_, float p_333725_, float p_333963_) void
addPotionTooltip
(Consumer<Component> p_334042_, float p_336314_, float p_328696_) void
applyToLivingEntity
(LivingEntity p_362891_) static ItemStack
createItemStack
(Item p_328254_, Holder<Potion> p_334269_) 返回customColor
记录组件的值。返回customEffects
记录组件的值。返回customName
记录组件的值。final boolean
指示某个其他对象是否“等于”此对象。void
forEachEffect
(Consumer<MobEffectInstance> p_335805_) int
getColor()
static OptionalInt
getColorOptional
(Iterable<MobEffectInstance> p_331345_) int
getColorOr
(int p_378053_) boolean
final int
hashCode()
返回此对象的哈希代码值。boolean
void
onConsume
(Level p_367284_, LivingEntity p_369037_, ItemStack p_368087_, Consumable p_366370_) potion()
返回potion
记录组件的值。final String
toString()
返回此记录类的字符串表示形式。withEffectAdded
(MobEffectInstance p_328742_) withPotion
(Holder<Potion> p_333654_)
-
字段详细资料
-
potion
potion
记录组件的字段。 -
customColor
customColor
记录组件的字段。 -
customEffects
customEffects
记录组件的字段。 -
customName
customName
记录组件的字段。 -
EMPTY
-
NO_EFFECT
-
BASE_POTION_COLOR
public static final int BASE_POTION_COLOR- 另请参阅:
-
FULL_CODEC
-
CODEC
-
STREAM_CODEC
-
-
构造器详细资料
-
PotionContents
-
PotionContents
public PotionContents(Optional<Holder<Potion>> potion, Optional<Integer> customColor, List<MobEffectInstance> customEffects, Optional<String> customName) 创建PotionContents
记录类的实例。- 参数:
potion
-potion
记录组件的值customColor
-customColor
记录组件的值customEffects
-customEffects
记录组件的值customName
-customName
记录组件的值
-
-
方法详细资料
-
createItemStack
-
is
-
getAllEffects
-
forEachEffect
-
withPotion
-
withEffectAdded
-
getColor
public int getColor() -
getColorOr
public int getColorOr(int p_378053_) -
getName
-
getColorOptional
-
hasEffects
public boolean hasEffects() -
customEffects
返回customEffects
记录组件的值。- 返回:
customEffects
记录组件的值
-
addPotionTooltip
-
applyToLivingEntity
-
addPotionTooltip
public static void addPotionTooltip(Iterable<MobEffectInstance> p_328255_, Consumer<Component> p_336197_, float p_333725_, float p_333963_) -
onConsume
public void onConsume(Level p_367284_, LivingEntity p_369037_, ItemStack p_368087_, Consumable p_366370_) - 指定者:
onConsume
在接口中ConsumableListener
-
toString
返回此记录类的字符串表示形式。此表示形式包含类的名称,后跟每个记录组件的名称和值。 -
hashCode
public final int hashCode()返回此对象的哈希代码值。此值派生自每个记录组件的哈希代码。 -
equals
指示某个其他对象是否“等于”此对象。如果两个对象属于同一个类,而且所有记录组件都相等,则这两个对象相等。 此记录类中的所有组件都使用Objects::equals(Object,Object)
进行比较。 -
potion
返回potion
记录组件的值。- 返回:
potion
记录组件的值
-
customColor
返回customColor
记录组件的值。- 返回:
customColor
记录组件的值
-
customName
返回customName
记录组件的值。- 返回:
customName
记录组件的值
-