Skip to content

Creadores-Program/FaceImageMC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FaceImageMC

This project provides a Java utility to extract the player's face image from a Minecraft Bedrock skin, designed for use on Nukkit servers or Java servers by MCBE. The code is based on the FaceLoginNK plugin.

What does it do?

The class org.CreadoresProgram.FaceImageMC.FaceImageMC contains a static method extractFaceAsPNG that takes the binary data of a Minecraft Bedrock skin and returns a PNG image (as bytes) of the player's face.

Usage

  1. Input: A byte array (byte[]) representing the player's full skin (in RGBA format).
  2. Output: A byte array (byte[]) representing the PNG image of the extracted face.

Usage Example

byte[] skinData = ... // Load skin data (RGBA)
byte[] facePng = FaceImageMC.extractFaceAsPNG(skinData);
// Save or use the resulting PNG

Nukkit:

// Example usage in a Nukkit plugin
import org.CreadoresProgram.FaceImageMC.FaceImageMC;
import cn.nukkit.Player;

public void onSomeEvent(Player player) {
    // Get the player's skin data (as byte[])
    byte[] skinData = player.getSkin().getSkinData().data;
    // Extract the PNG face image
    byte[] facePng = FaceImageNK.extractFaceAsPNG(skinData);

    // Now you can save, send, or use the PNG as needed
    // For example, save it to disk:
    try (java.io.FileOutputStream fos = new java.io.FileOutputStream("face_" + player.getName() + ".png")) {
        fos.write(facePng);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

About

This project provides a Java utility to extract the player's face image from a Minecraft Bedrock skin, designed for use on Nukkit servers or Java servers by MCBE. The code is based on the FaceLoginNK plugin.

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages