Interface ResourcePackRequest
- All Superinterfaces:
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 ResourcePackRequestaddingRequest(ResourcePackInfoLike first, ResourcePackInfoLike... others) Create a basic request to apply the provided resource packs.default ResourcePackRequestGet the pack request representation.callback()A callback to respond to resource pack application status events.Set the callback to respond to resource pack application status events.packs()The resource packs to apply.packs(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.replace(boolean replace) Set whether to replace or add to existing resource packs.booleanrequired()Gets whether the resource packs in this request are required.static ResourcePackRequest.BuilderCreate a builder for a resource pack request.static ResourcePackRequest.BuilderresourcePackRequest(ResourcePackRequest existing) Create a builder for a resource pack request, based on an existing request.
-
Method Details
-
addingRequest
static ResourcePackRequest addingRequest(ResourcePackInfoLike first, ResourcePackInfoLike... 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
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
List<ResourcePackInfo> packs()The resource packs to apply.- Returns:
- an unmodifiable list of packs to apply
- Since:
- 4.15.0
-
packs
Set the resource packs to apply.- Parameters:
packs- the packs to apply- Returns:
- an updated pack request
- Since:
- 4.15.0
-
callback
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
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
@Nullable Component 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
-