tModLoader Need help with modding a plant

Geminous

Skeletron Prime
So I was working on a mod focused entirely around food, and everything was going fine until I tried making a plant that grows but is 2 blocks tall instead of 1.
No matter what I change, some weird issue happens and it never really works.
Here's the code:

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.Enums;

namespace WorldofTaste.Tiles
{
public class WheatStalk : ModTile
{
public override void SetDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileCut[Type] = false;
Main.tileNoFail[Type] = true;
Main.tileLavaDeath[Type] = true;
Main.tileNoAttach[Type] = true;
TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2);
dustType = 32;
disableSmartCursor = true;
AddMapEntry(new Color(200, 200, 150));
TileObjectData.newTile.Width = 1;
TileObjectData.newTile.Height = 2;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.StyleHorizontal = false;
TileObjectData.addBaseTile(out TileObjectData.StyleAlch);
TileObjectData.newTile.CopyFrom(TileObjectData.StyleAlch);
TileObjectData.newTile.DrawYOffset = -18;
TileObjectData.newTile.CoordinateHeights = new int[]
{
20
};
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.AnchorValidTiles = new int[]
{
2, //TileID.Grass
};
TileObjectData.newTile.AnchorAlternateTiles = new int[]
{
78, //ClayPot
TileID.PlanterBox
};
TileObjectData.addTile(Type);
drop = mod.ItemType("WheatSeeds");
}
public override void SetSpriteEffects(int i, int j, ref SpriteEffects spriteEffects)
{
if (i % 2 == 1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
}

public override bool Drop(int i, int j)
{
int stage = Main.tile[i, j].frameX / 18;
if (stage == 2)
{
Item.NewItem(i * 16, j * 16, 0, 0, mod.ItemType<Items.Misc.Wheat>());
Item.NewItem(i * 16, j * 16, 0, 0, mod.ItemType<Items.Placeable.WheatSeeds>());
}
Item.NewItem(i * 16, j * 16, 0, 0, mod.ItemType<Items.Placeable.WheatSeeds>());
return false;
}

public override void RandomUpdate(int i, int j)
{
if (Main.tile[i, j].frameX == 0)
{
Main.tile[i, j].frameX += 18;
}
else if (Main.tile[i, j].frameX == 18)
{
Main.tile[i, j].frameX += 18;
}
}
}
}

Any help is appreciated, thanks for your time
 
Back
Top Bottom