Skip to content

Commit

Permalink
protocol/event.go: Fixed two missing events (waxing and sculk sensors…
Browse files Browse the repository at this point in the history
…). (#150)
  • Loading branch information
olebeck committed Sep 5, 2022
1 parent a44a047 commit 2bbe187
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
27 changes: 27 additions & 0 deletions minecraft/protocol/events.go
Expand Up @@ -390,3 +390,30 @@ type ExtractHoneyEventData struct{}

// Marshal ...
func (*ExtractHoneyEventData) Marshal(IO) {}

const (
WaxNotOxidised = uint16(0xa609)
WaxExposed = uint16(0xa809)
WaxWeathered = uint16(0xaa09)
WaxOxidised = uint16(0xac09)
UnWaxNotOxidised = uint16(0xae09)
UnWaxExposed = uint16(0xb009)
UnWaxWeathered = uint16(0xb209)
UnWaxOxidised = uint16(0xfa0a)
)

// WaxedOrUnwaxedCopperEventData is an event sent by the server when a copper block is waxed or unwaxed.
type WaxedOrUnwaxedCopperEventData struct {
Type uint16
}

// Marshal ...
func (w *WaxedOrUnwaxedCopperEventData) Marshal(r IO) {
r.Uint16(&w.Type)
}

// SneakCloseToSculkSensorEventData is an event sent by the server when a player sneaks close to an sculk block.
type SneakCloseToSculkSensorEventData struct{}

// Marshal ...
func (u *SneakCloseToSculkSensorEventData) Marshal(r IO) {}
4 changes: 4 additions & 0 deletions minecraft/protocol/packet/event.go
Expand Up @@ -118,6 +118,10 @@ func (pk *Event) Unmarshal(r *protocol.Reader) {
pk.EventData = &protocol.MovementCorrectedEventData{}
case EventTypeExtractHoney:
pk.EventData = &protocol.ExtractHoneyEventData{}
case EventTypePlayerWaxedOrUnwaxedCopper:
pk.EventData = &protocol.WaxedOrUnwaxedCopperEventData{}
case EventTypeSneakCloseToSculkSensor:
pk.EventData = &protocol.SneakCloseToSculkSensorEventData{}
}

pk.EventData.Marshal(r)
Expand Down

0 comments on commit 2bbe187

Please sign in to comment.