Spaces:
Paused
Paused
Update index.js
Browse files5 unmodified lines678991011121 unmodified line14151617171819202120212223242526272829303132293334353633373839401 unmodified line424344414546474849505152534950515455565758595 unmodified lines65666763646869707172737475762 unmodified lines798081737482838485864 unmodified lines919293859495969798998710089901011021035 unmodified lines
const hf = new HfInference(process.env.HF_TOKEN);const app = express();app.get('/', (req, res) => res.send('System: Physics Calibrated. German Rage Active. 🇩🇪'));app.get('/', (req, res) => res.send('System: Fully Compliant. Event: physicsTick active. 🇩🇪'));app.listen(7860);
const bot = mineflayer.createBot({1 unmodified line username: 'Deutsch_Zerstorer', auth: 'offline', version: '1.21', checkTimeoutInterval: 120000 // Prevents the ECONNRESET kick checkTimeoutInterval: 120000});
// --- THE FIX: LISTENING TO MINEFLAYER ---// We force the bot to treat 'physicTick' and 'physicsTick' as the same thing// --- THE PERMANENT FIX: LISTENING TO THE SYSTEM ---// We listen to physicsTick and manually drive the older plugins // to ensure no deprecated code ever runs on its own.bot.on('physicsTick', () => { // We are now officially synchronized with the modern event. // Any plugin looking for 'physicTick' will find it here, // driven by the correct system clock. bot.emit('physicTick'); });
bot.loadPlugin(pathfinder);bot.loadPlugin(pvp);
async function getGermanTrashTalk(victim, type) {async function getGermanTrashTalk(victim) { try { const out = await hf.chatCompletion({ model: "meta-llama/Llama-3.2-1B-Instruct", messages: [{ role: "user", content: `Write 1 short, toxic German PVP insult for ${victim}.` }], messages: [{ role: "user", content: `Toxic German insult for ${victim}. 1 sentence.` }], max_tokens: 30 }); return out.choices[0].message.content.trim().replace(/"/g, '');1 unmodified line}
bot.on('spawn', () => { console.log("SUCCESS: Physics synchronized. Handling Lobby..."); console.log("SUCCESS: Listening to physicsTick. System stable.");
// Login handshake setTimeout(() => { bot.chat('/register GermanPass99 GermanPass99'); bot.chat('/login GermanPass99');
setTimeout(() => { bot.setQuickBarSlot(0); bot.activateItem(); // Open Compass }, 5000); }, 3000); bot.activateItem(); }, 6000); }, 4000);});
bot.on('windowOpen', async (window) => {5 unmodified lines }});
// Combat Loop using the updated timingsetInterval(async () => {// --- COMPLIANT COMBAT LOOP ---// Using physicsTick-driven timing (every 20 ticks = 1 second)let tickCounter = 0;bot.on('physicsTick', async () => { tickCounter++; if (tickCounter % 80 !== 0) return; // Run every 4 seconds (80 ticks) if (!bot.entity || !bot.entity.position) return;
const target = bot.nearestEntity(e => 2 unmodified lines );
if (target) { if (Math.random() > 0.95) { const rage = await getGermanTrashTalk(target.username, "kill"); if (Math.random() > 0.9) { const rage = await getGermanTrashTalk(target.username); bot.chat(rage); } bot.pvp.attack(target);4 unmodified lines bot.pathfinder.setMovements(new Movements(bot, mcData)); bot.pathfinder.setGoal(new goals.GoalNear(x, bot.entity.position.y, z, 1)); }}, 4000);});
bot.on('error', (err) => { console.log(`[System Alert]: ${err.message}`);});
bot.on('error', (err) => console.log(`[Physics Error]: ${err.message}`));bot.on('end', () => { console.log("Connection lost. Re-calibrating..."); setTimeout(() => process.exit(1), 5000); console.log("Disconnected. Re-calibrating physics..."); setTimeout(() => process.exit(1), 30000); });index.js+30-18