예제 #1
0
 //Sets Entity Id
 /// <summary>
 /// Do never, *never* create a Player.
 /// </summary>
 public Player(MinecraftClient client) : base()
 {
     this.Client   = client;
     NextTransform = Transform;
     Inventory     = new Inventory(this);
     GameMode      = GameMode.Creative;
     SpawnPosition = new Vector3(0, 0, 0);
     Abilities     = new PlayerAbilities();
     OnGround      = true;
     World.Entities.Remove(this); //Re-Add Later on
 }
예제 #2
0
 public static void Process(ChatMessage msg, MinecraftClient client)
 {
     if (msg.Text.StartsWith('/'))
     {
         HandleCommand(msg.Text, client);
     }
     else
     {
         client.SendToAll(new ChatMessagePacketClient(client)
         {
             msg      = msg,
             position = Types.Enums.ChatPosition.Chat
         });
     }
 }
예제 #3
0
        private static void HandleCommand(string text, MinecraftClient client)
        {
            if (!text.StartsWith('/'))
            {
                throw new ArgumentException();
            }
            text = text.Remove(0, 1);

            try
            {
                root.Execute(new CommandContext(text, client.Player, client.Player.Transform.Position, client.Player));
            }
            catch
            {
                client.Send(new ChatMessagePacketClient(client)
                {
                    msg = new ChatMessage()
                    {
                        Text  = "Error Executing Command",
                        Color = "red"
                    }
                });
            }
        }
예제 #4
0
 public MinecraftPacket(MinecraftClient client)
 {
     this.Client = client;
 }