9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-06 15:52:03 +00:00

refactor(client-mod): 移除不必要的日志输出

This commit is contained in:
jhqwqmc
2025-03-24 17:54:55 +08:00
parent ac4b3c70e3
commit 310d23bd1d
2 changed files with 0 additions and 12 deletions

View File

@@ -52,32 +52,24 @@ public class YamlUtils {
public static Map<Identifier, Integer> loadMappingsAndAdditionalBlocks() throws IOException { public static Map<Identifier, Integer> loadMappingsAndAdditionalBlocks() throws IOException {
Path mappingPath = Path.of(CONFIG_DIR + "mappings.yml"); Path mappingPath = Path.of(CONFIG_DIR + "mappings.yml");
Path additionalYamlPath = Path.of(CONFIG_DIR + "additional-real-blocks.yml"); Path additionalYamlPath = Path.of(CONFIG_DIR + "additional-real-blocks.yml");
System.out.println("Loading mappings.yml and additional-real-blocks.yml...");
Map<String, String> blockStateMappings = loadConfig(mappingPath); Map<String, String> blockStateMappings = loadConfig(mappingPath);
System.out.println("Loaded " + blockStateMappings.size() + " block state mappings.");
validateBlockStateMappings(blockStateMappings); validateBlockStateMappings(blockStateMappings);
System.out.println("Validated block state mappings.");
Map<Identifier, Integer> blockTypeCounter = new LinkedHashMap<>(); Map<Identifier, Integer> blockTypeCounter = new LinkedHashMap<>();
Map<Integer, Integer> appearanceMapper = new HashMap<>(); Map<Integer, Integer> appearanceMapper = new HashMap<>();
System.out.println("Processing block state mappings...");
for (Map.Entry<String, String> entry : blockStateMappings.entrySet()) { for (Map.Entry<String, String> entry : blockStateMappings.entrySet()) {
processBlockStateMapping(entry, appearanceMapper, blockTypeCounter); processBlockStateMapping(entry, appearanceMapper, blockTypeCounter);
} }
System.out.println("Processed " + blockTypeCounter.size() + " block state mappings.");
Map<String, Integer> additionalYaml = loadConfig(additionalYamlPath); Map<String, Integer> additionalYaml = loadConfig(additionalYamlPath);
System.out.println("Loaded " + additionalYaml.size() + " additional real blocks.");
return buildRegisteredRealBlockSlots(blockTypeCounter, additionalYaml); return buildRegisteredRealBlockSlots(blockTypeCounter, additionalYaml);
} }
private static void validateBlockStateMappings(Map<String, String> blockStateMappings) { private static void validateBlockStateMappings(Map<String, String> blockStateMappings) {
Map<String, String> temp = new HashMap<>(blockStateMappings); Map<String, String> temp = new HashMap<>(blockStateMappings);
System.out.println("Validating block state mappings...");
for (Map.Entry<String, String> entry : temp.entrySet()) { for (Map.Entry<String, String> entry : temp.entrySet()) {
String state = entry.getValue(); String state = entry.getValue();
blockStateMappings.remove(state); blockStateMappings.remove(state);
} }
System.out.println("Validated " + blockStateMappings.size() + " block state mappings.");
} }
private static void processBlockStateMapping( private static void processBlockStateMapping(
@@ -114,14 +106,12 @@ public class YamlUtils {
private static LinkedHashMap<Identifier, Integer> buildRegisteredRealBlockSlots(Map<Identifier, Integer> counter, Map<String, Integer> additionalYaml) { private static LinkedHashMap<Identifier, Integer> buildRegisteredRealBlockSlots(Map<Identifier, Integer> counter, Map<String, Integer> additionalYaml) {
LinkedHashMap<Identifier, Integer> map = new LinkedHashMap<>(); LinkedHashMap<Identifier, Integer> map = new LinkedHashMap<>();
System.out.println("Building registered real block slots...");
for (Map.Entry<Identifier, Integer> entry : counter.entrySet()) { for (Map.Entry<Identifier, Integer> entry : counter.entrySet()) {
String id = entry.getKey().toString(); String id = entry.getKey().toString();
Integer additionalStates = additionalYaml.get(id); Integer additionalStates = additionalYaml.get(id);
int internalIds = entry.getValue() + (additionalStates != null ? additionalStates : 0); int internalIds = entry.getValue() + (additionalStates != null ? additionalStates : 0);
map.put(entry.getKey(), internalIds); map.put(entry.getKey(), internalIds);
} }
System.out.println("Built " + map.size() + " registered real block slots.");
return map; return map;
} }
} }

View File

@@ -33,7 +33,6 @@ public class CraftEngineFabricMod implements ModInitializer {
YamlUtils.ensureConfigFile("mappings.yml"); YamlUtils.ensureConfigFile("mappings.yml");
YamlUtils.ensureConfigFile("config.yml"); YamlUtils.ensureConfigFile("config.yml");
Map<Identifier, Integer> map = YamlUtils.loadMappingsAndAdditionalBlocks(); Map<Identifier, Integer> map = YamlUtils.loadMappingsAndAdditionalBlocks();
System.out.println("Loaded " + map.size() + " additional real blocks.");
for (Map.Entry<Identifier, Integer> entry : map.entrySet()) { for (Map.Entry<Identifier, Integer> entry : map.entrySet()) {
Identifier replacedBlockId = entry.getKey(); Identifier replacedBlockId = entry.getKey();
for (int i = 0; i < entry.getValue(); i++) { for (int i = 0; i < entry.getValue(); i++) {
@@ -44,7 +43,6 @@ public class CraftEngineFabricMod implements ModInitializer {
); );
} }
} }
System.out.println("Registered " + map.size() + " additional real blocks.");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }