SingleEntryContainerBase .java

net.minecraft.world.level.storage.loot.entries.SingleEntryContainerBase (class, 37 lines): members: expandRaw, entry, createItemStack, condition, codec.

net.minecraft.world.level.storage.loot.entriesclass37 linescommonextends UniformContainerBase1.3 KB

API Surface (2)

void createItemStack(final Consumer<ItemStack> output, final LootContext context)
boolean expandRaw(final LootContext context, final Consumer<LootPoolEntry> output)

Fields & Constants (2)

entry
condition

Full Source

SingleEntryContainerBase.java37 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.storage.loot.entries;
2
3
import com.mojang.serialization.MapCodec;
4
import java.util.Optional;
5
import java.util.function.Consumer;
6
import net.minecraft.core.Holder;
7
import net.minecraft.world.item.ItemStack;
8
import net.minecraft.world.level.storage.loot.LootContext;
9
import net.minecraft.world.level.storage.loot.functions.LootItemFunction;
10
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
11
12
public abstract class SingleEntryContainerBase extends UniformContainerBase {
13
	private final LootPoolEntry entry = new UniformContainerBase.EntryBase() {
14
		@Override
15
		public void createItemStack(final Consumer<ItemStack> output, final LootContext context) {
16
			SingleEntryContainerBase.this.createItemStack(output, context);
17
		}
18
	};
19
20
	protected SingleEntryContainerBase(
21
		final int weight, final int quality, final Optional<Holder<LootItemCondition>> condition, final Optional<Holder<LootItemFunction>> modifier
22
	) {
23
		super(weight, quality, condition, modifier);
24
	}
25
26
	@Override
27
	public abstract MapCodec<? extends SingleEntryContainerBase> codec();
28
29
	protected abstract void createItemStack(Consumer<ItemStack> output, LootContext context);
30
31
	@Override
32
	public final boolean expandRaw(final LootContext context, final Consumer<LootPoolEntry> output) {
33
		output.accept(this.entry);
34
		return true;
35
	}
36
}
37

Decompiled Minecraft 26.3 source of SingleEntryContainerBase (net/minecraft/world/level/storage/loot/entries/SingleEntryContainerBase.java) with Mojang official mappings, stored verbatim on the site.