PrismarineJS / flying-squid

Create Minecraft servers with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/flying-squid/
MIT License
546 stars 99 forks source link

Implement PVP #14

Closed ghost closed 9 years ago

ghost commented 9 years ago

Working on it...

EDIT: Scratch that, Fighting with someone works fine with no neck movement.

rom1504 commented 9 years ago

Something like that :

  1. find the packet of attacking (look at mineflayer bot.attack maybe)
  2. look for the update health packet
  3. update the health in player.entity.health
  4. put that in a pvp.js player plugin
rom1504 commented 9 years ago

https://github.com/andrewrk/mineflayer/blob/45df58afbfc98ad981d4e873261347e2e6f079da/lib/plugins/entities.js#L400 : we are on the receiving end of this

We need to add a serv.entities (indexed by entity id)

  1. create it in players.js (or a new entities.js ?)
  2. fill it in addPlayer
  3. remove the entity on logout

Then you can use serv.entities to know which entity was attacked

ghost commented 9 years ago

@rom1504 serv.entities complete.

ghost commented 9 years ago

Done