WrittenBookItem .java

net.minecraft.world.item.WrittenBookItem (class, 22 lines): extends Item. members: use. imports: Stats, InteractionHand, InteractionResult.

net.minecraft.world.itemclass22 linescommonextends Item668 B

API Surface (1)

InteractionResult use(final Level level, final Player player, final InteractionHand hand)

Code Graph: Dependencies (6)

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

Full Source

WrittenBookItem.java22 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.item;
2
3
import net.minecraft.stats.Stats;
4
import net.minecraft.world.InteractionHand;
5
import net.minecraft.world.InteractionResult;
6
import net.minecraft.world.entity.player.Player;
7
import net.minecraft.world.level.Level;
8
9
public class WrittenBookItem extends Item {
10
	public WrittenBookItem(final Item.Properties properties) {
11
		super(properties);
12
	}
13
14
	@Override
15
	public InteractionResult use(final Level level, final Player player, final InteractionHand hand) {
16
		ItemStack itemStack = player.getItemInHand(hand);
17
		player.openItemGui(itemStack, hand);
18
		player.awardStat(Stats.ITEM_USED.get(this));
19
		return InteractionResult.SUCCESS;
20
	}
21
}
22

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