Beispiel #1
0
        public int Hand;                // Optional Varint Enum

        public override void Read(byte[] array)
        {
            McVarint.TryParse(ref array, out EntityID);
            McVarint.TryParse(ref array, out var type);
            Type = (InteractEntityType)type;
            if (Type == InteractEntityType.InteractAt)
            {
                McFloat.TryParse(ref array, out TargetX);
                McFloat.TryParse(ref array, out TargetY);
                McFloat.TryParse(ref array, out TargetZ);
            }
            if (Type != InteractEntityType.Attack)
            {
                McVarint.TryParse(ref array, out Hand);
            }
        }
Beispiel #2
0
        public static InteractEntity GetInteractEntity(int id, string stype)
        {
            InteractEntityType type = (InteractEntityType)Enum.Parse(typeof(InteractEntityType), stype, true);

            object entity = null;

            switch (type)
            {
            case InteractEntityType.Npc:
                entity = new Npc(id);
                break;

            case InteractEntityType.Item:
                entity = new Item(id);
                break;

            case InteractEntityType.Object:
                entity = new wObject(id);
                break;
            }
            return(new InteractEntity(type, entity));
        }
Beispiel #3
0
 public InteractEntity(InteractEntityType type, object entity)
 {
     Type   = type;
     Entity = entity;
 }