mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
ChatBot API: OnScoreboardObjective, OnEntityEffect, OnUpdateScore, EntityInteract, Hand list (#1097)
* Create Effect.cs * Rename Effect.cs to Effects.cs * Update MinecraftClient.csproj * Update Effects.cs * Update Effects.cs * add EntityEffect * Update McClient.cs * Update Protocol18.cs + EntityEffect * Update IMinecraftComHandler.cs * Update Protocol18PacketTypes.cs + EntityEffect * Update ChatBot.cs + OnEntityEquipment * Update PacketIncomingType.cs + ScoreboardObjective * Update Protocol18PacketTypes.cs * Update Protocol18.cs * Update IMinecraftComHandler.cs + OnScoreboardObjective * Update McClient.cs + OnScoreboardObjective * Update ChatBot.cs + OnScoreboardObjective event * Update Protocol18.cs: fix scoreboard * Update McClient.cs * Update ChatBot.cs * Update PacketIncomingType.cs * Update ChatBot.cs + OnUpdateScore * Update McClient.cs + OnUpdateScore * Update IMinecraftComHandler.cs + OnUpdateScore * Update Protocol18.cs * Update Protocol18PacketTypes.cs * Update Protocol18.cs + fix micro lags * Update Protocol18.cs * Update Protocol18.cs * Update Protocol18.cs * Update Protocol16.cs * Update Protocol18.cs * Update McClient.cs * Update IMinecraftCom.cs * Update McClient.cs * Update McClient.cs * Update McClient.cs * Update ChatBot.cs + GetEntities() * Create Hand.cs * Update MinecraftClient.csproj * Update McClient.cs * Update ChatBot.cs * Update Protocol18.cs * Update ChatBot.cs * Update ChatBot.cs * Update ChatBot.cs * Update ChatBot.cs * Update ChatBot.cs: fix * Update AutoAttack.cs: Fix * Update McClient.cs: compile fix * Update ChatBot.cs * Update AutoAttack.cs * Update ChatBot.cs * Update Protocol18.cs * Update IMinecraftComHandler.cs * Update McClient.cs * Update ChatBot.cs * Update Protocol18.cs * Update IMinecraftComHandler.cs * Update ChatBot.cs * Update McClient.cs * Update McClient.cs: remove check distance * Update EntityActionType.cs: more actions * Create CommandBlockMode.cs * Create CommandBlockFlags.cs * Update IMinecraftCom.cs * Update McClient.cs * Update ChatBot.cs * Update Protocol18.cs * Update Protocol16.cs * Update PacketOutgoingType.cs * Update Protocol18PacketTypes.cs * Update Protocol18.cs
This commit is contained in:
parent
572191dcd2
commit
fb50b0d5cb
16 changed files with 469 additions and 78 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -7,10 +7,14 @@ namespace MinecraftClient.Protocol
|
|||
{
|
||||
public enum EntityActionType
|
||||
{
|
||||
StartSneaking,
|
||||
StopSneaking,
|
||||
LeaveBed,
|
||||
StartSprinting,
|
||||
StopSprinting
|
||||
StartSneaking = 0,
|
||||
StopSneaking = 1,
|
||||
LeaveBed = 2,
|
||||
StartSprinting = 3,
|
||||
StopSprinting = 4,
|
||||
StartJumpWithHorse = 5,
|
||||
StopJumpWithHorse = 6,
|
||||
OpenHorseInventory = 7,
|
||||
StartFlyingWithElytra = 8,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
EntityTeleport,
|
||||
EntityEquipment,
|
||||
EntityVelocity,
|
||||
EntityEffect,
|
||||
TimeUpdate,
|
||||
UpdateHealth,
|
||||
SetExperience,
|
||||
|
|
@ -52,7 +53,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
Explosion,
|
||||
MapData,
|
||||
Title,
|
||||
|
||||
ScoreboardObjective,
|
||||
UpdateScore,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a packet not implemented in MCC.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -35,5 +35,6 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
Animation,
|
||||
PlayerDigging,
|
||||
UpdateSign,
|
||||
UpdateCommandBlock,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -687,7 +687,17 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
|
||||
public bool SendInteractEntity(int EntityID, int type, int hand)
|
||||
{
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool UpdateCommandBlock(Location location, string command, CommandBlockMode mode, CommandBlockFlags flags)
|
||||
{
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendUseItem(int hand)
|
||||
{
|
||||
return false; //Currently not implemented
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ using MinecraftClient.Mapping.BlockPalettes;
|
|||
using MinecraftClient.Mapping.EntityPalettes;
|
||||
using MinecraftClient.Protocol.Handlers.Forge;
|
||||
using MinecraftClient.Inventory;
|
||||
using System.Windows.Forms;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers
|
||||
{
|
||||
|
|
@ -369,17 +372,17 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
break;
|
||||
case PacketIncomingType.MapData:
|
||||
int mapid = dataTypes.ReadNextVarInt(packetData);
|
||||
byte scale = dataTypes.ReadNextByte(packetData);
|
||||
bool trackingposition = dataTypes.ReadNextBool(packetData);
|
||||
bool locked = false;
|
||||
if (protocolversion >= MC114Version)
|
||||
{
|
||||
locked = dataTypes.ReadNextBool(packetData);
|
||||
}
|
||||
int iconcount = dataTypes.ReadNextVarInt(packetData);
|
||||
handler.OnMapData(mapid, scale, trackingposition, locked, iconcount);
|
||||
break;
|
||||
int mapid = dataTypes.ReadNextVarInt(packetData);
|
||||
byte scale = dataTypes.ReadNextByte(packetData);
|
||||
bool trackingposition = dataTypes.ReadNextBool(packetData);
|
||||
bool locked = false;
|
||||
if (protocolversion >= MC114Version)
|
||||
{
|
||||
locked = dataTypes.ReadNextBool(packetData);
|
||||
}
|
||||
int iconcount = dataTypes.ReadNextVarInt(packetData);
|
||||
handler.OnMapData(mapid, scale, trackingposition, locked, iconcount);
|
||||
break;
|
||||
case PacketIncomingType.Title:
|
||||
if (protocolversion >= MC18Version)
|
||||
{
|
||||
|
|
@ -719,7 +722,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
handler.OnEntityEquipment(entityid, slot2, item);
|
||||
}
|
||||
break;
|
||||
case PacketIncomingType.SpawnLivingEntity:
|
||||
case PacketIncomingType.SpawnLivingEntity:
|
||||
if (handler.GetEntityHandlingEnabled())
|
||||
{
|
||||
Entity entity = dataTypes.ReadNextEntity(packetData, entityPalette, true);
|
||||
|
|
@ -745,6 +748,20 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
handler.OnSpawnPlayer(EntityID, UUID, EntityLocation, Yaw, Pitch);
|
||||
}
|
||||
break;
|
||||
case PacketIncomingType.EntityEffect:
|
||||
if (handler.GetEntityHandlingEnabled())
|
||||
{
|
||||
int entityid = dataTypes.ReadNextVarInt(packetData);
|
||||
Inventory.Effects effect = Effects.Speed;
|
||||
if (Enum.TryParse(dataTypes.ReadNextByte(packetData).ToString(), out effect))
|
||||
{
|
||||
int amplifier = dataTypes.ReadNextByte(packetData);
|
||||
int duration = dataTypes.ReadNextVarInt(packetData);
|
||||
byte flags = dataTypes.ReadNextByte(packetData);
|
||||
handler.OnEntityEffect(entityid, effect, amplifier, duration, flags);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PacketIncomingType.DestroyEntities:
|
||||
if (handler.GetEntityHandlingEnabled())
|
||||
{
|
||||
|
|
@ -867,6 +884,29 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
byte slot = dataTypes.ReadNextByte(packetData);
|
||||
handler.OnHeldItemChange(slot);
|
||||
break;
|
||||
case PacketIncomingType.ScoreboardObjective:
|
||||
string objectivename = dataTypes.ReadNextString(packetData);
|
||||
byte mode = dataTypes.ReadNextByte(packetData);
|
||||
string objectivevalue = String.Empty;
|
||||
int type2 = -1;
|
||||
if (mode == 0 || mode == 2)
|
||||
{
|
||||
objectivevalue = dataTypes.ReadNextString(packetData);
|
||||
type2 = dataTypes.ReadNextVarInt(packetData);
|
||||
}
|
||||
handler.OnScoreboardObjective(objectivename, mode, objectivevalue, type2);
|
||||
break;
|
||||
case PacketIncomingType.UpdateScore:
|
||||
string entityname = dataTypes.ReadNextString(packetData);
|
||||
byte action3 = dataTypes.ReadNextByte(packetData);
|
||||
string objectivename2 = dataTypes.ReadNextString(packetData);
|
||||
int value = -1;
|
||||
if (action3 != 1)
|
||||
{
|
||||
value = dataTypes.ReadNextVarInt(packetData);
|
||||
}
|
||||
handler.OnUpdateScore(entityname, action3, objectivename2, value);
|
||||
break;
|
||||
default:
|
||||
return false; //Ignored packet
|
||||
}
|
||||
|
|
@ -1078,6 +1118,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// <returns>Completed text</returns>
|
||||
IEnumerable<string> IAutoComplete.AutoComplete(string BehindCursor)
|
||||
{
|
||||
|
||||
if (String.IsNullOrEmpty(BehindCursor))
|
||||
return new string[] { };
|
||||
|
||||
|
|
@ -1117,9 +1158,13 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
SendPacket(PacketOutgoingType.TabComplete, tabcomplete_packet);
|
||||
|
||||
int wait_left = 50; //do not wait more than 5 seconds (50 * 100 ms)
|
||||
while (wait_left > 0 && !autocomplete_received) { System.Threading.Thread.Sleep(100); wait_left--; }
|
||||
if (autocomplete_result.Count > 0)
|
||||
ConsoleIO.WriteLineFormatted("§8" + String.Join(" ", autocomplete_result), false);
|
||||
Thread t1 = new Thread(new ThreadStart(delegate
|
||||
{
|
||||
while (wait_left > 0 && !autocomplete_received) { System.Threading.Thread.Sleep(100); wait_left--; }
|
||||
if (autocomplete_result.Count > 0)
|
||||
ConsoleIO.WriteLineFormatted("§8" + String.Join(" ", autocomplete_result), false);
|
||||
}));
|
||||
t1.Start();
|
||||
return autocomplete_result;
|
||||
}
|
||||
|
||||
|
|
@ -1418,6 +1463,21 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
catch (System.IO.IOException) { return false; }
|
||||
catch (ObjectDisposedException) { return false; }
|
||||
}
|
||||
public bool SendInteractEntity(int EntityID, int type, int hand)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<byte> fields = new List<byte>();
|
||||
fields.AddRange(dataTypes.GetVarInt(EntityID));
|
||||
fields.AddRange(dataTypes.GetVarInt(type));
|
||||
fields.AddRange(dataTypes.GetVarInt(hand));
|
||||
SendPacket(PacketOutgoingType.InteractEntity, fields);
|
||||
return true;
|
||||
}
|
||||
catch (SocketException) { return false; }
|
||||
catch (System.IO.IOException) { return false; }
|
||||
catch (ObjectDisposedException) { return false; }
|
||||
}
|
||||
public bool SendInteractEntity(int EntityID, int type, float X, float Y, float Z)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -1645,5 +1705,26 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
catch (System.IO.IOException) { return false; }
|
||||
catch (ObjectDisposedException) { return false; }
|
||||
}
|
||||
|
||||
public bool UpdateCommandBlock(Location location, string command, CommandBlockMode mode, CommandBlockFlags flags)
|
||||
{
|
||||
if (protocolversion <= MC113Version)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<byte> packet = new List<byte>();
|
||||
packet.AddRange(dataTypes.GetLocation(location));
|
||||
packet.AddRange(dataTypes.GetString(command));
|
||||
packet.AddRange(dataTypes.GetVarInt((int)mode));
|
||||
packet.Add((byte)flags);
|
||||
SendPacket(PacketOutgoingType.UpdateSign, packet);
|
||||
return true;
|
||||
}
|
||||
catch (SocketException) { return false; }
|
||||
catch (System.IO.IOException) { return false; }
|
||||
catch (ObjectDisposedException) { return false; }
|
||||
}
|
||||
else { return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x18: return PacketIncomingType.EntityTeleport;
|
||||
case 0x12: return PacketIncomingType.EntityVelocity;
|
||||
case 0x04: return PacketIncomingType.EntityEquipment;
|
||||
case 0x1E: return PacketIncomingType.EntityEffect;
|
||||
case 0x03: return PacketIncomingType.TimeUpdate;
|
||||
case 0x06: return PacketIncomingType.UpdateHealth;
|
||||
case 0x1F: return PacketIncomingType.SetExperience;
|
||||
|
|
@ -66,6 +67,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x27: return PacketIncomingType.Explosion;
|
||||
case 0x34: return PacketIncomingType.MapData;
|
||||
case 0x45: return PacketIncomingType.Title;
|
||||
case 0x3B: return PacketIncomingType.ScoreboardObjective;
|
||||
case 0x3C: return PacketIncomingType.UpdateScore;
|
||||
}
|
||||
}
|
||||
else if (protocol <= Protocol18Handler.MC1112Version) // MC 1.9, 1.10 and 1.11
|
||||
|
|
@ -103,6 +106,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x49: return PacketIncomingType.EntityTeleport;
|
||||
case 0x3B: return PacketIncomingType.EntityVelocity;
|
||||
case 0x3C: return PacketIncomingType.EntityEquipment;
|
||||
case 0x4B: return PacketIncomingType.EntityEffect;
|
||||
case 0x44: return PacketIncomingType.TimeUpdate;
|
||||
case 0x3E: return PacketIncomingType.UpdateHealth;
|
||||
case 0x3D: return PacketIncomingType.SetExperience;
|
||||
|
|
@ -110,6 +114,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x1C: return PacketIncomingType.Explosion;
|
||||
case 0x24: return PacketIncomingType.MapData;
|
||||
case 0x45: return PacketIncomingType.Title;
|
||||
case 0x3F: return PacketIncomingType.ScoreboardObjective;
|
||||
case 0x42: return PacketIncomingType.UpdateScore;
|
||||
}
|
||||
}
|
||||
else if (protocol <= Protocol18Handler.MC112Version) // MC 1.12.0
|
||||
|
|
@ -147,6 +153,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x4B: return PacketIncomingType.EntityTeleport;
|
||||
case 0x3D: return PacketIncomingType.EntityVelocity;
|
||||
case 0x3E: return PacketIncomingType.EntityEquipment;
|
||||
case 0x4E: return PacketIncomingType.EntityEffect;
|
||||
case 0x46: return PacketIncomingType.TimeUpdate;
|
||||
case 0x40: return PacketIncomingType.UpdateHealth;
|
||||
case 0x3F: return PacketIncomingType.SetExperience;
|
||||
|
|
@ -154,6 +161,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x1C: return PacketIncomingType.Explosion;
|
||||
case 0x24: return PacketIncomingType.MapData;
|
||||
case 0x47: return PacketIncomingType.Title;
|
||||
case 0x41: return PacketIncomingType.ScoreboardObjective;
|
||||
case 0x44: return PacketIncomingType.UpdateScore;
|
||||
}
|
||||
}
|
||||
else if (protocol <= Protocol18Handler.MC1122Version) // MC 1.12.2
|
||||
|
|
@ -191,6 +200,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x4C: return PacketIncomingType.EntityTeleport;
|
||||
case 0x3E: return PacketIncomingType.EntityVelocity;
|
||||
case 0x3F: return PacketIncomingType.EntityEquipment;
|
||||
case 0x4F: return PacketIncomingType.EntityEffect;
|
||||
case 0x47: return PacketIncomingType.TimeUpdate;
|
||||
case 0x41: return PacketIncomingType.UpdateHealth;
|
||||
case 0x40: return PacketIncomingType.SetExperience;
|
||||
|
|
@ -198,6 +208,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x1C: return PacketIncomingType.Explosion;
|
||||
case 0x25: return PacketIncomingType.MapData;
|
||||
case 0x48: return PacketIncomingType.Title;
|
||||
case 0x42: return PacketIncomingType.ScoreboardObjective;
|
||||
case 0x45: return PacketIncomingType.UpdateScore;
|
||||
}
|
||||
}
|
||||
else if (protocol < Protocol18Handler.MC114Version) // MC 1.13 to 1.13.2
|
||||
|
|
@ -235,6 +247,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x50: return PacketIncomingType.EntityTeleport;
|
||||
case 0x41: return PacketIncomingType.EntityVelocity;
|
||||
case 0x42: return PacketIncomingType.EntityEquipment;
|
||||
case 0x53: return PacketIncomingType.EntityEffect;
|
||||
case 0x4A: return PacketIncomingType.TimeUpdate;
|
||||
case 0x44: return PacketIncomingType.UpdateHealth;
|
||||
case 0x43: return PacketIncomingType.SetExperience;
|
||||
|
|
@ -242,6 +255,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x1E: return PacketIncomingType.Explosion;
|
||||
case 0x26: return PacketIncomingType.MapData;
|
||||
case 0x4B: return PacketIncomingType.Title;
|
||||
case 0x45: return PacketIncomingType.ScoreboardObjective;
|
||||
case 0x48: return PacketIncomingType.UpdateScore;
|
||||
}
|
||||
}
|
||||
else if (protocol < Protocol18Handler.MC115Version) // MC 1.14 to 1.14.4
|
||||
|
|
@ -279,6 +294,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x56: return PacketIncomingType.EntityTeleport;
|
||||
case 0x41: return PacketIncomingType.EntityVelocity;
|
||||
case 0x42: return PacketIncomingType.EntityEquipment;
|
||||
case 0x59: return PacketIncomingType.EntityEffect;
|
||||
case 0x4E: return PacketIncomingType.TimeUpdate;
|
||||
case 0x48: return PacketIncomingType.UpdateHealth;
|
||||
case 0x45: return PacketIncomingType.SetExperience;
|
||||
|
|
@ -286,6 +302,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x1C: return PacketIncomingType.Explosion;
|
||||
case 0x26: return PacketIncomingType.MapData;
|
||||
case 0x4F: return PacketIncomingType.Title;
|
||||
case 0x49: return PacketIncomingType.ScoreboardObjective;
|
||||
case 0x4C: return PacketIncomingType.UpdateScore;
|
||||
}
|
||||
}
|
||||
else if (protocol <= Protocol18Handler.MC1152Version) // MC 1.15 to 1.15.2
|
||||
|
|
@ -323,6 +341,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x57: return PacketIncomingType.EntityTeleport;
|
||||
case 0x46: return PacketIncomingType.EntityVelocity;
|
||||
case 0x47: return PacketIncomingType.EntityEquipment;
|
||||
case 0x5A: return PacketIncomingType.EntityEffect;
|
||||
case 0x4F: return PacketIncomingType.TimeUpdate;
|
||||
case 0x49: return PacketIncomingType.UpdateHealth;
|
||||
case 0x48: return PacketIncomingType.SetExperience;
|
||||
|
|
@ -330,6 +349,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x1D: return PacketIncomingType.Explosion;
|
||||
case 0x27: return PacketIncomingType.MapData;
|
||||
case 0x50: return PacketIncomingType.Title;
|
||||
case 0x4A: return PacketIncomingType.ScoreboardObjective;
|
||||
case 0x4D: return PacketIncomingType.UpdateScore;
|
||||
|
||||
}
|
||||
} else {
|
||||
switch (packetID)
|
||||
|
|
@ -365,6 +387,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x56: return PacketIncomingType.EntityTeleport;
|
||||
case 0x46: return PacketIncomingType.EntityVelocity;
|
||||
case 0x47: return PacketIncomingType.EntityEquipment;
|
||||
case 0x5A: return PacketIncomingType.EntityEffect;
|
||||
case 0x4E: return PacketIncomingType.TimeUpdate;
|
||||
case 0x49: return PacketIncomingType.UpdateHealth;
|
||||
case 0x48: return PacketIncomingType.SetExperience;
|
||||
|
|
@ -372,6 +395,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x1C: return PacketIncomingType.Explosion;
|
||||
case 0x26: return PacketIncomingType.MapData;
|
||||
case 0x4F: return PacketIncomingType.Title;
|
||||
case 0x4A: return PacketIncomingType.ScoreboardObjective;
|
||||
case 0x4D: return PacketIncomingType.UpdateScore;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -417,6 +442,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.Animation: return 0x0A;
|
||||
case PacketOutgoingType.PlayerDigging: return 0x07;
|
||||
case PacketOutgoingType.UpdateSign: return 0x12;
|
||||
case PacketOutgoingType.UpdateCommandBlock: return 0x20;
|
||||
}
|
||||
}
|
||||
else if (protocol <= Protocol18Handler.MC1112Version) // MC 1.9, 1,10 and 1.11
|
||||
|
|
@ -444,6 +470,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.Animation: return 0x1A;
|
||||
case PacketOutgoingType.PlayerDigging: return 0x13;
|
||||
case PacketOutgoingType.UpdateSign: return 0x19;
|
||||
case PacketOutgoingType.UpdateCommandBlock: return 0x20;
|
||||
}
|
||||
}
|
||||
else if (protocol <= Protocol18Handler.MC112Version) // MC 1.12
|
||||
|
|
@ -471,6 +498,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.Animation: return 0x1D;
|
||||
case PacketOutgoingType.PlayerDigging: return 0x14;
|
||||
case PacketOutgoingType.UpdateSign: return 0x1C;
|
||||
case PacketOutgoingType.UpdateCommandBlock: return 0x20;
|
||||
}
|
||||
}
|
||||
else if (protocol <= Protocol18Handler.MC1122Version) // 1.12.2
|
||||
|
|
@ -498,6 +526,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.Animation: return 0x1D;
|
||||
case PacketOutgoingType.PlayerDigging: return 0x14;
|
||||
case PacketOutgoingType.UpdateSign: return 0x1C;
|
||||
case PacketOutgoingType.UpdateCommandBlock: return 0x20;
|
||||
}
|
||||
}
|
||||
else if (protocol < Protocol18Handler.MC114Version) // MC 1.13 to 1.13.2
|
||||
|
|
@ -525,6 +554,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.Animation: return 0x27;
|
||||
case PacketOutgoingType.PlayerDigging: return 0x18;
|
||||
case PacketOutgoingType.UpdateSign: return 0x26;
|
||||
case PacketOutgoingType.UpdateCommandBlock: return 0x22;
|
||||
}
|
||||
}
|
||||
else if (protocol <= Protocol18Handler.MC1152Version) //MC 1.14 to 1.15.2
|
||||
|
|
@ -552,6 +582,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.Animation: return 0x2A;
|
||||
case PacketOutgoingType.PlayerDigging: return 0x1A;
|
||||
case PacketOutgoingType.UpdateSign: return 0x29;
|
||||
case PacketOutgoingType.UpdateCommandBlock: return 0x24;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -579,6 +610,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.Animation: return 0x2B;
|
||||
case PacketOutgoingType.PlayerDigging: return 0x1B;
|
||||
case PacketOutgoingType.UpdateSign: return 0x2A;
|
||||
case PacketOutgoingType.UpdateCommandBlock: return 0x24;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,15 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="Z">Z coordinate for "interact at"</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendInteractEntity(int EntityID, int type, float X, float Y, float Z);
|
||||
|
||||
/// <summary>
|
||||
/// Send an entity interaction packet to the server.
|
||||
/// </summary>
|
||||
/// <param name="EntityID">Entity ID to interact with</param>
|
||||
/// <param name="type">Type of interaction (0: interact, 1: attack, 2: interact at)</param>
|
||||
/// <param name="hand">Only if Type is interact or interact at; 0: main hand, 1: off hand</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendInteractEntity(int EntityID, int type, int hand);
|
||||
|
||||
/// <summary>
|
||||
/// Send a use item packet to the server
|
||||
|
|
@ -202,5 +211,14 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="line4">New line 4</param>
|
||||
/// <returns>True if packet was succcessfully sent</returns>
|
||||
bool SendUpdateSign(Location location, string line1, string line2, string line3, string line4);
|
||||
|
||||
/// <summary>
|
||||
/// Update command block
|
||||
/// </summary>
|
||||
/// <param name="location">command block location</param>
|
||||
/// <param name="command">command</param>
|
||||
/// <param name="mode">command block mode</param>
|
||||
/// <param name="flags">command block flags</param>
|
||||
bool UpdateCommandBlock(Location location, string command, CommandBlockMode mode, CommandBlockFlags flags);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,5 +273,33 @@ namespace MinecraftClient.Protocol
|
|||
/// </summary>
|
||||
/// <param name="EntityID">Player entity ID</param>
|
||||
void OnReceivePlayerEntityID(int EntityID);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the Entity use effects
|
||||
/// </summary>
|
||||
/// <param name="entityid">entity ID</param>
|
||||
/// <param name="effect">effect id</param>
|
||||
/// <param name="amplifier">effect amplifier</param>
|
||||
/// <param name="duration">effect duration</param>
|
||||
/// <param name="flags">effect flags</param>
|
||||
void OnEntityEffect(int entityid, Effects effect, int amplifier, int duration, byte flags);
|
||||
|
||||
/// <summary>
|
||||
/// Called when coreboardObjective
|
||||
/// </summary>
|
||||
/// <param name="objectivename">objective name</param>
|
||||
/// <param name="mode">0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.</param>
|
||||
/// <param name="objectivevalue">Only if mode is 0 or 2. The text to be displayed for the score</param>
|
||||
/// <param name="type">Only if mode is 0 or 2. 0 = "integer", 1 = "hearts".</param>
|
||||
void OnScoreboardObjective(string objectivename, byte mode, string objectivevalue, int type);
|
||||
|
||||
/// <summary>
|
||||
/// Called when DisplayScoreboard
|
||||
/// </summary>
|
||||
/// <param name="entityname">The entity whose score this is. For players, this is their username; for other entities, it is their UUID.</param>
|
||||
/// <param name="action">0 to create/update an item. 1 to remove an item.</param>
|
||||
/// <param name="objectivename">The name of the objective the score belongs to</param>
|
||||
/// <param name="value">he score to be displayed next to the entry. Only sent when Action does not equal 1.</param>
|
||||
void OnUpdateScore(string entityname, byte action, string objectivename, int value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue