Record Class DamageEventPacket
java.lang.Object
java.lang.Record
net.minestom.server.network.packet.server.play.DamageEventPacket
- Record Components:
targetEntityId- ID of the entity being damageddamageType- the damage typesourceEntityId- the ID of the entity responsible for the damage, ornullwhen there is nonesourceDirectId- the ID of the entity that directly dealt the damage, such as a projectile, ornullwhen there is none. For a melee hit this is the same assourceEntityIdsourcePos- null if there is no source position, otherwise the position of the source
- All Implemented Interfaces:
Packet, SendablePacket, ServerPacket, ServerPacket.Play
public record DamageEventPacket(int targetEntityId, RegistryKey<DamageType> damageType, @Nullable Integer sourceEntityId, @Nullable Integer sourceDirectId, @Nullable Point sourcePos)
extends Record
implements ServerPacket.Play
See the Minecraft wiki for more info.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ServerPacket
ServerPacket.ComponentHolding, ServerPacket.Configuration, ServerPacket.Handshake, ServerPacket.Login, ServerPacket.Play, ServerPacket.Status -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDamageEventPacket(int targetEntityId, RegistryKey<DamageType> damageType, @Nullable Integer sourceEntityId, @Nullable Integer sourceDirectId, @Nullable Point sourcePos) Creates an instance of aDamageEventPacketrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedamageTyperecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thesourceDirectIdrecord component.Returns the value of thesourceEntityIdrecord component.Returns the value of thesourcePosrecord component.intReturns the value of thetargetEntityIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
SERIALIZER
-
-
Constructor Details
-
DamageEventPacket
public DamageEventPacket(int targetEntityId, RegistryKey<DamageType> damageType, @Nullable @Nullable Integer sourceEntityId, @Nullable @Nullable Integer sourceDirectId, @Nullable @Nullable Point sourcePos) Creates an instance of aDamageEventPacketrecord class.- Parameters:
targetEntityId- the value for thetargetEntityIdrecord componentdamageType- the value for thedamageTyperecord componentsourceEntityId- the value for thesourceEntityIdrecord componentsourceDirectId- the value for thesourceDirectIdrecord componentsourcePos- the value for thesourcePosrecord component
-
-
Method Details
-
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. -
targetEntityId
public int targetEntityId()Returns the value of thetargetEntityIdrecord component.- Returns:
- the value of the
targetEntityIdrecord component
-
damageType
Returns the value of thedamageTyperecord component.- Returns:
- the value of the
damageTyperecord component
-
sourceEntityId
Returns the value of thesourceEntityIdrecord component.- Returns:
- the value of the
sourceEntityIdrecord component
-
sourceDirectId
Returns the value of thesourceDirectIdrecord component.- Returns:
- the value of the
sourceDirectIdrecord component
-
sourcePos
-