Moved FlatLevelPresets to BCLib and started WorldPresets

This commit is contained in:
Frank 2022-05-19 23:32:27 +02:00
parent e8dbbffa8e
commit 375eb09bb9
5 changed files with 63 additions and 8 deletions

View file

@ -0,0 +1,25 @@
package org.betterx.bclib.presets;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.FlatLevelGeneratorPresetTags;
import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPreset;
import org.betterx.bclib.api.tag.TagAPI;
import org.betterx.bclib.api.tag.TagType;
public class FlatLevelPresets {
public static TagType.Simple<FlatLevelGeneratorPreset> FLAT_LEVEL_PRESETS =
TagAPI.registerType(Registry.FLAT_LEVEL_GENERATOR_PRESET_REGISTRY,
"tags/worldgen/flat_level_generator_preset",
(b) -> null);
public static ResourceKey<FlatLevelGeneratorPreset> register(ResourceLocation loc) {
ResourceKey<FlatLevelGeneratorPreset> key = ResourceKey.create(Registry.FLAT_LEVEL_GENERATOR_PRESET_REGISTRY,
loc);
FLAT_LEVEL_PRESETS.addUntyped(FlatLevelGeneratorPresetTags.VISIBLE, key.location());
return key;
}
}

View file

@ -0,0 +1,29 @@
package org.betterx.bclib.presets;
import net.minecraft.core.Registry;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.WorldPresetTags;
import net.minecraft.world.level.levelgen.presets.WorldPreset;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.api.tag.TagAPI;
import org.betterx.bclib.api.tag.TagType;
public class WorldPresets {
public static TagType.Simple<WorldPreset> WORLD_PRESETS =
TagAPI.registerType(BuiltinRegistries.WORLD_PRESET, "tag/worldgen/world_preset");
public static ResourceKey<WorldPreset> BCL_WORLD = register(BCLib.makeID("normal"));
public static ResourceKey<WorldPreset> register(ResourceLocation loc) {
ResourceKey<WorldPreset> key = ResourceKey.create(Registry.WORLD_PRESET_REGISTRY,
loc);
WORLD_PRESETS.addUntyped(WorldPresetTags.NORMAL, key.location());
return key;
}
public static void register() {
}
}