-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
184 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/generated/resources/data/malum/tags/worldgen/biome/has_runewood.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"values": [ | ||
"#minecraft:is_overworld" | ||
] | ||
} |
4 changes: 0 additions & 4 deletions
4
src/generated/resources/data/malum/worldgen/configured_feature/soulwood_tree.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
{ | ||
"type": "malum:soulwood_tree", | ||
"config": {} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/com/sammy/malum/data/BiomeModifications.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.sammy.malum.data; | ||
|
||
import com.sammy.malum.MalumMod; | ||
import com.sammy.malum.registry.common.worldgen.BiomeTagRegistry; | ||
import com.sammy.malum.registry.common.worldgen.PlacedFeatureRegistry; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.core.HolderSet; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.data.worldgen.BootstapContext; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.level.biome.Biome; | ||
import net.minecraft.world.level.levelgen.GenerationStep; | ||
import net.minecraft.world.level.levelgen.placement.PlacedFeature; | ||
import net.minecraftforge.common.world.BiomeModifier; | ||
import net.minecraftforge.common.world.ForgeBiomeModifiers; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
public class BiomeModifications { | ||
public static void bootstrap(BootstapContext<BiomeModifier> context) { | ||
register(context, "soulstone_ore", () -> | ||
addFeatureModifier(context, | ||
getPlacedHolderSet(context, PlacedFeatureRegistry.ORE_SOULSTONE), | ||
BiomeTagRegistry.HAS_SOULSTONE, GenerationStep.Decoration.UNDERGROUND_ORES)); | ||
|
||
register(context, "brilliant_ore", () -> | ||
addFeatureModifier(context, | ||
getPlacedHolderSet(context, PlacedFeatureRegistry.ORE_BRILLIANT), | ||
BiomeTagRegistry.HAS_BRILLIANT, GenerationStep.Decoration.UNDERGROUND_ORES)); | ||
|
||
register(context, "natural_quartz_ore", () -> | ||
addFeatureModifier(context, | ||
getPlacedHolderSet(context, PlacedFeatureRegistry.ORE_NATURAL_QUARTZ), | ||
BiomeTagRegistry.HAS_SOULSTONE, GenerationStep.Decoration.UNDERGROUND_ORES)); | ||
|
||
register(context, "runwood_tree", () -> | ||
addFeatureModifier(context, | ||
getPlacedHolderSet(context, PlacedFeatureRegistry.RUNEWOOD_TREE), | ||
BiomeTagRegistry.HAS_RUNEWOOD, GenerationStep.Decoration.VEGETAL_DECORATION)); | ||
|
||
} | ||
|
||
public static HolderSet<PlacedFeature> getPlacedHolderSet(BootstapContext<?> context, ResourceKey<PlacedFeature>... placedFeatures) { | ||
List<Holder<PlacedFeature>> holders = new ArrayList<>(); | ||
for (ResourceKey<PlacedFeature> feature : placedFeatures) { | ||
holders.add(context.lookup(Registries.PLACED_FEATURE).getOrThrow(feature)); | ||
} | ||
return HolderSet.direct(holders); | ||
} | ||
|
||
private static ForgeBiomeModifiers.AddFeaturesBiomeModifier addFeatureModifier(BootstapContext<BiomeModifier> context, HolderSet<PlacedFeature> placedSet, TagKey<Biome> biomeTag, GenerationStep.Decoration decoration) { | ||
return new ForgeBiomeModifiers.AddFeaturesBiomeModifier(context.lookup(Registries.BIOME).getOrThrow(biomeTag), placedSet, decoration); | ||
} | ||
|
||
private static void register(BootstapContext<BiomeModifier> context, String name, Supplier<? extends BiomeModifier> modifier) { | ||
context.register(ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, MalumMod.malumPath(name)), modifier.get()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.sammy.malum.data; | ||
|
||
import com.sammy.malum.MalumMod; | ||
import com.sammy.malum.data.block.MalumBlockLootTables; | ||
import com.sammy.malum.data.block.MalumBlockStates; | ||
import com.sammy.malum.data.block.MalumBlockTags; | ||
import com.sammy.malum.data.item.MalumItemModels; | ||
import com.sammy.malum.data.recipe.*; | ||
import net.minecraft.DetectedVersion; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.data.DataGenerator; | ||
import net.minecraft.data.PackOutput; | ||
import net.minecraft.data.metadata.PackMetadataGenerator; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.server.packs.PackType; | ||
import net.minecraft.server.packs.metadata.pack.PackMetadataSection; | ||
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider; | ||
import net.minecraftforge.common.data.ExistingFileHelper; | ||
import net.minecraftforge.data.event.GatherDataEvent; | ||
import net.minecraftforge.eventbus.api.SubscribeEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
|
||
import java.util.Arrays; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.Function; | ||
import java.util.stream.Collectors; | ||
|
||
@Mod.EventBusSubscriber(modid = MalumMod.MALUM, bus = Mod.EventBusSubscriber.Bus.MOD) | ||
public class DataGenerators { | ||
|
||
@SubscribeEvent | ||
public static void gatherData(GatherDataEvent event) { | ||
DataGenerator generator = event.getGenerator(); | ||
PackOutput output = generator.getPackOutput(); | ||
CompletableFuture<HolderLookup.Provider> provider = event.getLookupProvider(); | ||
ExistingFileHelper helper = event.getExistingFileHelper(); | ||
|
||
|
||
MalumItemModels itemModelsProvider = new MalumItemModels(output, helper); | ||
MalumBlockTags blockTagsProvider = new MalumBlockTags(output, provider, helper); | ||
|
||
generator.addProvider(event.includeClient(), new MalumBlockStates(output, helper, itemModelsProvider)); | ||
generator.addProvider(event.includeClient(), itemModelsProvider); | ||
|
||
|
||
//TODO generator.addProvider(event.includeServer(), blockTagsProvider); | ||
generator.addProvider(event.includeServer(), new MalumBlockLootTables(output)); | ||
//TODO generator.addProvider(event.includeServer(), new MalumItemTags(output, provider, blockTagsProvider.contentsGetter(), helper)); | ||
|
||
generator.addProvider(event.includeServer(), new MalumRecipes(output)); | ||
generator.addProvider(event.includeServer(), new MalumVanillaRecipeReplacements(output)); | ||
generator.addProvider(event.includeServer(), new MalumSpiritInfusionRecipes(output)); | ||
generator.addProvider(event.includeServer(), new MalumSpiritFocusingRecipes(output)); | ||
generator.addProvider(event.includeServer(), new MalumSpiritTransmutationRecipes(output)); | ||
generator.addProvider(event.includeServer(), new MalumVoidFavorRecipes(output)); | ||
|
||
generator.addProvider(event.includeServer(), new MalumBiomeTags(output, provider, helper)); | ||
|
||
generator.addProvider(event.includeServer(), new RegistryDataGenerator(output, provider)); | ||
generator.addProvider(event.includeClient(), new MalumLang(output)); | ||
} | ||
} |
82 changes: 0 additions & 82 deletions
82
src/main/java/com/sammy/malum/data/MalumWorldgenProvider.java
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
src/main/java/com/sammy/malum/data/RegistryDataGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.sammy.malum.data; | ||
|
||
import com.sammy.malum.MalumMod; | ||
import com.sammy.malum.registry.common.worldgen.BiomeTagRegistry; | ||
import com.sammy.malum.registry.common.worldgen.ConfiguredFeatureRegistry; | ||
import com.sammy.malum.registry.common.worldgen.PlacedFeatureRegistry; | ||
import com.sammy.malum.registry.common.worldgen.StructureRegistry; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.core.HolderSet; | ||
import net.minecraft.core.RegistrySetBuilder; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.data.PackOutput; | ||
import net.minecraft.data.worldgen.BootstapContext; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.level.biome.Biome; | ||
import net.minecraft.world.level.levelgen.GenerationStep; | ||
import net.minecraft.world.level.levelgen.placement.PlacedFeature; | ||
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider; | ||
import net.minecraftforge.common.world.BiomeModifier; | ||
import net.minecraftforge.common.world.ForgeBiomeModifiers; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.Supplier; | ||
|
||
public class RegistryDataGenerator extends DatapackBuiltinEntriesProvider { | ||
|
||
private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() | ||
.add(Registries.CONFIGURED_FEATURE, ConfiguredFeatureRegistry::bootstrap) | ||
.add(Registries.PLACED_FEATURE, PlacedFeatureRegistry::bootstrap) | ||
.add(ForgeRegistries.Keys.BIOME_MODIFIERS, BiomeModifications::bootstrap); | ||
|
||
public RegistryDataGenerator(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) { | ||
super(output, registries, BUILDER, Set.of("minecraft", MalumMod.MALUM)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.