fixed autofishing and made it use SoundEffect instead of NamedSoundEffect
This commit is contained in:
@ -68,19 +68,19 @@ func onGameStart() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var soundListener = bot.PacketHandler{
|
var soundListener = bot.PacketHandler{
|
||||||
ID: packetid.NamedSoundEffect,
|
ID: packetid.SoundEffect,
|
||||||
Priority: 0,
|
Priority: 0,
|
||||||
F: func(p pk.Packet) error {
|
F: func(p pk.Packet) error {
|
||||||
var (
|
var (
|
||||||
SoundName pk.Identifier
|
SoundID pk.VarInt
|
||||||
SoundCategory pk.VarInt
|
SoundCategory pk.VarInt
|
||||||
X, Y, Z pk.Int
|
X, Y, Z pk.Int
|
||||||
Volume, Pitch pk.Float
|
Volume, Pitch pk.Float
|
||||||
)
|
)
|
||||||
if err := p.Scan(&SoundName, &SoundCategory, &X, &Y, &Z, &Volume, &Pitch); err != nil {
|
if err := p.Scan(&SoundID, &SoundCategory, &X, &Y, &Z, &Volume, &Pitch); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return onSound(string(SoundName), int(SoundCategory), float64(X)/8, float64(Y)/8, float64(Z)/8, float32(Volume), float32(Pitch))
|
return onSound(int(SoundID), int(SoundCategory), float64(X)/8, float64(Y)/8, float64(Z)/8, float32(Volume), float32(Pitch))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,8 +92,8 @@ func UseItem(hand int32) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//goland:noinspection SpellCheckingInspection
|
//goland:noinspection SpellCheckingInspection
|
||||||
func onSound(name string, category int, x, y, z float64, volume, pitch float32) error {
|
func onSound(id int, category int, x, y, z float64, volume, pitch float32) error {
|
||||||
if name == "entity.fishing_bobber.splash" {
|
if id == 369 {
|
||||||
if err := UseItem(0); err != nil { //retrieve
|
if err := UseItem(0); err != nil { //retrieve
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user