Fixed clientside sync task system, thanks Fabric-API

This commit is contained in:
FlorianMichael 2023-09-20 00:41:52 +02:00
parent 2f9dc58613
commit 1e47ab7f51
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
3 changed files with 9 additions and 11 deletions

View File

@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx8G
org.gradle.parallel=true
# minecraft and fabric
minecraft_version=1.20.2-rc1
yarn_mappings=1.20.2-rc1+build.2
minecraft_version=1.20.2-rc2
yarn_mappings=1.20.2-rc2+build.4
loader_version=0.14.22
fabric_api_version=0.88.5+1.20.2
fabric_api_version=0.89.0+1.20.2
# viafabricplus
mod_version=2.8.7-SNAPSHOT
@ -18,7 +18,7 @@ raknet_transport_version=1.0.0.CR1-SNAPSHOT
classic4j_version=1.2.0
# viaversion (and required) libs
viaversion_version=4.8.0-1.20.2-rc1-SNAPSHOT
viaversion_version=4.8.0-1.20.2-rc2-SNAPSHOT
viabackwards_version=4.8.0-1.20.2-pre2-SNAPSHOT
vialoader_version=2.2.9-SNAPSHOT

View File

@ -19,10 +19,9 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network;
import de.florianmichael.viafabricplus.definition.ClientsideFixes;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import io.netty.buffer.Unpooled;
import net.fabricmc.fabric.impl.networking.payload.PacketByteBufPayload;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientCommonNetworkHandler;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.listener.ServerPacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.s2c.common.CommonPingS2CPacket;
@ -79,12 +78,11 @@ public abstract class MixinClientCommonNetworkHandler {
@Inject(method = "onCustomPayload(Lnet/minecraft/network/packet/s2c/common/CustomPayloadS2CPacket;)V", 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), cancellable = true)
public void handlePseudoPackets(CustomPayloadS2CPacket packet, CallbackInfo ci) {
final var channel = packet.payload().id().toString();
final var data = new PacketByteBuf(Unpooled.buffer());
packet.payload().write(data);
if (channel.equals(ClientsideFixes.PACKET_SYNC_IDENTIFIER)) {
if (channel.equals(ClientsideFixes.PACKET_SYNC_IDENTIFIER) && packet.payload() instanceof PacketByteBufPayload payload) {
final var data = payload.data();
final var uuid = data.readString();
if (ClientsideFixes.hasSyncTask(uuid)) {
ClientsideFixes.getSyncTask(uuid).accept(data);
ci.cancel();

View File

@ -33,7 +33,7 @@ public class PackFormatsMappings {
private final static Map<Integer, GameVersion> protocolMap = new HashMap<>();
public static void load() {
registerVersion(VersionEnum.r1_20_2, 18, "1.20.2 Release Candidate 1", "1.20.2-rc1");
registerVersion(VersionEnum.r1_20_2, 18, "1.20.2 Release Candidate 2", "1.20.2-rc2");
registerVersion(VersionEnum.r1_20tor1_20_1, 15, "1.20.1"); // 1.20 and 1.20.1 are the same, why care...
registerVersion(VersionEnum.r1_19_4, 13, "1.19.4");
registerVersion(VersionEnum.r1_19_3, 12, "1.19.3");