Ignite .java

net.minecraft.world.item.enchantment.effects.Ignite (record, 26 lines): members: duration, apply, codec, CODEC. strings: "duration". imports: Entity, Vec3.

net.minecraft.world.item.enchantment.effectsrecord26 linescommon985 B

Implements

API Surface (2)

void apply(final ServerLevel serverLevel, final int enchantmentLevel, final EnchantedItemInUse item, final Entity entity, final Vec3 position)
MapCodec<Ignite> codec()

Fields & Constants (1)

CODEC

String literals (1)

"duration"

Code Graph: Dependencies (6)

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

Full Source

Ignite.java26 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.server.level.ServerLevel;
6
import net.minecraft.world.entity.Entity;
7
import net.minecraft.world.item.enchantment.EnchantedItemInUse;
8
import net.minecraft.world.item.enchantment.LevelBasedValue;
9
import net.minecraft.world.phys.Vec3;
10
11
public record Ignite(LevelBasedValue duration) implements EnchantmentEntityEffect {
12
	public static final MapCodec<Ignite> CODEC = RecordCodecBuilder.mapCodec(
13
		i -> i.group(LevelBasedValue.CODEC.fieldOf("duration").forGetter(e -> e.duration)).apply(i, Ignite::new)
14
	);
15
16
	@Override
17
	public void apply(final ServerLevel serverLevel, final int enchantmentLevel, final EnchantedItemInUse item, final Entity entity, final Vec3 position) {
18
		entity.igniteForSeconds(this.duration.calculate(enchantmentLevel));
19
	}
20
21
	@Override
22
	public MapCodec<Ignite> codec() {
23
		return CODEC;
24
	}
25
}
26

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