using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace SoulHarvest.Items;
public class Soul : ModItem
{
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 1;
}
public override void SetDefaults()
{
Item.width = 20;
Item.height = 20;
Item.maxStack = Item.CommonMaxStack;
Item.value = Item.buyPrice(gold: 1);
Item.rare = ItemRarityID.Master;
}
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
{
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
float drawScale = 38f / Math.Max(texture.Width, texture.Height) * scale;
Vector2 position = Item.Center - Main.screenPosition;
spriteBatch.Draw(texture, position, null, lightColor, rotation,
texture.Size() * 0.5f, drawScale, SpriteEffects.None, 0f);
return false;
}
}
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace SoulHarvest.Items;
public class Soul : ModItem
{
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 1;
}
public override void SetDefaults()
{
Item.width = 20;
Item.height = 20;
Item.maxStack = Item.CommonMaxStack;
Item.value = Item.buyPrice(gold: 1);
Item.rare = ItemRarityID.Master;
}
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
{
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
float drawScale = 38f / Math.Max(texture.Width, texture.Height) * scale;
Vector2 position = Item.Center - Main.screenPosition;
spriteBatch.Draw(texture, position, null, lightColor, rotation,
texture.Size() * 0.5f, drawScale, SpriteEffects.None, 0f);
return false;
}
}