From 0e44fbfb4b887346e2f053e3b735214ee74257a7 Mon Sep 17 00:00:00 2001
From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com>
Date: Wed, 22 Mar 2023 15:23:57 +0100
Subject: [PATCH] Updated Via*
---
.github/USAGE.md | 2 +-
.../information/impl/BedrockInformation.java | 12 ++--
.../access/IPlayerPositionLookS2CPacket.java | 23 -------
.../injection/mixin/bridge/MixinDebugHud.java | 4 +-
.../MixinClientPlayNetworkHandler.java | 10 ---
.../MixinPlayerPositionLookS2CPacket.java | 48 -------------
.../MixinEntityPackets.java | 55 ---------------
.../protocolhack/ProtocolHack.java | 8 ++-
.../ViaFabricPlusBlobCacheProvider.java | 68 +++++++++++++++++++
src/main/resources/viafabricplus.mixins.json | 2 -
10 files changed, 86 insertions(+), 146 deletions(-)
delete mode 100644 src/main/java/de/florianmichael/viafabricplus/injection/access/IPlayerPositionLookS2CPacket.java
delete mode 100644 src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/packet/MixinPlayerPositionLookS2CPacket.java
delete mode 100644 src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/protocol1_19_4to1_19_3/MixinEntityPackets.java
create mode 100644 src/main/java/de/florianmichael/viafabricplus/protocolhack/provider/viabedrock/ViaFabricPlusBlobCacheProvider.java
diff --git a/.github/USAGE.md b/.github/USAGE.md
index 0d951044..3574a5e2 100644
--- a/.github/USAGE.md
+++ b/.github/USAGE.md
@@ -1,4 +1,4 @@
-## Settings and GUI
+# Settings and GUI
In the multiplayer screen you will find the ViaFabricPlus button in the upper left corner by default, it is the main button,
click on it, and you will see the Protocol selection, there you can choose the Minecraft version you want to connect to,
in the upper left corner you can go to the Settings.
diff --git a/src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java b/src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java
index 11165442..fdfb888a 100644
--- a/src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java
+++ b/src/main/java/de/florianmichael/viafabricplus/information/impl/BedrockInformation.java
@@ -17,10 +17,12 @@
*/
package de.florianmichael.viafabricplus.information.impl;
+import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.viafabricplus.definition.bedrock.storage.JoinGameStorage;
import de.florianmichael.viafabricplus.definition.bedrock.ModelFormats;
import de.florianmichael.viafabricplus.information.AbstractInformationGroup;
+import de.florianmichael.viafabricplus.protocolhack.provider.viabedrock.ViaFabricPlusBlobCacheProvider;
import de.florianmichael.viafabricplus.util.ScreenUtil;
import de.florianmichael.vialoadingbase.platform.ProtocolRange;
import net.lenni0451.reflect.stream.RStream;
@@ -28,6 +30,7 @@ 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.providers.BlobCacheProvider;
import net.raphimc.viabedrock.protocol.storage.BlobCache;
import net.raphimc.viabedrock.protocol.storage.ChunkTracker;
import net.raphimc.viabedrock.protocol.storage.GameSessionStorage;
@@ -35,6 +38,7 @@ import net.raphimc.viabedrock.protocol.storage.GameSessionStorage;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.CompletableFuture;
public class BedrockInformation extends AbstractInformationGroup {
@@ -44,11 +48,11 @@ public class BedrockInformation extends AbstractInformationGroup {
@Override
public void applyInformation(UserConnection userConnection, List output) {
- final BlobCache blobCache = userConnection.get(BlobCache.class);
+ final ViaFabricPlusBlobCacheProvider blobCache = (ViaFabricPlusBlobCacheProvider) Via.getManager().getProviders().get(BlobCacheProvider.class);
if (blobCache != null) {
- final long totalSize = blobCache.getTotalSize();
- final int blobCount = blobCache.getBlobCount();
- final int pendingCount = blobCache.getPendingCount();
+ final long totalSize = blobCache.getSize();
+ final int blobCount = blobCache.getBlobs().size();
+ final int pendingCount = RStream.of(userConnection.get(BlobCache.class)).fields().by("pending").