2025-11-24 22:52:51 +03:00

48 lines
1.6 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.mojang.datafixers.kinds.App
* com.mojang.datafixers.kinds.Applicative
* com.mojang.serialization.Codec
* com.mojang.serialization.codecs.RecordCodecBuilder
*/
package net.minecraft.advancements.criterion;
import com.mojang.datafixers.kinds.App;
import com.mojang.datafixers.kinds.Applicative;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.advancements.criterion.MinMaxBounds;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
public record LightPredicate(MinMaxBounds.Ints composite) {
public static final Codec<LightPredicate> CODEC = RecordCodecBuilder.create(i -> i.group((App)MinMaxBounds.Ints.CODEC.optionalFieldOf("light", (Object)MinMaxBounds.Ints.ANY).forGetter(LightPredicate::composite)).apply((Applicative)i, LightPredicate::new));
public boolean matches(ServerLevel level, BlockPos pos) {
if (!level.isLoaded(pos)) {
return false;
}
return this.composite.matches(level.getMaxLocalRawBrightness(pos));
}
public static class Builder {
private MinMaxBounds.Ints composite = MinMaxBounds.Ints.ANY;
public static Builder light() {
return new Builder();
}
public Builder setComposite(MinMaxBounds.Ints composite) {
this.composite = composite;
return this;
}
public LightPredicate build() {
return new LightPredicate(this.composite);
}
}
}