mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-12-22 16:38:04 +01:00
Updated Via*
This commit is contained in:
parent
3b0c557776
commit
54806174c3
@ -67,7 +67,7 @@ dependencies {
|
||||
}
|
||||
include "com.viaversion:viarewind-core:2.0.3-SNAPSHOT"
|
||||
include "net.raphimc:ViaLegacy:2.2.4"
|
||||
include "net.raphimc:ViaAprilFools:2.0.2"
|
||||
include "net.raphimc:ViaAprilFools:2.0.3"
|
||||
include("net.raphimc:ViaProtocolHack:2.1.3") {
|
||||
exclude group: "org.slf4j", module: "slf4j-api"
|
||||
}
|
||||
|
@ -6,4 +6,4 @@ org.gradle.configureondemand=true
|
||||
# Project properties
|
||||
maven_name=ViaProxy
|
||||
maven_group=net.raphimc
|
||||
maven_version=3.0.11
|
||||
maven_version=3.0.12
|
||||
|
@ -21,7 +21,8 @@ import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||
@ -40,85 +41,70 @@ import java.util.List;
|
||||
|
||||
public class ClassicWorldHeightInjection {
|
||||
|
||||
public static PacketRemapper handleJoinGame(final Protocol1_17To1_16_4 protocol, final PacketRemapper parentRemapper) {
|
||||
return new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
parentRemapper.remap(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
public static PacketHandler handleJoinGame(final Protocol1_17To1_16_4 protocol, final PacketHandler parentHandler) {
|
||||
return wrapper -> {
|
||||
parentHandler.handle(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
|
||||
if (VersionEnum.fromUserConnection(wrapper.user()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
for (Tag dimension : wrapper.get(Type.NBT, 0).<CompoundTag>get("minecraft:dimension_type").<ListTag>get("value")) {
|
||||
changeDimensionTagHeight(wrapper.user(), ((CompoundTag) dimension).get("element"));
|
||||
}
|
||||
changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 1));
|
||||
}
|
||||
});
|
||||
if (VersionEnum.fromUserConnection(wrapper.user()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
for (Tag dimension : wrapper.get(Type.NBT, 0).<CompoundTag>get("minecraft:dimension_type").<ListTag>get("value")) {
|
||||
changeDimensionTagHeight(wrapper.user(), ((CompoundTag) dimension).get("element"));
|
||||
}
|
||||
changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 1));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static PacketRemapper handleRespawn(final Protocol1_17To1_16_4 protocol, final PacketRemapper parentRemapper) {
|
||||
return new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
parentRemapper.remap(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
public static PacketHandler handleRespawn(final Protocol1_17To1_16_4 protocol, final PacketHandler parentHandler) {
|
||||
return wrapper -> {
|
||||
parentHandler.handle(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
|
||||
if (VersionEnum.fromUserConnection(wrapper.user()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 0));
|
||||
}
|
||||
});
|
||||
if (VersionEnum.fromUserConnection(wrapper.user()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
changeDimensionTagHeight(wrapper.user(), wrapper.get(Type.NBT, 0));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static PacketRemapper handleChunkData(final Protocol1_17To1_16_4 protocol, final PacketRemapper parentRemapper) {
|
||||
return new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
parentRemapper.remap(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
public static PacketHandler handleChunkData(final Protocol1_17To1_16_4 protocol, final PacketHandler parentHandler) {
|
||||
return wrapper -> {
|
||||
parentHandler.handle(wrapper);
|
||||
if (wrapper.isCancelled()) return;
|
||||
|
||||
if (VersionEnum.fromUserConnection(wrapper.user()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
wrapper.resetReader();
|
||||
final Chunk chunk = wrapper.read(new Chunk1_17Type(16));
|
||||
wrapper.write(new Chunk1_17Type(chunk.getSections().length), chunk);
|
||||
if (VersionEnum.fromUserConnection(wrapper.user()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
wrapper.resetReader();
|
||||
final Chunk chunk = wrapper.read(new Chunk1_17Type(16));
|
||||
wrapper.write(new Chunk1_17Type(chunk.getSections().length), chunk);
|
||||
|
||||
final ClassicWorldHeightProvider heightProvider = Via.getManager().getProviders().get(ClassicWorldHeightProvider.class);
|
||||
if (chunk.getSections().length < heightProvider.getMaxChunkSectionCount(wrapper.user())) { // Increase available sections to match new world height
|
||||
final ChunkSection[] newArray = new ChunkSection[heightProvider.getMaxChunkSectionCount(wrapper.user())];
|
||||
System.arraycopy(chunk.getSections(), 0, newArray, 0, chunk.getSections().length);
|
||||
chunk.setSections(newArray);
|
||||
}
|
||||
final ClassicWorldHeightProvider heightProvider = Via.getManager().getProviders().get(ClassicWorldHeightProvider.class);
|
||||
if (chunk.getSections().length < heightProvider.getMaxChunkSectionCount(wrapper.user())) { // Increase available sections to match new world height
|
||||
final ChunkSection[] newArray = new ChunkSection[heightProvider.getMaxChunkSectionCount(wrapper.user())];
|
||||
System.arraycopy(chunk.getSections(), 0, newArray, 0, chunk.getSections().length);
|
||||
chunk.setSections(newArray);
|
||||
}
|
||||
|
||||
final BitSet chunkMask = new BitSet();
|
||||
for (int i = 0; i < chunk.getSections().length; i++) {
|
||||
if (chunk.getSections()[i] != null) chunkMask.set(i);
|
||||
}
|
||||
chunk.setChunkMask(chunkMask);
|
||||
final BitSet chunkMask = new BitSet();
|
||||
for (int i = 0; i < chunk.getSections().length; i++) {
|
||||
if (chunk.getSections()[i] != null) chunkMask.set(i);
|
||||
}
|
||||
chunk.setChunkMask(chunkMask);
|
||||
|
||||
final int[] newBiomeData = new int[chunk.getSections().length * 4 * 4 * 4];
|
||||
System.arraycopy(chunk.getBiomeData(), 0, newBiomeData, 0, chunk.getBiomeData().length);
|
||||
for (int i = 64; i < chunk.getSections().length * 4; i++) { // copy top layer of old biome data all the way to max world height
|
||||
System.arraycopy(chunk.getBiomeData(), chunk.getBiomeData().length - 16, newBiomeData, i * 16, 16);
|
||||
}
|
||||
chunk.setBiomeData(newBiomeData);
|
||||
final int[] newBiomeData = new int[chunk.getSections().length * 4 * 4 * 4];
|
||||
System.arraycopy(chunk.getBiomeData(), 0, newBiomeData, 0, chunk.getBiomeData().length);
|
||||
for (int i = 64; i < chunk.getSections().length * 4; i++) { // copy top layer of old biome data all the way to max world height
|
||||
System.arraycopy(chunk.getBiomeData(), chunk.getBiomeData().length - 16, newBiomeData, i * 16, 16);
|
||||
}
|
||||
chunk.setBiomeData(newBiomeData);
|
||||
|
||||
chunk.setHeightMap(new CompoundTag()); // rip heightmap :(
|
||||
}
|
||||
});
|
||||
chunk.setHeightMap(new CompoundTag()); // rip heightmap :(
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static PacketRemapper handleUpdateLight(final Protocol1_17To1_16_4 protocol, final PacketRemapper parentRemapper) {
|
||||
final PacketRemapper classicLightHandler = new PacketRemapper() {
|
||||
public static PacketHandler handleUpdateLight(final Protocol1_17To1_16_4 protocol, final PacketHandler parentHandler) {
|
||||
final PacketHandler classicLightHandler = new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.VAR_INT); // x
|
||||
map(Type.VAR_INT); // y
|
||||
map(Type.BOOLEAN); // trust edges
|
||||
@ -174,16 +160,11 @@ public class ClassicWorldHeightInjection {
|
||||
}
|
||||
};
|
||||
|
||||
return new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
if (VersionEnum.fromUserConnection(wrapper.user()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
classicLightHandler.remap(wrapper);
|
||||
} else {
|
||||
parentRemapper.remap(wrapper);
|
||||
}
|
||||
});
|
||||
return wrapper -> {
|
||||
if (VersionEnum.fromUserConnection(wrapper.user()).isOlderThanOrEqualTo(VersionEnum.c0_28toc0_30)) {
|
||||
classicLightHandler.handle(wrapper);
|
||||
} else {
|
||||
parentHandler.handle(wrapper);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package net.raphimc.viaproxy.injection.mixins;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.packets.EntityPackets;
|
||||
@ -31,12 +31,12 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@Mixin(value = EntityPackets.class, remap = false)
|
||||
public abstract class MixinEntityPackets1_17 {
|
||||
|
||||
@Redirect(method = "registerPackets", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/protocols/protocol1_17to1_16_4/Protocol1_17To1_16_4;registerClientbound(Lcom/viaversion/viaversion/api/protocol/packet/ClientboundPacketType;Lcom/viaversion/viaversion/api/protocol/remapper/PacketRemapper;)V"))
|
||||
private void handleClassicWorldHeight(Protocol1_17To1_16_4 instance, ClientboundPacketType packetType, PacketRemapper packetRemapper) {
|
||||
if (packetType == ClientboundPackets1_16_2.JOIN_GAME) packetRemapper = ClassicWorldHeightInjection.handleJoinGame(instance, packetRemapper);
|
||||
if (packetType == ClientboundPackets1_16_2.RESPAWN) packetRemapper = ClassicWorldHeightInjection.handleRespawn(instance, packetRemapper);
|
||||
@Redirect(method = "registerPackets", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/protocols/protocol1_17to1_16_4/Protocol1_17To1_16_4;registerClientbound(Lcom/viaversion/viaversion/api/protocol/packet/ClientboundPacketType;Lcom/viaversion/viaversion/api/protocol/remapper/PacketHandler;)V"))
|
||||
private void handleClassicWorldHeight(Protocol1_17To1_16_4 instance, ClientboundPacketType packetType, PacketHandler packetHandler) {
|
||||
if (packetType == ClientboundPackets1_16_2.JOIN_GAME) packetHandler = ClassicWorldHeightInjection.handleJoinGame(instance, packetHandler);
|
||||
if (packetType == ClientboundPackets1_16_2.RESPAWN) packetHandler = ClassicWorldHeightInjection.handleRespawn(instance, packetHandler);
|
||||
|
||||
((Protocol) instance).registerClientbound(packetType, packetRemapper);
|
||||
((Protocol) instance).registerClientbound(packetType, packetHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,11 +23,10 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(targets = "com.viaversion.viaversion.protocols.protocol1_14to1_13_2.packets.InventoryPackets$3$1", remap = false)
|
||||
public abstract class MixinInventoryPackets_3_1 {
|
||||
@Mixin(targets = "com.viaversion.viaversion.protocols.protocol1_14to1_13_2.packets.InventoryPackets$2", remap = false)
|
||||
public abstract class MixinInventoryPackets_2 {
|
||||
|
||||
@SuppressWarnings({"UnresolvedMixinReference", "MixinAnnotationTarget"})
|
||||
@Inject(method = "handle", at = @At(value = "FIELD", target = "Lcom/viaversion/viaversion/api/type/Type;BOOLEAN:Lcom/viaversion/viaversion/api/type/types/BooleanType;", ordinal = 2, shift = At.Shift.BEFORE))
|
||||
@Inject(method = "lambda$register$0", at = @At(value = "FIELD", target = "Lcom/viaversion/viaversion/api/type/Type;BOOLEAN:Lcom/viaversion/viaversion/api/type/types/BooleanType;", ordinal = 2, shift = At.Shift.BEFORE))
|
||||
private void removeExtraData(PacketWrapper wrapper, CallbackInfo ci) {
|
||||
wrapper.clearInputBuffer();
|
||||
}
|
@ -19,7 +19,7 @@ package net.raphimc.viaproxy.injection.mixins;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||
@ -43,9 +43,9 @@ public abstract class MixinProtocol1_19_1To1_19 extends AbstractProtocol<Clientb
|
||||
|
||||
@Inject(method = "registerPackets", at = @At("RETURN"))
|
||||
private void allowSignatures(CallbackInfo ci) {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Name
|
||||
read(Type.OPTIONAL_PROFILE_KEY); // Profile Key
|
||||
handler(wrapper -> {
|
||||
@ -55,20 +55,14 @@ public abstract class MixinProtocol1_19_1To1_19 extends AbstractProtocol<Clientb
|
||||
read(Type.OPTIONAL_UUID); // Profile uuid
|
||||
}
|
||||
}, true);
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
}
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), wrapper -> {
|
||||
}, true);
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
}
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), wrapper -> {
|
||||
}, true);
|
||||
|
||||
this.registerServerbound(ServerboundPackets1_19_1.CHAT_MESSAGE, ServerboundPackets1_19.CHAT_MESSAGE, new PacketRemapper() {
|
||||
this.registerServerbound(ServerboundPackets1_19_1.CHAT_MESSAGE, ServerboundPackets1_19.CHAT_MESSAGE, new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Message
|
||||
map(Type.LONG); // Timestamp
|
||||
map(Type.LONG); // Salt
|
||||
|
@ -20,7 +20,7 @@ package net.raphimc.viaproxy.injection.mixins;
|
||||
import com.google.common.primitives.Longs;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.BitSetType;
|
||||
import com.viaversion.viaversion.api.type.types.ByteArrayType;
|
||||
@ -63,9 +63,9 @@ public abstract class MixinProtocol1_19_3To1_19_1 extends AbstractProtocol<Clien
|
||||
|
||||
@Inject(method = "registerPackets", at = @At("RETURN"))
|
||||
private void allowSignatures(CallbackInfo ci) {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Name
|
||||
handler(wrapper -> {
|
||||
final ChatSession1_19_1 chatSession = wrapper.user().get(ChatSession1_19_1.class);
|
||||
@ -74,9 +74,9 @@ public abstract class MixinProtocol1_19_3To1_19_1 extends AbstractProtocol<Clien
|
||||
map(Type.OPTIONAL_UUID); // Profile uuid
|
||||
}
|
||||
}, true);
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Server id
|
||||
map(Type.BYTE_ARRAY_PRIMITIVE); // Public key
|
||||
handler(wrapper -> {
|
||||
@ -84,9 +84,9 @@ public abstract class MixinProtocol1_19_3To1_19_1 extends AbstractProtocol<Clien
|
||||
});
|
||||
}
|
||||
});
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketRemapper() {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.BYTE_ARRAY_PRIMITIVE); // Public key
|
||||
handler(wrapper -> {
|
||||
final ChatSession1_19_1 chatSession = wrapper.user().get(ChatSession1_19_1.class);
|
||||
@ -108,9 +108,9 @@ public abstract class MixinProtocol1_19_3To1_19_1 extends AbstractProtocol<Clien
|
||||
}
|
||||
}, true);
|
||||
|
||||
this.registerServerbound(ServerboundPackets1_19_3.CHAT_MESSAGE, ServerboundPackets1_19_1.CHAT_MESSAGE, new PacketRemapper() {
|
||||
this.registerServerbound(ServerboundPackets1_19_3.CHAT_MESSAGE, ServerboundPackets1_19_1.CHAT_MESSAGE, new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Message
|
||||
map(Type.LONG); // Timestamp
|
||||
map(Type.LONG); // Salt
|
||||
|
@ -17,15 +17,16 @@
|
||||
*/
|
||||
package net.raphimc.viaproxy.injection.mixins;
|
||||
|
||||
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.packets.WorldPackets;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(targets = "com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.packets.WorldPackets$2", remap = false)
|
||||
public abstract class MixinWorldPackets_2 {
|
||||
@Mixin(value = WorldPackets.class, remap = false)
|
||||
public abstract class MixinWorldPackets1_16_2 {
|
||||
|
||||
@ModifyConstant(method = "lambda$registerMap$0", constant = @Constant(intValue = 16))
|
||||
private static int modifySectionCountToSupportClassicWorldHeight() {
|
||||
@ModifyConstant(method = "lambda$register$1", constant = @Constant(intValue = 16))
|
||||
private static int modifySectionCountToSupportClassicWorldHeight(int constant) {
|
||||
return 64;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package net.raphimc.viaproxy.injection.mixins;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.packets.WorldPackets;
|
||||
@ -31,12 +31,12 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@Mixin(value = WorldPackets.class, remap = false)
|
||||
public abstract class MixinWorldPackets1_17 {
|
||||
|
||||
@Redirect(method = "register", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/protocols/protocol1_17to1_16_4/Protocol1_17To1_16_4;registerClientbound(Lcom/viaversion/viaversion/api/protocol/packet/ClientboundPacketType;Lcom/viaversion/viaversion/api/protocol/remapper/PacketRemapper;)V"))
|
||||
private static void handleClassicWorldHeight(Protocol1_17To1_16_4 instance, ClientboundPacketType packetType, PacketRemapper packetRemapper) {
|
||||
if (packetType == ClientboundPackets1_16_2.CHUNK_DATA) packetRemapper = ClassicWorldHeightInjection.handleChunkData(instance, packetRemapper);
|
||||
if (packetType == ClientboundPackets1_16_2.UPDATE_LIGHT) packetRemapper = ClassicWorldHeightInjection.handleUpdateLight(instance, packetRemapper);
|
||||
@Redirect(method = "register", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/protocols/protocol1_17to1_16_4/Protocol1_17To1_16_4;registerClientbound(Lcom/viaversion/viaversion/api/protocol/packet/ClientboundPacketType;Lcom/viaversion/viaversion/api/protocol/remapper/PacketHandler;)V"))
|
||||
private static void handleClassicWorldHeight(Protocol1_17To1_16_4 instance, ClientboundPacketType packetType, PacketHandler packetHandler) {
|
||||
if (packetType == ClientboundPackets1_16_2.CHUNK_DATA) packetHandler = ClassicWorldHeightInjection.handleChunkData(instance, packetHandler);
|
||||
if (packetType == ClientboundPackets1_16_2.UPDATE_LIGHT) packetHandler = ClassicWorldHeightInjection.handleUpdateLight(instance, packetHandler);
|
||||
|
||||
((Protocol) instance).registerClientbound(packetType, packetRemapper);
|
||||
((Protocol) instance).registerClientbound(packetType, packetHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package net.raphimc.viaproxy.injection.transformer;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18_2to1_18.Protocol1_18_2To1_18;
|
||||
@ -34,18 +34,18 @@ public abstract class Protocol1_18_2To1_18Transformer extends AbstractProtocol<C
|
||||
|
||||
@CInject(method = "registerPackets", target = @CTarget("RETURN"))
|
||||
private void fixDownloadingTerrainScreenNotClosing() {
|
||||
this.registerClientbound(ClientboundPackets1_18.PLAYER_POSITION, new PacketRemapper() {
|
||||
this.registerClientbound(ClientboundPackets1_18.PLAYER_POSITION, new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final SpawnPositionTracker tracker = wrapper.user().get(SpawnPositionTracker.class);
|
||||
tracker.sendSpawnPosition();
|
||||
});
|
||||
}
|
||||
});
|
||||
this.registerClientbound(ClientboundPackets1_18.SPAWN_POSITION, new PacketRemapper() {
|
||||
this.registerClientbound(ClientboundPackets1_18.SPAWN_POSITION, new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.POSITION1_14); // position
|
||||
map(Type.FLOAT); // angle
|
||||
handler(wrapper -> {
|
||||
|
@ -21,7 +21,7 @@ import com.google.common.primitives.Longs;
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||
@ -51,9 +51,9 @@ public abstract class Protocol1_18_2To1_19Transformer extends BackwardsProtocol<
|
||||
|
||||
@CInject(method = "registerPackets", target = @CTarget("RETURN"))
|
||||
private void allowSignatures(InjectionCallback ic) {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Name
|
||||
handler(wrapper -> {
|
||||
final ChatSession1_19_0 chatSession = wrapper.user().get(ChatSession1_19_0.class);
|
||||
@ -61,9 +61,9 @@ public abstract class Protocol1_18_2To1_19Transformer extends BackwardsProtocol<
|
||||
});
|
||||
}
|
||||
}, true);
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Server id
|
||||
map(Type.BYTE_ARRAY_PRIMITIVE); // Public key
|
||||
handler(wrapper -> {
|
||||
@ -71,9 +71,9 @@ public abstract class Protocol1_18_2To1_19Transformer extends BackwardsProtocol<
|
||||
});
|
||||
}
|
||||
}, true);
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketRemapper() {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.BYTE_ARRAY_PRIMITIVE); // Public key
|
||||
handler(wrapper -> {
|
||||
final ChatSession1_19_0 chatSession = wrapper.user().get(ChatSession1_19_0.class);
|
||||
@ -95,9 +95,9 @@ public abstract class Protocol1_18_2To1_19Transformer extends BackwardsProtocol<
|
||||
}
|
||||
}, true);
|
||||
|
||||
this.registerServerbound(ServerboundPackets1_17.CHAT_MESSAGE, ServerboundPackets1_19.CHAT_MESSAGE, new PacketRemapper() {
|
||||
this.registerServerbound(ServerboundPackets1_17.CHAT_MESSAGE, ServerboundPackets1_19.CHAT_MESSAGE, new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Message
|
||||
handler(wrapper -> wrapper.write(Type.LONG, Instant.now().toEpochMilli())); // Timestamp
|
||||
create(Type.LONG, 0L); // Salt
|
||||
|
@ -21,7 +21,7 @@ import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_19to1_19_1.Protocol1_19To1_19_1;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_19to1_19_1.storage.ReceivedMessagesStorage;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
||||
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||
@ -48,9 +48,9 @@ public abstract class Protocol1_19To1_19_1Transformer extends BackwardsProtocol<
|
||||
|
||||
@CInject(method = "registerPackets", target = @CTarget("RETURN"))
|
||||
private void allowSignatures(InjectionCallback ic) {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Name
|
||||
read(Type.OPTIONAL_PROFILE_KEY); // Profile Key
|
||||
handler(wrapper -> {
|
||||
@ -60,20 +60,14 @@ public abstract class Protocol1_19To1_19_1Transformer extends BackwardsProtocol<
|
||||
});
|
||||
}
|
||||
}, true);
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
}
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), wrapper -> {
|
||||
}, true);
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
}
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), wrapper -> {
|
||||
}, true);
|
||||
|
||||
this.registerServerbound(ServerboundPackets1_19.CHAT_MESSAGE, ServerboundPackets1_19_1.CHAT_MESSAGE, new PacketRemapper() {
|
||||
this.registerServerbound(ServerboundPackets1_19.CHAT_MESSAGE, ServerboundPackets1_19_1.CHAT_MESSAGE, new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Message
|
||||
map(Type.LONG); // Timestamp
|
||||
map(Type.LONG); // Salt
|
||||
|
@ -22,7 +22,7 @@ import com.viaversion.viabackwards.protocol.protocol1_19_1to1_19_3.Protocol1_19_
|
||||
import com.viaversion.viaversion.api.minecraft.PlayerMessageSignature;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.BitSetType;
|
||||
import com.viaversion.viaversion.api.type.types.ByteArrayType;
|
||||
@ -49,9 +49,9 @@ public abstract class Protocol1_19_1To1_19_3Transformer extends BackwardsProtoco
|
||||
|
||||
@CInject(method = "registerPackets", target = @CTarget("RETURN"))
|
||||
private void allowSignatures(InjectionCallback ic) {
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.GAME_PROFILE.getId(), ClientboundLoginPackets.GAME_PROFILE.getId(), new PacketRemapper() {
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.GAME_PROFILE.getId(), ClientboundLoginPackets.GAME_PROFILE.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final ChatSession1_19_3 chatSession = wrapper.user().get(ChatSession1_19_3.class);
|
||||
|
||||
@ -65,9 +65,9 @@ public abstract class Protocol1_19_1To1_19_3Transformer extends BackwardsProtoco
|
||||
}
|
||||
}, true);
|
||||
|
||||
this.registerServerbound(ServerboundPackets1_19_1.CHAT_MESSAGE, ServerboundPackets1_19_3.CHAT_MESSAGE, new PacketRemapper() {
|
||||
this.registerServerbound(ServerboundPackets1_19_1.CHAT_MESSAGE, ServerboundPackets1_19_3.CHAT_MESSAGE, new PacketHandlers() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
public void register() {
|
||||
map(Type.STRING); // Message
|
||||
map(Type.LONG); // Timestamp
|
||||
map(Type.LONG); // Salt
|
||||
|
Loading…
Reference in New Issue
Block a user