From c8c16cdc915798a6a7599b8dc3a3c58875841d83 Mon Sep 17 00:00:00 2001 From: Ermolay Date: Fri, 26 Aug 2022 12:13:11 +0300 Subject: [PATCH 1/2] Fix PlayerDiedEventData --- minecraft/protocol/events.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/minecraft/protocol/events.go b/minecraft/protocol/events.go index bf4cf75b..03fabdba 100644 --- a/minecraft/protocol/events.go +++ b/minecraft/protocol/events.go @@ -110,14 +110,28 @@ func (c *CauldronUsedEventData) Marshal(r IO) { type PlayerDiedEventData struct { // AttackerEntityID ... AttackerEntityID int32 + // AttackerVariant ... + AttackerVariant int32 // EntityDamageCause ... EntityDamageCause int32 + // InRaid ... + InRaid bool } // Marshal ... -func (p *PlayerDiedEventData) Marshal(r IO) { +func (p *PlayerDiedEventData) Marshal(w *Writer) { + w.Varint32(&p.AttackerEntityID) + w.Varint32(&p.AttackerVariant) + w.Varint32(&p.EntityDamageCause) + w.Bool(&p.InRaid) +} + +// Unmarshal ... +func (p *PlayerDiedEventData) Unmarshal(r *Reader) { r.Varint32(&p.AttackerEntityID) + r.Varint32(&p.AttackerVariant) r.Varint32(&p.EntityDamageCause) + r.Bool(&p.InRaid) } // BossKilledEventData is the event data sent when a boss dies. From 3693999ec8f5faa73f8c13a55cac19680dbfeed4 Mon Sep 17 00:00:00 2001 From: Ermolay <60964356+egor-erm@users.noreply.github.com> Date: Fri, 26 Aug 2022 12:46:43 +0300 Subject: [PATCH 2/2] Update events.go --- minecraft/protocol/events.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/minecraft/protocol/events.go b/minecraft/protocol/events.go index 03fabdba..3a301318 100644 --- a/minecraft/protocol/events.go +++ b/minecraft/protocol/events.go @@ -119,15 +119,7 @@ type PlayerDiedEventData struct { } // Marshal ... -func (p *PlayerDiedEventData) Marshal(w *Writer) { - w.Varint32(&p.AttackerEntityID) - w.Varint32(&p.AttackerVariant) - w.Varint32(&p.EntityDamageCause) - w.Bool(&p.InRaid) -} - -// Unmarshal ... -func (p *PlayerDiedEventData) Unmarshal(r *Reader) { +func (p *PlayerDiedEventData) Marshal(r IO) { r.Varint32(&p.AttackerEntityID) r.Varint32(&p.AttackerVariant) r.Varint32(&p.EntityDamageCause)