Started by CloudtailRox on Mon, 08/01/2016 - 14:32 Topic category: Advanced modding Is there a way for a sword to posion mobs when they're hit? Jump to top globální eventy UseItemEvent a holding spesific item = [tvůj meč] add potion effect aspon myslim Jump to top Permalink Log in or register to post comments Sorry I forgot about it - this is only english forum and I wrote it wery wrong global events -> when player hits entity -> in spesifics cases (item in hand = your sworld) -> add potion efect and sellect potion effect but I am not sure if it goes to an atacked entity Jump to top Permalink Log in or register to post comments ok ill try it Jump to top Permalink Log in or register to post comments 1. It gave the effect to myself. 2. If an iron golem, wolf, or any other entity attacked another entity and I had the weapon in my hand, it still gave me the effect. Jump to top Permalink Log in or register to post comments Me anyway I do not know the code Jump to top Permalink Log in or register to post comments But I think we must look at the NBT Jump to top Permalink Log in or register to post comments Use: public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par2EntityLiving.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("poison"), 200, 2)); par1ItemStack.damageItem(1, par2EntityLiving); return true; } Jump to top Permalink Log in or register to post comments I don't know if you will see or respond to this considering the post is old but where would I paste this in Jump to top Permalink Log in or register to post comments Never mind I figured it out Jump to top Permalink Log in or register to post comments
globální eventy UseItemEvent a holding spesific item = [tvůj meč] add potion effect aspon myslim Jump to top Permalink Log in or register to post comments
Sorry I forgot about it - this is only english forum and I wrote it wery wrong global events -> when player hits entity -> in spesifics cases (item in hand = your sworld) -> add potion efect and sellect potion effect but I am not sure if it goes to an atacked entity Jump to top Permalink Log in or register to post comments
1. It gave the effect to myself. 2. If an iron golem, wolf, or any other entity attacked another entity and I had the weapon in my hand, it still gave me the effect. Jump to top Permalink Log in or register to post comments
Use: public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par2EntityLiving.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("poison"), 200, 2)); par1ItemStack.damageItem(1, par2EntityLiving); return true; } Jump to top Permalink Log in or register to post comments
I don't know if you will see or respond to this considering the post is old but where would I paste this in Jump to top Permalink Log in or register to post comments
globální eventy UseItemEvent a holding spesific item = [tvůj meč] add potion effect
aspon myslim
Sorry I forgot about it - this is only english forum and I wrote it wery wrong
global events -> when player hits entity -> in spesifics cases (item in hand = your sworld) -> add potion efect and sellect potion effect
but I am not sure if it goes to an atacked entity
ok ill try it
1. It gave the effect to myself.
2. If an iron golem, wolf, or any other entity attacked another entity and I had the weapon in my hand, it still gave me the effect.
Me anyway I do not know the code
But I think we must look at the NBT
Use:
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par2EntityLiving.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("poison"), 200, 2));
par1ItemStack.damageItem(1, par2EntityLiving);
return true;
}
I don't know if you will see or respond to this considering the post is old but where would I paste this in
Never mind I figured it out