mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-14 22:44:07 +01:00
Restore LangMerger#attachToRegistrateProvider
This commit is contained in:
parent
f8bd8d641d
commit
992373236e
@ -28,10 +28,12 @@ import com.tterrag.registrate.providers.ProviderType;
|
|||||||
|
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.data.CachedOutput;
|
import net.minecraft.data.CachedOutput;
|
||||||
|
import net.minecraft.data.DataGenerator;
|
||||||
import net.minecraft.data.DataProvider;
|
import net.minecraft.data.DataProvider;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.GsonHelper;
|
import net.minecraft.util.GsonHelper;
|
||||||
|
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link AbstractRegistrate#addRawLang} or {@link AbstractRegistrate#addDataGenerator} with {@link ProviderType#LANG} instead.
|
* @deprecated Use {@link AbstractRegistrate#addRawLang} or {@link AbstractRegistrate#addDataGenerator} with {@link ProviderType#LANG} instead.
|
||||||
@ -64,6 +66,18 @@ public class LangMerger implements DataProvider {
|
|||||||
populateLangIgnore();
|
populateLangIgnore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void attachToRegistrateProvider(DataGenerator gen, PackOutput output) {
|
||||||
|
Map<String, DataProvider> providers =
|
||||||
|
ObfuscationReflectionHelper.getPrivateValue(DataGenerator.class, gen, "providersToRun");
|
||||||
|
Entry<String, DataProvider> entryToReplace = null;
|
||||||
|
for (Entry<String, DataProvider> entry : providers.entrySet())
|
||||||
|
if (entry.getValue() instanceof RegistrateDataProvider rdp)
|
||||||
|
entryToReplace = entry;
|
||||||
|
if (entryToReplace != null)
|
||||||
|
providers.put(entryToReplace.getKey(), new ChainedDataProvider(entryToReplace.getValue(),
|
||||||
|
new LangMerger(output, Create.ID, Create.NAME, AllLangPartials.values())));
|
||||||
|
}
|
||||||
|
|
||||||
protected void populateLangIgnore() {
|
protected void populateLangIgnore() {
|
||||||
// Key prefixes added here will NOT be transferred to lang templates
|
// Key prefixes added here will NOT be transferred to lang templates
|
||||||
langIgnore.add("create.ponder.debug_"); // Ponder debug scene text
|
langIgnore.add("create.ponder.debug_"); // Ponder debug scene text
|
||||||
|
Loading…
Reference in New Issue
Block a user