Skip to content

Commit

Permalink
Start Work on LangFiles Data Gen
Browse files Browse the repository at this point in the history
  • Loading branch information
manmaed committed Oct 14, 2024
1 parent 57a82ac commit 3fc5ee7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static void gatherData(GatherDataEvent event) {
generator.addProvider(true, new PRLootTabels(packOutput, lookupProvider));
generator.addProvider(true, new PRWorldGenProvider(packOutput, lookupProvider));
generator.addProvider(true, new PRAdvancementProvider(packOutput, lookupProvider, fileHelper));
PRLanguageProvider.addTranslations(generator);



Expand Down
24 changes: 24 additions & 0 deletions src/main/java/net/manmaed/petrock/datagen/PRLanguageProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.manmaed.petrock.datagen;

import net.manmaed.petrock.datagen.lang.PetRockENUS;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;

public class PRLanguageProvider {

public static void addTranslations(DataGenerator generator) {
PackOutput output = generator.getPackOutput();
/**
* To Add a new LanguageProvider make a new fine in the net.manmaed.petrock.datagen.lang called PetRocklocale (eg PetRockENPT for Pirate Speak)
* then make that extend LanguageProvider make it only need a PackOutput and define the modID as PetRock.MOD_ID and the locale in the super
* Example:
* public PetRockENPT(PackOutput output) { super(output, PetRock.MOD_ID, "en_pt") }
* --
* please add the fist 2 lines to the new Language for Language Name, Translator Name
* Example:
* add("a.lang.file.name", "Pirate Speak");
* add("a.lang.author.name", "manmaed");
*/
generator.addProvider(true, new PetRockENUS(output));
}
}
19 changes: 19 additions & 0 deletions src/main/java/net/manmaed/petrock/datagen/lang/PetRockENUS.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.manmaed.petrock.datagen.lang;

import net.manmaed.petrock.PetRock;
import net.minecraft.data.PackOutput;
import net.neoforged.neoforge.common.data.LanguageProvider;

public class PetRockENUS extends LanguageProvider {
public PetRockENUS(PackOutput output) {
super(output, PetRock.MOD_ID, "en_us");
}

@Override
protected void addTranslations() {
add("a.lang.file.name", "English US");
add("a.lang.author.name", "manmaed");
add("itemGroup." + PetRock.MOD_ID, "PetRock");
//TODO: Make this
}
}

0 comments on commit 3fc5ee7

Please sign in to comment.