ItemUseAnimation .java

net.minecraft.world.item.ItemUseAnimation (enum): members: NONE, EAT, DRINK, BLOCK, BOW, TRIDENT, CROSSBOW, SPYGLASS, TOOT_HORN, BRUSH, BUNDLE, SPEAR.

net.minecraft.world.itemenum55 linescommon1.6 KB

Implements

API Surface (3)

int getId()
String getSerializedName()
boolean hasCustomArmTransform()

Fields & Constants (6)

BY_ID
CODEC
STREAM_CODEC
id
name
customArmTransform

String literals (10)

"none"
"drink"
"block"
"trident"
"crossbow"
"spyglass"
"toot_horn"
"brush"
"bundle"
"spear"

Code Graph: Dependencies (4)

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

Full Source

ItemUseAnimation.java55 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.item;
2
3
import com.mojang.serialization.Codec;
4
import io.netty.buffer.ByteBuf;
5
import java.util.function.IntFunction;
6
import net.minecraft.network.codec.ByteBufCodecs;
7
import net.minecraft.network.codec.StreamCodec;
8
import net.minecraft.util.ByIdMap;
9
import net.minecraft.util.StringRepresentable;
10
11
public enum ItemUseAnimation implements StringRepresentable {
12
	NONE(0, "none"),
13
	EAT(1, "eat", true),
14
	DRINK(2, "drink", true),
15
	BLOCK(3, "block"),
16
	BOW(4, "bow"),
17
	TRIDENT(5, "trident"),
18
	CROSSBOW(6, "crossbow"),
19
	SPYGLASS(7, "spyglass"),
20
	TOOT_HORN(8, "toot_horn"),
21
	BRUSH(9, "brush"),
22
	BUNDLE(10, "bundle"),
23
	SPEAR(11, "spear", true);
24
25
	private static final IntFunction<ItemUseAnimation> BY_ID = ByIdMap.continuous(ItemUseAnimation::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO);
26
	public static final Codec<ItemUseAnimation> CODEC = StringRepresentable.fromEnum(ItemUseAnimation::values);
27
	public static final StreamCodec<ByteBuf, ItemUseAnimation> STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, ItemUseAnimation::getId);
28
	private final int id;
29
	private final String name;
30
	private final boolean customArmTransform;
31
32
	ItemUseAnimation(final int id, final String name) {
33
		this(id, name, false);
34
	}
35
36
	ItemUseAnimation(final int id, final String name, final boolean customArmTransform) {
37
		this.id = id;
38
		this.name = name;
39
		this.customArmTransform = customArmTransform;
40
	}
41
42
	public int getId() {
43
		return this.id;
44
	}
45
46
	@Override
47
	public String getSerializedName() {
48
		return this.name;
49
	}
50
51
	public boolean hasCustomArmTransform() {
52
		return this.customArmTransform;
53
	}
54
}
55

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