completely forgot about refillcore

This commit is contained in:
ChomeNS 2022-10-18 08:40:46 +07:00
parent 26fe299201
commit 5579733b6f
2 changed files with 42 additions and 43 deletions

View file

@ -5,6 +5,6 @@ module.exports = {
usage: '',
trusted: 0,
execute: function(bot) {
bot.core.fillCore();
bot.core.loopPlace();
},
};

View file

@ -52,6 +52,45 @@ function inject(bot) {
return;
}
},
async loopPlace() {
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: {
present: true,
itemId: mcData.itemsByName['repeating_command_block'].id,
itemCount: 64,
nbtData: nbt.comp({BlockEntityTag: nbt.comp({
Command: nbt.string(fillCommand),
auto: nbt.byte(1),
TrackOutput: nbt.byte(0),
})}),
},
});
await sleep(50);
bot.write('block_dig', {
status: 0,
location,
face: 1,
});
await sleep(50);
bot.write('block_place', {
location,
direction: 1,
hand: 0,
cursorX: 0.5,
cursorY: 0.5,
cursorZ: 0.5,
insideBlock: false,
});
fillCore();
} catch (e) {
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) {
@ -98,49 +137,9 @@ function inject(bot) {
// core.fillCore();
}
async function loopPlace() {
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: {
present: true,
itemId: mcData.itemsByName['repeating_command_block'].id,
itemCount: 64,
nbtData: nbt.comp({BlockEntityTag: nbt.comp({
Command: nbt.string(fillCommand),
auto: nbt.byte(1),
TrackOutput: nbt.byte(0),
})}),
},
});
await sleep(50);
bot.write('block_dig', {
status: 0,
location,
face: 1,
});
await sleep(50);
bot.write('block_place', {
location,
direction: 1,
hand: 0,
cursorX: 0.5,
cursorY: 0.5,
cursorZ: 0.5,
insideBlock: false,
});
fillCore();
} catch (e) {
return;
}
}
loopPlace();
bot.core.loopPlace();
const interval = setInterval(() => {
loopPlace();
bot.core.loopPlace();
}, config.core.refillInterval);
return core;