Merge branch 'master' into 1.18.1

This commit is contained in:
ice_iix 2022-07-30 18:03:49 -07:00
commit be7236f93b
19 changed files with 1030 additions and 882 deletions

View File

@ -11,7 +11,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
# TODO: refactor toolchain version
toolchain: 1.57.0
toolchain: 1.58.1
components: clippy, rustfmt
default: true
- name: Install dependencies
@ -21,11 +21,22 @@ jobs:
- name: Build binary
run: |
cargo build --verbose --release
- name: Run clippy
uses: actions-rs/clippy-check@v1.0.7
- name: Check workflow permissions
id: check_permissions
uses: scherermichael-oss/action-has-permission@1.0.6
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run clippy action to produce annotations
uses: actions-rs/clippy-check@v1.0.7
if: steps.check_permissions.outputs.has-permission
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets -- -D warnings
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run clippy manually without annotations
if: ${{ !steps.check_permissions.outputs.has-permission }}
run: cargo clippy --all-targets -- -D warnings
- name: Check formatting
run: cargo fmt --all -- --check
- name: Upload binary
@ -49,17 +60,28 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.57.0
toolchain: 1.58.1
components: clippy, rustfmt
default: true
- name: Build binary
run: |
cargo build --verbose --release
- name: Run clippy
uses: actions-rs/clippy-check@v1.0.7
- name: Check workflow permissions
id: check_permissions
uses: scherermichael-oss/action-has-permission@1.0.6
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run clippy action to produce annotations
uses: actions-rs/clippy-check@v1.0.7
if: steps.check_permissions.outputs.has-permission
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets -- -D warnings
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run clippy manually without annotations
if: ${{ !steps.check_permissions.outputs.has-permission }}
run: cargo clippy --all-targets -- -D warnings
- name: Check formatting
run: cargo fmt --all -- --check
- name: Upload binary
@ -83,7 +105,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.57.0
toolchain: 1.58.1
components: clippy, rustfmt
default: true
- name: Build binary
@ -92,11 +114,22 @@ jobs:
chmod a+x target/release/stevenarella
env:
MACOSX_DEPLOYMENT_TARGET: 10.14
- name: Run clippy
uses: actions-rs/clippy-check@v1.0.7
- name: Check workflow permissions
id: check_permissions
uses: scherermichael-oss/action-has-permission@1.0.6
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run clippy action to produce annotations
uses: actions-rs/clippy-check@v1.0.7
if: steps.check_permissions.outputs.has-permission
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets -- -D warnings
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run clippy manually without annotations
if: ${{ !steps.check_permissions.outputs.has-permission }}
run: cargo clippy --all-targets -- -D warnings
- name: Check formatting
run: cargo fmt --all -- --check
- name: Package binary
@ -128,7 +161,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
# TODO: refactor toolchain version
toolchain: 1.57.0
toolchain: 1.58.1
components: clippy, rustfmt
default: true
- name: Install wasm-pack

1445
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ name = "stevenarella"
version = "0.0.1"
authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>", "iceiix <ice_ix@protonmail.ch>" ]
edition = "2021"
rust_version = "1.57"
rust-version = "1.58.1"
resolver = "2"
description = "Multi-protocol multi-platform Minecraft-compatible client"
repository = "https://github.com/iceiix/stevenarella"
@ -29,37 +29,37 @@ opt-level = 1
[dependencies]
cfg-if = "1.0.0"
wasm-bindgen = "0.2.78"
winit = { version = "0.25.0", features = [ "web-sys" ]}
glow = "0.11.0"
wasm-bindgen = "0.2.81"
winit = "0.27.0"
glow = "0.11.2"
byteorder = "1.4.3"
serde = "1.0.132"
serde_json = "1.0.73"
flate2 = { version = "1.0.22", features = ["rust_backend"], default-features = false }
zip = { version = "0.5.13", features = ["deflate"], default-features = false }
serde = "1.0.140"
serde_json = "1.0.82"
flate2 = { version = "1.0.24", features = ["rust_backend"], default-features = false }
zip = { version = "0.6.2", features = ["deflate"], default-features = false }
image = "0.23.14"
getrandom = { version = "0.2.3", features = ["js"] }
rand = "0.8.4"
getrandom = { version = "0.2.7", features = ["js"] }
rand = "0.8.5"
rand_pcg = "0.3.1"
base64 = "0.13.0"
log = { version = "0.4.14", features = ["std"] }
log = { version = "0.4.17", features = ["std"] }
cgmath = "0.17.0"
lazy_static = "1.4.0"
collision = "0.20.1"
rsa_public_encrypt_pkcs1 = "0.4.0"
structopt = "0.3.25"
clipboard = "0.5.0"
structopt = "0.3.26"
clipboard = { git = "https://github.com/iceiix/rust-clipboard", rev = "71089e792fd5e52f05d5b22c54bd2d206d20ec0d" }
instant = "0.1.12"
dirs = "4.0.0"
# clippy = "*"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
reqwest = { version = "0.11.8", features = [ "blocking" ]}
glutin = "0.27.0"
reqwest = { version = "0.11.11", features = [ "blocking" ]}
glutin = "0.29.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.7"
web-sys = "0.3.52"
web-sys = "0.3.59"
[dependencies.steven_resources]
path = "./resources"

View File

@ -1,5 +1,5 @@
# Stevenarella
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Ficeiix%2Fstevenarella%2Fbadge%3Fref%3Dmaster&style=plastic)](https://actions-badge.atrox.dev/iceiix/stevenarella/goto?ref=master)
[![Build](https://github.com/iceiix/stevenarella/actions/workflows/build.yaml/badge.svg)](https://github.com/iceiix/stevenarella/actions/workflows/build.yaml)
Multi-protocol Minecraft-compatible client written in Rust.
@ -68,7 +68,7 @@ from [GitHub Actions](https://actions-badge.atrox.dev/iceiix/stevenarella/goto?r
## Dependencies
Requires Rust stable version 1.57.0 or newer.
Requires Rust stable version 1.58.1 or newer.
**Debian/Ubuntu**

206
protocol/Cargo.lock generated
View File

@ -149,13 +149,11 @@ dependencies = [
[[package]]
name = "flate2"
version = "1.0.20"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0"
checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
dependencies = [
"cfg-if",
"crc32fast",
"libc",
"miniz_oxide",
]
@ -256,14 +254,14 @@ checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
dependencies = [
"cfg-if",
"libc",
"wasi",
"wasi 0.10.2+wasi-snapshot-preview1",
]
[[package]]
name = "h2"
version = "0.3.1"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d832b01df74254fe364568d6ddc294443f61cbec82816b60904303af87efae78"
checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57"
dependencies = [
"bytes",
"fnv",
@ -307,7 +305,7 @@ checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747"
dependencies = [
"bytes",
"fnv",
"itoa",
"itoa 0.4.7",
]
[[package]]
@ -322,21 +320,21 @@ dependencies = [
[[package]]
name = "httparse"
version = "1.3.5"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691"
checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c"
[[package]]
name = "httpdate"
version = "0.3.2"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47"
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]]
name = "hyper"
version = "0.14.4"
version = "0.14.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7"
checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac"
dependencies = [
"bytes",
"futures-channel",
@ -347,8 +345,8 @@ dependencies = [
"http-body",
"httparse",
"httpdate",
"itoa",
"pin-project",
"itoa 1.0.2",
"pin-project-lite",
"socket2",
"tokio",
"tower-service",
@ -392,9 +390,9 @@ dependencies = [
[[package]]
name = "instant"
version = "0.1.10"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if",
]
@ -411,6 +409,12 @@ version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]]
name = "itoa"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
[[package]]
name = "js-sys"
version = "0.3.48"
@ -428,9 +432,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.98"
version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]]
name = "log"
@ -461,42 +465,30 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
[[package]]
name = "miniz_oxide"
version = "0.4.4"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc"
dependencies = [
"adler",
"autocfg",
]
[[package]]
name = "mio"
version = "0.7.9"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5dede4e2065b3842b8b0af444119f3aa331cc7cc2dd20388bfb0f5d5a38823a"
checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
dependencies = [
"libc",
"log",
"miow",
"ntapi",
"winapi",
]
[[package]]
name = "miow"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
dependencies = [
"socket2",
"winapi",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys",
]
[[package]]
name = "native-tls"
version = "0.2.7"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4"
checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9"
dependencies = [
"lazy_static",
"libc",
@ -510,15 +502,6 @@ dependencies = [
"tempfile",
]
[[package]]
name = "ntapi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
dependencies = [
"winapi",
]
[[package]]
name = "num-traits"
version = "0.2.14"
@ -538,6 +521,12 @@ dependencies = [
"libc",
]
[[package]]
name = "once_cell"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
[[package]]
name = "opaque-debug"
version = "0.3.0"
@ -583,26 +572,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "pin-project"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pin-project-lite"
version = "0.2.5"
@ -705,15 +674,16 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.11.4"
version = "0.11.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22"
checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92"
dependencies = [
"base64",
"bytes",
"encoding_rs",
"futures-core",
"futures-util",
"h2",
"http",
"http-body",
"hyper",
@ -727,9 +697,11 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"serde",
"serde_json",
"serde_urlencoded",
"tokio",
"tokio-native-tls",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
@ -778,29 +750,29 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.130"
version = "1.0.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03"
[[package]]
name = "serde_json"
version = "1.0.66"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127"
checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7"
dependencies = [
"itoa",
"itoa 1.0.2",
"ryu",
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.0"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
"form_urlencoded",
"itoa",
"itoa 1.0.2",
"ryu",
"serde",
]
@ -826,11 +798,10 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
[[package]]
name = "socket2"
version = "0.3.19"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
dependencies = [
"cfg-if",
"libc",
"winapi",
]
@ -908,17 +879,19 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.2.0"
version = "1.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8190d04c665ea9e6b6a0dc45523ade572c088d2e6566244c1122671dbf4ae3a"
checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439"
dependencies = [
"autocfg",
"bytes",
"libc",
"memchr",
"mio",
"num_cpus",
"once_cell",
"pin-project-lite",
"socket2",
"winapi",
]
[[package]]
@ -933,16 +906,16 @@ dependencies = [
[[package]]
name = "tokio-util"
version = "0.6.3"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebb7cb2f00c5ae8df755b252306272cd1790d39728363936e01827e11f0b017b"
checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"log",
"pin-project-lite",
"tokio",
"tracing",
]
[[package]]
@ -1047,6 +1020,12 @@ version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.71"
@ -1054,8 +1033,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7"
dependencies = [
"cfg-if",
"serde",
"serde_json",
"wasm-bindgen-macro",
]
@ -1148,10 +1125,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "winreg"
version = "0.7.0"
name = "windows-sys"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
dependencies = [
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
[[package]]
name = "windows_i686_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
[[package]]
name = "windows_i686_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
[[package]]
name = "windows_x86_64_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
[[package]]
name = "windows_x86_64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]

View File

@ -5,15 +5,15 @@ authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>", "iceiix <ice_ix@protonma
edition = "2021"
[dependencies]
serde = "1.0.132"
serde_json = "1.0.73"
serde = "1.0.140"
serde_json = "1.0.82"
hex = "0.4.3"
sha-1 = "0.9.7"
aes = "0.7.4"
cfb8 = "0.7.1"
byteorder = "1.4.3"
log = { version = "0.4.14", features = ["std"] }
flate2 = { version = "1.0.22", features = ["rust_backend"], default-features = false }
log = { version = "0.4.17", features = ["std"] }
flate2 = { version = "1.0.24", features = ["rust_backend"], default-features = false }
num-traits = "0.2.14"
instant = "0.1.12"
@ -26,4 +26,4 @@ path = "../std_or_web"
version = "0"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
reqwest = { version = "0.11.8", features = [ "blocking" ]}
reqwest = { version = "0.11.11", features = [ "blocking" ]}

View File

@ -15,7 +15,7 @@
use std::fmt;
use std::mem;
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Component {
Text(TextComponent),
}
@ -115,7 +115,7 @@ impl Default for Component {
}
}
#[derive(Debug, Default, Clone)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Modifier {
pub extra: Option<Vec<Component>>,
pub bold: Option<bool>,
@ -159,7 +159,7 @@ impl Modifier {
}
}
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TextComponent {
pub text: String,
pub modifier: Modifier,
@ -199,7 +199,7 @@ impl fmt::Display for TextComponent {
}
}
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Color {
Black,
DarkBlue,

View File

@ -17,7 +17,7 @@ use crate::protocol::{self, Serializable};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use std::io;
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub struct Stack {
pub id: isize,
pub count: isize,

View File

@ -20,7 +20,7 @@ use super::protocol;
use super::protocol::Serializable;
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub enum Tag {
End,
Byte(i8),
@ -37,7 +37,7 @@ pub enum Tag {
LongArray(Vec<i64>),
}
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub struct NamedTag(pub String, pub Tag);
impl Tag {

View File

@ -5,7 +5,7 @@ use std::io;
use super::{Error, LenPrefixed, Serializable, VarInt};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Phase {
// Client handshake states (written)
Start,
@ -44,7 +44,7 @@ impl Serializable for Phase {
}
}
#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct ForgeMod {
pub modid: String,
pub version: String,
@ -64,7 +64,7 @@ impl Serializable for ForgeMod {
}
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ModIdMapping {
pub name: String,
pub id: VarInt,
@ -87,7 +87,7 @@ impl Serializable for ModIdMapping {
pub static BLOCK_NAMESPACE: &str = "\u{1}";
pub static ITEM_NAMESPACE: &str = "\u{2}";
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum FmlHs {
ServerHello {
fml_protocol_version: i8,
@ -196,7 +196,7 @@ pub mod fml2 {
// https://wiki.vg/Minecraft_Forge_Handshake#FML2_protocol_.281.13_-_Current.29
use super::*;
#[derive(Clone, Default, Debug)]
#[derive(Clone, Default, Debug, PartialEq, Eq)]
pub struct Channel {
pub name: String,
pub version: String,
@ -216,7 +216,7 @@ pub mod fml2 {
}
}
#[derive(Clone, Default, Debug)]
#[derive(Clone, Default, Debug, PartialEq, Eq)]
pub struct Registry {
pub name: String,
pub marker: String,
@ -236,7 +236,7 @@ pub mod fml2 {
}
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum FmlHandshake {
ModList {
mod_names: LenPrefixed<VarInt, String>,

View File

@ -75,7 +75,7 @@ macro_rules! state_packets {
use crate::protocol::*;
use std::io;
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq)]
pub enum Packet {
$(
$(
@ -107,7 +107,7 @@ macro_rules! state_packets {
}
$(
#[derive(Default, Debug)]
#[derive(Default, Debug, Clone, PartialEq)]
$(#[$attr])* pub struct $name {
$($(#[$fattr])* pub $field: $field_type),+,
}
@ -418,7 +418,7 @@ impl Serializable for f64 {
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub struct UUID(u64, u64);
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UUIDParseError;
impl std::error::Error for UUIDParseError {}
@ -469,6 +469,7 @@ impl Serializable for UUID {
}
}
#[derive(Clone, PartialEq, Eq)]
pub struct Biomes3D {
pub data: [i32; 1024],
}
@ -511,6 +512,7 @@ pub trait Lengthable: Serializable + Copy + Default {
fn from_len(_: usize) -> Self;
}
#[derive(Clone, PartialEq, Eq)]
pub struct LenPrefixed<L: Lengthable, V> {
len: L,
pub data: Vec<V>,
@ -566,6 +568,7 @@ impl<L: Lengthable, V: fmt::Debug> fmt::Debug for LenPrefixed<L, V> {
}
// Optimization
#[derive(Clone, PartialEq, Eq)]
pub struct LenPrefixedBytes<L: Lengthable> {
len: L,
pub data: Vec<u8>,
@ -662,7 +665,7 @@ impl Lengthable for i32 {
use num_traits::cast::{cast, NumCast};
/// `FixedPoint5` has the 5 least-significant bits for the fractional
/// part, upper for integer part: https://wiki.vg/Data_types#Fixed-point_numbers
#[derive(Clone, Copy)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct FixedPoint5<T>(T);
impl<T: Serializable> Serializable for FixedPoint5<T> {
@ -708,7 +711,7 @@ where
}
/// `FixedPoint12` is like `FixedPoint5` but the fractional part is 12-bit
#[derive(Clone, Copy)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct FixedPoint12<T>(T);
impl<T: Serializable> Serializable for FixedPoint12<T> {
@ -755,7 +758,7 @@ where
/// `VarInt` have a variable size (between 1 and 5 bytes) when encoded based
/// on the size of the number
#[derive(Clone, Copy)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct VarInt(pub i32);
impl Lengthable for VarInt {
@ -818,7 +821,7 @@ impl fmt::Debug for VarInt {
/// `VarShort` have a variable size (2 or 3 bytes) and are backwards-compatible
/// with vanilla shorts, used for Forge custom payloads
#[derive(Clone, Copy)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct VarShort(pub i32);
impl Lengthable for VarShort {
@ -881,7 +884,7 @@ impl fmt::Debug for VarShort {
/// `VarLong` have a variable size (between 1 and 10 bytes) when encoded based
/// on the size of the number
#[derive(Clone, Copy)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct VarLong(pub i64);
impl Lengthable for VarLong {
@ -963,7 +966,7 @@ impl Serializable for Position {
/// Direction is used to define whether packets are going to the
/// server or the client.
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Direction {
Serverbound,
Clientbound,
@ -1436,7 +1439,7 @@ pub fn try_parse_packet(ibuf: Vec<u8>, protocol_version: i32) {
}
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Status {
pub version: StatusVersion,
pub players: StatusPlayers,
@ -1446,20 +1449,20 @@ pub struct Status {
pub fml_network_version: Option<i64>,
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StatusVersion {
pub name: String,
pub protocol: i32,
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StatusPlayers {
pub max: i32,
pub online: i32,
pub sample: Vec<StatusPlayer>,
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StatusPlayer {
name: String,
id: String,

View File

@ -16,7 +16,7 @@
use serde_json::json;
use sha1::{self, Digest};
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Profile {
pub username: String,
pub id: String,

View File

@ -2474,7 +2474,7 @@ state_packets!(
}
);
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct SpawnProperty {
pub name: String,
pub value: String,
@ -2497,7 +2497,7 @@ impl Serializable for SpawnProperty {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Statistic {
pub name: String,
pub value: VarInt,
@ -2517,7 +2517,7 @@ impl Serializable for Statistic {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct BlockChangeRecord {
pub xz: u8,
pub y: u8,
@ -2540,7 +2540,7 @@ impl Serializable for BlockChangeRecord {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct ChunkMeta {
pub x: i32,
pub z: i32,
@ -2563,7 +2563,7 @@ impl Serializable for ChunkMeta {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct ExplosionRecord {
pub x: i8,
pub y: i8,
@ -2586,7 +2586,7 @@ impl Serializable for ExplosionRecord {
}
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MapIcon {
pub direction_type: i8,
pub x: i8,
@ -2619,7 +2619,7 @@ impl Default for MapIcon {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct Advancement {
pub id: String,
pub parent_id: Option<String>,
@ -2672,7 +2672,7 @@ impl Serializable for Advancement {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct AdvancementDisplay {
pub title: String,
pub description: String,
@ -2725,7 +2725,7 @@ impl Serializable for AdvancementDisplay {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct AdvancementProgress {
pub id: String,
pub criteria: LenPrefixed<VarInt, CriterionProgress>,
@ -2745,7 +2745,7 @@ impl Serializable for AdvancementProgress {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct CriterionProgress {
pub id: String,
pub date_of_achieving: Option<i64>,
@ -2773,7 +2773,7 @@ impl Serializable for CriterionProgress {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct BlockEntityAtPackedLocation {
/// The packed section coordinates, calculated from ((blockX & 15) << 4) | (blockZ & 15)
pub packed_xz: u8,
@ -2801,7 +2801,7 @@ impl Serializable for BlockEntityAtPackedLocation {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct EntityEquipment {
pub slot: u8,
pub item: Option<item::Stack>,
@ -2822,7 +2822,7 @@ impl Serializable for EntityEquipment {
}
// Top-bit terminated array of EntityEquipment
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct EntityEquipments {
pub equipments: Vec<EntityEquipment>,
}
@ -2852,7 +2852,7 @@ impl Serializable for EntityEquipments {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct EntityProperty {
pub key: String,
pub value: f64,
@ -2875,7 +2875,7 @@ impl Serializable for EntityProperty {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct EntityProperty_i16 {
pub key: String,
pub value: f64,
@ -2898,7 +2898,7 @@ impl Serializable for EntityProperty_i16 {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct PropertyModifier {
pub uuid: UUID,
pub amount: f64,
@ -2921,7 +2921,7 @@ impl Serializable for PropertyModifier {
}
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq)]
pub struct PlayerInfoData {
pub action: VarInt,
pub players: Vec<PlayerDetail>,
@ -3007,7 +3007,7 @@ impl Default for PlayerInfoData {
}
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PlayerDetail {
Add {
uuid: UUID,
@ -3034,7 +3034,7 @@ pub enum PlayerDetail {
},
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PlayerProperty {
pub name: String,
pub value: String,
@ -3044,7 +3044,7 @@ pub struct PlayerProperty {
use crate::item;
type RecipeIngredient = LenPrefixed<VarInt, Option<item::Stack>>;
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq)]
pub enum RecipeData {
Shapeless {
group: String,
@ -3118,7 +3118,7 @@ impl Default for RecipeData {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct Recipe {
pub id: String,
pub ty: String,
@ -3240,7 +3240,7 @@ impl Serializable for Recipe {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Tags {
pub tag_name: String,
pub entries: LenPrefixed<VarInt, VarInt>,
@ -3259,7 +3259,7 @@ impl Serializable for Tags {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct TagsGroup {
pub tag_type: String,
pub tags: LenPrefixed<VarInt, Tags>,
@ -3278,7 +3278,7 @@ impl Serializable for TagsGroup {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct Trade {
pub input_item_1: Option<nbt::NamedTag>,
pub output_item: Option<nbt::NamedTag>,
@ -3321,7 +3321,7 @@ impl Serializable for Trade {
}
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub struct CommandNode {
pub flags: u8,
pub children: LenPrefixed<VarInt, VarInt>,
@ -3332,14 +3332,14 @@ pub struct CommandNode {
pub suggestions_type: Option<String>,
}
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
enum CommandNodeType {
Root,
Literal,
Argument,
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq)]
pub enum CommandProperty {
Bool,
Double {
@ -3571,7 +3571,7 @@ impl Serializable for CommandNode {
}
}
#[derive(Debug, Clone, Default)]
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NumberedSlot {
pub slot_number: i16,
pub slot_data: Option<item::Stack>,

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Set {
data: Vec<u64>,
}

View File

@ -24,6 +24,7 @@ use std::fmt;
use std::io;
use std::marker::PhantomData;
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct MetadataKey<T: MetaValue> {
index: i32,
ty: PhantomData<T>,
@ -39,6 +40,7 @@ impl<T: MetaValue> MetadataKey<T> {
}
}
#[derive(Clone, PartialEq)]
pub struct Metadata {
map: HashMap<i32, Value>,
}
@ -491,7 +493,7 @@ impl Default for Metadata {
}
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq)]
pub enum Value {
Byte(i8),
Short(i16),
@ -516,7 +518,7 @@ pub enum Value {
Pose(PoseData),
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq)]
pub enum ParticleData {
AmbientEntityEffect,
AngryVillager,
@ -655,7 +657,7 @@ impl Serializable for ParticleData {
}
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(dead_code)]
pub struct VillagerData {
villager_type: protocol::VarInt,
@ -680,7 +682,7 @@ impl Serializable for VillagerData {
}
}
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PoseData {
Standing,
FallFlying,

View File

@ -19,7 +19,7 @@ pub mod bit;
pub mod hash;
pub mod nibble;
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Gamemode {
Survival = 0,
Creative = 1,

View File

@ -393,7 +393,7 @@ fn flood_fill(snapshot: &world::Snapshot, visited: &mut Set, x: i32, y: i32, z:
touched
}
#[derive(Clone, Copy, Default)]
#[derive(Clone, Copy, Default, PartialEq, Eq)]
pub struct CullInfo(u64);
impl CullInfo {

View File

@ -659,7 +659,9 @@ fn handle_window_event<T>(
use std::f64::consts::PI;
if game.focused {
window.set_cursor_grab(true).unwrap();
window
.set_cursor_grab(winit::window::CursorGrabMode::Locked)
.unwrap();
window.set_cursor_visible(false);
if let Some(player) = game.server.player {
let rotation = game
@ -677,7 +679,9 @@ fn handle_window_event<T>(
}
}
} else {
window.set_cursor_grab(false).unwrap();
window
.set_cursor_grab(winit::window::CursorGrabMode::None)
.unwrap();
window.set_cursor_visible(true);
}
}
@ -715,12 +719,16 @@ fn handle_window_event<T>(
&& !game.screen_sys.is_current_closable()
{
game.focused = true;
window.set_cursor_grab(true).unwrap();
window
.set_cursor_grab(winit::window::CursorGrabMode::Locked)
.unwrap();
window.set_cursor_visible(false);
} else if !game.focused {
#[cfg(not(target_arch = "wasm32"))]
// TODO: after Pointer Lock https://github.com/rust-windowing/winit/issues/1674
window.set_cursor_grab(false).unwrap();
window
.set_cursor_grab(winit::window::CursorGrabMode::None)
.unwrap();
window.set_cursor_visible(true);
ui_container.click_at(
game,
@ -766,14 +774,18 @@ fn handle_window_event<T>(
match (input.state, input.virtual_keycode) {
(ElementState::Released, Some(VirtualKeyCode::Escape)) => {
if game.focused {
window.set_cursor_grab(false).unwrap();
window
.set_cursor_grab(winit::window::CursorGrabMode::None)
.unwrap();
window.set_cursor_visible(true);
game.focused = false;
game.screen_sys.replace_screen(Box::new(
screen::SettingsMenu::new(game.vars.clone(), true),
));
} else if game.screen_sys.is_current_closable() {
window.set_cursor_grab(true).unwrap();
window
.set_cursor_grab(winit::window::CursorGrabMode::Locked)
.unwrap();
window.set_cursor_visible(false);
game.focused = true;
game.screen_sys.pop_screen();

View File

@ -588,6 +588,7 @@ impl Renderer {
info.count = count;
}
#[allow(clippy::uninit_vec)] // TODO: fix uninitialized memory, use MaybeUninit on Vec below
fn do_pending_textures(&mut self) {
let len = {
let tex = self.textures.read().unwrap();