Skip to content

Commit

Permalink
refactor: datagen class rename
Browse files Browse the repository at this point in the history
Gen -> Data
  • Loading branch information
Zepalesque committed Jun 14, 2024
1 parent 91b8799 commit e836cdf
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 62 deletions.
46 changes: 22 additions & 24 deletions src/main/java/net/zepalesque/redux/data/ReduxData.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package net.zepalesque.redux.data;

import com.aetherteam.aether.data.generators.AetherSoundData;
import net.minecraft.DetectedVersion;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.HolderLookup.Provider;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
Expand All @@ -15,18 +13,18 @@
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.data.event.GatherDataEvent;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.data.gen.ReduxBlockStateGen;
import net.zepalesque.redux.data.gen.ReduxDataMapGen;
import net.zepalesque.redux.data.gen.ReduxItemModelGen;
import net.zepalesque.redux.data.gen.ReduxLanguageGen;
import net.zepalesque.redux.data.gen.ReduxLootGen;
import net.zepalesque.redux.data.gen.ReduxParticleGen;
import net.zepalesque.redux.data.gen.ReduxRecipeGen;
import net.zepalesque.redux.data.gen.ReduxBlockStateData;
import net.zepalesque.redux.data.gen.ReduxMapData;
import net.zepalesque.redux.data.gen.ReduxItemModelData;
import net.zepalesque.redux.data.gen.ReduxLanguageData;
import net.zepalesque.redux.data.gen.ReduxLootData;
import net.zepalesque.redux.data.gen.ReduxParticleData;
import net.zepalesque.redux.data.gen.ReduxRecipeData;
import net.zepalesque.redux.data.gen.ReduxRegistrySets;
import net.zepalesque.redux.data.gen.ReduxSoundsGen;
import net.zepalesque.redux.data.gen.tags.ReduxBiomeTagsGen;
import net.zepalesque.redux.data.gen.tags.ReduxBlockTagsGen;
import net.zepalesque.redux.data.gen.tags.ReduxItemTagsGen;
import net.zepalesque.redux.data.gen.ReduxSoundsData;
import net.zepalesque.redux.data.gen.tags.ReduxBiomeTagsData;
import net.zepalesque.redux.data.gen.tags.ReduxBlockTagsData;
import net.zepalesque.redux.data.gen.tags.ReduxItemTagsData;

import java.util.Optional;
import java.util.concurrent.CompletableFuture;
Expand All @@ -39,26 +37,26 @@ public static void dataSetup(GatherDataEvent event) {
PackOutput packOutput = generator.getPackOutput();

// Client Data
generator.addProvider(event.includeClient(), new ReduxBlockStateGen(packOutput, fileHelper));
generator.addProvider(event.includeClient(), new ReduxItemModelGen(packOutput, fileHelper));
generator.addProvider(event.includeClient(), new ReduxLanguageGen(packOutput));
generator.addProvider(event.includeClient(), new ReduxParticleGen(packOutput, fileHelper));
generator.addProvider(event.includeClient(), new ReduxSoundsGen(packOutput, fileHelper));
generator.addProvider(event.includeClient(), new ReduxBlockStateData(packOutput, fileHelper));
generator.addProvider(event.includeClient(), new ReduxItemModelData(packOutput, fileHelper));
generator.addProvider(event.includeClient(), new ReduxLanguageData(packOutput));
generator.addProvider(event.includeClient(), new ReduxParticleData(packOutput, fileHelper));
generator.addProvider(event.includeClient(), new ReduxSoundsData(packOutput, fileHelper));

// Server Data
generator.addProvider(event.includeServer(), new ReduxRecipeGen(packOutput, lookupProvider));
generator.addProvider(event.includeServer(), ReduxLootGen.create(packOutput));
generator.addProvider(event.includeServer(), new ReduxDataMapGen(packOutput, lookupProvider));
generator.addProvider(event.includeServer(), new ReduxRecipeData(packOutput, lookupProvider));
generator.addProvider(event.includeServer(), ReduxLootData.create(packOutput));
generator.addProvider(event.includeServer(), new ReduxMapData(packOutput, lookupProvider));
DatapackBuiltinEntriesProvider registrySets = new ReduxRegistrySets(packOutput, lookupProvider, Redux.MODID);
// Use for structure and damage type data
CompletableFuture<Provider> registryProvider = registrySets.getRegistryProvider();
generator.addProvider(event.includeServer(), registrySets);

// Tags
ReduxBlockTagsGen blockTags = new ReduxBlockTagsGen(packOutput, lookupProvider, fileHelper);
ReduxBlockTagsData blockTags = new ReduxBlockTagsData(packOutput, lookupProvider, fileHelper);
generator.addProvider(event.includeServer(), blockTags);
generator.addProvider(event.includeServer(), new ReduxItemTagsGen(packOutput, lookupProvider, blockTags.contentsGetter(), fileHelper));
generator.addProvider(event.includeServer(), new ReduxBiomeTagsGen(packOutput, lookupProvider, fileHelper));
generator.addProvider(event.includeServer(), new ReduxItemTagsData(packOutput, lookupProvider, blockTags.contentsGetter(), fileHelper));
generator.addProvider(event.includeServer(), new ReduxBiomeTagsData(packOutput, lookupProvider, fileHelper));

// pack.mcmeta
generator.addProvider(true, new PackMetadataGenerator(packOutput).add(PackMetadataSection.TYPE, new PackMetadataSection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import net.zepalesque.redux.blockset.stone.ReduxStoneSets;
import net.zepalesque.redux.data.prov.ReduxBlockStateProvider;

public class ReduxBlockStateGen extends ReduxBlockStateProvider {
public class ReduxBlockStateData extends ReduxBlockStateProvider {

public ReduxBlockStateGen(PackOutput output, ExistingFileHelper helper) {
public ReduxBlockStateData(PackOutput output, ExistingFileHelper helper) {
super(output, Redux.MODID, helper);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import net.zepalesque.redux.data.prov.ReduxItemModelProvider;
import net.zepalesque.redux.item.ReduxItems;

public class ReduxItemModelGen extends ReduxItemModelProvider {
public class ReduxItemModelData extends ReduxItemModelProvider {

public ReduxItemModelGen(PackOutput output, ExistingFileHelper helper) {
public ReduxItemModelData(PackOutput output, ExistingFileHelper helper) {
super(output, Redux.MODID, helper);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.zenith.util.DatagenUtil;

public class ReduxLanguageGen extends ReduxLanguageProvider {
public class ReduxLanguageData extends ReduxLanguageProvider {

public ReduxLanguageGen(PackOutput output) {
public ReduxLanguageData(PackOutput output) {
super(output, Redux.MODID);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
package net.zepalesque.redux.data.gen;

import com.aetherteam.aether.data.generators.loot.AetherAdvancementLoot;
import com.aetherteam.aether.data.generators.loot.AetherBlockLoot;
import com.aetherteam.aether.data.generators.loot.AetherChestLoot;
import com.aetherteam.aether.data.generators.loot.AetherEntityLoot;
import com.aetherteam.aether.data.generators.loot.AetherSelectorLoot;
import com.aetherteam.aether.data.generators.loot.AetherStrippingLoot;
import com.aetherteam.aether.loot.AetherLoot;
import com.aetherteam.aether.loot.AetherLootContexts;
import net.minecraft.data.PackOutput;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
Expand All @@ -16,7 +8,7 @@

import java.util.List;

public class ReduxLootGen {
public class ReduxLootData {

public static LootTableProvider create(PackOutput output) {
return new LootTableProvider(output, ReduxLoot.IMMUTABLE_LOOT_TABLES, List.of(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
package net.zepalesque.redux.data.gen;

import com.aetherteam.aether.block.AetherBlocks;
import com.aetherteam.aether.data.generators.AetherDataMapData;
import com.aetherteam.aether.data.resources.registries.AetherBiomes;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.ReduxBlocks;
import net.zepalesque.redux.client.ReduxColors;
import net.zepalesque.redux.data.ReduxDataMaps;
import net.zepalesque.redux.data.ReduxTags;
import net.zepalesque.redux.data.prov.ReduxDataMapProvider;
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.redux.world.biome.tint.ReduxBiomeTints;

import java.util.concurrent.CompletableFuture;

public class ReduxDataMapGen extends ReduxDataMapProvider {
public class ReduxMapData extends ReduxDataMapProvider {

public ReduxDataMapGen(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
public ReduxMapData(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import net.zepalesque.redux.client.particle.ReduxParticles;
import net.zepalesque.redux.data.prov.ReduxParticleProvider;

public class ReduxParticleGen extends ReduxParticleProvider {
public ReduxParticleGen(PackOutput output, ExistingFileHelper fileHelper) {
public class ReduxParticleData extends ReduxParticleProvider {
public ReduxParticleData(PackOutput output, ExistingFileHelper fileHelper) {
super(output, fileHelper);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.ReduxBlocks;
import net.zepalesque.redux.blockset.stone.ReduxStoneSets;
Expand All @@ -25,9 +22,9 @@

import java.util.concurrent.CompletableFuture;

public class ReduxRecipeGen extends ReduxRecipeProvider {
public class ReduxRecipeData extends ReduxRecipeProvider {

public ReduxRecipeGen(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider) {
public ReduxRecipeData(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(output, lookupProvider, Redux.MODID);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import net.zepalesque.redux.data.prov.ReduxSoundsProvider;
import net.zepalesque.zenith.util.DatagenUtil;

public class ReduxSoundsGen extends ReduxSoundsProvider {
public ReduxSoundsGen(PackOutput output, ExistingFileHelper helper) {
public class ReduxSoundsData extends ReduxSoundsProvider {
public ReduxSoundsData(PackOutput output, ExistingFileHelper helper) {
super(output, Redux.MODID, helper);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import javax.annotation.Nullable;
import java.util.concurrent.CompletableFuture;

public class ReduxBiomeTagsGen extends BiomeTagsProvider {
public class ReduxBiomeTagsData extends BiomeTagsProvider {

public ReduxBiomeTagsGen(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, @Nullable ExistingFileHelper helper) {
public ReduxBiomeTagsData(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, @Nullable ExistingFileHelper helper) {
super(output, registries, Redux.MODID, helper);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import java.util.concurrent.CompletableFuture;

public class ReduxBlockTagsGen extends ReduxBlockTagsProvider {
public class ReduxBlockTagsData extends ReduxBlockTagsProvider {

public ReduxBlockTagsGen(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
public ReduxBlockTagsData(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
super(output, lookupProvider, Redux.MODID, existingFileHelper);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.aetherteam.aether.AetherTags;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.zepalesque.redux.Redux;
Expand All @@ -14,9 +13,9 @@

import java.util.concurrent.CompletableFuture;

public class ReduxItemTagsGen extends ReduxItemTagsProvider {
public class ReduxItemTagsData extends ReduxItemTagsProvider {

public ReduxItemTagsGen(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, CompletableFuture<TagLookup<Block>> blockTags, @Nullable ExistingFileHelper helper) {
public ReduxItemTagsData(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, CompletableFuture<TagLookup<Block>> blockTags, @Nullable ExistingFileHelper helper) {
super(output, registries, blockTags, Redux.MODID, helper);
}

Expand Down

0 comments on commit e836cdf

Please sign in to comment.