-
Notifications
You must be signed in to change notification settings - Fork 11
Custom HUDs
Lucraft edited this page Jan 17, 2023
·
1 revision
You can also use Palladium with KubeJS to make your own HUD. Simply register it in a client-side script like here:
// Event for registering HUDs
PalladiumEvents.registerGuiOverlays((event) => {
event.register(
// ID for the overlay
'test/broken_blocks_counter',
// Function for rendering
(minecraft, gui, poseStack, partialTick, screenWidth, screenHeight) => {
// Drawing text. Parameters: PoseStack, Text (as text component), X, Y, Color
guiUtil.drawString(poseStack, Component.string("Broken Blocks: " + brokenBlocks), 10, 10, 0xffffff);
// Drawing a piece of a texture
// Parameters: Texture, Gui, PoseStack, x, y, U on the texture, V on the texture, width, height
guiUtil.blit('test:textures/gui/my_cool_texture.png', gui, poseStack, 10, 20, 0, 10, 182, 5);
});
});
If you use the blit
method, your texture file must be 256x256 pixels big. If you choose to have your own dimensions, simply add to more arguments add the end as the texture width & height.