Giter Site home page Giter Site logo

mineskinclient's Introduction

MineskinClient

Client for api.mineskin.org

Can be used to generate valid texture data from skin image files.
You can also use mineskin.org to directly generate skin data from images.

The API requires official Minecraft accounts to upload the skin textures.
If you own a Minecraft account you don't actively use and want to contibute to the API's speed, please add your account here!

public class Example {

    private static final MineSkinClient CLIENT = MineSkinClient.builder()
            .requestHandler(JsoupRequestHandler::new)
            .userAgent("MyMineSkinApp/v1.0")
            .apiKey("your-api-key")
            .build();

    public static void main(String[] args) throws FileNotFoundException {
        GenerateOptions options = GenerateOptions.create()
                .name("My Skin")
                .visibility(Visibility.PUBLIC);
        File file = new File("skin.jpg");
        CLIENT.generateUpload(file, options)
                .thenAccept(response -> {
                    // get generated skin
                    Skin skin = response.getSkin();
                    System.out.println(skin);
                })
                .exceptionally(throwable -> {
                    throwable.printStackTrace();
                    if (throwable instanceof CompletionException completionException) {
                        throwable = completionException.getCause();
                    }

                    if (throwable instanceof MineSkinRequestException requestException) {
                        // get error details
                        MineSkinResponse response = requestException.getResponse();
                        System.out.println(response.getMessageOrError());
                    }
                    return null;
                });

        CLIENT.getSkinByUuid("skinuuid")
                .thenAccept(response -> {
                    // get existing skin
                    Skin skin = response.getSkin();
                    System.out.println(skin);
                });
    }

}
<depencies>
    <dependency>
        <groupId>org.mineskin</groupId>
        <artifactId>java-client</artifactId>
        <version>2.0.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.mineskin</groupId>
        <artifactId>java-client-jsoup</artifactId>
        <version>2.0.0-SNAPSHOT</version>
    </dependency>
<!-- alternatively use apache httpcommons -->
<!--    <dependency>-->
<!--        <groupId>org.mineskin</groupId>-->
<!--        <artifactId>java-client-apache</artifactId>-->
<!--        <version>2.0.0-SNAPSHOT</version>-->
<!--    </dependency>-->
</depencies>
<repositories>
    <repository>
        <id>inventive-repo</id>
        <url>https://repo.inventivetalent.org/repository/public/</url>
    </repository>
</repositories>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.