const mineflayer = require('mineflayer'); const { pathfinder, Movements, goals } = require('mineflayer-pathfinder'); const pvp = require('mineflayer-pvp').plugin; const { HfInference } = require('@huggingface/inference'); const express = require('express'); const hf = new HfInference(process.env.HF_TOKEN); const app = express(); app.get('/', (req, res) => res.send('System: Fully Compliant. Event: physicsTick active. 🇩🇪')); app.listen(7860); const bot = mineflayer.createBot({ host: 'nasi.lemak.xyz', username: 'Deutsch_Zerstorer', auth: 'offline', version: '1.21', checkTimeoutInterval: 120000 }); // --- 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) { try { const out = await hf.chatCompletion({ model: "meta-llama/Llama-3.2-1B-Instruct", messages: [{ role: "user", content: `Toxic German insult for ${victim}. 1 sentence.` }], max_tokens: 30 }); return out.choices[0].message.content.trim().replace(/"/g, ''); } catch (e) { return "GEH HEULEN DU LAUCH! 😂"; } } bot.on('spawn', () => { 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(); }, 6000); }, 4000); }); bot.on('windowOpen', async (window) => { const survivalSlot = window.slots.find(slot => slot && slot.nbt && JSON.stringify(slot.nbt).toLowerCase().includes('survival')); if (survivalSlot) { bot.clickWindow(survivalSlot.slot, 0, 0); } else { bot.clickWindow(12, 0, 0); } }); // --- 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 => e.type === 'player' && e.username !== bot.username && bot.entity.position.distanceTo(e.position) < 12 ); if (target) { if (Math.random() > 0.9) { const rage = await getGermanTrashTalk(target.username); bot.chat(rage); } bot.pvp.attack(target); } else if (!bot.pathfinder.isMoving()) { const x = bot.entity.position.x + (Math.random() * 10 - 5); const z = bot.entity.position.z + (Math.random() * 10 - 5); const mcData = require('minecraft-data')(bot.version); bot.pathfinder.setMovements(new Movements(bot, mcData)); bot.pathfinder.setGoal(new goals.GoalNear(x, bot.entity.position.y, z, 1)); } }); bot.on('error', (err) => { console.log(`[System Alert]: ${err.message}`); }); bot.on('end', () => { console.log("Disconnected. Re-calibrating physics..."); setTimeout(() => process.exit(1), 30000); });