1.17 support (#99)

This commit is contained in:
extremeheat 2021-06-09 17:26:44 -04:00 committed by GitHub
commit 5f0adfab76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 8999 additions and 25 deletions

4
.gitignore vendored
View file

@ -8,4 +8,6 @@ data/**/sample
data/**/read.js
data/**/write.js
data/**/size.js
tools/bds*
tools/bds*
tools/*/*
*.txt

View file

@ -11,7 +11,7 @@ This is a work in progress. You can track the progress in https://github.com/Pri
## Features
- Supports Minecraft Bedrock version 1.16.201, 1.16.210, 1.16.220
- Supports Minecraft Bedrock version 1.16.201, 1.16.210, 1.16.220, 1.17.0
- Parse and serialize packets as JavaScript objects
- Automatically respond to keep-alive packets
- [Proxy and mitm connections](docs/API.md)

8902
data/1.17.0/protocol.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
# Created from MiNET and gophertunnel docs
# The version below is the latest version this protocol schema was updated for.
# The output protocol.json will be in the folder for the version
!version: 1.16.220
!version: 1.17.0
# Some ProtoDef aliases
string: ["pstring",{"countType":"varint"}]
@ -379,7 +379,8 @@ packet_start_game:
# is a new system introduced in 1.16. Backwards compatibility with the inventory transactions has to
# some extent been preserved, but will eventually be removed.
server_authoritative_inventory: bool
# The server's engine version, used for telemetry
engine: string
packet_add_player:
!id: 0x0c
@ -629,8 +630,8 @@ packet_level_event:
1065: dye_used
1066: ink_sack_used
2000: particle_shoot #TODO: check 2000-2017
2001: particle_destroy
2002: particle_splash
2001: particle_destroy
2002: particle_splash
2003: particle_eye_despawn
2004: particle_spawn
2005: particle_crop_growth
@ -683,7 +684,7 @@ packet_level_event:
3600: block_start_break
3601: block_stop_break
4000: set_data
9800: players_sleeping
9800: players_sleeping
0x4000: add_particle_mask
position: vec3f
data: zigzag32
@ -1243,7 +1244,7 @@ packet_event:
9: agent_created
10: banner_pattern_removed
11: commaned_executed
12: fish_bucketed
12: fish_bucketed
13: mob_born
14: pet_died
15: cauldron_block_used
@ -1256,6 +1257,7 @@ packet_event:
22: honey_harvested
23: target_block_hit
24: piglin_barter
25: waxed_or_unwaxed_copper
use_player_id: u8
event_data: restBuffer # Unknown data, TODO: add
@ -3015,4 +3017,26 @@ packet_debug_renderer:
# Alpha is the alpha value from the RGBA colour rendered on the debug.
alpha: lf32
# Duration is how long the debug will last in the world for. It is measured in milliseconds.
duration: li64
duration: li64
# Sent by the server to synchronize/update entity properties as NBT, an alternative to Set Entity Data.
packet_sync_entity_property:
!id: 0xa5
!bound: client
nbt: nbt
# AddVolumeEntity sends a volume entity's definition and components from server to client.
packet_add_volume_entity:
!id: 0xa6
!bound: client
# The Runtime Entity ID
entity_id: varint64
nbt: nbt
# RemoveVolumeEntity indicates a volume entity to be removed from server to client.
packet_remove_volume_entity:
!id: 0xa7
!bound: client
# The Runtime Entity ID
entity_id: varint64

View file

@ -45,6 +45,7 @@ GameMode: zigzag32 =>
GameRule:
name: string
editable: bool
type: varint =>
1: bool
2: int
@ -283,12 +284,11 @@ MetadataDictionary: []varint
117: nearby_cured_discount_timestamp
118: hitbox
119: is_buoyant
120: freezing_effect_strength
121: buoyancy_data
122: goat_horn_count
123: base_runtime_id
124: define_properties
125: update_properties
120: base_runtime_id
121: freezing_effect_strength
122: buoyancy_data
123: goat_horn_count
124: update_properties
type: varint =>
0: byte
1: short
@ -418,7 +418,10 @@ MetadataFlags2: [ "bitflags", {
"emoting",
"celebrating",
"admiring",
"celebrating_special"
"celebrating_special",
"unknown95", # 95
"ram_attack",
"playing_dead"
]
}]
@ -1042,10 +1045,24 @@ StructureBlockSettings:
last_editing_player_unique_id: zigzag64
# Rotation is the rotation that the structure block should obtain. See the constants above for available
# options.
rotation: u8
rotation: u8 =>
0: none
1: 90_deg
2: 180_deg
3: 270_deg
# Mirror specifies the way the structure should be mirrored. It is either no mirror at all, mirror on the
# x/z axis or both.
mirror: u8
mirror: u8 =>
0: none
1: x_axis
2: z_axis
3: both_axes
animation_mode: u8 =>
0: none
1: layers
2: blocks
# How long the duration for this animation is
animation_duration: lf32
# Integrity is usually 1, but may be set to a number between 0 and 1 to omit blocks randomly, using
# the Seed that follows.
integrity: lf32
@ -1553,6 +1570,31 @@ SoundType: varint =>
- CaveVinesPickBerries
- BigDripleafTiltDown
- BigDripleafTiltUp
- unknown335
- unknown336
- unknown337
- unknown338
- copper_wax_on
- copper_wax_off
- scrape
- player_hurt_drown
- player_hurt_on_fire
- player_hurt_freeze
- use_spyglass
- stop_using_spyglass
- amethyst_block_chime
- ambient_screamer
- hurt_screamer
- death_screamer
- milk_screamer
- jump_to_block
- pre_ram
- pre_ram_screamer
- ram_impact
- ram_impact_screamer
- squid_ink_squirt
- glow_squid_ink_squirt
- convert_to_stray
- Undefined
# TODO: remove?

4
index.d.ts vendored
View file

@ -1,7 +1,7 @@
import EventEmitter from "events"
declare module "bedrock-protocol" {
type Version = '1.16.220' | '1.16.210' | '1.16.201'
type Version = '1.17.0' | '1.16.220' | '1.16.210' | '1.16.201'
enum title { MinecraftNintendoSwitch, MinecraftJava }
@ -157,4 +157,4 @@ declare module "bedrock-protocol" {
export function createServer(options: ServerOptions): Server
export function ping({ host, port }: { host: string, port: number }): Promise<ServerAdvertisement>
}
}

View file

@ -1,9 +1,10 @@
// Minimum supported version (< will be kicked)
const MIN_VERSION = '1.16.201'
// Currently supported verson
const CURRENT_VERSION = '1.16.220'
const CURRENT_VERSION = '1.17.0'
const Versions = {
'1.17.0': 440,
'1.16.220': 431,
'1.16.210': 428,
'1.16.201': 422

View file

@ -2,6 +2,7 @@ const { Server, Client } = require('../')
const { dumpPackets } = require('../tools/genPacketDumps')
const DataProvider = require('../data/provider')
const { ping } = require('../src/createClient')
const { CURRENT_VERSION } = require('../src/options')
// First we need to dump some packets that a vanilla server would send a vanilla
// client. Then we can replay those back in our custom server.
@ -9,7 +10,7 @@ function prepare (version) {
return dumpPackets(version)
}
async function startTest (version = '1.16.220', ok) {
async function startTest (version = CURRENT_VERSION, ok) {
await prepare(version)
const Item = require('../types/Item')(version)
const port = 19130

View file

@ -23,7 +23,7 @@ async function dump (version, force = true) {
const handle = await vanillaServer.startServerAndWait(version || CURRENT_VERSION, 1000 * 120, { 'server-port': port })
console.log('Started dump server')
console.log('Started dump server', version)
const client = new Client({
host: '127.0.0.1',
port,

View file

@ -1,3 +1,5 @@
const { Versions } = require('../src/options')
module.exports = (version) =>
class Item {
nbt
@ -11,7 +13,7 @@ module.exports = (version) =>
}
static fromBedrock (obj) {
if (version === '1.16.220') {
if (Versions[version] >= Versions['1.16.220']) {
return new Item({
networkId: obj.network_id,
stackId: obj.stack_id,
@ -32,7 +34,7 @@ module.exports = (version) =>
}
toBedrock () {
if (version === '1.16.220') {
if (Versions[version] >= Versions['1.16.220']) {
return {
network_id: this.networkId,
count: this.count,