Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My bot dont wants to activate "bot.setControlState" or another control #3504

Open
1 task
Mingau-Projects opened this issue Nov 15, 2024 · 1 comment
Open
1 task
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@Mingau-Projects
Copy link

  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.23.0
  • server: spigot/paper 1.21.1
  • node: im using node.js in replit, because my computer can't run javaScript

Detailed description of a problem

my robot only stand and more nothing, only look at me

What did you try yet?

i tried an example from https://www.youtube.com/watch?v=P7TIRIDuGjc here is the code on the description.

Your current code

const express = require('express');
const mineflayer = require("mineflayer");
const app = express();

app.use(express.json());

app.get("/", (_, res) => res.sendFile(__dirname + "/index.html"));
app.listen(process.env.PORT);

setInterval(() => {
	http.get(`http://ed4dded2-c5a5-40d3-a7e1-0217baab05a7-00-1hqclivsm9rpp.kirk.repl.co/`);
}, 224000);

var settings = {
	username: "giro_2027",
	host: "MineOfDonkeys.aternos.me",
	version: "1.21.1",
	port: "42003"
};

const bot = mineflayer.createBot(settings);

bot.on("move", () => {
	let friend = bot.nearestEntity();

	if (friend) {
		bot.lookAt(friend.position.offset(0, friend.height, 0));
	}
});

bot.on("kicked", console.log);
bot.on("error", console.log);
bot.on("end", console.log);
bot.on("spawn", console.log)

//here is the part that dont works

var walking = false;

bot.on("entityHurt", (entity)=>{
              if(entity != bot.entity){
		walking = !walking;
		bot.setControlState("forward", walking);
});

bot.on("move", (entity)=>{
	if(entity == "armor_stand"){
		bot.simpleClick(entity, "right");
	};
});

Expected behavior

My expectation was that the robot will click on armor stands (gravestones) and chase anything that causes damage to him (alternating).

@Mingau-Projects Mingau-Projects added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Nov 15, 2024
@miles-igd
Copy link

miles-igd commented Nov 16, 2024

entityHurt doesn't work as implemented in new versions of Minecraft at the moment, see #3501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

2 participants