michaelzangl / minebot

Minebot
GNU General Public License v3.0
146 stars 48 forks source link

breaking block I am looking at with js #194

Open ShiinaGM opened 7 years ago

ShiinaGM commented 7 years ago

Hey,

I only want to create a javascript for minebot with breaks the block I am looking at. Can somebody help me?

ghost commented 7 years ago

Take a look at this: (https://github.com/michaelzangl/minebot/wiki/Javascript-Examples#interact-with-the-world) But i do not know if this also works with leftclick

ShiinaGM commented 7 years ago

I already tested it with leftclick but it clicked just for one tick and didn't hold it to break any block.

ghost commented 7 years ago

Well then i have no idea i think you have to wait for a comment from @michaelzangl For me not even the dorightclickhandler works but i have no idea why... bot.txt

ghost commented 7 years ago

You can try minescript.doStrategy(minescript.strategy("minebot", "tunnel", "1")) minescript.doStrategy(minescript.strategyWalkTowards(minescript.getPlayer().x + 1, minescript.getPlayer().z + 0)); The X+1 is for walking back the to start position you have to replace it with X+1 X-1 Y+1 or Y-1

The only Problem is that Either the Block is in Front of you or 2017-07-29_12 53 23 one block below. 2017-07-29_12 53 20 For other the directions i have no idea how this should work. Also if there are 2 Blocks in front of you it breaks both because of the tunneling command. 2017-07-29_12 53 26

michaelzangl commented 7 years ago

Depends on what you want to do and how flexible you want the bot to react.

If you know the target coordinates, the best thing is to construct a DestroyInRange task. You need to write your own TaskStrategy for this. They can be used in JS, but it's easier to do in Java since your IDE will help you a lot ;-).