Пример #1
0
        /// <summary>
        /// Set a slot
        /// </summary>
        /// <param name="SlotId">The Id of the slot</param>
        /// <param name="Block">The BlocK Id</param>
        public void SetSlot(int SlotId, int Block)
        {
            if (WithinSlotRange(SlotId))
            {
                if (Bar[SlotId] != Block)
                {
                    Bar[SlotId] = Block;

                    var e = new Mod.HotbarSlotSelectedArgs();
                    e.SelectedBlock = Bar[SlotId];
                    e.SelectedSlot  = SlotId;
                    Mod.Events.FireHotbarSlotSet(Program.game, e);
                }
            }
            else
            {
                throw new ArgumentException(SlotId + " is not within the slot range.");
            }
        }
Пример #2
0
        /// <summary>
        /// Select one of the slots
        /// </summary>
        /// <param name="SlotId">The slot Id</param>
        public void SelectSlot(int SlotId)
        {
            if (WithinSlotRange(SlotId))
            {
                if (SelectedSlot != SlotId)
                {
                    SelectedSlot            = SlotId;
                    Program.game.BlockUsing = this.GetSlot(SlotId);

                    var e = new Mod.HotbarSlotSelectedArgs();
                    e.SelectedBlock = Bar[SlotId];
                    e.SelectedSlot  = SlotId;
                    Mod.Events.FireHotbarSlotSelected(Program.game, e);
                }
            }
            else
            {
                throw new ArgumentException(SlotId + " is not within the slot range.");
            }
        }