* BlockStorage is never used concurrently, no need to synchronize
* initial, semi-functional, faster chunk conversion
* faster chunk conversion works well for every situation except spigot
* delete unused ChunkPosition class
* preallocate and pool chunk encoding buffers
* make it work correctly on spigot
* make field naming more consistent
* attempt to upgrade to latest MCProtocolLib
* remove debug code
* compile against my MCProtocolLib fork while i wait for my upstream PR to be accepted
* return to Steveice10 MCProtocolLib
* fix some NPEs caused by race conditions in chunk conversion
tbh the whole session should be read-write locked for every operation
* fix code style issues
* make ChunkPosition use a hashCode implementation with far better hash distribution
this should improve the performance when used as a hash table key
* ChunkCache no longer uses position wrapper objects
this yields a roughly 15-20% increase in performance when converting chunk data
* fix code style issues
* 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.
* Various Scoreboard fixes
Fixes#1328 and a few other potential Scoreboard problems
* Consistent whitespacing
Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
* Fix NotNull error with particles, replace incorrect string meta with int meta.
* Add back newline
* Remove debug line
* Update Protocol and prepare for merge
Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
Fishing rods pulling players is a clientside feature on Java. On Bedrock, a SetEntityMotionPacket is sent to the client. Therefore this PR implements the Java fishing rod pulling mechanics and sends it off to Bedrock, which sends MovePlayerPackets that are sent to the server.
* 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
* Tipped arrow translation
- Tipped arrow items are now properly translated both ways
- Tipped arrow particle effects are also translated, by having a list of all colors Java could send us and their Bedrock ID
* Remove a whitespace
This commit mainly focuses on fixing the crashing of villagers that occurred pre-1.14.
Co-authored-by: AJ Ferguson <AJ-Ferguson@users.noreply.github.com>
In vanilla Bedrock, if you have operator status, the client sends a packet to change gamemode without confirmation from the server. Since we have a custom server option to request the gamemode, we just reset the gamemode and ignore this packet.
* Fix picking up liquids with buckets
The last fix to prevent bucket placement upon interacting with an inventory had an oversight with empty buckets, making them unusable. This commit fixes that while keeping the previous fix.
* Remove debug line
* Fix milk drinking and visual bucket item apperance
* Comment elaboration
* Make indentiation better
* 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
* Scoreboard: update score on UpdateType.ADD
* Actually fix
* Readd the Objective when a score changes
It looks like Objectives only update when you Remove the Objective and add it back using the SetDisplayObjective. This is hopefully a hotfix, but I think that there is no better way.
* Explain score tracking
Co-authored-by: Tim203 <mctim203@gmail.com>
* send resource packs
A lot of this code is nukkit-credits in the classes
* send resource packs
A lot of this code is nukkit-credits in the classes
* Remove unnecessary code/debugs
* use separately generated hashes
* Updated mappings and added .mcpack support
* "packs" directory auto-create (#484)
* "packs" directory auto-create
* cleaned indentation in ResourcePack.java
* Cleaned ResourcePack.java
* Another cleanup
I hate editor on github.
* Yet another
* Another indentation cleanup
* Fix resource pack loading
(cherry picked from commit f93b07491e)
* Move back to internal sha256 hashing
(cherry picked from commit 812a3d82b2)
* Add resource pack loading back after merge
* Add comments, config option and removed unused files
* Fix packs folder location and cleanup code
* Move to better options for the client
* Fix typos in comments
* Fix pack loading
* Try to make it compile
* Final touches?
* Add Javadoc for MathUtils#constrain
Co-authored-by: EOT3000 <43685885+EOT3000@users.noreply.github.com>
Co-authored-by: Vesek <61123478+Vesek@users.noreply.github.com>
Co-authored-by: Heath123 <heath.mitchell27@gmail.com>
Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>
* Fix inconsistencies with players and the player list
This commit makes the player list entry packet control the player cache, fixing inconsistencies that appeared when removing the override on despawning the player.
* Update comments
* 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
* Pick block improvements
- Creative block picking is now implemented. If the survival-styled block picking fails, then the item is created, following Java-style mechanics.
- Entity 'picking' is also implemented. The item is crafted using the same mechanics, and the same rules apply as normal block-picking (except it only works in creative mode, following Java.
* Switch some logic around
* Translate CanPlaceOn/CanDestroy NBT
This commit adds support for the translation of the CanPlaceOn/CanDestroy NBT for Bedrock clients.
* Remove debug line
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.
This commit adds support for name tag visibility in teams. If a player is set to hide their nametag, it will be hidden from the Bedrock client. Notably, this fixes most NPC nametag hiding, including Citizens. This does not fix some NPC nametag hiding - there are several NPCs in Hypixel that still have a nametag show up, and they are not a part of any team.
* 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
* 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
* Downgrade reflections to 0.9.11
* Add comment explaining downgrade
* Move to pre-build reflections
* Update skins to use https and relative cache dir
* Move to https OptiFine cape url
* Add javadoc to isProduction
* Add ANDROID as a platform type
* Re-ordered PlatformType
* Change stop command to call onDisable
* 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
* Translate client-computed recipes
A handful of recipes are complex enough on Java Edition that the client simply calculates them after getting an assurance that they are valid recipes. This PR stores those recipes in a Bedrock-compatible format in mappings, then generates the CraftingData information on startup to send to the Bedrock client when called. This fixes firework rocket and star crafting, and fixes leather armor and shulker box dyeing.
The recipe information for everything except leather armor was taken right from the Bedrock server. The leather armor had to be created separately (see https://github.com/DoctorMacc/LeatherDyeingCreation). There will be a slight visual difference in the crafting result preview if the armor is not perfectly dyed to one of the sixteen colors, but this is a visual issue that will persist unless we calculate every single possbile combination.
* Revert other changes
* Register shulker box recipes properly
* Add break
* Update mappings
* Add shulker box item tooltip translating
This commit adds support for previewing the items inside of a shulker box. This does not do a full translation, and only does enough to translate the item information to the client, so as to prevent any accidental item modifying/removing on creative mode.
* Swap values
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.
* Fix dyed signs in Bedrock Edition
Add visual support (in Bedrock Edition) for signs colored with dye (in Java Edition)
* Javadoc for getBedrockSignColor(string)
* Simplified getBedrockSignColor(string)
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
* Auto-configure more if setting is enabled
- Geyser dumps now show if the config was automatic
- Floodgate is now automatically detected if the address is also automatically found
- If the plugin versions' servers have the listening address set to something different, set our remote address to that
* Fix Sponge config
* Remove redundant Getter
* 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
The client should disallow players to join servers if they're not logged in, however this just adds a second layer of security in the event that it's somehow bypassed.
* Return permanent skins (alex/steve) when queried instead of returning an empty skin due to invalid lookup
* Fix Alex/Steve being shown incorrectly due to java signed integers
Co-authored-by: bundabrg <bundabrg@grieve.com.au>
* 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>
* 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>
* Update effects mappings
* Use STOP_RECORD as the default record instead of null
* Add comments
* Update mappings submodule
* Update MCProtocolLib and effects
* Change level event used for EVAPORATE effect
The bedrock client plays an additional sound when using CAULDRON_EXPLODE.
The java client does not play any sound.
* Update mappings submodule
* JavaEntityMetadataTranslator: replace stack trace with concise warning
Removes the stack trace given when a ClassCastException occurs and replaces it with a friendlier message. Class cast errors will happen since some servers send incorrect values, and apparently it is default Minecraft behavior to ignore them.
* Update languages submodule
* Move blocking case to LivingEntity, and make other players bows animate.
This moves metadata ID 7 to LivingEntity, it's proper place. It also sets the 'USING_ITEM' flag which animates other players bows.
* Add skeleton aiming support
Skeletons don't have support of pushing their bows back on Bedrock, but this allows them to hold their arms up
Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
* Support immediate respawn gamerule
This commit now supports immediate respawn if the server enables it - both on the setting being applied on join and the setting being modified in-game. This also refactors the respawning process to more closely match BDS behavior - nothing broke in my testing but more testing is needed.
* Reuse spawned variable instead of creating new variable
* Add rabbit jumping animation
This isn't perfect as Bedrock uses a duration and Java just sends the jumping animation. There may be something else missing from the puzzle piece.
* Remove debug line
* Added clone remote port option for bukkit, bungee and velocity
* Added clone remote port option for sponge
* Changed clone-remote-port description in config.yml
* Update config.yml
Updated config.yml to include a better description of the clone-remote-port option
* Updated GeyserSpongePlugin
An incorrect port was being edited before (remote instead of bedrock)
* Update config.yml
Co-authored-by: TeaNoDonuts <blackalegator@gmail.com>
Handshake now uses the server address directly from the config and no longer the IP from a domain (Some servers use the address that is given during the handshake)
Desktop clients send an extra item use packet for buckets whereas mobile clients dont send the second use packet causing the issue as a ClientPlayerUseItemPacket doesn't get sent to the Java server.
Buckets on mobile may still be glitchy as the player must be directly facing the block they want to place liquid on.
Sending a ClientPlayerAbilitiesPacket allows the player to successfully fly.
This commit also removes the setting of the CAN_FLY entity flag on creative mode. This did not break anything in my testing.
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.
* Update Entity.java
* Switched to VillagerEntity.java and added indents and whitespace
* Fix indents and whitespace and changed to pattern and matcher
* Clean up indentation problems
Co-authored-by: Savagetechguy <jakehorner@gmail.com>
Co-authored-by: Redned <redned235@gmail.com>
* Fix version checking on older Java versions
We add a useragent header to stop cloudflare blocking the default Java useragent
* Explain why we need the user agent
Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>
* Change versioning to match supported Bedrock version
Line up Geyser's versioning to match with the highest/currently supported Bedrock version for future tracking of older Geyser versions.
* Add version command
* Fix DEV check for version command
* Remove SNAPSHOT
* Update languages submodule
Co-authored-by: rtm516 <ryantmilner@hotmail.co.uk>
* Add dump command
Adds a command to collect and dump infomation about the Geyser install and bootstrap and submit it to a dumps site.
* Finalize URL; misc. fixes; add 'architecture' param
Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
* Provide a platform independent method of retrieving the datafolder
* LocaleUtils now uses datafolder
* Make use of Path instead of File
Changes:
* Rename getDataFolder() to getConfigFile() and update to return a Path in each bootstrap
* Rename filePath to tmpFilePath
* Update Velocity configFile to configFile Path
* Add villager interactive tag
This adds a button/controller guide for villager trading, if the villager is able to trade.
* Use a broader variable for metadata
* Add 1.9+ PvP 'Cooldown'
This commit adds a subtitle that acts as the Java cooldown. This is an optional feature disabled in the config with `show-cooldown`. This does not appear on plugins that use OldCombatMechanics.
* No need to bump up the config version; I was just tested with OldCombatMechanics
* Use simpler casting
* Use session variable of lastHitTime for theoretically better performance
* Reuse attribute value calculation from AttributeUtils
* Remove unused imports
* Revert config version update in config.yml
* Entity (mostly rotation) fixes
This PR adds:
- Pig health displaying. Doesn't fix pigs being able to be controlled
- Entity rotation is *mostly* correct. Villagers and sitting cats still seem to be odd but the ender dragon works great.
* Remove debug line
* Abstract rotation updating to functions per-entity
* Don't include changes from other projects
* Minor improvements
* Make updateRotation and updatePositionAndRotation cleaner
* Javadoc
* Fix maps not loading in sometimes
Adds a default map ID so the map item isnt invisible on bedrock.
Respond to the MapInfoRequestPacket so the image loads on first join.
* Remove debug log
* Add comments
* Fix block entities on older versions
This commit solves two problems related to block entities on older versions:
- Occasionally, tags would contain the ID under a StringTag with an empty value, and not the ID tag.
- The block entity regex did not account for block entity tags that were already in a Bedrock-compatible format (BlockEntity)
* Move BLOCK_ENTITY_TRANSLATIONS to BlockEntityTranslator
* Configuration updates
The main feature of this commit is switching Bukkit and BungeeCord to using Jackson configuration. This allows comments to load. Along with this, the Jackson configs have been consolidated into one abstract class, and a check is made to ensure auth-type cannot be set to Floodgate if Floodgate is not installed.
* Add deleted file; remove imports
* Re-add changing of Bukkit port
* Alphabetize import
* Alphabetize Bungee import
* Updates
* Swap values in GeyserJacksonConfiguration
* Add a null check for GeyserConnector in Bukkit's onDisable
This adds the height of the armour stand to the position if its invisible and not a marker to counteract the scale being 0 therefore having a wrong nametag position
* Fix edge case when shift clicking an output slot
* Don't send window close packet if window is already closed
* Limit amount of window close packets sent to the client
Fixes hidden inventory bar bug
* Restrict user from unusable chest inventory slots
* Fix crafting table slot mappings
* Always send cursor update