Hello,
I have been having trouble figuring out how to make my sword spawn lightning on right click where I look. I have basic knowledge of java, I am currently taking mod design 2 on youth digital. I still don't know what vectors, and par2 and all that means, Im not very advanced.
This is what I have so far:
package mymod.items;
import library.items.LibItemSword;
import library.util.Actions;
import mymod.Main;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.PotionHealth;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
public class MySword2 extends LibItemSword {
public MySword2(String registryName, ToolMaterial material) {
super(registryName, material);
this.setCreativeTab(Main.my_creative_tab_1);
this.setScale(0.5F);
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase hitEntity, EntityLivingBase attackingEntity)
{
hitEntity.addPotionEffect(new PotionEffect(Potion.getPotionById(2), 100, 10));
return true;
}
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
//Actions.summonLightningAtPosition(worldIn, playerIn.get, 5);
return super.onItemRightClick(worldIn, playerIn, handIn);
}
}
If you could help that would be greatly appreciated.