9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-22 00:19:17 +00:00

perf(network): 优化数据包的处理逻辑

This commit is contained in:
jhqwqmc
2025-03-24 17:50:41 +08:00
parent 6e91b3f8cf
commit ac4b3c70e3

View File

@@ -45,19 +45,12 @@ public class PacketConsumers {
public static void init(Map<Integer, Integer> map, int registrySize) {
mappings = new int[registrySize];
Arrays.fill(mappings, -1);
for (int i = 0; i < registrySize; i++) {
mappings[i] = i;
}
mappingsMOD = Arrays.copyOf(mappings, registrySize);
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
mappings[entry.getKey()] = entry.getValue();
}
mappingsMOD = new int[registrySize];
Arrays.fill(mappingsMOD, -1);
for (int i = 0; i < registrySize; i++) {
mappingsMOD[i] = i;
}
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
if (BlockStateUtils.isVanillaBlock(entry.getKey())) {
mappingsMOD[entry.getKey()] = entry.getValue();
}