ScratchIt
English
English
  • 👋🏻Welcome
  • ⚙️First install
  • 📄Online Config Editor
  • 📖Configurations
    • Permissions
    • Card
      • How to create a card
      • Icons locations
      • Animations
      • Cooldowns
      • Cancel usage
    • Loots
    • Cards example images
  • Compatibility with other plugins
    • WorldGuard
  • Minecraft versions compatibility
  • 📒Support
    • 🐞Report a bug
    • 📕Ask for help
  • Developers
    • ☕️Java API
      • Basic API
      • CustomCardRenderer
Powered by GitBook
On this page
  • What is a CustomCardRenderer?
  • Showcase of what you can achieve
  • Example code

Was this helpful?

  1. Developers
  2. ☕️Java API

CustomCardRenderer

PreviousBasic API

Last updated 4 years ago

Was this helpful?

This is not for newbie developers.

⚠️Please don't ask for support if you don't know how to use BufferedImage and Color classes.

Keep in mind that you have to handle all the stuff manually and this is limited compared to Spigot API. The only advantage of using this is that it's not laggy like Spigot API as this is only packet based.

Use this class only if you really need to.

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 .

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
}

BufferedImage