@zardoy/flying-squid 0.0.97 → 0.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,9 +13,6 @@ const player = function (player, serv, { version }) {
13
13
  if (!heldItem || heldItem.type === -1)
14
14
  return;
15
15
  const count = (status === 4) ? 1 : heldItem.count;
16
- heldItem.count -= count;
17
- if (heldItem.count === 0)
18
- player.inventory.slots[36 + player.heldItemSlot] = null;
19
16
  // TODO: correct position & velocity + physic simulation
20
17
  player.behavior('item_drop', {
21
18
  blockDropPosition: player.position,
@@ -27,7 +24,13 @@ const player = function (player, serv, { version }) {
27
24
  blockDropPickup: 500,
28
25
  blockDropDeath: 60 * 5 * 1000
29
26
  }, async (data) => {
30
- dropBlock(data);
27
+ const currentItem = player.inventory.slots[36 + player.heldItemSlot];
28
+ if (currentItem && currentItem.count > 0) {
29
+ dropBlock(data);
30
+ currentItem.count -= count;
31
+ if (currentItem.count === 0)
32
+ player.inventory.slots[36 + player.heldItemSlot] = null;
33
+ }
31
34
  });
32
35
  }
33
36
  else if (status === 5) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zardoy/flying-squid",
3
3
  "description": "A minecraft server written in TS",
4
- "version": "0.0.97",
4
+ "version": "0.0.98",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "bin": "dist/app.js",