mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
MC 1.17/1.18 Terrain/Entity/Inventory (#1943)
Merge branch 'master' of github.com:milutinke/Minecraft-Console-Client into milutinke-master Manually fix merge conflicts Additional changes: - WindowItems: Fix data type for "elements" below 1.17 - DestroyEntities: Fix packet palettes and remove DestroyEntity - EntityMetadata: Throw exception if health field mapping is not updated Co-authored-by: Milutinke <bgteam@live.com> Co-authored-by: BruceChen <MrChen131217@gmail.com>
This commit is contained in:
commit
1ce7850193
34 changed files with 5983 additions and 920 deletions
|
|
@ -103,11 +103,15 @@ namespace MinecraftClient.ChatBots
|
|||
}
|
||||
}
|
||||
}
|
||||
// check entity distance and health again
|
||||
if (shouldAttackEntity(entitiesToAttack[priorityEntity]))
|
||||
|
||||
if (entitiesToAttack.ContainsKey(priorityEntity))
|
||||
{
|
||||
InteractEntity(priorityEntity, interactMode); // hit the entity!
|
||||
SendAnimation(Inventory.Hand.MainHand); // Arm animation
|
||||
// check entity distance and health again
|
||||
if (shouldAttackEntity(entitiesToAttack[priorityEntity]))
|
||||
{
|
||||
InteractEntity(priorityEntity, interactMode); // hit the entity!
|
||||
SendAnimation(Inventory.Hand.MainHand); // Arm animation
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -143,6 +147,22 @@ namespace MinecraftClient.ChatBots
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnEntityHealth(Entity entity, float health)
|
||||
{
|
||||
if (!entity.Type.IsHostile())
|
||||
return;
|
||||
|
||||
if (entitiesToAttack.ContainsKey(entity.ID))
|
||||
{
|
||||
entitiesToAttack[entity.ID].Health = health;
|
||||
|
||||
if (entitiesToAttack[entity.ID].Health <= 0)
|
||||
{
|
||||
entitiesToAttack.Remove(entity.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEntityMove(Entity entity)
|
||||
{
|
||||
shouldAttackEntity(entity);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue