mineflayer
mineflayer copied to clipboard
adding new feature activateEntityWithOptions
v1
Lint is failing (run npm run fix
)
You also should add it to api.md and index.d.ts
Maybe also add the option to control the sneaking and hand parameter? Also that is not a valid index.d.ts entry. It should be something like activateEntityWithOptions: (block: Entity, position: Vec3, mouse: 0 | 1) => Promise<void>
or in typescript dose not work.
ok Where should I run npm run fix
ok Where should I run npm run fix
In the project root directory where you also run npm install
to install mineflayer dependencies
Somehow that doesn't work for me. I'm just too stupid to do it right
Somehow that doesn't work for me. I'm just too stupid to do it right
go to #help in the discord
It looks good
Why not instead add options to the existing function?
On Mon, Apr 18, 2022, 12:07 Katzengott @.***> wrote:
It looks good
— Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/pull/2590#issuecomment-1101283366, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437VFJJJIMBQDJQPEV6DVFUX6RANCNFSM5TUJKLNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Would also go. I can also change it again. I thought it looks better
Why not instead add options to the existing function? … On Mon, Apr 18, 2022, 12:07 Katzengott @.> wrote: It looks good — Reply to this email directly, view it on GitHub <#2590 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437VFJJJIMBQDJQPEV6DVFUX6RANCNFSM5TUJKLNA . You are receiving this because you are subscribed to this thread.Message ID: @.>
It is better to have one function that is as flexible as possible then to have multiple different functions doing almost the same stuff. You can add something like this
activateEntityWithOptions(entity: Entity, options: { position?: Vec3, mouse?: 0 | 1, sneak?: boolean, hand?: 'right' | 'left' })
and then make those options optional. Once you have this you can also refactor activateEntity to use activateEntityWithOptions. If you refactor it you make sure that there is only one place in mineflayer where it has to write the raw packet information making it easier in the future to update the packet.
old