mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
better codec names
This commit is contained in:
@@ -48,7 +48,7 @@ public class FabricEntryPoint implements ModInitializer {
|
|||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
logger.info("Initializing Terra Fabric mod...");
|
logger.info("Initializing Terra Fabric mod...");
|
||||||
// register the things
|
// register the things
|
||||||
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), Codecs.CODEC);
|
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), Codecs.FABRIC_CHUNK_GENERATOR_WRAPPER);
|
||||||
Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE);
|
Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE);
|
||||||
|
|
||||||
FabricServerCommandManager<CommandSender> manager = new FabricServerCommandManager<>(
|
FabricServerCommandManager<CommandSender> manager = new FabricServerCommandManager<>(
|
||||||
|
|||||||
@@ -12,13 +12,12 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|||||||
import net.minecraft.structure.StructureSet;
|
import net.minecraft.structure.StructureSet;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.util.registry.RegistryCodecs;
|
import net.minecraft.util.registry.RegistryCodecs;
|
||||||
import net.minecraft.util.registry.RegistryFixedCodec;
|
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||||
|
|
||||||
|
|
||||||
public final class Codecs {
|
public final class Codecs {
|
||||||
public static final Codec<RegistryKey> REGISTRY_KEY = RecordCodecBuilder
|
public static final Codec<RegistryKey> TERRA_REGISTRY_KEY = RecordCodecBuilder
|
||||||
.create(registryKey -> registryKey.group(Codec.STRING.fieldOf("namespace")
|
.create(registryKey -> registryKey.group(Codec.STRING.fieldOf("namespace")
|
||||||
.forGetter(RegistryKey::getNamespace),
|
.forGetter(RegistryKey::getNamespace),
|
||||||
Codec.STRING.fieldOf("id")
|
Codec.STRING.fieldOf("id")
|
||||||
@@ -26,8 +25,8 @@ public final class Codecs {
|
|||||||
.apply(registryKey, registryKey.stable(RegistryKey::of)));
|
.apply(registryKey, registryKey.stable(RegistryKey::of)));
|
||||||
|
|
||||||
public static final Codec<ConfigPack> CONFIG_PACK = RecordCodecBuilder
|
public static final Codec<ConfigPack> CONFIG_PACK = RecordCodecBuilder
|
||||||
.create(config -> config.group(REGISTRY_KEY.fieldOf("pack")
|
.create(config -> config.group(TERRA_REGISTRY_KEY.fieldOf("pack")
|
||||||
.forGetter(ConfigPack::getRegistryKey))
|
.forGetter(ConfigPack::getRegistryKey))
|
||||||
.apply(config, config.stable(id -> FabricEntryPoint.getPlatform()
|
.apply(config, config.stable(id -> FabricEntryPoint.getPlatform()
|
||||||
.getConfigRegistry()
|
.getConfigRegistry()
|
||||||
.get(id)
|
.get(id)
|
||||||
@@ -45,7 +44,7 @@ public final class Codecs {
|
|||||||
.forGetter(TerraBiomeSource::getPack))
|
.forGetter(TerraBiomeSource::getPack))
|
||||||
.apply(instance, instance.stable(TerraBiomeSource::new)));
|
.apply(instance, instance.stable(TerraBiomeSource::new)));
|
||||||
|
|
||||||
public static final Codec<FabricChunkGeneratorWrapper> CODEC = RecordCodecBuilder.create(
|
public static final Codec<FabricChunkGeneratorWrapper> FABRIC_CHUNK_GENERATOR_WRAPPER = RecordCodecBuilder.create(
|
||||||
instance -> instance.group(
|
instance -> instance.group(
|
||||||
RegistryCodecs.dynamicRegistry(Registry.STRUCTURE_SET_KEY, Lifecycle.stable(), StructureSet.CODEC)
|
RegistryCodecs.dynamicRegistry(Registry.STRUCTURE_SET_KEY, Lifecycle.stable(), StructureSet.CODEC)
|
||||||
.fieldOf("structures")
|
.fieldOf("structures")
|
||||||
@@ -59,5 +58,5 @@ public final class Codecs {
|
|||||||
ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings")
|
ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings")
|
||||||
.forGetter(FabricChunkGeneratorWrapper::getSettings)
|
.forGetter(FabricChunkGeneratorWrapper::getSettings)
|
||||||
).apply(instance, instance.stable(FabricChunkGeneratorWrapper::new))
|
).apply(instance, instance.stable(FabricChunkGeneratorWrapper::new))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -48,7 +48,6 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.config.ConfigPack;
|
import com.dfsek.terra.api.config.ConfigPack;
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
@@ -93,7 +92,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Codec<? extends net.minecraft.world.gen.chunk.ChunkGenerator> getCodec() {
|
protected Codec<? extends net.minecraft.world.gen.chunk.ChunkGenerator> getCodec() {
|
||||||
return Codecs.CODEC;
|
return Codecs.FABRIC_CHUNK_GENERATOR_WRAPPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user