mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fixed entity rotations (#2596)
* Fixed entity rotations Fixed entity yaw and pitch not changing when entity moves head. * Update ChatBot.cs * Update McClient.cs * Update Protocol18.cs * Update McClient.cs * Finalize code style * Fix incorrect variable type --------- Co-authored-by: ReinforceZwei <39955851+ReinforceZwei@users.noreply.github.com>
This commit is contained in:
parent
c3fa413b4e
commit
1aea8d3a4e
4 changed files with 85 additions and 3 deletions
|
|
@ -3146,6 +3146,31 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when an entity's position changed within 8 block of its previous position with rotation.
|
||||
/// </summary>
|
||||
/// <param name="EntityID"></param>
|
||||
/// <param name="Dx"></param>
|
||||
/// <param name="Dy"></param>
|
||||
/// <param name="Dz"></param>
|
||||
/// <param name="yaw"></param>
|
||||
/// <param name="pitch"></param>
|
||||
/// <param name="onGround"></param>
|
||||
public void OnEntityPosition(int EntityID, Double Dx, Double Dy, Double Dz, float yaw, float pitch, bool onGround)
|
||||
{
|
||||
if (entities.ContainsKey(EntityID))
|
||||
{
|
||||
Location L = entities[EntityID].Location;
|
||||
L.X += Dx;
|
||||
L.Y += Dy;
|
||||
L.Z += Dz;
|
||||
entities[EntityID].Location = L;
|
||||
entities[EntityID].Yaw = yaw;
|
||||
entities[EntityID].Pitch = pitch;
|
||||
DispatchBotEvent(bot => bot.OnEntityMove(entities[EntityID]));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when an entity's position changed within 8 block of its previous position.
|
||||
/// </summary>
|
||||
|
|
@ -3165,7 +3190,23 @@ namespace MinecraftClient
|
|||
entities[EntityID].Location = L;
|
||||
DispatchBotEvent(bot => bot.OnEntityMove(entities[EntityID]));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when an entity's rotation changed.
|
||||
/// </summary>
|
||||
/// <param name="EntityID"></param>
|
||||
/// <param name="yaw"></param>
|
||||
/// <param name="pitch"></param>
|
||||
/// <param name="onGround"></param>
|
||||
public void OnEntityRotation(int EntityID, float yaw, float pitch, bool onGround)
|
||||
{
|
||||
if (entities.ContainsKey(EntityID))
|
||||
{
|
||||
entities[EntityID].Yaw = yaw;
|
||||
entities[EntityID].Pitch = pitch;
|
||||
DispatchBotEvent(bot => bot.OnEntityRotate(entities[EntityID]));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue