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
FieldsModifier and TypeFieldDescriptionprivate final intThe field for theentityIdrecord component.private final intThe field for thesourceCauseIdrecord component.private final intThe field for thesourceDirectIdrecord component.The field for thesourcePositionrecord component.private final Holder<DamageType> The field for thesourceTyperecord component.static final StreamCodec<RegistryFriendlyByteBuf, ClientboundDamageEventPacket> -
Constructor Summary
ConstructorsModifierConstructorDescriptionClientboundDamageEventPacket(int entityId, Holder<DamageType> sourceType, int sourceCauseId, int sourceDirectId, Optional<Vec3> sourcePosition) Creates an instance of aClientboundDamageEventPacketrecord class.privateClientboundDamageEventPacket(Entity p_270474_, DamageSource p_270781_) -
Method Summary
Modifier and TypeMethodDescriptionintentityId()Returns the value of theentityIdrecord component.final booleanIndicates whether some other object is "equal to" this one.voidhandle(ClientGamePacketListener p_270510_) final inthashCode()Returns a hash code value for this object.private static intreadOptionalEntityId(FriendlyByteBuf p_270462_) intReturns the value of thesourceCauseIdrecord component.intReturns the value of thesourceDirectIdrecord component.Returns the value of thesourcePositionrecord component.Returns the value of thesourceTyperecord component.final StringtoString()Returns a string representation of this record class.type()private voidwrite(RegistryFriendlyByteBuf p_321775_) private static voidwriteOptionalEntityId(FriendlyByteBuf p_270812_, int p_270852_) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.network.protocol.Packet
isSkippable, isTerminal
-
Field Details
-
entityId
private final int entityIdThe field for theentityIdrecord component. -
sourceType
The field for thesourceTyperecord component. -
sourceCauseId
private final int sourceCauseIdThe field for thesourceCauseIdrecord component. -
sourceDirectId
private final int sourceDirectIdThe field for thesourceDirectIdrecord component. -
sourcePosition
The field for thesourcePositionrecord 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 aClientboundDamageEventPacketrecord class.- Parameters:
entityId- the value for theentityIdrecord componentsourceType- the value for thesourceTyperecord componentsourceCauseId- the value for thesourceCauseIdrecord componentsourceDirectId- the value for thesourceDirectIdrecord componentsourcePosition- the value for thesourcePositionrecord component
-
-
Method Details
-
writeOptionalEntityId
-
readOptionalEntityId
-
write
-
type
- Specified by:
typein interfacePacket<ClientGamePacketListener>
-
handle
- Specified by:
handlein 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 theentityIdrecord component.- Returns:
- the value of the
entityIdrecord component
-
sourceType
Returns the value of thesourceTyperecord component.- Returns:
- the value of the
sourceTyperecord component
-
sourceCauseId
public int sourceCauseId()Returns the value of thesourceCauseIdrecord component.- Returns:
- the value of the
sourceCauseIdrecord component
-
sourceDirectId
public int sourceDirectId()Returns the value of thesourceDirectIdrecord component.- Returns:
- the value of the
sourceDirectIdrecord component
-
sourcePosition
Returns the value of thesourcePositionrecord component.- Returns:
- the value of the
sourcePositionrecord component
-