-
-
Notifications
You must be signed in to change notification settings - Fork 693
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
Feature: Allow API users to set ResourcePackOption's, add a GeyserDefineResourcePacksEvent #4978
Open
onebeastchris
wants to merge
79
commits into
GeyserMC:master
Choose a base branch
from
onebeastchris:subpacks-rewrite-merge-urlpacks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature: Allow API users to set ResourcePackOption's, add a GeyserDefineResourcePacksEvent #4978
onebeastchris
wants to merge
79
commits into
GeyserMC:master
from
onebeastchris:subpacks-rewrite-merge-urlpacks
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Deprecate GeyserLoadResourcePacksEvent in favor of GeyserDefineResourcePacksEvent - Load CDNentries properly
…licate deprecation annotation
Instead: - add UrlPackCodec & GeyserUrlPackCodec - try and provide the resource pack via a stream from the url - either because the client does not support packs via the url, or because it failed to get the packs
…t, since it seems to work without it !?
…haos ensues since the client will either show bogus resource pack size values (invalid sizes), or skip resource packs altogether (if not properly zipped).
# Conflicts: # core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java # core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java
- better exception catching - proper error handling - caching of packs if size, etag, and last modified are the same
# Conflicts: # core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java # core/src/main/java/org/geysermc/geyser/registry/loader/ProviderRegistryLoader.java
# Conflicts: # core/src/main/java/org/geysermc/geyser/GeyserImpl.java # core/src/main/java/org/geysermc/geyser/util/WebUtils.java
Add uuid shortcut to ResourcePack interface Make the priority a double, add LOWEST and HIGHEST priorities
…ewrite-merge-urlpacks # Conflicts: # api/src/main/java/org/geysermc/geyser/api/event/bedrock/SessionLoadResourcePacksEvent.java # core/src/main/java/org/geysermc/geyser/event/type/SessionLoadResourcePacksEventImpl.java # core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java # core/src/main/java/org/geysermc/geyser/pack/GeyserResourcePack.java # core/src/main/java/org/geysermc/geyser/registry/loader/ProviderRegistryLoader.java # core/src/main/java/org/geysermc/geyser/registry/loader/ResourcePackLoader.java
…acks-rewrite-merge-urlpacks # Conflicts: # core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java
onebeastchris
added
API
The issue/feature request relates to the Geyser API
PR: Needs review
Indicates that a PR is functional and review-ready.
labels
Aug 21, 2024
…acks-rewrite-merge-urlpacks
Camotoy
reviewed
Aug 22, 2024
core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java
Outdated
Show resolved
Hide resolved
Camotoy
reviewed
Aug 22, 2024
core/src/main/java/org/geysermc/geyser/event/type/SessionLoadResourcePacksEventImpl.java
Outdated
Show resolved
Hide resolved
…cts...) method to easily debug-log messages without debug checks preventing formatting overhead
6 tasks
This was
linked to
issues
Aug 30, 2024
…r; clean up holders, fluent accessors
…acks-rewrite-merge-urlpacks # Conflicts: # core/src/main/java/org/geysermc/geyser/item/enchantment/Enchantment.java
…acks-rewrite-merge-urlpacks # Conflicts: # core/src/main/java/org/geysermc/geyser/GeyserImpl.java # core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java # core/src/main/java/org/geysermc/geyser/registry/Registries.java
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
API
The issue/feature request relates to the Geyser API
PR: Needs review
Indicates that a PR is functional and review-ready.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds quite a bit of resource pack related API, and changes how resource packs are handled.
New: ResourcePackOption's
A system to pass options alongside/for a resource pack, that define how these are sent to the client. Currently implemented:
PriorityOption
: the order in which resource packs are applied on the client, thereby allowing api users to change the order in which packs override each other. This is done with a double between 0 and 10 inclusive, which are then sorted.SubpackOption
: allows specifying a Subpack of a resource pack. (Implements Resource Subpack Loading #4939)UrlFallbackOption
: Only relevant for packs provided via the new UrlPackCodec; allows to disconnect the player instead of providing the pack over raknet. This could be interesting for cases where the resource pack link isn't working anymoreNew event:
GeyserDefineResourcePacksEvent
: similar to the SessionLoadResourcePacksEvent, this event allows registeringResourcePack
's to the core Geyser resource pack registry. With this, theGeyserLoadResourcePacksEvent
api will be deprecated, and marked for removal.New api methods for the
SessionLoadResourcePacksEvent
andGeyserDefineResourcePacksEvent
:#register(ResourcePack, ResourcePackOptions<?>...)
: Registers a resource pack with these resource pack options.#registerOptions(UUID uuid, ResourcePackOption<?>... );
Registers options for an already registered resource pack.Collection<ResourcePackOption<?>> #options(UUID);
Returns a collection of all set resource pack options for a registered resource pack.@Nullable ResourcePackOption<?> #option(UUID, ResourcePackOption.Type)
- returns an option with the specific type currently applied to a resource packNew addition to the
ResourcePack
: aResourcePack.Builder
...and a
ResourcePack#uuid
shortcut to avoid getting the manifest, then header, and finally the UUID.ResourcePackManifest
additions:API Deprecations:
PackCodec#serialize()
method takes in a ResourcePack parameter which isn't used. It's also not relevant as a codec would represent a singular resource pack. This method was deprecated, and replaced with a serialize method without a parameter.Further, this PR (currently) supersedes #4205 by also including the changes made there here. This is done to ensure that the options system plays nicely with the changes there; but i can split it up again if that's desired.
Brief rundown of changes in the remote resource pack PR:
UrlPackCodec
that can be used to create a resource pack from a URL. Geyser will download the pack there to get a manifest, and provided that theUrlFallbackOption
is not disabled, also provide the resource pack over raknet as a fallback when the client fails to download it from the url.However, in order to not have to wait until configurate auto-adds config options, i've not included the
remote-resource-packs
config option here, making url packs api only. That, imo, is also fine given the overly complex requirements of url packs (content type, size, etc)Internal changes:
ResourcePackHolder
to hold default resource pack options - provided in theGeyserDefineResourcePacks
event - and the resource pack itself.SessionLoadResourcePacksEvent
- this makes sense imo as it avoids cluttering the UpstreamPacketHandler, and also ensures that the options are set from the same spot they're collected from.OptionHolder
which holds the variousResourcePackOption
's. The use of it would be to avoid duplicate types, to validate options - e.g. not allowing a subpack option if there are no subpacks on a given pack - and to provide both default resource pack options (set in the define event) additionally to the options in the session event, while avoiding duplicate keys.Opening as a draft now until it's decided whether we want to actually implement such a system, or whether we want to split this into multiple PR's.