Skip to content

Commit

Permalink
Move Datagen Folder Again
Browse files Browse the repository at this point in the history
  • Loading branch information
EmpressAutumn committed Aug 7, 2024
1 parent 3465d6f commit b4cb79d
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 48 deletions.
4 changes: 0 additions & 4 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@ plugins {
id 'multiloader-common'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
}

minecraft {
version(minecraft_version)
def aw = file("src/main/resources/${mod_id}.accesswidener")
if(aw.exists()){
accessWideners(aw)
}
}

dependencies {
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
}

configurations {
commonJava {
canBeResolved = false
Expand All @@ -25,7 +22,6 @@ configurations {
canBeConsumed = true
}
}

artifacts {
commonJava sourceSets.main.java.sourceDirectories.singleFile
commonResources sourceSets.main.resources.sourceDirectories.singleFile
Expand Down
4 changes: 2 additions & 2 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
sourceSets {
main {
resources {
srcDir("src/generated/resources")
srcDir(project(":common").file("src/main/generated"))
exclude("**/.cache")
}
}
Expand Down Expand Up @@ -44,7 +44,7 @@ loom {
name("Data Generation")
property("fabric-api.datagen")
property("fabric-api.datagen.modid", mod_id)
property("fabric-api.datagen.output-dir", project(":common").file("src/generated/resources").absolutePath)
property("fabric-api.datagen.output-dir", project(":common").file("src/main/generated").absolutePath)
property("fabric-api.datagen.strict-validation")
property("fabric-api.datagen.assets-dir", project(":common").file("src/main/resources/assets").absolutePath)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.atom596.titanium.datagen.TitaniumAdvancementProvider;
import com.atom596.titanium.datagen.TitaniumBlockLootTableProvider;
import com.atom596.titanium.datagen.TitaniumBlockTagProvider;
import com.atom596.titanium.datagen.TitaniumModelProvider;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.minecraft.core.RegistrySetBuilder;
Expand All @@ -13,7 +15,7 @@ public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {

pack.addProvider(TitaniumAdvancementProvider::new);
//pack.addProvider(TitaniumBlockLootTableProvider::new);
//pack.addProvider(TitaniumBlockTagProvider::new);
pack.addProvider(TitaniumBlockTagProvider::new);
//pack.addProvider(TitaniumChestLootTableProvider::new);
//pack.addProvider(TitaniumItemTagProvider::new);
//pack.addProvider(TitaniumModelProvider::new);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
package com.atom596.titanium.datagen;

public class TitaniumBlockTagProvider /*extends FabricTagProvider.BlockTagProvider*/ {/*
public TitaniumBlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
import com.atom596.titanium.Titanium;
import com.atom596.titanium.block.TitaniumBlocks;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider.BlockTagProvider;
import net.minecraft.commands.arguments.ResourceKeyArgument;
import net.minecraft.core.HolderLookup;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;

import java.util.concurrent.CompletableFuture;

public class TitaniumBlockTagProvider extends BlockTagProvider {
public TitaniumBlockTagProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) {
super(output, registriesFuture);
}

@Override
protected void configure(RegistryWrapper.WrapperLookup arg) {
getOrCreateTagBuilder(TagKey.of(RegistryKeys.BLOCK, new Identifier(Titanium.MOD_ID, "titanium_ores")))
protected void addTags(HolderLookup.Provider wrapperLookup) {
/*getOrCreateTagBuilder(TagKey.create(ResourceKey.BLOCK, new ResourceLocation(Titanium.MOD_ID, "titanium_ores")))
.add(TitaniumBlocks.TITANIUM_ORE)
.add(TitaniumBlocks.TITANIUM_BLOCK)
.add(TitaniumBlocks.END_TITANIUM_ORE);
getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE)
.add(TitaniumBlocks.END_TITANIUM_ORE);*/
getOrCreateTagBuilder(BlockTags.MINEABLE_WITH_PICKAXE)
.add(TitaniumBlocks.TITANIUM_ORE)
.add(TitaniumBlocks.DEEPSLATE_TITANIUM_ORE)
.add(TitaniumBlocks.END_TITANIUM_ORE)
Expand All @@ -26,4 +38,4 @@ protected void configure(RegistryWrapper.WrapperLookup arg) {
.add(TitaniumBlocks.RAW_TITANIUM_BLOCK)
.add(TitaniumBlocks.TITANIUM_BLOCK);
}
*/}
}
Original file line number Diff line number Diff line change
@@ -1,38 +1,47 @@
package com.atom596.titanium.datagen;
public class TitaniumModelProvider /*extends FabricModelProvider*/ {/*

import com.atom596.titanium.block.TitaniumBlocks;
import com.atom596.titanium.item.TitaniumItems;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
import net.minecraft.data.models.BlockModelGenerators;
import net.minecraft.data.models.ItemModelGenerators;
import net.minecraft.data.models.model.ModelTemplates;

public class TitaniumModelProvider extends FabricModelProvider {
public TitaniumModelProvider(FabricDataOutput output) {
super(output);
}

@Override
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
blockStateModelGenerator.registerSimpleCubeAll(TitaniumBlocks.TITANIUM_ORE);
blockStateModelGenerator.registerSimpleCubeAll(TitaniumBlocks.DEEPSLATE_TITANIUM_ORE);
blockStateModelGenerator.registerSimpleCubeAll(TitaniumBlocks.END_TITANIUM_ORE);
blockStateModelGenerator.registerSimpleCubeAll(TitaniumBlocks.RAW_TITANIUM_BLOCK);
blockStateModelGenerator.registerSimpleCubeAll(TitaniumBlocks.TITANIUM_BLOCK);
public void generateBlockStateModels(BlockModelGenerators blockStateModelGenerator) {
blockStateModelGenerator.createGenericCube(TitaniumBlocks.TITANIUM_ORE);
blockStateModelGenerator.createGenericCube(TitaniumBlocks.DEEPSLATE_TITANIUM_ORE);
blockStateModelGenerator.createGenericCube(TitaniumBlocks.END_TITANIUM_ORE);
blockStateModelGenerator.createGenericCube(TitaniumBlocks.RAW_TITANIUM_BLOCK);
blockStateModelGenerator.createGenericCube(TitaniumBlocks.TITANIUM_BLOCK);
}

@Override
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
itemModelGenerator.register(TitaniumItems.TITANIUM_HELMET, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.TITANIUM_CHESTPLATE, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.TITANIUM_LEGGINGS, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.TITANIUM_BOOTS, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.RAW_TITANIUM, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.TITANIUM_NUGGET, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.TITANIUM_INGOT, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.MUSIC_DISC_AMETHYST, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.TITANIUM_HORSE_ARMOR, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.END_POWDER, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.FLIGHT_CHARGE, Models.GENERATED);
itemModelGenerator.register(TitaniumItems.TITANIUM_LANTERN, Models.GENERATED);
public void generateItemModels(ItemModelGenerators itemModelGenerator) {
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_HELMET, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_CHESTPLATE, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_LEGGINGS, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_BOOTS, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.RAW_TITANIUM, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_NUGGET, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_INGOT, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.MUSIC_DISC_AMETHYST, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_HORSE_ARMOR, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.END_POWDER, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.FLIGHT_CHARGE, ModelTemplates.FLAT_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_LANTERN, ModelTemplates.FLAT_ITEM);

itemModelGenerator.register(TitaniumItems.TITANIUM_SHOVEL, Models.HANDHELD);
itemModelGenerator.register(TitaniumItems.TITANIUM_SWORD, Models.HANDHELD);
itemModelGenerator.register(TitaniumItems.TITANIUM_PICKAXE, Models.HANDHELD);
itemModelGenerator.register(TitaniumItems.TITANIUM_AXE, Models.HANDHELD);
itemModelGenerator.register(TitaniumItems.TITANIUM_HOE, Models.HANDHELD);
itemModelGenerator.register(TitaniumItems.TESTING_WAND, Models.HANDHELD);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_SHOVEL, ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_SWORD, ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_PICKAXE, ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_AXE, ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TITANIUM_HOE, ModelTemplates.FLAT_HANDHELD_ITEM);
itemModelGenerator.generateFlatItem(TitaniumItems.TESTING_WAND, ModelTemplates.FLAT_HANDHELD_ITEM);
}
*/}
}
8 changes: 1 addition & 7 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ plugins {
id 'multiloader-loader'
id 'net.neoforged.gradle.userdev' version '7.0.107'
}

// Automatically enable neoforge AccessTransformers if the file exists
// This location is hardcoded in FML and can not be changed.
// https://github.com/neoforged/FancyModLoader/blob/a952595eaaddd571fbc53f43847680b00894e0c1/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java#L118
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
minecraft.accessTransformers.file at
Expand All @@ -30,9 +26,7 @@ runs {
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

dependencies {
implementation "net.neoforged:neoforge:${neoforge_version}"
}
}

0 comments on commit b4cb79d

Please sign in to comment.