Commit Graph

210 Commits

Author SHA1 Message Date
YHDiamond fb283fcce8
Add advancements GUI (#1579)
Using /geyser advancements, Bedrock clients can get a visual on their progress.

Co-authored-by: yehudahrrs <47502993+yehudahrrs@users.noreply.github.com>
Co-authored-by: Olivia <chew@chew.pw>
Co-authored-by: rtm516 <rtm516@users.noreply.github.com>
Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
Co-authored-by: rtm516 <ryantmilner@hotmail.co.uk>
Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com>
2021-01-11 21:23:09 -05:00
rtm516 1c0cc4622a
Microsoft account authentication (#1808)
Microsoft accounts can now use Geyser, while maintaining full backwards compatibility with Mojang accounts.

Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com>
2021-01-11 15:52:02 -05:00
Camotoy fe23c79053
Implement book editing (#1117)
* Implement book editing

Updates the PR created by @ForceUpdate1 for 1.16 support. Seems to work fine now that hand support is in MCProtocolLib.

Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>

* Remove debug line

* Simplify code

Currently still borked for creative mode.

* Fix books on creative

* Bug fixes

* Fix NPE?

* Blind fixes

* Send Book update before any player actions

* Remove debug prints

* Fix out of bounds for page replace and add

* Fix editing desync and remove empty pages from the end

* Send edit packet after signing

* Refactor

* Clean up and fix creative

* Apply suggestions from code review

Co-authored-by: rtm516 <rtm516@users.noreply.github.com>

Co-authored-by: ForceUpdate1 <mneuhaus44@gmail.com>
Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>
Co-authored-by: David Choo <davchoo3@gmail.com>
Co-authored-by: rtm516 <rtm516@users.noreply.github.com>
2021-01-07 19:40:34 -05:00
Camotoy 92c86cf15b
Null check tick thread (#1812) 2021-01-05 23:28:31 -05:00
Camotoy 0641800be7
Add Tickable interface (#1790)
* Add Tickable interface

By having a tickable interface, we're only dedicating one thread to ticking entities and running tasks as opposed to several. This will also help with implementing world border support.

* removeEntity already clears tickableEntities for us

* Only tick the entity if it's not being ticked
2021-01-05 18:41:20 -05:00
Camotoy 50b80a64d3
Dimension switching cleanup (#1694)
* Dimension switching cleanup

Cleans up dimension switching logic that should no longer be needed. Also fixes above Nether Bedrock building dimension switching.

* Clear thunder on dimension switch too

* Clarify fake dimension switch function name

* Javadoc that
2021-01-03 19:06:20 -05:00
Camotoy 186d94917a
Update copyright to 2021 (#1772)
* Update copyright to 2021

Free commit!

* These don't need a copyright

* Don't downgrade the mappings
2021-01-01 10:10:36 -05:00
Camotoy 9fc6228fc0
GeyserSession: remove 32 render distance cap (#1546)
Having an incongruency between the server render distance and the client render distance appears to cause issues, and I have not been able to encounter such a crash.
2020-12-24 13:40:57 -05:00
Mark c67d91943c
HAProxy PROXY protocol support for downstream connections (#1688)
* Implement downstream PROXY protocol support

* Clarify the configuration version updating procedure

* Bump netty-resolver-dns to 4.1.56.Final

* Update Netty to .56

* Don't increase jar size by 2MB

Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com>
2020-12-23 20:47:29 -05:00
Camotoy b490dcfcbb
Improve doDaylightCycle translation (#1711)
Previously, we wouldn't send the time if the server was sending the same time with doDaylightCycle on. However, this isn't vanilla behavior (for Bedrock nor Java) and can occasionally cause irregularities. The time is now always sent to Bedrock clients, and a daylightCycle field is added to GeyserSession to keep track of the doDaylightCycle gamerule we need to send to Bedrock. Removing the map we used to store the time may also improve memory usage since this was never cleaned up.
2020-12-20 20:41:07 -05:00
Camotoy 988fd66a85
Fix boat movement on land (#1668)
* Fix boat movement on land

1.16.100 appears to now take advantage of two newer entity metadata properties, IS_BUOYANT and BUOYANCY_DATA. Without the former, moving on land will not work properly. With the former and without the latter, moving in water no longer works.

* Use offset kind of
2020-12-15 13:09:40 -05:00
RednedEpic 31209be79e Ensure spawn radius is always 0 on the client's end
Fixes #1496 to the best of my knowledge. Any issue regarding the spawnpoint being off in terms of radius is up to the server at this point - would not be an us situation here.
2020-12-12 01:23:30 -06:00
RednedEpic 70031c65e7 Handle keepalives better (Closes #965)
Bedrock cuts off the last 3 digits consistently every time, meaning that the keepalive returned from bedrock is never fully accurate. However, if we multiply the value by 1000, then divide by 1000 when sending back to java, the proper value is returned.
2020-12-12 00:45:41 -06:00
Camotoy 87c52ad524
Add a config option for toggling showing coordinates (#1645) 2020-12-10 11:13:36 -05:00
Camotoy 8e274daa75
Change default protocol version to 422 (#1640)
* Change default protocol version to 422

* Update Protocol

* Actually update to Protocol 2.6.1-SNAPSHOT

* Keep languages commit the same
2020-12-09 11:30:59 -05:00
OnlyBMan 2c0f3ec84d
Custom skull block support (#683)
Custom skulls are now implemented within the world when placed as a block. This is achieved by placing a fake player entity in the same spot.

Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
Co-authored-by: bundabrg <brendan@grieve.com.au>
Co-authored-by: bundabrg <bundabrg@grieve.com.au>
Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>
2020-12-04 16:55:24 -05:00
circuit10 a70d3e2150
Fix inconsistencies with movement and position (#699)
Movement is now significant better, especially on slabs, stairs, and other half-blocks.

Co-authored-by: RednedEpic <redned235@gmail.com>
Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
Co-authored-by: Tim203 <mctim203@gmail.com>
Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>
2020-11-20 14:56:39 -05:00
Camotoy 123b074cc7
Update to Bedrock 1.16.100 (#1552)
* Initial work on 1.16.100 - currently crashes the client

* Update runtime item states

* Use new Bedrock runtime IDs

Bedrock now hardcodes block runtime IDs in alphabetical order of the identifiers. This commit updates Geyser to accomodate.

- Remove runtime_block_states.dat and replace it with blockpalette.nbt
- Calculate the block runtime ID based on the order of the block palette
- Separate BlockTranslator.AIR into Bedrock and Java values
- Update the second layer of chunks to use air when not waterlogged
- Don't send item palette for now, as that's what crashes the game (will look into for v415)
- Other misc. changes

* Improve second layer chunk translation

* v415 support

- Add a message warning people they are on a beta version of Geyser

* Update to protocol v417

There are still some mappings changes that need to be gone through.

* Update runtime item states and clean up item frames

* Future-proof enchanment table

* Update for v418

* Update to v419

* Apply proper air ID to waterlogged chunk layer

* Fix missing import

* Remove beta warning

* Update mappings

* Manually patch runtime_item_states and send the ITEMS registry

* Update README

* Disable grindstone and smithing inventories (since they're broken)

* Use artifactory jenkins plugin (#1548)

* Use artifactory jenkins plugin

* Bump version to 1.2.0-SNAPSHOT

Co-authored-by: SupremeMortal <6178101+SupremeMortal@users.noreply.github.com>
2020-11-17 11:03:12 -06:00
rtm516 512f8cd6c2
Rewrite message handling in MessageUtils to use Adventure (#1498)
* Rewrite message handling in MessageUtils to use Adventure

* Move to static Adventure commit to fix a bug

* Initial test implementation

* Add RGB downgrade test

* Move MessageUtils and rename

* Clean-up and fix tests

* Fixed sign and book content handling

* Fix blank signs causing NPEs

* Fix reset before message being stripped

* Add comment about the reset character

* Fix legacy style server motds

* Fix more messages being handled wrong

* Fix title packets being handled wrong

* Fix trailing formatting characters on the end of sign lines

* Add auto updating of Java locale files

* Add en_us locale updating and hash caching

* Changes to hash determining

Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
2020-11-16 23:57:57 +00:00
Camotoy e748240a02
Add more interactive tags (mobile buttons) (#1443)
* Add more interactive tags (mobile buttons)

This expands our support for showing the interactive tags on touchscreen and console setups. This is not complete - specifically, the food compatibility of creatures needs to be expanded upon (I will work on this later and does not stop this PR from being mergable). This also includes:

- Creepers who are ignited with flint and steel now show up properly
- Zombie villagers now shake properly when converting and show their region outfits

* Add more food choices and add more panda entity metadata

* Re-add eating flag

* Remove debug line

* Refactor dimension usage, finish interactive tag usage, bees

* Print statements... ._.

* Don't make eating item packet data a non-constant

* Move BAMBOO to ItemRegistry

* Add missing break

* Make changes

* Minor final changes
2020-11-11 19:28:45 -05:00
rtm516 a6cc28ee80
Add config option for enabling achievements (#1504)
* Add config option for enabling achievements

* Disabled achievements by default and added warning about commands being disabled

* Update config.yml

* Rename achievements-enabled to xbox-achievements-enabled for clarity

Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>
2020-11-07 00:52:09 +00:00
Camotoy 69d4d9f0d6
Send position update every 3 seconds if idle (#1421)
* Send position update every 3 seconds if idle

Prevents timeouts in certain instances when AFK.

* Cancel position sending on dimension switching

* Remove debug lines

* Create function to centralize movement translation
2020-11-02 16:04:08 -05:00
Camotoy 045c0e0637
Introduce CommandSender.getLocale() (#1431)
* Introduce CommandSender.getLocale()

This allows Geyser-specific commands (e.g. `/geyser help`) to be displayed in the (Java or Bedrock) player's default language, which stops those commands from simply being displayed in the default locale.

* Tweak Javadoc

* Set CommandManager's GeyserConnector to final

* Clean up
2020-10-29 18:30:52 -04:00
rtm516 c30cb78e74
Add statistics menu (#1424)
* Add statistics menu

* Changed back button text

* Add check to make sure the player requested the statistics display

* Better item translation support; misc changes

* Clean up session getting?

* Remove extra debug that is likely unnecessary

* Remove unused function

* Update languages submodule

* Clean up javadoc comment

* Fix typo

Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>
2020-10-24 23:33:49 +01:00
RednedEpic dfba278f4d Use correct methods in refreshEmotes 2020-10-23 01:36:34 -05:00
RednedEpic ee8c718c62 Translate emote list packet 2020-10-23 01:25:24 -05:00
Camotoy b02bc33393
GeyserSession: Set a default value for attackSpeed (#1419)
Fixes cooldowns not showing on a fresh world.
2020-10-19 19:03:31 -04:00
Camotoy 96db37c14c
Fix bucket interactions on creative mode (#1369)
* Fix bucket interactions on creative mode

Bedrock uses the BLOCK_INTERACT enum of BedrockActionTranslator to truly indicate if a bucket should be used or not. In order to hook into this, we need to delay the bucket placing by about 5 milliseconds - this gives us time to cancel the interaction if needed.

Bucket sounds will now not play in this case as well.
2020-10-12 20:02:41 -04:00
Camotoy 772cb246f0
Forward keep alive packets to the client (#1344)
* Forward keep alive packets to the client

Previously, MCProtocolLib (our Java protocol library) handled keep alive packets for us. This commit disables that option and 'forwards' the keep alive packets to the client, and sending the keep alive packet back once Bedrock sends us a ping response.

* Delete DataCache

* Update to latest MCProtocolLib

* Swap values around as a sanity check
2020-09-29 14:15:11 -04:00
rtm516 7c49391b9d
Fix gamemodes not fully applying on server switch (#1348)
* Fix gamemodes not fully applying on server switch

* Revert previous commit and move session flag updating to the adventure settings method
2020-09-28 17:43:50 -04:00
Camotoy 1ec768d95d
Fix interaction spam bug (#1324)
* Fix interaction spam bug

This references the Nukkit 1.0 fix for the client bug of spamming to interact. Holding down still works.

* Remove interaction position set at action type 1

* Remove debug line
2020-09-24 12:54:18 -04:00
Camotoy f9c1d3f218
Remove Protocol v409 support (#1300)
* Remove Protocol v409 support

Protocol has dropped support for this version.

* Fix movement

* Use a static commit for Protocol
2020-09-16 00:11:56 -04:00
Camotoy 6638c53029
Implement command block and jigsaw support (#1291)
* Implement command block and jigsaw support

- Command block UI is now fully implemented to match Java Edition.
- Command block minecarts are now supported.
- Command blocks now show the correct type of command block.
- Jigsaw blocks are translated.

Structure blocks can be implemented, but these will be trickier as there are significant GUI differences between Java and Bedrock.

* Add more detail about command block minecart color

* Set PlayerPermission.OPERATOR to allow command blocks to be destroyed
2020-09-14 20:54:19 -04:00
Camotoy d47360d6fb
GeyserSession: send command permission level OPERATOR if qualified (#1254)
Mobile clients have a GUI for commands that shows if CommandPermission.OPERATOR or higher is sent. The commands present all require OP permission 2 or higher; therefore we set that command permission if the server tells us we have a OP permission level of 2 or higher.
2020-09-05 16:22:31 -04:00
Camotoy dcf1731d8a
Implement correct sign wrapping (#1228)
* Implement correct sign wrapping

This commit ensures that the auto-wrapping nature of Bedrock with signs is corrected. If a Bedrock player sends a sign that is auto-wrapped, it will now be interpreted by Geyser to fit on multiple lines. Additionally, Geyser will crop incoming sign text to prevent auto-wrapping.

* Don't wrap if it's the last line
2020-09-01 23:38:36 -05:00
Camotoy 6f161a380f
GeyserSession: Always set Keep Inventory to true (#1213)
* GeyserSession: Always set Keep Inventory to true

This prevents the client from removing items on death in creative mode if Keep Inventory is true, but doesn't break existing behavior. Essentially, this assures full server-side behavior of the inventory during death.

* Small comment update

* OK, it was fine before the last commit, but make it better
2020-09-01 23:37:24 -05:00
Tim203 1c84993853
Scoreboard improvements (#1166)
* Added a way to check if debug logging is enabled

* Improved scoreboard performance

* Include Teams in pps and return pending pps instead when higher then pps

Some servers have a huge amount of score packets when the player logs in, but before this commit, only after the first high pps (packets per second) the ScoreboardUpdater will be used (after pending packets per second have been moved to packets per second). But this commit fixes that the ScoreboardUpdater can be used on the second that the pps is getting high.

* Fixed team pre + suffix "null" issue and added threshold config option

Fixed team pre + suffix "null" issue.
When the prefix and/or suffix of a Team is null, "null" will be returned instead of null (Due to the way that MCProtocolLib is made and designed). This is fixed by simply checking if the prefix and/or suffix equal "null" and if that is the case, replace it with "".

Added threshold option.
Gave the person who is running Geyser an option to specify the first Scoreboard packets per second threshold to further improve performance by lowering the setting or decrease performance by relaxing the setting a bit. The value can't be higher then 250 (the second threshold), because it'll always choose the lowest threshold.

* Forgot to bump config version

* Small changes

* Reverted version bump, changed Sponge config, changed FloodgateKeyLoader

Reverted version bump
Camotoy said that you only need to bump the config version if the change is breaking, the config version bump has been reverted.

Changed Sponge config
The Sponge config has been modified to look like the other platform configurations.

Changed FloodgateKeyLoader

* Changed default-locale and (remote) address as requested by Camotoy

* Reduce bandwidth and a few final tweaks

* Made the scoreboard-packet-threshold a bit higher due to improvements
2020-08-28 10:47:52 -05:00
James Cahill 81f58ee9bf
Add Server Name config option (#1170)
* Add bedrock.server-name config option

* Fix spelling mistake oops!

* Remove trailing whitespace
2020-08-25 09:29:55 -04:00
Camotoy 8b7165a564
Implement (hopefully) temporary dimension switching fix (#1188)
This fixes rare (?) instances where dimension switching doesn't finish loading on the client. Ideally a proper fix would send the finishing packets in the correct order but I didn't get far in this regard.

Fixes #1154 and #1072.

Other miscellaeous chunk-related fixes have also been included here.
2020-08-24 09:31:21 -04:00
Camotoy 7fcfa7d54d
Implement an enchantment table GUI (#1177)
Until 1.16, enchantment tables were impossible to implement properly in Geyser. When a user selects an enchantment in Bedrock, the client creates the book on its end and assumes the server is OK with it. Java requires a button to be pressed to select the enchantment. With 1.16, server authoritative inventories remove that on Bedrock. However, until our inventory rewrite is finished we are still stuck without enchantment table support. This commit serves as an alternative as we wait.

Enchantment table GUI support is still impossible since we are using the pre-1.16 inventory system. To solve this, this commit replaces the enchantment table GUI with a hopper GUI. The first slot serves as the spot you place the weapon. The second slot acts as the lapis slot - Geyser prevents any item from going in there that is not lapis. The final three slots act as the buttons; an enchanted book acts as each button, with the ability to show the translated text of each enchantment.

https://cdn.discordapp.com/attachments/613194828359925800/746164042359504927/unknown.png
2020-08-20 20:53:47 -04:00
Camotoy 1ead2900a3
Translate RAIN_STRENGTH to Bedrock client (#1151)
* Translate RAIN_STRENGTH to Bedrock client

Previously Geyser ignored RAIN_STRENGTH and instead relied on START_RAIN and STOP_RAIN only. This is unreliable on a vanilla server as these values are swapped around. This commit also implements thunder strength which was untranslated.

* Update rain code in JavaRespawnTranslator
2020-08-16 12:43:16 -05:00
RednedEpic 04cf8b2a99 Fix javadoc errors 2020-08-08 17:56:15 -05:00
rtm516 0a5048232f
Add support for client side settings (#1035)
* Port code from #486

Co-authored-by: Luke <32024335+lukeeey@users.noreply.github.com>

* Fix and clean code and add default gamemode changing

* Clean copyright

* Remove direct modification of server, clean up code and add player list xuid fetching.

* Move to custom settings menu

* Move sendAdventureSettings to GeyserSession

* Add javadoc comments

* Add translation support

* Remove updated copyright

* Clean up

* Clarify some javadoc comments

* Remove obsolete code

* Update languages submodule

* Fix javadoc comments

* Fix compile

Co-authored-by: Luke <32024335+lukeeey@users.noreply.github.com>
Co-authored-by: Redned <redned235@gmail.com>
2020-08-08 17:41:12 -05:00
Camotoy 0fde30fc78
GeyserSession: always send naturalRegeneration=false gamerule (#1097)
This essentially gives the server full control over the health visual.
2020-08-08 16:50:49 -05:00
bundabrg 0ca1096f45
Fix Skin Caching and Fix Skin Restorer (#680)
* Fix Skin Caching

Changes:
* Instead of caching a skin based upon the player we cached it based upon the textureURL. This means multiple players with the same skin will benefit from the cache and more importantly will mean a player changing their skin will not get a false cache hit.
* This should fix all issues with SkinRestorer and will now correctly show the skin both to the player themselves and to other players

Closes #518

* Remove duplicated code

* Minimize playerlist updates

Changes:
* All async skin stuff will now just update skins and not be involved with sending the session to the player. This eliminates issues where the player list changes whilst an async task is occuring plus it means no invisible players while retrieving skin.
* Fix bug when retrieving cached skin

* When sending PlayerList packets ensure the skins have appropriate skinIds so the Bedrock client will cache hit/miss as needed

* Make sure to add and remove player when setting skin if they do not belong on the playerlist

* Make use of AuthData UUID when removing the player

* Revert removal of checking if entity is valid when initialized

This section is supposed to send all spawned entities in the java world to a player only after they've initialized. By removing this check it would also be sending entities that exist but are not spawned.

* Optimizations

Changes:
* Check for duplicate requests based on textureURL instead of player ID
* Don't use the PlayerSkinPacket. It duplicates the data sent in the PlayerListPacket and without it the players still get skin updates.

* Support caching of skins to disk based on configuration variable

If a skin is downloaded it will be saved to `cache/skins` using a base64 encoded filename of the textureUrl, if allowed by setting a non 0 value for the configuration variable `cache-skins`

When reading a skin we try load it from a cache file first before trying to download it.

We don't yet expire them but do update their last modification so we know which ones have been accessed.

* Update `config.yml` with cache-skins directive, defaulting to disabled

* Merge Fixes

* Cache all images instead of just skins

Changes:
* Move the image caching from skins to where images may get downloaded so this also covers capes and anything else that uses the same method of image retrieval
* Updated config value from `cache-skins` to `cache-images`
* Updated cache location from `cache/skins` to `cache/images`
* Images are stored in png format with a uuid. This may make debugging easier as they can be directly opened.

* Implement cached image expiry

If `cache-images` is set to a value greater than 0 then a scheduled task will occur once a day that will remove images with a modification date older than the value in days.

* Force skin changes as trusted

* Resolve PR queries

* Fix signed int causing issues calculating expiry time for images

* Reset Defaults to 0 and implement Google Timed Eviction cache for Images

* Add memory cache for Capes

Co-authored-by: Brendan Grieve <brendan.grieve@zepli.com.au>
Co-authored-by: bundabrg <bundabrg@grieve.com.au>
2020-08-07 12:33:21 -04:00
AJ Ferguson 5b1116b15a
Creative items (#1013) 2020-07-24 15:42:15 -04:00
Camotoy 221e5bd103
Disconnect client if using an invalid Mojang account (#975)
This commit supresses the NPE that was previously sent when using an invalid Mojang account. Instead, the Bedrock client is disconnected with an error message.
2020-07-18 15:56:12 -05:00
RednedEpic 24f9651cc6 Convert map of players to list (may address #833) 2020-07-06 20:11:34 -05:00
AJ Ferguson 699402e635 Fix bug with maps 2020-07-06 15:52:38 -08:00
rtm516 cfaf4051b7
Add Translation support (#504)
Adds full multi-language support to any Bedrock-supported language.

Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
2020-07-05 19:35:51 -04:00