Commit Graph

93 Commits

Author SHA1 Message Date
Camotoy bc0cfde8f9
Set the minimum Java version to 16; drop Bedrock 1.17.0 (#2477) 2021-09-10 14:10:56 -04:00
Camotoy f22d286ea1
Add world border translation (#1839)
As Bedrock does not have world border support, this PR translates what the Java server sends us for a world border into particles and fog, while also preventing the Bedrock client from moving outside of the world border.

Co-authored-by: Luke <32024335+lukeeey@users.noreply.github.com>
Co-authored-by: ofunny <play@ofunny.world>
2021-09-09 21:27:38 -04:00
Redned 64b0788012 Use an array for java blocks and replace rarely used map in BlockMappings 2021-09-04 12:36:09 -05:00
Camotoy b9541505af
Bump version to try and fix deploying; other nitpicks 2021-08-30 13:55:01 -04:00
Camotoy 3d04a957d0 Ensure that exceptions in player event loop are handled
Any stray exception means that the entire event loop comes crashing down.
2021-08-17 20:57:46 -04:00
Camotoy 7ae91a40ec
Ensure every packet is ran on the same thread per player (#2473)
This removes a lot of concurrency checking that needs to be done, because there should be no way two packets can be handled at the same time.
2021-08-16 20:39:29 -04:00
David Choo 3eb73a5634
Fix powder snow and fish buckets (#2437) 2021-08-01 22:20:15 -04:00
Redned b4921132e1 Replace BiMap with an Object2IntBiMap 2021-07-18 14:43:17 -05:00
Redned f7ef90278b
Implement a new registry system (#2306)
Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com>
2021-07-12 21:19:40 -04:00
Camotoy 683ac1c763
Fix spawn egg triggering twice in water 2021-06-19 20:33:07 -04:00
Camotoy dbf366b138
ACTUALLY fix swapping armor in hotbar when armor is already present (#2206)
Tested with iOS, desktop and console
2021-05-10 21:14:30 -04:00
Camotoy 0691bb67b4
Item frame optimization and block picking support (#2203)
Geyser now supports block picking for item frames. It checks to see if the item frame has an item in it - if so, it attempts the same block picking process with the item inside (NBT included). Otherwise, it attempts to pick for an item frame item.

This commit also improves item frames by having the internal map store the entity and not the ID - in many situations, this prevents two maps from having to be searched. Additionally, item frames are no longer despawned if an item is placed on them - rather, it waits until the server tells us to despawn the entity.
2021-05-09 15:44:41 -04:00
Camotoy 51aa96de2e
Fix visual glitch when swapping out armor that's already equipped (#2173)
Bedrock Edition allows you to swap out armor by right-clicking an item in your inventory, even when armor in that slot is already equipped. This PR prevents Bedrock from performing this action if both slots are occupied (which Java Edition will not do).
2021-05-09 01:25:57 -04:00
Camotoy 1301cd9c30
Fix interact entity packet (#2179)
For the InteractAt type of packet of the PlayerInteractEntityPacket, Java sends a diff between the entity's current position and the hit result of its cursor. Bedrock sends the full vector location in its interaction. Therefore, we just do the diff ourselves.

This fixes taking armor off of armor stands.
2021-04-30 18:35:45 -04:00
Camotoy 120769c7f6
Allow for crawling and moving in one-block spaces where possible (#1814)
This commit brings full support for crawling, sneaking under 1.5-block-tall spaces, and swimming in one-block areas. There is a check in place that decreases the player's speed to something comparable to Java if they are in a situation where they would otherwise go at normal walking speed (for example: without the check, a Bedrock player would go at full walking speed while crawling).
2021-04-12 00:35:53 -04:00
Camotoy f827b28852
More smoothed out shield code (#2051)
- Shield code is now down as the player is sneaking - it doesn't wait for the server to update our sneaking status
- Shield is now applied correctly when sneaking and then moving to the shield item
2021-03-18 00:53:14 -04:00
Camotoy ded00dfd97
Merge branch 'master' of https://github.com/GeyserMC/Geyser into server-inventory 2021-03-09 14:45:04 -05:00
Camotoy 9ae7c1de25
1.16.210 support (#2019)
This commit implements 1.16.210 support while still keeping 1.16.100 and 1.16.210 compatibility.

Co-authored-by: AJ Ferguson <AJ-Ferguson@users.noreply.github.com>
Co-authored-by: rtm516 <rtm516@users.noreply.github.com>
2021-03-09 12:51:48 -05:00
Camotoy da11cd298c
Address requests 2021-03-08 16:57:31 -05:00
Camotoy ca3f9550dd
Remove unused variables; fix opening double chests quickly 2021-03-04 12:26:16 -05:00
Camotoy 78337830c6
Use the real block for opening inventory when possible 2021-02-12 14:39:41 -05:00
Camotoy 8670172f8d
Revert "Start work on using the world block for inventories"
Oops! Not finished yet!!

This reverts commit 454896a7ad.
2021-02-05 11:48:12 -05:00
Camotoy 454896a7ad
Start work on using the world block for inventories 2021-01-30 16:05:27 -05:00
AJ Ferguson 196c9f5c17 Remove debug lines 2021-01-13 19:19:01 -09:00
Camotoy 4db9ec92bf
Merge branch 'master' of https://github.com/GeyserMC/Geyser into server-inventory 2021-01-11 19:46:39 -05:00
Camotoy ade4c14911
Block breaking refactors (#1336)
Client-side block animations and reach checks are now added.

This commit also includes cleanup in BlockChangeTranslator as well as proper Netherite tool support for calculating block breaking.

Co-authored-by: rtm516 <rtm516@users.noreply.github.com>
2021-01-07 22:43:36 -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 8317961340
Merge branch 'master' of https://github.com/GeyserMC/Geyser into server-inventory 2021-01-01 14:20:52 -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 3c1a40c56a
Better net ID handling 2020-12-29 19:59:22 -05:00
DoctorMacc 049242db4b
Update to 1.16.200 2020-12-09 01:12:02 -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
Tim203 c64d57439f
Block entity performance improvements (#1481)
* BlockEntity performance improvements

* Use chunk cache if possible for block caching

* Get new block state from ViaVersion if block entity

* Add Javadoc for FlowerPotBlockEntityTranslator.isFlowerBlock

* Remove debug line

* Don't add all RequiresBlockState instances if cache chunks is enabled

* Double chest map get optimization

* Last changes

Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
2020-11-05 22:36:22 +01:00
David Choo 8fdaf6a385
Ender dragon Melee Attacks (#1466)
* Create and position Ender Dragon Bounding Box

Currently allows the player to "kill aura" target
the ender dragon.

* Use an entity to handle attacks for each hitbox

* Use the proper flag to make entities invisible

* Clean up and add some comments

* Ender dragon entity metadata improvements

* Add doc to segment functions

* Add changes

Co-authored-by: DoctorMacc <toy.fighter1@gmail.com>
2020-10-29 18:35:46 -04:00
AJ Ferguson 7f4b588cdf server inventory. WORK IN PROGRESS
wip commit of implementing server authoritative inventories. there is a lot of experimental and debug code. this is NOT ready for testing or review.
2020-10-16 15:25:05 -08: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 4514167835
Fix fire being punched in all directions (#1370)
Apply the fix we have for fire but for all block faces.
2020-10-08 18:44:15 -04:00
Camotoy fa0864b8a1
Fix picking up liquids with buckets (#1311)
* 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
2020-09-24 15:11:42 -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 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 46c34842d8
BedrockInventoryTransactionTranslator: check to make sure bucket usage is on purpose (#1280)
Otherwise buckets can be activated when opening block inventories.
2020-09-12 09:47:43 -04:00
Camotoy b103d86ff9
Fix buckets on desktop survival (#1003) 2020-07-23 14:37:14 -04:00
rtm516 30c007d04b
Fix buckets not working on mobile (#767)
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.
2020-07-21 13:17:55 -04:00
DoctorMacc 0cea703b46 Save ItemEntry classes for items 2020-07-07 16:40:19 -04:00
DoctorMacc f68632f433 Block-related updates
- Fix block breaking animation
- Fix block breaking particles
- Don't initialize Geyser's chunk cache if using Spigot
2020-07-06 21:38:10 -04:00
DoctorMacc ea1a9e5427 Bedrock 1.16 updating part 1 2020-06-22 20:11:09 -04:00
DoctorMacc 117cdf282d Begin updating Geyser. Requires manual MCProtocolLib compile 2020-06-20 22:24:45 -04:00
DoctorMacc d6119375b2 (Incomplete) Update MCProtocolLib 2020-06-18 21:44:50 -04:00
DoctorMacc afb12e923b Show villager display name 2020-06-06 00:04:05 -04:00
RednedEpic 6b68bbb413 Large refactoring to item translator and registry/util classes
- Merged ItemTranslator and ItemStackTranslator together.
- Split ItemTranslator into two classes: ItemTranslator and ItemRegistry. The registry is where items are registered, and the translator class is where item translation takes place.
- Made most of ItemTranslator's methods static and removed the initialization in Toolbox.
- Moved a handful of registry classes previously ending with 'Utils' to a 'Registry' class to be more fitting for the term.
- Moved inventory and block entity registration out of Translators.
- Renamed Translators to PacketTranslatorRegistry.
- Yeeted Toolbox.
- Minor cleanups and small refactors.
2020-05-24 20:07:05 -05:00