katharosada / botchallenge

A Minecraft bukkit server plugin and Python client for scripting bots
MIT License
34 stars 6 forks source link

Looking for (hostile) mobs #17

Open Rafiot opened 9 years ago

Rafiot commented 9 years ago

I am very very new at minecraft programming so I'm not sure this question is even relevant.

Would it be possible to know if there is an hostile mob close to the player? What I want to do is to use the robot as a guard to automatically protect the player.

katharosada commented 9 years ago

That's a relevant question! And a couple of other people have been asking about being able to detect mobs (both friendly and hostile).

But I think it makes more sense to know if there's a mob near the robot, the robot can follow the player around if they want to protect the player. There's also the problem that the robot can't really attack a mob, it can do damage just by moving into the mob, but it would be cool to have a real attack system. (I'm thinking fireballs or something!)

How's this (just an example, not added yet): list_of_mobs = robot.find_mobs_nearby()

It would give you a list of Mob objects, which have a type (sheep, creeper, etc.), whether it's hostile or not and a location. You can use that location to attack the mob by moving into it (or once we have fireballs, attack it properly!)

How's that sound for a plan? Maybe we could also add a find_mobs_near_player() but I'm not sure that makes sense, because if the robot is far away, it probably wouldn't get there in time to help.

katharosada commented 9 years ago

Oh, to give a rough timeframe, I can probably find the time to add this next week or the week after.

Rafiot commented 9 years ago

That sounds great :)

FYI, I'm working on a curriculum to teach python to kids participating to CoderDojo in Luxembourg and your plugin is the best available.

Rafiot commented 9 years ago

And I'm thinking about it, but find_mobs_near_player() might be interesting to print an alert message in the screen for example. It is not as useful as robot.find_mobs_nearby() but I'm sure we can find a use for that.