You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to check line of sight to a block with mineflayer's bot.findBlock, you have to set checkExtraInfo in the matching options to true, but BehaviorFindBlock doesn't do that and thus it doesn't work. Here is a proof of concept fix:
class BehaviorCustomFindBlock implements sm.StateBehavior {
active = false;
stateName = 'customFindBlock';
blocks:any[]
bot:mf.Bot;
isFinished = false
targets:any = {}
constructor(bot:mf.Bot,targets) {
this.bot = bot
this.targets = targets
}
onStateEntered(): void
{
this.targets.position = this.targets.position = this.bot.findBlock({
matching:(block)=>this.blocks.indexOf(block.stateId)!==-1 && bot.canSeeBlock(block),
useExtraInfo:true,
maxDistance:32,
}).position
}
}
The text was updated successfully, but these errors were encountered:
In order to check line of sight to a block with mineflayer's bot.findBlock, you have to set checkExtraInfo in the matching options to true, but BehaviorFindBlock doesn't do that and thus it doesn't work. Here is a proof of concept fix:
class BehaviorCustomFindBlock implements sm.StateBehavior {
active = false;
stateName = 'customFindBlock';
blocks:any[]
bot:mf.Bot;
isFinished = false
targets:any = {}
constructor(bot:mf.Bot,targets) {
this.bot = bot
this.targets = targets
}
onStateEntered(): void
{
this.targets.position = this.targets.position = this.bot.findBlock({
matching:(block)=>this.blocks.indexOf(block.stateId)!==-1 && bot.canSeeBlock(block),
useExtraInfo:true,
maxDistance:32,
}).position
}
}
The text was updated successfully, but these errors were encountered: