Compostable .java

net.minecraft.world.item.component.Compostable (record): members: layers, STREAM_CODEC, CODEC. strings: "layers". imports: ResolvableInt, ByteBuf.

net.minecraft.world.item.componentrecord21 linescommon953 B

API Surface (1)

record Compostable(ResolvableInt layers)

Fields & Constants (2)

CODEC
STREAM_CODEC

String literals (1)

"layers"

Code Graph: Dependencies (4)

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

Full Source

Compostable.java21 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.item.component;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import io.netty.buffer.ByteBuf;
6
import net.minecraft.network.codec.StreamCodec;
7
import net.minecraft.resources.ResourceKey;
8
import net.minecraft.world.level.storage.loot.providers.number.ints.ContextIntProvider;
9
import net.minecraft.world.level.storage.loot.providers.number.ints.ResolvableInt;
10
11
public record Compostable(ResolvableInt layers) {
12
	public static final Codec<Compostable> CODEC = RecordCodecBuilder.create(
13
		i -> i.group(ResolvableInt.CODEC.fieldOf("layers").forGetter(Compostable::layers)).apply(i, Compostable::new)
14
	);
15
	public static final StreamCodec<ByteBuf, Compostable> STREAM_CODEC = StreamCodec.composite(ResolvableInt.STREAM_CODEC, Compostable::layers, Compostable::new);
16
17
	public Compostable(final ResourceKey<ContextIntProvider> layers) {
18
		this(ResolvableInt.fromKey(layers));
19
	}
20
}
21

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