mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
auto attack
This commit is contained in:
parent
758bc2ad49
commit
0b0e3c334e
13 changed files with 2065 additions and 15 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
15
MinecraftClient/ChatBots/kill.cs
Normal file
15
MinecraftClient/ChatBots/kill.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MinecraftClient.ChatBots
|
||||
{
|
||||
class kill : ChatBot
|
||||
{
|
||||
public override void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -135,6 +135,7 @@ namespace MinecraftClient
|
|||
if (Settings.AutoRespond_Enabled) { BotLoad(new ChatBots.AutoRespond(Settings.AutoRespond_Matches)); }
|
||||
//Add your ChatBot here by uncommenting and adapting
|
||||
//BotLoad(new ChatBots.YourBot());
|
||||
//BotLoad(new ChatBots.kill());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -816,6 +817,25 @@ namespace MinecraftClient
|
|||
pitch = null;
|
||||
}
|
||||
}
|
||||
|
||||
// auto attack entity within range
|
||||
// by reinforce
|
||||
if (attackCooldown == 0)
|
||||
{
|
||||
attackCooldown = 6;
|
||||
if (entitiesToAttack.Count > 0)
|
||||
{
|
||||
foreach(KeyValuePair<int,Location> a in entitiesToAttack)
|
||||
{
|
||||
handler.SendInteractEntityPacket(a.Key, 1);
|
||||
ConsoleIO.WriteLine("Attacked Entity with ID " + a.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attackCooldown--;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1018,5 +1038,157 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// by reinforce
|
||||
//public List<Entity> entitiesToAttack = new List<Entity>();
|
||||
//public List<Entity> entitiesInAttackList = new List<Entity>();
|
||||
public Dictionary<int,Location> entitiesToAttack = new Dictionary<int, Location>();
|
||||
public Dictionary<int, Location> entitiesToTrack = new Dictionary<int, Location>();
|
||||
public int attackCooldown = 6;
|
||||
public Double attackSpeed;
|
||||
public Double attackCooldownSecond;
|
||||
public void OnSpawnLivingEntity(int EntityID, int EntityType, Guid UUID, Location location)
|
||||
{
|
||||
string msg;
|
||||
|
||||
string name = getEntityName(EntityType);
|
||||
if (name == "")
|
||||
{
|
||||
//msg = "Spawn Entity with typeID " + EntityType.ToString();
|
||||
//msg = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "Spawn Entity " + getEntityName(EntityType);
|
||||
|
||||
//handler.SendInteractEntityPacket(EntityID, 1);
|
||||
//ConsoleIO.WriteLine("Attacked Entity with ID " + EntityID.ToString());
|
||||
|
||||
if (calculateDistance(location, GetCurrentLocation()) < 5)
|
||||
{
|
||||
entitiesToAttack.Add(EntityID, location);
|
||||
ConsoleIO.WriteLine("Added Entity with ID " + EntityID.ToString()+" to Attack list");
|
||||
}
|
||||
|
||||
entitiesToTrack.Add(EntityID, location);
|
||||
//ConsoleIO.WriteLine("Added Entity with ID " + EntityID.ToString() + " to Track list");
|
||||
//ConsoleIO.WriteLine(msg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDestroyEntities(int[] Entities)
|
||||
{
|
||||
foreach(int a in Entities)
|
||||
{
|
||||
if (entitiesToTrack.ContainsKey(a))
|
||||
{
|
||||
if(entitiesToAttack.ContainsKey(a)) ConsoleIO.WriteLine("Removed Entity with ID " + a.ToString());
|
||||
entitiesToAttack.Remove(a);
|
||||
entitiesToTrack.Remove(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSetCooldown(int itemID, int tick)
|
||||
{
|
||||
ConsoleIO.WriteLine("Set Cooldown on item " + itemID + " by " + tick + " ticks");
|
||||
}
|
||||
|
||||
public void OnEntityPosition(int EntityID, Double Dx, Double Dy, Double Dz,bool onGround)
|
||||
{
|
||||
if (entitiesToTrack.ContainsKey(EntityID))
|
||||
{
|
||||
|
||||
Location L = entitiesToTrack[EntityID];
|
||||
L.X += Dx;
|
||||
L.Y += Dy;
|
||||
L.Z += Dz;
|
||||
entitiesToTrack[EntityID] = L;
|
||||
entitiesToAttack[EntityID] = L;
|
||||
Double distance = calculateDistance(L, GetCurrentLocation());
|
||||
|
||||
if (distance < 5)
|
||||
{
|
||||
ConsoleIO.WriteLine("Entity Pos changed, ID " + EntityID + ", Distance: " + distance);
|
||||
if (!entitiesToAttack.ContainsKey(EntityID))
|
||||
{
|
||||
entitiesToAttack.Add(EntityID, L);
|
||||
ConsoleIO.WriteLine("Added Entity with ID " + EntityID.ToString()+" to Attack list");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entitiesToAttack.Remove(EntityID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntityProperties(int EntityID, Dictionary<string, Double> prop)
|
||||
{
|
||||
if(EntityID == playerEntityID)
|
||||
{
|
||||
//ConsoleIO.WriteLine("Prop On Player reviced");
|
||||
if (prop.ContainsKey("generic.attackSpeed"))
|
||||
{
|
||||
if (attackSpeed != prop["generic.attackSpeed"])
|
||||
{
|
||||
ConsoleIO.WriteLine("generic.attackSpeed: " + prop["generic.attackSpeed"].ToString());
|
||||
attackSpeed = prop["generic.attackSpeed"];
|
||||
attackCooldownSecond = 1 / attackSpeed * (serverTPS / 20.0);
|
||||
attackCooldown = Convert.ToInt16(Math.Truncate(attackCooldownSecond / 0.1) + 1);
|
||||
ConsoleIO.WriteLine("attack cooldown: " + attackCooldown);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long lastAge = 0;
|
||||
DateTime lastTime;
|
||||
Double serverTPS = 0;
|
||||
public void OnTimeUpdate(long WorldAge, long TimeOfDay)
|
||||
{
|
||||
//ConsoleIO.WriteLine("Time update: World age: " + WorldAge.ToString());
|
||||
//ConsoleIO.WriteLine("Time update: Time of day: " + TimeOfDay.ToString());
|
||||
if (lastAge != 0)
|
||||
{
|
||||
DateTime currentTime = DateTime.Now;
|
||||
Double tps = (WorldAge - lastAge) / (currentTime - lastTime).TotalSeconds;
|
||||
lastAge = WorldAge;
|
||||
lastTime = currentTime;
|
||||
ConsoleIO.WriteLine("TPS: " + tps.ToString());
|
||||
if (tps <= 20 || tps >= 0)
|
||||
{
|
||||
serverTPS = tps;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lastAge = WorldAge;
|
||||
lastTime = DateTime.Now;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double calculateDistance(Location l1,Location l2)
|
||||
{
|
||||
return Math.Sqrt(Math.Pow(l2.X - l1.X, 2) + Math.Pow(l2.Y - l1.Y, 2) + Math.Pow(l2.Z - l1.Z, 2));
|
||||
}
|
||||
public string getEntityName(int EntityType)
|
||||
{
|
||||
switch (EntityType)
|
||||
{
|
||||
case 31: return "Guardian";
|
||||
case 95: return "zombie";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
public int playerEntityID;
|
||||
public void SetPlayerEntityID(int EntityID)
|
||||
{
|
||||
playerEntityID = EntityID;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@
|
|||
<Compile Include="ChatBots\AutoRelog.cs" />
|
||||
<Compile Include="ChatBots\ChatLog.cs" />
|
||||
<Compile Include="ChatBots\HangmanGame.cs" />
|
||||
<Compile Include="ChatBots\kill.cs" />
|
||||
<Compile Include="ChatBots\PlayerListLogger.cs" />
|
||||
<Compile Include="ChatBots\RemoteControl.cs" />
|
||||
<Compile Include="ChatBots\Script.cs" />
|
||||
|
|
|
|||
|
|
@ -324,18 +324,16 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// </summary>
|
||||
private Dictionary<string, object> ReadNextNbt(List<byte> cache, bool root)
|
||||
{
|
||||
Dictionary<string, object> NbtData = new Dictionary<string, object>();
|
||||
|
||||
if (root)
|
||||
{
|
||||
if (cache[0] == 0) // TAG_End
|
||||
return NbtData;
|
||||
if (cache[0] != 10) // TAG_Compound
|
||||
throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound");
|
||||
ReadNextByte(cache); // Tag type (TAG_Compound)
|
||||
ReadData(ReadNextUShort(cache), cache); // NBT root name
|
||||
}
|
||||
|
||||
Dictionary<string, object> NbtData = new Dictionary<string, object>();
|
||||
|
||||
while (true)
|
||||
{
|
||||
int fieldType = ReadNextByte(cache);
|
||||
|
|
@ -447,7 +445,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (protocolversion < Protocol18Handler.MC18Version)
|
||||
{
|
||||
byte[] length = BitConverter.GetBytes((short)array.Length);
|
||||
Array.Reverse(length); //Endianness
|
||||
Array.Reverse(length);
|
||||
return ConcatBytes(length, array);
|
||||
}
|
||||
else return ConcatBytes(GetVarInt(array.Length), array);
|
||||
|
|
@ -466,7 +464,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a byte array representing the given location encoded as an unsigned long
|
||||
/// Get a byte array representing the given location encoded as an unsigned short
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A modulo will be applied if the location is outside the following ranges:
|
||||
|
|
@ -477,14 +475,11 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// <returns>Location representation as ulong</returns>
|
||||
public byte[] GetLocation(Location location)
|
||||
{
|
||||
byte[] locationBytes;
|
||||
if (protocolversion >= Protocol18Handler.MC114Version)
|
||||
{
|
||||
locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Z) & 0x3FFFFFF) << 12) | (((ulong)location.Y) & 0xFFF));
|
||||
return BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Z) & 0x3FFFFFF) << 12) | (((ulong)location.Y) & 0xFFF));
|
||||
}
|
||||
else locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Y) & 0xFFF) << 26) | (((ulong)location.Z) & 0x3FFFFFF));
|
||||
Array.Reverse(locationBytes); //Endianness
|
||||
return locationBytes;
|
||||
else return BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Y) & 0xFFF) << 26) | (((ulong)location.Z) & 0x3FFFFFF));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// </summary>
|
||||
enum PacketIncomingType
|
||||
{
|
||||
// modified by reinforce
|
||||
SpawnEntity,
|
||||
SpawnLivingEntity,
|
||||
KeepAlive,
|
||||
JoinGame,
|
||||
ChatMessage,
|
||||
|
|
@ -30,6 +33,12 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
OpenWindow,
|
||||
WindowItems,
|
||||
SetSlot,
|
||||
UnknownPacket
|
||||
UnknownPacket,
|
||||
DestroyEntities,
|
||||
SetCooldown,
|
||||
EntityPosition,
|
||||
EntityPositionAndRotation,
|
||||
EntityProperties,
|
||||
TimeUpdate
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
TabComplete,
|
||||
PlayerPosition,
|
||||
PlayerPositionAndLook,
|
||||
TeleportConfirm
|
||||
TeleportConfirm,
|
||||
//modified by reinforce
|
||||
HeldItemChange,
|
||||
InteractEntity
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -733,5 +733,19 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
// reinforce
|
||||
public bool SendInteractEntityPacket(int EntityID, int type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z, int hand)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
break;
|
||||
case PacketIncomingType.JoinGame:
|
||||
handler.OnGameJoined();
|
||||
dataTypes.ReadNextInt(packetData);
|
||||
// by reinforce
|
||||
// get client player EntityID
|
||||
int playerEntityID = dataTypes.ReadNextInt(packetData);
|
||||
handler.SetPlayerEntityID(playerEntityID);
|
||||
dataTypes.ReadNextByte(packetData);
|
||||
if (protocolversion >= MC191Version)
|
||||
this.currentDimension = dataTypes.ReadNextInt(packetData);
|
||||
|
|
@ -242,7 +245,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
float pitch = dataTypes.ReadNextFloat(packetData);
|
||||
byte locMask = dataTypes.ReadNextByte(packetData);
|
||||
|
||||
if (handler.GetTerrainEnabled())
|
||||
// player pos is needed for calculate entity distance
|
||||
// modified by reinforce
|
||||
if (handler.GetTerrainEnabled() || true)
|
||||
{
|
||||
if (protocolversion >= MC18Version)
|
||||
{
|
||||
|
|
@ -535,6 +540,98 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
SendPacket(PacketOutgoingType.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(3))); //Accepted pack
|
||||
SendPacket(PacketOutgoingType.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(0))); //Successfully loaded
|
||||
break;
|
||||
// modified by reinforce
|
||||
case PacketIncomingType.SpawnLivingEntity:
|
||||
if (login_phase) break;
|
||||
int EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||
Guid EntityUUID = dataTypes.ReadNextUUID(packetData);
|
||||
int EntityType = dataTypes.ReadNextVarInt(packetData);
|
||||
Double X = dataTypes.ReadNextDouble(packetData);
|
||||
Double Y = dataTypes.ReadNextDouble(packetData);
|
||||
Double Z = dataTypes.ReadNextDouble(packetData);
|
||||
byte EntityYaw = dataTypes.ReadNextByte(packetData);
|
||||
byte EntityPitch = dataTypes.ReadNextByte(packetData);
|
||||
byte EntityHeadPitch = dataTypes.ReadNextByte(packetData);
|
||||
short VelocityX = dataTypes.ReadNextShort(packetData);
|
||||
short VelocityY = dataTypes.ReadNextShort(packetData);
|
||||
short VelocityZ = dataTypes.ReadNextShort(packetData);
|
||||
|
||||
Location EntityLocation = new Location(X, Y, Z);
|
||||
|
||||
|
||||
handler.OnSpawnLivingEntity(EntityID,EntityType,EntityUUID,EntityLocation);
|
||||
break;
|
||||
case PacketIncomingType.DestroyEntities:
|
||||
int EntityCount = dataTypes.ReadNextVarInt(packetData);
|
||||
int[] EntitiesList = new int[EntityCount];
|
||||
for(int i = 0; i < EntityCount; i++)
|
||||
{
|
||||
EntitiesList[i] = dataTypes.ReadNextVarInt(packetData);
|
||||
}
|
||||
handler.OnDestroyEntities(EntitiesList);
|
||||
break;
|
||||
case PacketIncomingType.SetCooldown:
|
||||
int _itemID = dataTypes.ReadNextVarInt(packetData);
|
||||
int tick = dataTypes.ReadNextVarInt(packetData);
|
||||
handler.OnSetCooldown(_itemID, tick);
|
||||
break;
|
||||
case PacketIncomingType.EntityPosition:
|
||||
EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||
Double DeltaX = Convert.ToDouble(dataTypes.ReadNextShort(packetData));
|
||||
Double DeltaY = Convert.ToDouble(dataTypes.ReadNextShort(packetData));
|
||||
Double DeltaZ = Convert.ToDouble(dataTypes.ReadNextShort(packetData));
|
||||
bool OnGround = dataTypes.ReadNextBool(packetData);
|
||||
DeltaX = DeltaX / (128 * 32);
|
||||
DeltaY = DeltaY / (128 * 32);
|
||||
DeltaZ = DeltaZ / (128 * 32);
|
||||
handler.OnEntityPosition(EntityID, DeltaX, DeltaY, DeltaZ,OnGround);
|
||||
break;
|
||||
case PacketIncomingType.EntityPositionAndRotation:
|
||||
EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||
DeltaX = Convert.ToDouble(dataTypes.ReadNextShort(packetData));
|
||||
DeltaY = Convert.ToDouble(dataTypes.ReadNextShort(packetData));
|
||||
DeltaZ = Convert.ToDouble(dataTypes.ReadNextShort(packetData));
|
||||
yaw = dataTypes.ReadNextByte(packetData);
|
||||
pitch = dataTypes.ReadNextByte(packetData);
|
||||
OnGround = dataTypes.ReadNextBool(packetData);
|
||||
DeltaX = DeltaX / (128 * 32);
|
||||
DeltaY = DeltaY / (128 * 32);
|
||||
DeltaZ = DeltaZ / (128 * 32);
|
||||
handler.OnEntityPosition(EntityID, DeltaX, DeltaY, DeltaZ, OnGround);
|
||||
break;
|
||||
case PacketIncomingType.EntityProperties:
|
||||
EntityID = dataTypes.ReadNextVarInt(packetData);
|
||||
int NumberOfProperties = dataTypes.ReadNextInt(packetData);
|
||||
Dictionary<string,Double> keys = new Dictionary<string,Double>();
|
||||
for(int i = 0; i < NumberOfProperties; i++)
|
||||
{
|
||||
string _key = dataTypes.ReadNextString(packetData);
|
||||
Double _value = dataTypes.ReadNextDouble(packetData);
|
||||
|
||||
|
||||
int NumberOfModifiers = dataTypes.ReadNextVarInt(packetData);
|
||||
//if (NumberOfModifiers == 0) continue;
|
||||
for(int j = 0; j < NumberOfModifiers; j++)
|
||||
{
|
||||
dataTypes.ReadNextUUID(packetData);
|
||||
Double amount = dataTypes.ReadNextDouble(packetData);
|
||||
byte operation = dataTypes.ReadNextByte(packetData);
|
||||
switch (operation)
|
||||
{
|
||||
case 0: _value += amount; break;
|
||||
case 1: _value += (amount / 100); break;
|
||||
case 2: _value *= amount; break;
|
||||
}
|
||||
}
|
||||
keys.Add(_key, _value);
|
||||
}
|
||||
handler.OnEntityProperties(EntityID, keys);
|
||||
break;
|
||||
case PacketIncomingType.TimeUpdate:
|
||||
long WorldAge = dataTypes.ReadNextLong(packetData);
|
||||
long TimeOfday = dataTypes.ReadNextLong(packetData);
|
||||
handler.OnTimeUpdate(WorldAge, TimeOfday);
|
||||
break;
|
||||
default:
|
||||
return false; //Ignored packet
|
||||
}
|
||||
|
|
@ -1023,5 +1120,29 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// reinforce
|
||||
public bool SendInteractEntityPacket(int EntityID, int type)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<byte> fields = new List<byte>();
|
||||
fields.AddRange(dataTypes.GetVarInt(EntityID));
|
||||
fields.AddRange(dataTypes.GetVarInt(type));
|
||||
SendPacket(PacketOutgoingType.InteractEntity, fields);
|
||||
return true;
|
||||
}
|
||||
catch (SocketException) { return false; }
|
||||
catch (System.IO.IOException) { return false; }
|
||||
catch (ObjectDisposedException) { return false; }
|
||||
}
|
||||
public bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z, int hand)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,6 +176,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
switch (packetID)
|
||||
{
|
||||
// modified by reinforce
|
||||
case 0x00: return PacketIncomingType.SpawnEntity;
|
||||
case 0x03: return PacketIncomingType.SpawnLivingEntity;
|
||||
case 0x21: return PacketIncomingType.KeepAlive;
|
||||
case 0x26: return PacketIncomingType.JoinGame;
|
||||
case 0x0F: return PacketIncomingType.ChatMessage;
|
||||
|
|
@ -194,6 +197,12 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x14: return PacketIncomingType.CloseWindow;
|
||||
case 0x15: return PacketIncomingType.WindowItems;
|
||||
case 0x17: return PacketIncomingType.SetSlot;
|
||||
case 0x38: return PacketIncomingType.DestroyEntities;
|
||||
case 0x18: return PacketIncomingType.SetCooldown;
|
||||
case 0x29: return PacketIncomingType.EntityPosition;
|
||||
case 0x2A: return PacketIncomingType.EntityPositionAndRotation;
|
||||
case 0x59: return PacketIncomingType.EntityProperties;
|
||||
case 0x4F: return PacketIncomingType.TimeUpdate;
|
||||
default: return PacketIncomingType.UnknownPacket;
|
||||
}
|
||||
}
|
||||
|
|
@ -301,6 +310,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case PacketOutgoingType.PlayerPosition: return 0x11;
|
||||
case PacketOutgoingType.PlayerPositionAndLook: return 0x12;
|
||||
case PacketOutgoingType.TeleportConfirm: return 0x00;
|
||||
case PacketOutgoingType.HeldItemChange: return 0x23;
|
||||
case PacketOutgoingType.InteractEntity: return 0x0E;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,5 +84,10 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="data">packet Data</param>
|
||||
/// <returns>True if message was successfully sent</returns>
|
||||
bool SendPluginChannelPacket(string channel, byte[] data);
|
||||
|
||||
// by reinforce
|
||||
bool SendInteractEntityPacket(int EntityID, int type);
|
||||
bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z, int hand);
|
||||
bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,5 +125,19 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="channel">The channel the message was sent on</param>
|
||||
/// <param name="data">The data from the channel</param>
|
||||
void OnPluginChannelMessage(string channel, byte[] data);
|
||||
|
||||
void OnSpawnLivingEntity(int EntityID, int EntityType, Guid UUID, Location location);
|
||||
|
||||
void OnDestroyEntities(int[] EntityID);
|
||||
|
||||
void OnSetCooldown(int itemID, int tick);
|
||||
|
||||
void OnEntityPosition(int EntityID, Double Dx, Double Dy, Double Dz,bool onGround);
|
||||
|
||||
void OnEntityProperties(int EntityID, Dictionary<string, Double> prop);
|
||||
|
||||
void OnTimeUpdate(long WorldAge, long TimeOfDay);
|
||||
|
||||
void SetPlayerEntityID(int EntityID);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1688
entityID list.txt
Normal file
1688
entityID list.txt
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue