Commit Graph

391 Commits

Author SHA1 Message Date
dependabot[bot] c331e2b55e Bump rand from 0.5.5 to 0.6.4
Bumps [rand](https://github.com/rust-random/rand) from 0.5.5 to 0.6.4.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.5.5...0.6.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-11 21:36:48 -08:00
ice_iix c80372a1f1 Rename project to Stevenarella (#83)
This fork has significantly diverged from the original, it is time
to make it official, as a new distinct project. Forked from
https://github.com/thinkofname/steven into https://github.com/iceiix/steven,
now moved to https://github.com/iceiix/stevenarella and renamed accordingly.

* Update readme

* Update logo

* Update binary name

* Update window title

* Update splash text
2019-01-11 20:41:19 -08:00
iceiix 916473d8a7
Add 19w02a (452) multiprotocol support (#82)
Adds support for the 19w02a (451) protocol, yesterday's snapshot.
Builds on https://github.com/iceiix/steven/pull/79 18w50a
Closer to https://github.com/iceiix/steven/issues/72 1.14 protocol support
Updates https://github.com/iceiix/steven/issues/18 Enhance protocol support

* Add 19w02a (452) protocol

* Add campfire recipe type

* Add trade list new packet, and window open variants
2019-01-10 17:47:07 -08:00
iceiix 9adf589436
Add 18w50a (451) multiprotocol support (#79)
Adds 18w50a (451) multiprotocol support, last snapshot of 2018
Reference: https://wiki.vg/index.php?title=Pre-release_protocol&oldid=14491

* Use v18w50a module for protocol

* Add blasting, smoking, and suspicious stew recipe types

* Add entity tags to tags packet

* Add chunk data packet variant with height map

* Add update light packet

* Add chunk format parsing with block_count, without skylights, conditionalize on protocol_version >= 451

* Add villager data entity metadata type parsing

https://wiki.vg/Pre-release_protocol#Entity_Metadata

* Add open book and entity sound effect packets
2019-01-10 17:21:19 -08:00
iceiix 98cc88df5c
Workaround resource manager RwLock deadlock (#78). Closes https://github.com/iceiix/steven/issues/75
game.resource_manager, an Arc<RwLock<resources::Manager>>, sometimes hangs on write(), apparently a deadlock. Switch to using try_write() and continue the main game loop iteration if it fails, using the previous resource version and allow main loop tick if can't obtain a write lock. No warning is logged since this error is recoverable and seemingly intermittent. May not be the best fix, but unblocking iterative development.
2019-01-06 19:56:34 -08:00
iceiix e1769edae8
Update base64, serde_json, and serde (#76)
* Update to base64 0.10.0, use standard base64 config. Closes https://github.com/iceiix/steven/pull/52

* Update to serde_json 1.0.34. Closes https://github.com/iceiix/steven/pull/73

* Update to serde 1.0.84. Closes https://github.com/iceiix/steven/pull/74
2019-01-05 19:55:27 -08:00
iceiix 11f2d2ae13 1.13.2 (404) multiprotocol support (#67)
Adds support for 1.13.2 protocol (404)
Expands https://github.com/iceiix/steven/issues/18 Enhance protocol support

Metadata:

* Support 1.13.2 slot data format, bool and varint item id, optional damage (moved to NBT)

https://wiki.vg/index.php?title=Slot_Data&type=revision&diff=14363&oldid=7835

Packets:

* Add 1.13.2 packets, and implement all the command data parsers

https://wiki.vg/Command_Data#Parsers

* Send new plugin channel minecraft:brand

https://wiki.vg/Plugin_channels#minecraft:brand

* Add 1.13.2 metadata format, with shifted IDs

https://wiki.vg/Entity_metadata#Entity_Metadata_Format

* Implement particle entity metadata

* Add structures for 16 new packets

Blocks: The Flattening:

* Assign flattened IDs in correct order using new 'offset' macro token

* Assign hierarchical (pre-flattening) block IDs sequentially by counting Some data

* Split VANILLA_ID_MAP into flat/hier struct, to support before and after the flattening

* Extend travis build time to 20 minutes because the blocks macro takes a long time

* Support both flat/hier blocks by passing protocol_version to by_vanilla_id

Add block states and offsets for all blocks, replacing metadata for 1.13+:

* Add stripped logs and what was Log2 to Log
* Add the Wood blocks, should be called bark, previously Axis::None Log
* Add leaves distance and offset
* Add jungle/acacia to Leaves moved from Leaves2
* Add dispenser offsets, direction
* Add note block states
* Add offset None to Missing253 and Missing254, no holes in block states of 1.13.2
* Add bed colors
* Add seagrass, tall seagrass, remove redundant deadgrass, and piston offset
* Add torch, TNT, fire offsets, remove slabs
* Add furnance offset, merges lit into a property
* Add pressure plate offsets, new pressure plates, redstone ore/lit merged
* Add lever offsets, new directions from ceiling/floor, rename LeverDirections
* Add redstone torch offsets, new blocks since lit/unlit is now merged, and standing/wall is split
* Change lever to split face/facing, rm LeverDirection, add AttachedFace
* Add stone button offsets, face/facing similar to lever
* Move face/facing data and variant to AttachedFace, reuse for lever/stonebutton
* Add data_with_facing_and_powered() to AttachedFace, for lever/stonebutton
* Add wooden button offsets each wood
* Add pumpkin without a face
* Add carved pumpkin, portal offsets
* Add lit pumpkin (as jack-o-lantern) offsets after carved pumpkin
* Add repeater offsets, merged into Repeater
* Change brown mushroom block to booleans instead of MushroomVariant
* Add mushroom block offsets, red/brown mushroom blocks, and a new mushroom stem block
* Add command block, cobblestone walls, and flower pot offsets
Empty flower pot, and potted plants including saplings. Rename
variant DarkOak to DarkOakSaplings because it is a sapling, and
remove the duplicate Dandelion variant which causes duplicate blocks.
* Increase recursion limit in steven_blocks
* Add colored banner offsets
* Add wooden slab including double slab, in a different position for pre-1.13 and 1.13
* StoneSlabVariant::Wood -> StoneSlabVariant::PetrifiedWood
* Add fence_gate_offset() for wooden fence gates
* Add frosted ice age, offset
* Add new blocks: kelp, turtle egg, coral, coral fans, sea pickle, blue ice, smooth stone
* Add new blocks: conduit, void air, cave aid, bubble column, last of the 1.13 blocks
2018-12-28 21:22:58 -08:00
dependabot[bot] e360fbd3d4 Bump serde from 1.0.82 to 1.0.83 (#70)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.82 to 1.0.83.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.82...v1.0.83)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-28 17:17:23 -08:00
iceiix bf8d913d19
Add new blocks up to 1.12 (#68)
* Add observer block
Added in 1.11: https://minecraft.gamepedia.com/Observer

* Add shulker box blocks, using wool for models for now
Added in 1.12: https://minecraft.gamepedia.com/Shulker_Box

* Add glazed terracotta
Added in 1.12: https://minecraft.gamepedia.com/Glazed_Terracotta

* Add concrete and concrete powder
Both were added in 1.12:
https://minecraft.gamepedia.com/Concrete
https://minecraft.gamepedia.com/Concrete_Powder

* Add structure block
https://minecraft.gamepedia.com/Structure_Block
2018-12-22 14:34:06 -08:00
iceiix 797b20aaf9
Add new blocks up to 1.10 (#69)
* Update blocks/Cargo.lock

* Add magma block

Turns out magma was added way back in 1.10: https://minecraft.gamepedia.com/Magma_Block

* Add nether wart block and red nether brick

Both were added in 1.10:
https://minecraft.gamepedia.com/Nether_Wart_Block
https://minecraft.gamepedia.com/Nether_Bricks#History

* Add bone blocks

Added in 1.10, and they have orientation similar to logs:
https://minecraft.gamepedia.com/Bone_Block

* Add structure void

Added in 1.10, invisible but not a barrier:
https://minecraft.gamepedia.com/Structure_Block#Structure_void
2018-12-17 19:20:51 -08:00
iceiix 2b641c9af3 1.7.10 (5) multiprotocol support (#64)
Adds 1.7.10 protocol version 5 support, a major update with significant changes.
Expands https://github.com/iceiix/steven/issues/18 Enhance protocol support

* Add v1_7_10 protocol packet structures and IDs

* EncryptionRequest/Response i16 variant in login protocol

* 1.7.10 slot NBT data parsing

* Support both 1.7/1.8+ item::Stack in read_from, using if protocol_verson

* 1.7.10 chunk format support, ChunkDataBulk_17 and ChunkData_17

* Extract dirty_chunks_by_bitmask from load_chunks17/18/19

* Implement keepalive i32 handler

* Send PlayerPositionLook_HeadY

* Send PlayerBlockPlacement_u8_Item_u8y

* Handle JoinGame_i8_NoDebug

* Handle SpawnPlayer_i32_HeldItem_String

* BlockChange_u8, MultiBlockChange_i16, UpdateBlockEntity_Data, EntityMove_i8_i32_NoGround, EntityLook_i32_NoGround, EntityLookAndMove_i8_i32_NoGround

* UpdateSign_u16, PlayerInfo_String, EntityDestroy_u8, EntityTeleport_i32_i32_NoGround

* Send feet_y = head_y - 1.62, fixes Illegal stance

https://wiki.vg/index.php?title=Protocol&oldid=6003#Player_Position

> Updates the players XYZ position on the server. If HeadY - FeetY is less than 0.1 or greater than 1.65, the stance is illegal and the client will be kicked with the message “Illegal Stance”.

> Absolute feet position, normally HeadY - 1.62. Used to modify the players bounding box when going up stairs, crouching, etc…

* Set on_ground = true in entity teleport, fixes bouncing

* Implement block change, fix metadata/id packing, bounce _u8 through on_block_change

* Implement on_multi_block_change_u16, used with explosions
2018-12-17 15:59:17 -08:00
dependabot[bot] 44dc7eedd5 Bump serde from 1.0.80 to 1.0.82 (#66)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.80 to 1.0.82.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.80...v1.0.82)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-14 18:17:35 -08:00
ice_iix 46999f59bb Add protocol version global mutable to merge Metadata18/19 into one
Cleans up https://github.com/iceiix/steven/pull/57 1.8.9 (47) multiprotocol support
which added too much code duplication, Metadata19 vs Metadata18, and
different packets for each, the only difference being how it was parsed.

Instead, switch back to using only one Metadata implementation, but with
parsing conditionalized on a new global mutable: SUPPORTED_PROTOCOL_VERSION.
Accessing global mutable state is unsafe but it is only set when
initializing the connection, and only read when deep enough in the code
where it is not feasible to pass otherwise. More elegant, worth it.
2018-12-11 18:18:25 -08:00
ice_iix 1cb671093d 1.8.9 (47) multiprotocol support (#57)
Protocol 47 (1.8.9-1.8) is the biggest multiprotocol (https://github.com/iceiix/steven/issues/18) change yet:

* New chunk format (load_chunk18)
* New metadata format (Metadata18)
* New packets and changes to 13 packets

References:

http://wiki.vg/index.php?title=Protocol&oldid=7368
https://wiki.vg/Protocol_version_numbers#Versions_after_the_Netty_rewrite
https://wiki.vg/Protocol_History#1.8
https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.8/protocol.json
1.8 chunk format: https://wiki.vg/index.php?title=Chunk_Format&oldid=6124
1.9 chunk format: https://wiki.vg/index.php?title=Chunk_Format&oldid=7411
1.8 vs 1.9: https://wiki.vg/index.php?title=Chunk_Format&diff=7411&oldid=6124
https://github.com/PrismarineJS/prismarine-chunk/blob/master/src/pc/1.8/section.js
https://github.com/PrismarineJS/prismarine-chunk/blob/master/src/pc/1.8/chunk.js

Details:

* Add 1.8.9 packet IDs from https://github.com/iceiix/steven/pull/37

* Add ChunkDataBulk, parse the ChunkMeta and save data in Vec<u8>

* Add EntityEquipment u16 variant, EntityStatus, ChunkData u16 variants

* SpawnPlayer with added held item

https://wiki.vg/Protocol_History#15w31a Removed Current Item short from Spawn Player (0x0C)

* SpawnObject no UUID and optional velocity

https://wiki.vg/index.php?title=Protocol&oldid=7368#Spawn_Object
https://wiki.vg/Protocol_History#15w31a
Added Entity UUID after entity ID to Spawn Object (0x0E)
Spawn Object always sends velocity, even if data is 0

* SpawnMob no UUID variant

https://wiki.vg/Protocol_History#15w31a
Added Entity UUID after entity ID to Spawn Mob (0x0F)

* Maps packet without tracking position boolean

https://wiki.vg/index.php?title=Protocol&oldid=7368#Map
https://wiki.vg/Protocol_History#15w34a
Added tracking position boolean to Map (0x34)

* Update Entity NBT was removed and Bossbar added (both 0x49) >1.8

https://wiki.vg/index.php?title=Protocol&oldid=7368#Update_Entity_NBT
https://wiki.vg/Protocol_History#15w31a
Removed Update Entity NBT Packet (0x49)
Added Boss Bar packet (0x4

* Use entity without hands

https://wiki.vg/index.php?title=Protocol&oldid=7368#Use_Entity
https://wiki.vg/Protocol_History#15w31a
Added VarInt enum for selected hand in Use Entity (0x02); only sent if type is interact or interact at

* Player block placement, held item stack and face byte variant

https://wiki.vg/index.php?title=Protocol&oldid=7368#Player_Block_Placement
https://wiki.vg/Protocol_History#15w31a
Face for Player Block Placement is now a VarInt enum instead of a byte
Replaced held item (slot) with VarInt enum selected hand in Player Block Placement

* Arm swing without hands, a packet with no fields, uses a ZST

https://wiki.vg/index.php?title=Protocol&oldid=7368#Animation_2
https://github.com/iceiix/steven/pull/57#issuecomment-444289008
https://doc.rust-lang.org/nomicon/exotic-sizes.html

* ClickWindow uses u8 mode, same as in 15w39c

* ClientSettings without hands

* SpectateTeleport is added before ResourcePackStatus

* Copy load_chunk to load_chunk19 and load_chunk18

* 1.8 chunk reading implementation, load_chunk18

* Support both metadata formats, Metadata18/Metadata19

* Remove fmt::Debug

* Implement formatting in MetadataBase and bounce through fmt::Debug
2018-12-09 12:03:55 -08:00
iceiix bd4a521072
Update to Rust stable 1.31.0. Closes https://github.com/iceiix/steven/issues/47 (#60) 2018-12-06 18:16:57 -08:00
ice_iix 3a359267dd Fix backspace not deleting in textfields, but shows ⌂. Closes https://github.com/iceiix/steven/issues/55 2018-12-04 15:51:20 -08:00
dependabot[bot] de4fd7d28d Bump serde from 1.0.79 to 1.0.80 (#59)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.79 to 1.0.80.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.79...v1.0.80)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-04 15:22:19 -08:00
dependabot[bot] 16d0d2dded Bump zip from 0.4.2 to 0.5.0 (#58)
Bumps [zip](https://github.com/mvdnes/zip-rs) from 0.4.2 to 0.5.0.
- [Release notes](https://github.com/mvdnes/zip-rs/releases)
- [Commits](https://github.com/mvdnes/zip-rs/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-04 15:22:00 -08:00
ice_iix a5a6a71397 Fix logging bad packet IDs in multiprotocol packet translation macro
https://github.com/iceiix/steven/pull/57#issuecomment-443962662
2018-12-04 08:03:58 -08:00
iceiix 3f5024d4ec
Add 15w39c (74) multiprotocol support (#56)
Closes https://github.com/iceiix/steven/pull/17
This is the biggest multi-protocol change yet, adding many new packet variants and implementing the most, necessitating a respectable amount of refactoring. The last of the "easy" protocols (already implemented, and cribbed from Steven commit history).
For https://github.com/iceiix/steven/issues/18 Enhance protocol support

* Add 15w39c packet IDs

* Add 15w39c packet changes

* Implement EntityMove i16 and i8 packet variants

* Implement EntityLookAndMove i16 and i8 packet variants

* Implement TeleportPlayer no confirm / with confirm packet variants

* Implement EntityTeleport f64 and i32 packet variants

* Implement SpawnPlayer f64 and i32 packet variants
2018-12-03 19:29:02 -08:00
ice_iix b6de7103a7 Add 1.9 (107) multiprotocol support
Closes https://github.com/iceiix/steven/pull/16
Enhances https://github.com/iceiix/steven/issues/18
2018-12-03 16:06:20 -08:00
ice_iix 166079ab06 Add 1.9.2 (109) multiprotocol support
Closes https://github.com/iceiix/steven/pull/15
Enhances https://github.com/iceiix/steven/issues/18
2018-12-03 15:40:57 -08:00
ice_iix 7e54e68d72 Add 1.10.2 (210) multiprotocol support
Closes https://github.com/iceiix/steven/pull/14
Enhances https://github.com/iceiix/steven/issues/18
2018-12-03 15:04:39 -08:00
ice_iix 26bc33a178 Update flate2, sha-1, lazy_static, and reqwest dependencies
Closes https://github.com/iceiix/steven/pull/49 Bump flate2 from 1.0.2 to 1.0.6
Closes https://github.com/iceiix/steven/pull/50 Bump sha-1 from 0.8.0 to 0.8.1
Closes https://github.com/iceiix/steven/pull/51 Bump lazy_static from 1.1.0 to 1.2.0
Closes https://github.com/iceiix/steven/pull/53 Bump reqwest from 0.9.4 to 0.9.5
2018-12-03 14:29:29 -08:00
iceiix d03f102bb8
Multiprotocol support: 1.12.2 and 1.11.2 (#54)
Adds support for connecting to both 1.12.2 and 1.11.2 (protocols 340 and 316) servers

https://github.com/iceiix/steven/issues/18 Enhance protocol support
Closes https://github.com/iceiix/steven/pull/48 1.11.2 protocol support (316)

* Restore create_ids!() macro in packet identifiers

* Add translate_packet_id() function to map external 1.12.2 packet ids to internal sequential ids

* Implement translate_internal_packet_id() from a new protocol_packet_ids! macro

* Move packet IDs to separate file, v1_12_2.rs

* Change supported protocols constant to an array

* Add v1_11_2 protocol packet IDs (from https://github.com/iceiix/steven/pull/48)

* Add keep alive packet variants: _i64 (>=1.12.2) and _VarInt (<=1.11.2)

* Abstract protocol versions, can now connect to both 1.12.2 and 1.11.2

* Send protocol version in handshake packet

* Restore 1.11 (315) protocol support as in original (https://github.com/thinkofname/steven) Steven
2018-12-03 14:22:47 -08:00
iceiix be6e1f79f1 1.12.2 protocol support (340) (#40)
* Add new 1.12.2 packets and shift IDs

CraftRecipeResponse
AdvancementTab
SelectAdvancementTab
Advancements
CraftingRecipeRequest
UnlockRecipes
CraftingBookData

* Fix unlock recipes packet, add length-prefixed arrays

https://wiki.vg/index.php?title=Protocol&oldid=14204#Unlock_Recipes

* Update resources to 1.12.2

* Handle NBTTag metadata (value 13), parsed as nbt::NamedTag

https://wiki.vg/index.php?title=Entity_metadata&oldid=14048#Entity_Metadata_Format
https://github.com/iceiix/steven/pull/40#issuecomment-443454757

* Fix entity packet IDs, 0x25 now is Entity https://wiki.vg/index.php?title=Protocol&oldid=14204#Entity

* Add NBT long array (type 12) support

https://wiki.vg/NBT#Specification

* Entity metadata type is now a VarInt, not u8: https://wiki.vg/index.php?title=Entity_metadata&oldid=14048#Entity_Metadata_Format

* Keep alives changed to longs, no longer VarInts

https://wiki.vg/index.php?title=Protocol&oldid=14204#Keep_Alive_.28serverbound.29

* Parse CraftRecipeResponse (0x2b)

* Add structs for advancements data

* Implement Serializable trait for Advancement and AdvancementDisplay

* Implement advancement progress parsing; advancement packet works

* Particle packet adds fallingdust (46) with length 1

https://wiki.vg/index.php?title=Protocol&oldid=14204#Particle_2
2018-12-02 19:37:41 -08:00
ice_iix 36d9c1383e Recognize translate text components, instead of showing "UNHANDLED"
For example, if a server connection times out and you are kicked, Steven
will now show disconnect.reason timeout, versus a non-descriptive
UNHANDLED message. This text is supposed to be looked up in a
translation table for localization, not yet supported, but showing the
translation identifier is more informative than nothing.
2018-12-02 19:25:11 -08:00
dependabot[bot] 8dade5b230 Bump byteorder from 1.2.6 to 1.2.7 (#45)
Bumps [byteorder](https://github.com/BurntSushi/byteorder) from 1.2.6 to 1.2.7.
- [Release notes](https://github.com/BurntSushi/byteorder/releases)
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.2.6...1.2.7)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-02 07:16:31 -08:00
dependabot[bot] 0b356337b1 Bump image from 0.20.0 to 0.20.1 (#43)
Bumps [image](https://github.com/PistonDevelopers/image) from 0.20.0 to 0.20.1.
- [Release notes](https://github.com/PistonDevelopers/image/releases)
- [Changelog](https://github.com/PistonDevelopers/image/blob/master/CHANGES.md)
- [Commits](https://github.com/PistonDevelopers/image/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-02 07:16:18 -08:00
dependabot[bot] ff8a452af9 Bump log from 0.4.5 to 0.4.6 (#42)
Bumps [log](https://github.com/rust-lang/log) from 0.4.5 to 0.4.6.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang-nursery/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.5...0.4.6)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-02 07:16:06 -08:00
dependabot[bot] a5d913d61a Bump serde_json from 1.0.32 to 1.0.33 (#41)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.32 to 1.0.33.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.32...v1.0.33)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-02 07:15:54 -08:00
iceiix e8025a0978
1.11.2 (316) protocol update (#38)
Only a minor update, -1 now indicates no color, so changed u8 to i8:

https://wiki.vg/Protocol_History#16w50a
https://wiki.vg/index.php?title=Protocol&diff=8543&oldid=8405
https://wiki.vg/index.php?title=Protocol&oldid=8543

and updated version numbers. 1.11.2 uses the same 1.11 assets, which can
be found by looking up 1.11.2 in:

https://launchermeta.mojang.com/mc/game/version_manifest.json
https://launchermeta.mojang.com/v1/packages/6bd228727ed48bd7ac7bdc0088587dad0fb7c02b/1.11.2.json

1.11.2/1.11 is compatible except for the version number, which is now sent matching the server (#20), so no backwards-compatible branch for 1.11 (315) is needed.

https://github.com/iceiix/steven/issues/18 Enhance protocol support
2018-12-01 10:10:48 -08:00
iceiix 936fb17d1a
AppVeyor: skip building branches and 32-bit Windows (#39)
AppVeyor as configured is too slow, so make it do less:

* Prevent duplicate AppVeyor builds on pull requests https://github.com/appveyor/ci/issues/882

* Only allow AppVeyor to build updates branch, https://www.appveyor.com/docs/branches/#white--and-blacklisting

* Only build for 64-bit Windows (x64) to improve CI times; remove x86
2018-12-01 09:29:18 -08:00
iceiix 6189d560fd
Explicitly assign packet IDs (not implicitly from ordering in source code) (#19)
The packet IDs were assigned by the `create_ids!` macro, in the order they are in
the source code. This reduces flexibility for adopting new protocols, since the
packets can be reordered arbitrarily. Part of https://github.com/iceiix/steven/issues/18
2018-11-30 17:02:26 -08:00
iceiix d80eca3940
Get the protocol version to send from the ping packet (#20)
The first step of https://github.com/iceiix/steven/issues/18 Enhance protocol support,
instead of hardcoding a fixed version, the client now matches whatever the server sent.

* Get the protocol version to send from the ping packet

* Save/load server protocol versions to disk, server_versions.json

* Fallback to default SUPPORTED_PROTOCOL if no ping response
2018-11-30 16:41:27 -08:00
iceiix c099a68168
Use glutin to replace sdl2 (#35)
* Add glutin dependency

* Create a glutin window

* Use the glutin window, basics work

* Store DPI factor on game object, update on Resized

* Use physical size for rendering only. Fixes UI scaled too small

Fixes https://github.com/iceiix/steven/pull/35#issuecomment-442683373
See also https://github.com/iceiix/steven/issues/22

* Begin adding mouse input events

* Listen for DeviceEvents

* Call hover_at on mouse motion

* Listen for CursorMoved window event, hovering works

Glutin has separate WindowEvent::CursorMoved and
DeviceEvent::MouseMotion events, for absolute cursor and relative mouse
motion, respectively, instead of SDL's Event::MouseMotion for both.

* Use tuple pattern matching instead of nested if for MouseInput

* Implement left clicking

* Use grab_cursor() to capture the cursor

* Hide the cursor when grabbing

* Implement MouseWheel event

* Listen for keyboard input, escape key release

* Keyboard input: console toggling, glutin calls backquote 'grave'

* Implement fullscreen in glutin, updates https://github.com/iceiix/steven/pull/31

* Update settings for glutin VirtualKeyCode

* Keyboard controls (note: must clear conf.cfg to use correct bindings)

* Move DeviceEvent match arm up higher for clarity

* Remove SDL

* Pass physical dimensions to renderer tick so blit_framebuffer can use full size but the ui is still sized logically.

* Listen for DeviceEvent::Text

* Implement text input using ReceivedCharacter window event, works

https://github.com/iceiix/steven/pull/35#issuecomment-443247267

* Request specific version of OpenGL, version 3.2

* Request OpenGL 3.2 but fallback to OpenGL ES 2.0 if available (not tested)

* Set core profile and depth 24-bits, stencil 0-bits

* Allow changing vsync, but require restarting (until https://github.com/tomaka/glutin/issues/693)

* Clarify specific Rust version requirement

* Import glutin::* in handle_window_event() to avoid overly repetitive code

* Linux in VM fix: manually calculate delta in MouseMotion

For the third issue on https://github.com/iceiix/steven/pull/35#issuecomment-443084458
https://github.com/tomaka/glutin/issues/1084 MouseMotion event returns absolute instead of relative values, when running Linux in a VM

* Heuristic to detect absolute/relative MouseMotion from delta:(xrel, yrel); use a higher scaling factor

* Add clipboard pasting with clipboard crate instead of sdl2

https://github.com/iceiix/steven/pull/35#issuecomment-443307295
2018-11-30 11:35:35 -08:00
iceiix 26b1867604 Fix uninitialized texP and heightP in clouds_geo. Closes https://github.com/iceiix/steven/issues/32 2018-11-28 16:45:25 -08:00
ice_iix b91ef23c20 Fix model rendering on OSX by removing [] from uniform names. Closes https://github.com/iceiix/steven/issues/25 2018-11-27 17:03:36 -08:00
iceiix 47d18781b6
Add toggling full screen mode with F11 hotkey (#31)
* Detect when F11 is pressed

* Change mutability of window in handle_window_event()

* Toggle fullscreen between Desktop and Off
2018-11-20 19:42:36 -08:00
ice_iix 58ea3442b8 Add FreeBSD support. Closes https://github.com/iceiix/steven/issues/29 2018-11-20 08:30:19 -08:00
iceiix e72cf4787c
Update to Visual Studio 2017 (#28)
* Update readme for Windows with rustup and VS17

* Update AppVeyor to build with Visual Studio 2017

* Drop Visual Studio 2015 support in favor of 2017
2018-11-20 07:06:31 -08:00
ice_iix 7d41bb838d Revert "Change multisampling count to 0, improved fix/workaround for AMD GPUs (#26)"
NUM_SAMPLES=0 or 1 breaks AMD Radeon R9 M295X on Windows 11, but 2 works.

This reverts commit 748911a91b.
2018-11-19 17:44:06 -08:00
ice_iix 1854275282 Fix HDPI scale/offset: Revert "Use drawable_size instead of size for rendering"
Closes https://github.com/iceiix/steven/issues/22 Wrong GUI offsets on AMD Radeon R9 M295X

This reverts commit 715b0cb1ee.
2018-11-19 07:51:55 -08:00
iceiix 748911a91b
Change multisampling count to 0, improved fix/workaround for AMD GPUs (#26)
Part of fixing graphical rendering bugs: https://github.com/iceiix/steven/issues/25
Corrupted graphics on AMD video cards: https://github.com/Thinkofname/steven/issues/74

The previous workaround set NUM_SAMPLES to 2, but this added an extra texel fetch. Setting to 1 reproduces the 16px blue striped unexpected behavior. Setting to 0 samples avoids the extra fetch and the striping.

This is allowed per http://docs.gl/gl3/glTexImage2DMultisample:
> samples specifies the number of samples in the image and must be in the range zero to GL_MAX_SAMPLES - 1.
2018-11-18 16:18:16 -08:00
iceiix e12ea17aaa
Update readme for installation instructions from wiki (#21)
* Copy contents of wiki https://github.com/Thinkofname/steven/wiki/Compiling-and-or-running

* Update and cleanup install instructions: now uses MSVC instead of MinGW on Windows, and no longer uses OpenSSL (https://github.com/iceiix/steven/issues/2)
2018-11-18 08:11:23 -08:00
ice_iix 52ed85a440 Update to rsa_public_encrypt_pkcs1 0.2.0 2018-11-05 17:17:02 -08:00
ice_iix 9b31646a8d Disable three stylistic Clippy warnings, var names/params, never loop
This allows the tool to continue and emit a bunch more warnings
2018-11-04 15:01:44 -08:00
ice_iix d111497a50 Use if let instead of match to fix clippy warning 2018-11-04 14:39:08 -08:00
ice_iix b4514a8500 Fix clippy warnings: passed by reference, but would be more efficient if passed by value
https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#trivially_copy_pass_by_ref

i = 0
ll = map(lambda x: int(x.strip()), file("/tmp/lines").readlines())
ll2 = map(lambda x: int(x.strip()), file("/tmp/lines2").readlines())
for line in file("/Users/admin/games/rust/steven/blocks/src/lib.rs").readlines():
    i += 1
    line = line[:-1]

    if i in ll:
        line = line.replace("&self", "self")

    if i in ll2:
        line = line.replace("*self", "self")

    print line
2018-11-04 14:31:46 -08:00
ice_iix ca14ea595b Fix clippy warnings: casting u8 to f64 may become silently lossy if types change
https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#cast_lossless
2018-11-04 14:21:10 -08:00
ice_iix 77cd4ecf35 Use field init shorthand, instead of x:x, just x,
https://rust-lang-nursery.github.io/edition-guide/rust-2018/data-types/field-init-shorthand.html

find src -name '*.rs' -exec perl -pe 's/\b(\w+): \1,/$1,/g' -i {} \;
2018-11-04 13:43:30 -08:00
ice_iix 2af7307d8b Remove inferred 'static lifetime on const, Rust 1.17+
No longer needed since it is inferred automatically:
https://rust-lang-nursery.github.io/edition-guide/rust-2018/ownership-and-lifetimes/simpler-lifetimes-in-static-and-const.html
2018-11-04 13:37:57 -08:00
ice_iix 103a58f92a Remove unnecessary #[macro_use] on console 2018-11-04 12:53:03 -08:00
ice_iix 411e4f69a6 Remove unnecessary 'extern crate's in Rust 2018 edition, import macros
https://rust-lang-nursery.github.io/edition-guide/print.html#no-more-extern-crate
https://rust-lang-nursery.github.io/edition-guide/rust-2018/macros/macro-changes.html
https://github.com/iceiix/steven/pull/13#issuecomment-435702507
2018-11-04 12:39:23 -08:00
ice_iix 0d8696286c Update Cargo.tomls to Rust edition 2018, fix crate imports. Closes #13 2018-11-04 12:15:34 -08:00
ice_iix a40cd43a2e Update to use crate:: for current crate, for Rust 2018 edition
From `cargo fix --edition`, see https://rust-lang-nursery.github.io/edition-guide/print.html#the-crate-keyword-refers-to-the-current-crate
2018-11-04 12:06:00 -08:00
ice_iix db02f9e790 Update try!() to new ? syntax for Rust 2018 edition
Not automatically updated, see https://users.rust-lang.org/t/why-does-cargo-fix-replace-try-with-r-try-instead-of/21972/3
There are other tools to replace it, btu this is what I used:
find src -name '*.rs' -exec perl -MRegexp::Common -0777 -pe'$bp=$RE{balanced}{-parens=>"()"}; s/try\!($bp)/substr($1, 1, length($1) - 2) . "?"/ges' -i {} \;
2018-11-04 11:48:51 -08:00
ice_iix fc18e9836f Remove anonymous trait parameters, name _ for Rust 2018
https://rust-lang-nursery.github.io/edition-guide/rust-2018/trait-system/no-anon-params.html
2018-11-04 11:48:34 -08:00
ice_iix f6a56f5b86 Use non-colliding variable name dynamic_texture instead of dyn (now a keyword) 2018-11-04 11:31:28 -08:00
iceiix 1589a29685
Remove use of OpenSSL for RSA PKCS1 encryption (#12). Closes #2
* Add handwritten RSA PKCS1 encryption using num-bigint and simple_asn1

* Add more logging to compare OpenSSL with/without side-by-side

* Log message and ciphertext in hex

* Print N and e as hexadecimal integers

* Fix bad encryption caused by zeros in PKCS1 padding

PS field in https://tools.ietf.org/html/rfc8017#section-7.2.1
Must be nonzero

* Use rand fill instead of rand_bytes

* Remove OpenSSL!

* Update CI scripts and docs to not install OpenSSL

* Remove copying OpenSSL DLLs (libeay and ssleay) in AppVeyor script

* Change rsa_public_encrypt_pkcs1 to return a Result<Vec<u8>, String>

* Add error checking, returning Err<String> on failure; RFC comments

* Add the required message representative range checking

* Use expect() instead of unwrap() on from_der

* Map the ASN.1 error to a String to return it from rsa_public_encrypt_pkcs1() instead of panicking

* Move RSA to a new crate, rsa_public_encrypt_pkcs1

https://github.com/iceiix/rsa_public_encrypt_pkcs1

* Update to rsa_public_encrypt_pkcs1 with simple_asn 0.1.0

https://github.com/iceiix/rsa_public_encrypt_pkcs1/issues/1

* Update to published version of rsa_public_encrypt_pkcs1, 0.1.0

* Remove unnecessarily added blank line

* Remove libssl-dev from .travis.yml
2018-11-04 09:40:51 -08:00
iceiix 90aaeaf16a
Support beta Rust release. Closes #8 (#11)
* Remove seemingly unneeded const on MetadataKey<T> new

* Change biome temperature/moisture to integer, x100 to remove floating-point so can use within stable 'const fn'

* Remove unstable const_fn feature, now using stable const fn: see https://www.reddit.com/r/rust/comments/9msqfn/const_fn_soon_on_stable_rust/

* Test on Rust beta (awaiting 1.31 release for stable)

* Update readme for beta Rust support
2018-11-02 16:57:23 -07:00
iceiix 6d88ce23ec Switch to RustCrypto for Cfb8 symmetric crypto, instead of OpenSSL (#10) (#2)
* Encrypt with both RustCrypto cfb8 and OpenSSL

* Switch to RustCrypto for decrypting

* Show encryption for both RustCrypto and OpenSSL, for comparison...

* Correct off-by-one error in encryption, cfb8 doesn't need extra byte

* Remove OpenSSL for symmetric crypto

* Update Cargo.lock
2018-11-01 20:46:21 -07:00
ice_iix 432ce59238 Update Travis-CI to my branch 2018-10-31 19:27:30 -07:00
iceiix 24f71cf959
Add Appveyor for Windows continuous integration (#9)
* Add appveyor based on https://users.rust-lang.org/t/rust-appveyor-windows-ci-scripts/4437/2

* Add build script in a separate file, based on https://github.com/briansmith/ring/blob/master/mk/appveyor.bat

* Add pacman installation packages from https://github.com/Thinkofname/steven/wiki/Compiling-and-or-running#compiling-on-windows

* Run msys2_shell from https://github.com/appveyor/ci/issues/352

* Set msys64 and mingw PATH

f000540506

* Add --noconfirm option to pacman

https://unix.stackexchange.com/questions/52277/pacman-option-to-assume-yes-to-every-question#52278

* Try installing OpenSSL using vcpkg

https://www.appveyor.com/docs/lang/cpp/#vc-packaging-tool

* Attempt to install OpenSSL using rust-openssl's appveyor.yml

https://github.com/sfackler/rust-openssl/blob/master/appveyor.yml

* Revert "Attempt to install OpenSSL using rust-openssl's appveyor.yml"

This reverts commit 50106089798615f5a6576651fe9ca88af9a43a0d.

* Set OPENSSL_DIR to C:\OpenSSL

* List contents of C:\OpenSSL

* List C:\OpenSSL after installation

* No such directory

* Use appveyor script from thinkofname

https://github.com/Thinkofname/steven/issues/72#issuecomment-433889692

* Enable echo in appveyor.bat

* Add exported build script, merge working with existing

* Remove environment matrix, nightly-2018-10-24 vs nightly

* Remove debug/release because it builds both in one go

* Echo the platform variable before forcing it

* Set platforms to x86 (not Win32) and x64

* Build x64 first

* Only install the proper platform for OpenSSL, not both
2018-10-31 19:22:16 -07:00
ice_iix c36d0706ac Remove obsolete comment 2018-10-29 17:10:08 -07:00
ice_iix 56a1cb2b76 Fix logging with set_boxed_logger, add std feature to dep
https://github.com/rust-lang-nursery/log/issues/303
2018-10-28 19:45:57 -07:00
ice_iix c477fa0089 Travis-CI: cache the cargo dependencies, so they are only recompiled when updated 2018-10-28 10:06:59 -07:00
ice_iix 541d8c22b8 Travis-CI: allow nightly to fail without error since it is often broken
https://docs.travis-ci.com/user/languages/rust/#stq=&stp=0
2018-10-28 10:04:56 -07:00
ice_iix 3f67d8477c Try adding mesa dev packages for Linux Travis-CI script
https://travis-ci.org/iceiix/steven/jobs/447445632
The following packages have unmet dependencies:
 libsdl2-dev : Depends: libegl1-mesa-dev
               Depends: libgles2-mesa-dev
2018-10-28 09:46:22 -07:00
ice_iix bf0159209c Update Travis-CI to test against known good nightly 2018-10-28 09:40:21 -07:00
ice_iix 51a5e3ed5c Update to rust-openssl 0.10.15 (from 0.7.8)
Major API change, the last of the outdated dependencies
Closes https://github.com/iceiix/steven/issues/4

Note: would still like to replace the last usages of the OpenSSL crate
https://github.com/iceiix/steven/issues/2 but it is needed for CFB8
until a replacement is available (maybe https://github.com/RustCrypto/stream-ciphers/issues/4)
2018-10-27 19:56:34 -07:00
ice_iix 6a41539896 Update to khronos_api 2.2.0
https://github.com/iceiix/steven/issues/4
2018-10-27 18:15:51 -07:00
ice_iix 80c740c1c5 Update to cgmath 0.16.1, collision 0.18.0
https://github.com/iceiix/steven/issues/4
2018-10-27 18:11:26 -07:00
ice_iix 5ce9bf3fa3 Update to lazy_static 1.1.0 in blocks/Cargo.toml
https://github.com/iceiix/steven/issues/4
2018-10-27 17:21:57 -07:00
iceiix b17f296ab4
Replace hyper with reqwest (#7)
An old version of hyper was used before (0.8.0), in the process of updating to hyper 0.12.11, found this higher-level replacement/wrapper, reqwest 0.9.4 which is simpler to use than the latest hyper and serves the purpose of a simple HTTP client well

* Begin updating to hyper 0.12.11

https://github.com/iceiix/steven/issues/4#issuecomment-425759778

* Use type variables for hyper::Client

* Fix setting header syntax, Content-Type: application/json, 17->13

* Parse strings into URLs with url.parse::<hyper::Uri>().unwrap()

b20971cb4e/examples/client.rs (L25)

* Use hyper::Request::post() then client.request() since client.post() removed

* wait() on the ResponseFuture to get the Result

* try! to unwrap the Result

* status() is now a method

* Concatenate body chunks unwrap into bytes, then parse JSON from byte slice, instead of from_reader which didn't compile

* Replace send() with wait() on ResponseFuture

* Parse HeaderValue to u64

* Slices implement std::io::Read trait

* Read into_bytes() instead of read_to_end()

* Disable boxed logger for now to workaround 'expected function, found macro'

* Remove unnecessary mutability, warnings

* Hack to parse twice to avoid double move

* Use hyper-rustls pure Rust implementation for TLS for HTTPS in hyper

* Start converting to reqwest: add Protocol::Error and reqwest::Error conversion

* Use reqwest, replacing hyper, in protocol

* Convert resources to use reqwest instead of hyper

* Convert skin download to reqwest, instead of hyper

* Remove hyper

* Revert unnecessary variable name change req/body to reduce diff

* Revert unnecessary whitespace change to reduce diff, align indentation on .

* Fix authenticating to server, wrong method and join URL

* Update Cargo.lock
2018-10-27 17:03:34 -07:00
iceiix de6cd2044e
Update to serde_json 1.0 (#6)
* Replace find() with get()

* Update for renamed as_string->as_str and as_boolean->as_bool

https://github.com/serde-rs/json/releases/tag/v0.8.0
Value::as_string() has been renamed to as_str() and Value::as_boolean() has been renamed to as_bool() to improve consistency
https://github.com/serde-rs/json/issues/126

* No serde_json::Value::I64/U64/F64 anymore, only Number

* Update from lookup() to pointer(), using JSON pointer syntax

https://github.com/iceiix/steven/pull/6#issuecomment-432472123

* Remove unused and removed ObjectBuilder import

* Use into_iter().collect() to convert BTreeMap to serde_json::Map

* Change parse_rules to accept serde_json::Map instead of BTreeMap

* Remove unused serde_json macro_use

* Update Cargo.lock
2018-10-23 18:47:21 -07:00
ice_iix edbed5e319 Check glGetError() in rendering loop
For investigating https://github.com/iceiix/steven/issues/5
No errors seen
2018-10-07 13:53:50 -07:00
ice_iix ed5d48f136 Clamp NUM_SAMPLES glTexImage2DMultisample at GL_MAX_SAMPLES, since not all systems support >1 see https://github.com/iceiix/steven/issues/5#issuecomment-427669426 2018-10-07 10:08:24 -07:00
iceiix cceb1768b1 Panic on incomplete framebuffer so can see where it was called with RUST_BACKTRACE=1 2018-10-07 09:43:00 -07:00
ice_iix 7731117e4f Check framebuffer statuses before rendering and unbinding
No errors, so not the cause of https://github.com/iceiix/steven/issues/5
2018-10-07 08:00:07 -07:00
ice_iix 84c682b177 Check framebuffer status later not immediately after binding
No errors https://github.com/iceiix/steven/issues/5
2018-10-06 13:58:16 -07:00
ice_iix 3a32710b17 Check framebuffer status after each bind
For https://github.com/iceiix/steven/issues/5
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
2018-10-06 13:28:19 -07:00
ice_iix 7503b90667 Use the RustCrypto sha-1 crate instead of sha1
For https://github.com/iceiix/steven/issues/2#issuecomment-425769562
2018-10-03 18:28:05 -07:00
ice_iix 9997174fae Update to serde 1.0.79 for https://github.com/iceiix/steven/issues/4 2018-09-30 19:42:13 -07:00
ice_iix d2b59fbd10 Update to rand 0.5.5 for https://github.com/iceiix/steven/issues/4
Useful guide: https://github.com/rust-random/rand/blob/master/UPDATING.md
2018-09-30 19:05:20 -07:00
ice_iix c688836a16 Use hex module for hex decoding, removing deprecated rustc-serialize for https://github.com/iceiix/steven/issues/4 2018-09-30 18:14:36 -07:00
ice_iix e988c64376 Use base64 crate for base64 instead of deprecated rustc-serialize, for https://github.com/iceiix/steven/issues/4 2018-09-30 17:58:40 -07:00
ice_iix fe99910550 Update to image 0.20.0 2018-09-30 17:21:05 -07:00
ice_iix 9f49d10eb3 Update to lazy_static 1.1.0
https://github.com/iceiix/steven/issues/4
2018-09-30 17:11:22 -07:00
ice_iix 43f6565fa5 Update to log 0.4.5
https://github.com/iceiix/steven/issues/4
2018-09-30 16:36:00 -07:00
ice_iix a25eaf1476 Update to zip 0.4.2
https://github.com/iceiix/steven/issues/4
2018-09-30 16:20:33 -07:00
ice_iix fd2c51eac4 Update to flate2 1.0.2
https://github.com/iceiix/steven/issues/4
2018-09-30 16:19:24 -07:00
ice_iix 51a88ab95b Update to byteorder 1.2.6
https://github.com/iceiix/steven/issues/4
2018-09-30 13:53:22 -07:00
ice_iix 562ab9dbc4 Remove unused username field in Server. Closes https://github.com/iceiix/steven/issues/1 2018-09-30 00:25:07 -07:00
ice_iix 8ca41dfcda Update gl-generator, fixes hundreds of non_upper_case_globals warnings
Resolves most of https://github.com/iceiix/steven/issues/1
2018-09-30 00:21:33 -07:00
ice_iix be46377842 Remove unused macros and imports to appease compiler warnings
https://github.com/iceiix/steven/issues/1
2018-09-29 23:52:47 -07:00
ice_iix d6fa1d0a0b Fix warning: unnecessary parentheses around function argument, new in nightly-2018-02-15 2018-09-29 23:28:38 -07:00
ice_iix cb1d282381 Update to rustc-serialize 0.3.24, for nightly-2018-01-04 compatibility
Allows upgrading from nightly-2017-10-12 to nightly-2018-01-04 which is
aligned with Rust version 1.23.0 https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1230-2018-01-04
See https://github.com/iceiix/steven/issues/3#issuecomment-425688203
2018-09-29 23:20:43 -07:00
ice_iix 6eaf1688f4 Remove time crate in favor of std::time, removing last usage in main
Combined with these changes, which also convert to std::time:
47aeb83da2 logo text
2f861f815a light updates
9677f8ae9c server ping
2018-09-29 23:11:47 -07:00
ice_iix 9677f8ae9c Use std::time for server ping, getting closer to eliminating use of 'time' crate, https://github.com/iceiix/steven/issues/3 2018-09-29 22:57:55 -07:00