Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom blocks and skulls #3505

Merged
merged 190 commits into from
Aug 21, 2023
Merged

Conversation

Kas-tle
Copy link
Member

@Kas-tle Kas-tle commented Jan 16, 2023

Major thanks to Amberichu for all her help with this! 🎉

This PR builds off of her initial skull and custom block registry system. It adds support for registration of custom blocks via both extensions and mappings. Via mappings, the user can override either specific blockstates, or all blockstates for a given block. A blocks section may be simply added to existing files in custom_mappings. The structure of the mappings is described in the preview documentation.
Preview documentation: https://pages.kastle.dev/geyser/custom-blocks/

In addition, there is support for registering specific skulls via a config file. These skulls are incorporated into a resource pack generated by Geyser on startup.
Preview documentation: https://pages.kastle.dev/geyser/custom-skulls/

I know we'll probably have a long road to getting this merged, but I'm ready to get started with whatever changes need to be made. Just let me know. Also feel free to commit to my branch directly if you so choose.

Accompanying PR has been made on the wiki for documentation of these new features. See GeyserMC/GeyserWiki#115

@Camotoy (to figure out the branch stuff)

Major Caveats

  • Break speeds will be completely broken for vanilla tools. This cannot be fixed at this time. We can likely fix for custom tools once Added tool break speeds & more #3381 is merged. Thanks to a suggestion from Camotoy, we can calculate the break time server side and simply break the block for the client when needed. See 29835a1
  • Hit boxes cannot extend outside 1x1x1 block. This means blocks like walls and fences can effectively be jumped over by bedrock players. We could perhaps work around this by adding either solid entities or invisible blocks above blocks with a collision box that extend outside this size. I implemented the proposed workaround; see 7f85e90 and 5f5159d (primarily). The only minor inconvenience here is an unknown geometry warning will be displayed without a slight change to GeyserOptionalPack, but there is not other change in function beyond the content log error. Note that we still have the issue of being limited to cuboid shaped collision boxes, but for now this is a Mojang limitation we cannot control.
  • Blocks with native GUIs will not work.
  • Blocks are not overridden in the creative inventory. To accomplish this, we would need a way to programmatically map the blocks in each creative category. This would probably require futzing around with pmmp/bds-mod-mapping. This can now be done as long as the creative category and group is specified in the mappings.
  • Block geometries are limited to 1.875x1.875x1.875. This limitation is expressly imposed by Mojang and is unlikely to change. See https://bugs.mojang.com/browse/MCPE-152191. Note that currently this can technically be worked around since as of 1.20.12 the transformation component seems to bypass size limits, but note that 1. a content log warning is displayed and 2. there is an open bug regarding this with an ADO (see https://bugs.mojang.com/browse/MCPE-173799) implying that this will likely be patched in the future.

Given the above, I see this as primarily a cosmetic feature. We can do our best to make the components work, but it would be ill advised for anyone to rely on them working.

davchoo and others added 30 commits July 5, 2022 03:41
…kulls

Clean up skull block translation a bit
Change `davchoo` to `geyser` in geometry
21 block states vs 48 block states
Custom skulls can now be added by username, uuid, and textures

Move skull nbt stuff from requestTexturesFromUsername to
SkullBlockEntityTranslator
Add requestTexturesFromUUID
# Conflicts:
#	core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java
#	core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java
Fix incorrect collision names used in CustomBlockComponentsBuilder
# Conflicts:
#	core/src/main/java/org/geysermc/geyser/GeyserImpl.java
#	core/src/main/java/org/geysermc/geyser/registry/provider/GeyserBuilderProvider.java
Convert CustomBlockPermutation into a record
Change materialInstances in CustomBlockComponents Builder to
materialInstance
Reuse box components in CustomSkull
Should be easier to modify in needed in the future.
Should reduce memory & storage usage for Bedrock clients
Add defaultBlockState to CustomBlockData
Remove defaultBlockState CustomBlockState field from
GeyserCustomBlockData since it creates a circular reference
Fix missing providers when used in GeyserDefineCustomBlocksEvent
Signed-off-by: Joshua Castle <[email protected]>
Signed-off-by: Joshua Castle <[email protected]>
@polargh
Copy link

polargh commented Aug 5, 2023

LGTM! 😀 👍

@Tydium
Copy link
Contributor

Tydium commented Aug 5, 2023

👀

@Kas-tle Kas-tle requested a review from davchoo August 12, 2023 14:49
Signed-off-by: Joshua Castle <[email protected]>
Signed-off-by: Joshua Castle <[email protected]>
@Kas-tle Kas-tle requested a review from rtm516 August 15, 2023 03:37
@davchoo davchoo removed their request for review August 20, 2023 14:07
Signed-off-by: Joshua Castle <[email protected]>
Signed-off-by: Joshua Castle <[email protected]>
Signed-off-by: Joshua Castle <[email protected]>
@polargh
Copy link

polargh commented Aug 21, 2023

LGTM!

@polargh
Copy link

polargh commented Aug 21, 2023

👍

@Kas-tle Kas-tle merged commit 9ddfdf9 into GeyserMC:master Aug 21, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Extensions PR: Feature When a PR implements a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.