mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-26 09:55:26 +02:00
Merge 04745264ed
into 00127506b1
This commit is contained in:
commit
724e6e1c27
2 changed files with 8 additions and 0 deletions
|
@ -42,6 +42,9 @@ const settings = {
|
|||
"verbose_commands": true, // show full command syntax
|
||||
"narrate_behavior": true, // chat simple automatic actions ('Picking up item!')
|
||||
"chat_bot_messages": true, // publicly chat messages to other bots
|
||||
|
||||
"block_place_delay": 10, // delay between placing blocks (ms) if using newAction. helps avoid bot being kicked by anti-cheat mechanisms on servers.
|
||||
|
||||
"log_all_prompts": false, // log ALL prompts to file
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import * as mc from "../../utils/mcdata.js";
|
|||
import * as world from "./world.js";
|
||||
import pf from 'mineflayer-pathfinder';
|
||||
import Vec3 from 'vec3';
|
||||
import settings from "../../../settings.js";
|
||||
|
||||
|
||||
export function log(bot, message) {
|
||||
|
@ -533,6 +534,7 @@ export async function breakBlockAt(bot, x, y, z) {
|
|||
let block = bot.blockAt(Vec3(x, y, z));
|
||||
if (block.name !== 'air' && block.name !== 'water' && block.name !== 'lava') {
|
||||
if (bot.modes.isOn('cheat')) {
|
||||
await new Promise(resolve => setTimeout(resolve, settings.block_place_delay || 10));
|
||||
let msg = '/setblock ' + Math.floor(x) + ' ' + Math.floor(y) + ' ' + Math.floor(z) + ' air';
|
||||
bot.chat(msg);
|
||||
log(bot, `Used /setblock to break block at ${x}, ${y}, ${z}.`);
|
||||
|
@ -629,11 +631,14 @@ export async function placeBlock(bot, blockType, x, y, z, placeOn='bottom', dont
|
|||
if (blockType.includes('stairs')) {
|
||||
blockType += `[facing=${face}]`;
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, settings.block_place_delay || 10));
|
||||
let msg = '/setblock ' + Math.floor(x) + ' ' + Math.floor(y) + ' ' + Math.floor(z) + ' ' + blockType;
|
||||
bot.chat(msg);
|
||||
if (blockType.includes('door'))
|
||||
await new Promise(resolve => setTimeout(resolve, settings.block_place_delay || 10));
|
||||
bot.chat('/setblock ' + Math.floor(x) + ' ' + Math.floor(y+1) + ' ' + Math.floor(z) + ' ' + blockType + '[half=upper]');
|
||||
if (blockType.includes('bed'))
|
||||
await new Promise(resolve => setTimeout(resolve, settings.block_place_delay || 10));
|
||||
bot.chat('/setblock ' + Math.floor(x) + ' ' + Math.floor(y) + ' ' + Math.floor(z-1) + ' ' + blockType + '[part=head]');
|
||||
log(bot, `Used /setblock to place ${blockType} at ${target_dest}.`);
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue