File size: 1,233 Bytes
d46f4a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package net.minecraft.util.datafix.fixes;

import com.mojang.datafixers.DSL;
import com.mojang.datafixers.DataFix;
import com.mojang.datafixers.OpticFinder;
import com.mojang.datafixers.TypeRewriteRule;
import com.mojang.datafixers.Typed;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.datafixers.types.Type;
import com.mojang.serialization.Dynamic;

public class ChunkDeleteLightFix extends DataFix {
    public ChunkDeleteLightFix(Schema p_284990_) {
        super(p_284990_, false);
    }

    @Override
    protected TypeRewriteRule makeRule() {
        Type<?> type = this.getInputSchema().getType(References.CHUNK);
        OpticFinder<?> opticfinder = type.findField("sections");
        return this.fixTypeEverywhereTyped(
            "ChunkDeleteLightFix for " + this.getOutputSchema().getVersionKey(),
            type,
            p_285335_ -> {
                p_285335_ = p_285335_.update(DSL.remainderFinder(), p_284993_ -> p_284993_.remove("isLightOn"));
                return p_285335_.updateTyped(
                    opticfinder, p_285501_ -> p_285501_.update(DSL.remainderFinder(), p_285474_ -> p_285474_.remove("BlockLight").remove("SkyLight"))
                );
            }
        );
    }
}