Beispiel #1
0
        public override void StartClientSide(ICoreClientAPI capi)
        {
            this.capi = capi;
            base.Initialize();

            clientChannel =
                capi.Network.GetChannel("weather")
                .SetMessageHandler <WeatherState>(OnWeatherUpdatePacket)
                .SetMessageHandler <WeatherConfigPacket>(OnWeatherConfigUpdatePacket)
                .SetMessageHandler <WeatherPatternAssetsPacket>(OnAssetsPacket)
            ;

            capi.Event.RegisterGameTickListener(OnClientGameTick, 50);

            capi.Event.LevelFinalize += LevelFinalizeInit;

            capi.Event.RegisterRenderer(this, EnumRenderStage.Before, "weatherSystem");
            capi.Event.RegisterRenderer(this, EnumRenderStage.Done, "weatherSystem");
            capi.Event.LeaveWorld   += () => cloudRenderer?.Dispose();
            capi.Event.OnGetClimate += Event_OnGetClimate;

            simSounds      = new WeatherSimulationSound(capi as ICoreClientAPI, this);
            simParticles   = new WeatherSimulationParticles(capi as ICoreClientAPI, this);
            simLightning   = new WeatherSimulationLightning(capi as ICoreClientAPI, this);
            auroraRenderer = new AuroraRenderer(capi as ICoreClientAPI, this);
        }
        public override void Initialize(EntityProperties properties, JsonObject attributes)
        {
            base.Initialize(properties, attributes);

            tempStabilitySystem = entity.Api.ModLoader.GetModSystem <SystemTemporalStability>();

            if (entity.Api.Side == EnumAppSide.Client)
            {
                requireInitSounds = true;
                precipParticleSys = entity.Api.ModLoader.GetModSystem <WeatherSystemClient>().simParticles;
            }

            enabled = entity.Api.World.Config.GetBool("temporalStability", true);

            if (!entity.WatchedAttributes.HasAttribute("temporalStability"))
            {
                OwnStability = 1;
            }
        }
        public override void StartClientSide(ICoreClientAPI capi)
        {
            this.capi     = capi;
            clientChannel =
                capi.Network.RegisterChannel("weather")
                .RegisterMessageType(typeof(WeatherState))
                .SetMessageHandler <WeatherState>(OnWeatherUpdate)
            ;

            capi.Event.RegisterGameTickListener(OnClientGameTick, 50);
            capi.Event.LevelFinalize += LevelFinalizeInit;
            capi.Event.RegisterRenderer(this, EnumRenderStage.Before, "weatherSystem");
            capi.Event.RegisterRenderer(this, EnumRenderStage.Done, "weatherSystem");
            capi.Event.LeaveWorld += () => cloudRenderer?.Dispose();

            blendedWeatherData.Ambient = new AmbientModifier().EnsurePopulated();

            simSounds      = new WeatherSimulationSound(capi as ICoreClientAPI, this);
            simParticles   = new WeatherSimulationParticles(capi as ICoreClientAPI, this);
            simLightning   = new WeatherSimulationLightning(capi as ICoreClientAPI, this);
            auroraRenderer = new AuroraRenderer(capi as ICoreClientAPI, this);
        }