From ab2a40774297f86d65411f3e1c0626aab0204d16 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 5 Nov 2024 20:18:30 +0100 Subject: [PATCH 1/8] Bump version to 5.1.2-SNAPSHOT --- gradle.properties | 2 +- gradle/libs.versions.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6a28f64f..f88f29d2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=5.1.1 +projectVersion=5.1.2-SNAPSHOT # Smile emoji mcVersions=1.21.3,1.21.2,1.21.1,1.21,1.20.6,1.20.5,1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 29850cb3..10364b62 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ metadata.format.version = "1.1" [versions] # ViaVersion -viaver = "5.1.1-SNAPSHOT" +viaver = "5.1.1" # Common provided netty = "4.0.20.Final" @@ -16,7 +16,7 @@ checkerQual = "3.39.0" paper = "1.16.5-R0.1-SNAPSHOT" velocity = "3.1.1" fabricLoader = "0.11.6" -viaProxy = "3.3.5-SNAPSHOT" +viaProxy = "3.3.5" [libraries] From 498bec9065208b855f18e6bcf3b067c83c91c633 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 5 Nov 2024 20:18:48 +0100 Subject: [PATCH 2/8] Remove 'has recipe error' container data from smithing table Fixes #909 --- .../v1_21_2to1_21/Protocol1_21_2To1_21.java | 1 - .../BlockItemPacketRewriter1_21_2.java | 31 +++++++++++++++++-- .../storage/InventoryStateIdStorage.java | 9 ++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/Protocol1_21_2To1_21.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/Protocol1_21_2To1_21.java index 0833efc6..ca9ffe28 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/Protocol1_21_2To1_21.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/Protocol1_21_2To1_21.java @@ -86,7 +86,6 @@ public final class Protocol1_21_2To1_21 extends BackwardsProtocol(this).register(ClientboundPackets1_21_2.AWARD_STATS); new AttributeRewriter<>(this).register1_21(ClientboundPackets1_21_2.UPDATE_ATTRIBUTES); - translatableRewriter.registerOpenScreen(ClientboundPackets1_21_2.OPEN_SCREEN); translatableRewriter.registerComponentPacket(ClientboundPackets1_21_2.SET_ACTION_BAR_TEXT); translatableRewriter.registerComponentPacket(ClientboundPackets1_21_2.SET_TITLE_TEXT); translatableRewriter.registerComponentPacket(ClientboundPackets1_21_2.SET_SUBTITLE_TEXT); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java index 3f4c08d6..80f0f140 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java @@ -86,6 +86,18 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem handleItemToClient(wrapper.user(), item); }); + protocol.registerClientbound(ClientboundPackets1_21_2.OPEN_SCREEN, wrapper -> { + wrapper.passthrough(Types.VAR_INT); // Id + + final int containerType = wrapper.passthrough(Types.VAR_INT); + if (containerType == 21) { + // Track smithing table to remove new data + wrapper.user().get(InventoryStateIdStorage.class).setSmithingTableOpen(true); + } + + protocol.getComponentRewriter().passthroughAndProcess(wrapper); + }); + protocol.registerClientbound(ClientboundPackets1_21_2.CONTAINER_SET_CONTENT, wrapper -> { updateContainerId(wrapper); @@ -108,11 +120,24 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem wrapper.passthrough(Types.SHORT); // Slot id passthroughClientboundItem(wrapper); }); + protocol.registerClientbound(ClientboundPackets1_21_2.CONTAINER_SET_DATA, wrapper -> { + updateContainerId(wrapper); + + if (wrapper.user().get(InventoryStateIdStorage.class).smithingTableOpen()) { + // Cancel new data for smithing table + wrapper.cancel(); + } + }); + protocol.registerClientbound(ClientboundPackets1_21_2.CONTAINER_CLOSE, wrapper -> { + updateContainerId(wrapper); + wrapper.user().get(InventoryStateIdStorage.class).setSmithingTableOpen(false); + }); protocol.registerClientbound(ClientboundPackets1_21_2.SET_HELD_SLOT, ClientboundPackets1_21.SET_CARRIED_ITEM); - protocol.registerClientbound(ClientboundPackets1_21_2.CONTAINER_CLOSE, this::updateContainerId); - protocol.registerClientbound(ClientboundPackets1_21_2.CONTAINER_SET_DATA, this::updateContainerId); protocol.registerClientbound(ClientboundPackets1_21_2.HORSE_SCREEN_OPEN, this::updateContainerId); - protocol.registerServerbound(ServerboundPackets1_20_5.CONTAINER_CLOSE, this::updateContainerIdServerbound); + protocol.registerServerbound(ServerboundPackets1_20_5.CONTAINER_CLOSE, wrapper -> { + updateContainerIdServerbound(wrapper); + wrapper.user().get(InventoryStateIdStorage.class).setSmithingTableOpen(false); + }); protocol.registerServerbound(ServerboundPackets1_20_5.CONTAINER_CLICK, wrapper -> { updateContainerIdServerbound(wrapper); wrapper.passthrough(Types.VAR_INT); // State id diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/storage/InventoryStateIdStorage.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/storage/InventoryStateIdStorage.java index 0f6064fa..5749ce0a 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/storage/InventoryStateIdStorage.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/storage/InventoryStateIdStorage.java @@ -21,6 +21,7 @@ import com.viaversion.viaversion.api.connection.StorableObject; public final class InventoryStateIdStorage implements StorableObject { + private boolean smithingTableOpen; private int stateId = -1; public int stateId() { @@ -30,4 +31,12 @@ public final class InventoryStateIdStorage implements StorableObject { public void setStateId(final int stateId) { this.stateId = stateId; } + + public boolean smithingTableOpen() { + return smithingTableOpen; + } + + public void setSmithingTableOpen(final boolean smithingTableOpen) { + this.smithingTableOpen = smithingTableOpen; + } } From 04a692022aad6b627fe310625b7578f935152a42 Mon Sep 17 00:00:00 2001 From: EnZaXD Date: Thu, 7 Nov 2024 09:11:38 +0100 Subject: [PATCH 3/8] Move config option check for player face fix into packet handlers (#913) --- .../rewriter/EntityPacketRewriter1_13.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/EntityPacketRewriter1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/EntityPacketRewriter1_13.java index a1e8cf27..38b1bbf7 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/EntityPacketRewriter1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/EntityPacketRewriter1_13.java @@ -237,17 +237,18 @@ public class EntityPacketRewriter1_13 extends LegacyEntityRewriter { - final double x = wrapper.passthrough(Types.DOUBLE); - final double y = wrapper.passthrough(Types.DOUBLE); - final double z = wrapper.passthrough(Types.DOUBLE); - wrapper.user().get(PlayerPositionStorage1_13.class).setPosition(x, y, z); - }; - protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_PLAYER_POS, movementRemapper); // Player Position - protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_PLAYER_POS_ROT, movementRemapper); // Player Position And Look (serverbound) - protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_VEHICLE, movementRemapper); // Vehicle Move (serverbound) - } + PacketHandler movementRemapper = wrapper -> { + if (!ViaBackwards.getConfig().isFix1_13FacePlayer()) { + return; + } + final double x = wrapper.passthrough(Types.DOUBLE); + final double y = wrapper.passthrough(Types.DOUBLE); + final double z = wrapper.passthrough(Types.DOUBLE); + wrapper.user().get(PlayerPositionStorage1_13.class).setPosition(x, y, z); + }; + protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_PLAYER_POS, movementRemapper); // Player Position + protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_PLAYER_POS_ROT, movementRemapper); // Player Position And Look (serverbound) + protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_VEHICLE, movementRemapper); // Vehicle Move (serverbound) } @Override From 8cb285db69469a8241cae12b248005fe80499aa4 Mon Sep 17 00:00:00 2001 From: EnZaXD Date: Thu, 7 Nov 2024 09:18:33 +0100 Subject: [PATCH 4/8] Change darkness->blindness in 1.19->1.18.2 (#908) --- .../viabackwards/ViaBackwardsConfig.java | 7 +++ .../viabackwards/api/ViaBackwardsConfig.java | 7 +++ .../v1_19to1_18_2/Protocol1_19To1_18_2.java | 5 +- .../rewriter/EntityPacketRewriter1_19.java | 46 +++++++++++++++++ .../storage/EntityTracker1_19.java | 49 +++++++++++++++++++ .../resources/assets/viabackwards/config.yml | 5 +- 6 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java diff --git a/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java b/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java index 9ee39754..81d626cc 100644 --- a/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java +++ b/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java @@ -36,6 +36,7 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback private boolean handlePingsAsInvAcknowledgements; private boolean bedrockAtY0; private boolean sculkShriekersToCryingObsidian; + private boolean mapDarknessEffect; private boolean suppressEmulationWarnings; public ViaBackwardsConfig(File configFile, Logger logger) { @@ -57,6 +58,7 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback handlePingsAsInvAcknowledgements = getBoolean("handle-pings-as-inv-acknowledgements", false); bedrockAtY0 = getBoolean("bedrock-at-y-0", false); sculkShriekersToCryingObsidian = getBoolean("sculk-shriekers-to-crying-obsidian", false); + mapDarknessEffect = getBoolean("map-darkness-effect", true); suppressEmulationWarnings = getBoolean("suppress-emulation-warnings", false); } @@ -100,6 +102,11 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback return sculkShriekersToCryingObsidian; } + @Override + public boolean mapDarknessEffect() { + return mapDarknessEffect; + } + @Override public boolean suppressEmulationWarnings() { return suppressEmulationWarnings; diff --git a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsConfig.java b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsConfig.java index 08f0902a..f9cd38a8 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsConfig.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsConfig.java @@ -78,6 +78,13 @@ public interface ViaBackwardsConfig extends Config { */ boolean sculkShriekerToCryingObsidian(); + /** + * Maps the darkness effect to blindness for 1.18.2 clients on 1.19+ servers. + * + * @return true if enabled + */ + boolean mapDarknessEffect(); + /** * Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+). * diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/Protocol1_19To1_18_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/Protocol1_19To1_18_2.java index 4635fcea..481fdd1d 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/Protocol1_19To1_18_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/Protocol1_19To1_18_2.java @@ -28,11 +28,11 @@ import com.viaversion.viabackwards.protocol.v1_19to1_18_2.rewriter.BlockItemPack import com.viaversion.viabackwards.protocol.v1_19to1_18_2.rewriter.CommandRewriter1_19; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.rewriter.EntityPacketRewriter1_19; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.DimensionRegistryStorage; +import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.EntityTracker1_19; import com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage.NonceStorage; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.RegistryType; -import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19; import com.viaversion.viaversion.api.minecraft.signature.SignableCommandArgumentsProvider; import com.viaversion.viaversion.api.minecraft.signature.model.DecoratableMessage; import com.viaversion.viaversion.api.minecraft.signature.model.MessageMetadata; @@ -40,7 +40,6 @@ import com.viaversion.viaversion.api.minecraft.signature.storage.ChatSession1_19 import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Types; -import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.libs.gson.JsonElement; import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets; import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets; @@ -364,7 +363,7 @@ public final class Protocol1_19To1_18_2 extends BackwardsProtocol { // Remove factor data wrapper.read(Types.OPTIONAL_NAMED_COMPOUND_TAG); + + if (!ViaBackwards.getConfig().mapDarknessEffect()) { + return; + } + + final EntityTracker1_19 tracker = tracker(wrapper.user()); + + final int entityId = wrapper.get(Types.VAR_INT, 0); + final int effectId = wrapper.get(Types.VAR_INT, 1); + if (effectId == 33) { // Newly added darkness, rewrite to blindness + tracker.getAffectedByDarkness().add(entityId); + wrapper.set(Types.VAR_INT, 1, 15); + } else if (effectId == 15) { // Track actual blindness effect for removal later + tracker.getAffectedByBlindness().add(entityId); + } + }); + } + }); + + protocol.registerClientbound(ClientboundPackets1_19.REMOVE_MOB_EFFECT, new PacketHandlers() { + @Override + protected void register() { + map(Types.VAR_INT); // Entity id + map(Types.VAR_INT); // Effect id + handler(wrapper -> { + if (!ViaBackwards.getConfig().mapDarknessEffect()) { + return; + } + + final int entityId = wrapper.get(Types.VAR_INT, 0); + final int effectId = wrapper.get(Types.VAR_INT, 1); + + final EntityTracker1_19 tracker = tracker(wrapper.user()); + if (effectId == 33) { // Remove darkness and the fake blindness effect if the client doesn't have actual blindness + tracker.getAffectedByDarkness().rem(entityId); + if (!tracker.getAffectedByBlindness().contains(entityId)) { + wrapper.set(Types.VAR_INT, 1, 15); + } + } else if (effectId == 15) { // Remove blindness and cancel if the client has darkness (will be removed by darkness removal) + tracker.getAffectedByBlindness().rem(entityId); + if (tracker.getAffectedByDarkness().contains(entityId)) { + wrapper.cancel(); + } + } }); } }); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java new file mode 100644 index 00000000..37c6d1c8 --- /dev/null +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_19to1_18_2/storage/EntityTracker1_19.java @@ -0,0 +1,49 @@ +/* + * 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 . + */ +package com.viaversion.viabackwards.protocol.v1_19to1_18_2.storage; + +import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19; +import com.viaversion.viaversion.data.entity.EntityTrackerBase; +import com.viaversion.viaversion.libs.fastutil.ints.IntArrayList; +import com.viaversion.viaversion.libs.fastutil.ints.IntList; + +public final class EntityTracker1_19 extends EntityTrackerBase { + + private final IntList affectedByBlindness = new IntArrayList(); + private final IntList affectedByDarkness = new IntArrayList(); + + public EntityTracker1_19(final UserConnection connection) { + super(connection, EntityTypes1_19.PLAYER); + } + + @Override + public void removeEntity(final int id) { + super.removeEntity(id); + this.affectedByBlindness.rem(id); + this.affectedByDarkness.rem(id); + } + + public IntList getAffectedByBlindness() { + return affectedByBlindness; + } + + public IntList getAffectedByDarkness() { + return affectedByDarkness; + } +} diff --git a/common/src/main/resources/assets/viabackwards/config.yml b/common/src/main/resources/assets/viabackwards/config.yml index f2ff5f37..92c15d1f 100644 --- a/common/src/main/resources/assets/viabackwards/config.yml +++ b/common/src/main/resources/assets/viabackwards/config.yml @@ -28,5 +28,8 @@ bedrock-at-y-0: false # If disabled, the client will see them as end portal frames. sculk-shriekers-to-crying-obsidian: true # +# Maps the darkness effect to blindness for 1.18.2 clients on 1.19+ servers. +map-darkness-effect: true +# # Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+). -suppress-emulation-warnings: false \ No newline at end of file +suppress-emulation-warnings: false From 3a67be7fe5add592cc5d2bf8be23307ba430f94e Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 8 Nov 2024 17:25:40 +0100 Subject: [PATCH 5/8] Don't forget to rewrite item in set cursor and set player inventory --- .../v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java index 80f0f140..aa4a4410 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java @@ -82,8 +82,7 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem wrapper.write(Types.UNSIGNED_BYTE, (short) -1); // Player inventory wrapper.write(Types.VAR_INT, wrapper.user().get(InventoryStateIdStorage.class).stateId()); // State id; re-use the last known one wrapper.write(Types.SHORT, (short) -1); // Cursor - final Item item = wrapper.passthrough(Types1_21_2.ITEM); - handleItemToClient(wrapper.user(), item); + passthroughClientboundItem(wrapper); }); protocol.registerClientbound(ClientboundPackets1_21_2.OPEN_SCREEN, wrapper -> { @@ -168,6 +167,7 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem wrapper.write(Types.VAR_INT, 0); // 0 state id final int slot = wrapper.read(Types.VAR_INT); wrapper.write(Types.SHORT, (short) slot); + passthroughClientboundItem(wrapper); }); protocol.registerClientbound(ClientboundPackets1_21_2.EXPLODE, wrapper -> { From 82a7c9bc3d0562b2a7e9119fda2834b07b8fd2fd Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 11 Nov 2024 15:00:34 +0100 Subject: [PATCH 6/8] Update VV usage --- .../com/viaversion/viabackwards/api/ViaBackwardsPlatform.java | 2 +- .../viabackwards/api/rewriters/EntityRewriterBase.java | 2 +- .../v1_13to1_12_2/rewriter/PlayerPacketRewriter1_13.java | 4 ++-- .../v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java | 3 ++- gradle/libs.versions.toml | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java index d878aadb..a7160e5b 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java @@ -71,7 +71,7 @@ import java.util.logging.Logger; public interface ViaBackwardsPlatform { - String MINIMUM_VV_VERSION = "5.1.1"; + String MINIMUM_VV_VERSION = "5.1.2"; /** * Initialize ViaBackwards. diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriterBase.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriterBase.java index a0c6be46..cadd29c4 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriterBase.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriterBase.java @@ -240,7 +240,7 @@ public abstract class EntityRewriterBase 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() { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/PlayerPacketRewriter1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/PlayerPacketRewriter1_13.java index 79581b75..602a29b8 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/PlayerPacketRewriter1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/PlayerPacketRewriter1_13.java @@ -469,7 +469,7 @@ public class PlayerPacketRewriter1_13 extends RewriterBase wrapper.write(Types.STRING, newChannel); 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 rewrittenChannels = new ArrayList<>(); for (String s : channels) { String rewritten = ItemPacketRewriter1_13.getNewPluginChannelId(s); @@ -480,7 +480,7 @@ public class PlayerPacketRewriter1_13 extends RewriterBase } } 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 { wrapper.cancel(); } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java index aa4a4410..3b58cf1f 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/BlockItemPacketRewriter1_21_2.java @@ -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.SoundRewriter; 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.updateItemData; @@ -143,7 +144,7 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem wrapper.passthrough(Types.SHORT); // Slot wrapper.passthrough(Types.BYTE); // Button 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++) { wrapper.passthrough(Types.SHORT); // Slot passthroughServerboundItem(wrapper); diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 10364b62..f8118301 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ metadata.format.version = "1.1" [versions] # ViaVersion -viaver = "5.1.1" +viaver = "5.1.2-SNAPSHOT" # Common provided netty = "4.0.20.Final" From 1db6824391b7f9939e76af4b09a6d6d62585b5bf Mon Sep 17 00:00:00 2001 From: Gero Date: Mon, 11 Nov 2024 17:01:35 +0100 Subject: [PATCH 7/8] Fix remapping of 1.21.3 PLAYER_INFO_UPDATE list order (#915) --- .../v1_21_2to1_21/rewriter/EntityPacketRewriter1_21_2.java | 1 - 1 file changed, 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/EntityPacketRewriter1_21_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/EntityPacketRewriter1_21_2.java index 0b19f6ac..49d57c89 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/EntityPacketRewriter1_21_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/rewriter/EntityPacketRewriter1_21_2.java @@ -390,7 +390,6 @@ public final class EntityPacketRewriter1_21_2 extends EntityRewriter Date: Sun, 17 Nov 2024 12:23:33 +0100 Subject: [PATCH 8/8] Update Gradle Wrapper from 8.10.2 to 8.11 (#917) Signed-off-by: gradle-update-robot Co-authored-by: gradle-update-robot --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fb602ee2..82dd18b2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionSha256Sum=57dafb5c2622c6cc08b993c85b7c06956a2f53536432a30ead46166dbca0f1e9 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME