CZ43
Terrarian
Hello, I am having problems with one of my mod items.
It shoots a projectile on Right Mouse button and behaves like a pickaxe on the left mouse button.
Using the left mouse button once you joined the world, you can mine blocks.
Using the right mouse button, you shoot a projectile.
But trying to use the left mouse button after using the right mouse button, it no longer works as a pickaxe and shoots projectiles, which it shouldn't.
It shoots a projectile on Right Mouse button and behaves like a pickaxe on the left mouse button.
Using the left mouse button once you joined the world, you can mine blocks.
Using the right mouse button, you shoot a projectile.
But trying to use the left mouse button after using the right mouse button, it no longer works as a pickaxe and shoots projectiles, which it shouldn't.
using Terraria.ID;
using Terraria;
using Terraria.ModLoader;
namespace WeaponsAndTools.Items.Tools
{
public class EnchantedPickaxe : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Enchanted Pickaxe");
Tooltip.SetDefault("Right Click to shoot a Beam");
}
public override void SetDefaults()
{
item.pick = 55;
item.useTurn = true;
item.damage = 8;
item.melee = true;
item.width = 34;
item.height = 34;
item.useTime = 50;
item.useAnimation = 21;
item.useStyle = 1;
item.knockBack = 3.0f;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}
public override bool AltFunctionUse(Player player)//You use this to allow the item to be right clicked
{
return true;
}
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2)//rightclick
{
item.damage = 5;
item.width = 20;
item.height = 20;
item.useTime = 50;
item.useAnimation = 50;
item.useStyle = 3;
item.knockBack = 3.0f;
item.UseSound = SoundID.Item4;
item.shoot = 173;
item.shootSpeed = 4.0f;
}
else //left click
{
item.pick = 55;
item.useTurn = true;
item.damage = 8;
item.melee = true;
item.width = 34;
item.height = 34;
item.useTime = 25;
item.useAnimation = 25;
item.useStyle = 1;
item.knockBack = 3.0f;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(mod, "EnchantedFragment", 8);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
recipe = new ModRecipe(mod);
recipe.AddIngredient(mod, "EnchantedPickaxe", 1);
recipe.AddTile(TileID.Furnaces);
recipe.SetResult(mod, "EnchantedFragment", 8);
recipe.AddRecipe();
}
}
}
using Terraria;
using Terraria.ModLoader;
namespace WeaponsAndTools.Items.Tools
{
public class EnchantedPickaxe : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Enchanted Pickaxe");
Tooltip.SetDefault("Right Click to shoot a Beam");
}
public override void SetDefaults()
{
item.pick = 55;
item.useTurn = true;
item.damage = 8;
item.melee = true;
item.width = 34;
item.height = 34;
item.useTime = 50;
item.useAnimation = 21;
item.useStyle = 1;
item.knockBack = 3.0f;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}
public override bool AltFunctionUse(Player player)//You use this to allow the item to be right clicked
{
return true;
}
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2)//rightclick
{
item.damage = 5;
item.width = 20;
item.height = 20;
item.useTime = 50;
item.useAnimation = 50;
item.useStyle = 3;
item.knockBack = 3.0f;
item.UseSound = SoundID.Item4;
item.shoot = 173;
item.shootSpeed = 4.0f;
}
else //left click
{
item.pick = 55;
item.useTurn = true;
item.damage = 8;
item.melee = true;
item.width = 34;
item.height = 34;
item.useTime = 25;
item.useAnimation = 25;
item.useStyle = 1;
item.knockBack = 3.0f;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(mod, "EnchantedFragment", 8);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
recipe = new ModRecipe(mod);
recipe.AddIngredient(mod, "EnchantedPickaxe", 1);
recipe.AddTile(TileID.Furnaces);
recipe.SetResult(mod, "EnchantedFragment", 8);
recipe.AddRecipe();
}
}
}
Last edited: