-
Notifications
You must be signed in to change notification settings - Fork 1
Plugins
This page will provide information on how to make a plugin based on the pack's system and a step-by-step guide to ripping it off.
The pack is based on lines of commands(functions) executed as all players in the world every tick. This means that actions such as playing sounds could potentially be repeated multiple times. To avoid making users deaf, the pack has a solution that is the host
, which is the person who executes /function UHC_setup
. Commands that are executed one time only or require conditions are all based on the tag. For example, to say 'hi' in the chat once every tick:
execute @s[tag=host] ~~~ tellraw @a {"rawtext":[{"text":"hi"}]}
Note that @s
is used here, because if @a
is used it would still be executed player count times.
The pack executes functions in loop.mcfunction
and runloop.mcfunction
at 10 ticks per second.
Conditions are achieved using additional selectors when executing commands as host
. For example, saying "GGWP" in chat when the game ends:
execute @s[tag=host,scores={settings_state=2,var_alive=1}] ~~~ tellraw @a {"rawtext":[{"text":"GGWP"}]}
You can see that there is now a scores
selector, which executes the commands only when settings_state
is 2 and var_alive
is 1 for this player.
These objectives are the variables that you can use. Their values are stored as the host's score.
In this case:
-
settings_state
stores the game's state (1=pregame, 2=in-game, 0=game finished) -
var_alive
stores how many players are left in the game. When there's only one player left in the game and the game state is still in-game, then it means we have a winner and the game could be ended. This is when you should send the message.
This is just an example. In the actual scenario,
settings_state
will be set to 0 as soon as these values match.
Objective | Description |
---|---|
timer | The timer which determines the current time of the game. Starts at 12000 for arcade and 36000 for normal. Reduces 1 each tick when settings_state is 2. |
spec_timeout | The timer determines how long left to switch the spectating target. Starts at 300 and reduces 1 each tick when settings_state is 2. When it reaches 0, the spectating target is selected as a new random available player and the number is set back to 300. |
var_alive | The variable storing how many players are left in the game. |
anim_timer | The timer used for various purposes. Starts at 40 and reduces 1 each tick, resets when it goes to 0 and repeat. |
settings_state | Stores the game's current state. 1=pregame, 2=in-game, and 0=game finished. |
Unless specified, 0 means the setting is turned off and 1 means on.
Objective | Description |
---|---|
settings_healing | Restoring health and hunger |
settings_time | Game mode. 0 for Arcade and 1 for Normal. When set to 1, weapon enchanting is not available. |
settings_gapple | Changing apples to golden apples, and changing tree saplings to apples. |
settings_spec | In-game spectating when players are dead. |
settings_autosmelt | Automatically smelting ores. |
Objective | Description |
---|---|
despawn_timer | The objective that controls despawning behavior. When entities stay without the radius of 20 blocks from any player for 40 seconds, they are immediately despawned. |