ServerItemCooldowns .java

net.minecraft.world.item.ServerItemCooldowns (class): members: onCooldownStarted, onCooldownEnded, player. imports: ClientboundCooldownPacket, Identifier.

net.minecraft.world.itemclass26 linescommonextends ItemCooldowns820 B

API Surface (2)

void onCooldownStarted(final Identifier cooldownGroup, final int duration)
void onCooldownEnded(final Identifier cooldownGroup)

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

ServerItemCooldowns.java26 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.item;
2
3
import net.minecraft.network.protocol.game.ClientboundCooldownPacket;
4
import net.minecraft.resources.Identifier;
5
import net.minecraft.server.level.ServerPlayer;
6
7
public class ServerItemCooldowns extends ItemCooldowns {
8
	private final ServerPlayer player;
9
10
	public ServerItemCooldowns(final ServerPlayer player) {
11
		this.player = player;
12
	}
13
14
	@Override
15
	protected void onCooldownStarted(final Identifier cooldownGroup, final int duration) {
16
		super.onCooldownStarted(cooldownGroup, duration);
17
		this.player.connection.send(new ClientboundCooldownPacket(cooldownGroup, duration));
18
	}
19
20
	@Override
21
	protected void onCooldownEnded(final Identifier cooldownGroup) {
22
		super.onCooldownEnded(cooldownGroup);
23
		this.player.connection.send(new ClientboundCooldownPacket(cooldownGroup, 0));
24
	}
25
}
26

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