Exemplo n.º 1
0
        public override void OnBlockRemoved()
        {
            base.OnBlockRemoved();

            if (ambientSound != null)
            {
                ambientSound.Stop();
                ambientSound.Dispose();
            }

            renderer?.Dispose();
            renderer = null;

            if (clientDialog != null)
            {
                clientDialog.TryClose();
                clientDialog?.Dispose();
                clientDialog = null;
            }
        }
Exemplo n.º 2
0
        public override void Initialize(ICoreAPI api)
        {
            base.Initialize(api);

            inventory.pos = Pos;
            inventory.LateInitialize("smelting-" + Pos.X + "/" + Pos.Y + "/" + Pos.Z, api);
            wsys       = api.ModLoader.GetModSystem <WeatherSystemBase>();
            speedBonus = Block.Attributes["speedBonus"].AsFloat(speedBonus); // speed bonus it's got info in json.


            RegisterGameTickListener(OnBurnTick, 100);
            RegisterGameTickListener(On500msTick, 500);

            if (api is ICoreClientAPI)
            {
                renderer = new CampfireContentsRenderer(api as ICoreClientAPI, Pos);

                (api as ICoreClientAPI).Event.RegisterRenderer(renderer, EnumRenderStage.Opaque, "campfire");

                UpdateRenderer();
            }
        }