Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-24 23:30:17 +01:00
Merge 1.19.1->1.19 and 1.19->1.18.2 protocols
Dieser Commit ist enthalten in:
Ursprung
41e4172136
Commit
80041606a7
@ -45,9 +45,8 @@ import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4T
|
|||||||
import com.viaversion.viabackwards.protocol.protocol1_16to1_16_1.Protocol1_16To1_16_1;
|
import com.viaversion.viabackwards.protocol.protocol1_16to1_16_1.Protocol1_16To1_16_1;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.Protocol1_17_1To1_18;
|
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.Protocol1_17_1To1_18;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_17to1_17_1.Protocol1_17To1_17_1;
|
import com.viaversion.viabackwards.protocol.protocol1_17to1_17_1.Protocol1_17To1_17_1;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.Protocol1_18_2To1_19_1;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18to1_18_2.Protocol1_18To1_18_2;
|
import com.viaversion.viabackwards.protocol.protocol1_18to1_18_2.Protocol1_18To1_18_2;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_19to1_19_1.Protocol1_19To1_19_1;
|
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
import com.viaversion.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
||||||
import com.viaversion.viaversion.api.Via;
|
import com.viaversion.viaversion.api.Via;
|
||||||
import com.viaversion.viaversion.api.protocol.ProtocolManager;
|
import com.viaversion.viaversion.api.protocol.ProtocolManager;
|
||||||
@ -114,8 +113,8 @@ public interface ViaBackwardsPlatform {
|
|||||||
protocolManager.registerProtocol(new Protocol1_17_1To1_18(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_18);
|
protocolManager.registerProtocol(new Protocol1_17_1To1_18(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_18);
|
||||||
protocolManager.registerProtocol(new Protocol1_18To1_18_2(), ProtocolVersion.v1_18, ProtocolVersion.v1_18_2);
|
protocolManager.registerProtocol(new Protocol1_18To1_18_2(), ProtocolVersion.v1_18, ProtocolVersion.v1_18_2);
|
||||||
|
|
||||||
protocolManager.registerProtocol(new Protocol1_18_2To1_19(), ProtocolVersion.v1_18_2, ProtocolVersion.v1_19);
|
// 1.19.0 clients cannot join 1.19.1+ servers due to changes in the public profile key. 1.19.0 servers can use older ViaBackwards 4.3.1 snapshots
|
||||||
protocolManager.registerProtocol(new Protocol1_19To1_19_1(), ProtocolVersion.v1_19, ProtocolVersion.v1_19_1);
|
protocolManager.registerProtocol(new Protocol1_18_2To1_19_1(), ProtocolVersion.v1_18_2, ProtocolVersion.v1_19_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,18 +15,18 @@
|
|||||||
* 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_18_2to1_19;
|
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.viaversion.viabackwards.ViaBackwards;
|
import com.viaversion.viabackwards.ViaBackwards;
|
||||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||||
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
|
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.protocol1_18_2to1_19.data.BackwardsMappings;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.data.BackwardsMappings;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.data.CommandRewriter1_19;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.data.CommandRewriter1_19;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.BlockItemPackets1_19;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.packets.BlockItemPackets1_19;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets.EntityPackets1_19;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.packets.EntityPackets1_19;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.DimensionRegistryStorage;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.storage.DimensionRegistryStorage;
|
||||||
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;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
||||||
@ -62,7 +62,7 @@ import com.viaversion.viaversion.rewriter.TagRewriter;
|
|||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPackets1_19, ClientboundPackets1_18, ServerboundPackets1_19, ServerboundPackets1_17> {
|
public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundPackets1_19, ClientboundPackets1_18, ServerboundPackets1_19, ServerboundPackets1_17> {
|
||||||
|
|
||||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||||
private static final UUID ZERO_UUID = new UUID(0, 0);
|
private static final UUID ZERO_UUID = new UUID(0, 0);
|
||||||
@ -71,7 +71,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
|||||||
private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this);
|
private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this);
|
||||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||||
|
|
||||||
public Protocol1_18_2To1_19() {
|
public Protocol1_18_2To1_19_1() {
|
||||||
super(ClientboundPackets1_19.class, ClientboundPackets1_18.class, ServerboundPackets1_19.class, ServerboundPackets1_17.class);
|
super(ClientboundPackets1_19.class, ClientboundPackets1_18.class, ServerboundPackets1_19.class, ServerboundPackets1_17.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,6 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
|||||||
entityRewriter.onMappingDataLoaded();
|
entityRewriter.onMappingDataLoaded();
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO update translation mappings on release
|
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.ACTIONBAR);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.ACTIONBAR);
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_TEXT);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_TEXT);
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_SUBTITLE);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_19.TITLE_SUBTITLE);
|
||||||
@ -227,9 +226,11 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
|||||||
registerClientbound(ClientboundPackets1_19.SYSTEM_CHAT, ClientboundPackets1_18.CHAT_MESSAGE, new PacketRemapper() {
|
registerClientbound(ClientboundPackets1_19.SYSTEM_CHAT, ClientboundPackets1_18.CHAT_MESSAGE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.COMPONENT); // Message
|
map(Type.COMPONENT);
|
||||||
read(Type.VAR_INT);
|
handler(wrapper -> {
|
||||||
create(Type.BYTE, (byte) 0);
|
final boolean overlay = wrapper.read(Type.BOOLEAN);
|
||||||
|
wrapper.write(Type.BYTE, overlay ? (byte) 2 : (byte) 0);
|
||||||
|
});
|
||||||
create(Type.UUID, ZERO_UUID); // Sender
|
create(Type.UUID, ZERO_UUID); // Sender
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -278,7 +279,9 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
|||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // Name
|
map(Type.STRING); // Name
|
||||||
create(Type.OPTIONAL_PROFILE_KEY, null); // No public key - requiring this has to be disabled on the server
|
// Write empty profile key and uuid - requires the enforce-secure-profiles option to be disabled on the server
|
||||||
|
create(Type.OPTIONAL_PROFILE_KEY, null);
|
||||||
|
create(Type.OPTIONAL_UUID, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -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_18_2to1_19.data;
|
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.data;
|
||||||
|
|
||||||
import com.viaversion.viabackwards.api.data.VBMappingDataLoader;
|
import com.viaversion.viabackwards.api.data.VBMappingDataLoader;
|
||||||
import com.viaversion.viaversion.api.minecraft.nbt.BinaryTagIO;
|
import com.viaversion.viaversion.api.minecraft.nbt.BinaryTagIO;
|
@ -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_18_2to1_19.data;
|
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.data;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
@ -15,10 +15,10 @@
|
|||||||
* 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_18_2to1_19.packets;
|
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.packets;
|
||||||
|
|
||||||
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.Protocol1_18_2To1_19_1;
|
||||||
import com.viaversion.viaversion.api.data.ParticleMappings;
|
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||||
import com.viaversion.viaversion.api.data.entity.EntityTracker;
|
import com.viaversion.viaversion.api.data.entity.EntityTracker;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||||
@ -36,9 +36,9 @@ import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPacke
|
|||||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||||
import com.viaversion.viaversion.util.MathUtil;
|
import com.viaversion.viaversion.util.MathUtil;
|
||||||
|
|
||||||
public final class BlockItemPackets1_19 extends ItemRewriter<Protocol1_18_2To1_19> {
|
public final class BlockItemPackets1_19 extends ItemRewriter<Protocol1_18_2To1_19_1> {
|
||||||
|
|
||||||
public BlockItemPackets1_19(final Protocol1_18_2To1_19 protocol) {
|
public BlockItemPackets1_19(final Protocol1_18_2To1_19_1 protocol) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
}
|
}
|
||||||
|
|
@ -15,12 +15,12 @@
|
|||||||
* 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_18_2to1_19.packets;
|
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.packets;
|
||||||
|
|
||||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.Protocol1_18_2To1_19_1;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.DimensionRegistryStorage;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.storage.DimensionRegistryStorage;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.StoredPainting;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.storage.StoredPainting;
|
||||||
import com.viaversion.viaversion.api.data.ParticleMappings;
|
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||||
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
||||||
import com.viaversion.viaversion.api.minecraft.Position;
|
import com.viaversion.viaversion.api.minecraft.Position;
|
||||||
@ -41,9 +41,9 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
|||||||
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_19to1_18_2.ClientboundPackets1_19;
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
||||||
|
|
||||||
public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19> {
|
public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19_1> {
|
||||||
|
|
||||||
public EntityPackets1_19(final Protocol1_18_2To1_19 protocol) {
|
public EntityPackets1_19(final Protocol1_18_2To1_19_1 protocol) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
|||||||
packet.write(Type.BYTE, storedPainting.direction());
|
packet.write(Type.BYTE, storedPainting.direction());
|
||||||
try {
|
try {
|
||||||
// TODO Race condition
|
// TODO Race condition
|
||||||
packet.send(Protocol1_18_2To1_19.class);
|
packet.send(Protocol1_18_2To1_19_1.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -327,6 +327,8 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
|||||||
filter().type(Entity1_19Types.WARDEN).cancel(16); // Anger
|
filter().type(Entity1_19Types.WARDEN).cancel(16); // Anger
|
||||||
mapEntityTypeWithData(Entity1_19Types.WARDEN, Entity1_19Types.IRON_GOLEM).jsonName();
|
mapEntityTypeWithData(Entity1_19Types.WARDEN, Entity1_19Types.IRON_GOLEM).jsonName();
|
||||||
|
|
||||||
|
filter().type(Entity1_19Types.ALLAY).cancel(16); // Dancing
|
||||||
|
filter().type(Entity1_19Types.ALLAY).cancel(17); // Can duplicate
|
||||||
mapEntityTypeWithData(Entity1_19Types.ALLAY, Entity1_19Types.VEX).jsonName();
|
mapEntityTypeWithData(Entity1_19Types.ALLAY, Entity1_19Types.VEX).jsonName();
|
||||||
|
|
||||||
filter().type(Entity1_19Types.GOAT).cancel(18);
|
filter().type(Entity1_19Types.GOAT).cancel(18);
|
@ -15,9 +15,9 @@
|
|||||||
* 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_18_2to1_19.storage;
|
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.storage;
|
||||||
|
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.Protocol1_18_2To1_19_1;
|
||||||
import com.viaversion.viaversion.api.connection.StorableObject;
|
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
@ -42,7 +42,7 @@ public final class DimensionRegistryStorage implements StorableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable CompoundTag chatType(final int id) {
|
public @Nullable CompoundTag chatType(final int id) {
|
||||||
if (chatTypes.isEmpty()) return Protocol1_18_2To1_19.MAPPINGS.chatType(id);
|
if (chatTypes.isEmpty()) return Protocol1_18_2To1_19_1.MAPPINGS.chatType(id);
|
||||||
return chatTypes.get(id);
|
return chatTypes.get(id);
|
||||||
}
|
}
|
||||||
|
|
@ -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_18_2to1_19.storage;
|
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19_1.storage;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.connection.StorableObject;
|
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||||
import com.viaversion.viaversion.api.minecraft.Position;
|
import com.viaversion.viaversion.api.minecraft.Position;
|
@ -1,76 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
|
||||||
* Copyright (C) 2016-2022 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.protocol1_19to1_19_1;
|
|
||||||
|
|
||||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_19to1_19_1.packets.EntityPackets1_19_1;
|
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
|
||||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
|
||||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
|
||||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19;
|
|
||||||
|
|
||||||
public final class Protocol1_19To1_19_1 extends BackwardsProtocol<ClientboundPackets1_19, ClientboundPackets1_19, ServerboundPackets1_19, ServerboundPackets1_19> {
|
|
||||||
|
|
||||||
private final EntityPackets1_19_1 entityRewriter = new EntityPackets1_19_1(this);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void registerPackets() {
|
|
||||||
entityRewriter.register();
|
|
||||||
|
|
||||||
// Skip 1.19 and assume 1.19.1->1.18.2 translation
|
|
||||||
registerClientbound(ClientboundPackets1_19.SYSTEM_CHAT, new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
map(Type.COMPONENT);
|
|
||||||
handler(wrapper -> {
|
|
||||||
if (wrapper.read(Type.BOOLEAN)) {
|
|
||||||
wrapper.cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wrapper.write(Type.VAR_INT, 0); // TODO
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
|
||||||
@Override
|
|
||||||
public void registerMap() {
|
|
||||||
map(Type.STRING); // Name
|
|
||||||
// Write empty profile key and uuid
|
|
||||||
read(Type.OPTIONAL_PROFILE_KEY);
|
|
||||||
create(Type.OPTIONAL_PROFILE_KEY, null);
|
|
||||||
create(Type.OPTIONAL_UUID, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityPackets1_19_1 getEntityRewriter() {
|
|
||||||
return entityRewriter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(final UserConnection user) {
|
|
||||||
addEntityTracker(user, new EntityTrackerBase(user, null));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
|
||||||
* Copyright (C) 2016-2022 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.protocol1_19to1_19_1.packets;
|
|
||||||
|
|
||||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_19to1_19_1.Protocol1_19To1_19_1;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_18;
|
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_19;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
|
||||||
|
|
||||||
public final class EntityPackets1_19_1 extends EntityRewriter<Protocol1_19To1_19_1> {
|
|
||||||
|
|
||||||
public EntityPackets1_19_1(final Protocol1_19To1_19_1 protocol) {
|
|
||||||
super(protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void registerPackets() {
|
|
||||||
registerMetadataRewriter(ClientboundPackets1_19.ENTITY_METADATA, Types1_19.METADATA_LIST, Types1_18.METADATA_LIST);
|
|
||||||
registerRemoveEntities(ClientboundPackets1_19.REMOVE_ENTITIES);
|
|
||||||
registerSpawnTracker(ClientboundPackets1_19.SPAWN_ENTITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRewrites() {
|
|
||||||
filter().type(Entity1_19Types.ALLAY).cancel(16); // Dancing
|
|
||||||
filter().type(Entity1_19Types.ALLAY).cancel(17); // Can duplicate
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityType typeFromId(final int typeId) {
|
|
||||||
return Entity1_19Types.getTypeFromId(typeId);
|
|
||||||
}
|
|
||||||
}
|
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren