diff --git a/common/build.gradle b/common/build.gradle index b474900..2743260 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -2,7 +2,6 @@ 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") @@ -10,11 +9,9 @@ minecraft { accessWideners(aw) } } - dependencies { compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5' } - configurations { commonJava { canBeResolved = false @@ -25,7 +22,6 @@ configurations { canBeConsumed = true } } - artifacts { commonJava sourceSets.main.java.sourceDirectories.singleFile commonResources sourceSets.main.resources.sourceDirectories.singleFile diff --git a/fabric/build.gradle b/fabric/build.gradle index 29e7e1e..32697ea 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -11,7 +11,7 @@ dependencies { sourceSets { main { resources { - srcDir("src/generated/resources") + srcDir(project(":common").file("src/main/generated")) exclude("**/.cache") } } @@ -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) } diff --git a/fabric/src/main/java/com/atom596/titanium/TitaniumDataGenerator.java b/fabric/src/main/java/com/atom596/titanium/TitaniumDataGenerator.java index d264c05..d4a9881 100644 --- a/fabric/src/main/java/com/atom596/titanium/TitaniumDataGenerator.java +++ b/fabric/src/main/java/com/atom596/titanium/TitaniumDataGenerator.java @@ -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; @@ -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); diff --git a/fabric/src/main/java/com/atom596/titanium/datagen/TitaniumBlockTagProvider.java b/fabric/src/main/java/com/atom596/titanium/datagen/TitaniumBlockTagProvider.java index 57e39be..e70447b 100644 --- a/fabric/src/main/java/com/atom596/titanium/datagen/TitaniumBlockTagProvider.java +++ b/fabric/src/main/java/com/atom596/titanium/datagen/TitaniumBlockTagProvider.java @@ -1,17 +1,29 @@ package com.atom596.titanium.datagen; -public class TitaniumBlockTagProvider /*extends FabricTagProvider.BlockTagProvider*/ {/* - public TitaniumBlockTagProvider(FabricDataOutput output, CompletableFuture 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 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) @@ -26,4 +38,4 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { .add(TitaniumBlocks.RAW_TITANIUM_BLOCK) .add(TitaniumBlocks.TITANIUM_BLOCK); } -*/} +} diff --git a/fabric/src/main/java/com/atom596/titanium/datagen/TitaniumModelProvider.java b/fabric/src/main/java/com/atom596/titanium/datagen/TitaniumModelProvider.java index d3c93b1..26a100e 100644 --- a/fabric/src/main/java/com/atom596/titanium/datagen/TitaniumModelProvider.java +++ b/fabric/src/main/java/com/atom596/titanium/datagen/TitaniumModelProvider.java @@ -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); } -*/} +} diff --git a/neoforge/build.gradle b/neoforge/build.gradle index c32f04f..0ccad9d 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -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 @@ -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}" -} \ No newline at end of file +}