[TUTORIAL] How to create custom loading screen for dimension (Forge 1.18.2) (Custom code)

Started by TANC57 on

Topic category: User side tutorials

Last seen on 08:20, 1. May 2024
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] How to create custom loading screen for dimension (Forge 1.18.2) (Custom code)
Thu, 01/18/2024 - 13:44 (edited)

This is a quick tutorial on how you can create a custom loading screen that will appear when you teleport to a specific dimension (like the dirt block background in the game).


Step 1: Create a new overlay element

Create a new overlay element


Step 2: Add the texture of your block that you want to make the background (or another texture). This will help you navigate the code later.

Adding texture


Step 3: Change the overlay properties like this.

Overlay properties


Step 4: Add a display condition like this one. Of course, you can change the Nether to a different dimension, or even multiple dimensions.


Step 5: Lock the created overlay element using the lock button.


Step 6: Add this line to the already generated imports.

import net.minecraft.network.chat.TranslatableComponent;

Step 7: Find the two lines of code that describe your image and edit them as shown. By doing so, we scale your image to 32x32 and repeat it across the screen.

RenderSystem.setShaderTexture(0, new ResourceLocation("dw_test:textures/screens/random_texture.png")); Minecraft.getInstance().gui.blit(event.getPoseStack(), posX + -63, posY + -21, 0, 0, 16, 16, 16, 16);

V V V

RenderSystem.setShaderTexture(0, new ResourceLocation("dw_test:textures/screens/random_texture.png"));
Minecraft.getInstance().gui.blit(event.getPoseStack(), 0, 0, 0, 0, w, h, 32, 32);

Step 8: Add this line of code right below the previous two to display the centered "Download Terrain..." text that we overlap with our texture.

Minecraft.getInstance().gui.drawCenteredString(event.getPoseStack(), Minecraft.getInstance().font, new TranslatableComponent("multiplayer.downloadingTerrain"), w / 2, h / 2 - 50, -1);

Step 9: Save the locked element and test it in the game.

In my case, I get the following screen when I teleport to the Nether.


Here's how I created similar loading screens for the Distant Worlds mod, with a little bit of modification to the code shown.

Edited by TANC57 on Thu, 01/18/2024 - 13:44