IsUsingItem .java

net.minecraft.client.renderer.item.properties.conditional.IsUsingItem (record, 28 lines): members: seed, get, MAP_CODEC, type. imports: ItemDisplayContext.

net.minecraft.client.renderer.item.properties.conditionalrecord28 linesclient969 B

Implements

API Surface (2)

boolean get(final ItemStack itemStack, final @Nullable ClientLevel level, final @Nullable LivingEntity owner, final int seed, final ItemDisplayContext displayContext)
MapCodec<IsUsingItem> type()

Fields & Constants (2)

MAP_CODEC
seed

Code Graph: Dependencies (5)

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

Full Source

IsUsingItem.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer.item.properties.conditional;
2
3
import com.mojang.serialization.MapCodec;
4
import net.fabricmc.api.EnvType;
5
import net.fabricmc.api.Environment;
6
import net.minecraft.client.multiplayer.ClientLevel;
7
import net.minecraft.world.entity.LivingEntity;
8
import net.minecraft.world.item.ItemDisplayContext;
9
import net.minecraft.world.item.ItemStack;
10
import org.jspecify.annotations.Nullable;
11
12
@Environment(EnvType.CLIENT)
13
public record IsUsingItem() implements ConditionalItemModelProperty {
14
	public static final MapCodec<IsUsingItem> MAP_CODEC = MapCodec.unit(new IsUsingItem());
15
16
	@Override
17
	public boolean get(
18
		final ItemStack itemStack, final @Nullable ClientLevel level, final @Nullable LivingEntity owner, final int seed, final ItemDisplayContext displayContext
19
	) {
20
		return owner == null ? false : owner.isUsingItem() && owner.getUseItem() == itemStack;
21
	}
22
23
	@Override
24
	public MapCodec<IsUsingItem> type() {
25
		return MAP_CODEC;
26
	}
27
}
28

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