Skip to content

Commit

Permalink
chore: added standard methods to get dimension key translations
Browse files Browse the repository at this point in the history
And default translations for vanilla dims plus a couple modded ones
  • Loading branch information
desht committed Jul 23, 2024
1 parent ec6c646 commit 6c0d32c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level;

public class TextComponentUtils {
@ExpectPlatform
Expand All @@ -15,4 +18,12 @@ public static Component hotkeyTooltip(String txt) {
.append(Component.literal(txt).withStyle(ChatFormatting.GRAY))
.append(Component.literal("]").withStyle(ChatFormatting.DARK_GRAY));
}

public static Component translatedDimension(ResourceKey<Level> key) {
return translatedDimension(key.location());
}

public static Component translatedDimension(ResourceLocation dimId) {
return Component.translatableWithFallback(dimId.toLanguageKey("dimension"), dimId.toString());
}
}
7 changes: 6 additions & 1 deletion common/src/main/resources/assets/ftblibrary/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,10 @@
"ftblibrary.panel.position.right": "Right",
"ftblibrary.panel.position.bottom_left": "Bottom Left",
"ftblibrary.panel.position.bottom": "Bottom",
"ftblibrary.panel.position.bottom_right": "Bottom Right"
"ftblibrary.panel.position.bottom_right": "Bottom Right",
"dimension.minecraft.overworld": "Overworld",
"dimension.minecraft.the_nether": "The Nether",
"dimension.minecraft.the_end": "The End",
"dimension.hyperbox.hyperbox": "Hyperbox",
"dimension.ae2.spatial_storage": "AE2 Spatial Storage"
}

0 comments on commit 6c0d32c

Please sign in to comment.