-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a leve.keep key to the settings.
- Loading branch information
1 parent
eb94eeb
commit 42d8f14
Showing
6 changed files
with
88 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/io/github/noeppi_noeppi/mods/bongo/data/settings/KeptLevelData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.github.noeppi_noeppi.mods.bongo.data.settings; | ||
|
||
import com.mojang.datafixers.util.Either; | ||
import com.mojang.serialization.Codec; | ||
import net.minecraft.util.Unit; | ||
import org.moddingx.libx.codec.MoreCodecs; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.function.Function; | ||
|
||
public enum KeptLevelData { | ||
game_mode, | ||
equipment, | ||
advancements, | ||
experience, | ||
statistics, | ||
time, | ||
weather, | ||
wandering_trader_time; | ||
|
||
public static final Set<KeptLevelData> ALL = Set.of(values()); | ||
|
||
public static final Codec<Set<KeptLevelData>> CODEC = Codec.either( | ||
MoreCodecs.fixed("all"), | ||
MoreCodecs.enumCodec(KeptLevelData.class).listOf().xmap(Set::copyOf, List::copyOf) | ||
).xmap(either -> either.map(unit -> ALL, Function.identity()), set -> ALL.equals(set) ? Either.left(Unit.INSTANCE) : Either.right(set)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters