自定义卡片渲染器

This is not for newbie developers.

What is a CustomCardRenderer?

It's a class that can be used to create a custom renderer. You can use it to show custom images to the player. You will have to obtain pixel colors for example using a BufferedImage.

This class is meant to be used to do simple stuff not advanced layering. To do advanced layering, transparency etc you have to handle that on your own.

In the future I may extend this API to fill the gaps.

Showcase of what you can achieve

Example code

try
{
    BufferedImage img = ImageIO.read(new File(getDataFolder() + File.separator + "test.png"));

    CustomCardRenderer renderer = new CustomCardRenderer(player, false);
    renderer.start();

    for (int x = 0; x < 128; x++)
        for (int y = 0; y < 128; y++)
            renderer.setPixel(x, y, new Color(img.getRGB(x, y)));

    Bukkit.getScheduler().runTaskLater(this, () -> {
        renderer.stop();
    }, 20L * 5);
}
catch (IOException e)
{
    //error
}

Last updated

Was this helpful?