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 void Initialize() { precipitationNoise = SimplexNoise.FromDefaultOctaves(4, 0.02 / 3, 0.95, api.World.Seed - 18971121); precipitationNoiseSub = SimplexNoise.FromDefaultOctaves(3, 0.004 / 3, 0.95, api.World.Seed - 1717121); simLightning = new WeatherSimulationLightning(api, this); }
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); }