Commit Graph

30 Commits

Author SHA1 Message Date
Kas-tle 1df63c6de8
Support Bedrock 1.20.70 (#4477)
* Support 1.20.70

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Update readme

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Use 1.20.70 mappings

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Creative lectern drops work but not survival yet

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Fix lectern book pickup in survival

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Add copyright notices to new files

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Temp fix for incorrect creative_items from Cloudburst/Data

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Fix item frame breaking in creative

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Clarify what to remove when 1.20.60 support is dropped

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Don't use dim change enum pre 1.20.70

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

---------

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
2024-03-11 00:29:27 -07:00
chris ec526a798d
Send cooldown when punching air (#4257) 2023-11-03 17:22:55 +01:00
Kas-tle 3fa35b2cb9
Restrict game packets to state; Closes #4191 (#4210)
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
2023-10-12 06:02:57 -07:00
chris dec62e94e2
Fix: Implement 1.20.30 START_FLYING and STOP_FLYING cases (#4198) 2023-10-08 00:31:23 +02:00
Valaphee The Meerkat dead91b929
Set BlockMapping.AIR (#4135)
* Set BlockMapping.AIR, id is always 0, but this also ensures that the palette always has air

* Rename BlockMapping.AIR to DEFAULT, as it does not have to represent AIR, and statically set it
2023-09-20 06:52:37 -07:00
chris 0d5cb51d5f
Make `geyser connectiontest` command more foolproof (#3951)
Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com>
2023-09-05 23:16:44 -04:00
Kas-tle 9ddfdf9374
Add support for custom blocks and skulls (#3505)
* Super cursed custom skulls custom block

* Rename some stuff

* Attempt to clean up some code

* Remove skull translation events and define custom blocks for custom skulls

Clean up skull block translation a bit

* Auto generate skull resource pack

Change `davchoo` to `geyser` in geometry

* Add config options for custom blocks and custom skull blocks

* Fix formatting and names for player skulls

* Use block states more efficiently for custom skulls

21 block states vs 48 block states

* Clean up custom block api a bit

* Apply some suggestions from Camotoy

* Move custom skull config stuff to its own file

Custom skulls can now be added by username, uuid, and textures

Move skull nbt stuff from requestTexturesFromUsername to
SkullBlockEntityTranslator
Add requestTexturesFromUUID

* Update custom block nbt for v534

* Disable collision box & selection box when box is empty

Fix incorrect collision names used in CustomBlockComponentsBuilder

* Add custom block stuff to provider registry loader

* More API changes

Convert CustomBlockPermutation into a record
Change materialInstances in CustomBlockComponents Builder to
materialInstance
Reuse box components in CustomSkull

* Convert skull floor geometries into a template

Should be easier to modify in needed in the future.

* Crop and reorder skull textures to eliminate unused space

Should reduce memory & storage usage for Bedrock clients

* Revert "Crop and reorder skull textures to eliminate unused space"

This reverts commit 15fd5353e1.

* Use identifier from CustomBlockData in SkullResourcePackManager

* Fix isIncorrectHeldItem check for custom skull blocks

Add defaultBlockState to CustomBlockData

* Fix adding duplicate block states for custom blocks with 0 properties

Remove defaultBlockState CustomBlockState field from
GeyserCustomBlockData since it creates a circular reference

* Add basis for overriding Bedrock block states

Fix missing providers when used in GeyserDefineCustomBlocksEvent

* Fix custom blocks in 1.19.50

* Decouple mappings from items

* Decouple mappings from items

* Null check

* Move to CustomBlockRegistryPopulator

* Remove name_hash from blocksTag/vanillaBlockStates

Fixes creative inventory contents with custom blocks registered

* Limit Bedrock versions to 1.19.40+

Custom blocks were released in 1.19.40

* Un-revert Crop and reorder skull textures to eliminate unused space

Should reduce memory & storage usage for Bedrock clients

Bug with top face flipping + per-face uv's was fixed in 1.19.40+
https://bugs.mojang.com/browse/MCPE-160073
Geometry is still offset by 0.5 to prevent lighting bugs

* Add validation custom block components and s/lightFilter/lightDampening/

Also validate custom block names

* Add display name component and add toggle for client block placing

The display name component allows blocks to use other locale keys.
placeAir will prevent the client from placing the default block state.

* Begin parsing block mappings (still much to do!)

* CustomBlockMapping stores block w/ all states

* Mappings almost :/

* Ok now they work at least

* Read most mapping components

* Block mappings mostly done

* Translate block item

* Add docs for custom blocks

* Add tags

* More docs

* Accidentally added name comp.

* Fix collide box and warn for >16 props

* add registerBlockItemOverride event + refactor

* Inventory overrides for multistate bedrock blocks

* Implement all remaining block components

* Minor cleanup and javadocs

* Update custom skull config example

* Address @Camotoy's review

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Fix light_emission and light_dampening components

* Remove redundant populate method and remove BLOCKS_JSON after last use

* Fix inventories with block state overrides not opening

* API event for skull blocks & let register via URL

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Use skin hash instead of URL

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address @davchoo's review

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Rework MappingsReader_v1 to avoid passing maps around

* Treat all properties as string properties

There isn't a real need to check for boolean and int properties

* Fix block registry scan in MappingsReader

* Skin hashes can have less than 64 characters?

* Include entry when logging exceptions from block mappings

* Submodule

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Fix block break speeds thanks to @Camotoy

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Temporarily fix build on eclipse so I may work...

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Custom tool breakspeed by server; Closes #3348

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Account for if custom skulls are added on 1st run

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Initial framework for extended collision boxes

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Add some notes for the extended collision box impl

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* We have our extended collision registry

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Notes for me

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Extended collision boxes almost work

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Extended collision boxes actually work

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Consider all hitboxes in calculation

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* X is mirrored...

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Extended collision boxes are much improved

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Upstream fallout

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address @Redned235's review

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Oops my bad that makes no sense :)

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Ext collision box chunk translation optimization

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Trunc skinhash to 32 chars due to 80 char limit

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Use new transformation cmpnt vs legacy rotation

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* keep arr null on get extcolstor

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Properly handle if extended collision box is below

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Less ugly (realized it can go here)

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Prevent 2x placement due to extended collision box

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Properly build on eclipse via indra

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Ensure enough bits in bedrockData for paletteIDs

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Fix not needed whitespace

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Update license headers to 2023

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Use release indra over snapshot

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Revert "Update license headers to 2023"

This reverts commit f750059e8e.

* Account for collisions in chunk section y0 layer

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Fix extended collision @ air section bottom

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address @davchoo's review

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address @rtm516's review

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* More @rtm516's review

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address @Camotoy's review

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Update javadocs

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address @davchoo's review

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Lock extended collision to section

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Clear ext col even when air

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Let override vanilla items in creative inventory

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Avoid creating 12 HashSets for every overrided block state

* Super minor nitpicks + Custom Skull NBT fix

* Check custom skull is within Bedrock bounds

Fixes NPE with custom skulls above y=320 or below y=-64

* Add static builder methods to match CustomItemData API

* Upstream

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Initial API setup for modded blocks (no impl yet)

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* More work on nonvanilla blocks (nonfunctional)

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Fix compile

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Update submodules

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Modded reg so far (not done)

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Add non-vanilla registration and fix a few bugs

* Fixes for non-vanilla blocks

* Remove import

* CustomRegPop. go1st for now; must split for modded

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address silent change to geo component for blocks

Co-Authored-By: Unoqwy <pm@unoqwy.dev>
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Seperate bedrock, vanilla, & nonvanilla block reg

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Single event

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Impl MaterialInstance as builder per @Redned235

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Added creative category enum & added some missing overrides (#7)

* Add material instance to provider registry

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* oops

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Fix case of correctBedrockIdentifier not found

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Fix docs

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address @Camotoy's review

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address review from @davchoo

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Set namespace of custom blocks vs ident direct

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Address review from @rtm516

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* One more

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Remove rogue space

* Geo component as builder

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* use super name

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

* Bump version

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>

---------

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: davchoo <davchoo@users.noreply.github.com>
Co-authored-by: davchoo <4722249+davchoo@users.noreply.github.com>
Co-authored-by: Unoqwy <pm@unoqwy.dev>
Co-authored-by: RednedEpic <redned235@gmail.com>
Co-authored-by: ImDaBigBoss <67973871+ImDaBigBoss@users.noreply.github.com>
Co-authored-by: rtm516 <rtm516@users.noreply.github.com>
2023-08-21 16:04:08 -07:00
Roman Alexander 7725651726
Fix double sending ServerboundPlayerActionPacket in creative (both of which Spigot interprets as a BlockBreakEvent) (Fixes #4021) (#3996) 2023-07-30 13:48:29 -07:00
Camotoy 966270d3c8
Fix missed swing on 1.20.10 2023-07-21 19:25:01 -04:00
Camotoy ed21a10101
Boss bars should actually be more reliable on dimension switch 2023-05-09 01:41:57 -04:00
Camotoy 0d25a3f04d Fix boss bars not showing up on dimension switch 2023-05-07 02:59:44 -04:00
Camotoy b6113dfd31 Optimizations and regression fix 2023-04-06 21:47:37 -04:00
Camotoy 4fe9aeca40
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feature/protocol-3.0 2022-12-20 19:47:45 -05:00
RednedEpic a133308f51 It compiles! 2022-10-29 22:02:11 -05:00
RednedEpic 18e7db8c30 Start on update to Protocol 3.0 2022-10-29 19:23:21 -05:00
Konicai cc82f4b871
Fix bounding box for 1.19.40 after death + respawn (#3374)
Co-authored-by: onebeastchris <105284508+onebeastchris@users.noreply.github.com>
2022-10-29 20:08:41 -04:00
Camotoy 1b6cfad5ad
Fix ghost blocks when insta-mining on 1.19+
Fixes #3113
2022-09-27 19:24:50 -04:00
Camotoy 2ce7ff850a
Support the 1.19.0 Java block prediction/ack system 2022-07-09 23:02:19 -04:00
David Choo 9ea22042eb
Fix some item interactions (#3083)
* Remove Bedrock only banner patterns from the creative inventory

* Add sound for tadpole bucket

* Fix lily pad and frogspawn placing on mobile/single stacks

* Workaround? Fix? for bucket usage on mobile

* Simplify math and update position+rotation whenever ServerboundUseItemPacket is sent

* Rotate the player back after using an item and fix glass bottles

* ITEM_USE actionType 1 does not need the rotation fix

Increase delay for look back

* Add some checks

* Prevent buckets and spawn eggs from being unintentionally placed when interacting with special blocks

As of 1.19 Bedrock no longer sends a PlayerActionPacket with action=BLOCK_INTERACT. Bedrock now sends action=ITEM_USE_ON_START before and action=ITEM_USE_ON_STOP after using an item on a block. However, this is not useful as it is sent for all block interactions.

* Fix inventory transactions being rejected after restoreCorrectBlock

The held item's netId is always 0 in the InventoryTransactionPacket.

* Touch ups

* Fix lookAt for different poses and sneaking + cauldron + bucket interactions

Fix boat items being desynced when placing them very close to collision
Fix bottles being desynced when tapping above water

Resend the held item if we do encounter a desync

* Avoid getting blockstate twice and fix comment

* Use generated interaction data

* Fix glass bottles being double filled and phantom water bottles/water buckets

* Don't update the entire inventory on useItem

* Use Geyser's inventory copy for check

* Use ItemTranslator#getBedrockItemMapping to avoid NBT translation

* mappings

Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com>
2022-06-24 16:48:28 -04:00
Camotoy ebf18cfb28
Switch all Position instances to Vector3i 2022-05-25 19:17:49 -04:00
Camotoy bbf45b6a4c
Compiles; provide your own mappings for now 2022-05-25 15:55:15 -04:00
Camotoy 0829b5cd4e
Replicate Bedrock shield behavior more accurately
If the player swings, then they cannot be holding their shield at the same time.

Also fixes an animation edge case with other players.
2022-03-15 13:34:56 -04:00
Tim203 3251d9010c
We're in 2022 now 2022-01-01 20:03:05 +01:00
Camotoy 68c13c08fa
Fix some regressions in swim handling 2021-12-25 22:46:16 -05:00
Camotoy 24f09e016d Entity IDs in Java Edition just need to be integers
We don't need to keep them as longs - this just reduces the amount of casting needing throughout the codebase.
2021-12-20 19:25:11 -05:00
David Choo 754bb42c19
Fix some mount offsets and strange behaviors with GSit (#2701)
* Prevent boats from floating when a Bedrock player rides in the back

* Update llama and shulker mount height offset

* Fix Trader llama mount offset

* Change passengers to an IntList

Also move rotation lock stuff to EntityUtils

* Allow EntityCache.getEntityByJavaId to return the session's player

Removes many checks from several translators.

* Fix mount offset on armorstands and area effect clouds

Also prevent area effect clouds from despawning when used as an invisible entity (used in GSit to offset players riding on other players)

* Update mount offsets on height changes

TODO test this

* Actually update vehicleId and optimize StriderEntity metadata update

* Don't hide marker armor stands and properly update mount offsets

* What?

* Remove y offset for Shulkers riding other entities

* Confirm teleports in the order received

This allows Bedrock players to move after standing up when using GSit

* Fix mount offset for riders on baby zoglins

* Cache only the latest teleport and confirm teleports immediately

* Fix crawling with GSit

* Inline var and undo respawn method

* Use Entity reference for vehicles

* Remove ridingVehicleEntity from GeyserSession

* Use Entity references for passengers and drop cachedPlayerEntityLinks

* Reuse variable and remove setVehicle(null)
2021-12-18 11:43:57 -05:00
Camotoy e954d091b9
Prevent errors from simply being swallowed 2021-12-05 19:03:47 -05:00
Camotoy 966c2155ad
API: change player class to Connection 2021-11-22 14:52:26 -05:00
RednedEpic 83ddbd7d1a Initial api draft 2021-11-21 12:36:42 -06:00
RednedEpic 2c663e0ee5 The Great Refactor Part 3 - Entire project restructure 2021-11-20 17:29:46 -06:00
Renamed from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockActionTranslator.java (Browse further)