Spaces:
Paused
Paused
Update index.js
Browse files5 unmodified lines67891011121 unmodified line14151617181920212223242526272829303132333435361 unmodified line38394041424344454647484950515253545 unmodified lines60616263646566672 unmodified lines70717273747576774 unmodified lines828384858687888990915 unmodified linesconst hf = new HfInference(process.env.HF_TOKEN);const app = express();app.get('/', (req, res) => res.send('System: Physics Calibrated. German Rage Active. 🇩🇪'));app.listen(7860);const bot = mineflayer.createBot({1 unmodified lineusername: 'Deutsch_Zerstorer',auth: 'offline',version: '1.21',checkTimeoutInterval: 120000 // Prevents the ECONNRESET kick});// --- THE FIX: LISTENING TO MINEFLAYER ---// We force the bot to treat 'physicTick' and 'physicsTick' as the same thingbot.on('physicsTick', () => {bot.emit('physicTick');});bot.loadPlugin(pathfinder);bot.loadPlugin(pvp);async function getGermanTrashTalk(victim, type) {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}.` }],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...");setTimeout(() => {bot.chat('/register GermanPass99 GermanPass99');bot.chat('/login GermanPass99');setTimeout(() => {bot.setQuickBarSlot(0);bot.activateItem(); // Open Compass}, 5000);}, 3000);});bot.on('windowOpen', async (window) => {5 unmodified lines}});// Combat Loop using the updated timingsetInterval(async () => {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");bot.chat(rage);}bot.pvp.attack(target);4 unmodified linesbot.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(`[Physics Error]: ${err.message}`));bot.on('end', () => {console.log("Connection lost. Re-calibrating...");setTimeout(() => process.exit(1), 5000);});5 unmodified lines67891011121 unmodified line1415161718192021222324252627282930313233343536373839401 unmodified line4243444546474849505152535455565758595 unmodified lines6566676869707172737475762 unmodified lines79808182838485864 unmodified lines9192939495969798991001011021035 unmodified linesconst 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({1 unmodified lineusername: '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, '');1 unmodified line}bot.on('spawn', () => {console.log("SUCCESS: Listening to physicsTick. System stable.");// Login handshakesetTimeout(() => {bot.chat('/register GermanPass99 GermanPass99');bot.chat('/login GermanPass99');setTimeout(() => {bot.setQuickBarSlot(0);bot.activateItem();}, 6000);}, 4000);});bot.on('windowOpen', async (window) => {5 unmodified lines}});// --- 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.9) {const rage = await getGermanTrashTalk(target.username);bot.chat(rage);}bot.pvp.attack(target);4 unmodified linesbot.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);});
index.js+30-18