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 Classes Modifier and Type Interface Description static interface
ResourcePackRequest.Builder
A builder for resource pack requests.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static @NotNull ResourcePackRequest
addingRequest(@NotNull ResourcePackInfoLike first, @NotNull ResourcePackInfoLike @NotNull ... others)
Create a basic request to apply the provided resource packs.default @NotNull ResourcePackRequest
asResourcePackRequest()
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 java.util.List<ResourcePackInfo>
packs()
The resource packs to apply.@NotNull ResourcePackRequest
packs(@NotNull java.lang.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
resourcePackRequest()
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.
-
-
-
Method Detail
-
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
@NotNull static @NotNull ResourcePackRequest.Builder 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
@NotNull @NotNull java.util.List<ResourcePackInfo> 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 java.lang.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
@NotNull @NotNull ResourcePackCallback 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
@NotNull @NotNull ResourcePackRequest callback(@NotNull @NotNull ResourcePackCallback cb)
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
@NotNull @NotNull ResourcePackRequest replace(boolean 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
@Nullable @Nullable Component prompt()
Gets the prompt that will be provided when requesting these packs.- Returns:
- the prompt
- Since:
- 4.15.0
-
asResourcePackRequest
@NotNull default @NotNull ResourcePackRequest asResourcePackRequest()
Description copied from interface:ResourcePackRequestLike
Get the pack request representation.- Specified by:
asResourcePackRequest
in interfaceResourcePackRequestLike
- Returns:
- the pack request representation of this object
-
-