Standalone [1.3] tModLoader - A Modding API

I don't know if this is where I should bring this up for assistance but every time I try to install this on my mac it always downloads .exe files.
I've tried everything. If anybody could give some advice that would be great!
 
@Solo-Ion now it gives me this error:
Die beste Übereinstimmung für die überladene 'Terraria.NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int)'-Methode hat einige ungültige Argumente.

and with google translator in english:
The best match for the overloaded 'Terraria.NetMessage.SendData (int, int, int, terraria.Localization.NetworkText, int, float, float, float, int, int, int)' method has some invalid arguments.


EDIT: It also tells me to replace the old lang array system: Lang arrays have been replaced with the new Language.GetText system. What should I put there instead
That's odd. If you have null after your third comma, you shouldn't have any problems with Language.GetText. You only need something there if you are sending text over the message. Can I see the code that's causing the error?
 
That's odd. If you have null after your third comma, you shouldn't have any problems with Language.GetText. You only need something there if you are sending text over the message. Can I see the code that's causing the error?
Like I said, this mod isn't actually from me but I'm triying to update it.
And I don't understand everythin in this code.
But here's the code for one file(the error happens in all tile files, because they are simmilar):
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Itemtronics.Util;

namespace Itemtronics.Tiles
{
public class AutomaticChest : ModTile
{
public override void SetDefaults()
{
Main.tileSpelunker[Type] = true;
Main.tileContainer[Type] = true;
Main.tileShine2[Type] = true;
Main.tileShine[Type] = 1200;
Main.tileFrameImportant[Type] = true;
Main.tileNoAttach[Type] = true;
Main.tileValue[Type] = 5000;
Main.tileLavaDeath[Type] = false;
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
TileObjectData.newTile.Origin = new Point16(0, 1);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 };
TileObjectData.newTile.HookCheck = new PlacementHook(Chest.FindEmptyChest, -1, 0, true);
TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(Chest.AfterPlacement_Hook, -1, 0, false);
TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 };
TileObjectData.newTile.StyleHorizontal = true;
TileObjectData.newTile.LavaDeath = false;
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
TileObjectData.addTile(Type);
//AddMapEntry(new Color(200, 200, 200), "Automatic Chest", MapChestName);
ModTranslation name = CreateMapEntryName();
name.SetDefault("Automatic Chest");
AddMapEntry(new Color(200, 200, 200),name);
dustType = mod.DustType("Sparkle");
disableSmartCursor = true;
adjTiles = new int[] { TileID.Containers };
chest = "Automatic Chest";
chestDrop = mod.ItemType("AutomaticChest");
}

public override void HitWire(int x, int y)
{
int chestID = ChestUtils.GetChestID(x, y);
int ownerID = Main.netMode == 2 ? Chest.UsingChest(chestID) : -1;
Chest chest = Main.chest[chestID];

Wiring.SkipWire(chest.x, chest.y);
Wiring.SkipWire(chest.x+1, chest.y);
Wiring.SkipWire(chest.x, chest.y+1);
Wiring.SkipWire(chest.x+1, chest.y+1);

for (int i = 0; i < 400; ++i)
{
if (Main.item.type != 0 && !ItemID.Sets.NebulaPickup[Main.item.type] && Main.item.type != 58 && Main.item.type != 184 && Main.item.type != 1867 && Main.item.type != 1868 && Main.item.type != 1734 && Main.item.type != 1735 && new Rectangle(chest.x * 16, chest.y * 16, 32, 32).Intersects(new Rectangle((int)Main.item.position.X, (int)Main.item.position.Y, Main.item.width, Main.item.height)))
{
ItemState state = ChestUtils.DepositItem(chestID, ownerID, chest.item, Main.item);

if (state != ItemState.SAME)
{
if (state == ItemState.EMPTY)
{
Main.item = new Item();
//Main.item.SetDefaults(0, false);
}
if (Main.netMode == 2)
{
NetMessage.SendData(21, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
}
}
}
}
}

public string MapChestName(string name, int i, int j)
{
string chestName = ChestUtils.GetChest(i, j).name;
if (chestName == "")
{
return name;
}
else
{
return name + ": " + chestName;
}
}

public override void NumDust(int i, int j, bool fail, ref int num)
{
num = 1;
}

public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
Item.NewItem(i * 16, j * 16, 32, 32, chestDrop);
Chest.DestroyChest(i, j);
}

public override void RightClick(int i, int j)
{
Player player = Main.player[Main.myPlayer];
Tile tile = Main.tile[i, j];
Main.mouseRightRelease = false;
int left = i;
int top = j;
if (tile.frameX != 0)
{
left--;
}
if (tile.frameY != 0)
{
top--;
}

if (player.sign >= 0)
{
Main.PlaySound(11, -1, -1, 1);
player.sign = -1;
Main.editSign = false;
Main.npcChatText = "";
}
if (Main.editChest)
{
Main.PlaySound(12, -1, -1, 1);
Main.editChest = false;
Main.npcChatText = "";
}
if (player.editedChestName)
{
NetMessage.SendData(33, -1, -1, Main.chest[player.chest].name, player.chest, 1f, 0f, 0f, 0, 0, 0);
player.editedChestName = false;
}
if (Main.netMode == 1)
{
if (left == player.chestX && top == player.chestY && player.chest >= 0)
{
player.chest = -1;
Recipe.FindRecipes();
Main.PlaySound(11, -1, -1, 1);
}
else
{
NetMessage.SendData(31, -1, -1, "", left, (float)top, 0f, 0f, 0, 0, 0);
Main.stackSplit = 600;
}
}
else
{
int chest = Chest.FindChest(left, top);
if (chest >= 0)
{
Main.stackSplit = 600;
if (chest == player.chest)
{
player.chest = -1;
Main.PlaySound(11, -1, -1, 1);
}
else
{
player.chest = chest;
Main.playerInventory = true;
Main.recBigList = false;
player.chestX = left;
player.chestY = top;
Main.PlaySound(player.chest < 0 ? 10 : 12, -1, -1, 1);
}
Recipe.FindRecipes();
}
}
}

public override void MouseOver(int i, int j)
{
Player player = Main.player[Main.myPlayer];
Chest chest = ChestUtils.GetChestSafe(i, j);
player.showItemIcon2 = -1;
if (chest == null)
{
player.showItemIconText = Lang.chestType[0];
}
else
{
player.showItemIconText = chest.name.Length > 0 ? chest.name : "Automatic Chest";
if (player.showItemIconText == "Automatic Chest")
{
player.showItemIcon2 = mod.ItemType("AutomaticChest");
player.showItemIconText = "";
}
}
player.noThrow = 2;
player.showItemIcon = true;
}

public override void MouseOverFar(int i, int j)
{
MouseOver(i, j);
Player player = Main.player[Main.myPlayer];
if (player.showItemIconText == "")
{
player.showItemIcon = false;
player.showItemIcon2 = 0;
}
}
}
}
 
I said something about this a while ago and I was hoping that updating would fix it, but that was not the case. My mod browser is not working. Opening or reloading it gives this error:
Sequence contains more than one matching element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Terraria.ModLoader.UI.UIModBrowser.PopulateFromJSON(TmodFile[] installedMods, String json)

This means I have to manually download and update any mods I want to use, which tends to be annoying when a download is not given or updated.
 
I seem to have this problem when i try to load up the Mod Download Page in Terraria.---->

Sequence contains more than one matching element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Terraria.ModLoader.UI.UIModBrowser.PopulateFromJSON(TmodFile[] installedMods, String json)
 
hello I get an error when trying to install the new version when I try to run it this pops up Unable to find an entry point named "init" in DLL 'CSteamworks' plz help
 
did someone managed to run tModLoader server in a linux machine? tried to run the tModLoadServer.exe on mono and tried to run the tModLoaderServer.bin.x86_64, both returning errors.
 
A bit late maybe, but why doesn't tModLoader accept these lines:
Code:
item.name = "NameOfItem";
item.toolTip = "ItemDescription";
Here's the error I get:
c:\Users\Joshua\Documents\My Games\Terraria\ModLoader\Mod Sources\JoshuasMod\Items\Weapons\CosmicCataclysm\CosmicCataclysm.cs(14,9) : error CS1061: 'Terraria.Item' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Joshua\Documents\My Games\Terraria\ModLoader\Mod Sources\JoshuasMod\Items\Weapons\CosmicCataclysm\CosmicCataclysm.cs(20,9) : error CS1061: 'Terraria.Item' does not contain a definition for 'toolTip' and no extension method 'toolTip' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)
They worked (For me at least) in the 0.9.2.3 version, but they don't in the 0.10.0.1 version, did the TML Team change it?
 
Like I said, this mod isn't actually from me but I'm triying to update it.
And I don't understand everythin in this code.
But here's the code for one file(the error happens in all tile files, because they are simmilar):
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Itemtronics.Util;

namespace Itemtronics.Tiles
{
public class AutomaticChest : ModTile
{
public override void SetDefaults()
{
Main.tileSpelunker[Type] = true;
Main.tileContainer[Type] = true;
Main.tileShine2[Type] = true;
Main.tileShine[Type] = 1200;
Main.tileFrameImportant[Type] = true;
Main.tileNoAttach[Type] = true;
Main.tileValue[Type] = 5000;
Main.tileLavaDeath[Type] = false;
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
TileObjectData.newTile.Origin = new Point16(0, 1);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 };
TileObjectData.newTile.HookCheck = new PlacementHook(Chest.FindEmptyChest, -1, 0, true);
TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(Chest.AfterPlacement_Hook, -1, 0, false);
TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 };
TileObjectData.newTile.StyleHorizontal = true;
TileObjectData.newTile.LavaDeath = false;
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
TileObjectData.addTile(Type);
//AddMapEntry(new Color(200, 200, 200), "Automatic Chest", MapChestName);
ModTranslation name = CreateMapEntryName();
name.SetDefault("Automatic Chest");
AddMapEntry(new Color(200, 200, 200),name);
dustType = mod.DustType("Sparkle");
disableSmartCursor = true;
adjTiles = new int[] { TileID.Containers };
chest = "Automatic Chest";
chestDrop = mod.ItemType("AutomaticChest");
}

public override void HitWire(int x, int y)
{
int chestID = ChestUtils.GetChestID(x, y);
int ownerID = Main.netMode == 2 ? Chest.UsingChest(chestID) : -1;
Chest chest = Main.chest[chestID];

Wiring.SkipWire(chest.x, chest.y);
Wiring.SkipWire(chest.x+1, chest.y);
Wiring.SkipWire(chest.x, chest.y+1);
Wiring.SkipWire(chest.x+1, chest.y+1);

for (int i = 0; i < 400; ++i)
{
if (Main.item.type != 0 && !ItemID.Sets.NebulaPickup[Main.item.type] && Main.item.type != 58 && Main.item.type != 184 && Main.item.type != 1867 && Main.item.type != 1868 && Main.item.type != 1734 && Main.item.type != 1735 && new Rectangle(chest.x * 16, chest.y * 16, 32, 32).Intersects(new Rectangle((int)Main.item.position.X, (int)Main.item.position.Y, Main.item.width, Main.item.height)))
{
ItemState state = ChestUtils.DepositItem(chestID, ownerID, chest.item, Main.item);

if (state != ItemState.SAME)
{
if (state == ItemState.EMPTY)
{
Main.item = new Item();
//Main.item.SetDefaults(0, false);
}
if (Main.netMode == 2)
{
NetMessage.SendData(21, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
}
}
}
}
}

public string MapChestName(string name, int i, int j)
{
string chestName = ChestUtils.GetChest(i, j).name;
if (chestName == "")
{
return name;
}
else
{
return name + ": " + chestName;
}
}

public override void NumDust(int i, int j, bool fail, ref int num)
{
num = 1;
}

public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
Item.NewItem(i * 16, j * 16, 32, 32, chestDrop);
Chest.DestroyChest(i, j);
}

public override void RightClick(int i, int j)
{
Player player = Main.player[Main.myPlayer];
Tile tile = Main.tile[i, j];
Main.mouseRightRelease = false;
int left = i;
int top = j;
if (tile.frameX != 0)
{
left--;
}
if (tile.frameY != 0)
{
top--;
}

if (player.sign >= 0)
{
Main.PlaySound(11, -1, -1, 1);
player.sign = -1;
Main.editSign = false;
Main.npcChatText = "";
}
if (Main.editChest)
{
Main.PlaySound(12, -1, -1, 1);
Main.editChest = false;
Main.npcChatText = "";
}
if (player.editedChestName)
{
NetMessage.SendData(33, -1, -1, Main.chest[player.chest].name, player.chest, 1f, 0f, 0f, 0, 0, 0);
player.editedChestName = false;
}
if (Main.netMode == 1)
{
if (left == player.chestX && top == player.chestY && player.chest >= 0)
{
player.chest = -1;
Recipe.FindRecipes();
Main.PlaySound(11, -1, -1, 1);
}
else
{
NetMessage.SendData(31, -1, -1, "", left, (float)top, 0f, 0f, 0, 0, 0);
Main.stackSplit = 600;
}
}
else
{
int chest = Chest.FindChest(left, top);
if (chest >= 0)
{
Main.stackSplit = 600;
if (chest == player.chest)
{
player.chest = -1;
Main.PlaySound(11, -1, -1, 1);
}
else
{
player.chest = chest;
Main.playerInventory = true;
Main.recBigList = false;
player.chestX = left;
player.chestY = top;
Main.PlaySound(player.chest < 0 ? 10 : 12, -1, -1, 1);
}
Recipe.FindRecipes();
}
}
}

public override void MouseOver(int i, int j)
{
Player player = Main.player[Main.myPlayer];
Chest chest = ChestUtils.GetChestSafe(i, j);
player.showItemIcon2 = -1;
if (chest == null)
{
player.showItemIconText = Lang.chestType[0];
}
else
{
player.showItemIconText = chest.name.Length > 0 ? chest.name : "Automatic Chest";
if (player.showItemIconText == "Automatic Chest")
{
player.showItemIcon2 = mod.ItemType("AutomaticChest");
player.showItemIconText = "";
}
}
player.noThrow = 2;
player.showItemIcon = true;
}

public override void MouseOverFar(int i, int j)
{
MouseOver(i, j);
Player player = Main.player[Main.myPlayer];
if (player.showItemIconText == "")
{
player.showItemIcon = false;
player.showItemIcon2 = 0;
}
}
}
}
Looking through that code, I can see that you corrected this line,
Code:
NetMessage.SendData(21, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
but not this one,
Code:
NetMessage.SendData(31, -1, -1, "", left, (float)top, 0f, 0f, 0, 0, 0);
You need to replace "" with null in all NetMessages... unless you actually want to sent some text in the message. I don't know how this is done, but thankfully BlushieMagic has updated the Migration Guide with that info.

hello I get an error when trying to install the new version when I try to run it this pops up Unable to find an entry point named "init" in DLL 'CSteamworks' plz help
Sounds like you need to verify Terraria's game cache through Steam.

A bit late maybe, but why doesn't tModLoader accept these lines:
Code:
item.name = "NameOfItem";
item.toolTip = "ItemDescription";
Here's the error I get:
c:\Users\Joshua\Documents\My Games\Terraria\ModLoader\Mod Sources\JoshuasMod\Items\Weapons\CosmicCataclysm\CosmicCataclysm.cs(14,9) : error CS1061: 'Terraria.Item' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Joshua\Documents\My Games\Terraria\ModLoader\Mod Sources\JoshuasMod\Items\Weapons\CosmicCataclysm\CosmicCataclysm.cs(20,9) : error CS1061: 'Terraria.Item' does not contain a definition for 'toolTip' and no extension method 'toolTip' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)
They worked (For me at least) in the 0.9.2.3 version, but they don't in the 0.10.0.1 version, did the TML Team change it?
Yes, check the Example Mod for the new way to do toolTips and other things. Also have a look at the Migration Guide for a complete list of things that changed.
 
Looking through that code, I can see that you corrected this line,
Code:
NetMessage.SendData(21, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
but not this one,
Code:
NetMessage.SendData(31, -1, -1, "", left, (float)top, 0f, 0f, 0, 0, 0);
You need to replace "" with null in all NetMessages... unless you actually want to sent some text in the message. I don't know how this is done, but thankfully BlushieMagic has updated the Migration Guide with that info.


Sounds like you need to verify Terraria's game cache through Steam.


Yes, check the Example Mod for the new way to do toolTips and other things. Also have a look at the Migration Guide for a complete list of things that changed.
Thank you! :D Btw, is there any guides on here about making and applying Debuffs to NPCs?
Edit: I meant Custom Debuffs, my bad.
 
Looking through that code, I can see that you corrected this line,
Code:
NetMessage.SendData(21, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
but not this one,
Code:
NetMessage.SendData(31, -1, -1, "", left, (float)top, 0f, 0f, 0, 0, 0);
You need to replace "" with null in all NetMessages... unless you actually want to sent some text in the message. I don't know how this is done, but thankfully BlushieMagic has updated the Migration Guide with that info.


Sounds like you need to verify Terraria's game cache through Steam.


Yes, check the Example Mod for the new way to do toolTips and other things. Also have a look at the Migration Guide for a complete list of things that changed.

Thx, I changed it to null but I am getting other errors.:
Here's the Compile Errors.txt:
Code:
c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\AutomaticChest.cs(134,5) : error CS1502: Die beste Übereinstimmung für die überladene 'Terraria.NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int)'-Methode hat einige ungültige Argumente.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\AutomaticChest.cs(134,37) : error CS1503: Argument '4': Konvertierung von 'string' in 'Terraria.Localization.NetworkText' nicht möglich.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\AutomaticChest.cs(183,31) : warning CS0618: 'Terraria.Lang.chestType' ist veraltet: 'Lang arrays have been replaced with the new Language.GetText system.'

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\AutomaticChest.cs(183,31) : error CS0266: Der Typ 'Terraria.Localization.LocalizedText' kann nicht implizit in 'string' konvertiert werden. Es ist bereits eine explizite Konvertierung vorhanden. (Möglicherweise fehlt eine Umwandlung.)

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\EjectorChest.cs(128,5) : error CS1502: Die beste Übereinstimmung für die überladene 'Terraria.NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int)'-Methode hat einige ungültige Argumente.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\EjectorChest.cs(128,37) : error CS1503: Argument '4': Konvertierung von 'string' in 'Terraria.Localization.NetworkText' nicht möglich.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\EjectorChest.cs(177,31) : warning CS0618: 'Terraria.Lang.chestType' ist veraltet: 'Lang arrays have been replaced with the new Language.GetText system.'

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\EjectorChest.cs(177,31) : error CS0266: Der Typ 'Terraria.Localization.LocalizedText' kann nicht implizit in 'string' konvertiert werden. Es ist bereits eine explizite Konvertierung vorhanden. (Möglicherweise fehlt eine Umwandlung.)

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Util\ChestUtils.cs(63,7) : error CS1502: Die beste Übereinstimmung für die überladene 'Terraria.NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int)'-Methode hat einige ungültige Argumente.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Util\ChestUtils.cs(63,42) : error CS1503: Argument '4': Konvertierung von 'string' in 'Terraria.Localization.NetworkText' nicht möglich.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Util\ChestUtils.cs(82,7) : error CS1502: Die beste Übereinstimmung für die überladene 'Terraria.NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int)'-Methode hat einige ungültige Argumente.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Util\ChestUtils.cs(82,42) : error CS1503: Argument '4': Konvertierung von 'string' in 'Terraria.Localization.NetworkText' nicht möglich.

and you already have the code ot the Automatic Chest.cs,
so here are the other files:
Ejector Chest.cs:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Itemtronics.Util;

namespace Itemtronics.Tiles
{
    public class EjectorChest : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSpelunker[Type] = true;
            Main.tileContainer[Type] = true;
            Main.tileShine2[Type] = true;
            Main.tileShine[Type] = 1200;
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileValue[Type] = 5000;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
            TileObjectData.newTile.Origin = new Point16(0, 1);
            TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 };
            TileObjectData.newTile.HookCheck = new PlacementHook(Chest.FindEmptyChest, -1, 0, true);
            TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(Chest.AfterPlacement_Hook, -1, 0, false);
            TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 };
            TileObjectData.newTile.StyleHorizontal = true;
            TileObjectData.newTile.LavaDeath = false;
            TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
            TileObjectData.addTile(Type);
            //AddMapEntry(new Color(200, 200, 200), "Ejector Chest", MapChestName);
            ModTranslation name = CreateMapEntryName();
            name.SetDefault("Ejector Chest");
            AddMapEntry(new Color(200, 200, 200),name);
            dustType = mod.DustType("Sparkle");
            disableSmartCursor = true;
            adjTiles = new int[] { TileID.Containers };
            chest = "Ejector Chest";
            chestDrop = mod.ItemType("EjectorChest");
        }

        public override void HitWire(int x, int y)
        {
            int chestID = ChestUtils.GetChestID(x, y);
            int ownerID = Main.netMode == 2 ? Chest.UsingChest(chestID) : -1;
            Chest chest = Main.chest[chestID];

            Wiring.SkipWire(chest.x, chest.y);
            Wiring.SkipWire(chest.x+1, chest.y);
            Wiring.SkipWire(chest.x, chest.y+1);
            Wiring.SkipWire(chest.x+1, chest.y+1);

            for (int i = 0; i < chest.item.Length; ++i)
            {
                if (chest.item[i].type != 0)
                {
                    Item.NewItem(chest.x * 16, chest.y * 16, 32, 32, chest.item[i].type, chest.item[i].stack, false, chest.item[i].prefix);
                    chest.item[i].SetDefaults(0, true);

                    if (ownerID != -1)
                    {
                        NetMessage.SendData(32, ownerID, -1, null, chestID, i, 0f, 0f, 0, 0, 0);
                    }

                    break;
                }
            }
        }

        public string MapChestName(string name, int i, int j)
        {
            string chestName = ChestUtils.GetChest(i, j).name;
            if (chestName == "")
            {
                return name;
            }
            else
            {
                return name + ": " + chestName;
            }
        }

        public override void NumDust(int i, int j, bool fail, ref int num)
        {
            num = 1;
        }

        public override void KillMultiTile(int i, int j, int frameX, int frameY)
        {
            Item.NewItem(i * 16, j * 16, 32, 32, chestDrop);
            Chest.DestroyChest(i, j);
        }

        public override void RightClick(int i, int j)
        {
            Player player = Main.player[Main.myPlayer];
            Tile tile = Main.tile[i, j];
            Main.mouseRightRelease = false;
            int left = i;
            int top = j;
            if (tile.frameX != 0)
            {
                left--;
            }
            if (tile.frameY != 0)
            {
                top--;
            }

            if (player.sign >= 0)
            {
                Main.PlaySound(11, -1, -1, 1);
                player.sign = -1;
                Main.editSign = false;
                Main.npcChatText = "";
            }
            if (Main.editChest)
            {
                Main.PlaySound(12, -1, -1, 1);
                Main.editChest = false;
                Main.npcChatText = "";
            }
            if (player.editedChestName)
            {
                NetMessage.SendData(33, -1, -1, Main.chest[player.chest].name, player.chest, 1f, 0f, 0f, 0, 0, 0);
                player.editedChestName = false;
            }
            if (Main.netMode == 1)
            {
                if (left == player.chestX && top == player.chestY && player.chest >= 0)
                {
                    player.chest = -1;
                    Recipe.FindRecipes();
                    Main.PlaySound(11, -1, -1, 1);
                }
                else
                {
                    NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0);
                    Main.stackSplit = 600;
                }
            }
            else
            {
                int chest = Chest.FindChest(left, top);
                if (chest >= 0)
                {
                    Main.stackSplit = 600;
                    if (chest == player.chest)
                    {
                        player.chest = -1;
                        Main.PlaySound(11, -1, -1, 1);
                    }
                    else
                    {
                        player.chest = chest;
                        Main.playerInventory = true;
                        Main.recBigList = false;
                        player.chestX = left;
                        player.chestY = top;
                        Main.PlaySound(player.chest < 0 ? 10 : 12, -1, -1, 1);
                    }
                    Recipe.FindRecipes();
                }
            }
        }

        public override void MouseOver(int i, int j)
        {
            Player player = Main.player[Main.myPlayer];
            Chest chest = ChestUtils.GetChestSafe(i, j);
            player.showItemIcon2 = -1;
            if (chest == null)
            {
                player.showItemIconText = Lang.chestType[0];
            }
            else
            {
                player.showItemIconText = chest.name.Length > 0 ? chest.name : "Ejector Chest";
                if (player.showItemIconText == "Ejector Chest")
                {
                    player.showItemIcon2 = mod.ItemType("EjectorChest");
                    player.showItemIconText = "";
                }
            }
            player.noThrow = 2;
            player.showItemIcon = true;
        }

        public override void MouseOverFar(int i, int j)
        {
            MouseOver(i, j);
            Player player = Main.player[Main.myPlayer];
            if (player.showItemIconText == "")
            {
                player.showItemIcon = false;
                player.showItemIcon2 = 0;
            }
        }
    }
}

Item Translocator.cs:
Code:
using Itemtronics.Util;
using Terraria;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;

namespace Itemtronics.Tiles
{
    class ItemTranslocator : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSolid[Type] = true;
            Main.tileSolidTop[Type] = true;
            Main.tileFrameImportant[Type] = true;
            Main.tileLavaDeath[Type] = false;
            Main.tileValue[Type] = 1000;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1);
            TileObjectData.newTile.StyleHorizontal = true;
            TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0);
            TileObjectData.newTile.LavaDeath = false;
            TileObjectData.addTile(Type);
            //disableSmartCursor = true;
            drop = mod.ItemType("ItemTranslocator");
        }

        /*public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
        {
            Tile tile = Main.tile[i, j];
            tile.frameX = 36;
            //tile.frameY = 0;
            return true;
        }*/

        public override void RightClick(int i, int j)
        {
            Tile tile = Main.tile[i, j];
            tile.frameX = (short)((tile.frameX + 18) % 72);
        }

        public override void HitWire(int x, int y)
        {
            Tile tile = Main.tile[x, y];
            int ChestInID = ChestUtils.GetTargetChestID(x, y, tile.frameX / 18);
            int ChestOutID = ChestUtils.GetTargetChestID(x, y, (tile.frameX / 18 + 2) % 4);

            if (ChestInID != -1 && ChestOutID != -1)
            {
                Item[] ItemsIn = Main.chest[ChestInID].item;
                Item[] ItemsOut = Main.chest[ChestOutID].item;
                int OwnerInID = Main.netMode == 2 ? Chest.UsingChest(ChestInID) : -1;
                int OwnerOutID = Main.netMode == 2 ? Chest.UsingChest(ChestOutID) : -1;

                for (int i = 0; i < ItemsIn.Length; ++i)
                {
                    if (ItemsIn[i].type != 0)
                    {
                        ItemState state = ChestUtils.DepositItem(ChestOutID, OwnerOutID, ItemsOut, ItemsIn[i]);
                        if (state != ItemState.SAME)
                        {
                            if (state == ItemState.EMPTY)
                            {
                                ItemsIn[i] = new Item();
                            }
                            if (OwnerInID != -1)
                            {
                                NetMessage.SendData(32, OwnerInID, -1, null, ChestInID, i, 0f, 0f, 0, 0, 0);
                            }
                            break;
                        }
                    }
                }
            }
        }
    }
}

Chest Utils.cs:
Code:
using System;
using Terraria;
using Terraria.ObjectData;

namespace Itemtronics.Util
{
    internal enum ItemState
    {
        EMPTY,
        CHANGED,
        SAME
    }

    internal static class ChestUtils
    {
        public static readonly int[] xOffset = { 0, -1, 0, 1 };
        public static readonly int[] yOffset = { 1, 0, -1, 0 };

        public static Chest GetChest(int x, int y)
        {
            return Main.chest[GetChestID(x, y)];
        }

        public static Chest GetChestSafe(int x, int y)
        {
            int chest = GetChestID(x, y);
            return chest == -1 ? null : Main.chest[chest];
        }

        public static int GetChestID(int x, int y)
        {
            Tile tile = Main.tile[x, y];
            return Chest.FindChest(tile.frameX % 36 == 0 ? x : x - 1, tile.frameY == 0 ? y : y - 1);
        }

        //Should work for any size of chest, as long as chest location is upper right corner
        public static int GetVarSizeChestID(int x, int y)
        {
            Tile tile = Main.tile[x, y];
            TileObjectData tileData = TileObjectData.GetTileData(tile);
            return Chest.FindChest(x - tile.frameX / 18 % (tileData == null ? 1 : tileData.Width), y - tile.frameY / 18);
        }

        public static int GetTargetChestID(int x, int y, int dir)
        {
            return GetVarSizeChestID(x + xOffset[dir], y + yOffset[dir]);
        }

        public static ItemState DepositItem(int chest, int owner, Item[] items, Item item)
        {
            ItemState state = ItemState.SAME;
            for (int i = 0; i < items.Length; ++i)
            {
                if (item.IsTheSameAs(items[i]) && items[i].stack != items[i].maxStack)
                {
                    state = ItemState.CHANGED;

                    item.stack = items[i].stack - items[i].maxStack + item.stack;
                    items[i].stack = Math.Min(items[i].maxStack + item.stack, items[i].maxStack);

                    if (owner != -1)
                    {
                        NetMessage.SendData(32, owner, -1, "", chest, i, 0f, 0f, 0, 0, 0);
                    }

                    if (item.stack <= 0)
                    {
                        return ItemState.EMPTY;
                    }
                }
            }

            for (int i = 0; i < items.Length; ++i)
            {
                if (items[i].type == 0)
                {
                    items[i] = item;
                    //item.newAndShiny = true;

                    if (owner != -1)
                    {
                        NetMessage.SendData(32, owner, -1, "", chest, i, 0f, 0f, 0, 0, 0);
                    }

                    return ItemState.EMPTY;
                }
            }

            return state;
        }
    }
}
 
Looking through that code, I can see that you corrected this line,
Code:
NetMessage.SendData(21, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
but not this one,
Code:
NetMessage.SendData(31, -1, -1, "", left, (float)top, 0f, 0f, 0, 0, 0);
You need to replace "" with null in all NetMessages... unless you actually want to sent some text in the message. I don't know how this is done, but thankfully BlushieMagic has updated the Migration Guide with that info.


Sounds like you need to verify Terraria's game cache through Steam.


Yes, check the Example Mod for the new way to do toolTips and other things. Also have a look at the Migration Guide for a complete list of things that changed.

Hmm i just verifyed it but nothing happen.
 
I have a question, when you disable a mod through the modloader, is ti supposed to still have elements of the mod in game?

I ask as i recently got my terraria back, and I had long since gotten bored of it, due to beating it multiple times many updates ago. I decided to download some mods, I currently have teh Thorium mod active, Enabled, but there are items from the Tremor mod that show up as well, is this a problem with the modloader or the fact that i had the three mods running in caoncert? (Tremor, Torium, Calamity)
 
I did reload them, but it still ahppened. I will try again later and then edit this message.

There are no mobs or the like from the other mods, except for the item, living leaf, so far, and from what i have foucd that is for the Tremor mod, not Thorium which is currently enabled.
 
Living Leaf, an item you an get from the leaf blocks from living trees.

i even created a new world and character, jsut to use Thorium mod on, alone, so i am understandably confused as to why there are items, or one item at least, from disabled mods.
 
I get this error

http://prntscr.com/fq5t9e

Method not found: 'Void Terraria.Main.NewText(System.Object, Microsoft.Xna.Framework.Color, Boolean)'.
at MobUtils.MUPlayer.ProcessTriggers(TriggersSet triggersSet)
at Terraria.ModLoader.PlayerHooks.ProcessTriggers(Player player, TriggersSet triggersSet)
at Terraria.GameInput.TriggersSet.CopyInto(Player p)
at Terraria.Player.Update(Int32 i)
at Terraria.WorldGen.do_playWorldCallBack(Object threadContext)
at Terraria.WorldGen.playWorldCallBack(Object threadContext)

whenever i try joining my world

help please
 
Last edited:
I hope this is the right place to put this...
So I decided to start modding today, so I open Steam, and go on tModloader. I open it up and it tells me to select a language (which it never does), and then it shows the "Finding Mods" loading screen, and then a couple seconds later it just crashes. I opened up event viewer and found two errors. Here they are... (Also, I've used tModloader many times and this has NEVER happened.)
Faulting application name: ModdedT.exe, version: 1.3.5.1, time stamp: 0x5934ec95
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x1eab5c76
Faulting process id: 0xd98
Faulting application start time: 0x01d2f1e0eb55b452
Faulting application path: C:\Program Files (x86)\Steam\steamapps\common\Terraria\ModdedT.exe
Faulting module path: unknown
Report Id: 7ad6eb4b-5dd4-11e7-bf8b-ac220b0ddb05
Faulting package full name:
Faulting package-relative application ID:

Application: ModdedT.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
at Terraria.ModLoader.ModLoader.IsEnabled(Terraria.ModLoader.IO.TmodFile)
at System.Linq.Enumerable+WhereSelectArrayIterator`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Linq.Enumerable+WhereEnumerableIterator`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at Terraria.ModLoader.ModLoader.LoadMods()
at Terraria.ModLoader.ModLoader.do_Load(System.Object)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
 
Back
Top Bottom