|
37 | 37 | import org.maxgamer.quickshop.util.MsgUtil; |
38 | 38 | import org.maxgamer.quickshop.util.ReflectFactory; |
39 | 39 | import org.maxgamer.quickshop.util.Util; |
40 | | -import org.maxgamer.quickshop.util.mojangapi.*; |
| 40 | +import org.maxgamer.quickshop.util.mojangapi.MojangAPI; |
| 41 | +import org.maxgamer.quickshop.util.mojangapi.MojangApiBmclApiMirror; |
| 42 | +import org.maxgamer.quickshop.util.mojangapi.MojangApiMcbbsApiMirror; |
| 43 | +import org.maxgamer.quickshop.util.mojangapi.MojangApiMirror; |
| 44 | +import org.maxgamer.quickshop.util.mojangapi.MojangApiOfficialMirror; |
41 | 45 |
|
42 | 46 | import java.io.File; |
43 | 47 | import java.io.FileInputStream; |
|
46 | 50 | import java.nio.charset.StandardCharsets; |
47 | 51 | import java.nio.file.Files; |
48 | 52 | import java.util.Optional; |
49 | | -import java.util.concurrent.*; |
| 53 | +import java.util.concurrent.Callable; |
| 54 | +import java.util.concurrent.ExecutionException; |
| 55 | +import java.util.concurrent.FutureTask; |
| 56 | +import java.util.concurrent.TimeUnit; |
| 57 | +import java.util.concurrent.TimeoutException; |
50 | 58 | import java.util.concurrent.atomic.AtomicBoolean; |
51 | 59 | import java.util.concurrent.atomic.AtomicReference; |
52 | 60 | import java.util.logging.Level; |
@@ -134,10 +142,38 @@ public void load() { |
134 | 142 | if (!lang.isPresent()) { |
135 | 143 | return super.getItem(material); |
136 | 144 | } |
137 | | - JsonElement element = lang.get().get("item.minecraft." + material.name().toLowerCase()); |
| 145 | + JsonElement element; |
| 146 | + String name = material.name().toLowerCase(); |
| 147 | + boolean isSmithingTemplate = false; |
| 148 | + boolean hasDesc = false; |
| 149 | + if (name.endsWith("_banner_pattern") || name.startsWith("music_disc")) { |
| 150 | + hasDesc = true; |
| 151 | + element = lang.get().get("item.minecraft." + name); |
| 152 | + } else if (name.endsWith("_armor_trim_smithing_template")) { |
| 153 | + isSmithingTemplate = true; |
| 154 | + element = lang.get().get("trim_pattern.minecraft." + name.substring(0, name.length() - "_armor_trim_smithing_template".length())); |
| 155 | + } else if (name.endsWith("_upgrade_smithing_template")) { |
| 156 | + isSmithingTemplate = true; |
| 157 | + element = lang.get().get("upgrade.minecraft." + name.substring(0, name.length() - "_smithing_template".length())); |
| 158 | + } else { |
| 159 | + element = lang.get().get("item.minecraft." + name); |
| 160 | + } |
138 | 161 | if (element == null) { |
139 | 162 | return getBlock(material); |
140 | 163 | } else { |
| 164 | + if (isSmithingTemplate) { |
| 165 | + JsonElement prefix = lang.get().get("item.minecraft.smithing_template"); |
| 166 | + if (prefix != null) { |
| 167 | + return prefix.getAsString() + ":" + element.getAsString(); |
| 168 | + } |
| 169 | + } |
| 170 | + if (hasDesc) { |
| 171 | + JsonElement desc = lang.get().get("item.minecraft." + name + ".desc"); |
| 172 | + if (desc != null) { |
| 173 | + return element.getAsString() + ":" + desc.getAsString(); |
| 174 | + } |
| 175 | + } |
| 176 | + |
141 | 177 | return element.getAsString(); |
142 | 178 | } |
143 | 179 | } |
|
0 commit comments