mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Made ChatBotAPI OnEntityDespawn to pass Entity object instead of EntityID
This commit is contained in:
parent
dbf5334758
commit
7fbf9443a1
4 changed files with 9 additions and 10 deletions
|
|
@ -145,7 +145,7 @@ namespace MinecraftClient
|
||||||
|
|
||||||
public virtual void OnEntitySpawn(Mapping.Entity entity) { }
|
public virtual void OnEntitySpawn(Mapping.Entity entity) { }
|
||||||
|
|
||||||
public virtual void OnEntityDespawn(int EntityID) { }
|
public virtual void OnEntityDespawn(Mapping.Entity entity) { }
|
||||||
|
|
||||||
|
|
||||||
/* =================================================================== */
|
/* =================================================================== */
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace MinecraftClient.ChatBots
|
||||||
if (!GetEntityHandlingEnabled())
|
if (!GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
ConsoleIO.WriteLine("[AutoAttack] Entity Handling is not enabled in the config file!");
|
ConsoleIO.WriteLine("[AutoAttack] Entity Handling is not enabled in the config file!");
|
||||||
ConsoleIO.WriteLine("Please enable it to use this bot.");
|
ConsoleIO.WriteLine("[AutoAttack] This bot will be unloaded.");
|
||||||
UnloadBot();
|
UnloadBot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -53,11 +53,11 @@ namespace MinecraftClient.ChatBots
|
||||||
entitiesToTrack.Add(entity.ID, entity);
|
entitiesToTrack.Add(entity.ID, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override void OnEntityDespawn(int EntityID)
|
public override void OnEntityDespawn(Entity entity)
|
||||||
{
|
{
|
||||||
if (entitiesToTrack.ContainsKey(EntityID))
|
if (entitiesToTrack.ContainsKey(entity.ID))
|
||||||
{
|
{
|
||||||
entitiesToTrack.Remove(EntityID);
|
entitiesToTrack.Remove(entity.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override void OnEntityMove(Entity entity)
|
public override void OnEntityMove(Entity entity)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace MinecraftClient.ChatBots
|
||||||
if (!GetEntityHandlingEnabled())
|
if (!GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
ConsoleIO.WriteLine("[AutoFishing] Entity Handling is not enabled in the config file!");
|
ConsoleIO.WriteLine("[AutoFishing] Entity Handling is not enabled in the config file!");
|
||||||
ConsoleIO.WriteLine("Please enable it to use this bot.");
|
ConsoleIO.WriteLine("[AutoFishing] This bot will be unloaded.");
|
||||||
UnloadBot();
|
UnloadBot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -60,8 +60,7 @@ namespace MinecraftClient.ChatBots
|
||||||
fishingRod[entity.ID] = entity;
|
fishingRod[entity.ID] = entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Move into ChatBot
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when detected a fish is caught
|
/// Called when detected a fish is caught
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1115,12 +1115,12 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
foreach (int a in Entities)
|
foreach (int a in Entities)
|
||||||
{
|
{
|
||||||
|
foreach (ChatBot bot in bots.ToArray())
|
||||||
|
bot.OnEntityDespawn(new Entity(entities[a].ID, entities[a].Type, entities[a].Location));
|
||||||
if (entities.ContainsKey(a))
|
if (entities.ContainsKey(a))
|
||||||
{
|
{
|
||||||
entities.Remove(a);
|
entities.Remove(a);
|
||||||
}
|
}
|
||||||
foreach (ChatBot bot in bots.ToArray())
|
|
||||||
bot.OnEntityDespawn(a);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue