Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interface terminal localization #522

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {

private static final int OFFSET_X = 21;
private static final int MAGIC_HEIGHT_NUMBER = 52 + 99;
private static final String MOLECULAR_ASSEMBLER = "molecular assembler";
private static final String MOLECULAR_ASSEMBLER = "tile.appliedenergistics2.molecular_assembler";

private final boolean jeiEnabled;
private final int jeiButtonPadding;
Expand Down Expand Up @@ -536,7 +536,8 @@ private void refreshList() {
continue;
}
// Exit if molecular assembler filter is on and this is not a molecular assembler
if (onlyMolecularAssemblers && !entry.getName().toLowerCase().contains(MOLECULAR_ASSEMBLER)) {
// Forge documantation said unlocalized name shouldn't be use for logic, so we might need a better way......
if (onlyMolecularAssemblers && !entry.getUnlocalizedName().equals(MOLECULAR_ASSEMBLER)) {
cachedSearch.remove(entry);
continue;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/appeng/client/me/ClientDCInternalInv.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public String getName() {
return s;
}

public String getUnlocalizedName() {
return this.unlocalizedName;
}

@Override
public int compareTo(@Nonnull final ClientDCInternalInv o) {
return Long.compare(this.sortBy, o.sortBy);
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/appeng/helpers/DualityInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,21 @@ public String getTermName() {
}

if (what.getItem() != Items.AIR) {
return what.getItem().getItemStackDisplayName(what);
/* getTranslationKey() and getUnlocalizedNameInefficiently() have different return values in some mod
*
* For small item output of a formed machine in mod Modular Machinery Community Edition.
* getTranslationKey() returns "tile.modularmachinery.blockinputbus"
* getUnlocalizedNameInefficiently() return "tile.modularmachinery.blockinputbus.small"
* Because modular machinery community edition overides getUnlocalizedNameInefficiently()
*
* For the Thermal Expansion
* getTranslationKey() returns complete key ending with ".name".
* getUnlocalizedNameInefficiently() returns localized name
* Because CoFH Core overrides method getTranslationKey()
*
* Waiting MMCE overrides getTranslationKey
*/
return what.getItem().getTranslationKey(what);
}

final Item item = Item.getItemFromBlock(directedBlock);
Expand Down