Record Class Potion
java.lang.Object
java.lang.Record
net.minestom.server.potion.Potion
- Record Components:
effect- the potion effectamplifier- the amplifier starting at 0 (level 1)duration- the duration (in ticks) that the potion will lastflags- the flags of the potion, seeflags()
Represents a potion effect that can be added to an
Entity.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteA flag indicating that this Potion is ambient (it came from a beacon).static final byteA flag instructing the client to use its builtin blending effect, only used with the darkness effect currently.static final byteA flag indicating that this Potion has an icon.static final intA duration constant which sets a Potion duration to infinite.static final NetworkBuffer.Type<Potion> static final byteA flag indicating that this Potion has particles. -
Constructor Summary
ConstructorsConstructorDescriptionPotion(PotionEffect effect, int amplifier, int duration) Creates a new Potion with no flags.Potion(PotionEffect effect, int amplifier, int duration, byte flags) Creates an instance of aPotionrecord class.Potion(PotionEffect effect, int amplifier, int duration, int flags) -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theamplifierrecord component.intduration()Returns the value of thedurationrecord component.effect()Returns the value of theeffectrecord component.final booleanIndicates whether some other object is "equal to" this one.byteflags()Returns the flags that this Potion has.booleanhasBlend()final inthashCode()Returns a hash code value for this object.booleanhasIcon()Returns whether this Potion has an icon or not.booleanReturns whether this Potion has particles or not.booleanReturns whether this Potion is ambient (it came from a beacon) or not.voidsendAddPacket(Entity entity) Sends a packet that a potion effect has been applied to the entity.voidsendRemovePacket(Entity entity) Sends a packet that a potion effect has been removed from the entity.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
AMBIENT_FLAG
public static final byte AMBIENT_FLAGA flag indicating that this Potion is ambient (it came from a beacon).- See Also:
-
PARTICLES_FLAG
public static final byte PARTICLES_FLAGA flag indicating that this Potion has particles.- See Also:
-
ICON_FLAG
public static final byte ICON_FLAGA flag indicating that this Potion has an icon.- See Also:
-
BLEND_FLAG
public static final byte BLEND_FLAGA flag instructing the client to use its builtin blending effect, only used with the darkness effect currently.- See Also:
-
INFINITE_DURATION
public static final int INFINITE_DURATIONA duration constant which sets a Potion duration to infinite.- See Also:
-
NETWORK_TYPE
-
-
Constructor Details
-
Potion
- See Also:
-
Potion
Creates a new Potion with no flags.- See Also:
-
Potion
Creates an instance of aPotionrecord class.
-
-
Method Details
-
flags
public byte flags()Returns the flags that this Potion has.- See Also:
-
isAmbient
public boolean isAmbient()Returns whether this Potion is ambient (it came from a beacon) or not.- Returns:
trueif the Potion is ambient
-
hasParticles
public boolean hasParticles()Returns whether this Potion has particles or not.- Returns:
trueif the Potion has particles
-
hasIcon
public boolean hasIcon()Returns whether this Potion has an icon or not.- Returns:
trueif the Potion has an icon
-
hasBlend
public boolean hasBlend() -
sendAddPacket
Sends a packet that a potion effect has been applied to the entity.Used internally by
Entity.addEffect(Potion)- Parameters:
entity- the entity to add the effect to
-
sendRemovePacket
Sends a packet that a potion effect has been removed from the entity.Used internally by
Entity.removeEffect(PotionEffect)- Parameters:
entity- the entity to remove the effect from
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
effect
-
amplifier
-
duration
-