AttributeTypes .java

net.minecraft.world.attribute.AttributeTypes (interface, 69 lines): members: MOB_SPAWN_SETTINGS, ANGLE_DEGREES, ARGB_COLOR, TRI_STATE, INTEGER, MOON_PHASE.

net.minecraft.world.attributeinterface69 linescommon3.6 KB

API Surface (0)

No public/protected methods detected (fields or constants only).

Fields & Constants (16)

BOOLEAN
TRI_STATE
FLOAT
ANGLE_DEGREES
RGB_COLOR
ARGB_COLOR
INTEGER
MOON_PHASE
ACTIVITY
BED_RULE
PARTICLE
AMBIENT_PARTICLES
BACKGROUND_MUSIC
AMBIENT_SOUNDS
MOB_SPAWN_SETTINGS
CODEC

String literals (15)

"boolean"
"tri_state"
"float"
"angle_degrees"
"rgb_color"
"argb_color"
"integer"
"moon_phase"
"activity"
"bed_rule"
"particle"
"ambient_particles"
"background_music"
"ambient_sounds"
"mob_spawn_settings"

Full Source

AttributeTypes.java69 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.attribute;
2
3
import com.mojang.serialization.Codec;
4
import java.util.List;
5
import net.minecraft.core.Registry;
6
import net.minecraft.core.particles.ParticleOptions;
7
import net.minecraft.core.particles.ParticleTypes;
8
import net.minecraft.core.registries.BuiltInRegistries;
9
import net.minecraft.resources.Identifier;
10
import net.minecraft.util.ExtraCodecs;
11
import net.minecraft.util.TriState;
12
import net.minecraft.world.attribute.modifier.AttributeModifier;
13
import net.minecraft.world.entity.schedule.Activity;
14
import net.minecraft.world.level.MoonPhase;
15
import net.minecraft.world.level.biome.MobSpawnSettings;
16
import org.joml.Vector3fc;
17
import org.joml.Vector4fc;
18
19
public interface AttributeTypes {
20
	AttributeType<Boolean> BOOLEAN = register("boolean", AttributeType.ofNotInterpolated(Codec.BOOL, AttributeModifier.BOOLEAN_LIBRARY));
21
	AttributeType<TriState> TRI_STATE = register("tri_state", AttributeType.ofNotInterpolated(TriState.CODEC));
22
	AttributeType<Float> FLOAT = register(
23
		"float", AttributeType.ofInterpolated(Codec.FLOAT, AttributeModifier.FLOAT_LIBRARY, LerpFunction.ofFloat(), LerpFunction.ofFloat(), value -> value, null)
24
	);
25
	AttributeType<Float> ANGLE_DEGREES = register(
26
		"angle_degrees",
27
		AttributeType.ofInterpolated(Codec.FLOAT, AttributeModifier.FLOAT_LIBRARY, LerpFunction.ofFloat(), LerpFunction.ofDegrees(90.0F), value -> value, null)
28
	);
29
	AttributeType<Vector3fc> RGB_COLOR = register(
30
		"rgb_color", AttributeType.ofInterpolated(ExtraCodecs.STRING_RGB_VEC3_COLOR, AttributeModifier.RGB_COLOR_LIBRARY, LerpFunction.ofColorVec3())
31
	);
32
	AttributeType<Vector4fc> ARGB_COLOR = register(
33
		"argb_color", AttributeType.ofInterpolated(ExtraCodecs.STRING_ARGB_VEC4_COLOR, AttributeModifier.ARGB_COLOR_LIBRARY, LerpFunction.ofColorVec4())
34
	);
35
	AttributeType<Integer> INTEGER = register(
36
		"integer",
37
		AttributeType.ofInterpolated(
38
			Codec.INT, AttributeModifier.INTEGER_LIBRARY, LerpFunction.ofInteger(), LerpFunction.ofInteger(), value -> value.intValue(), value -> value
39
		)
40
	);
41
	AttributeType<MoonPhase> MOON_PHASE = register("moon_phase", AttributeType.ofNotInterpolated(MoonPhase.CODEC));
42
	AttributeType<Activity> ACTIVITY = register("activity", AttributeType.ofNotInterpolated(BuiltInRegistries.ACTIVITY.byNameCodec()));
43
	AttributeType<BedRule> BED_RULE = register("bed_rule", AttributeType.ofNotInterpolated(BedRule.CODEC));
44
	AttributeType<ParticleOptions> PARTICLE = register("particle", AttributeType.ofNotInterpolated(ParticleTypes.CODEC));
45
	AttributeType<List<AmbientParticle>> AMBIENT_PARTICLES = register(
46
		"ambient_particles",
47
		AttributeType.ofInterpolated(
48
			AmbientParticle.CODEC.listOf(),
49
			AttributeModifier.listLibrary(),
50
			LerpFunction.ofListCrossFade((p, alpha) -> new AmbientParticle(p.particle(), p.probability() * alpha))
51
		)
52
	);
53
	AttributeType<BackgroundMusic> BACKGROUND_MUSIC = register("background_music", AttributeType.ofNotInterpolated(BackgroundMusic.CODEC));
54
	AttributeType<AmbientSounds> AMBIENT_SOUNDS = register("ambient_sounds", AttributeType.ofNotInterpolated(AmbientSounds.CODEC));
55
	AttributeType<MobSpawnSettings> MOB_SPAWN_SETTINGS = register(
56
		"mob_spawn_settings", AttributeType.ofNotInterpolated(MobSpawnSettings.CODEC, AttributeModifier.MOB_SPAWN_SETTINGS_LIBRARY)
57
	);
58
	Codec<AttributeType<?>> CODEC = BuiltInRegistries.ATTRIBUTE_TYPE.byNameCodec();
59
60
	static AttributeType<?> bootstrap(final Registry<AttributeType<?>> registry) {
61
		return BOOLEAN;
62
	}
63
64
	static <Value> AttributeType<Value> register(final String name, final AttributeType<Value> type) {
65
		Registry.register(BuiltInRegistries.ATTRIBUTE_TYPE, Identifier.withDefaultNamespace(name), type);
66
		return type;
67
	}
68
}
69

Decompiled Minecraft 26.3 source of AttributeTypes (net/minecraft/world/attribute/AttributeTypes.java) with Mojang official mappings, stored verbatim on the site.