1using Microsoft.Xna.Framework;
 
    2using Microsoft.Xna.Framework.Graphics;
 
    4using System.Collections.Generic;
 
    6using Terraria.GameInput;
 
    7using Terraria.Graphics;
 
    8using Terraria.Localization;
 
   13    public abstract partial class Mod
 
   28        [Obsolete(
"This UpdateMusic method now obsolete, use the UpdateMusic with the MusicPriority parameter.")]
 
   61        public virtual bool HijackSendData(
int whoAmI, 
int msgType, 
int remoteClient, 
int ignoreClient, NetworkText text, 
int number, 
float number2, 
float number3, 
float number4, 
int number5, 
int number6, 
int number7) {
 
   74        public virtual void UpdateUI(GameTime gameTime) {
 
  219    internal static class ModHooks
 
  222        internal static void UpdateMusic(ref 
int music, ref 
MusicPriority priority) {
 
  223            foreach (Mod mod 
in ModLoader.Mods) {
 
  226                mod.UpdateMusic(ref modMusic, ref modPriority);
 
  227                if (modMusic >= 0 && modPriority >= priority) {
 
  229                    priority = modPriority;
 
  235        internal static void HotKeyPressed() {
 
  236            foreach (var modHotkey 
in HotKeyLoader.HotKeys) {
 
  237                if (PlayerInput.Triggers.Current.KeyStatus[modHotkey.uniqueName]) {
 
  238                    modHotkey.mod.HotKeyPressed(modHotkey.name);
 
  243        internal static void ModifyTransformMatrix(ref SpriteViewMatrix Transform) {
 
  244            foreach (Mod mod 
in ModLoader.Mods) {
 
  245                mod.ModifyTransformMatrix(ref Transform);
 
  249        internal static void ModifySunLight(ref Color tileColor, ref Color backgroundColor) {
 
  250            if (Main.gameMenu) 
return;
 
  251            foreach (Mod mod 
in ModLoader.Mods) {
 
  252                mod.ModifySunLightColor(ref tileColor, ref backgroundColor);
 
  256        internal static void ModifyLightingBrightness(ref 
float negLight, ref 
float negLight2) {
 
  258            foreach (Mod mod 
in ModLoader.Mods) {
 
  259                mod.ModifyLightingBrightness(ref scale);
 
  261            if (Lighting.NotRetro) {
 
  266                negLight -= (scale - 1f) / 2.307692307692308f;
 
  267                negLight2 -= (scale - 1f) / 0.75f;
 
  269            negLight = Math.Max(negLight, 0.001f);
 
  270            negLight2 = Math.Max(negLight2, 0.001f);
 
  273        internal static void PostDrawFullscreenMap(ref 
string mouseText) {
 
  274            foreach (Mod mod 
in ModLoader.Mods) {
 
  275                mod.PostDrawFullscreenMap(ref mouseText);
 
  279        internal static void UpdateUI(GameTime gameTime) {
 
  280            if (Main.gameMenu) 
return;
 
  281            foreach (Mod mod 
in ModLoader.Mods) {
 
  282                mod.UpdateUI(gameTime);
 
  286        public static void PreUpdateEntities() {
 
  287            foreach (Mod mod 
in ModLoader.Mods) {
 
  288                mod.PreUpdateEntities();
 
  292        public static void MidUpdatePlayerNPC() {
 
  293            foreach (Mod mod 
in ModLoader.Mods) {
 
  294                mod.MidUpdatePlayerNPC();
 
  298        public static void MidUpdateNPCGore() {
 
  299            foreach (Mod mod 
in ModLoader.Mods) {
 
  300                mod.MidUpdateNPCGore();
 
  304        public static void MidUpdateGoreProjectile() {
 
  305            foreach (Mod mod 
in ModLoader.Mods) {
 
  306                mod.MidUpdateGoreProjectile();
 
  310        public static void MidUpdateProjectileItem() {
 
  311            foreach (Mod mod 
in ModLoader.Mods) {
 
  312                mod.MidUpdateProjectileItem();
 
  316        public static void MidUpdateItemDust() {
 
  317            foreach (Mod mod 
in ModLoader.Mods) {
 
  318                mod.MidUpdateItemDust();
 
  322        public static void MidUpdateDustTime() {
 
  323            foreach (Mod mod 
in ModLoader.Mods) {
 
  324                mod.MidUpdateDustTime();
 
  328        public static void MidUpdateTimeWorld() {
 
  329            foreach (Mod mod 
in ModLoader.Mods) {
 
  330                mod.MidUpdateTimeWorld();
 
  334        public static void MidUpdateInvasionNet() {
 
  335            foreach (Mod mod 
in ModLoader.Mods) {
 
  336                mod.MidUpdateInvasionNet();
 
  340        public static void PostUpdateEverything() {
 
  341            foreach (Mod mod 
in ModLoader.Mods) {
 
  342                mod.PostUpdateEverything();
 
  346        internal static void ModifyInterfaceLayers(List<GameInterfaceLayer> layers) {
 
  347            foreach (GameInterfaceLayer layer 
in layers) {
 
  350            foreach (Mod mod 
in ModLoader.Mods) {
 
  351                mod.ModifyInterfaceLayers(layers);
 
  355        internal static void PostDrawInterface(SpriteBatch spriteBatch) {
 
  356            foreach (Mod mod 
in ModLoader.Mods) {
 
  357                mod.PostDrawInterface(spriteBatch);
 
  361        internal static void PostUpdateInput() {
 
  362            foreach (Mod mod 
in ModLoader.Mods) {
 
  363                mod.PostUpdateInput();
 
  367        internal static void PreSaveAndQuit() {
 
  368            foreach (Mod mod 
in ModLoader.Mods) {
 
  369                mod.PreSaveAndQuit();
 
virtual void MidUpdatePlayerNPC()
Called after Players got updated, but before any NPCs get updated.
 
virtual void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor)
Allows you to modify color of light the sun emits.
 
virtual void PreUpdateEntities()
Use this if you want to do something before anything in the World gets updated. Called after UI updat...
 
virtual void MidUpdateTimeWorld()
Called after Time got updated, but before the World gets updated.
 
virtual void HandlePacket(BinaryReader reader, int whoAmI)
Called whenever a net message / packet is received from a client (if this is a server) or the server ...
 
virtual void PreSaveAndQuit()
Called in SP or Client when the Save and Quit button is pressed. One use for this hook is clearing ou...
 
virtual void MidUpdateDustTime()
Called after Dust got updated, but before Time (day/night, events, etc.) gets updated.
 
virtual bool HijackGetData(ref byte messageType, ref BinaryReader reader, int playerNumber)
Allows you to modify net message / packet information that is received before the game can act on it.
 
virtual void MidUpdateItemDust()
Called after Items got updated, but before any Dust gets updated.
 
virtual void MidUpdateInvasionNet()
Called after Invasions got updated. The only thing that is updated after this is the Network.
 
virtual void ModifyLightingBrightness(ref float scale)
Allows you to modify overall brightness of lights. Can be used to create effects similiar to what nig...
 
virtual void MidUpdateNPCGore()
Called after NPCs got updated, but before any Gores get updated.
 
virtual void ModifyTransformMatrix(ref SpriteViewMatrix Transform)
Allows you to set the transformation of the screen that is drawn. (Translations, rotations,...
 
virtual bool HijackSendData(int whoAmI, int msgType, int remoteClient, int ignoreClient, NetworkText text, int number, float number2, float number3, float number4, int number5, int number6, int number7)
Hijacks the send data method. Only use if you absolutely know what you are doing. If any hooks return...
 
virtual void MidUpdateGoreProjectile()
Called after Gores got updated, but before any Projectiles get updated.
 
virtual void MidUpdateProjectileItem()
Gets called immediately after all Projectiles are updated, but before any Items get updated.
 
virtual void PostDrawInterface(SpriteBatch spriteBatch)
Called after interface is drawn but right before mouse and mouse hover text is drawn....
 
virtual void PostUpdateInput()
Called after the input keys are polled. Allows for modifying things like scroll wheel if your custom ...
 
virtual void HotKeyPressed(string name)
Called when a hotkey is pressed. Check against the name to verify particular hotkey that was pressed....
 
virtual void UpdateMusic(ref int music, ref MusicPriority priority)
Allows you to determine what music should currently play.
 
virtual void PostDrawFullscreenMap(ref string mouseText)
Called while the fullscreen map is active. Allows custom drawing to the map.
 
virtual void UpdateMusic(ref int music)
A legacy hook that you should no longer use. Use the version with two parameters instead.
 
virtual void PostUpdateEverything()
Called after the Network got updated, this is the last hook that happens in an update.
 
virtual void ModifyInterfaceLayers(List< GameInterfaceLayer > layers)
Allows you to modify the elements of the in-game interface that get drawn. GameInterfaceLayer can be ...
 
virtual void UpdateUI(GameTime gameTime)
Ran every update and suitable for calling Update for UserInterface classes
 
MusicPriority
This enum dictates from low to high which music selections take priority. Setting appropriate MusicPr...