Package net.kyori.adventure.resource
Interface ResourcePackRequest
- All Superinterfaces:
net.kyori.examination.Examinable,ResourcePackRequestLike
public interface ResourcePackRequest
extends net.kyori.examination.Examinable, ResourcePackRequestLike
A request to apply one or more resource packs to a client.
Multiple packs are only supported since Minecraft 1.20.3.
- Since:
- 4.15.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder for resource pack requests. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ResourcePackRequestaddingRequest(@NotNull ResourcePackInfoLike first, @NotNull ResourcePackInfoLike @NotNull ... others) Create a basic request to apply the provided resource packs.default @NotNull ResourcePackRequestGet the pack request representation.@NotNull ResourcePackCallbackcallback()A callback to respond to resource pack application status events.@NotNull ResourcePackRequestcallback(@NotNull ResourcePackCallback cb) Set the callback to respond to resource pack application status events.@NotNull List<ResourcePackInfo>packs()The resource packs to apply.@NotNull ResourcePackRequestpacks(@NotNull Iterable<? extends ResourcePackInfoLike> packs) Set the resource packs to apply.@Nullable Componentprompt()Gets the prompt that will be provided when requesting these packs.booleanreplace()Whether to replace or add to existing resource packs.@NotNull ResourcePackRequestreplace(boolean replace) Set whether to replace or add to existing resource packs.booleanrequired()Gets whether the resource packs in this request are required.static @NotNull ResourcePackRequest.BuilderCreate a builder for a resource pack request.static @NotNull ResourcePackRequest.BuilderresourcePackRequest(@NotNull ResourcePackRequest existing) Create a builder for a resource pack request, based on an existing request.Methods inherited from interface net.kyori.examination.Examinable
examinableName, examinableProperties, examine
-
Method Details
-
addingRequest
@NotNull static @NotNull ResourcePackRequest addingRequest(@NotNull @NotNull ResourcePackInfoLike first, @NotNull @NotNull ResourcePackInfoLike @NotNull ... others) Create a basic request to apply the provided resource packs.- Parameters:
first- the first packothers- the other packs to apply- Returns:
- the created request
- Since:
- 4.15.0
-
resourcePackRequest
Create a builder for a resource pack request.- Returns:
- the pack request builder
- Since:
- 4.15.0
-
resourcePackRequest
@NotNull static @NotNull ResourcePackRequest.Builder resourcePackRequest(@NotNull @NotNull ResourcePackRequest existing) Create a builder for a resource pack request, based on an existing request.- Parameters:
existing- the existing request- Returns:
- the pack request builder
- Since:
- 4.15.0
-
packs
The resource packs to apply.- Returns:
- an unmodifiable list of packs to apply
- Since:
- 4.15.0
-
packs
@NotNull @NotNull ResourcePackRequest packs(@NotNull @NotNull Iterable<? extends ResourcePackInfoLike> packs) Set the resource packs to apply.- Parameters:
packs- the packs to apply- Returns:
- an updated pack request
- Since:
- 4.15.0
-
callback
A callback to respond to resource pack application status events.This method will return
ResourcePackCallback.noOp()if no callback has been set.- Returns:
- the callback
- Since:
- 4.15.0
-
callback
Set the callback to respond to resource pack application status events.- Parameters:
cb- the callback- Returns:
- an updated pack request
- Since:
- 4.15.0
-
replace
boolean replace()Whether to replace or add to existing resource packs.- Returns:
- whether to replace existing resource packs
- Since:
- 4.15.0
- Since Minecraft:
- 1.20.3
-
replace
Set whether to replace or add to existing resource packs.- Parameters:
replace- whether to replace existing server packs- Returns:
- an updated pack request
- Since:
- 4.15.0
-
required
boolean required()Gets whether the resource packs in this request are required.Vanilla clients will disconnect themselves if their player rejects a required pack, but implementations will not necessarily perform any additional serverside validation. The
callback()can provide more information about the client's reaction.- Returns:
- True if the resource pack is required, false otherwise
- Since:
- 4.15.0
-
prompt
Gets the prompt that will be provided when requesting these packs.- Returns:
- the prompt
- Since:
- 4.15.0
-
asResourcePackRequest
Description copied from interface:ResourcePackRequestLikeGet the pack request representation.- Specified by:
asResourcePackRequestin interfaceResourcePackRequestLike- Returns:
- the pack request representation of this object
-