Standalone [1.3] tModLoader - A Modding API

I am attempting to do a multiplayer modded terraria tmodloader server on a mac but I am unsure of how to do so. Does anyone know how to do this or if it's possible?
 
c:\Users\Owner\Documents\My Games\Terraria\ModLoader\Mod Sources\TestMod\Items\BasicKnife.cs(36,52) : error CS0246: The type or namespace name 'Rectangle' could not be found (are you missing a using directive or an assembly reference?)



my code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TestMod.Items
{
public class BasicKnife : ModItem
{
public override void SetDefaults()
{
item.name = "BasicKnife"; //The name of your weapon
item.damage = 50; //The damage of your weapon
item.melee = true; //Is your weapon a melee weapon?
item.width = 40; //Weapon's texture's width
item.height = 40; //Weapon's texture's height
item.toolTip = "This is a modded sword."; //The text showed below your weapon's name
item.useTime = 20; //The time span of using the weapon. Remember in terraria, 60 frames is a second.
item.useAnimation = 20; //The time span of the using animation of the weapon, suggest set it the same as useTime.
item.useStyle = 1; //The use style of weapon, 1 for swinging, 2 for drinking, 3 act like shortsword, 4 for use like life crystal, 5 for use staffs or guns
item.knockBack = 6; //The force of knockback of the weapon. Maxium is 20
item.value = 10000; //The value of the weapon
item.rare = 2; //The rarity of the weapon, from -1 to 13
item.UseSound = SoundID.Item1; //The sound when the weapon is using
item.autoReuse = true; //Whether the weapon can use automaticly by pressing mousebutton
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "ExampleItem", 10);
recipe.AddTile(null, "ExampleWorkbench");
recipe.SetResult(this);
recipe.AddRecipe();
}

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("Sparkle"));
//Emit dusts when swing the sword
}
}

public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.OnFire, 60); //Add Onfire buff to the NPC for 1 second
}
}
}
 
nvm fixed it..... for anyone who doesn't know how yet, i used al0n37's script and just modified the names.... worked wonders the problem i actually had was that i named the basicknife picture ''basic knife'' and spaces won't work.
 
Hi again, finished my pickaxes, so I'm trying to modify Dirt Blocks now. I'm trying to change their minPick and mineResist properties. I was wondering if anyone could walk me through it?

On the same note, I would like to know if it is possible to view the .cs of pre-existing items, such as the Dirt Block itself, so I could look at all its vanilla values?
 
Hi again, finished my pickaxes, so I'm trying to modify Dirt Blocks now. I'm trying to change their minPick and mineResist properties. I was wondering if anyone could walk me through it?

On the same note, I would like to know if it is possible to view the .cs of pre-existing items, such as the Dirt Block itself, so I could look at all its vanilla values?
I believe minPick and mineResist are only available for ModTiles, not vanilla tiles. They are hardcoded for vanilla tiles. You can decomplile terraria, but don't expect individual classes like with tmodloader mods. All the tiles info is peppered throughout TileObjectData, Main, and some other classes.
 
Aw, that really stinks...

So the only way to get the results I wanted at this point would be to clone a new brick for each one I wanted... And that would actually be okay.

It just begs the question: Would it be possible to use mod tiles in TEdit? That's the only thing stopping me from actually going through with cloning stuff.

EDIT: Actually thinking about it, it would be a real pain to do it this way because I'd have to edit recipes of other things too! Like you can make wood out of wood wall, and pick it up from trees, so I'd need the resulting tile to be right...that would be a lot of extra work! I don't know if I would want to do it this way after all o_o
 
Last edited:
v0.9.2.2
-Added OnRespawn hook for ModPlayer
-Changed parameters for NetSend and NetReceive hooks for ModTileEntity
-Also fixed bug where modded tile entities sometimes would not sync
-Changed parameters for Mod.GetEquipTexture, Mod.GetEquipSlot, and Mod.GetAccessorySlot
-Fixed many freezing bugs resulting from GlobalItem
-Fixed bug where selling items makes them lose their ItemInfo
-Improved the speed and appearance of the mod browser
-Added the ability to suppress mod browser warnings
-Added object overload for ErrorLogger.Log
-More generic GetX and XType methods in Mod
-Added more Item.NewItem overloads
-Added Main.DiscoColor to get the rainbow color more easily
-Added Item.QuickSpawnClonedItem

I promise this update is not a joke.
 
v0.9.2.2
-Added OnRespawn hook for ModPlayer
-Changed parameters for NetSend and NetReceive hooks for ModTileEntity
-Also fixed bug where modded tile entities sometimes would not sync
-Changed parameters for Mod.GetEquipTexture, Mod.GetEquipSlot, and Mod.GetAccessorySlot
-Fixed many freezing bugs resulting from GlobalItem
-Fixed bug where selling items makes them lose their ItemInfo
-Improved the speed and appearance of the mod browser
-Added the ability to suppress mod browser warnings
-Added object overload for ErrorLogger.Log
-More generic GetX and XType methods in Mod
-Added more Item.NewItem overloads
-Added Main.DiscoColor to get the rainbow color more easily
-Added Item.QuickSpawnClonedItem

I promise this update is not a joke.
is the linux version playable now ?
 
XzysJ6F.png

I think I found a "bug". :D
 
Could someone tell me how to update Tmodloader because I am a little new to this and have no idea.plz help.
 
Last edited:
my mod browser says OFFLINE and no matter what i do it won't change is there a fix. btw i am on mac.

Quick Update: Also my game crashes when ever i try to look at the mod list and can't load up large worlds

any help would great
 
Last edited:
In the code, in what context would you use main. For Example,
public override void SetDefaults()
{
projectile.name = "GlowyThing";
projectile.width = 40;
projectile.height = 40;
main.projFrames[projectile.type] = 8;
projectile.timeLeft = 180;
projectile.penetrate = 8;
projectile.friendly = true;
projectile.hostile = false;
projectile.tileCollide = false;;
projectile.ignoreWater = true;
projectile.ranged = true;
projectile.aiStyle = 25;
}
 
In the code, in what context would you use main. For Example,
public override void SetDefaults()
{
projectile.name = "GlowyThing";
projectile.width = 40;
projectile.height = 40;
main.projFrames[projectile.type] = 8;
projectile.timeLeft = 180;
projectile.penetrate = 8;
projectile.friendly = true;
projectile.hostile = false;
projectile.tileCollide = false;;
projectile.ignoreWater = true;
projectile.ranged = true;
projectile.aiStyle = 25;
}
You would use Main if the property/field you are accessing is part of the Main class. Terraria is pretty organized, but Main has a lot of random things. Basically you need to be using Visual Studio to be productive.
 
for the new modloader update 9.2.2 requires that all mods need to be updated for 9.2.2?
because i dont want update modloader because the typical message of this version was for the 9.2.1 and mod has been disasbled.
 
Back
Top Bottom