HOOK_WEATHER_CHANGING


Index:
Articles
Classes
Hooks

Quick navigation:
BLOCK_SPREAD
BLOCK_TO_PICKUPS
BREWING_COMPLETED
BREWING_COMPLETING
CHAT
CHUNK_AVAILABLE
CHUNK_GENERATED
CHUNK_GENERATING
CHUNK_UNLOADED
CHUNK_UNLOADING
COLLECTING_PICKUP
CRAFTING_NO_RECIPE
DISCONNECT
DROPSPENSE
ENTITY_ADD_EFFECT
ENTITY_CHANGED_WORLD
ENTITY_CHANGING_WORLD
ENTITY_TELEPORT
EXECUTE_COMMAND
EXPLODED
EXPLODING
HANDSHAKE
HOPPER_PULLING_ITEM
HOPPER_PUSHING_ITEM
KILLED
KILLING
LOGIN
LOGIN_FORGE
PLAYER_ANIMATION
PLAYER_BREAKING_BLOCK
PLAYER_BROKEN_BLOCK
PLAYER_CROUCHED
PLAYER_DESTROYED
PLAYER_EATING
PLAYER_FISHED
PLAYER_FISHING
PLAYER_FOOD_LEVEL_CHANGE
PLAYER_JOINED
PLAYER_LEFT_CLICK
PLAYER_MOVING
PLAYER_OPENING_WINDOW
PLAYER_PLACED_BLOCK
PLAYER_PLACING_BLOCK
PLAYER_RIGHT_CLICK
PLAYER_RIGHT_CLICKING_ENTITY
PLAYER_SHOOTING
PLAYER_SPAWNED
PLAYER_TOSSING_ITEM
PLAYER_USED_BLOCK
PLAYER_USED_ITEM
PLAYER_USING_BLOCK
PLAYER_USING_ITEM
PLUGINS_LOADED
PLUGIN_MESSAGE
POST_CRAFTING
PRE_CRAFTING
PROJECTILE_HIT_BLOCK
PROJECTILE_HIT_ENTITY
SERVER_PING
SPAWNED_ENTITY
SPAWNED_MONSTER
SPAWNING_ENTITY
SPAWNING_MONSTER
TAKE_DAMAGE
TICK
UPDATED_SIGN
UPDATING_SIGN
WEATHER_CHANGED
WEATHER_CHANGING
WORLD_STARTED
WORLD_TICK

This hook is called when the current weather has expired and a new weather is selected. Plugins may override the new weather being set.

The new weather setting is sent to the clients only after this hook has been processed.

See also the HOOK_WEATHER_CHANGED hook for a similar hook called after the change.


Callback function

The default name for the callback function is OnWeatherChanging. It has the following signature:

function MyOnWeatherChanging(World, Weather)

Parameters:

NameTypeNotes
WorldcWorldWorld for which the weather is changing
WeathernumberThe newly selected weather. One of wSunny, wRain, wStorm

The hook handler can return up to two values. If the first value is false or not present, the server calls other plugins' callbacks and finally sets the weather. If it is true, the server doesn't call any more callbacks for this hook. The second value returned is used as the new weather. If no value is given, the weather from the parameters is used as the weather. Returning false as the first value and a specific weather constant as the second value makes the server call the rest of the hook handlers with the new weather value.


Code examples

Registering the callback

cPluginManager:AddHook(cPluginManager.HOOK_WEATHER_CHANGING, MyOnWeatherChanging);
Generated by APIDump on 2024-10-25 05:01:00, Build ID Unknown, Commit approx: 0325de7dacaf1e2feaea5eaab4791bc23d78f9e7