Mining Away
I don’t know what to mine!
Summary
I started a new project. It’s a fabric mod on 1.20 that aims to replicate the ui and menus from the console editions of Minecraft. I used Minecraft: Wii-U Edition as a reference for the look and behaviour of different interfaces as I already had an emulator setup with dumped keys and the title installed. This had a major impact on my productivity as during my previous attempt at recreating the menu I had referenced the minecraft wiki for screenshots of the game which was less than ideal for screens like the options menu.
Titlescreen
I began by recreating the titlescreen to the best of my ability and gained some familiarity with exploring the decompiled classes and overriding methods and/or args to alter behaviour. This process was relatively easy and only really required me to insert an early return in the init function to prevent some widgets loading, replace the buttons with my own custom layout and alter a few textures. (Edition logo and button highlight).
Options Menus
I'm happy with the titlescreen for now so I began work on the options menu. This small sidequest allowed me to futher familiarise with some basic minecraft classes and during this exploration I managed to figure out how to import textures and use texture offsets to tile them. My 1st goal was to recreate a small widget that is constantly used for options menus as well as the ingame host options screens and pause menus. Below you can see the basic demo I got working and the code behind it. My next goal is to extend one of the default list classes or implement my own to allow this widget to parent others and handle navigating between them. This will also allow me to have it size appropriately based on the child count. (As seen in console edition).
public void drawBackground(DrawContext context, int len) {
context.drawTexture(BACKGROUND_TEXTURE, this.x, this.y, 0, 0, BACKGROUND_WIDTH, BACKGROUND_OFFSET, BACKGROUND_WIDTH, BACKGROUND_HEIGHT);
for (int count = 0; count < len; count++) {
context.drawTexture(BACKGROUND_TEXTURE, this.x, this.y + 16 * (count + 1), 0, 16, BACKGROUND_WIDTH, BACKGROUND_OFFSET, BACKGROUND_WIDTH, BACKGROUND_HEIGHT);
}
context.drawTexture(BACKGROUND_TEXTURE, this.x, this.y + 16 + (16 * len), 0, 32, BACKGROUND_WIDTH, BACKGROUND_OFFSET, BACKGROUND_WIDTH, BACKGROUND_HEIGHT);
}
Conclusion
I'm happy with the current progress so far and I have already planned further features and ideas. I have began getting controller support working using a 3rd party lib which also allows me to add button prompts to different menus and customize the bindings. My next plan is to get the controller options menu working and styled as it were on console.