tModLoader Webmilio's Commons Library

webmilio

Pixel Pirate
icon.png


Webmilio's Commons Library is a library aimed a making modding much easier.

Things this adds:
  • Better Networking (in my opinion, at least)
  • Managers (Manual or singletons that handle classes that could be seen as static, but need inheritance. Also known as the Definition pattern in programming)
  • Loaders (Manual or singletons that handle loading all found classes within the Terraria assembly, including mods. Very similar to ItemLoader, NPCLoader, etc.)
  • Identity Manager (WIP): a way to get Steam ID from the user (if the user is using Steam)
  • A bunch of extensions
    • This includes TINQ (inspired by LINQ from Microsoft): adds a lot of extension methods that affect entity collections (NPCs, Items, Players, Projectiles).
  • Keyboard Manager: get the state of any keys (NotPressed, JustPressed, Pressed, JustReleased), regardless of Mod Hotkey.
  • Custom Achievements: you can add custom achievements in a less complex way than without the library.
    • This is a work-in-progress. While you can add achievements and they do correctly save, all modded achievement progress is lost after disabling and reloading a mod that adds achievements. It is unconfirmed if the same happens when reloading mods normally.
  • Time Management: you can manipulate time within your mod to a certain extend. The best example for this is within the JoJo Mod by HellGoesOn: Star Platinum is able to fully stop time.
    • This is a work-in-progress. My goal is to make time-stop affect all entities and be fully customizable: you can choose to stop players only, entities and players or any combination of entities. You can also change the day rate, etc.

Other Utilities:
  • Class which allows you to quickly create a tile-placing item once extended.
  • Classes for easy statue creation with customizable behavior.

Examples can be found in the wiki and in the discord.


To obtain the DLL for referencing in your mod, simply click Extract after updating the library in tModLoader, or go to the releases (see link down below).


My own mods (check this discord for more information)
  • QuickSave
  • DoTaria (if I ever update it)


Credits to Scalie for the idea of moddable achievements and the easy tile-creating class.
Credits to Kalciphoz for making the kick-a$$ mod icon!

There is a discord available for this library, but you must first request to be invited as it is developer only.
 
Last edited:
Trying to use this after the update, causes this to crash.
So until it's fixed I can't even continue to play my world, cause I have Laugicality also, and it won't load without this.
 
First off sorry for getting back so late.
Second I was going to get the error message that this mod puts out but then noticed that it had an update.
Installed update and it no longer crashes.
So I'm guessing it was the past update did something.
 
I updated the mod last Monday, and now multiplayer doesn't work. It also crashed when I first updated the mod, causing me to have to delete and redownload it. Any time I enable or disable it it crashes. I'll get those error codes in a minute. I really don't know what's going on, so any help would be appreciated. Thanks anyway! (I don't really know where else to post this so here is where I'm posting it)
 
Webmilio's Commons Library v0.1.8.14
I believe this is the correct log:
12/10/2019 8:20:36 PM
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Texture2D'.
at Microsoft.Xna.Framework.Helpers.CheckDisposed(Object obj, IntPtr pComPtr)
at Microsoft.Xna.Framework.Graphics.TextureCollection.set_Item(Int32 index, Texture value)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.RenderBatch(Texture2D texture, SpriteInfo[] sprites, Int32 offset, Int32 count)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.Flush()
at Microsoft.Xna.Framework.Graphics.SpriteBatch.End()
at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.DrawChildren(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
at Terraria.GameContent.UI.Elements.UIList.UIInnerList.DrawChildren(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.DrawChildren(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.DrawChildren(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.DrawChildren(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.DrawChildren(SpriteBatch spriteBatch)
at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
at Terraria.GameContent.UI.States.UICharacterSelect.Draw(SpriteBatch spriteBatch)
at Terraria.UI.UserInterface.Draw(SpriteBatch spriteBatch, GameTime time)
at Terraria.Main.DrawMenu(GameTime gameTime)
at Terraria.Main.DoDraw(GameTime gameTime)
at Terraria.Main.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Terraria.Program.LaunchGame_()
 
As for the inability to connect to a server with the mod enabled, there are no logs for that as far as I know.
 
latest update sadly seems broken. cannot move or use items, stuck in place while NPCs move as usual as well as vanity armor not showing on existing character/world or new character/world. thankfully I was only using this for dust bags for the stand arrow, but it's an issue that (assuming I'm not the only case) could affect others more severely. I'll check back to this thread to see if you need any logs or anything. I don't tangle with mods but I'm sure this is useful for those that do and that this can be fixed expediently :)

edit - only broken when dust bags is enabled, if that means anything
 
latest update sadly seems broken. cannot move or use items, stuck in place while NPCs move as usual as well as vanity armor not showing on existing character/world or new character/world. thankfully I was only using this for dust bags for the stand arrow, but it's an issue that (assuming I'm not the only case) could affect others more severely. I'll check back to this thread to see if you need any logs or anything. I don't tangle with mods but I'm sure this is useful for those that do and that this can be fixed expediently :)

edit - only broken when dust bags is enabled, if that means anything

Are you using Magic Stick ?
 
is that an item in dust bags? if so no, and I don't have a mod called magic stick. I tried new world, new character and the issue still happened. sorry for the late reply, haven't been checking this thread
 

Webmilio's Commons Library is a library aimed a making modding much easier.

Things this adds:
  • Better Networking (in my opinion, at least)
  • Managers (Manual or singletons that handle classes that could be seen as static, but need inheritance. Also known as the Definition pattern in programming)
  • Loaders (Manual or singletons that handle loading all found classes within the Terraria assembly, including mods. Very similar to ItemLoader, NPCLoader, etc.)
  • Identity Manager (WIP): a way to get Steam ID from the user (if the user is using Steam)
  • A bunch of extensions
    • This includes TINQ (inspired by LINQ from Microsoft): adds a lot of extension methods that affect entity collections (NPCs, Items, Players, Projectiles).
  • Keyboard Manager: get the state of any keys (NotPressed, JustPressed, Pressed, JustReleased), regardless of Mod Hotkey.
  • Custom Achievements: you can add custom achievements in a less complex way than without the library.
    • This is a work-in-progress. While you can add achievements and they do correctly save, all modded achievement progress is lost after disabling and reloading a mod that adds achievements. It is unconfirmed if the same happens when reloading mods normally.
  • Time Management: you can manipulate time within your mod to a certain extend. The best example for this is within the JoJo Mod by HellGoesOn: Star Platinum is able to fully stop time.
    • This is a work-in-progress. My goal is to make time-stop affect all entities and be fully customizable: you can choose to stop players only, entities and players or any combination of entities. You can also change the day rate, etc.

Other Utilities:
  • Class which allows you to quickly create a tile-placing item once extended.

To obtain the DLL for referencing in your mod, simply click Extract after updating the library in tModLoader, or go to the releases (see link down below).


My own mods (check this discord for more information)
  • QuickSave
  • DoTaria (if I ever update it)


Credits to Scalie for the idea of moddable achievements and the easy tile-creating class.
Credits to Kalciphoz for making the kick-a$$ mod icon!

There is a discord available for this library, but you must first request to be invited as it is developer only.
Is there an Achievement Example?
 
Hey @webmilio I think I broke your mod
I was trying to get achivements in, and I did, but I deleted the data to reset it but Commons won't make a new one and nothing is saving
Also, it no longer shows the "achivement unlocked" popup, which is sad
 
Pretty nice. So how make custom/modded achievements?
And yes, im a bit dont understand in github link (u know where) about some thing, if be you could, lets talk about it in discord (here), pls?
 
Back
Top Bottom