Updated NetMinecraft

This commit is contained in:
RaphiMC 2024-05-17 23:51:08 +02:00
parent a2434c8253
commit 3f3f746f35
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
7 changed files with 30 additions and 30 deletions

View File

@ -54,12 +54,12 @@ repositories {
} }
dependencies { dependencies {
include "com.viaversion:viaversion-common:5.0.0-20240517.190711-8" include "com.viaversion:viaversion-common:5.0.0-SNAPSHOT"
include "com.viaversion:viabackwards-common:5.0.0-20240515.152913-2" include "com.viaversion:viabackwards-common:5.0.0-SNAPSHOT"
include "com.viaversion:viarewind-common:4.0.0-20240515.083613-2" include "com.viaversion:viarewind-common:4.0.0-SNAPSHOT"
include "net.raphimc:ViaLegacy:3.0.0-20240517.210413-2" include "net.raphimc:ViaLegacy:3.0.0-SNAPSHOT"
include "net.raphimc:ViaAprilFools:3.0.0-20240517.172611-2" include "net.raphimc:ViaAprilFools:3.0.0-SNAPSHOT"
include("net.raphimc:ViaBedrock:0.0.8-20240517.153009-1") { include("net.raphimc:ViaBedrock:0.0.8-SNAPSHOT") {
exclude group: "io.netty" exclude group: "io.netty"
exclude group: "io.jsonwebtoken" exclude group: "io.jsonwebtoken"
} }
@ -88,7 +88,7 @@ dependencies {
exclude group: "com.google.code.gson", module: "gson" exclude group: "com.google.code.gson", module: "gson"
} }
include "net.lenni0451.commons:swing:1.5.1" include "net.lenni0451.commons:swing:1.5.1"
include("net.raphimc.netminecraft:all:2.4.0") { include("net.raphimc.netminecraft:all:2.5.0-SNAPSHOT") {
exclude group: "com.google.code.gson", module: "gson" exclude group: "com.google.code.gson", module: "gson"
} }
include("net.raphimc:MinecraftAuth:4.0.1") { include("net.raphimc:MinecraftAuth:4.0.1") {

View File

@ -60,27 +60,27 @@ public abstract class MixinEntityPacketRewriter1_20_5 extends EntityRewriter<Cli
*/ */
@Overwrite @Overwrite
private void sendRangeAttributes(final UserConnection connection, final boolean creativeMode) { private void sendRangeAttributes(final UserConnection connection, final boolean creativeMode) {
final PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_20_5.UPDATE_ATTRIBUTES, connection); final PacketWrapper updateAttributes = PacketWrapper.create(ClientboundPackets1_20_5.UPDATE_ATTRIBUTES, connection);
wrapper.write(Types.VAR_INT, this.tracker(connection).clientEntityId()); updateAttributes.write(Types.VAR_INT, this.tracker(connection).clientEntityId());
if (connection.getProtocolInfo().serverProtocolVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) { if (connection.getProtocolInfo().serverProtocolVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
wrapper.write(Types.VAR_INT, 3); // Number of attributes updateAttributes.write(Types.VAR_INT, 3); // Number of attributes
this.writeAttribute(wrapper, "generic.step_height", 0.5D, null, 0D); this.writeAttribute(updateAttributes, "generic.step_height", 0.5D, null, 0D);
} else { } else {
wrapper.write(Types.VAR_INT, 2); // Number of attributes updateAttributes.write(Types.VAR_INT, 2); // Number of attributes
} }
if (connection.getProtocolInfo().serverProtocolVersion().olderThan(LegacyProtocolVersion.r1_0_0tor1_0_1)) { if (connection.getProtocolInfo().serverProtocolVersion().olderThan(LegacyProtocolVersion.r1_0_0tor1_0_1)) {
this.writeAttribute(wrapper, "player.block_interaction_range", 4D, creativeMode ? CREATIVE_BLOCK_INTERACTION_RANGE : null, 1D); this.writeAttribute(updateAttributes, "player.block_interaction_range", 4D, creativeMode ? CREATIVE_BLOCK_INTERACTION_RANGE : null, 1D);
} else { } else {
this.writeAttribute(wrapper, "player.block_interaction_range", 4.5D, creativeMode ? CREATIVE_BLOCK_INTERACTION_RANGE : null, 0.5D); this.writeAttribute(updateAttributes, "player.block_interaction_range", 4.5D, creativeMode ? CREATIVE_BLOCK_INTERACTION_RANGE : null, 0.5D);
} }
if (connection.getProtocolInfo().serverProtocolVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (connection.getProtocolInfo().serverProtocolVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
this.writeAttribute(wrapper, "player.entity_interaction_range", 3D, creativeMode ? CREATIVE_ENTITY_INTERACTION_RANGE : null, 3D); this.writeAttribute(updateAttributes, "player.entity_interaction_range", 3D, creativeMode ? CREATIVE_ENTITY_INTERACTION_RANGE : null, 3D);
} else if (connection.getProtocolInfo().serverProtocolVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) { } else if (connection.getProtocolInfo().serverProtocolVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
this.writeAttribute(wrapper, "player.entity_interaction_range", 3D, creativeMode ? CREATIVE_ENTITY_INTERACTION_RANGE : null, 1D); this.writeAttribute(updateAttributes, "player.entity_interaction_range", 3D, creativeMode ? CREATIVE_ENTITY_INTERACTION_RANGE : null, 1D);
} else { } else {
this.writeAttribute(wrapper, "player.entity_interaction_range", 3D, creativeMode ? CREATIVE_ENTITY_INTERACTION_RANGE : null, 2D); this.writeAttribute(updateAttributes, "player.entity_interaction_range", 3D, creativeMode ? CREATIVE_ENTITY_INTERACTION_RANGE : null, 2D);
} }
wrapper.scheduleSend(Protocol1_20_3To1_20_5.class); updateAttributes.scheduleSend(Protocol1_20_3To1_20_5.class);
} }
} }

View File

@ -40,10 +40,10 @@ public class SpawnPositionTracker extends StoredObject {
} }
public void sendSpawnPosition() { public void sendSpawnPosition() {
final PacketWrapper spawnPosition = PacketWrapper.create(ClientboundPackets1_18.SET_DEFAULT_SPAWN_POSITION, this.getUser()); final PacketWrapper setDefaultSpawnPosition = PacketWrapper.create(ClientboundPackets1_18.SET_DEFAULT_SPAWN_POSITION, this.getUser());
spawnPosition.write(Types.BLOCK_POSITION1_14, this.spawnPosition); // position setDefaultSpawnPosition.write(Types.BLOCK_POSITION1_14, this.spawnPosition); // position
spawnPosition.write(Types.FLOAT, this.angle); // angle setDefaultSpawnPosition.write(Types.FLOAT, this.angle); // angle
spawnPosition.send(Protocol1_18To1_18_2.class); setDefaultSpawnPosition.send(Protocol1_18To1_18_2.class);
} }
} }

View File

@ -45,9 +45,9 @@ public class ChatSignaturePacketHandler extends PacketHandler {
public ChatSignaturePacketHandler(ProxyConnection proxyConnection) { public ChatSignaturePacketHandler(ProxyConnection proxyConnection) {
super(proxyConnection); super(proxyConnection);
this.joinGameId = MCPackets.S2C_JOIN_GAME.getId(proxyConnection.getClientVersion().getVersion()); this.joinGameId = MCPackets.S2C_LOGIN.getId(proxyConnection.getClientVersion().getVersion());
this.chatSessionUpdateId = MCPackets.C2S_CHAT_SESSION_UPDATE.getId(proxyConnection.getClientVersion().getVersion()); this.chatSessionUpdateId = MCPackets.C2S_CHAT_SESSION_UPDATE.getId(proxyConnection.getClientVersion().getVersion());
this.chatMessageId = MCPackets.C2S_CHAT_MESSAGE.getId(proxyConnection.getClientVersion().getVersion()); this.chatMessageId = MCPackets.C2S_CHAT.getId(proxyConnection.getClientVersion().getVersion());
} }
@Override @Override

View File

@ -40,9 +40,9 @@ public abstract class CustomPayloadPacketHandler extends PacketHandler {
public CustomPayloadPacketHandler(ProxyConnection proxyConnection) { public CustomPayloadPacketHandler(ProxyConnection proxyConnection) {
super(proxyConnection); super(proxyConnection);
this.s2cCustomPayloadId = MCPackets.S2C_PLUGIN_MESSAGE.getId(proxyConnection.getClientVersion().getVersion()); this.s2cCustomPayloadId = MCPackets.S2C_CUSTOM_PAYLOAD.getId(proxyConnection.getClientVersion().getVersion());
this.s2cConfigCustomPayloadId = MCPackets.S2C_CONFIG_CUSTOM_PAYLOAD.getId(proxyConnection.getClientVersion().getVersion()); this.s2cConfigCustomPayloadId = MCPackets.S2C_CONFIG_CUSTOM_PAYLOAD.getId(proxyConnection.getClientVersion().getVersion());
this.c2sCustomPayloadId = MCPackets.C2S_PLUGIN_MESSAGE.getId(proxyConnection.getClientVersion().getVersion()); this.c2sCustomPayloadId = MCPackets.C2S_CUSTOM_PAYLOAD.getId(proxyConnection.getClientVersion().getVersion());
this.c2sConfigCustomPayloadId = MCPackets.C2S_CONFIG_CUSTOM_PAYLOAD.getId(proxyConnection.getClientVersion().getVersion()); this.c2sConfigCustomPayloadId = MCPackets.C2S_CONFIG_CUSTOM_PAYLOAD.getId(proxyConnection.getClientVersion().getVersion());
} }

View File

@ -53,8 +53,8 @@ public class OpenAuthModPacketHandler extends PacketHandler {
public OpenAuthModPacketHandler(ProxyConnection proxyConnection) { public OpenAuthModPacketHandler(ProxyConnection proxyConnection) {
super(proxyConnection); super(proxyConnection);
this.c2sCustomPayloadId = MCPackets.C2S_PLUGIN_MESSAGE.getId(proxyConnection.getClientVersion().getVersion()); this.c2sCustomPayloadId = MCPackets.C2S_CUSTOM_PAYLOAD.getId(proxyConnection.getClientVersion().getVersion());
this.s2cCustomPayloadId = MCPackets.S2C_PLUGIN_MESSAGE.getId(proxyConnection.getClientVersion().getVersion()); this.s2cCustomPayloadId = MCPackets.S2C_CUSTOM_PAYLOAD.getId(proxyConnection.getClientVersion().getVersion());
} }
@Override @Override

View File

@ -42,7 +42,7 @@ public class ResourcePackPacketHandler extends PacketHandler {
public ResourcePackPacketHandler(ProxyConnection proxyConnection) { public ResourcePackPacketHandler(ProxyConnection proxyConnection) {
super(proxyConnection); super(proxyConnection);
this.joinGameId = MCPackets.S2C_JOIN_GAME.getId(this.proxyConnection.getClientVersion().getVersion()); this.joinGameId = MCPackets.S2C_LOGIN.getId(this.proxyConnection.getClientVersion().getVersion());
} }
@Override @Override
@ -83,7 +83,7 @@ public class ResourcePackPacketHandler extends PacketHandler {
final byte[] data = ViaProxy.getConfig().getResourcePackUrl().getBytes(StandardCharsets.UTF_8); final byte[] data = ViaProxy.getConfig().getResourcePackUrl().getBytes(StandardCharsets.UTF_8);
final ByteBuf customPayloadPacket = Unpooled.buffer(); final ByteBuf customPayloadPacket = Unpooled.buffer();
PacketTypes.writeVarInt(customPayloadPacket, MCPackets.S2C_PLUGIN_MESSAGE.getId(this.proxyConnection.getClientVersion().getVersion())); PacketTypes.writeVarInt(customPayloadPacket, MCPackets.S2C_CUSTOM_PAYLOAD.getId(this.proxyConnection.getClientVersion().getVersion()));
PacketTypes.writeString(customPayloadPacket, "MC|RPack"); // channel PacketTypes.writeString(customPayloadPacket, "MC|RPack"); // channel
customPayloadPacket.writeShort(data.length); // length customPayloadPacket.writeShort(data.length); // length
customPayloadPacket.writeBytes(data); // data customPayloadPacket.writeBytes(data); // data