Standalone [1.3] tModLoader - A Modding API

well the numbers i use is not ment to be these but i se copy paste and this is just a test
i plan on useing 0-74 and 75-99 for the real use


View attachment 143904 View attachment 143905

these are the pictures (10 of them) really simple just the same thing with another color

also i dont know how to do code with out some example code

sry dont do much codeing i do mostly copy pasteing but with just that i do get far
Please show me your entire class. I need to see exactly what you're trying to do.
 
Please show me your entire class. I need to see exactly what you're trying to do.


using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;

namespace collectingcards.Tiles.trees
{
public class loottreerainbow : ModTree
{
private Mod mod
{
get
{
return ModLoader.GetMod("collectingcards");
}
}

public override int CreateDust()
{
return mod.DustType("lootspark1");
}

public override int GrowthFXGore()
{
return mod.GetGoreSlot("Gores/geotreeFX");
}

public override int DropWood()
{
int f = Main.rand.Next(0, 10);
if(f >= 0 && f <= 0)
{
return mod.ItemType("lootblock1blue");
}
else if(f >= 1 && f <= 1)
{
return mod.ItemType("lootblock2green");
}
else if(f >= 2 && f <= 2)
{
return mod.ItemType("lootblock3red");
}
else if(f >= 3 && f <= 3)
{
return mod.ItemType("lootblock4yellow");
}
else if(f >= 4 && f <= 4)
{
return mod.ItemType("lootblock5orange");
}
else if(f >= 5 && f <= 5)
{
return mod.ItemType("lootblock6purple");
}
else if(f >= 6 && f <= 6)
{
return mod.ItemType("lootblock7white");
}
else if(f >= 7 && f <= 7)
{
return mod.ItemType("lootblock8limegreen");
}
else if(f >= 8 && f <= 8)
{
return mod.ItemType("lootblock9gray");
}
else if(f >= 9 && f <= 9)
{
return mod.ItemType("lootblock910magenta");
}
else
{
return mod.ItemType("lootblock1blue");
}
}

public override Texture2D GetTexture()
{
int f = Main.rand.Next(0, 10);
if(f >= 0 && f <= 0)
{
return mod.GetTexture("Tiles/trees/loottree1");
}
else if(f >= 1 && f <= 1)
{
return mod.GetTexture("Tiles/trees/loottree2");
}
else if(f >= 2 && f <= 2)
{
return mod.GetTexture("Tiles/trees/loottree3");
}
else if(f >= 3 && f <= 3)
{
return mod.GetTexture("Tiles/trees/loottree4");
}
else if(f >= 4 && f <= 4)
{
return mod.GetTexture("Tiles/trees/loottree5");
}
else if(f >= 5 && f <= 5)
{
return mod.GetTexture("Tiles/trees/loottree6");
}
else if(f >= 6 && f <= 6)
{
return mod.GetTexture("Tiles/trees/loottree7");
}
else if(f >= 7 && f <= 7)
{
return mod.GetTexture("Tiles/trees/loottree8");
}
else if(f >= 8 && f <= 8)
{
return mod.GetTexture("Tiles/trees/loottree9");
}
else if(f >= 9 && f <= 9)
{
return mod.GetTexture("Tiles/trees/loottree910");
}
else
{
return mod.GetTexture("Tiles/trees/loottree1");
}
}

public override Texture2D GetTopTextures()
{
return mod.GetTexture("Tiles/trees/loottree_top");
}

public override Texture2D GetBranchTextures()
{
return mod.GetTexture("Tiles/trees/loottree_leaves");
}
}
}

again the way i use the numbers is just testing (f >= 9 && f <= 9)

i want it to just pick one number and stick with it per tree and not per tick
 
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;

namespace collectingcards.Tiles.trees
{
public class loottreerainbow : ModTree
{
private Mod mod
{
get
{
return ModLoader.GetMod("collectingcards");
}
}

public override int CreateDust()
{
return mod.DustType("lootspark1");
}

public override int GrowthFXGore()
{
return mod.GetGoreSlot("Gores/geotreeFX");
}

public override int DropWood()
{
int f = Main.rand.Next(0, 10);
if(f >= 0 && f <= 0)
{
return mod.ItemType("lootblock1blue");
}
else if(f >= 1 && f <= 1)
{
return mod.ItemType("lootblock2green");
}
else if(f >= 2 && f <= 2)
{
return mod.ItemType("lootblock3red");
}
else if(f >= 3 && f <= 3)
{
return mod.ItemType("lootblock4yellow");
}
else if(f >= 4 && f <= 4)
{
return mod.ItemType("lootblock5orange");
}
else if(f >= 5 && f <= 5)
{
return mod.ItemType("lootblock6purple");
}
else if(f >= 6 && f <= 6)
{
return mod.ItemType("lootblock7white");
}
else if(f >= 7 && f <= 7)
{
return mod.ItemType("lootblock8limegreen");
}
else if(f >= 8 && f <= 8)
{
return mod.ItemType("lootblock9gray");
}
else if(f >= 9 && f <= 9)
{
return mod.ItemType("lootblock910magenta");
}
else
{
return mod.ItemType("lootblock1blue");
}
}

public override Texture2D GetTexture()
{
int f = Main.rand.Next(0, 10);
if(f >= 0 && f <= 0)
{
return mod.GetTexture("Tiles/trees/loottree1");
}
else if(f >= 1 && f <= 1)
{
return mod.GetTexture("Tiles/trees/loottree2");
}
else if(f >= 2 && f <= 2)
{
return mod.GetTexture("Tiles/trees/loottree3");
}
else if(f >= 3 && f <= 3)
{
return mod.GetTexture("Tiles/trees/loottree4");
}
else if(f >= 4 && f <= 4)
{
return mod.GetTexture("Tiles/trees/loottree5");
}
else if(f >= 5 && f <= 5)
{
return mod.GetTexture("Tiles/trees/loottree6");
}
else if(f >= 6 && f <= 6)
{
return mod.GetTexture("Tiles/trees/loottree7");
}
else if(f >= 7 && f <= 7)
{
return mod.GetTexture("Tiles/trees/loottree8");
}
else if(f >= 8 && f <= 8)
{
return mod.GetTexture("Tiles/trees/loottree9");
}
else if(f >= 9 && f <= 9)
{
return mod.GetTexture("Tiles/trees/loottree910");
}
else
{
return mod.GetTexture("Tiles/trees/loottree1");
}
}

public override Texture2D GetTopTextures()
{
return mod.GetTexture("Tiles/trees/loottree_top");
}

public override Texture2D GetBranchTextures()
{
return mod.GetTexture("Tiles/trees/loottree_leaves");
}
}
}

again the way i use the numbers is just testing (f >= 9 && f <= 9)

i want it to just pick one number and stick with it per tree and not per tick
Okay, so first of all some coding conventions to help you keep your code organised:
  1. Be sure to use proper casing. Identifiers (names) of methods, classes and namespaces should be PascalCased (so you should call your class LootTreeRainbow and your namespace CollectingCards.Tiles.Trees). Identifiers for variables should be camelCased (so for instance isTree, damageValue or criticalChance). This helps a lot with the readability of your codes, and makes it easier to distinguish between methods, classes and variables.
  2. Use comment lines (// Like this). This will make it obvious to people reading your code what specific parts of your code to, and also go a long way to keep your code structured and understandable for yourself.
I've used your identifiers consistently as to avoid confusion (as you can't just rename something on a whim), but you should look into correcting them. I also left in the ">= =<" stuff.

This is what I've come up with. I don't know exactly how ModTree works (because it's missing from the depository), but if it works like I think it does then this will work. I didn't use my IDE for this, so there could be errors, but those should be fairly straightforward to fix.
Code:
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;

namespace collectingcards.Tiles.trees
{
    public class loottreerainbow : ModTree
    {
   
        int type;
       
        public loottreerainbow()
        {
            type = Main.rand.Next(0,10);
        }
       
        private Mod mod
        {
            get    { return ModLoader.GetMod("collectingcards"); }
        }

        public override int CreateDust()
        {
        return mod.DustType("lootspark1");
        }

        public override int GrowthFXGore()
        {
        return mod.GetGoreSlot("Gores/geotreeFX");
        }

        public override int DropWood()
        {
            if(type >= 0 && type <= 0)
            {
                return mod.ItemType("lootblock1blue");
            }
            else if(type >= 1 && type <= 1)
            {
                return mod.ItemType("lootblock2green");
            }
            else if(type >= 2 && type <= 2)
            {
                return mod.ItemType("lootblock3red");
            }
            else if(type >= 3 && type <= 3)
            {
                return mod.ItemType("lootblock4yellow");
            }
            else if(type >= 4 && type <= 4)
            {
                return mod.ItemType("lootblock5orange");
            }
            else if(type >= 5 && type <= 5)
            {
                return mod.ItemType("lootblock6purple");
            }
            else if(type >= 6 && type <= 6)
            {
                return mod.ItemType("lootblock7white");
            }
            else if(type >= 7 && type <= 7)
            {
                return mod.ItemType("lootblock8limegreen");
            }
            else if(type >= 8 && type <= 8)
            {
                return mod.ItemType("lootblock9gray");
            }
            else if(type >= 9 && type <= 9)
            {
                return mod.ItemType("lootblock910magenta");
            }
            else
            {
                return mod.ItemType("lootblock1blue");
            }
        }

        public override Texture2D GetTexture()
        {
            if(type >= 0 && type <= 0)
            {
                return mod.GetTexture("Tiles/trees/loottree1");
            }
            else if(type >= 1 && type <= 1)
            {
                return mod.GetTexture("Tiles/trees/loottree2");
            }
            else if(type >= 2 && type <= 2)
            {
                return mod.GetTexture("Tiles/trees/loottree3");
            }
            else if(type >= 3 && type <= 3)
            {
                return mod.GetTexture("Tiles/trees/loottree4");
            }
            else if(type >= 4 && type <= 4)
            {
                return mod.GetTexture("Tiles/trees/loottree5");
            }
            else if(type >= 5 && type <= 5)
            {
                return mod.GetTexture("Tiles/trees/loottree6");
            }
            else if(type >= 6 && type <= 6)
            {
                return mod.GetTexture("Tiles/trees/loottree7");
            }
            else if(type >= 7 && type <= 7)
            {
                return mod.GetTexture("Tiles/trees/loottree8");
            }
            else if(type >= 8 && type <= 8)
            {
                return mod.GetTexture("Tiles/trees/loottree9");
            }
            else if(type >= 9 && type <= 9)
            {
                return mod.GetTexture("Tiles/trees/loottree910");
            }
            else
            {
                return mod.GetTexture("Tiles/trees/loottree1");
            }
        }

        public override Texture2D GetTopTextures()
        {
            return mod.GetTexture("Tiles/trees/loottree_top");
        }

        public override Texture2D GetBranchTextures()
        {
            return mod.GetTexture("Tiles/trees/loottree_leaves");
        }
    }
}
 
Okay, so first of all some coding conventions to help you keep your code organised:
  1. Be sure to use proper casing. Identifiers (names) of methods, classes and namespaces should be PascalCased (so you should call your class LootTreeRainbow and your namespace CollectingCards.Tiles.Trees). Identifiers for variables should be camelCased (so for instance isTree, damageValue or criticalChance). This helps a lot with the readability of your codes, and makes it easier to distinguish between methods, classes and variables.
  2. Use comment lines (// Like this). This will make it obvious to people reading your code what specific parts of your code to, and also go a long way to keep your code structured and understandable for yourself.
I've used your identifiers consistently as to avoid confusion (as you can't just rename something on a whim), but you should look into correcting them. I also left in the ">= =<" stuff.

This is what I've come up with. I don't know exactly how ModTree works (because it's missing from the depository), but if it works like I think it does then this will work. I didn't use my IDE for this, so there could be errors, but those should be fairly straightforward to fix.
Code:
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;

namespace collectingcards.Tiles.trees
{
    public class loottreerainbow : ModTree
    {
  
        int type;
      
        public loottreerainbow()
        {
            type = Main.rand.Next(0,10);
        }
      
        private Mod mod
        {
            get    { return ModLoader.GetMod("collectingcards"); }
        }

        public override int CreateDust()
        {
        return mod.DustType("lootspark1");
        }

        public override int GrowthFXGore()
        {
        return mod.GetGoreSlot("Gores/geotreeFX");
        }

        public override int DropWood()
        {
            if(type >= 0 && type <= 0)
            {
                return mod.ItemType("lootblock1blue");
            }
            else if(type >= 1 && type <= 1)
            {
                return mod.ItemType("lootblock2green");
            }
            else if(type >= 2 && type <= 2)
            {
                return mod.ItemType("lootblock3red");
            }
            else if(type >= 3 && type <= 3)
            {
                return mod.ItemType("lootblock4yellow");
            }
            else if(type >= 4 && type <= 4)
            {
                return mod.ItemType("lootblock5orange");
            }
            else if(type >= 5 && type <= 5)
            {
                return mod.ItemType("lootblock6purple");
            }
            else if(type >= 6 && type <= 6)
            {
                return mod.ItemType("lootblock7white");
            }
            else if(type >= 7 && type <= 7)
            {
                return mod.ItemType("lootblock8limegreen");
            }
            else if(type >= 8 && type <= 8)
            {
                return mod.ItemType("lootblock9gray");
            }
            else if(type >= 9 && type <= 9)
            {
                return mod.ItemType("lootblock910magenta");
            }
            else
            {
                return mod.ItemType("lootblock1blue");
            }
        }

        public override Texture2D GetTexture()
        {
            if(type >= 0 && type <= 0)
            {
                return mod.GetTexture("Tiles/trees/loottree1");
            }
            else if(type >= 1 && type <= 1)
            {
                return mod.GetTexture("Tiles/trees/loottree2");
            }
            else if(type >= 2 && type <= 2)
            {
                return mod.GetTexture("Tiles/trees/loottree3");
            }
            else if(type >= 3 && type <= 3)
            {
                return mod.GetTexture("Tiles/trees/loottree4");
            }
            else if(type >= 4 && type <= 4)
            {
                return mod.GetTexture("Tiles/trees/loottree5");
            }
            else if(type >= 5 && type <= 5)
            {
                return mod.GetTexture("Tiles/trees/loottree6");
            }
            else if(type >= 6 && type <= 6)
            {
                return mod.GetTexture("Tiles/trees/loottree7");
            }
            else if(type >= 7 && type <= 7)
            {
                return mod.GetTexture("Tiles/trees/loottree8");
            }
            else if(type >= 8 && type <= 8)
            {
                return mod.GetTexture("Tiles/trees/loottree9");
            }
            else if(type >= 9 && type <= 9)
            {
                return mod.GetTexture("Tiles/trees/loottree910");
            }
            else
            {
                return mod.GetTexture("Tiles/trees/loottree1");
            }
        }

        public override Texture2D GetTopTextures()
        {
            return mod.GetTexture("Tiles/trees/loottree_top");
        }

        public override Texture2D GetBranchTextures()
        {
            return mod.GetTexture("Tiles/trees/loottree_leaves");
        }
    }
}


so yeah it did work kinda it pick 2 so it made the trees grow red but only red

bandicam 2016-10-14 16-45-39-588.jpg


i also added some text to the sapling code to show the 2 numbers it picks when growing the tree

i do say i dont get those at all here they are


public override void RandomUpdate(int i, int j)
{
if (WorldGen.genRand.Next(1) == 0) // this was 3 but 1 wont make it grow instant (its faster tho)
{
bool isPlayerNear = WorldGen.PlayerLOS(i, j);
bool success = WorldGen.GrowTree(i, j);
Main.NewText(string.Format("i={0} j={1}",i,j),15,155,155); // so i added this line
if (success && isPlayerNear)
{
WorldGen.TreeGrowFXCheck(i, j);
}
}
}

i do use // in some but as i mostly use the codes
dont show to anyone more then whats just needed

also the thing where u want name change well that is not as simple as with most mods
asdasdad.png
 
when ever the number is updated per reload of the world all the trees recolor to new number

as the textures update per tick still
 
So I just updated to terraria 1.3.3 and I wanted to update my mods as well, but when I tried updating the tModLoader and followed the new directions, when I tried to run the resulting applications from the patch.bat, they wouldn't run because my terraria said they weren't a valid Win32 Application. Could anyone help me with this issue?
 
v0.8.3.5
-Updated to Terraria 1.3.3.3
-Added mod packs - ability to enable/disable groups of mods at once
-Added ability to search mod browser by author
-Added ModifyInterfaceLayers hook
-DrawLayers can now modify the DrawInfo parameter
-Added whoAmI parameter to world-drawing hooks for items
-Made Main._drawInterfaceGameTime public
-Fixed bug where custom tile kill check uses liquid placement check
-Added modpath option for dedicated server command line
-Minor fixes and improvements

Note that if you're using the PreDrawInWorld or PostDrawInWorld hook for ModItem or GlobalItem, you will have to update your mod.

Enjoy!

Edit: Also, I'm trying something new with this update. Downloads are hosted through Github instead of Mediafire. Hopefully this circumvents some problems with Mediafire some people have; also hopefully no new problems get created.
thnks for your hardwork man , appreciate its
 
Time to wait for 1.3.3.3 GoG Update
Maybe I'm going to buy this game (again) on Steam. =T
 
While mining down in the snow biome with tmodloader v0.8.3.5 on terraria 1.3.3.3...with the mods "thorium" "tremor" "summoner's association" "pumpkings mod" "imksushi more recipes mod", This happened. http://images.akamai.steamuserconte...085/8D39BDFEACD60B29C32BE8857DC0E50192A0F2B4/
Looks normal, right? then when I moved lower..this happened. http://images.akamai.steamuserconte...270/D42F9C86672FE8913F0F661A4DB2A1D8153376A0/
I'm standing in "water" moving at normal speed and not drowning at all. :eek:
After reloading the world and coming back, everything seemed to be back to normal
http://images.akamai.steamuserconte...338/981CB0C9D2D63A77B9D8DD89BD2508FFB72735EA/
Sorry for not using the {IMG] feature, but I didn't want to clog up the page with a super tall post :3...Oh and I have windows 10.
 
Last edited:
I am a bit confused about updating hooks. I seem to have revised the pertinent code, but even after doing that I still get a "This mod uses an old GlobalItem.PreDrawInWorld hook" error. What am I missing here? I tried updating someone else's mod for practice and I couldn't get it to work, but upon extracting and rebuilding their officially updated version it worked fine. I compared the files and every character in every file was the same between my attempt and their release.
 
I am a bit confused about updating hooks. I seem to have revised the pertinent code, but even after doing that I still get a "This mod uses an old GlobalItem.PreDrawInWorld hook" error. What am I missing here? I tried updating someone else's mod for practice and I couldn't get it to work, but upon extracting and rebuilding their officially updated version it worked fine. I compared the files and every character in every file was the same between my attempt and their release.
The only difference is there is an additional int parameter. You sure you added it in?

https://github.com/bluemagic123/tMo...ref-float-rotation-ref-float-scale-int-whoami
 
Yep. Heck, I even tried entirely removing the hook and it still gave me that error.
In your globalitem? I'd check the whole mod for other instances of that. If you are sure it's the globalitem at fault, you can post the whole globalitem and we can look.
 
So I just updated to terraria 1.3.3 and I wanted to update my mods as well, but when I tried updating the tModLoader and followed the new directions, when I tried to run the resulting applications from the patch.bat, they wouldn't run because my terraria said they weren't a valid Win32 Application. Could anyone help me with this issue?

If you meant you tried updating to Terraria 1.3.3.3 and TML didn't work, that is because I haven't yet released the GOG patches for Terraria 1.3.3.3 and TML 0.8.3.5. I should have the patches out by Monday.

Time to wait for 1.3.3.3 GoG Update
Maybe I'm going to buy this game (again) on Steam. =T

I'll have a bunch of free time on Saturday or Sunday, so should have it out by Monday at the latest.
 
index.php
all the mods have a whithe backround on items pls fix
?
 
Huh. I need to play bullet impact sound when projectile collides tile, but it plays different sound. I know how to use styles, but it doesn't seem to work right way.
I don't know how code could help, but here it is:
Code:
Main.PlaySound(10, projectile.position, Style: 2);
 
@superhc I get that allot, it's just lag.
All you need to do is update a block[i.e. break a block beside the water or place a block] and it'll return back to normal.

-=EDIT=-
Well trying to see if the mods I use are updated and the mod browser caused my game to not respond.
Well I guess it's getting tons of traffic or something borked on it's end.
 
Last edited:
In your globalitem? I'd check the whole mod for other instances of that. If you are sure it's the globalitem at fault, you can post the whole globalitem and we can look.
Still no luck, so here are copies of the original file, my modified file, and the official update as well as copies of each respective project.
 

Attachments

Back
Top Bottom