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 damageddamageTypeId
- ID of damage typesourceEntityId
- 0 if there is no source entity, otherwise it is entityId + 1sourceDirectId
- 0 if there is no direct source. For direct attacks (e.g. melee), this is the same as sourceEntityId. For indirect attacks (e.g. projectiles), this is the projectile entity id + 1sourcePos
- null if there is no source position, otherwise the position of the source
- All Implemented Interfaces:
SendablePacket
,ServerPacket
,ServerPacket.Play
public record DamageEventPacket(int targetEntityId, int damageTypeId, int sourceEntityId, int 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 net.minestom.server.network.packet.server.ServerPacket
ServerPacket.ComponentHolding, ServerPacket.Configuration, ServerPacket.Login, ServerPacket.Play, ServerPacket.Status
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDamageEventPacket
(int targetEntityId, int damageTypeId, int sourceEntityId, int sourceDirectId, @Nullable Point sourcePos) Creates an instance of aDamageEventPacket
record class. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the value of thedamageTypeId
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
Returns the value of thesourceDirectId
record component.int
Returns the value of thesourceEntityId
record component.@Nullable Point
Returns the value of thesourcePos
record component.int
Returns the value of thetargetEntityId
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
SERIALIZER
-
-
Constructor Details
-
DamageEventPacket
public DamageEventPacket(int targetEntityId, int damageTypeId, int sourceEntityId, int sourceDirectId, @Nullable @Nullable Point sourcePos) Creates an instance of aDamageEventPacket
record class.- Parameters:
targetEntityId
- the value for thetargetEntityId
record componentdamageTypeId
- the value for thedamageTypeId
record componentsourceEntityId
- the value for thesourceEntityId
record componentsourceDirectId
- the value for thesourceDirectId
record componentsourcePos
- the value for thesourcePos
record 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 thecompare
method from their corresponding wrapper classes. -
targetEntityId
public int targetEntityId()Returns the value of thetargetEntityId
record component.- Returns:
- the value of the
targetEntityId
record component
-
damageTypeId
public int damageTypeId()Returns the value of thedamageTypeId
record component.- Returns:
- the value of the
damageTypeId
record component
-
sourceEntityId
public int sourceEntityId()Returns the value of thesourceEntityId
record component.- Returns:
- the value of the
sourceEntityId
record component
-
sourceDirectId
public int sourceDirectId()Returns the value of thesourceDirectId
record component.- Returns:
- the value of the
sourceDirectId
record component
-
sourcePos
-