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 entity, DamageSource source) -
Method Summary
Modifier and TypeMethodDescriptionintentityId()Returns the value of theentityIdrecord component.final booleanIndicates whether some other object is "equal to" this one.voidhandle(ClientGamePacketListener listener) Passes this Packet on to the PacketListener for processing.final inthashCode()Returns a hash code value for this object.private static intintReturns 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 output) private static voidwriteOptionalEntityId(FriendlyByteBuf output, int id) Methods inherited from interface 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
-
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
Description copied from interface:PacketPasses this Packet on to the PacketListener for processing.- Specified by:
handlein interfacePacket<ClientGamePacketListener>
-
getSource
-
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. -
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
-