bedrock-portal 2.6.0 → 2.7.0

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.
@@ -5,7 +5,7 @@ exports.SessionConfig = {
5
5
  MinecraftTitleID: '896928775',
6
6
  MinecraftSCID: '4fc10100-5f7a-4470-899b-280835760c07',
7
7
  MinecraftTemplateName: 'MinecraftLobby',
8
- MinecraftProtocolVersion: 2169,
8
+ MinecraftProtocolVersion: 2193,
9
9
  };
10
10
  var Joinability;
11
11
  (function (Joinability) {
@@ -102,3 +102,6 @@ export declare const start_game: {
102
102
  world_identifier: string;
103
103
  owner_identifier: string;
104
104
  };
105
+ export declare const sendStartGame: (client: {
106
+ write: (name: string, params: unknown) => void;
107
+ }) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.start_game = void 0;
3
+ exports.sendStartGame = exports.start_game = void 0;
4
4
  exports.start_game = {
5
5
  entity_id: '-8589934591',
6
6
  runtime_entity_id: '1',
@@ -105,3 +105,32 @@ exports.start_game = {
105
105
  world_identifier: '',
106
106
  owner_identifier: '',
107
107
  };
108
+ const sendStartGame = (client) => {
109
+ // The client validates both structure registries before accepting StartGame.
110
+ const emptyNbtList = {
111
+ type: 'list',
112
+ value: {
113
+ type: 'end',
114
+ value: [],
115
+ },
116
+ };
117
+ client.write('jigsaw_structure_data', {
118
+ structure_data: {
119
+ type: 'compound',
120
+ name: '',
121
+ value: {
122
+ processors: emptyNbtList,
123
+ template_pools: emptyNbtList,
124
+ jigsaws: emptyNbtList,
125
+ structure_sets: emptyNbtList,
126
+ },
127
+ },
128
+ });
129
+ client.write('voxel_shapes', {
130
+ shapes: [],
131
+ name_map: [],
132
+ custom_shape_count: 0,
133
+ });
134
+ client.write('start_game', exports.start_game);
135
+ };
136
+ exports.sendStartGame = sendStartGame;
package/dist/index.js CHANGED
@@ -282,7 +282,7 @@ class BedrockPortal extends tiny_typed_emitter_1.TypedEmitter {
282
282
  gatherings_configuration: undefined,
283
283
  });
284
284
  });
285
- client.write('start_game', start_game_1.start_game);
285
+ (0, start_game_1.sendStartGame)(client);
286
286
  };
287
287
  client.on('resource_pack_client_response', onResourcePackResponse);
288
288
  });
@@ -59,19 +59,31 @@ class ServerFromList extends Module_1.default {
59
59
  },
60
60
  texture_packs: [],
61
61
  });
62
- client.write('resource_pack_stack', {
63
- must_accept: false,
64
- resource_packs: [],
65
- game_version: '*',
66
- experiments: [],
67
- experiments_previously_used: false,
68
- has_editor_packs: false,
69
- });
70
- client.once('resource_pack_client_response', async () => {
71
- client.write('start_game', start_game_1.start_game);
62
+ const onResourcePackResponse = (response) => {
63
+ if (response.response_status === 'refused') {
64
+ client.off('resource_pack_client_response', onResourcePackResponse);
65
+ client.disconnect('Resource packs refused');
66
+ return;
67
+ }
68
+ if (response.response_status === 'send_packs' || response.response_status === 'have_all_packs') {
69
+ client.write('resource_pack_stack', {
70
+ must_accept: false,
71
+ resource_packs: [],
72
+ game_version: '*',
73
+ experiments: [],
74
+ experiments_previously_used: false,
75
+ has_editor_packs: false,
76
+ });
77
+ return;
78
+ }
79
+ if (response.response_status !== 'completed')
80
+ return;
81
+ client.off('resource_pack_client_response', onResourcePackResponse);
82
+ (0, start_game_1.sendStartGame)(client);
72
83
  client.write('item_registry', { itemstates: [] });
73
84
  client.write('play_status', { status: 'player_spawn' });
74
- });
85
+ };
86
+ client.on('resource_pack_client_response', onResourcePackResponse);
75
87
  client.on('modal_form_response', (p) => this.handleFormResponse(p, client));
76
88
  }
77
89
  handleFormResponse(response, client) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bedrock-portal",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Creates a joinable session in Minecraft Bedrock Edition that can route players to their a specified host",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",