Skip to content

Commit

Permalink
Fixed Auto Fishing not working
Browse files Browse the repository at this point in the history
Fixed Auto Fishing not working
  • Loading branch information
milutinke authored May 10, 2023
2 parents 7107023 + 599c6aa commit 4ff7712
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions MinecraftClient/Protocol/Handlers/DataTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,8 @@ public Entity ReadNextEntity(Queue<byte> cache, EntityPalette entityPalette, boo
entityY = ReadNextDouble(cache); // Y
entityZ = ReadNextDouble(cache); // Z
}


int metadata = -1;
bool hasData = false;

int data = -1;
byte entityPitch, entityYaw;

if (living)
Expand All @@ -522,15 +520,14 @@ public Entity ReadNextEntity(Queue<byte> cache, EntityPalette entityPalette, boo
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);
Expand All @@ -544,7 +541,7 @@ public Entity ReadNextEntity(Queue<byte> cache, EntityPalette entityPalette, boo
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);
}

/// <summary>
Expand Down

0 comments on commit 4ff7712

Please sign in to comment.