diff --git a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java
index d2a440b4..e4e09a49 100644
--- a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java
+++ b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java
@@ -26,6 +26,7 @@ import de.florianmichael.viafabricplus.definition.c0_30.command.ClassicProtocolC
import de.florianmichael.viafabricplus.definition.v1_8_x.ArmorPointsDefinition;
import de.florianmichael.viafabricplus.event.FinishMinecraftLoadCallback;
import de.florianmichael.viafabricplus.event.PreLoadCallback;
+import de.florianmichael.viafabricplus.information.InformationSystem;
import de.florianmichael.viafabricplus.settings.SettingsSystem;
import de.florianmichael.viafabricplus.vialoadingbase.ViaLoadingBaseStartup;
@@ -36,10 +37,12 @@ public class ViaFabricPlus {
public final static ViaFabricPlus INSTANCE = new ViaFabricPlus();
private final SettingsSystem settingsSystem = new SettingsSystem();
+ private final InformationSystem informationSystem = new InformationSystem();
public void init() {
FinishMinecraftLoadCallback.EVENT.register(() -> {
settingsSystem.init();
+ informationSystem.init();
// General definitions
PackFormatsDefinition.load();
@@ -60,4 +63,8 @@ public class ViaFabricPlus {
public SettingsSystem getSettingsSystem() {
return settingsSystem;
}
+
+ public InformationSystem getInformationSystem() {
+ return informationSystem;
+ }
}
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/AbstractInformationGroup.java b/src/main/java/de/florianmichael/viafabricplus/information/AbstractInformationGroup.java
new file mode 100644
index 00000000..538ad890
--- /dev/null
+++ b/src/main/java/de/florianmichael/viafabricplus/information/AbstractInformationGroup.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
+ * Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.florianmichael.viafabricplus.information;
+
+import com.viaversion.viaversion.api.connection.UserConnection;
+import de.florianmichael.vialoadingbase.platform.ProtocolRange;
+
+import java.util.List;
+
+public abstract class AbstractInformationGroup {
+ private final ProtocolRange protocolRange;
+
+ public AbstractInformationGroup(final ProtocolRange protocolRange) {
+ this.protocolRange = protocolRange;
+ }
+
+ public abstract void applyInformation(final UserConnection userConnection, final List output);
+
+ public ProtocolRange getProtocolRange() {
+ return protocolRange;
+ }
+}
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/InformationSystem.java b/src/main/java/de/florianmichael/viafabricplus/information/InformationSystem.java
new file mode 100644
index 00000000..5b23ad42
--- /dev/null
+++ b/src/main/java/de/florianmichael/viafabricplus/information/InformationSystem.java
@@ -0,0 +1,51 @@
+/*
+ * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
+ * Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.florianmichael.viafabricplus.information;
+
+import de.florianmichael.viafabricplus.information.impl.*;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class InformationSystem {
+ private final List groups = new ArrayList<>();
+
+ public void init() {
+ addGroup(
+ new GeneralInformation(),
+
+ new BedrockInformation(),
+
+ new V1_7_10Information(),
+ new V1_5_2Information(),
+ new V1_2_4_5Information(),
+ new V1_1Information(),
+
+ new C0_30CPEInformation()
+ );
+ }
+
+ public void addGroup(final AbstractInformationGroup... groups) {
+ Collections.addAll(this.groups, groups);
+ }
+
+ public List getGroups() {
+ return groups;
+ }
+}
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java b/src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java
new file mode 100644
index 00000000..77068fda
--- /dev/null
+++ b/src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java
@@ -0,0 +1,84 @@
+/*
+ * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
+ * Copyright (C) 2021-2023 FlorianMichael/MrLookAtMe (EnZaXD) and contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.florianmichael.viafabricplus.information.impl;
+
+import com.viaversion.viaversion.api.connection.UserConnection;
+import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.util.ScreenUtil;
+import de.florianmichael.vialoadingbase.platform.ProtocolRange;
+import net.lenni0451.reflect.stream.RStream;
+import net.lenni0451.reflect.stream.field.FieldStream;
+import net.raphimc.viabedrock.api.BedrockProtocolVersion;
+import net.raphimc.viabedrock.api.chunk.BedrockChunk;
+import net.raphimc.viabedrock.api.model.entity.Entity;
+import net.raphimc.viabedrock.protocol.storage.BlobCache;
+import net.raphimc.viabedrock.protocol.storage.ChunkTracker;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class BedrockInformation extends AbstractInformationGroup {
+
+ public BedrockInformation() {
+ super(ProtocolRange.singleton(BedrockProtocolVersion.bedrockLatest));
+ }
+
+ @Override
+ public void applyInformation(UserConnection userConnection, List output) {
+ final BlobCache blobCache = userConnection.get(BlobCache.class);
+ if (blobCache != null) {
+ final long totalSize = blobCache.getTotalSize();
+ final int blobCount = blobCache.getBlobCount();
+ final int pendingCount = blobCache.getPendingCount();
+
+ if (totalSize != 0 || blobCount != 0 || pendingCount != 0) {
+ output.add("Blob Cache:");
+ }
+
+ if (totalSize != 0) output.add("Total size: " + ScreenUtil.formatBytes(totalSize));
+ if (blobCount != 0) output.add("Blob count: " + blobCount);
+ if (pendingCount != 0) output.add("Pending count: " + pendingCount);
+ }
+ final ChunkTracker chunkTracker = userConnection.get(ChunkTracker.class);
+ if (chunkTracker != null) {
+ final FieldStream fields = RStream.of(chunkTracker).fields();
+ final int subChunkRequests = fields.by("subChunkRequests").>get().size();
+ final int pendingSubChunks = fields.by("pendingSubChunks").>get().size();
+ final int chunks = fields.by("chunks").