ChunkLightRemoveFix .java

net.minecraft.util.datafix.fixes.ChunkLightRemoveFix (class): members: makeRule. strings: "isLightOn", "Level". imports: OpticFinder, Type, DataFix.

net.minecraft.util.datafix.fixesclass28 linescommonextends DataFix951 B

API Surface (1)

TypeRewriteRule makeRule()

String literals (2)

"Level"
"isLightOn"

Full Source

ChunkLightRemoveFix.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util.datafix.fixes;
2
3
import com.mojang.datafixers.DSL;
4
import com.mojang.datafixers.DataFix;
5
import com.mojang.datafixers.OpticFinder;
6
import com.mojang.datafixers.TypeRewriteRule;
7
import com.mojang.datafixers.schemas.Schema;
8
import com.mojang.datafixers.types.Type;
9
10
public class ChunkLightRemoveFix extends DataFix {
11
	public ChunkLightRemoveFix(final Schema schema, final boolean changesType) {
12
		super(schema, changesType);
13
	}
14
15
	@Override
16
	protected TypeRewriteRule makeRule() {
17
		Type<?> chunkType = this.getInputSchema().getType(References.CHUNK);
18
		Type<?> levelType = chunkType.findFieldType("Level");
19
		OpticFinder<?> levelF = DSL.fieldFinder("Level", levelType);
20
		return this.fixTypeEverywhereTyped(
21
			"ChunkLightRemoveFix",
22
			chunkType,
23
			this.getOutputSchema().getType(References.CHUNK),
24
			input -> input.updateTyped(levelF, level -> level.update(DSL.remainderFinder(), tag -> tag.remove("isLightOn")))
25
		);
26
	}
27
}
28

Decompiled Minecraft 26.3 source of ChunkLightRemoveFix (net/minecraft/util/datafix/fixes/ChunkLightRemoveFix.java) with Mojang official mappings, stored verbatim on the site.