Skip to content

Commit

Permalink
Merge branch 'master' into mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqtoday authored May 22, 2024
2 parents 4a917ac + ec76468 commit a582548
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 9 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,14 @@ export interface Bot extends TypedEmitter<BotEvents> {
times?: number
) => Promise<void>

setCommandBlock: (pos: Vec3, command: string, trackOutput: boolean) => void

export interface CommandBlockOptions {
mode: number,
trackOutput: boolean,
conditional: boolean,
alwaysActive: boolean
}
export function setCommandBlock(pos: Vec3, command: string, options: CommandBlockOptions) => void

clickWindow: (
slot: number,
Expand Down Expand Up @@ -457,6 +464,7 @@ export interface GameState {
dimension: Dimension
difficulty: Difficulty
maxPlayers: number
serverBrand: string
}

export type LevelType =
Expand Down
5 changes: 3 additions & 2 deletions lib/plugins/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,10 @@ function inject (bot, { version, storageBuilder, hideErrors }) {
bot.emit('error', new Error('too many lines for sign text'))
return
}

for (let i = 0; i < lines.length; ++i) {
if (lines[i].length > 15) {
bot.emit('error', new Error('signs have max line length 15'))
if (lines[i].length > 45) {
bot.emit('error', new Error('Signs have a maximum of 45 characters per line'))
return
}
}
Expand Down
7 changes: 1 addition & 6 deletions lib/plugins/ray_trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ module.exports = (bot) => {
}

bot.blockAtCursor = (maxDistance = 256, matcher = null) => {
const { position, height, pitch, yaw } = bot.entity

const eyePosition = position.offset(0, height, 0)
const viewDirection = getViewDirection(pitch, yaw)

return bot.world.raycast(eyePosition, viewDirection, maxDistance, matcher)
return bot.blockAtEntityCursor(bot.entity, maxDistance, matcher)
}

bot.entityAtCursor = (maxDistance = 3.5) => {
Expand Down

0 comments on commit a582548

Please sign in to comment.