From fb0ab0ef95a2001ea3e9079781c67f08946167b9 Mon Sep 17 00:00:00 2001 From: mhsjlw Date: Fri, 28 Aug 2015 15:07:40 -0400 Subject: [PATCH] Implement crouching and sprinting --- lib/playerPlugins/animations.js | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/playerPlugins/animations.js b/lib/playerPlugins/animations.js index a9a3b2b..b79bd58 100644 --- a/lib/playerPlugins/animations.js +++ b/lib/playerPlugins/animations.js @@ -8,4 +8,38 @@ function inject(serv, player) animation: 0 }); }); + + player._client.on("entity_action", function(packet) { + if(packet.actionId == 3) { + player.entity.metadata = [{"key":0,"type":"byte","value": 0x08}]; + player._writeOthers("entity_metadata", { + entityId: player.entity.id, + metadata: player.entity.metadata + }); + } + + if(packet.actionId == 4) { + player.entity.metadata = [{"key":0,"type":"byte","value": 0x00}]; + player._writeOthers("entity_metadata", { + entityId: player.entity.id, + metadata: player.entity.metadata + }); + } + + if(packet.actionId == 0) { + player.entity.metadata = [{"key":0,"type":"byte","value": 0x02}]; + player._writeOthers("entity_metadata", { + entityId: player.entity.id, + metadata: player.entity.metadata + }); + } + + if(packet.actionId == 1) { + player.entity.metadata = [{"key":0,"type":"byte","value": 0x00}]; + player._writeOthers("entity_metadata", { + entityId: player.entity.id, + metadata: player.entity.metadata + }); + } + }); } \ No newline at end of file