Exemplo n.º 1
0
        public override void OnHeldInteractStart(ItemSlot slot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel, bool firstEvent, ref EnumHandHandling handling)
        {
            if (((ItemCage)slot.Itemstack.Item).IsCase)
            {
                base.OnHeldInteractStart(slot, byEntity, blockSel, entitySel, firstEvent, ref handling);
                return;
            }

            if (byEntity.Controls.Sneak && ((ItemCage)slot.Itemstack.Item).IsEmpty)
            {
                IPlayer       player    = (byEntity as EntityPlayer).Player;
                InventoryCage inventory = new InventoryCage(player, slot);

                player.InventoryManager.OpenInventory(inventory);

                byEntity.Attributes.SetInt("opengui", 1);
                handling = EnumHandHandling.Handled;
                return;
            }

            byEntity.Attributes.SetInt("opengui", 0);
            byEntity.Attributes.SetInt("aiming", 1);
            byEntity.Attributes.SetInt("aimingCancel", 0);
            byEntity.StartAnimation("aim");

            handling = EnumHandHandling.PreventDefault;
        }
Exemplo n.º 2
0
        public GuiDialogBait(InventoryCage inventory, ICoreClientAPI capi)
            : base(Lang.Get(ConstantsCore.ModId + ":bait-dialog-title"), capi)
        {
            this.inventory = inventory;
            this.inventory.SlotModified += (int n) => UpdateText();

            InitDialog();
        }