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
    • 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 pack
        others - 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