MissingTextureAtlasSprite .java

net.minecraft.client.renderer.texture.MissingTextureAtlasSprite (class, 46 lines): members: MISSING_TEXTURE_LOCATION, MISSING_IMAGE_HEIGHT, getLocation.

net.minecraft.client.renderer.textureclass46 linesclient1.4 KB

API Surface (4)

NativeImage generateMissingImage()
NativeImage generateMissingImage(final int width, final int height)
SpriteContents create()
Identifier getLocation()

Fields & Constants (4)

MISSING_IMAGE_WIDTH
MISSING_IMAGE_HEIGHT
MISSING_TEXTURE_NAME
MISSING_TEXTURE_LOCATION

String literals (1)

"missingno"

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

MissingTextureAtlasSprite.java46 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer.texture;
2
3
import com.mojang.blaze3d.platform.NativeImage;
4
import net.fabricmc.api.EnvType;
5
import net.fabricmc.api.Environment;
6
import net.minecraft.client.resources.metadata.animation.FrameSize;
7
import net.minecraft.resources.Identifier;
8
9
@Environment(EnvType.CLIENT)
10
public final class MissingTextureAtlasSprite {
11
	private static final int MISSING_IMAGE_WIDTH = 16;
12
	private static final int MISSING_IMAGE_HEIGHT = 16;
13
	private static final String MISSING_TEXTURE_NAME = "missingno";
14
	private static final Identifier MISSING_TEXTURE_LOCATION = Identifier.withDefaultNamespace("missingno");
15
16
	public static NativeImage generateMissingImage() {
17
		return generateMissingImage(16, 16);
18
	}
19
20
	public static NativeImage generateMissingImage(final int width, final int height) {
21
		NativeImage result = new NativeImage(width, height, false);
22
		int pink = -524040;
23
24
		for (int y = 0; y < height; y++) {
25
			for (int x = 0; x < width; x++) {
26
				if (y < height / 2 ^ x < width / 2) {
27
					result.setPixel(x, y, -524040);
28
				} else {
29
					result.setPixel(x, y, -16777216);
30
				}
31
			}
32
		}
33
34
		return result;
35
	}
36
37
	public static SpriteContents create() {
38
		NativeImage contents = generateMissingImage(16, 16);
39
		return new SpriteContents(MISSING_TEXTURE_LOCATION, new FrameSize(16, 16), contents);
40
	}
41
42
	public static Identifier getLocation() {
43
		return MISSING_TEXTURE_LOCATION;
44
	}
45
}
46

Decompiled Minecraft 26.3 source of MissingTextureAtlasSprite (net/minecraft/client/renderer/texture/MissingTextureAtlasSprite.java) with Mojang official mappings, stored verbatim on the site.