Removed BlobCache override

This commit is contained in:
RaphiMC 2023-12-27 22:32:33 +01:00
parent 49ec4638a8
commit f8cc29698c
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
6 changed files with 0 additions and 161 deletions

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
package de.florianmichael.viafabricplus.injection.access;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
public interface IBlobCache {
Map<Long, CompletableFuture<byte[]>> viaFabricPlus$getPending();
}

View File

@ -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.JoinGameTracker;
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 abstract class MixinDebugHud {
if (joinGameTracker != null) {
information.add("World Seed: " + joinGameTracker.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();

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Long, CompletableFuture<byte[]>> pending;
@Override
public Map<Long, CompletableFuture<byte[]>> viaFabricPlus$getPending() {
return pending;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Long, byte[]> 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<Long, byte[]> getBlobs() {
return blobs;
}
public long getSize() {
return this.size;
}
}

View File

@ -27,13 +27,11 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.Player
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 class ViaFabricPlusVLLoader extends VLLoader {
}
providers.use(NettyPipelineProvider.class, new ViaFabricPlusNettyPipelineProvider());
providers.use(BlobCacheProvider.class, new ViaFabricPlusBlobCacheProvider());
providers.use(TransferProvider.class, new ViaFabricPlusTransferProvider());
}

View File

@ -191,7 +191,6 @@
"fixes.viaversion.MixinWorldPackets1_17",
"fixes.viaversion.MixinWorldPackets1_19",
"viabedrock.MixinBedrockProtocol",
"viabedrock.MixinBlobCache",
"viabedrock.MixinJoinPackets",
"vialegacy.MixinExtensionProtocolMetadataStorage",
"vialegacy.MixinViaLegacyConfig",