mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-23 15:47:57 -05:00
remove fill core using chat + improve other things
i am lazy but now i removed it
This commit is contained in:
parent
4c0d1881b7
commit
14e677e5a3
3 changed files with 41 additions and 51 deletions
|
@ -8,6 +8,7 @@ module.exports = {
|
|||
'useChat': false,
|
||||
'core': {
|
||||
'layers': 1,
|
||||
'refillInterval': 500,
|
||||
},
|
||||
'reconnectTimeout': 1000 * 6,
|
||||
'discord': {
|
||||
|
|
14
index.js
14
index.js
|
@ -363,13 +363,9 @@ function main() {
|
|||
// onerror('end event: ' + util.inspect(reason).replaceAll('runner', 'chayapak1'));
|
||||
});
|
||||
|
||||
bot._client.on('keep_alive', (packet) => {
|
||||
bot.write('keep_alive', {keepAliveId: packet.keepAliveId});
|
||||
});
|
||||
bot._client.on('keep_alive', (packet) => bot.write('keep_alive', {keepAliveId: packet.keepAliveId}));
|
||||
|
||||
bot._client.on('tab_complete', (packet) => {
|
||||
bot.tabcompleteplayers = packet.matches;
|
||||
});
|
||||
bot._client.on('tab_complete', (packet) => bot.tabcompleteplayers = packet.matches);
|
||||
|
||||
bot._client.on('kick_disconnect', function(data) {
|
||||
const parsed = JSON.parse(data.reason);
|
||||
|
@ -383,9 +379,9 @@ function main() {
|
|||
});
|
||||
|
||||
bot._client.on('error', function() {
|
||||
// console.log('Error: ' + util.inspect(error));
|
||||
// channel.send('Error: ' + util.inspect(error));
|
||||
// onerror('error event: ' + util.inspect(err).replaceAll('runner', 'chayapak1'));
|
||||
// console.log('Error: ' + util.inspect(error));
|
||||
// channel.send('Error: ' + util.inspect(error));
|
||||
// onerror('error event: ' + util.inspect(err).replaceAll('runner', 'chayapak1'));
|
||||
});
|
||||
|
||||
process.on('uncaughtException', (error) => {
|
||||
|
|
|
@ -52,15 +52,15 @@ function inject(bot) {
|
|||
return;
|
||||
}
|
||||
},
|
||||
fillCore(useCore) {
|
||||
const fillCommand = `/minecraft:fill ${core.start.x} ${core.start.y} ${core.start.z} ${core.end.x} ${core.end.y} ${core.end.z} command_block{CustomName:'{"text":"ChomeNS Bot Core","color":"yellow"}'}`;
|
||||
if (useCore==true) {
|
||||
bot.core.run(fillCommand);
|
||||
} else {
|
||||
bot.chat(fillCommand);
|
||||
}
|
||||
bot.emit('core_filled');
|
||||
},
|
||||
// fillCore(useCore) {
|
||||
// const fillCommand = `/minecraft:fill ${core.start.x} ${core.start.y} ${core.start.z} ${core.end.x} ${core.end.y} ${core.end.z} command_block{CustomName:'{"text":"ChomeNS Bot Core","color":"yellow"}'}`;
|
||||
// if (useCore==true) {
|
||||
// bot.core.run(fillCommand);
|
||||
// } else {
|
||||
// bot.chat(fillCommand);
|
||||
// }
|
||||
// bot.emit('core_filled');
|
||||
// },
|
||||
};
|
||||
|
||||
bot._client.on('position', (position) => {
|
||||
|
@ -77,9 +77,31 @@ function inject(bot) {
|
|||
// if (core.start===packet.chunkCoordinates || core.end===packet.chunkCoordinates) fillCore();
|
||||
// });
|
||||
|
||||
// bot.on('position', fillCore);
|
||||
|
||||
bot.on('end', () => {
|
||||
clearInterval(interval);
|
||||
});
|
||||
|
||||
fillCore();
|
||||
|
||||
bot.core = core;
|
||||
|
||||
function fillCore() {
|
||||
core.start = new Vec3(
|
||||
Math.floor(bot.position.x / 16) * 16,
|
||||
0 /* bot.position.y */,
|
||||
Math.floor(bot.position.z / 16) * 16,
|
||||
).floor();
|
||||
core.end = core.start.clone().translate(16, layers, 16).subtract(new Vec3(1, 1, 1));
|
||||
|
||||
// core.fillCore();
|
||||
}
|
||||
|
||||
const interval = setInterval(async () => {
|
||||
try {
|
||||
const fillCommand = `/minecraft:fill ${core.start.x} ${core.start.y} ${core.start.z} ${core.end.x} ${core.end.y} ${core.end.z} command_block{CustomName:'{"text":"ChomeNS Bot Core","color":"yellow"}'}`;
|
||||
const location = {x: Math.floor(bot.position.x), y: Math.floor(bot.position.y) - 1, z: Math.floor(bot.position.z)};
|
||||
bot.write('set_creative_slot', {
|
||||
slot: 36,
|
||||
item: {
|
||||
|
@ -96,22 +118,14 @@ function inject(bot) {
|
|||
await sleep(50);
|
||||
bot.write('block_dig', {
|
||||
status: 0,
|
||||
location: {
|
||||
x: bot.position.x,
|
||||
y: bot.position.y - 1,
|
||||
z: bot.position.z,
|
||||
},
|
||||
location,
|
||||
face: 1,
|
||||
});
|
||||
await sleep(50);
|
||||
bot.write('block_place', {
|
||||
location: {
|
||||
x: bot.position.x,
|
||||
y: bot.position.y - 1,
|
||||
z: bot.position.z,
|
||||
},
|
||||
hand: 0,
|
||||
location,
|
||||
direction: 1,
|
||||
hand: 0,
|
||||
cursorX: 0.5,
|
||||
cursorY: 0.5,
|
||||
cursorZ: 0.5,
|
||||
|
@ -120,30 +134,9 @@ function inject(bot) {
|
|||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
}, 500);
|
||||
|
||||
bot.on('position', fillCore);
|
||||
|
||||
bot.on('end', () => {
|
||||
clearInterval(interval);
|
||||
});
|
||||
|
||||
fillCore();
|
||||
|
||||
bot.core = core;
|
||||
}, config.core.refillInterval);
|
||||
|
||||
return core;
|
||||
|
||||
function fillCore() {
|
||||
core.start = new Vec3(
|
||||
Math.floor(bot.position.x / 16) * 16,
|
||||
0 /* bot.position.y */,
|
||||
Math.floor(bot.position.z / 16) * 16,
|
||||
).floor();
|
||||
core.end = core.start.clone().translate(16, layers, 16).subtract(new Vec3(1, 1, 1));
|
||||
|
||||
core.fillCore();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue