public record Sum(HolderSet<ContextIntProvider> inputs) implements ContextIntProvider, AggregateProvider<ContextIntProvider> {
10
public static final MapCodec<Sum> MAP_CODEC = AggregateProvider.mapCodec(ContextIntProviders.LIST_CODEC, Sum::new);
11
12
@Override
13
public MapCodec<Sum> codec() {
14
return MAP_CODEC;
15
}
16
17
@Override
18
public int getIntUnsafe(final LootContext context) {
19
long value = 0L;
20
21
for (Holder<ContextIntProvider> input : this.inputs()) {
22
value += input.value().getIntUnsafe(context);
23
}
24
25
return ContextIntProvider.longToIntSafe(value);
26
}
27
}
28
Decompiled Minecraft 26.3 source of Sum (net/minecraft/world/level/storage/loot/providers/number/ints/Sum.java) with Mojang official mappings, stored verbatim on the site.