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
Modifier and TypeInterfaceDescriptionstatic interface
A builder for resource pack requests. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ResourcePackRequest
addingRequest
(@NotNull ResourcePackInfoLike first, @NotNull ResourcePackInfoLike @NotNull ... others) Create a basic request to apply the provided resource packs.default @NotNull ResourcePackRequest
Get the pack request representation.@NotNull ResourcePackCallback
callback()
A callback to respond to resource pack application status events.@NotNull ResourcePackRequest
callback
(@NotNull ResourcePackCallback cb) Set the callback to respond to resource pack application status events.@NotNull List<ResourcePackInfo>
packs()
The resource packs to apply.@NotNull ResourcePackRequest
packs
(@NotNull Iterable<? extends ResourcePackInfoLike> packs) Set the resource packs to apply.@Nullable Component
prompt()
Gets the prompt that will be provided when requesting these packs.boolean
replace()
Whether to replace or add to existing resource packs.@NotNull ResourcePackRequest
replace
(boolean replace) Set whether to replace or add to existing resource packs.boolean
required()
Gets whether the resource packs in this request are required.static @NotNull ResourcePackRequest.Builder
Create a builder for a resource pack request.static @NotNull ResourcePackRequest.Builder
resourcePackRequest
(@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:ResourcePackRequestLike
Get the pack request representation.- Specified by:
asResourcePackRequest
in interfaceResourcePackRequestLike
- Returns:
- the pack request representation of this object
-