3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 08:30:10 +01:00

Remove transaction tracking (and cancelling) in 1.17->1.16.4 (#883)

Dieser Commit ist enthalten in:
EnZaXD 2024-09-12 14:45:44 +02:00 committet von GitHub
Ursprung 0bac9201ac
Commit 66a1748573
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
3 geänderte Dateien mit 1 neuen und 40 gelöschten Zeilen

Datei anzeigen

@ -24,7 +24,6 @@ import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.rewriter.BlockItemPacketRewriter1_17; import com.viaversion.viabackwards.protocol.v1_17to1_16_4.rewriter.BlockItemPacketRewriter1_17;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.rewriter.EntityPacketRewriter1_17; import com.viaversion.viabackwards.protocol.v1_17to1_16_4.rewriter.EntityPacketRewriter1_17;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.storage.PingRequests;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.storage.PlayerLastCursorItem; import com.viaversion.viabackwards.protocol.v1_17to1_16_4.storage.PlayerLastCursorItem;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.RegistryType; import com.viaversion.viaversion.api.minecraft.RegistryType;
@ -170,8 +169,6 @@ public final class Protocol1_17To1_16_4 extends BackwardsProtocol<ClientboundPac
int id = wrapper.read(Types.INT); int id = wrapper.read(Types.INT);
short shortId = (short) id; short shortId = (short) id;
if (id == shortId && ViaBackwards.getConfig().handlePingsAsInvAcknowledgements()) { if (id == shortId && ViaBackwards.getConfig().handlePingsAsInvAcknowledgements()) {
wrapper.user().get(PingRequests.class).addId(shortId);
// Send inventory acknowledgement to replace ping packet functionality in the unsigned byte range // Send inventory acknowledgement to replace ping packet functionality in the unsigned byte range
PacketWrapper acknowledgementPacket = wrapper.create(ClientboundPackets1_16_2.CONTAINER_ACK); PacketWrapper acknowledgementPacket = wrapper.create(ClientboundPackets1_16_2.CONTAINER_ACK);
acknowledgementPacket.write(Types.UNSIGNED_BYTE, (short) 0); // Inventory id acknowledgementPacket.write(Types.UNSIGNED_BYTE, (short) 0); // Inventory id
@ -221,7 +218,6 @@ public final class Protocol1_17To1_16_4 extends BackwardsProtocol<ClientboundPac
@Override @Override
public void init(UserConnection user) { public void init(UserConnection user) {
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_17.PLAYER)); addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_17.PLAYER));
user.put(new PingRequests());
user.put(new PlayerLastCursorItem()); user.put(new PlayerLastCursorItem());
} }

Datei anzeigen

@ -26,7 +26,6 @@ import com.viaversion.viabackwards.api.rewriters.BackwardsItemRewriter;
import com.viaversion.viabackwards.api.rewriters.MapColorRewriter; import com.viaversion.viabackwards.api.rewriters.MapColorRewriter;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.Protocol1_17To1_16_4; import com.viaversion.viabackwards.protocol.v1_17to1_16_4.Protocol1_17To1_16_4;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.data.MapColorMappings1_16_4; import com.viaversion.viabackwards.protocol.v1_17to1_16_4.data.MapColorMappings1_16_4;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.storage.PingRequests;
import com.viaversion.viabackwards.protocol.v1_17to1_16_4.storage.PlayerLastCursorItem; import com.viaversion.viabackwards.protocol.v1_17to1_16_4.storage.PlayerLastCursorItem;
import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
@ -167,7 +166,7 @@ public final class BlockItemPacketRewriter1_17 extends BackwardsItemRewriter<Cli
short inventoryId = wrapper.read(Types.UNSIGNED_BYTE); short inventoryId = wrapper.read(Types.UNSIGNED_BYTE);
short confirmationId = wrapper.read(Types.SHORT); short confirmationId = wrapper.read(Types.SHORT);
boolean accepted = wrapper.read(Types.BOOLEAN); boolean accepted = wrapper.read(Types.BOOLEAN);
if (inventoryId == 0 && accepted && wrapper.user().get(PingRequests.class).removeId(confirmationId)) { if (inventoryId == 0 && accepted) {
PacketWrapper pongPacket = wrapper.create(ServerboundPackets1_17.PONG); PacketWrapper pongPacket = wrapper.create(ServerboundPackets1_17.PONG);
pongPacket.write(Types.INT, (int) confirmationId); pongPacket.write(Types.INT, (int) confirmationId);
pongPacket.sendToServer(Protocol1_17To1_16_4.class); pongPacket.sendToServer(Protocol1_17To1_16_4.class);

Datei anzeigen

@ -1,34 +0,0 @@
/*
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2016-2024 ViaVersion 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 com.viaversion.viabackwards.protocol.v1_17to1_16_4.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
import com.viaversion.viaversion.libs.fastutil.ints.IntOpenHashSet;
import com.viaversion.viaversion.libs.fastutil.ints.IntSet;
public final class PingRequests implements StorableObject {
private final IntSet ids = new IntOpenHashSet();
public void addId(short id) {
ids.add(id);
}
public boolean removeId(short id) {
return ids.remove(id);
}
}