Understanding the shader
Control Pixels
What are these colored pixels you might be wondering??
The map needs these colored pixels to know wether to render the map on top right or left, or don't render at all but in the player's hands.
These four colored pixels works as a unique passcode due to their position and color combination, its nature makes it conflict-proof and the rendering will be always as expected!

As you see, the map is rendered on top right if it finds a combination of the following colors at those specific pre-determined points: BLUE - YELLOW - RED - GREEN
And on top left if it sees the other colors.
Pre-determined colors
You'll be mainly editing this shader file, in which you can set these colors at MAIN_RIGHT_COLORS and MAIN_LEFT_COLORS.
You can simply edit the RGB values in the brackets.
// Order is top left, top right, bottom right, bottom left
const ivec3[] MAIN_RIGHT_COLORS = ivec3[](
ivec3(135, 0, 0),
ivec3(135, 0, 0),
ivec3(135, 0, 0),
ivec3(135, 0, 0)
);
const ivec3[] MAIN_LEFT_COLORS = ivec3[](
ivec3(84, 84, 135),
ivec3(84, 84, 135),
ivec3(84, 84, 135),
ivec3(84, 84, 135)
);
File path: shaders/core/rendertype_text.vsh
Editing the map's properties
We came up with a pretty decent default configuration, we suggest you to not change it unless you really need to due to other huds being displayed!
const float MAP_SIZE = 0.3;
// Size of the map. Percentage of the height of the screen (default: 30%)
const float MARGIN = 0.05;
// The width of the margin around the map. Percentage of the height of the screen (default: 2%)
const float FRAME_WIDTH = 0.04;
// The width of the frame around the map. Percentage of the height of the screen (default: 1%)
File path: shaders/core/rendertype_text.vsh (same as before)
Handling the map's frame
Frames follows the similar concept of the pixel control, but this time we are putting the control pixel in the centre.

const ivec2 FRAME_ID_PIXEL = ivec2(64, 64);
const ivec3 FRAME_COLOR_RIGHT = ivec3(180, 0, 0);
const ivec3 FRAME_COLOR_LEFT = ivec3(220, 0, 0);
File path: shaders/core/rendertype_text.vsh (same as before)
The FRAME_ID_PIXEL tells Minecraft where to check for the red blob, essentially it checks for the position of the pixel control, in this case, in the middle.
The FRAME_COLOR_RIGHT sets the color of the pixel control that will render the frame on the right part.
The FRAME_COLOR_LEFT same thing, but for left.
Last updated