mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
english u stupid shit
This commit is contained in:
parent
29534764a9
commit
85038e9628
1 changed files with 30 additions and 11 deletions
|
@ -10,15 +10,17 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.util;
|
package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import java.io.InputStream;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import java.lang.reflect.Method;
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.util.text.translation.LanguageMap;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public final class StringUtil{
|
public final class StringUtil{
|
||||||
|
|
||||||
|
@ -48,11 +50,6 @@ public final class StringUtil{
|
||||||
return net.minecraft.util.text.translation.I18n.translateToLocal(langKey);
|
return net.minecraft.util.text.translation.I18n.translateToLocal(langKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")//Configs why must you need to be translated.
|
|
||||||
public static String badTranslate(String someUnlocAAItemName) {
|
|
||||||
return net.minecraft.util.text.translation.I18n.translateToLocal("item.actuallyadditions."+someUnlocAAItemName+".name");
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){
|
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){
|
||||||
List<String> list = renderer.listFormattedStringToWidth(strg, width);
|
List<String> list = renderer.listFormattedStringToWidth(strg, width);
|
||||||
|
@ -82,4 +79,26 @@ public final class StringUtil{
|
||||||
renderScaledAsciiString(font, lines.get(i), x, y+(i*(int)(font.FONT_HEIGHT*scale+3)), color, shadow, scale);
|
renderScaledAsciiString(font, lines.get(i), x, y+(i*(int)(font.FONT_HEIGHT*scale+3)), color, shadow, scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Remove
|
||||||
|
static LanguageMap cancerino;
|
||||||
|
|
||||||
|
static void setupLangMap() {
|
||||||
|
try {
|
||||||
|
Method m = LanguageMap.class.getDeclaredMethod("inject", LanguageMap.class, InputStream.class);
|
||||||
|
m.setAccessible(true);
|
||||||
|
m.invoke(null, cancerino = new LanguageMap(), ActuallyAdditions.class.getResourceAsStream("/assets/actuallyadditions/lang/en_US.lang"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("Actually Additions failed to access LanguageMap.inject. Report this!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String badTranslate(String someUnlocAAItemName) {
|
||||||
|
if (cancerino == null) {
|
||||||
|
cancerino = new LanguageMap();
|
||||||
|
setupLangMap();
|
||||||
|
}
|
||||||
|
return cancerino.translateKey("item.actuallyadditions."+someUnlocAAItemName+".name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue