11package com .altnoir .mia .datagen ;
22
33import com .altnoir .mia .MIA ;
4- import com .altnoir .mia .client .gui .screens .ArtifactSmithingTableScreen ;
5- import com .altnoir .mia .common .block .ArtifactSmithingTableBlock ;
6- import com .altnoir .mia .core .event .client .ClientCurseEvent ;
7- import com .altnoir .mia .core .event .client .ClientTooltipEvent ;
8- import com .altnoir .mia .core .event .client .KeyArrowEvent ;
94import com .altnoir .mia .init .*;
10- import com .altnoir .mia .common .item .abs .AbsArtifactBundle ;
11- import com .altnoir .mia .common .item .abs .IArtifactItem ;
12- import com .altnoir .mia .common .item .abs .IArtifactSkill ;
13- import com .altnoir .mia .common .item .abs .IEArtifact ;
5+ import com .altnoir .mia .util .FilesHelper ;
146import com .altnoir .mia .worldgen .biome .MiaBiomes ;
157import net .minecraft .core .registries .BuiltInRegistries ;
168import net .minecraft .data .PackOutput ;
@@ -31,83 +23,27 @@ public MiaLangProvider(PackOutput output) {
3123
3224 @ Override
3325 protected void addTranslations () {
34- add ("itemgroup.mia" , "Memento In Abyss" );
35- add ("itemgroup.mia_artifact" , "Memento In Abyss: Artifact" );
36-
37- //Tooltip start
38- add (ClientTooltipEvent .TOOLTIP_HOLD_SHIFT , "Hold [%s] to show details" );
39- add (ClientTooltipEvent .TOOLTIP_ATTRIBUTE_MODIFIER , "%s %s" );
40- add (ClientTooltipEvent .TOOLTIP_MODIFIERS_ARTIFACT_MATERIAL , "When Applying Artifact: " );
41-
42- add ("tooltip.mia.whistle.level" , "Whistle Level: %s" );
43- add ("tooltip.mia.whistle.capacity" , "Capacity: %s" );
44- add ("tooltip.mia.item.red_whistle" , "Red Whistles are novice cave raiders allowed only in the Abyss’s first layer." );
45-
46- add (IArtifactSkill .TOOLTIP_SKILL_COOLDOWN_VALUE , "Cooldown: %s" );
47-
48- add (IArtifactItem .TOOLTIP_ARTIFACT_WEIGHT , "Weight: %s" );
49- add (IArtifactItem .TOOLTIP_ARTIFACT_GRADE_S , "S" );
50- add (IArtifactItem .TOOLTIP_ARTIFACT_GRADE_A , "A" );
51- add (IArtifactItem .TOOLTIP_ARTIFACT_GRADE_B , "B" );
52- add (IArtifactItem .TOOLTIP_ARTIFACT_GRADE_C , "C" );
53- add (IArtifactItem .TOOLTIP_ARTIFACT_GRADE_D , "D" );
54- add (IArtifactItem .TOOLTIP_ARTIFACT_GRADE_UNKNOWN , "Unknown" );
55-
56- add (IEArtifact .TOOLTIP_ARTIFACT_LEVEL , "Echo: %s/%s" );
57- add (IEArtifact .TOOLTIP_ARTIFACT_MAX , "Echo: MAX" );
58- add (AbsArtifactBundle .TOOLTIP_ARTIFACT_BUNDLE_CAPACITY , "Artifact Capacity: %s" );
59-
60- add ("tooltip.mia.description.abyss_compass" , "It will point the way toward the abyss." );
61- //Tooltip end
62-
63- // Attributes
64- add ("attribute.name.generic.critical_hit" , "Critical Hit" );
65- add ("attribute.name.generic.critical_hit_damage" , "Critical Hit Damage" );
66-
67- // Container
68- add (ArtifactSmithingTableBlock .TITLE , "Artifact Smithing Table" );
69-
70- // Skill start
71- add (KeyArrowEvent .SKILL_UNSKILL , "Unskill" );
72- add (KeyArrowEvent .SKILL_COMBO_SKILLS , "Combo Skills" );
73- add (KeyArrowEvent .SKILL_COOLDOWN , "Cooldown..." );
74- add (KeyArrowEvent .SKILL_COOLDOWN_TIME , "Cooldown T-" );
75- add (KeyArrowEvent .SKILL_MINUTE , ":" );
76- add (KeyArrowEvent .SKILL_SECOND , " " );
77- // Skill end
78-
79- // kEY start
80- add (MiaKeyBinding .KEY_CATEGORIES_MIA , "Memento In Abyss" );
81- add (MiaKeyBinding .KEY_SKILL_DIAL , "Skill Dial" );
82- // KEY end
83-
84- //GUI start
85- add (ClientCurseEvent .GUI_DISCONNECT , "Quit?" );
86- //GUI end
87-
88- //Biome start
89- addBiome (MiaBiomes .THE_ABYSS , "The Abyss" );
90- addBiome (MiaBiomes .ABYSS_PLAINS , "Abyss Plains" );
91- addBiome (MiaBiomes .SKYFOG_FOREST , "Skyfog Forest" );
92- addBiome (MiaBiomes .PRASIOLITE_CAVES , "Prasiolite Caves" );
93- addBiome (MiaBiomes .ABYSS_LUSH_CAVES , "Abyss Lush Caves" );
94- addBiome (MiaBiomes .ABYSS_DRIPSTONE_CAVES , "Abyss Dripstone Caves" );
95-
96- addBiome (MiaBiomes .TEMPTATION_FOREST , "Temptation Forest" );
97- //Biome end
26+ addDefault ("interface" );
27+ addDefault ("tooltip" );
28+ addDefault ("ponder" );
29+
30+ MiaBiomes .BIOMES .forEach (biome -> {
31+ add ("biome.mia." + biome .location ().getPath (), formatName (biome ));
32+ });
33+
34+ MiaPaintingVariants .PAINTING_VARIANTS .forEach (paintingVariant -> {
35+ add ("painting.mia." + paintingVariant .location ().getPath () + ".title" , formatName (paintingVariant .location ().getPath ()));
36+ add ("painting.mia." + paintingVariant .location ().getPath () + ".author" , "Memento In Abyss" );
37+ });
9838
9939 MiaItems .ITEMS .getEntries ().stream ()
10040 .map (DeferredHolder ::get )
10141 .filter (item -> !(item instanceof BlockItem ))
102- .forEach (item -> {
103- add (item , formatName (BuiltInRegistries .ITEM .getKey (item ).getPath ()));
104- });
42+ .forEach (item -> add (item , formatName (BuiltInRegistries .ITEM .getKey (item ).getPath ())));
10543
10644 MiaBlocks .BLOCKS .getEntries ().stream ()
10745 .map (DeferredHolder ::get )
108- .forEach (block -> {
109- add (block , formatName (BuiltInRegistries .BLOCK .getKey (block ).getPath ()));
110- });
46+ .forEach (block -> add (block , formatName (BuiltInRegistries .BLOCK .getKey (block ).getPath ())));
11147
11248 MiaPotions .POTIONS .getEntries ().forEach (holder -> {
11349 String name = holder .getId ().getPath ();
@@ -118,97 +54,13 @@ protected void addTranslations() {
11854 String name = holder .getId ().getPath ();
11955 add ("stat.mia.interact_with_" + name , "Interactions with " + formatName (name ));
12056 });
121- // Painting Variant
122- addPainting (MiaPaintingVariants .ABYSS_MAP );
123- addPainting (MiaPaintingVariants .THE_ABYSS );
124- addPainting (MiaPaintingVariants .THE_ABYSS_2 );
125- addPainting (MiaPaintingVariants .FOSSIL_TREE );
126- addPainting (MiaPaintingVariants .FORTITUDE_FLOWER );
127-
128- // Sounds start
129- add (MiaSoundsProvider .ABYSS_PORTAL_AMBIENT , "Abyss Portal: Ambient" );
130- add (MiaSoundsProvider .ABYSS_PORTAL_TRAVEL , "Abyss Portal: Travel" );
131- // Sounds end
132-
133- //Config start
134- add ("mia.configuration.title" , "Memento In Abyss Configuration" );
135-
136- // 通用配置
137- add ("mia.configuration.abyss_radius" , "Abyss Radius Value" );
138- add ("mia.configuration.abyss_radius.tooltip" , "Setting The Abyss Radius" );
139-
140- // 服务端配置
141- add ("mia.configuration.curse" , "Enable Curse" );
142- add ("mia.configuration.curse.tooltip" , "Whether to enable the Curse" );
143- add ("mia.configuration.curse_god" , "Curse the Creative and Spectator" );
144- add ("mia.configuration.curse_god.tooltip" , "Whether to Curse the Creative and Spectator" );
145-
146- add ("mia.configuration.cave_explorer_beacon" , "Cave Explorer Beacon" );
147- add ("mia.configuration.cave_explorer_beacon.tooltip" , "Cave Explorer Beacon Configuration" );
148- add ("mia.configuration.cave_explorer_beacon_horizontal" , "Horizontal Range" );
149- add ("mia.configuration.cave_explorer_beacon_horizontal.tooltip" , "Setting The Cave Explorer Beacon Horizontal Range" );
150- add ("mia.configuration.cave_explorer_beacon_vertical" , "Vertical Range" );
151- add ("mia.configuration.cave_explorer_beacon_vertical.tooltip" , "Setting The Cave Explorer Beacon Vertical Range" );
152- add ("mia.configuration.cave_explorer_beacon_max_vertical" , "Max Vertical Range" );
153- add ("mia.configuration.cave_explorer_beacon_max_vertical.tooltip" , "Setting The Cave Explorer Beacon Max Vertical" );
154-
155- // 客户端配置
156- add ("mia.configuration.curse_icon_position" , "Curse Icon Position" );
157- add ("mia.configuration.curse_icon_position.tooltip" , "Switch Curse Icon Position" );
158- add ("mia.configuration.curse_icon_position.middle" , "Middle" );
159- add ("mia.configuration.curse_icon_position.right" , "Right" );
160- add ("mia.configuration.curse_icon_position.hidden" , "Hidden" );
161- add ("mia.configuration.disconnect_button_state" , "Disconnect Button State" );
162- add ("mia.configuration.disconnect_button_state.tooltip" , "Adjust the Disconnect Button" );
163- add ("mia.configuration.disconnect_button_state.default" , "Default" );
164- add ("mia.configuration.disconnect_button_state.disabled" , "Disabled" );
165- add ("mia.configuration.disconnect_button_state.hidden" , "Hidden" );
166-
167- add ("mia.configuration.hook" , "Hook" );
168- add ("mia.configuration.hook.tooltip" , "Hook Configuration" );
169-
170- add ("mia.configuration.hook_max_distance" , "Max Hook Distance" );
171- add ("mia.configuration.hook_max_distance.tooltip" , "Maximum hook distance in blocks" );
172- add ("mia.configuration.hook_stop_distance" , "Hook Pull Stop Distance" );
173- add ("mia.configuration.hook_stop_distance.tooltip" , "Distance at which the hook stops pulling the player" );
174- add ("mia.configuration.hook_shoot_velocity" , "Hook Shoot Velocity" );
175- add ("mia.configuration.hook_shoot_velocity.tooltip" , "Hook shoot velocity" );
176- add ("mia.configuration.hook_pull_velocity" , "Hook Pull Velocity" );
177- add ("mia.configuration.hook_pull_velocity.tooltip" , "Base pull velocity" );
178- add ("mia.configuration.hook_retract_velocity" , "Hook Retract Velocity" );
179- add ("mia.configuration.hook_retract_velocity.tooltip" , "Hook retract velocity" );
180- add ("mia.configuration.hook_retract_distance" , "Hook Retract Distance" );
181- add ("mia.configuration.hook_retract_distance.tooltip" , "Distance at which the hook automatically retracts" );
182- add ("mia.configuration.hook_jump_boost" , "Jump Boost Multiplier" );
183- add ("mia.configuration.hook_jump_boost.tooltip" , "Jump boost multiplier when using hook" );
184-
185- add ("mia.configuration.auto_hook" , "auto hook" );
186- add ("mia.configuration.auto_hook.tooltip" , "Whether to enable auto hook" );
187- //Config end
18857
18958 // Tags start
19059 add ("tag.item.curios.whistle" , "Whistle" );
19160 add ("tag.item.mia.fossilized_logs" , "Fossilized Logs" );
19261 add ("tag.item.mia.stripped_fossilized_logs" , "Stripped Fossilized Logs" );
19362 add ("tag.item.mia.skyfog_logs" , "Skyfog Logs" );
19463 // Tags end
195-
196- add ("pack.mia.music_pack.name" , "Memento In Abyss: Music Pack" );
197-
198- //Compat start
199- add ("curios.identifier.whistle" , "Whistle" );
200- add ("curios.modifiers.whistle" , "Red Whistle Attributes" );
201- add ("emi.category.mia.lamp_tube" , "Laser Catalysis" );
202- //Compat end
203- }
204-
205- private void addPainting (ResourceKey <PaintingVariant > key ) {
206- add ("painting.mia." + key .location ().getPath () + ".title" , formatName (key .location ().getPath ()));
207- add ("painting.mia." + key .location ().getPath () + ".author" , "Memento In Abyss" );
208- }
209-
210- private void addBiome (ResourceKey <Biome > biome , String name ) {
211- add ("biome.mia." + biome .location ().getPath (), name );
21264 }
21365
21466 private void addPotions (String key ) {
@@ -221,6 +73,30 @@ private void addPotions(String key) {
22173 add (key3 , "Lingering Potion of " + formatName (key ));
22274 }
22375
76+ private void addDefault (String fileName ) {
77+ var path = "assets/mia/lang/default/" + fileName + ".json" ;
78+ var jsonElement = FilesHelper .loadJsonResource (path );
79+ if (jsonElement == null ) {
80+ throw new IllegalStateException (String .format ("Could not find default lang file: %s" , path ));
81+ }
82+ var jsonObject = jsonElement .getAsJsonObject ();
83+ for (var entry : jsonObject .entrySet ()) {
84+ var key = entry .getKey ();
85+ var value = entry .getValue ().getAsString ();
86+ add (key , value );
87+ }
88+ }
89+
90+ private String formatName (ResourceKey <Biome > key ) {
91+ var path = key .location ().getPath ();
92+
93+ int index = path .lastIndexOf ('/' );
94+ if (index != -1 ) {
95+ path = path .substring (index + 1 );
96+ }
97+ return formatName (path );
98+ }
99+
224100 private String formatName (String name ) {
225101 return Arrays .stream (name .split ("_" ))
226102 .filter (word -> !word .isEmpty ())
0 commit comments