Advertisement
jayhillx

SetupDataGenerator

Nov 4th, 2023
1,068
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. package com.mod.common.datagen;
  2.  
  3. import com.mod.core.mod;
  4. import com.mod.core.init.Biomes;
  5. import com.mod.core.init.Dimensions;
  6. import net.minecraft.core.RegistrySetBuilder;
  7. import net.minecraft.core.registries.Registries;
  8. import net.minecraft.data.DataGenerator;
  9. import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider;
  10. import net.minecraftforge.data.event.GatherDataEvent;
  11. import net.minecraftforge.eventbus.api.SubscribeEvent;
  12. import net.minecraftforge.fml.common.Mod;
  13.  
  14. import java.util.Set;
  15.  
  16. @Mod.EventBusSubscriber(modid = mod.modId, bus = Mod.EventBusSubscriber.Bus.MOD)
  17. public class SetupDataGenerator {
  18.     private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder().add(Registries.DIMENSION_TYPE, Dimensions::bootstrap).add(Registries.BIOME, Biomes::bootstrap);
  19.  
  20.     @SubscribeEvent
  21.     public static void onGatherData(GatherDataEvent event) {
  22.         DataGenerator generator = event.getGenerator();
  23.         generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(generator.getPackOutput(), event.getLookupProvider(), BUILDER, Set.of(mod.modId)));
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement