Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix waxing event panicing #150

Merged
merged 4 commits into from Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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