Skip to content

Bot not able to detect music disc being played, in mineflayer events #3688

@TwistyLime

Description

@TwistyLime
  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.29.0
  • server: vanilla/spigot/paper 1.21.3
  • node: v22.11.0

Detailed description of a problem

The event actionBar doesn't capture the event when a music disc is being player. When we play any music disc we get an actionbar text saying 'Now Playing ....', but it is not captured in the incident. Tried the message event and the message str event too, soundEffectHeard and hardcodedSoundEffectHeard, events too, the too doesn't capture the music disc sound effect being played.

Altho, I can detect if a music disc is being played using particle event, but it does not help with the type of music disc being played

What did you try yet?

Did you try any method from the API? Yes
Did you try any example? Any error from those? Tried but same issue, no music disc event captured

Your current code

const mineflayer = require('mineflayer');

const bot = mineflayer.createBot({
    host: 'localhost',
    port: 25565,
    username: 'Bot',
});

bot.on('soundEffectHeard', (soundName, position, volume, pitch) => {
  const { x, y, z } = position
  console.log(`Heard sound: ${soundName} at ${x}, ${y}, ${z}`)
})

bot.on('noteHeard', (block, instrument, pitch) => {
  console.log(`Heard note block: ${instrument.name} at pitch ${pitch}`)
})

bot.on('hardcodedSoundEffectHeard', (soundId, soundCategory, position, volume, pitch) => {
  const { x, y, z } = position
  console.log(`Heard hardcoded sound: ${soundId} (${soundCategory}) at ${x}, ${y}, ${z}`)
})

bot.on('title',(text,type)=>{
    console.log(`Title: ${text}, type: ${type}`);
})

bot.on('actionBar',(jsonMsg)=>{
    console.log(`Captured actionbar event: ${jsonMsg}`);
})

bot.on('message',(jsonMsg, position)=>{
    console.log(`Captured message event: ${jsonMsg}`);
})

bot.on('messagestr',(message,postion, jsonMsg)=>{
    console.log(`Captured messagestr event: ${jsonMsg}, ${message}`);
})

Expected behavior

The music disc event should be captured in either of sound events, also the actionbar text of the disc being played should be detected by actionBar event

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stage1just created by someone new to the project, we don't know yet if it deserves an implementation / a fpossible bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions