Skip to content

Commit e5b3ee0

Browse files
committed
rename getName to getTitleKey
1 parent 532d86d commit e5b3ee0

11 files changed

Lines changed: 21 additions & 14 deletions

src/main/java/turing/tmb/InfoRecipeCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public InfoRecipeCategory() {
2929
}
3030

3131
@Override
32-
public String getName() {
32+
public String getTitleKey() {
3333
return "tmb.category.info";
3434
}
3535

src/main/java/turing/tmb/RecipeIndex.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public List<Pair<IRecipeCategory<?>, IRecipeTranslator<?>>> searchRecipes(ILooku
4343

4444
List<Pair<IRecipeCategory<?>, IRecipeTranslator<?>>> list = context.getRole() == RecipeIngredientRole.INPUT ? getRecipesCatalyst(context.getIngredient(), false) : new ArrayList<>();
4545
for (Map.Entry<IRecipeCategory<?>, List<IRecipeTranslator<?>>> entry : recipeLists.entrySet()) {
46-
if (!hiddenCategories.contains(entry.getKey().getName())) {
46+
if (!hiddenCategories.contains(entry.getKey().getTitleKey())) {
4747
for (IRecipeTranslator<?> translator : entry.getValue()) {
4848
boolean isIn = false;
4949
switch (context.getRole()) {
@@ -99,7 +99,7 @@ public List<Pair<IRecipeCategory<?>, IRecipeTranslator<?>>> getRecipesCatalyst(I
9999
List<IRecipeCategory<?>> categoryList = getCategoriesForCatalyst(ingredient);
100100

101101
for (IRecipeCategory<?> category : categoryList) {
102-
if (!hiddenCategories.contains(category.getName())) {
102+
if (!hiddenCategories.contains(category.getTitleKey())) {
103103
for (IRecipeTranslator<?> translator : recipeLists.get(category)) {
104104
pairList.add(Pair.of(category, translator));
105105
}

src/main/java/turing/tmb/TMB.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static void saveData() {
137137
ingredientTag.putString("uid", key.ingredient.getUid());
138138
defaultRecipeTag.put("ingredient", ingredientTag);
139139
categoryTag.putString("namespace", key.category.getNamespace());
140-
categoryTag.putString("name", key.category.getName());
140+
categoryTag.putString("name", key.category.getTitleKey());
141141
defaultRecipeTag.put("category", categoryTag);
142142
defaultRecipes.put(String.valueOf(i), defaultRecipeTag);
143143
i++;
@@ -184,7 +184,7 @@ public static void loadData() {
184184

185185
Optional<IRecipeCategory<?>> category = TMB.getRuntime().getRecipeIndex().getAllCategories().stream()
186186
.filter(it ->
187-
it.getName().equals(categoryTag.getString("name"))
187+
it.getTitleKey().equals(categoryTag.getString("name"))
188188
&& it.getNamespace().equals(categoryTag.getString("namespace"))).findFirst();
189189

190190
Optional<IRecipeTranslator<?>> recipe = category

src/main/java/turing/tmb/api/recipe/IRecipeCategory.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ default IDrawable getIcon() {
1515
return null;
1616
}
1717

18-
String getName();
18+
default String getTitleKey() {
19+
return getName();
20+
}
21+
22+
@Deprecated
23+
default String getName() {
24+
return getTitleKey();
25+
}
1926

2027
String getNamespace();
2128

src/main/java/turing/tmb/client/ScreenTMBRecipe.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public void render(int mx, int my, float partialTick) {
370370
GLRenderer.popFrame();
371371

372372
GLRenderer.modelM4f().translate(x, y + 4, 0);
373-
String text = I18n.getInstance().translateKey(category.getName());
373+
String text = I18n.getInstance().translateKey(category.getTitleKey());
374374
int textX = ((xSize / 2) - mc.font.stringWidth(text) / 2);
375375
drawStringShadow(mc.font, text, textX + 1, 1, 0xFFFFFF);
376376
if (mx >= x && mx < x + xSize && my >= y && my < y + mc.font.getFont().fontHeight()) {
@@ -473,7 +473,7 @@ private void renderTab(int x, int mx, int my, boolean selected, IRecipeCategory<
473473
category.getIcon().draw(TMB.getRuntime().getGuiHelper(), x + 10, y + 4);
474474
}
475475
if (mx >= x + 8 && my >= y && mx < x + 28 && my < y + 20) {
476-
tooltip = I18n.getInstance().translateKey(category.getName()) + "\n" + TextFormatting.formatted(category.getNamespace(), TextFormatting.BLUE);
476+
tooltip = I18n.getInstance().translateKey(category.getTitleKey()) + "\n" + TextFormatting.formatted(category.getNamespace(), TextFormatting.BLUE);
477477
}
478478
}
479479

src/main/java/turing/tmb/vanilla/BlastFurnaceRecipeCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public BlastFurnaceRecipeCategory(ITMBRuntime runtime, String title, ItemStack i
4444
}
4545

4646
@Override
47-
public String getName() {
47+
public String getTitleKey() {
4848
return title;
4949
}
5050

src/main/java/turing/tmb/vanilla/FurnaceRecipeCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public FurnaceRecipeCategory(ITMBRuntime runtime, String title, ItemStack icon)
4444
}
4545

4646
@Override
47-
public String getName() {
47+
public String getTitleKey() {
4848
return title;
4949
}
5050

src/main/java/turing/tmb/vanilla/MobInfoCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public MobInfoCategory() {
5252
}
5353

5454
@Override
55-
public String getName() {
55+
public String getTitleKey() {
5656
return "guidebook.section.mob";
5757
}
5858

src/main/java/turing/tmb/vanilla/ShapedCraftingRecipeCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void addInputs(ITMBRuntime runtime, ShapedCraftingRecipeTranslator recipe, IReci
4545
}
4646

4747
@Override
48-
public String getName() {
48+
public String getTitleKey() {
4949
return "tmb.category.shapedCrafting";
5050
}
5151
}

src/main/java/turing/tmb/vanilla/ShapelessCraftingRecipeCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void addInputs(ITMBRuntime runtime, ShapelessCraftingRecipeTranslator recipe, IR
4444
}
4545

4646
@Override
47-
public String getName() {
47+
public String getTitleKey() {
4848
return "tmb.category.shapelessCrafting";
4949
}
5050
}

0 commit comments

Comments
 (0)