PrismarineJS / mineflayer-scaffold

mineflayer plugin to build or break blocks to get to a certain point
26 stars 12 forks source link

cant break leaves #5

Open TheTechPony opened 7 years ago

TheTechPony commented 7 years ago

------ TheTechPony: lumberjack search for id: 17 founded log with id 17 Block { type: 17, metadata: 0, light: 0, skyLight: 0, biome: Biome { id: 0, color: 112, name: 'Ocean', height: undefined, rainfall: 0.5, temperature: 0.5 }, position: Vec3 { x: -25400, y: 64, z: 19134 }, name: 'log', hardness: 2, displayName: 'Wood', boundingBox: 'block', diggable: true, material: 'wood', harvestTools: undefined, drops: [ { drop: 17 } ], signText: undefined, painting: undefined } C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index.js:365 var toolMultipliers = materials[material]; ^

TypeError: Cannot read property 'leaves' of undefined at equipToolToBreak (C:\Program Files\nodejs\node_modules\mineflayer-scaffol d\index.js:365:36) at breakBlock (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\inde x.js:321:11) at moveInDirection (C:\Program Files\nodejs\node_modules\mineflayer-scaffold \index.js:278:7) at Object.increaseX (C:\Program Files\nodejs\node_modules\mineflayer-scaffol d\index.js:110:7) at changeState (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\ind ex.js:249:25) at improveX (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index. js:259:42) at Object.improvePosition (C:\Program Files\nodejs\node_modules\mineflayer-s caffold\index.js:106:7) at changeState (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\ind ex.js:249:25) at C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index.js:76:9 at stop (C:\Program Files\nodejs\node_modules\mineflayer-navigate\index.js:1 38:7)

rom1504 commented 7 years ago

Likely need adapting for mineflayer 2.0 (ie using Minecraft data directly instead of mineflayer.*) Feel free to do a PR for it (or I'll do it but later)

On Sun, Feb 12, 2017, 05:04 TheTechPony notifications@github.com wrote:

------ TheTechPony: lumberjack search for id: 17 founded log with id 17 Block { type: 17, metadata: 0, light: 0, skyLight: 0, biome: Biome { id: 0, color: 112, name: 'Ocean', height: undefined, rainfall: 0.5, temperature: 0.5 }, position: Vec3 { x: -25400, y: 64, z: 19134 }, name: 'log', hardness: 2, displayName: 'Wood', boundingBox: 'block', diggable: true, material: 'wood', harvestTools: undefined, drops: [ { drop: 17 } ], signText: undefined, painting: undefined } C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index.js:365 var toolMultipliers = materials[material]; ^

TypeError: Cannot read property 'leaves' of undefined at equipToolToBreak (C:\Program Files\nodejs\node_modules\mineflayer-scaffol d\index.js:365:36) at breakBlock (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\inde x.js:321:11) at moveInDirection (C:\Program Files\nodejs\node_modules\mineflayer-scaffold \index.js:278:7) at Object.increaseX (C:\Program Files\nodejs\node_modules\mineflayer-scaffol d\index.js:110:7) at changeState (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\ind ex.js:249:25) at improveX (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index. js:259:42) at Object.improvePosition (C:\Program Files\nodejs\node_modules\mineflayer-s caffold\index.js:106:7) at changeState (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\ind ex.js:249:25) at C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index.js:76:9 at stop (C:\Program Files\nodejs\node_modules\mineflayer-navigate\index.js:1 38:7)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/andrewrk/mineflayer-scaffold/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_v8pe4EVWXrmcbZbqanFikgXutnNks5rboTBgaJpZM4L-Yp8 .

TheTechPony commented 7 years ago

This is still an issue for me, I can't break anything using this plugin.

C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index.js:365 var toolMultipliers = materials[material]; ^

TypeError: Cannot read property 'wood' of undefined at equipToolToBreak (C:\Program Files\nodejs\node_modules\mineflayer-scaffol d\index.js:365:36) at breakBlock (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\inde x.js:321:11) at moveInDirection (C:\Program Files\nodejs\node_modules\mineflayer-scaffold \index.js:276:7) at Object.decreaseZ (C:\Program Files\nodejs\node_modules\mineflayer-scaffol d\index.js:202:7) at changeState (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\ind ex.js:249:25) at improveX (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index. js:264:42) at Object.improvePosition (C:\Program Files\nodejs\node_modules\mineflayer-s caffold\index.js:106:7) at changeState (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\ind ex.js:249:25) at C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index.js:76:9 at stop (C:\Program Files\nodejs\node_modules\mineflayer-navigate\index.js:1 38:7)

TheTechPony commented 7 years ago

Okay so I've found how to fix it but when I apply the fix I get this error

The fix https://github.com/PrismarineJS/node-minecraft-data/blob/master/doc/api.md

function init() { sideVecs = [ vec3(-1, 0, 0), vec3( 1, 0, 0), vec3( 0, -1, 0), vec3( 0, 1, 0), vec3( 0, 0, -1), vec3( 0, 0, 1), ]; materials = minecraft-data.materials; return inject; }

The error

C:\Program Files\nodejs>node fish.js C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index.js:40 materials = minecraft-data.materials; ^

ReferenceError: minecraft is not defined at init (C:\Program Files\nodejs\node_modules\mineflayer-scaffold\index.js:4 0:15) at Object. (C:\Program Files\nodejs\fish.js:4:52) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9)

C:\Program Files\nodejs>

TheTechPony commented 7 years ago

nvm I fixed it. forgot to require the module.

rom1504 commented 7 years ago

Can you make a PR and reopen the issue until it's merged ?

TheTechPony commented 7 years ago

I don't know how to make a pull request so I'll just post my solution here.

index.js line 9 - var mcData=require("minecraft-data")("1.8.8"); line 41 - materials = mcData.materials;

rom1504 commented 7 years ago

you can just press edit on that page https://github.com/andrewrk/mineflayer-scaffold/blob/master/index.js to make a pull request

TheTechPony commented 7 years ago

Done. I messed up the first 3 so just ignore those

FrostBird347 commented 5 years ago

I have this exact same issue and I have been unable to fix it.

FrostBird347 commented 5 years ago

I did not really need it to select the right tool, so I just replaced if (! material) return true; with if (! material) return true; if (material) return true;

This is still a problem though.