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

Fix minor inconsistencies in older protocols (#714)

Dieser Commit ist enthalten in:
EnZaXD 2024-04-01 13:01:07 +02:00 committet von GitHub
Ursprung 0e74527342
Commit 4e5b6fe876
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
14 geänderte Dateien mit 14 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -35,8 +35,8 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPac
public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> { public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> {
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.11", "1.10"); public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.11", "1.10");
private final EntityPackets1_11 entityPackets = new EntityPackets1_11(this); // Required for the item rewriter private final EntityPackets1_11 entityPackets = new EntityPackets1_11(this);
private BlockItemPackets1_11 blockItemPackets; private final BlockItemPackets1_11 blockItemPackets = new BlockItemPackets1_11(this);
public Protocol1_10To1_11() { public Protocol1_10To1_11() {
super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class); super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class);
@ -44,9 +44,9 @@ public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_
@Override @Override
protected void registerPackets() { protected void registerPackets() {
(blockItemPackets = new BlockItemPackets1_11(this)).register(); blockItemPackets.register();
entityPackets.register(); entityPackets.register();
new PlayerPackets1_11().register(this); PlayerPackets1_11.register(this);
SoundRewriter<ClientboundPackets1_9_3> soundRewriter = new SoundRewriter<>(this); SoundRewriter<ClientboundPackets1_9_3> soundRewriter = new SoundRewriter<>(this);
soundRewriter.registerNamedSound(ClientboundPackets1_9_3.NAMED_SOUND); soundRewriter.registerNamedSound(ClientboundPackets1_9_3.NAMED_SOUND);
@ -55,7 +55,6 @@ public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_
@Override @Override
public void init(UserConnection user) { public void init(UserConnection user) {
// Register ClientWorld
if (!user.has(ClientWorld.class)) { if (!user.has(ClientWorld.class)) {
user.put(new ClientWorld()); user.put(new ClientWorld());
} }

Datei anzeigen

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.viaversion.viabackwards.protocol.protocol1_10to1_11; package com.viaversion.viabackwards.protocol.protocol1_10to1_11.data;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap; import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap;
import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap; import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;

Datei anzeigen

@ -38,7 +38,7 @@ import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
import com.viaversion.viaversion.protocols.protocol1_11to1_10.EntityIdRewriter; import com.viaversion.viaversion.protocols.protocol1_11to1_10.rewriter.EntityIdRewriter;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
import java.util.Arrays; import java.util.Arrays;

Datei anzeigen

@ -21,7 +21,7 @@ package com.viaversion.viabackwards.protocol.protocol1_10to1_11.packets;
import com.viaversion.viabackwards.api.entities.storage.EntityData; import com.viaversion.viabackwards.api.entities.storage.EntityData;
import com.viaversion.viabackwards.api.entities.storage.WrappedMetadata; import com.viaversion.viabackwards.api.entities.storage.WrappedMetadata;
import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter; import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter;
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.PotionSplashHandler; import com.viaversion.viabackwards.protocol.protocol1_10to1_11.data.PotionSplashHandler;
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11; import com.viaversion.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11;
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.storage.ChestedHorseStorage; import com.viaversion.viabackwards.protocol.protocol1_10to1_11.storage.ChestedHorseStorage;
import com.viaversion.viaversion.api.data.entity.StoredEntityData; import com.viaversion.viaversion.api.data.entity.StoredEntityData;

Datei anzeigen

@ -37,7 +37,7 @@ public class PlayerPackets1_11 {
} }
}; };
public void register(Protocol1_10To1_11 protocol) { public static void register(Protocol1_10To1_11 protocol) {
protocol.registerClientbound(ClientboundPackets1_9_3.TITLE, new PacketHandlers() { protocol.registerClientbound(ClientboundPackets1_9_3.TITLE, new PacketHandlers() {
@Override @Override
public void register() { public void register() {

Datei anzeigen

@ -69,7 +69,6 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_
@Override @Override
public void init(UserConnection user) { public void init(UserConnection user) {
// Register ClientWorld
if (!user.has(ClientWorld.class)) { if (!user.has(ClientWorld.class)) {
user.put(new ClientWorld()); user.put(new ClientWorld());
} }

Datei anzeigen

@ -45,7 +45,6 @@ public class Protocol1_11To1_11_1 extends BackwardsProtocol<ClientboundPackets1_
@Override @Override
public void init(UserConnection user) { public void init(UserConnection user) {
// Register ClientWorld
if (!user.has(ClientWorld.class)) { if (!user.has(ClientWorld.class)) {
user.put(new ClientWorld()); user.put(new ClientWorld());
} }

Datei anzeigen

@ -19,6 +19,7 @@
package com.viaversion.viabackwards.protocol.protocol1_12_1to1_12_2; package com.viaversion.viabackwards.protocol.protocol1_12_1to1_12_2;
import com.viaversion.viabackwards.api.BackwardsProtocol; import com.viaversion.viabackwards.api.BackwardsProtocol;
import com.viaversion.viabackwards.protocol.protocol1_12_1to1_12_2.storage.KeepAliveTracker;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;

Datei anzeigen

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.viaversion.viabackwards.protocol.protocol1_12_1to1_12_2; package com.viaversion.viabackwards.protocol.protocol1_12_1to1_12_2.storage;
import com.viaversion.viaversion.api.connection.StorableObject; import com.viaversion.viaversion.api.connection.StorableObject;

Datei anzeigen

@ -112,7 +112,6 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
@Override @Override
public void init(UserConnection user) { public void init(UserConnection user) {
// Register ClientWorld
if (!user.has(ClientWorld.class)) { if (!user.has(ClientWorld.class)) {
user.put(new ClientWorld()); user.put(new ClientWorld());
} }

Datei anzeigen

@ -162,7 +162,6 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
@Override @Override
public void init(UserConnection user) { public void init(UserConnection user) {
// Register ClientWorld
if (!user.has(ClientWorld.class)) { if (!user.has(ClientWorld.class)) {
user.put(new ClientWorld()); user.put(new ClientWorld());
} }

Datei anzeigen

@ -24,7 +24,7 @@ public final class BlockEntityIds {
private static final int[] IDS; private static final int[] IDS;
static { static {
final int[] ids = com.viaversion.viaversion.protocols.protocol1_18to1_17_1.BlockEntityIds.getIds(); final int[] ids = com.viaversion.viaversion.protocols.protocol1_18to1_17_1.data.BlockEntityIds.getIds();
IDS = new int[Arrays.stream(ids).max().getAsInt() + 1]; IDS = new int[Arrays.stream(ids).max().getAsInt() + 1];
Arrays.fill(IDS, -1); Arrays.fill(IDS, -1);
for (int i = 0; i < ids.length; i++) { for (int i = 0; i < ids.length; i++) {

Datei anzeigen

@ -47,8 +47,8 @@ import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets; import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18; import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ChatDecorationResult;
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.Protocol1_19_1To1_19; import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.Protocol1_19_1To1_19;
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.data.ChatDecorationResult;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19;
import com.viaversion.viaversion.rewriter.CommandRewriter; import com.viaversion.viaversion.rewriter.CommandRewriter;

Datei anzeigen

@ -49,6 +49,7 @@ public class Protocol1_9_4To1_10 extends BackwardsProtocol<ClientboundPackets1_9
super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class); super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class);
} }
@Override
protected void registerPackets() { protected void registerPackets() {
entityPackets.register(); entityPackets.register();
blockItemPackets.register(); blockItemPackets.register();
@ -90,8 +91,8 @@ public class Protocol1_9_4To1_10 extends BackwardsProtocol<ClientboundPackets1_9
}); });
} }
@Override
public void init(UserConnection user) { public void init(UserConnection user) {
// Register ClientWorld
if (!user.has(ClientWorld.class)) { if (!user.has(ClientWorld.class)) {
user.put(new ClientWorld()); user.put(new ClientWorld());
} }