From 599c6aac098ebec295c0db3bef77aa3796f3c290 Mon Sep 17 00:00:00 2001 From: Anon Date: Wed, 10 May 2023 19:07:42 +0200 Subject: [PATCH] Fixed entity object data not being read, this should fix the Auto Fishing bot --- MinecraftClient/Protocol/Handlers/DataTypes.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/MinecraftClient/Protocol/Handlers/DataTypes.cs b/MinecraftClient/Protocol/Handlers/DataTypes.cs index 2906e4d9..78e594a1 100644 --- a/MinecraftClient/Protocol/Handlers/DataTypes.cs +++ b/MinecraftClient/Protocol/Handlers/DataTypes.cs @@ -501,10 +501,8 @@ namespace MinecraftClient.Protocol.Handlers entityY = ReadNextDouble(cache); // Y entityZ = ReadNextDouble(cache); // Z } - - - int metadata = -1; - bool hasData = false; + + int data = -1; byte entityPitch, entityYaw; if (living) @@ -522,15 +520,14 @@ namespace MinecraftClient.Protocol.Handlers entityYaw = ReadNextByte(cache); // Head Yaw // Data - if (protocolversion >= Protocol18Handler.MC_1_19_Version) - ReadNextVarInt(cache); - else hasData = ReadNextInt(cache) == 1; + data = protocolversion >= Protocol18Handler.MC_1_19_Version + ? ReadNextVarInt(cache) : ReadNextInt(cache); } // In 1.8 those 3 fields for Velocity are optional if (protocolversion < Protocol18Handler.MC_1_9_Version) { - if (hasData) + if (data != 0) { ReadNextShort(cache); ReadNextShort(cache); @@ -544,7 +541,7 @@ namespace MinecraftClient.Protocol.Handlers ReadNextShort(cache); } - return new Entity(entityID, entityType, new Location(entityX, entityY, entityZ), entityYaw, entityPitch, metadata); + return new Entity(entityID, entityType, new Location(entityX, entityY, entityZ), entityYaw, entityPitch, data); } ///