Spaces:
Paused
Paused
File size: 3,479 Bytes
4e0f97e 7430730 2395522 7430730 dd1feb6 7d88023 7430730 d615ec6 4e0f97e dd1feb6 2395522 1f67d5a 2395522 ac535fe d615ec6 ac535fe d615ec6 ac535fe d615ec6 ac535fe 2395522 d615ec6 7706249 d615ec6 ac535fe 7706249 2395522 1f67d5a 7706249 7430730 2395522 d615ec6 2395522 d615ec6 7d88023 2395522 7430730 2395522 ac535fe d615ec6 1f67d5a 4e0f97e 1f67d5a ac535fe 1f67d5a 2395522 4e0f97e d615ec6 1f67d5a 2395522 ac535fe 2395522 4e0f97e 2395522 d615ec6 2395522 ac535fe 1f67d5a 2395522 d615ec6 2395522 ac535fe d615ec6 ac535fe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 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);
}); |