@zardoy/flying-squid 0.0.136 → 0.0.137

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.
@@ -18,6 +18,10 @@ const server = function (serv, options) {
18
18
  const mcData = serv.mcData;
19
19
  const projectiles = new Set();
20
20
  const typeId = (names) => serv.entityTypeId(names, 'object');
21
+ // NoGravity (entity metadata 5, boolean, 1.9+): clients (mineflayer integrates ender pearls, snowballs, eggs and falling blocks itself) must not move what the server steers
22
+ const metaTypes = mcData.protocol?.types?.entityMetadataEntry?.[1]?.[1]?.type?.[1]?.mappings;
23
+ const boolType = Object.entries(metaTypes ?? {}).find(([, name]) => /^bool/.test(String(name)))?.[0];
24
+ const noGravityMetadata = () => (boolType !== undefined && mcData.version['>=']('1.9') ? [{ key: 5, type: Number(boolType), value: true }] : []);
21
25
  const spawn = (names, world, position, velocity, owner, size = 0.25) => {
22
26
  const id = typeId(names);
23
27
  if (id === undefined)
@@ -37,7 +41,7 @@ const server = function (serv, options) {
37
41
  e.pitch = pitch;
38
42
  e.yawDeg = yaw;
39
43
  e.data = (owner?.id ?? 0);
40
- e.metadata = [];
44
+ e.metadata = noGravityMetadata();
41
45
  e.updateAndSpawn();
42
46
  return e;
43
47
  };
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.136",
4
+ "version": "0.0.137",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "bin": "dist/app.js",