<commit_before>using Alex.Net;
using Alex.Net.Bedrock;
using Alex.Worlds.Multiplayer.Bedrock;
using MiNET.Net;
using MiNET.UI;
using NLog;
using RocketUI;
using RocketUI.Input;

namespace Alex.Gui.Forms
{
    public class BedrockFormManager
    {
        private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
        
        private GuiManager GuiManager { get; }
        private NetworkProvider NetworkProvider { get; }
        private InputManager InputManager { get; }
        
        private FormBase _activeForm = null;
        public BedrockFormManager(NetworkProvider networkProvider, GuiManager guiManager, InputManager input)
        {
            NetworkProvider = networkProvider;
            GuiManager = guiManager;
            InputManager = input;
        }

        public bool IsShowingForm => _activeForm != null;

        public void Show(uint id, Form form)
        {
            if (_activeForm != null)
            {
                GuiManager.HideDialog(_activeForm);
            }
            
            if (form is SimpleForm simpleForm)
            {
                GuiManager.ShowDialog(_activeForm = new SimpleFormDialog(id, this, simpleForm, InputManager));
            }
            else if (form is CustomForm customForm)
            {
                GuiManager.ShowDialog(_activeForm = new CustomFormDialog(id, this, customForm, InputManager));
            }
            else if (form is ModalForm modalForm)
            {
                GuiManager.ShowDialog(_activeForm = new ModalFormDialog(id, this, modalForm, InputManager));
            }
            else
            {
                Log.Warn($"Form type not supported: {form.GetType()}");
            }
        }

        public void Hide(uint id)
        {
            if (_activeForm != null)
            {
                if (_activeForm.FormId == id)
                {
                    _activeForm?.Close();
                    _activeForm = null;
                }
            }
        }

        public void SendResponse(McpeModalFormResponse response)
        {
            if (NetworkProvider is BedrockClient client)
            {
                client.SendPacket(response);
            }
        }

        public void CloseAll()
        {
            var active = _activeForm;
            if (active != null) 
                Hide(active.FormId);
        }
    }
}<commit_msg>Fix recursive loop in BedrockFormManager<commit_after>using Alex.Net;
using Alex.Net.Bedrock;
using Alex.Worlds.Multiplayer.Bedrock;
using MiNET.Net;
using MiNET.UI;
using NLog;
using RocketUI;
using RocketUI.Input;

namespace Alex.Gui.Forms
{
    public class BedrockFormManager
    {
        private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
        
        private GuiManager GuiManager { get; }
        private NetworkProvider NetworkProvider { get; }
        private InputManager InputManager { get; }
        
        private FormBase _activeForm = null;
        public BedrockFormManager(NetworkProvider networkProvider, GuiManager guiManager, InputManager input)
        {
            NetworkProvider = networkProvider;
            GuiManager = guiManager;
            InputManager = input;
        }

        public bool IsShowingForm => _activeForm != null;

        public void Show(uint id, Form form)
        {
            if (_activeForm != null)
            {
                GuiManager.HideDialog(_activeForm);
            }
            
            if (form is SimpleForm simpleForm)
            {
                GuiManager.ShowDialog(_activeForm = new SimpleFormDialog(id, this, simpleForm, InputManager));
            }
            else if (form is CustomForm customForm)
            {
                GuiManager.ShowDialog(_activeForm = new CustomFormDialog(id, this, customForm, InputManager));
            }
            else if (form is ModalForm modalForm)
            {
                GuiManager.ShowDialog(_activeForm = new ModalFormDialog(id, this, modalForm, InputManager));
            }
            else
            {
                Log.Warn($"Form type not supported: {form.GetType()}");
            }
        }

        public void Hide(uint id)
        {
            var activeForm = _activeForm;
            if (activeForm != null && activeForm.FormId == id)
            {
                _activeForm = null;
                activeForm?.Close();
            }
        }

        public void SendResponse(McpeModalFormResponse response)
        {
            if (NetworkProvider is BedrockClient client)
            {
                client.SendPacket(response);
            }
        }

        public void CloseAll()
        {
            var active = _activeForm;
            if (active != null) 
                Hide(active.FormId);
        }
    }
}
{'fraction_non_alphanumeric': 0.07504145936981758, 'fraction_numerical': 0.0, 'mean_word_length': 1.5954814416352878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3299871', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1185, 'n_words': 296}