mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-12-01 22:55:40 -05:00
v7.0.3, build: 2120
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const mcData = require('minecraft-data')('1.20.2');
|
||||
const nbt = require('prismarine-nbt');
|
||||
|
||||
const sleep = require('../util/sleep');
|
||||
function inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -24,9 +24,14 @@ function inject (context) {
|
||||
const { start, end } = bot.core.area
|
||||
|
||||
if (!pos) return
|
||||
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
|
||||
if (bot.options.mode === "creayun") return;
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} command_block`
|
||||
} else {
|
||||
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
|
||||
}
|
||||
|
||||
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
|
||||
bot.chat.command(`${command}`)
|
||||
},
|
||||
|
||||
@@ -36,7 +41,6 @@ function inject (context) {
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!pos) return;
|
||||
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
|
||||
|
||||
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
|
||||
|
||||
@@ -64,9 +68,9 @@ function inject (context) {
|
||||
hand: 0,
|
||||
location: itemPosition,
|
||||
direction: 0,
|
||||
cursorX: 0.1,
|
||||
cursorX: 0,
|
||||
cursorY: 0,
|
||||
cursorZ: 0.1,
|
||||
cursorZ: 0,
|
||||
insideBlock: false
|
||||
});
|
||||
|
||||
@@ -95,7 +99,7 @@ function inject (context) {
|
||||
z: pos.z
|
||||
}
|
||||
|
||||
if (config.core.itemRefill === true) {
|
||||
if (config.core.itemRefill) {
|
||||
bot.core.itemRefill();
|
||||
} else {
|
||||
bot.core.chatRefill();
|
||||
@@ -137,8 +141,17 @@ function inject (context) {
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!location) return;
|
||||
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") {
|
||||
return
|
||||
if (bot.options.mode === "creayun") {
|
||||
return;
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot._client.write('update_command_block', {
|
||||
command: command.substring(0, 32767),
|
||||
location: location,
|
||||
mode: 2,
|
||||
flags: 0b101,
|
||||
});
|
||||
|
||||
bot.core.incrementCurrentBlock();
|
||||
} else {
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
bot._client.write('update_command_block', {
|
||||
@@ -161,6 +174,73 @@ function inject (context) {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async runTracked (command) {
|
||||
const location = bot.core.itemPosition;
|
||||
let transactionId = Math.floor(Math.random() * 10000);
|
||||
|
||||
bot._client.write('set_creative_slot', {
|
||||
slot: 36,
|
||||
item: {
|
||||
present: true,
|
||||
itemId: mcData.itemsByName.repeating_command_block.id,
|
||||
itemCount: 1,
|
||||
nbtData: nbt.comp({
|
||||
BlockEntityTag: nbt.comp({
|
||||
CustomName: nbt.string(JSON.stringify(config.core.itemName))
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
bot._client.write('block_dig', {
|
||||
status: 0,
|
||||
location: {
|
||||
x: location.x,
|
||||
y: location.y - 1,
|
||||
z: location.z
|
||||
},
|
||||
face: 0
|
||||
});
|
||||
|
||||
bot._client.write('block_place', {
|
||||
hand: 0,
|
||||
location,
|
||||
direction: 0,
|
||||
cursorX: 0,
|
||||
cursorY: 0,
|
||||
cursorZ: 0,
|
||||
insideBlock: false
|
||||
});
|
||||
|
||||
bot._client.write('update_command_block', {
|
||||
command: command.substring(0, 32767),
|
||||
location: {
|
||||
x: location.x,
|
||||
y: location.y,
|
||||
z: location.z
|
||||
},
|
||||
flags: 0b101,
|
||||
mode: 1
|
||||
});
|
||||
|
||||
await sleep(100);
|
||||
|
||||
bot._client.write('query_block_nbt', { location, transactionId });
|
||||
|
||||
bot.on('packet.nbt_query_response', (data) => {
|
||||
try {
|
||||
if (data.transactionId == transactionId) {
|
||||
|
||||
if (data?.nbt?.value?.LastOutput) {
|
||||
bot.tellraw("@a", JSON.parse(data.nbt.value.LastOutput.value));
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
require('../util/core_util')(bot, config, options);
|
||||
|
||||
Reference in New Issue
Block a user