mineflayer icon indicating copy to clipboard operation
mineflayer copied to clipboard

adding new feature activateEntityWithOptions

Open Katzengott opened this issue 2 years ago • 10 comments

v1

Katzengott avatar Apr 17 '22 19:04 Katzengott

Lint is failing (run npm run fix)

You also should add it to api.md and index.d.ts

amoraschi avatar Apr 17 '22 19:04 amoraschi

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.

IceTank avatar Apr 17 '22 19:04 IceTank

ok Where should I run npm run fix

Katzengott avatar Apr 17 '22 19:04 Katzengott

ok Where should I run npm run fix

In the project root directory where you also run npm install to install mineflayer dependencies

IceTank avatar Apr 17 '22 19:04 IceTank

Somehow that doesn't work for me. I'm just too stupid to do it right

Katzengott avatar Apr 17 '22 20:04 Katzengott

Somehow that doesn't work for me. I'm just too stupid to do it right

go to #help in the discord

IceTank avatar Apr 17 '22 20:04 IceTank

It looks good

Katzengott avatar Apr 18 '22 10:04 Katzengott

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: @.***>

rom1504 avatar Apr 18 '22 10:04 rom1504

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: @.>

Katzengott avatar Apr 18 '22 10:04 Katzengott

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.

IceTank avatar Apr 18 '22 12:04 IceTank

old

rom1504 avatar Mar 04 '23 18:03 rom1504