Commit Graph

495 Commits

Author SHA1 Message Date
Slushie 67e019faba
entity/player: rotate nametag to face player (#746)
Nametag is rotated to face the player (Around the Y axes. it still doesn't rotate up or down, I don't know how to rotate it on both axis)
2022-12-31 08:30:22 -08:00
iceiix 6ad43b3ccb
Merge pull request #731 from nathanruiz/digging
Add the ability to break blocks
2022-10-30 16:10:45 -07:00
ice_iix e4c5e61857 Fix clippy::manual_find, replace with an iterator
This manual implementation of Iterator::find can be replaced with
`find`, which has the same performance, but Clippy considers easier to
read than the original implementation.
2022-10-30 15:36:50 -07:00
ice_iix 6394b60a39 Fix clippy::needless_borrow in console
Clippy says the compiler automatically borrows this
2022-10-30 15:32:31 -07:00
ice_iix e8558b427a Fix clippy::type_complexity, refactor type alias
Use a type alias to refactor the submit_funcs type definition, as a
vector of boxed SubmitFuncs. Note this type alias isn't used in the
parameterized add_submit_func() function because it accepts a trait, not
a type - no `dyn` keyword in this context, but it is needed in the type
definition.
2022-10-30 15:27:28 -07:00
ice_iix 4c45ada7ef Fix clippy::drop_non_drop on MaybeUninit<T> in ecs
std::mem::drop was called on a value which does not implement `Drop`,
specifically std::mem::MaybeUninit<T>. According to the Clippy warning,
this only extends its contained lifetime. Change to assume_init_drop().
2022-10-30 15:18:46 -07:00
Nathan Ruiz ee8e6cb9f3 Fix formatting 2022-10-30 21:46:21 +00:00
Nathan Ruiz 4ac2a8dafa Fix position serialization 2022-10-24 16:04:54 +00:00
Nathan Ruiz 18b2641d66 Send correct dig packet for each version 2022-10-24 16:04:30 +00:00
Nathan Ruiz ddd9eb26e4 Fix formatting issues 2022-10-24 09:21:33 +00:00
Nathan Ruiz 700a31013f Add digging to ECS 2022-09-27 07:07:22 +00:00
Nathan Ruiz 7edc7ee4fa Parse light values in 1.18 2022-09-18 04:45:00 +00:00
Nathan Ruiz 8f96f6169f Write tests for parsing chunks across versions 2022-09-16 17:41:05 +00:00
Nathan Ruiz a5b3b61989 Refactor chunk section management to support 1.18 2022-09-16 07:17:09 +00:00
iceiix fe8d8ece9c
Fix set_cursor_grab on Linux. Closes #714 (#717)
The glutin/winit update in #700 changed set_cursor_grab from a bool to
an enum, but always used CursorGrabMode::Locked, which is only available
on macOS. Conditionally compile to use CursorGrabMode::Confined otherwise.
Fixes #714 and fixes #713 

* set_cursor_grab failed with NotSupported(NotSupportedError) on Linux
Patch from https://github.com/iceiix/stevenarella/issues/714

* cargo fmt

Co-authored-by: inferno <inferrna@gmail.com>
2022-08-28 09:30:56 -07:00
iceiix bbbe58a112
Update to Rust 1.59.0 (#718)
* Update to Rust 1.59.0

* Fix clippy::single_char_pattern in console, ui/logo

* Fix clippy::needless_late_init in load_block_entities
2022-08-28 08:27:39 -07:00
iceiix 1f183ed76e
1.18.1 protocol (757) (#640)
https://wiki.vg/index.php?title=Protocol&oldid=17203 1.18.1
https://wiki.vg/index.php?title=Protocol&type=revision&diff=17203&oldid=16918 1.18.1 vs 1.17.1

* protocol: add UpdateSimulationDistance packet and update IDs
* protocol: add JoinGame_WorldNames_IsHard_SimDist packet variant
* protocol: add UpdateBlockEntity_VarInt packet variant
* protocol: start adding ChunkData_AndLight, combining ChunkData + UpdateLight
* protocol: ChunkData_AndLight: add struct BlockEntityAtPackedLocation

* server: handle JoinGame_WorldNames_IsHard_SimDist packet variant
* server: handle combined chunk data and light packet
* server: on_chunk_data_and_light: set all bits in now-removed bitmask

* bit map: add derived std::fmt::Debug implementation
* bit map: allow creating, but not accessing, zero-length bit maps

* world: sanity check chunk bit_size, failing earlier
* world: read biome data bits after palette
* world: support single-valued palettes
* world: handle single-valued biomes
* world: add checks for direct palettes; update comments
* world: parse dimension tags
* world: load dimension type tags: min_y
* world: skip chunk sections underneath y<0
* world: force filling sky on 1.18+ for now, workaround until mask/fill_sky can be calculated correctly wrt min_y

* readme: add 1.18.1 (757)
2022-08-06 16:32:40 -07:00
iceiix ba3cf43f93
Update dependencies: glutin 0.29, winit 0.27, and more (#700)
* Update to glutin 0.29.0, winit 0.27.0. Closes #695
Change true/false to CursorGrabMode::Locked/None for set_cursor_grab
https://github.com/rust-windowing/winit/releases/tag/v0.27.0
> Breaking: Window::set_cursor_grab now accepts CursorGrabMode to control grabbing behavior.

* Update web-sys to 0.3.59. Closes #699

* Update flate2 to 1.0.24. Closes #698

* Update zip to 0.6.2. Closes #697

* Update to log 0.4.17. Closes #696
2022-07-30 15:54:49 -07:00
ice_iix 9486bf817b render: suppress clippy::uninit_vec for now 2022-03-06 13:39:20 -08:00
Ben Reeves 9a8d3572eb Derive Clone, PartialEq, Eq, and Hash where appropriate.
This is really useful for anyone who wishes to use the steven_protocol
crate and write tests that compare packets to expected values.
2022-02-05 15:42:38 -08:00
ice_iix c3edf715ef Fix clippy needless_borrow and unused_mut 2021-12-24 09:25:15 -08:00
ice_iix 669e37ac5c Suppress dead_code warnings for unused fields new in Rust 1.57 2021-12-24 09:17:58 -08:00
iceiix cfcc7d2a1f
1.17.1 (756) protocol (#605)
https://wiki.vg/index.php?title=Protocol&oldid=16918

New and changed packets:
* 1.17.1 packet id shifts, new clientbound packets
* Add WindowPong new packet serverbound
* Add Tags_Nested packet variant
* Add TeleportPlayer_WithDismount packet variant
* Add ChunkData_Biomes3D_Bitmasks packet variant 
* Add WindowItems_StateCarry variant, split WindowItems_i16
* Add WindowSetSlot_State packet variant
* Add Explosion_VarInt packet variant
* Add UpdateLight_Arrays variant
* Add ResourcePackSend_Prompt variant
* Add SpawnPosition_Angle variant
* Add EntityProperties_VarIntVarInt variant, using VarInts in both fields 
* Add ClientSettings_Filtering variant
* Add ClickWindow_State variant
* Add EditBook packet variant 
* Fix many Particle packet variant definitions

* server: handle TeleportPlayer_WithDismount
* server: handle ChunkData_Biomes3D_Bitmasks

* world: add num_sections to self.load_chunk19_or_115
* world: load_chunk19_to_117: accept 64-bit mask

* metadata: add PoseData::LongJumping 

* protocol: update Cargo.lock for serde_json 1.0.130
* build: pin to wasm-pack 0.10.0
2021-09-05 13:30:32 -07:00
dependabot[bot] 83bbb9fe4f
gl: Update to glow 0.11.0 (#594)
* gl: update for newtype wrappers Default impl

* build(deps): bump glow from 0.10.0 to 0.11.0

Bumps [glow](https://github.com/grovesNL/glow) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/grovesNL/glow/releases)
- [Commits](https://github.com/grovesNL/glow/commits)

---
updated-dependencies:
- dependency-name: glow
  dependency-type: direct:production
  update-type: version-update:semver-minor
2021-09-01 19:21:49 -07:00
terrarier2111 3ae7e0e178
Fix transparency while ingame (#592). Fixes #570 2021-08-29 18:25:35 -07:00
ice_iix 47df12b5ee main: allow clippy::needless_borrow since it isn't needless for web 2021-08-01 06:25:57 -07:00
ice_iix 3d1bea85fe Fix clippy::needless_borrow 2021-08-01 06:19:48 -07:00
ice_iix eb420c4896 Fix clippy::manual_str_repeat 2021-08-01 06:19:48 -07:00
terrarier2111 44fd1f933c
screen: fixed a focusing bug in the settings (#565)
The game was previously focused after clicking the done button in the individual settings, which would cause the game to be focused while still in the main settings menu.
2021-07-31 18:56:06 -07:00
terrarier2111 d260162642
entity/systems: fixed typo in comment (#566) 2021-07-18 09:12:42 -07:00
terrarier2111 9e0dc7cceb
settings: remove outdated comment (#564)
This notice is outdated as the file was already renamed to settings.rs.
2021-07-18 09:09:00 -07:00
ice_iix b145e1ad0e Fix clippy::branches_sharing_code in chunk loading 2021-06-18 19:32:26 -07:00
ice_iix 526dfa65b6 Fix clippy::uninit_assumed_init, use MaybeUninit<T> 2021-06-18 19:32:26 -07:00
ice_iix 728367c59b Fix clippy::collapsible_match, collapse it 2021-06-18 19:32:26 -07:00
ice_iix 53a0bc9fb6 Fix clippy::manual_flatten, use flatten() 2021-06-18 19:32:26 -07:00
ice_iix d15229dd0b Fix clippy::mem_replace_with_default, use std::mem::take 2021-06-18 19:32:26 -07:00
ice_iix c4dac61ab5 Fix clippy::manual_map, no longer manual 2021-06-18 19:32:26 -07:00
iceiix 63c9d81687
Update to glow 0.9.0. Closes #532 (#545) 2021-05-25 08:13:07 -07:00
Kezi 8cecbb37e3
server: fix block placement in 1.16 (#512)
* fix block placement in 1.16

* fmt
2021-03-03 19:34:36 -08:00
ice_iix d7b7216315 server: thread_rng is a CSPRNG, closes #508 2021-03-03 19:11:56 -08:00
ice_iix 995cf981c5 main: remove console chat activation, updates #479 2021-02-18 17:40:45 -08:00
iceiix 3e3bcdc5da
protocol, console, server: receive chat messages (#479)
Implements support for receiving chat messages from the server, the
first step towards #63 chat support. Long way to go, but is a start.

* server: handle ServerMessage_* packets, on_servermessage

* format: get the with arguments of translations
* format: hardcode chat types
* format: support bare strings, used in chat.type.text
* format: use extra text if present, fixes missing username on 1.16.5

* console/main/server: activate on receiving chat messages
2021-01-24 17:41:16 -08:00
iceiix 6b961622aa
forge: add FML2 protocol support (1.13.2-1.16.5+), fixes #400 (#494)
Allows connecting to newer Forge servers, 1.13.2 to 1.16.5 at least, which use
the FML2 handshake protocol:

https://wiki.vg/Minecraft_Forge_Handshake#FML2_protocol_.281.13_-_Current.29

Tested with a modded 1.16.5 server

Extends #88 #134 Forge FML (v1, for 1.7.10 - 1.12.2)

* protocol: update Cargo.lock
* protocol: send FML2 on fmlNetworkVersion: 2
* protocol: factor out read_raw_packet_from()
* protocol: move plugin message writing from Server to Conn; add write_fml2_handshake_plugin_message
* protocol: CommandNode: add forge:modid, forge:enum
* forge: add fml2 handshake packets
* server: handle fml:loginwrapper fml::handshake packets
2021-01-23 13:47:30 -08:00
iceiix 3daa9c0b83
console: configurable log levels, file logging (#359) (#488)
* console: write to log file (configdir/client.log)

* console: change to log only Info and more important to terminal (but all to file)

* console: configurable log levels
2021-01-20 15:22:28 -08:00
iceiix c7bdb60d85
CI enhancements: .app bundling, build .wasm (#486)
Updates to enhance GitHub Actions continuous integration:

* ci: add macOS app bundle packaging using cargo-bundle, closes #352 
based on https://github.com/EndlessSkyCommunity/ESLauncher2/blob/master/Cargo.toml
* ci: add web target, building using wasm-pack (for #446) 
* ci: refactor and cleanup targets, split out instead of using matrix

* main: save config in consistent OS-specific dirs::config_dir()
Instead of storing and loading in the current working directory, change
to a consistent dedicated configuration directory. This is necessary for
.app launching since cwd is set to /. To preserve compatibility with
existing installations, if conf.cfg exists in cwd then it will be used instead,
but otherwise we will use the operating system specific config dirs:
// Lin: Some(/home/alice/.config)
// Win: Some(C:\Users\Alice\AppData\Roaming)
// Mac: Some(/Users/Alice/Library/Application Support)

* macos: add icons based on screenshotted logo
* macos: add Cmd-Q to quit
2021-01-18 19:05:29 -08:00
iceiix 0b4c56b803
1.7.10: populate player info on spawn, fixes #141 (#485)
PlayerInfo post-1.7.10 has the UUID, so it populates the self.players map,
in 1.7.10 there is only enough information for the client <tab> list. To fix
this, instead populate self.players in SpawnPlayer, for the 1.7.10 variant.

Fixes player name tags showing as "MISSING" on 1.7.10 servers.
2021-01-18 13:53:09 -08:00
iceiix 2b6103e6d9
gl: fix disembodied player model found in #141 (#484)
Regression introduced in #262 by the glow port, correct the raw size to
include all elements in set_float_multi().

See https://github.com/iceiix/stevenarella/issues/141#issuecomment-762417970
2021-01-18 11:50:00 -08:00
iceiix c505903aed
ui: fix backspace on Windows, closes #481 (#482) 2021-01-17 18:32:13 -08:00
iceiix 0c65cc1e0d
ui: keyboard input fixes (#432, #476) (#477)
* Fix Cmd-V typing v, suppress key_type on ctrl/logo, closes #432
Only send key_type() when modifiers are not pressed.

* Fix backspace repeat and inserting ⌂, closes #476
Handle backspace in key_type instead of key_press, so we get
auto-repeat for free, and can suppress typing the character.
2021-01-16 14:11:17 -08:00
iceiix 4dd25de709
ui: click TextBox to focus, fixes #415 (#475)
Previously text boxes could only be focused by cycling through
focus with the tab key, now you can click with the mouse as well.
2021-01-15 16:42:20 -08:00
iceiix 8ca12a69ce
blocks: versioned block states, fixes world on fire #467 (#469)
Since the unflattening in 1.13.x, block IDs are no longer stable across versions, and
can be shifted by the addition of new block states. To get the right block IDs across
multiple protocol versions, add a new `offsets` token to `define_blocks!`, which
is similar to `offset` (used post-flattening, compare to `data` used pre-flattening),
but accepts a protocol_version argument to enable block states _per-version_:

* Add 'offsets' for protocol_version-specific blockstates

As part of this change, by_vanilla_id is now a method of a VanillaIDMap instance,
instead of a method of Block, so it can know the protocol version. Previously, the
ID map was lazily computed statically, once, but this change allows it to be
computed based on protocol version:

* Move by_vanilla_id to VanillaIDMap instance

Tools to help debug blocks:

* Add DEBUG_BLOCKS environment variable to dump block states
* Add dump_block command-line tool

The block `offset`s were previously only correct for 1.13.2, to take advantage of
the new version-specific `offsets` capability, blocks were updated for 1.14.x:

1.14+ (protocol_version >= 477):
* Add NoteBlock instruments
* Add FlowerPot and RedFlowerVariant cornflower, wither rose, lily of the valley
* Add StandingSign wood variants
* Add WallSign tree variants
* Add StoneSlab smooth stone, cut sandstone, cut red sandstone

This fixes #467, where grass was misinterpreted as fire on 1.14+ because of the
ID shifts caused by NoteBlock, among other block misassignments (though not 100%).
2021-01-13 19:50:05 -08:00
ice_iix fa2e5e8bdb chunk_builder: single-threaded on wasm (#458)
Refactor the chunk builder to use multithreading on native, but no threads on
wasm, at least until we have web workers or wasm threads. With this change
and the shader fix, chunks now render on Chrome (albeit with no textures).
Another step towards 🕸️ Web support #446.

* Single-threaded chunk builder

* shaders: chunk_frag: consistently enable outputs, fixes GL_INVALID_OPERATION on WebGL
2021-01-07 17:26:58 -08:00
iceiix 8208e3b595
wasm: enable events loop (#459)
On the web, we have a separate render_loop (for window.requestAnimationFrame)
and events_loop (for winit/window events), so `game` and `ui_container` are shared
using an `Rc<RefCell>`, and `winit_window` as well for wasm only (on native,
`glutin_window` which provides access to the winit window is used instead).

With these changes, events (hover, click, etc.) and rendering now work in the web.
Another step towards 🕸️ Web support (#446)

* wasm: enable events loop

* Use Rc<RefCell>'s for winit_window

* Use Rc<RefCell> for game and ui_container

* main: disable set_cursor_grab() call on wasm to get further until Pointer Lock is available
2021-01-04 10:14:55 -08:00
iceiix 22f6c83d59
WebGL fixes after disabling threaded chunk builder (#451)
At this point, the UI renders in the browser through WebGL, with no GL errors.
Progress towards #446 🕸️ Web support

* main: enable render loop on wasm, disable events_loop on wasm for now
Allow for testing rendering on WebGL

* chunk_builder: disable on wasm due to no threads on wasm
Chunks will not be correctly rendered, but other parts of the program now can be tested instead of crashing in std::thread

* chunk_frag: glBindFragDataLocation is only on native, WebGL 2 uses in-shader specification layout(location=), which works on native in OpenGL 4.1 but we're on OpenGL 3.2 - see https://www.khronos.org/opengl/wiki/Fragment_Shader#Output_buffers

* std_or_web: always fail File::open() to avoid servers.json empty string JSON parse failing

* www: update installation instructions

* render: fix apparent TEXTURE_MAX_LEVEL -> TEXTURE_MAG_FILTER typo

* render: correct type for internalFormat DEPTH_COMPONENT24
Valid combinations of format, type, and internalFormat are listed at https://www.khronos.org/registry/OpenGL/specs/es/3.0/es_spec_3.0.pdf#page=124&zoom=100,168,206. We had UNSIGNED_BYTE for DEPTH_COMPONENT24, but only UNSIGNED_INT is a valid type for this internal format.

Fixes texImage: Mismatched internalFormat and format/type: 0x81a6 and 0x1902/0x1401
and fixes the subsequent GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error.

* render: gl::MULTISAMPLE (0x809d) is not available on WebGL
Fixes WebGL warning: enabled: cap: Invalid enum value <enum 0x809d> 0.bootstrap.js line 11 > eval:851:21

* gl: replace set_float_multi_raw with a safer set_float_multi
Removes use of passing raw pointers in set_float_multi_raw parameters
Instead, casts raw pointers to flatten, similar to set_matrix_multi
Fixes uniform setter: (uniform colorMul[0]) values length (1) must be a positive integer multiple of size of <enum 0x8b52>.

* render: model: send BYTE to id attrib, fixes type mismatch
Fixes drawElementsInstanced: Vertex attrib 0 requires data of type INT, but is being supplied with type UINT
2020-12-31 14:35:30 -08:00
iceiix b7bd59f75f
Update to Rust 1.49.0 (#457)
* Update to Rust 1.49.0

* Fix clippy::manual_range_contains warnings
2020-12-31 09:51:46 -08:00
ice_iix 80887eec91 1.16.2+: fix Respawn dimension field, closes #452 2020-12-27 18:13:51 -08:00
ice_iix 71121bd572 load_block_entities: check for missing id, fixes #445 2020-12-27 17:49:22 -08:00
iceiix 352f1965af
Update rand to 0.8.0, add getrandom js for web (#450)
* Add getrandom with js feature for JavaScript web compatibility

* Update to rand 0.8.0, closes #440

* Update to rand_pcg 0.3.0, closes #434

* Update rsa_public_encrypt_pkcs1 to 0.3.0, updates rand 0.8.0
2020-12-27 16:14:11 -08:00
iceiix 503a98d7a8
Use instant over std::time, for wasm compat (#449)
Replace std::time with the `instant` crate, which bridges to std::time on
native but on wasm calls performance.now() instead of panicking.

A step towards 🕸️ Web support #446

* logo: replace SystemTime/UNIX_EPOCH with Instant
2020-12-27 15:06:03 -08:00
iceiix 8e728830b3
render: disable clouds on wasm (#448)
No clouds on wasm since no geo shaders on WebGL
Needed for 🕸️ Web support #446, to fix "invalid shader type", see https://github.com/iceiix/stevenarella/pull/442#issuecomment-751428548
2020-12-27 10:42:01 -08:00
iceiix b8b4cb07a7
Disable multisampled textures, glTexImage2DMultisample (#447)
Steven used multisampled textures from the beginning, but this caused
incompatibilities: https://github.com/Thinkofname/steven/issues/74.
Subsequently fixed by increasing the number of samples, but increasing
it beyond the limit caused more incompatibilities, so it was clamped to
the maximum samples reported as supported by the system.

Fast-forward to now, as part of adding WebGL support (#446), the use of
multisampled textures via the glTexImage2DMultisample() call is
unsupported on this platform. Replace the following:

* glTexImage2DMultisample -> glTexImage2D
* TEXTURE_2D_MULTISAMPLE -> TEXTURE_2D
* sampler2DMS -> sampler2D

This disables the custom multisampling anti-aliasing algorithm (MSAA)
implemented in the chunk fragment shader, increasing compatibility:

* Update to glow release, remove image_2d_sample()

MSAA may be added back at a later date using multisampled renderbuffers
instead, see #442.
2020-12-27 10:14:39 -08:00
iceiix 0471eb3a82 Use web-sys for web backend (#444)
A small step for #446 🕸️ Web support, use web-sys to interface to the web.
Previously, we would try to use glutin on the web, which is not supported;
now glutin is only used on native: fixes #171 could not find Context in platform_impl.

winit is still used on both, but the GL context is created with web-sys and glow
(on the web), and created with glutin and used with glow (on native). stdweb is
no longer used, being replaced by web-sys.

Substantial refactoring to allow reusing the code between web/native:

* settings: use VirtualKeyCode from winit, not reexported from glutin
* std_or_web: remove broken localstoragefs/stdweb, add File placeholder
* render: disable skin_thread on wasm since we don't have threads

* gl: use glow types in gl wrapper (integers in native, but Web*Key in web)
* gl: web-sys WebGlUniformLocation does not implement Copy trait, so glow::UniformLocation doesn't so gl::Uniform can't
* gl: refactor context initialization, pass glow::Context to gl::init for consistency between native/web
* gl: update to glow with panicking tex_image_2d_multisample web-sys wrapper

* glsl: use shader version in GLSL for WebGL 2 and OpenGL 3.2

* shaders: add explicit float/int type conversions, required for WebGL
* shaders: specify mediump precision, required for WebGL
* shaders: specify fragment shader output locations for WebGL

* main: refactor handle_window_event to take a winit window, not glutin context
* main: handle resize outside of handle_window_event since it updates the glutin window (the only event which does this)
* main: use winit events in handle_window_event not reexported glutin events
* main: refactor game loop handling into tick_all()
* main: create winit window for WebGL, and use winit_window from glutin
* main: restore console_error_panic_hook,  mistakingly removed in (#260)
* main: remove force setting env RUST_BACKTRACE=1, no longer can set env on web

* www: index.js: fix wasm import path
* www: npm update, npm audit fix
* www: update readme to link to status on #446 🕸️ Web support
2020-12-26 13:43:21 -08:00
iceiix 0aa062f4b8
Use glow, GL on Whatever (#262)
Replaces the use of gl_generator with the glow wrapper:

* Add glow dependency, based on glow 0.6.1

* Pin version of glow fork for https://github.com/iceiix/glow/pull/1 until #442 renderbuffer

* Remove gl module, steven_gl

Porting details:
* Initialize glow in src/gl/mod.rs
* Call gl methods on glow context
* glow uses camelcase
* Import glow::HasContext trait, finds draw_elements etc.
* Fix mismatched types, glow uses Option and &str instead of raw pointers
* Fix uniform_location, glow already returns Some(u32)
* uniform_location: convert i32 to u32 for Uniform
* Fix attribute_location
* Fix shader creation Result u32 type 
* Fix passing GLvoid and 2d/3d
* Fix missing Options type mismatches
* Offsets are i32 in glow, not GLvoid
* Fix clear_buffer using _f32_slice
* Delete methods are singular not plural
* glBufferData -> buffer_data_u8_slice
* buffer_sub_data_u8_slice
* Update more glow method wrapper names found by reviewing glow native platform
* Remove unused multi_draw_elements, can be replaced by draw_elements in a loop and it has no WebGL equivalent
* glow implements glMapBufferRange
* Remove unused read_buffer
* glow's deletes automatically pass 1 and take no reference
* shader_source() accepts &str directly; removes last of std::ptr
* Pass uniform Option<u32>
* Fix bool passing normalized parameter
* Fix draw_buffers parameter
* Stop unnecessarily returning context from gl::init
* Getting shader info is unsafe 
* Unwrapping static mut is unsafe
* Use unsafe raw pointers for global mutable context
* Fix initializing GL objects wrappers from glow wrappers
* Unbinding framebuffers uses None
* Uppercase global to fix warning
* Shaders return Some instead of None
* Unbox the context to a raw pointer
* Use tex_image_2d_multisample added in glow fork 
* Implement uniform_location, fixing unwrap None failed
* Add tex_sub_image_3d, using PixelUnpackData::Slice
* set_matrix4: transmute the Matrix4 since it is repr(C)
* get_pixels -> get_tex_image -> glGetTexImage, with PixelPackData::Slice
* Wrap sub_image_2d (glTexSubImage2D) and fix warnings
* Implement set_float_multi_raw and set_matrix4_multi, using from_raw_parts
2020-12-25 10:00:22 -08:00
iceiix 9bc10c1100
Update to glutin 0.26.0 + winit 0.24.0 (#334)
* Update for ModifiersChanged event

* Consistently use logical position and size

CursorMoved gives us a PhysicalPosition, which needs to be converted
to LogicalPosition to properly track the mouse movement. Change the
width/height passed to be a LogicalSize instead of a PhysicalPosition,
matching the LogicalPosition.
2020-12-20 08:18:39 -08:00
ice_iix 37f55e2c57 Add --network-parse-packet option 2020-12-19 15:32:19 -08:00
iceiix 710a7732ef
Update to Rust 1.48 (#424)
* Update to Rust 1.48.0

* Fix clippy::single_char_push_str warnings

* Fix clippy::manual_strip warnings
2020-11-24 19:35:55 -08:00
ice_iix f3faae383e Bump image to 0.23.12 (closes #422) 2020-11-24 19:02:18 -08:00
iceiix 4a757656ab 1.16.4 (754) / 1.16.3 (753) / 1.16.2 (751) protocol (#390)
Adds support for 1.16.4 (754) / 1.16.3 (753) / 1.16.2 (751) protocols

* Update packet IDs and readme

* Add and handle ChunkData_Biomes3D_VarInt variant

* Support world chunk data padded bit map array

* Add and handle JoinGame_WorldNames_IsHard variant

* Add and handle MultiBlockChange_Packed variant

* Add UnlockRecipes_WithBlastSmoker variant

* Add SetDisplayedRecipe and SetRecipeBookState packets
2020-11-24 19:01:57 -08:00
ice_iix ff90d8af6a Use `matches!` for bool match (clippy match_like_matches_macro) 2020-10-10 16:22:46 -07:00
ice_iix d362f136f1 1.15.1+: handle SpawnPlayer variant, fixes #357 2020-07-05 00:21:26 -07:00
iceiix 1fabc0c5bf
server_list: implement server deletion, fixes #355 (#361)
Adds a delete_server screen to delete servers, handled by clicking
the "X" button on the server list, similar to the "E" button for edit_server.
2020-07-04 17:42:17 -07:00
ice_iix 64fc29796d server_list: fix pre-1.13 favicon data, #353 (#354)
The server list ping response contains a base64-encoded favicon image,
which in pre-1.13 servers can have embedded newlines:
https://wiki.vg/Server_List_Ping#Response

> The favicon should be a PNG image that is Base64 encoded (without
> newlines: \n, new lines no longer work since 1.13) and prepended
> with data:image/png;base64,.

If this was the case, base64 decode would fail with a DecodeError,
similar to Invalid byte (76, 10). We now strip the whitespace, so the
base64 favicon can be decoded properly.
2020-07-03 16:07:36 -07:00
ice_iix 337ee74b22 Allow verbose bit mask because this is in a performance-critical path, tick(), and it is faster on Intel according to https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask 2020-07-02 18:11:52 -07:00
ice_iix 9cfb686528 Use cmp match to replace if chain (comparison_chain) 2020-07-02 17:58:12 -07:00
ice_iix 476d46cac6 Use into_*(self) convention, fixes wrong_self_convention 2020-07-02 17:51:51 -07:00
ice_iix 5ce06c3067 Suppress type_complexity, would not be clarified by using a type definition 2020-07-02 17:49:04 -07:00
ice_iix 7ef173416a Suppress needless_range_loop in chunk loading for clarity -- it will always be 16, and this value is not from block_types, blocks_meta, blocks_add, but must be consistent with all variables and is part of the wire protocol 2020-07-02 17:47:12 -07:00
ice_iix 0d1e86a233 Box block update sign text to reduce enum size from 268 bytes (large_enum_variant)
warning: large size difference between variants
  --> src/world/mod.rs:54:5
   |
54 | /     UpdateSignText(
55 | |         Position,
56 | |         format::Component,
57 | |         format::Component,
58 | |         format::Component,
59 | |         format::Component,
60 | |     ),
   | |_____^ this variant is 268 bytes
   |
   = note: `#[warn(clippy::large_enum_variant)]` on by default
note: and the second-largest variant is 12 bytes:
  --> src/world/mod.rs:53:5
   |
53 |     Remove(Position),
   |     ^^^^^^^^^^^^^^^^
help: consider boxing the large fields to reduce the total size of the enum
  --> src/world/mod.rs:54:5
   |
54 | /     UpdateSignText(
55 | |         Position,
56 | |         format::Component,
57 | |         format::Component,
58 | |         format::Component,
59 | |         format::Component,
60 | |     ),
   | |_____^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
2020-07-02 17:39:40 -07:00
ice_iix f88036ea4e Use byte literal b"" instead of as_bytes (string_lit_as_bytes) 2020-07-02 17:29:16 -07:00
ice_iix 7f5ab06c34 Use !is_empty instead of length check (len_zero) 2020-07-02 17:25:55 -07:00
ice_iix 113abefd80 Fix unnecessary use of match with if let (single_match) 2020-07-02 17:22:24 -07:00
ice_iix deb35db895 Use more descriptive name to fix blacklisted_name 'bar' (as in foobar) 2020-07-02 17:17:51 -07:00
ice_iix 2e2c82eae4 Use if let pattern match to fix unnecessary_wrap 2020-07-02 17:14:49 -07:00
ice_iix 9939eae361 Use values_mut() to iterate map values (for_kv_map) 2020-07-02 17:07:48 -07:00
ice_iix 35f29705b3 Use question mark operator idiom (question_mark) 2020-07-02 16:53:27 -07:00
ice_iix c27425750d Change set_float_multi_raw to unsafe because it dereferences a raw pointer argument (not_unsafe_ptr_arg_deref); fix typo 2020-07-02 16:51:50 -07:00
ice_iix 0f9dcd2515 Use unwrap_or_else to fix two or_fun_call and suppress one 2020-06-30 19:09:15 -07:00
ice_iix 07fd4788e1 Use += to fix assign_op_pattern 2020-06-30 19:03:59 -07:00
ice_iix bffb33297f Allow float_cmp since we use it to check if floating point values changed from the last value assigned, not compare two different floating point values; downgrade not_unsafe_ptr_arg_deref to warning 2020-06-30 19:01:17 -07:00
ice_iix c4690bba32 Use add(x) instead of offset(x as isize), fixes ptr_offset_with_cast 2020-06-30 18:56:08 -07:00
ice_iix 8a0936faac Disable clippy::let_and_return for now in src/render/mod.rs 2020-06-30 18:53:33 -07:00
ice_iix d496eaf3bb Use is_*() instead of if let x(_), fixes redundant_pattern_matching 2020-06-30 18:50:46 -07:00
ice_iix b4aa23ecf5 Use if let instead of map, fixes option_map_unit_fn 2020-06-30 18:48:25 -07:00
ice_iix 98dff0b390 Fix redundant clones 2020-06-29 18:48:07 -07:00
ice_iix 8fb5491e15 Add missing default implementations (new_without_default) 2020-06-29 18:42:07 -07:00
ice_iix 9d88168d0e Fix collapsible_if in lighting update 2020-06-29 18:26:53 -07:00
ice_iix 55856ccf1b Allow TeleportFlag enum variant names Rel..., Rel..., as they are all relative 2020-06-29 18:26:29 -07:00
ice_iix e8c066cd26 Clippy: allow too_many_arguments, many_single_char_names 2020-06-29 18:17:16 -07:00
ice_iix fe5cb47d40 Fix redundant field names in struct initialization (redundant_field_names) 2020-06-29 18:07:12 -07:00
ice_iix 132b40c19e Fix collapsible_if in main game loop 2020-06-29 18:06:51 -07:00