A Python & Java system to auto-generate personalized 'One Piece' style bounty posters from player data and display them in-game.
Python | Java | Denizen | Pillow | Web API
This system was created to increase player immersion and motivation in Pirate-Era. It gives players a personal incentive to increase their in-game bounty to have their own unique poster displayed. The system works via a Java plugin that uses Minecraft maps to display images. This plugin sends a web request to a custom Python tool, passing the player's UUID and bounty amount. The Python tool then uses Pillow to composite the player's skin and data onto a poster template, which is sent back and rendered in-game.
Developed a Python web service using Pillow to dynamically generate a ‘One Piece’ style bounty poster from a player’s UUID and bounty amount.
Wrote the image processing logic to fetch the player’s skin and composite it onto a poster template along with the dynamic bounty text.
Created a Java plugin that utilizes Minecraft maps as a canvas to render custom images in-game.
Engineered the Java plugin to send a web request to the Python backend, retrieve the generated image, and display it on a map item.
public class MapImageRenderer extends MapRenderer {
private BufferedImage image;
// Version of the constructor for a image file
public MapImageRenderer(File imageFile){
try {
this.image = ImageIO.read(imageFile);
// Automatically resize the image to fit the map if needed
if (this.image != null && this.image.getWidth() != 128 && this.image.getHeight() != 128) {
this.image = resizeImage(image, 128, 128);
}
} catch (IOException e) {
this.image = null;
}
}
// Version of the constructor for a buffered image (less safe)
public MapImageRenderer(BufferedImage imageFile){
this.image = imageFile;
// Automatically resize the image to fit the map if needed
if (this.image != null && this.image.getWidth() != 128 && this.image.getHeight() != 128) {
this.image = resizeImage(image, 128, 128);
}
}
// The renderer of this renderer, this actually renders onto the map. So in this case an image
@Override
public void render(MapView mapView, MapCanvas mapCanvas, Player player) {
// Draw the image onto the canvas, the image has to exist because otherwise this is not called upon
if(image != null){
mapCanvas.drawImage(0, 0, image);
}
}
}