|
1 |
| -package raccoonman.reterraforged.data; |
2 |
| - |
3 |
| -import java.nio.file.Path; |
4 |
| -import java.util.concurrent.CompletableFuture; |
5 |
| - |
6 |
| -import net.minecraft.SharedConstants; |
7 |
| -import net.minecraft.core.HolderLookup; |
8 |
| -import net.minecraft.core.RegistryAccess; |
9 |
| -import net.minecraft.data.DataGenerator; |
10 |
| -import net.minecraft.data.DataGenerator.PackGenerator; |
11 |
| -import net.minecraft.data.PackOutput; |
12 |
| -import net.minecraft.data.metadata.PackMetadataGenerator; |
13 |
| -import net.minecraft.network.chat.Component; |
14 |
| -import net.minecraft.resources.ResourceLocation; |
15 |
| -import raccoonman.reterraforged.client.data.RTFLanguageProvider; |
16 |
| -import raccoonman.reterraforged.client.data.RTFTranslationKeys; |
17 |
| -import raccoonman.reterraforged.data.preset.settings.Preset; |
18 |
| -import raccoonman.reterraforged.data.preset.tags.PresetBiomeTagsProvider; |
19 |
| -import raccoonman.reterraforged.data.preset.tags.PresetBlockTagsProvider; |
20 |
| -import raccoonman.reterraforged.data.preset.tags.PresetSurfaceLayerTags; |
21 |
| -import raccoonman.reterraforged.platform.DataGenUtil; |
22 |
| - |
23 |
| -public class RTFDataGen { |
24 |
| - public static final String DATAPACK_PATH = "data/reterraforged/datapacks"; |
25 |
| - |
26 |
| - public static void generateResourcePacks(ResourcePackFactory resourcePackFactory) { |
27 |
| - DataGenerator.PackGenerator pack = resourcePackFactory.createPack(); |
28 |
| - |
29 |
| - pack.addProvider(RTFLanguageProvider.EnglishUS::new); |
30 |
| - pack.addProvider((PackOutput output) -> PackMetadataGenerator.forFeaturePack(output, Component.translatable(RTFTranslationKeys.METADATA_DESCRIPTION))); |
31 |
| - } |
32 |
| - |
33 |
| - @Deprecated |
34 |
| - public static DataGenerator makePreset(Preset preset, RegistryAccess registryAccess, Path dataGenPath, Path dataGenOutputPath) { |
35 |
| - DataGenerator dataGenerator = new DataGenerator(dataGenPath, SharedConstants.getCurrentVersion(), true); |
36 |
| - PackGenerator packGenerator = dataGenerator.new PackGenerator(true, "preset", new PackOutput(dataGenOutputPath)); |
37 |
| - CompletableFuture<HolderLookup.Provider> lookup = CompletableFuture.supplyAsync(() -> preset.buildPatch(registryAccess)); |
38 |
| - |
39 |
| - packGenerator.addProvider((output) -> { |
40 |
| - return DataGenUtil.createRegistryProvider(output, lookup); |
41 |
| - }); |
42 |
| - packGenerator.addProvider((output) -> { |
43 |
| - return new PresetBlockTagsProvider(output, lookup); |
44 |
| - }); |
45 |
| - packGenerator.addProvider((output) -> { |
46 |
| - return new PresetSurfaceLayerTags(preset, output, lookup); |
47 |
| - }); |
48 |
| - packGenerator.addProvider((output) -> { |
49 |
| - return new PresetBiomeTagsProvider(preset, output, CompletableFuture.completedFuture(registryAccess)); |
50 |
| - }); |
51 |
| - packGenerator.addProvider((output) -> { |
52 |
| - return PackMetadataGenerator.forFeaturePack(output, Component.translatable(RTFTranslationKeys.PRESET_METADATA_DESCRIPTION)); |
53 |
| - }); |
54 |
| - return dataGenerator; |
55 |
| - } |
56 |
| - |
57 |
| - public interface ResourcePackFactory { |
58 |
| - DataGenerator.PackGenerator createPack(); |
59 |
| - } |
60 |
| - |
61 |
| - public interface DataPackFactory { |
62 |
| - DataGenerator.PackGenerator createPack(ResourceLocation id); |
63 |
| - } |
64 |
| -} |
| 1 | +package raccoonman.reterraforged.data; |
| 2 | + |
| 3 | +import java.nio.file.Path; |
| 4 | +import java.util.concurrent.CompletableFuture; |
| 5 | + |
| 6 | +import net.minecraft.SharedConstants; |
| 7 | +import net.minecraft.core.HolderLookup; |
| 8 | +import net.minecraft.core.RegistryAccess; |
| 9 | +import net.minecraft.data.DataGenerator; |
| 10 | +import net.minecraft.data.DataGenerator.PackGenerator; |
| 11 | +import net.minecraft.data.PackOutput; |
| 12 | +import net.minecraft.data.metadata.PackMetadataGenerator; |
| 13 | +import net.minecraft.network.chat.Component; |
| 14 | +import net.minecraft.resources.ResourceLocation; |
| 15 | +import raccoonman.reterraforged.client.data.RTFLanguageProvider; |
| 16 | +import raccoonman.reterraforged.client.data.RTFTranslationKeys; |
| 17 | +import raccoonman.reterraforged.data.preset.settings.Preset; |
| 18 | +import raccoonman.reterraforged.data.preset.tags.PresetBiomeTagsProvider; |
| 19 | +import raccoonman.reterraforged.data.preset.tags.PresetBlockTagsProvider; |
| 20 | +import raccoonman.reterraforged.data.preset.tags.PresetSurfaceLayerProvider; |
| 21 | +import raccoonman.reterraforged.platform.DataGenUtil; |
| 22 | + |
| 23 | +public class RTFDataGen { |
| 24 | + public static final String DATAPACK_PATH = "data/reterraforged/datapacks"; |
| 25 | + |
| 26 | + public static void generateResourcePacks(ResourcePackFactory resourcePackFactory) { |
| 27 | + DataGenerator.PackGenerator pack = resourcePackFactory.createPack(); |
| 28 | + |
| 29 | + pack.addProvider(RTFLanguageProvider.EnglishUS::new); |
| 30 | + pack.addProvider((PackOutput output) -> PackMetadataGenerator.forFeaturePack(output, Component.translatable(RTFTranslationKeys.METADATA_DESCRIPTION))); |
| 31 | + } |
| 32 | + |
| 33 | + @Deprecated |
| 34 | + public static DataGenerator makePreset(Preset preset, RegistryAccess registryAccess, Path dataGenPath, Path dataGenOutputPath) { |
| 35 | + DataGenerator dataGenerator = new DataGenerator(dataGenPath, SharedConstants.getCurrentVersion(), true); |
| 36 | + PackGenerator packGenerator = dataGenerator.new PackGenerator(true, "preset", new PackOutput(dataGenOutputPath)); |
| 37 | + CompletableFuture<HolderLookup.Provider> lookup = CompletableFuture.supplyAsync(() -> preset.buildPatch(registryAccess)); |
| 38 | + |
| 39 | + packGenerator.addProvider((output) -> { |
| 40 | + return DataGenUtil.createRegistryProvider(output, lookup); |
| 41 | + }); |
| 42 | + packGenerator.addProvider((output) -> { |
| 43 | + return new PresetBlockTagsProvider(output, lookup); |
| 44 | + }); |
| 45 | + packGenerator.addProvider((output) -> { |
| 46 | + return new PresetSurfaceLayerProvider(preset, output, lookup); |
| 47 | + }); |
| 48 | + packGenerator.addProvider((output) -> { |
| 49 | + return new PresetBiomeTagsProvider(preset, output, CompletableFuture.completedFuture(registryAccess)); |
| 50 | + }); |
| 51 | + packGenerator.addProvider((output) -> { |
| 52 | + return PackMetadataGenerator.forFeaturePack(output, Component.translatable(RTFTranslationKeys.PRESET_METADATA_DESCRIPTION)); |
| 53 | + }); |
| 54 | + return dataGenerator; |
| 55 | + } |
| 56 | + |
| 57 | + public interface ResourcePackFactory { |
| 58 | + DataGenerator.PackGenerator createPack(); |
| 59 | + } |
| 60 | + |
| 61 | + public interface DataPackFactory { |
| 62 | + DataGenerator.PackGenerator createPack(ResourceLocation id); |
| 63 | + } |
| 64 | +} |
0 commit comments