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.
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.
- Input: A byte array (
byte[]) representing the player's full skin (in RGBA format). - Output: A byte array (
byte[]) representing the PNG image of the extracted face.
byte[] skinData = ... // Load skin data (RGBA)
byte[] facePng = FaceImageMC.extractFaceAsPNG(skinData);
// Save or use the resulting PNGNukkit:
// 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();
}
}