forked from NucleoidMC/fantasy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
61 additions
and
180 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
174 changes: 0 additions & 174 deletions
174
src/main/java/xyz/nucleoid/fantasy/util/FilteredRegistry.java
This file was deleted.
Oops, something went wrong.
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
41 changes: 41 additions & 0 deletions
41
src/main/java/xyz/nucleoid/fantasy/util/TransientChunkGenerator.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,41 @@ | ||
package xyz.nucleoid.fantasy.util; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import net.minecraft.registry.RegistryOps; | ||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.world.biome.Biome; | ||
import net.minecraft.world.biome.BiomeKeys; | ||
import net.minecraft.world.biome.GenerationSettings; | ||
import net.minecraft.world.biome.source.BiomeSource; | ||
import net.minecraft.world.gen.chunk.ChunkGenerator; | ||
import xyz.nucleoid.fantasy.RuntimeWorldConfig; | ||
|
||
import java.util.function.Function; | ||
|
||
/** | ||
* A {@link ChunkGenerator} instance that does not know how to be, and does not care to be serialized. | ||
* This is particularly useful when creating a temporary world with Fantasy. | ||
* <p> | ||
* If serialized, however, it will be loaded as a {@link VoidChunkGenerator void world}. | ||
* | ||
* @see xyz.nucleoid.fantasy.Fantasy#openTemporaryWorld(RuntimeWorldConfig) | ||
*/ | ||
public abstract class TransientChunkGenerator extends ChunkGenerator { | ||
public static final MapCodec<? extends ChunkGenerator> CODEC = RecordCodecBuilder.mapCodec(i -> i.group( | ||
RegistryOps.getEntryCodec(BiomeKeys.THE_VOID) | ||
).apply(i, VoidChunkGenerator::new)); | ||
|
||
public TransientChunkGenerator(BiomeSource biomeSource) { | ||
super(biomeSource); | ||
} | ||
|
||
public TransientChunkGenerator(BiomeSource biomeSource, Function<RegistryEntry<Biome>, GenerationSettings> generationSettingsGetter) { | ||
super(biomeSource, generationSettingsGetter); | ||
} | ||
|
||
@Override | ||
protected final MapCodec<? extends ChunkGenerator> getCodec() { | ||
return CODEC; | ||
} | ||
} |
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