Record Class ClientboundDamageEventPacket
java.lang.Object
java.lang.Record
net.minecraft.network.protocol.game.ClientboundDamageEventPacket
- All Implemented Interfaces:
Packet<ClientGamePacketListener>
public record ClientboundDamageEventPacket(int entityId, Holder<DamageType> sourceType, int sourceCauseId, int sourceDirectId, Optional<Vec3> sourcePosition)
extends Record
implements Packet<ClientGamePacketListener>
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
The field for theentityId
record component.private final int
The field for thesourceCauseId
record component.private final int
The field for thesourceDirectId
record component.The field for thesourcePosition
record component.private final Holder
<DamageType> The field for thesourceType
record component.static final StreamCodec
<RegistryFriendlyByteBuf, ClientboundDamageEventPacket> -
Constructor Summary
ModifierConstructorDescriptionClientboundDamageEventPacket
(int entityId, Holder<DamageType> sourceType, int sourceCauseId, int sourceDirectId, Optional<Vec3> sourcePosition) Creates an instance of aClientboundDamageEventPacket
record class.private
ClientboundDamageEventPacket
(Entity p_270474_, DamageSource p_270781_) -
Method Summary
Modifier and TypeMethodDescriptionint
entityId()
Returns the value of theentityId
record component.final boolean
Indicates whether some other object is "equal to" this one.void
handle
(ClientGamePacketListener p_270510_) final int
hashCode()
Returns a hash code value for this object.private static int
readOptionalEntityId
(FriendlyByteBuf p_270462_) int
Returns the value of thesourceCauseId
record component.int
Returns the value of thesourceDirectId
record component.Returns the value of thesourcePosition
record component.Returns the value of thesourceType
record component.final String
toString()
Returns a string representation of this record class.type()
private void
write
(RegistryFriendlyByteBuf p_330396_) private static void
writeOptionalEntityId
(FriendlyByteBuf p_270812_, int p_270852_) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.network.protocol.Packet
isSkippable, isTerminal
-
Field Details
-
entityId
private final int entityIdThe field for theentityId
record component. -
sourceType
The field for thesourceType
record component. -
sourceCauseId
private final int sourceCauseIdThe field for thesourceCauseId
record component. -
sourceDirectId
private final int sourceDirectIdThe field for thesourceDirectId
record component. -
sourcePosition
The field for thesourcePosition
record component. -
STREAM_CODEC
-
-
Constructor Details
-
ClientboundDamageEventPacket
-
ClientboundDamageEventPacket
-
ClientboundDamageEventPacket
public ClientboundDamageEventPacket(int entityId, Holder<DamageType> sourceType, int sourceCauseId, int sourceDirectId, Optional<Vec3> sourcePosition) Creates an instance of aClientboundDamageEventPacket
record class.- Parameters:
entityId
- the value for theentityId
record componentsourceType
- the value for thesourceType
record componentsourceCauseId
- the value for thesourceCauseId
record componentsourceDirectId
- the value for thesourceDirectId
record componentsourcePosition
- the value for thesourcePosition
record component
-
-
Method Details
-
writeOptionalEntityId
-
readOptionalEntityId
-
write
-
type
- Specified by:
type
in interfacePacket<ClientGamePacketListener>
-
handle
- Specified by:
handle
in interfacePacket<ClientGamePacketListener>
-
getSource
-
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 '=='. -
entityId
public int entityId()Returns the value of theentityId
record component.- Returns:
- the value of the
entityId
record component
-
sourceType
Returns the value of thesourceType
record component.- Returns:
- the value of the
sourceType
record component
-
sourceCauseId
public int sourceCauseId()Returns the value of thesourceCauseId
record component.- Returns:
- the value of the
sourceCauseId
record component
-
sourceDirectId
public int sourceDirectId()Returns the value of thesourceDirectId
record component.- Returns:
- the value of the
sourceDirectId
record component
-
sourcePosition
Returns the value of thesourcePosition
record component.- Returns:
- the value of the
sourcePosition
record component
-