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:
NetworkBuffer.Writer
,SendablePacket
,ServerPacket
,ServerPacket.Play
public record DamageEventPacket(int targetEntityId, int damageTypeId, int sourceEntityId, int sourceDirectId, @Nullable Point sourcePos)
extends Record
implements ServerPacket.Play
See https://wiki.vg/Protocol#Damage_Event 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
-
Constructor Summary
ConstructorDescriptionDamageEventPacket
(int targetEntityId, int damageTypeId, int sourceEntityId, int sourceDirectId, @Nullable Point sourcePos) Creates an instance of aDamageEventPacket
record class.DamageEventPacket
(@NotNull NetworkBuffer reader) -
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
playId()
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.void
write
(@NotNull NetworkBuffer writer) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minestom.server.network.packet.server.ServerPacket
getId
-
Constructor Details
-
DamageEventPacket
-
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
-
playId
public int playId()- Specified by:
playId
in interfaceServerPacket.Play
-
write
- Specified by:
write
in interfaceNetworkBuffer.Writer
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
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
Returns the value of thesourcePos
record component.- Returns:
- the value of the
sourcePos
record component
-