Refactor data-provider use in server ex (#64)
This commit is contained in:
parent
880b052093
commit
5499f956b9
1 changed files with 14 additions and 14 deletions
|
|
@ -27,7 +27,7 @@ async function startServer (version = '1.16.210', ok) {
|
|||
let loop
|
||||
|
||||
const getPath = (packetPath) => DataProvider(server.options.protocolVersion).getPath(packetPath)
|
||||
const get = (packetPath) => require(getPath('sample/' + packetPath))
|
||||
const get = (packetName) => require(getPath(`sample/packets/${packetName}.json`))
|
||||
|
||||
server.listen()
|
||||
console.log('Started server')
|
||||
|
|
@ -71,25 +71,25 @@ async function startServer (version = '1.16.210', ok) {
|
|||
client.queue('inventory_slot', { window_id: 120, slot: 0, item: new Item().toBedrock() })
|
||||
}
|
||||
|
||||
client.write('player_list', get('packets/player_list.json'))
|
||||
client.write('start_game', get('packets/start_game.json'))
|
||||
client.write('player_list', get('player_list'))
|
||||
client.write('start_game', get('start_game'))
|
||||
client.write('item_component', { entries: [] })
|
||||
client.write('set_spawn_position', get('packets/set_spawn_position.json'))
|
||||
client.write('set_spawn_position', get('set_spawn_position'))
|
||||
client.write('set_time', { time: 5433771 })
|
||||
client.write('set_difficulty', { difficulty: 1 })
|
||||
client.write('set_commands_enabled', { enabled: true })
|
||||
client.write('adventure_settings', get('packets/adventure_settings.json'))
|
||||
client.write('biome_definition_list', get('packets/biome_definition_list.json'))
|
||||
client.write('available_entity_identifiers', get('packets/available_entity_identifiers.json'))
|
||||
client.write('update_attributes', get('packets/update_attributes.json'))
|
||||
client.write('creative_content', get('packets/creative_content.json'))
|
||||
client.write('inventory_content', get('packets/inventory_content.json'))
|
||||
client.write('adventure_settings', get('adventure_settings'))
|
||||
client.write('biome_definition_list', get('biome_definition_list'))
|
||||
client.write('available_entity_identifiers', get('available_entity_identifiers'))
|
||||
client.write('update_attributes', get('update_attributes'))
|
||||
client.write('creative_content', get('creative_content'))
|
||||
client.write('inventory_content', get('inventory_content'))
|
||||
client.write('player_hotbar', { selected_slot: 3, window_id: 'inventory', select_slot: true })
|
||||
client.write('crafting_data', get('packets/crafting_data.json'))
|
||||
client.write('available_commands', get('packets/available_commands.json'))
|
||||
client.write('crafting_data', get('crafting_data'))
|
||||
client.write('available_commands', get('available_commands'))
|
||||
client.write('chunk_radius_update', { chunk_radius: 1 })
|
||||
client.write('game_rules_changed', get('packets/game_rules_changed.json'))
|
||||
client.write('respawn', get('packets/respawn.json'))
|
||||
client.write('game_rules_changed', get('game_rules_changed'))
|
||||
client.write('respawn', get('respawn'))
|
||||
|
||||
for (const chunk of chunks) {
|
||||
client.queue('level_chunk', chunk)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue