Skip to content

Commit

Permalink
chanegd a lot for languages
Browse files Browse the repository at this point in the history
  • Loading branch information
MelanX committed Mar 14, 2020
1 parent 08181a6 commit fcf7305
Showing 1 changed file with 7 additions and 68 deletions.
75 changes: 7 additions & 68 deletions src/main/java/de/melanx/MoreVanillaTools/util/data/Languages.java
@@ -1,9 +1,9 @@
package de.melanx.MoreVanillaTools.util.data;

import de.melanx.MoreVanillaTools.MoreVanillaTools;
import de.melanx.MoreVanillaTools.items.ItemTiers;
import de.melanx.MoreVanillaTools.items.base.*;
import de.melanx.MoreVanillaTools.util.Registry;
import de.melanx.morevanillalib.util.TranslationHelper;
import net.minecraft.data.DataGenerator;
import net.minecraft.item.Item;
import net.minecraftforge.common.data.LanguageProvider;
Expand All @@ -23,24 +23,12 @@ protected void addTranslations() {
add("enchantment.morevanillatools.repairing_luck.desc", "Reduces the repair costs in the anvil to a minimum.");
for (RegistryObject<Item> object : Registry.ITEMS.getEntries()) {
Item item = object.get();
String name = item.getRegistryName().getPath().split("_")[0];
add(item, Languages.capitalize(name) + " " + getToolTypeName(item));
String path = item.getRegistryName().getPath();
String name = path.split("_")[0];
String tool = path.split("_")[1];
add(item, TranslationHelper.capitalize(name) + " " + TranslationHelper.capitalize(tool));
}
}

private static String getToolTypeName(Item item) {
if (item instanceof SwordBase)
return "Sword";
else if (item instanceof AxeBase)
return "Axe";
else if (item instanceof PickaxeBase)
return "Pickaxe";
else if (item instanceof ShovelBase)
return "Shovel";
else if (item instanceof HoeBase)
return "Hoe";
return null;
}
}

public static class German extends LanguageProvider {
Expand All @@ -54,53 +42,8 @@ protected void addTranslations() {
add("enchantment.morevanillatools.repairing_luck.desc", "Verringert die Reperaturkosten im Amboss auf ein Minimum.");
for (RegistryObject<Item> object : Registry.ITEMS.getEntries()) {
Item item = object.get();
add(item, getGermanMaterialName(item) + getToolTypeName(item));
}
}

private static String getGermanMaterialName(Item item) {
ItemTiers type = null;
if (item instanceof SwordBase)
type = ((SwordBase) item).getToolType();
else if (item instanceof AxeBase)
type = ((AxeBase) item).getToolType();
else if (item instanceof PickaxeBase)
type = ((PickaxeBase) item).getToolType();
else if (item instanceof ShovelBase)
type = ((ShovelBase) item).getToolType();
else if (item instanceof HoeBase)
type = ((HoeBase) item).getToolType();
switch (type) {
case BONE:
return "Knochen";
case COAL:
return "Kohle";
case EMERALD:
return "Smaragd";
case ENDER:
return "Ender";
case FIERY:
return "Feuer";
case GLOWSTONE:
return "Glowstone";
case LAPIS:
return "Lapis";
case NETHER:
return "Nether";
case OBSIDIAN:
return "Obsidian";
case PAPER:
return "Papier";
case PRISMARINE:
return "Prismarin";
case QUARTZ:
return "Netherquartz";
case REDSTONE:
return "Redstone";
case SLIME:
return "Schleim";
default:
return null;
String path = item.getRegistryName().getPath();
add(item, TranslationHelper.getGermanMaterial(path) + getToolTypeName(item));
}
}

Expand All @@ -119,8 +62,4 @@ else if (item instanceof HoeBase)
}
}

private static String capitalize(String string) {
return string.substring(0, 1).toUpperCase() + string.substring(1);
}

}

0 comments on commit fcf7305

Please sign in to comment.