MultiplyValue .java

net.minecraft.world.item.enchantment.effects.MultiplyValue (record): members: factor, process, codec, CODEC. strings: "factor". imports: LevelBasedValue.

net.minecraft.world.item.enchantment.effectsrecord23 linescommon806 B

Implements

API Surface (2)

float process(final int enchantmentLevel, final RandomSource random, final float inputValue)
MapCodec<MultiplyValue> codec()

Fields & Constants (1)

CODEC

String literals (1)

"factor"

Code Graph: Dependencies (3)

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

Full Source

MultiplyValue.java23 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.item.enchantment.effects;
2
3
import com.mojang.serialization.MapCodec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import net.minecraft.util.RandomSource;
6
import net.minecraft.world.item.enchantment.LevelBasedValue;
7
8
public record MultiplyValue(LevelBasedValue factor) implements EnchantmentValueEffect {
9
	public static final MapCodec<MultiplyValue> CODEC = RecordCodecBuilder.mapCodec(
10
		i -> i.group(LevelBasedValue.CODEC.fieldOf("factor").forGetter(MultiplyValue::factor)).apply(i, MultiplyValue::new)
11
	);
12
13
	@Override
14
	public float process(final int enchantmentLevel, final RandomSource random, final float inputValue) {
15
		return inputValue * this.factor.calculate(enchantmentLevel);
16
	}
17
18
	@Override
19
	public MapCodec<MultiplyValue> codec() {
20
		return CODEC;
21
	}
22
}
23

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