diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/access/IBlobCache.java b/src/main/java/de/florianmichael/viafabricplus/injection/access/IBlobCache.java deleted file mode 100644 index 60f6d8713..000000000 --- a/src/main/java/de/florianmichael/viafabricplus/injection/access/IBlobCache.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus - * Copyright (C) 2021-2023 FlorianMichael/EnZaXD - * Copyright (C) 2023 RK_01/RaphiMC 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.injection.access; - -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -public interface IBlobCache { - - Map> viaFabricPlus$getPending(); -} diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java index 16a429bc6..cb74402e5 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/integration/MixinDebugHud.java @@ -19,26 +19,20 @@ package de.florianmichael.viafabricplus.injection.mixin.base.integration; -import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.ProtocolInfo; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import de.florianmichael.viafabricplus.fixes.tracker.JoinGameDataTracker; import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin; -import de.florianmichael.viafabricplus.injection.access.IBlobCache; import de.florianmichael.viafabricplus.injection.access.IChunkTracker; import de.florianmichael.viafabricplus.injection.access.IRakSessionCodec; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; -import de.florianmichael.viafabricplus.protocolhack.impl.provider.viabedrock.ViaFabricPlusBlobCacheProvider; import de.florianmichael.viafabricplus.settings.impl.GeneralSettings; import de.florianmichael.viafabricplus.util.ChatUtil; -import de.florianmichael.viafabricplus.util.StringUtil; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.DebugHud; import net.minecraft.util.Formatting; import net.raphimc.viabedrock.protocol.data.enums.bedrock.ServerMovementModes; -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; import net.raphimc.vialegacy.protocols.classic.protocolc0_28_30toc0_28_30cpe.storage.ExtensionProtocolMetadataStorage; @@ -122,16 +116,6 @@ public void addViaFabricPlusInformation(CallbackInfoReturnable> cir if (joinGameDataTracker != null) { information.add("World Seed: " + joinGameDataTracker.getSeed()); } - final BlobCache blobCache = userConnection.get(BlobCache.class); - if (blobCache != null) { - final var blobCacheProvider = (ViaFabricPlusBlobCacheProvider) Via.getManager().getProviders().get(BlobCacheProvider.class); - - final long totalSize = blobCacheProvider.getSize(); - final int blobCount = blobCacheProvider.getBlobs().size(); - final int pendingCount = ((IBlobCache) blobCache).viaFabricPlus$getPending().size(); - - information.add("Blob Cache: S: " + StringUtil.formatBytes(totalSize) + ", C: " + blobCount + ", P: " + pendingCount); - } final ChunkTracker chunkTracker = userConnection.get(ChunkTracker.class); if (chunkTracker != null) { final int subChunkRequests = ((IChunkTracker) chunkTracker).viaFabricPlus$getSubChunkRequests(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/viabedrock/MixinBlobCache.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/viabedrock/MixinBlobCache.java deleted file mode 100644 index a5bd2a60f..000000000 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/viabedrock/MixinBlobCache.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus - * Copyright (C) 2021-2023 FlorianMichael/EnZaXD - * Copyright (C) 2023 RK_01/RaphiMC 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.injection.mixin.viabedrock; - -import de.florianmichael.viafabricplus.injection.access.IBlobCache; -import net.raphimc.viabedrock.protocol.storage.BlobCache; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -@Mixin(value = BlobCache.class, remap = false) -public class MixinBlobCache implements IBlobCache { - - @Shadow - @Final - private Map> pending; - - @Override - public Map> viaFabricPlus$getPending() { - return pending; - } - -} diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viabedrock/ViaFabricPlusBlobCacheProvider.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viabedrock/ViaFabricPlusBlobCacheProvider.java deleted file mode 100644 index 8b27204db..000000000 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/provider/viabedrock/ViaFabricPlusBlobCacheProvider.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus - * Copyright (C) 2021-2023 FlorianMichael/EnZaXD - * Copyright (C) 2023 RK_01/RaphiMC 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.protocolhack.impl.provider.viabedrock; - -import net.raphimc.viabedrock.protocol.providers.BlobCacheProvider; - -import java.util.HashMap; -import java.util.Map; - -public class ViaFabricPlusBlobCacheProvider extends BlobCacheProvider { - - private final Map blobs = new HashMap<>(); - private long size; - - public ViaFabricPlusBlobCacheProvider() { - this.blobs.put(0L, new byte[0]); - } - - @Override - public byte[] addBlob(final long hash, final byte[] compressedBlob) { - synchronized (this.blobs) { - final byte[] previousBlob = this.blobs.put(hash, compressedBlob); - if (previousBlob != null) { // In case the server overwrites a blob - this.size -= previousBlob.length; - } - this.size += compressedBlob.length; - return previousBlob; - } - } - - @Override - public boolean hasBlob(final long hash) { - synchronized (this.blobs) { - return this.blobs.containsKey(hash); - } - } - - @Override - public byte[] getBlob(final long hash) { - synchronized (this.blobs) { - return this.blobs.get(hash); - } - } - - public Map getBlobs() { - return blobs; - } - - public long getSize() { - return this.size; - } - -} diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLLoader.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLLoader.java index 3ffff4dce..4de0349e6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLLoader.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/impl/viaversion/ViaFabricPlusVLLoader.java @@ -27,13 +27,11 @@ import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.provider.AckSequenceProvider; import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider; -import de.florianmichael.viafabricplus.protocolhack.impl.provider.viabedrock.ViaFabricPlusBlobCacheProvider; import de.florianmichael.viafabricplus.protocolhack.impl.provider.viabedrock.ViaFabricPlusNettyPipelineProvider; import de.florianmichael.viafabricplus.protocolhack.impl.provider.viabedrock.ViaFabricPlusTransferProvider; import de.florianmichael.viafabricplus.protocolhack.impl.provider.vialegacy.*; import de.florianmichael.viafabricplus.protocolhack.impl.provider.viaversion.*; import de.florianmichael.viafabricplus.settings.impl.GeneralSettings; -import net.raphimc.viabedrock.protocol.providers.BlobCacheProvider; import net.raphimc.viabedrock.protocol.providers.NettyPipelineProvider; import net.raphimc.viabedrock.protocol.providers.TransferProvider; import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.AlphaInventoryProvider; @@ -70,7 +68,6 @@ public void load() { } providers.use(NettyPipelineProvider.class, new ViaFabricPlusNettyPipelineProvider()); - providers.use(BlobCacheProvider.class, new ViaFabricPlusBlobCacheProvider()); providers.use(TransferProvider.class, new ViaFabricPlusTransferProvider()); } diff --git a/src/main/resources/viafabricplus.mixins.json b/src/main/resources/viafabricplus.mixins.json index 72d1ae6d0..aa192fd67 100644 --- a/src/main/resources/viafabricplus.mixins.json +++ b/src/main/resources/viafabricplus.mixins.json @@ -191,7 +191,6 @@ "fixes.viaversion.MixinWorldPackets1_17", "fixes.viaversion.MixinWorldPackets1_19", "viabedrock.MixinBedrockProtocol", - "viabedrock.MixinBlobCache", "viabedrock.MixinJoinPackets", "vialegacy.MixinExtensionProtocolMetadataStorage", "vialegacy.MixinViaLegacyConfig",