Skip to content

Commit

Permalink
Re-fix datagen (MDG ftw tho)
Browse files Browse the repository at this point in the history
  • Loading branch information
robotgryphon committed Jun 21, 2024
1 parent 0ab602f commit 5e8ad15
Show file tree
Hide file tree
Showing 19 changed files with 101 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/datagen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: gradle/actions/setup-gradle@v3

- name: Data Generation
run: ./gradlew :neoforge-main:runData
run: ./gradlew :neoforge-datagen:runData
env:
VERSION: ${{ inputs.version }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
Expand Down
130 changes: 63 additions & 67 deletions neoforge-datagen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,67 +1,63 @@
//import org.slf4j.event.Level
//
//plugins {
// id("java")
// id("eclipse")
// id("idea")
// id("maven-publish")
// alias(neoforged.plugins.userdev)
//}
//
//val modId: String = "compactmachines"
//
//val coreApi = project(":core-api")
//val mainProject: Project = project(":neoforge-main")
//
//project.evaluationDependsOn(coreApi.path)
//project.evaluationDependsOn(mainProject.path)
//
//java {
// toolchain.languageVersion.set(JavaLanguageVersion.of(21))
//}
//
//minecraft {
// modIdentifier.set(modId)
//}
//
//runs {
// // applies to all the run configs below
// configureEach {
// systemProperty("forge.logging.markers", "")
// systemProperty("forge.logging.console.level", "debug")
//
// modSources {
// add(modId, project.sourceSets.main.get())
// add(modId, mainProject.sourceSets.main.get())
// add(modId, coreApi.sourceSets.main.get())
// }
// }
//
// create("data") {
// dataGenerator(true)
//
// programArguments("--mod", "compactmachines")
// programArguments("--all")
// programArguments("--output", mainProject.file("src/generated/resources").absolutePath)
// programArguments("--existing", mainProject.file("src/main/resources").absolutePath)
// }
//}
//
//repositories {
// mavenLocal()
//}
//
//dependencies {
// compileOnly(coreApi)
// compileOnly(mainProject)
//
// implementation(neoforged.neoforge)
//}
//
//tasks.compileJava {
// options.encoding = "UTF-8";
//}
//
//tasks.withType<ProcessResources> {
// duplicatesStrategy = DuplicatesStrategy.EXCLUDE
//}
import org.slf4j.event.Level

plugins {
id("java")
id("eclipse")
id("idea")
id("maven-publish")
alias(neoforged.plugins.moddev)
}

val modId: String = "compactmachines"

val coreApi = project(":core-api")
val mainProject: Project = project(":neoforge-main")

project.evaluationDependsOn(coreApi.path)
project.evaluationDependsOn(mainProject.path)

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}

neoForge {
version = neoforged.versions.neoforge

this.mods.create(modId) {
sourceSet(sourceSets.main.get())
sourceSet(coreApi.sourceSets.main.get())
sourceSet(mainProject.sourceSets.main.get())
}

this.runs {
configureEach {
logLevel.set(Level.DEBUG)
}

create("data") {
data()

programArguments.addAll("--mod", modId)
programArguments.addAll("--all")
programArguments.addAll("--output", mainProject.file("src/generated/resources").absolutePath)
programArguments.addAll("--existing", mainProject.file("src/main/resources").absolutePath)
}
}
}

repositories {
mavenLocal()
}

dependencies {
implementation(coreApi)
implementation(mainProject)
}

tasks.compileJava {
options.encoding = "UTF-8";
}

tasks.withType<ProcessResources> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package dev.compactmods.machines.data.datagen;
package dev.compactmods.machines.datagen;

import dev.compactmods.machines.api.CompactMachines;
import dev.compactmods.machines.data.datagen.compat.curios.CurioEntityGenerator;
import dev.compactmods.machines.data.datagen.compat.curios.CurioSlotGenerator;
import dev.compactmods.machines.data.datagen.lang.EnglishLangGenerator;
import dev.compactmods.machines.data.datagen.loot.BlockLootGenerator;
import dev.compactmods.machines.data.datagen.tags.BlockTagGenerator;
import dev.compactmods.machines.data.datagen.tags.ItemTagGenerator;
import dev.compactmods.machines.data.datagen.tags.PointOfInterestTagGenerator;
import dev.compactmods.machines.datagen.compat.curios.CurioEntityGenerator;
import dev.compactmods.machines.datagen.compat.curios.CurioSlotGenerator;
import dev.compactmods.machines.datagen.lang.EnglishLangGenerator;
import dev.compactmods.machines.datagen.loot.BlockLootGenerator;
import dev.compactmods.machines.datagen.tags.BlockTagGenerator;
import dev.compactmods.machines.datagen.tags.ItemTagGenerator;
import dev.compactmods.machines.datagen.tags.PointOfInterestTagGenerator;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.neoforged.bus.api.SubscribeEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.compactmods.machines.data.datagen;
package dev.compactmods.machines.datagen;

import dev.compactmods.machines.api.room.RoomTemplate;
import dev.compactmods.machines.api.CompactMachines;
import dev.compactmods.machines.api.dimension.CompactDimension;
import dev.compactmods.machines.data.datagen.util.DimensionTypeBuilder;
import dev.compactmods.machines.datagen.util.DimensionTypeBuilder;
import dev.compactmods.machines.dimension.Dimension;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.RegistrySetBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen;
package dev.compactmods.machines.datagen;

import dev.compactmods.machines.api.CompactMachines;
import dev.compactmods.machines.machine.Machines;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen;
package dev.compactmods.machines.datagen;

import dev.compactmods.machines.api.CompactMachines;
import dev.compactmods.machines.api.room.RoomTemplate;
Expand Down Expand Up @@ -33,7 +33,7 @@ protected void buildRecipes(RecipeOutput recipeOutput) {
.pattern("D D")
.pattern("DDD")
.define('D', Items.POLISHED_DEEPSLATE)
.unlockedBy("picked_up_deepslate", has(Tags.Items.COBBLESTONES_DEEPSLATE))
.unlockedBy("picked_up_deepslate", RecipeProvider.has(Tags.Items.COBBLESTONES_DEEPSLATE))
.save(recipeOutput);

ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, Shrinking.PERSONAL_SHRINKING_DEVICE.get())
Expand All @@ -47,7 +47,7 @@ protected void buildRecipes(RecipeOutput recipeOutput) {
.define('5', Shrinking.SHRINKING_MODULE)
.define('6', Tags.Items.INGOTS_IRON)
.define('7', Tags.Items.INGOTS_COPPER)
.unlockedBy("picked_up_ender_eye", has(Items.ENDER_EYE))
.unlockedBy("picked_up_ender_eye", RecipeProvider.has(Items.ENDER_EYE))
.save(recipeOutput);

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Shrinking.ENLARGING_MODULE)
Expand All @@ -58,7 +58,7 @@ protected void buildRecipes(RecipeOutput recipeOutput) {
.define('P', Items.PISTON)
.define('E', Items.ENDER_EYE)
.define('L', Items.LIGHT_WEIGHTED_PRESSURE_PLATE)
.unlockedBy("picked_up_ender_eye", has(Items.ENDER_EYE))
.unlockedBy("picked_up_ender_eye", RecipeProvider.has(Items.ENDER_EYE))
.save(recipeOutput);

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Shrinking.SHRINKING_MODULE)
Expand All @@ -69,7 +69,7 @@ protected void buildRecipes(RecipeOutput recipeOutput) {
.define('P', Items.STICKY_PISTON)
.define('E', Items.ENDER_EYE)
.define('L', Items.LIGHT_WEIGHTED_PRESSURE_PLATE)
.unlockedBy("picked_up_ender_eye", has(Items.ENDER_EYE))
.unlockedBy("picked_up_ender_eye", RecipeProvider.has(Items.ENDER_EYE))
.save(recipeOutput);

addMachineRecipes(recipeOutput);
Expand Down Expand Up @@ -105,7 +105,7 @@ protected void registerMachineRecipe(RecipeOutput consumer, ResourceLocation tem
.define('S', Shrinking.SHRINKING_MODULE)
.define('P', catalyst);

recipe.unlockedBy("has_recipe", has(Rooms.Items.BREAKABLE_WALL));
recipe.unlockedBy("has_recipe", RecipeProvider.has(Rooms.Items.BREAKABLE_WALL));

final var recipeId = CompactMachines.modRL("new_machine_" + temId.getPath());
recipe.save(consumer, recipeId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen;
package dev.compactmods.machines.datagen;

import dev.compactmods.machines.api.CompactMachines;
import dev.compactmods.machines.machine.Machines;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package dev.compactmods.machines.datagen;

public class VillagerTrades {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen.compat.curios;
package dev.compactmods.machines.datagen.compat.curios;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen.compat.curios;
package dev.compactmods.machines.datagen.compat.curios;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package dev.compactmods.machines.data.datagen.lang;
package dev.compactmods.machines.datagen.lang;

import dev.compactmods.machines.api.CompactMachines;
import net.minecraft.Util;
import net.minecraft.core.Direction;
import net.minecraft.data.DataGenerator;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.common.data.LanguageProvider;

import static org.apache.commons.lang3.StringUtils.capitalize;
import org.apache.commons.lang3.StringUtils;

public abstract class BaseLangGenerator extends LanguageProvider {

Expand All @@ -19,7 +18,7 @@ public BaseLangGenerator(DataGenerator gen, String locale) {
}

protected String getDirectionTranslation(Direction dir) {
return capitalize(dir.getSerializedName());
return StringUtils.capitalize(dir.getSerializedName());
}

protected String getMachineTranslation() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen.lang;
package dev.compactmods.machines.datagen.lang;

import dev.compactmods.machines.api.CompactMachines;
import dev.compactmods.machines.api.Translations;
Expand All @@ -8,6 +8,7 @@
import dev.compactmods.machines.api.room.RoomTranslations;
import dev.compactmods.machines.client.keybinds.room.RoomExitKeyMapping;
import dev.compactmods.machines.client.creative.CreativeTabs;
import dev.compactmods.machines.datagen.lang.BaseLangGenerator;
import dev.compactmods.machines.room.Rooms;
import dev.compactmods.machines.shrinking.Shrinking;
import net.minecraft.Util;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen.loot;
package dev.compactmods.machines.datagen.loot;

import dev.compactmods.machines.data.functions.CopyRoomBindingFunction;
import dev.compactmods.machines.machine.Machines;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen.tags;
package dev.compactmods.machines.datagen.tags;

import dev.compactmods.machines.api.CompactMachines;
import dev.compactmods.machines.api.machine.MachineConstants;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen.tags;
package dev.compactmods.machines.datagen.tags;

import dev.compactmods.machines.api.machine.MachineConstants;
import dev.compactmods.machines.api.shrinking.PSDTags;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen.tags;
package dev.compactmods.machines.datagen.tags;

import dev.compactmods.machines.api.CompactMachines;
import dev.compactmods.machines.villager.Villagers;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.compactmods.machines.data.datagen.util;
package dev.compactmods.machines.datagen.util;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ rootProject.name = "Compact Machines 21.0"

dependencyResolutionManagement {
versionCatalogs.create("neoforged") {
version("mdg", "0.1.92")
version("neoforge", "21.0.14-beta")
version("mdg", "0.1.105")
version("neoforge", "21.0.21-beta")
version("neogradle", "7.0.145")
version("neoforgeRange") {
require("[21.0,22)")
Expand Down Expand Up @@ -87,5 +87,5 @@ plugins {

include(":core-api")
include(":neoforge-main")
//include(":neoforge-datagen")
include(":neoforge-datagen")

0 comments on commit 5e8ad15

Please sign in to comment.