mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Added UUID initializers for the functions that support it in McTcpClient.cs, Also Fixed some redundant Object creation.
This commit is contained in:
parent
1c2e4ab6d8
commit
2f1b99c064
2 changed files with 8 additions and 7 deletions
|
|
@ -60,18 +60,19 @@ namespace MinecraftClient.Mapping
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new entity based on Entity ID, Entity Type and location
|
/// Create a new entity based on Entity ID, Entity Type, location, and UUID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ID">Entity ID</param>
|
/// <param name="ID">Entity ID</param>
|
||||||
/// <param name="TypeID">Entity Type ID</param>
|
/// <param name="TypeID">Entity Type ID</param>
|
||||||
/// <param name="type">Entity Type Enum</param>
|
/// <param name="type">Entity Type Enum</param>
|
||||||
/// <param name="location">Entity location</param>
|
/// <param name="location">Entity location</param>
|
||||||
public Entity(int ID, int TypeID, EntityType type, Location location)
|
public Entity(int ID, int TypeID, EntityType type, Location location, Guid uuid)
|
||||||
{
|
{
|
||||||
this.ID = ID;
|
this.ID = ID;
|
||||||
this.TypeID = TypeID;
|
this.TypeID = TypeID;
|
||||||
this.Type = type;
|
this.Type = type;
|
||||||
this.Location = location;
|
this.Location = location;
|
||||||
|
this.UUID = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1211,7 +1211,7 @@ namespace MinecraftClient
|
||||||
public void OnSpawnEntity(int EntityID, int TypeID, Guid UUID, Location location)
|
public void OnSpawnEntity(int EntityID, int TypeID, Guid UUID, Location location)
|
||||||
{
|
{
|
||||||
if (entities.ContainsKey(EntityID)) return;
|
if (entities.ContainsKey(EntityID)) return;
|
||||||
Entity entity = new Entity(EntityID, TypeID, EntityType.NonLivingThings, location);
|
Entity entity = new Entity(EntityID, TypeID, EntityType.NonLivingThings, location, UUID);
|
||||||
entities.Add(EntityID, entity);
|
entities.Add(EntityID, entity);
|
||||||
foreach (ChatBot bot in bots.ToArray())
|
foreach (ChatBot bot in bots.ToArray())
|
||||||
{
|
{
|
||||||
|
|
@ -1241,7 +1241,7 @@ namespace MinecraftClient
|
||||||
public void OnSpawnLivingEntity(int EntityID, int TypeID, Guid UUID, Location location)
|
public void OnSpawnLivingEntity(int EntityID, int TypeID, Guid UUID, Location location)
|
||||||
{
|
{
|
||||||
if (entities.ContainsKey(EntityID)) return;
|
if (entities.ContainsKey(EntityID)) return;
|
||||||
Entity entity = new Entity(EntityID, TypeID, EntityType.MobAndAnimal, location);
|
Entity entity = new Entity(EntityID, TypeID, EntityType.MobAndAnimal, location, UUID);
|
||||||
entities.Add(EntityID, entity);
|
entities.Add(EntityID, entity);
|
||||||
foreach (ChatBot bot in bots.ToArray())
|
foreach (ChatBot bot in bots.ToArray())
|
||||||
{
|
{
|
||||||
|
|
@ -1304,7 +1304,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bot.OnEntityDespawn(new Entity(entities[a].ID, entities[a].TypeID, entities[a].Type, entities[a].Location));
|
bot.OnEntityDespawn(entities[a]);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -1342,7 +1342,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bot.OnEntityMove(new Entity(entities[EntityID].ID, entities[EntityID].TypeID, entities[EntityID].Type, entities[EntityID].Location));
|
bot.OnEntityMove(entities[EntityID]);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -1375,7 +1375,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bot.OnEntityMove(new Entity(entities[EntityID].ID, entities[EntityID].TypeID, entities[EntityID].Type, entities[EntityID].Location));
|
bot.OnEntityMove(entities[EntityID]);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue