FurnaceResultSlot .java

net.minecraft.world.inventory.FurnaceResultSlot (class): members: removeCount, checkTakeAchievements, onQuickCraft, onTake, mayPlace, remove, player.

net.minecraft.world.inventoryclass54 linescommonextends Slot1.5 KB

API Surface (5)

boolean mayPlace(final ItemStack itemStack)
ItemStack remove(final int amount)
void onTake(final Player player, final ItemStack carried)
void onQuickCraft(final ItemStack picked, final int count)
void checkTakeAchievements(final ItemStack carried)

Fields & Constants (2)

player
removeCount

Code Graph: Dependencies (6)

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

Full Source

FurnaceResultSlot.java54 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.inventory;
2
3
import net.minecraft.server.level.ServerPlayer;
4
import net.minecraft.world.Container;
5
import net.minecraft.world.entity.player.Player;
6
import net.minecraft.world.item.ItemStack;
7
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
8
9
public class FurnaceResultSlot extends Slot {
10
	private final Player player;
11
	private int removeCount;
12
13
	public FurnaceResultSlot(final Player player, final Container container, final int slot, final int x, final int y) {
14
		super(container, slot, x, y);
15
		this.player = player;
16
	}
17
18
	@Override
19
	public boolean mayPlace(final ItemStack itemStack) {
20
		return false;
21
	}
22
23
	@Override
24
	public ItemStack remove(final int amount) {
25
		if (this.hasItem()) {
26
			this.removeCount = this.removeCount + Math.min(amount, this.getItem().getCount());
27
		}
28
29
		return super.remove(amount);
30
	}
31
32
	@Override
33
	public void onTake(final Player player, final ItemStack carried) {
34
		this.checkTakeAchievements(carried);
35
		super.onTake(player, carried);
36
	}
37
38
	@Override
39
	protected void onQuickCraft(final ItemStack picked, final int count) {
40
		this.removeCount += count;
41
		this.checkTakeAchievements(picked);
42
	}
43
44
	@Override
45
	protected void checkTakeAchievements(final ItemStack carried) {
46
		carried.onCraftedBy(this.player, this.removeCount);
47
		if (this.player instanceof ServerPlayer serverPlayer && this.container instanceof AbstractFurnaceBlockEntity abstractFurnaceBlockEntity) {
48
			abstractFurnaceBlockEntity.awardUsedRecipesAndPopExperience(serverPlayer);
49
		}
50
51
		this.removeCount = 0;
52
	}
53
}
54

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