PlayerEquipment .java

net.minecraft.world.entity.player.PlayerEquipment (class): members: set, player, isEmpty, get. imports: EntityEquipment, EquipmentSlot, ItemStack.

net.minecraft.world.entity.playerclass29 linescommonextends EntityEquipment866 B

API Surface (3)

ItemStack set(final EquipmentSlot slot, final ItemStack itemStack)
ItemStack get(final EquipmentSlot slot)
boolean isEmpty()

Fields & Constants (1)

player

Code Graph: Dependencies (4)

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

Full Source

PlayerEquipment.java29 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.player;
2
3
import net.minecraft.world.entity.EntityEquipment;
4
import net.minecraft.world.entity.EquipmentSlot;
5
import net.minecraft.world.item.ItemStack;
6
7
public class PlayerEquipment extends EntityEquipment {
8
	private final Player player;
9
10
	public PlayerEquipment(final Player player) {
11
		this.player = player;
12
	}
13
14
	@Override
15
	public ItemStack set(final EquipmentSlot slot, final ItemStack itemStack) {
16
		return slot == EquipmentSlot.MAINHAND ? this.player.getInventory().setSelectedItem(itemStack) : super.set(slot, itemStack);
17
	}
18
19
	@Override
20
	public ItemStack get(final EquipmentSlot slot) {
21
		return slot == EquipmentSlot.MAINHAND ? this.player.getInventory().getSelectedItem() : super.get(slot);
22
	}
23
24
	@Override
25
	public boolean isEmpty() {
26
		return this.player.getInventory().getSelectedItem().isEmpty() && super.isEmpty();
27
	}
28
}
29

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