ParticleDescription .java

net.minecraft.client.particle.ParticleDescription (class): members: getTextures, fromJson, textures. strings: "textures", "texture". imports: Streams.

net.minecraft.client.particleclass38 linesclient1.1 KB

API Surface (2)

List<Identifier> getTextures()
ParticleDescription fromJson(final JsonObject data)

Fields & Constants (1)

textures

String literals (2)

"textures"
"texture"

Code Graph: Dependencies (2)

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

Full Source

ParticleDescription.java38 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.particle;
2
3
import com.google.common.collect.ImmutableList;
4
import com.google.common.collect.Streams;
5
import com.google.gson.JsonArray;
6
import com.google.gson.JsonObject;
7
import java.util.List;
8
import net.fabricmc.api.EnvType;
9
import net.fabricmc.api.Environment;
10
import net.minecraft.resources.Identifier;
11
import net.minecraft.util.GsonHelper;
12
13
@Environment(EnvType.CLIENT)
14
public class ParticleDescription {
15
	private final List<Identifier> textures;
16
17
	private ParticleDescription(final List<Identifier> textures) {
18
		this.textures = textures;
19
	}
20
21
	public List<Identifier> getTextures() {
22
		return this.textures;
23
	}
24
25
	public static ParticleDescription fromJson(final JsonObject data) {
26
		JsonArray texturesData = GsonHelper.getAsJsonArray(data, "textures", null);
27
		if (texturesData == null) {
28
			return new ParticleDescription(List.of());
29
		}
30
31
		List<Identifier> textures = Streams.stream(texturesData)
32
			.map(element -> GsonHelper.convertToString(element, "texture"))
33
			.map(Identifier::parse)
34
			.collect(ImmutableList.toImmutableList());
35
		return new ParticleDescription(textures);
36
	}
37
}
38

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