PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

Finding Blocks returns nothing after 35~ per block #1566

Closed NameSiege closed 3 years ago

NameSiege commented 3 years ago

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve? A bot that continues to mine without stopping unless told to or it needs to craft a new pick(done, works good), eat food(works good), or store goods when inv full (good). The bot doesn't continue to mine. Server plugin Askyblock is used and the lava with water has a chance of either stone lapis or coal.

The bot will continue to dig just fine until it will just stop. It's less than a block away from what it's mining. Note* the bot doesn't move. At first, he is breaking a total of 4 blocks, then 2. When teleported 2 blocks to the left, the bot will resume mining the same block list as it should, but wouldn't touch the old blocks it was just mining just to the right of it. The bot will repeat this again. I then teleport it again two blocks forward and the bot does the same thing. Doesn't touch the old block and will continue mining the new blocks.

Attempt 1: 140 blocks broken before stopping. After teleporting: 71 more blocks broken before stopping. 3rd Teleport: 70 blocks fresh inventory, tools did not break. Attempt 2: 136 After teleporting: After teleporting: 72 Third Teleport: 70 blocks fresh inventory, tools did not break. Attempt 3: single block 33, then 29, then 37 Attempt 4: single block 35, then 34, then 28

What did you try yet?

I've tried changing it from findblocks to findblock debugging and trying different ways to repeat the cycle. removing everything that wasn't tied to the bots digging code. moving everything that involved the digging process to one file

Did you try any method from the API? No Did you try any example? Any error from those? blockfinder.js + digger with a crappy repeat made by my me with my room temperature iq.

Your current code

https://hastebin.com/ruyemunoji.js <---that combo example with small changes that shouldn't affect anything. https://www.diffchecker.com/R1CKbqwe <-- combo diff https://hastebin.com/bohebozici.typescript <-- The one I use. It's not typescript. //A better repeat

Expected behavior

A clear and concise description of what you expected to happen. Continue to mine without stopping

Additional context

Add any other context about the problem here. I have no clue what's wrong. Been stuck on this all day.

I don't want to revert back to it, but I will for now. I have to run a stop repeat check every 20 cycles and restart the command. That's a bad solution to this though. Kind of just sweeping it under the rug. It works if it do it that way though.

https://user-images.githubusercontent.com/16330102/103482620-2d8e7780-4e25-11eb-8b66-9be179193829.mp4

rom1504 commented 3 years ago

Hi, Can you try to explain what bot you are building and what it should do ideally ? I didn't understand why you need find block since the blocks are next to the bot.

On Sun, Jan 3, 2021, 17:02 Name_Siege notifications@github.com wrote:

Versions

  • mineflayer: 2.40.1
  • server: vanilla/spigot/paper 1.16.4
  • node: 15.5.0

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible. What are you building? What problem are you trying to solve? A bot that continues to mine without stopping unless told to or it needs to craft a new pick(done, works good), eat food(works good), or store goods when inv full (good). The bot doesn't continue to mine. Server plugin Askyblock is used and the lava with water has a chance of either stone lapis or coal.

The bot will continue to dig just fine until it will just stop. It's less than a block away from what it's mining. Note* the bot doesn't move. At first, he is breaking a total of 4 blocks, then 2. When teleported 2 blocks to the left, the bot will resume mining the same block list as it should, but wouldn't touch the old blocks it was just mining just to the right of it. The bot will repeat this again. I then teleport it again two blocks forward and the bot does the same thing. Doesn't touch the old block and will continue mining the new blocks.

Attempt 1: 140 blocks broken before stopping. After teleporting: 71 more blocks broken before stopping. 3rd Teleport: 70 blocks fresh inventory, tools did not break. Attempt 2: 136 After teleporting: After teleporting: 72 Third Teleport: 70 blocks fresh inventory, tools did not break. Attempt 3: single block 33, then 29, then 37 Attempt 3: single block 35, then 34, then 28 What did you try yet?

I've tried changing it from findblocks to findblock debugging and trying different ways to repeat the cycle. removing everything that wasn't tied to the bots digging code. moving everything that involved the digging process to one file

Did you try any method from the API? No Did you try any example? Any error from those? blockfinder.js + digger with a crappy repeat made by my me with my room temperature iq. Your current code

https://hastebin.com/ruyemunoji.js <---that combo example with small changes that shouldn't affect anything. https://www.diffchecker.com/R1CKbqwe <-- combo diff https://hastebin.com/bohebozici.typescript <-- The one I use. It's not typescript. //A better repeat Expected behavior

A clear and concise description of what you expected to happen. Continue to mine without stopping Additional context

Add any other context about the problem here. I have no clue what's wrong. Been stuck on this all day.

https://user-images.githubusercontent.com/16330102/103482620-2d8e7780-4e25-11eb-8b66-9be179193829.mp4

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/1566, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437RFJAPFHPZIBPAB4NDSYCIIZANCNFSM4VR7HSTA .

NameSiege commented 3 years ago

Sorry, that's my bad. I didn't want to use blockat because I want the most options with the least amount of input from the user. Although I could use blockat, I don't want it to only be able to stationary mine that specific generator.

The solution I can think of while using blockat is entering the coords of all the blocks you want to break repeatedly. Then run that through the chat, direct message, or discord.js. After running that it will save a prefab of the blocks in the formate (0, 0, 0) being the first block placed. 2nd block is adjusted is + or - depending on the second set of cords. Final check being that the cords have to be within 6 blocks of the location of the bot. Whenever you want to use that prefab again, the bot will have to be in the same position as you saved it with the prefab (whatever name). The reason why I don't want to do it this way is that it will require input from the user. Although, if I wanted a simple solution I can program the prefabs directly or just make it for that specific generator I have in the video.

TLDR: Ramble how blockat solution would work and why I didn't want to do it that way. There are other solutions, but the best I don't want to deal with it solution is having the bot stop digging completely and go again after 20 cycles.

rom1504 commented 3 years ago

Can you try to explain what bot you are building and what it should do ideally ?

NameSiege commented 3 years ago

I'm trying to build a bot that will be eventually self sustaining. Of course it's no where near complete. Right now it should be able to dig stationary with the hard coded defined blocks. It can move too that spot and leave after it's inventory is 75% full. As soon as it can fill its inventory without issue I'll have it store said items then track whats in that chest in a json file.

It should continue to dig the same blocks until the inventory is 75% full. It doesn't reach that point and always stops after ~140 blocks or roughly 35 per block. Nothing that I can find in my code should have it behave like that.