3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 00:00:33 +01:00

Update VV usage

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-11-11 15:00:34 +01:00
Ursprung 3a67be7fe5
Commit 82a7c9bc3d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
5 geänderte Dateien mit 7 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -71,7 +71,7 @@ import java.util.logging.Logger;
public interface ViaBackwardsPlatform { public interface ViaBackwardsPlatform {
String MINIMUM_VV_VERSION = "5.1.1"; String MINIMUM_VV_VERSION = "5.1.2";
/** /**
* Initialize ViaBackwards. * Initialize ViaBackwards.

Datei anzeigen

@ -240,7 +240,7 @@ public abstract class EntityRewriterBase<C extends ClientboundPacketType, T exte
} }
protected PacketHandler getTrackerHandler(EntityType entityType) { protected PacketHandler getTrackerHandler(EntityType entityType) {
return wrapper -> tracker(wrapper.user()).addEntity((int) wrapper.get(Types.VAR_INT, 0), entityType); return wrapper -> tracker(wrapper.user()).addEntity(wrapper.get(Types.VAR_INT, 0), entityType);
} }
protected PacketHandler getPlayerTrackerHandler() { protected PacketHandler getPlayerTrackerHandler() {

Datei anzeigen

@ -469,7 +469,7 @@ public class PlayerPacketRewriter1_13 extends RewriterBase<Protocol1_13To1_12_2>
wrapper.write(Types.STRING, newChannel); wrapper.write(Types.STRING, newChannel);
if (newChannel.equals("minecraft:register") || newChannel.equals("minecraft:unregister")) { if (newChannel.equals("minecraft:register") || newChannel.equals("minecraft:unregister")) {
String[] channels = new String(wrapper.read(Types.REMAINING_BYTES), StandardCharsets.UTF_8).split("\0"); String[] channels = new String(wrapper.read(Types.SERVERBOUND_CUSTOM_PAYLOAD_DATA), StandardCharsets.UTF_8).split("\0");
List<String> rewrittenChannels = new ArrayList<>(); List<String> rewrittenChannels = new ArrayList<>();
for (String s : channels) { for (String s : channels) {
String rewritten = ItemPacketRewriter1_13.getNewPluginChannelId(s); String rewritten = ItemPacketRewriter1_13.getNewPluginChannelId(s);
@ -480,7 +480,7 @@ public class PlayerPacketRewriter1_13 extends RewriterBase<Protocol1_13To1_12_2>
} }
} }
if (!rewrittenChannels.isEmpty()) { if (!rewrittenChannels.isEmpty()) {
wrapper.write(Types.REMAINING_BYTES, Joiner.on('\0').join(rewrittenChannels).getBytes(StandardCharsets.UTF_8)); wrapper.write(Types.SERVERBOUND_CUSTOM_PAYLOAD_DATA, Joiner.on('\0').join(rewrittenChannels).getBytes(StandardCharsets.UTF_8));
} else { } else {
wrapper.cancel(); wrapper.cancel();
} }

Datei anzeigen

@ -38,6 +38,7 @@ import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ClientboundPacke
import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.BlockRewriter;
import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.rewriter.SoundRewriter;
import com.viaversion.viaversion.util.Key; import com.viaversion.viaversion.util.Key;
import com.viaversion.viaversion.util.Limit;
import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.downgradeItemData; import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.downgradeItemData;
import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.updateItemData; import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.updateItemData;
@ -143,7 +144,7 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem
wrapper.passthrough(Types.SHORT); // Slot wrapper.passthrough(Types.SHORT); // Slot
wrapper.passthrough(Types.BYTE); // Button wrapper.passthrough(Types.BYTE); // Button
wrapper.passthrough(Types.VAR_INT); // Mode wrapper.passthrough(Types.VAR_INT); // Mode
final int length = wrapper.passthrough(Types.VAR_INT); final int length = Limit.max(wrapper.passthrough(Types.VAR_INT), 128);
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
wrapper.passthrough(Types.SHORT); // Slot wrapper.passthrough(Types.SHORT); // Slot
passthroughServerboundItem(wrapper); passthroughServerboundItem(wrapper);

Datei anzeigen

@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions] [versions]
# ViaVersion # ViaVersion
viaver = "5.1.1" viaver = "5.1.2-SNAPSHOT"
# Common provided # Common provided
netty = "4.0.20.Final" netty = "4.0.20.Final"