mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-26 17:27:58 +01:00
Updated Via*
This commit is contained in:
parent
08056c3ee8
commit
0e44fbfb4b
2
.github/USAGE.md
vendored
2
.github/USAGE.md
vendored
@ -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, <br>
|
||||
click on it, and you will see the Protocol selection, there you can choose the Minecraft version you want to connect to, <br>
|
||||
in the upper left corner you can go to the Settings.
|
||||
|
@ -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<String> 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").<Map<Long, CompletableFuture<byte[]>>>get().size();
|
||||
|
||||
if (totalSize != 0 || blobCount != 0 || pendingCount != 0) {
|
||||
output.add("Blob Cache:");
|
||||
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.access;
|
||||
|
||||
public interface IPlayerPositionLookS2CPacket {
|
||||
|
||||
boolean viafabricplus_isDismountVehicle();
|
||||
}
|
@ -52,7 +52,9 @@ public class MixinDebugHud {
|
||||
if (group.getProtocolRange() != null && !group.getProtocolRange().contains(ProtocolHack.getTargetVersion())) continue;
|
||||
|
||||
final List<String> groupInformation = new ArrayList<>();
|
||||
group.applyInformation(userConnection, groupInformation);
|
||||
try {
|
||||
group.applyInformation(userConnection, groupInformation);
|
||||
} catch (Exception ignored) {}
|
||||
if (groupInformation.isEmpty()) continue;
|
||||
|
||||
information.add(group.getProtocolRange() == null ? "General" : group.getProtocolRange().toString());
|
||||
|
@ -18,9 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.access.IPlayerPositionLookS2CPacket;
|
||||
import de.florianmichael.viafabricplus.settings.groups.VisualSettings;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -36,7 +34,6 @@ import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.listener.ServerPlayPacketListener;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.c2s.play.KeepAliveC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.play.*;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@ -154,13 +151,6 @@ public abstract class MixinClientPlayNetworkHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPlayerPositionLook", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER))
|
||||
public void dismountIfRequested(PlayerPositionLookS2CPacket packet, CallbackInfo ci) {
|
||||
if (((IPlayerPositionLookS2CPacket) packet).viafabricplus_isDismountVehicle()) {
|
||||
client.player.dismountVehicle();
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "onKeepAlive", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;Ljava/util/function/BooleanSupplier;Ljava/time/Duration;)V"))
|
||||
public void forceSendKeepAlive(ClientPlayNetworkHandler instance, Packet<ServerPlayPacketListener> packet, BooleanSupplier sendCondition, Duration expirationTime) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.packet;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.access.IPlayerPositionLookS2CPacket;
|
||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(PlayerPositionLookS2CPacket.class)
|
||||
public class MixinPlayerPositionLookS2CPacket implements IPlayerPositionLookS2CPacket {
|
||||
|
||||
@Unique
|
||||
private boolean viafabricplus_dismountVehicle;
|
||||
|
||||
@Inject(method = "<init>(Lnet/minecraft/network/PacketByteBuf;)V", at = @At("RETURN"))
|
||||
public void readDismountVehicle(PacketByteBuf buf, CallbackInfo ci) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
viafabricplus_dismountVehicle = buf.readBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean viafabricplus_isDismountVehicle() {
|
||||
return viafabricplus_dismountVehicle;
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion.protocol1_19_4to1_19_3;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4To1_19_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.packets.EntityPackets;
|
||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(value = EntityPackets.class, remap = false)
|
||||
public abstract class MixinEntityPackets extends EntityRewriter<ClientboundPackets1_19_3, Protocol1_19_4To1_19_3> {
|
||||
|
||||
public MixinEntityPackets(Protocol1_19_4To1_19_3 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Inject(method = "registerPackets", at = @At("RETURN"))
|
||||
public void fixPlayerPosition(CallbackInfo ci) {
|
||||
protocol.registerClientbound(ClientboundPackets1_19_3.PLAYER_POSITION, ClientboundPackets1_19_4.PLAYER_POSITION, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
map(Type.DOUBLE); // X
|
||||
map(Type.DOUBLE); // Y
|
||||
map(Type.DOUBLE); // Z
|
||||
map(Type.FLOAT); // Yaw
|
||||
map(Type.FLOAT); // Pitch
|
||||
map(Type.BYTE); // Relative arguments
|
||||
map(Type.VAR_INT); // Id
|
||||
map(Type.BOOLEAN); // Dismount vehicle - handling in MC
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ import de.florianmichael.viafabricplus.protocolhack.platform.ViaAprilFoolsPlatfo
|
||||
import de.florianmichael.viafabricplus.protocolhack.platform.ViaBedrockPlatformImpl;
|
||||
import de.florianmichael.viafabricplus.protocolhack.platform.ViaLegacyPlatformImpl;
|
||||
import de.florianmichael.viafabricplus.protocolhack.provider.*;
|
||||
import de.florianmichael.viafabricplus.protocolhack.provider.viabedrock.ViaFabricPlusBlobCacheProvider;
|
||||
import de.florianmichael.viafabricplus.protocolhack.provider.viabedrock.ViaFabricPlusNettyPipelineProvider;
|
||||
import de.florianmichael.viafabricplus.protocolhack.provider.vialegacy.*;
|
||||
import de.florianmichael.viafabricplus.protocolhack.provider.viaversion.ViaFabricPlusHandItemProvider;
|
||||
@ -45,6 +46,7 @@ import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.raphimc.viaaprilfools.api.AprilFoolsProtocolVersion;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.viabedrock.protocol.providers.BlobCacheProvider;
|
||||
import net.raphimc.viabedrock.protocol.providers.NettyPipelineProvider;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicCustomCommandProvider;
|
||||
@ -124,6 +126,8 @@ public class ProtocolHack {
|
||||
return MinecraftClient.getInstance().isInSingleplayer();
|
||||
});
|
||||
builder = builder.providers(providers -> {
|
||||
providers.use(VersionProvider.class, new ViaFabricPlusVLBBaseVersionProvider());
|
||||
|
||||
providers.use(MovementTransmitterProvider.class, new ViaFabricPlusMovementTransmitterProvider());
|
||||
providers.use(HandItemProvider.class, new ViaFabricPlusHandItemProvider());
|
||||
|
||||
@ -135,9 +139,9 @@ public class ProtocolHack {
|
||||
providers.use(GameProfileFetcher.class, new ViaFabricPlusGameProfileFetcher());
|
||||
providers.use(ClassicMPPassProvider.class, new ViaFabricPlusClassicMPPassProvider());
|
||||
providers.use(ClassicCustomCommandProvider.class, new ViaFabricPlusClassicCustomCommandProvider());
|
||||
providers.use(NettyPipelineProvider.class, new ViaFabricPlusNettyPipelineProvider());
|
||||
|
||||
providers.use(VersionProvider.class, new ViaFabricPlusVLBBaseVersionProvider());
|
||||
providers.use(NettyPipelineProvider.class, new ViaFabricPlusNettyPipelineProvider());
|
||||
providers.use(BlobCacheProvider.class, new ViaFabricPlusBlobCacheProvider());
|
||||
});
|
||||
builder = builder.onProtocolReload(protocolVersion -> ChangeProtocolVersionCallback.EVENT.invoker().onChangeProtocolVersion(protocolVersion));
|
||||
builder.build();
|
||||
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2023 FlorianMichael/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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.protocolhack.provider.viabedrock;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
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 UserConnection user, final long hash, final byte[] compressedBlob) {
|
||||
synchronized (this.blobs) {
|
||||
if (this.blobs.containsKey(hash)) { // In case the server overwrites a blob
|
||||
size -= this.blobs.get(hash).length;
|
||||
this.blobs.remove(hash);
|
||||
}
|
||||
size += compressedBlob.length;
|
||||
return this.blobs.put(hash, compressedBlob);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBlob(final UserConnection user, final long hash) {
|
||||
synchronized (this.blobs) {
|
||||
return this.blobs.containsKey(hash);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBlob(final UserConnection user, final long hash) {
|
||||
synchronized (this.blobs) {
|
||||
return this.blobs.get(hash);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Long, byte[]> getBlobs() {
|
||||
return blobs;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
}
|
@ -95,7 +95,6 @@
|
||||
"fixes.minecraft.item.MixinSwordItem",
|
||||
"fixes.minecraft.packet.MixinChatMessageC2SPacket",
|
||||
"fixes.minecraft.packet.MixinPacketByteBuf",
|
||||
"fixes.minecraft.packet.MixinPlayerPositionLookS2CPacket",
|
||||
"fixes.minecraft.packet.MixinUpdatePlayerAbilitiesC2SPacket",
|
||||
"fixes.minecraft.screen.MixinChatHud",
|
||||
"fixes.minecraft.screen.MixinChatScreen",
|
||||
@ -142,7 +141,6 @@
|
||||
"fixes.viaversion.protocol1_18_2to1_18.MixinProtocol1_18_2To1_18",
|
||||
"fixes.viaversion.protocol1_19_1to1_19.MixinProtocol1_19_1To1_19",
|
||||
"fixes.viaversion.protocol1_19_3to1_19_1.MixinProtocol1_19_3To1_19_1",
|
||||
"fixes.viaversion.protocol1_19_4to1_19_3.MixinEntityPackets",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinChunk1_8Type",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinCommandBlockProvider",
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinEntityPackets_6_1",
|
||||
|
Loading…
Reference in New Issue
Block a user