Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

How to make a sword that sets fire to things.


  • Please log in to reply
12 replies to this topic

#1

woochikaboo
  • Minecraft: woochikaboo

Posted 17 January 2012 - 12:37 AM

ok,so i am making a mod with lightsabers and  want to make it so the lightsaber catches fie to mobs when it hits them. but how?

On the internet, nobody knows you're a dog.

Nobody.


Register or log in to remove.

#2

Jsn_man
    Jsn_man

    Redstone Miner

  • Curse Premium
  • Curse Premium
  • 644 posts
  • Location: Arizona, USA
  • Minecraft: Jsn_man

Posted 17 January 2012 - 01:05 AM

If you add this to your sword's class, it should get the job done:

public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		entityliving1.setFire(50);
		itemstack.damageItem(1, entityliving1);
		return true;
	}

Where 50 is how long you want the fire to last, so you can experiment with that.

If you need anything else, please PM me.

#3

woochikaboo
  • Minecraft: woochikaboo

Posted 17 January 2012 - 08:34 PM

View PostJsn_man, on 17 January 2012 - 01:05 AM, said:

If you add this to your sword's class, it should get the job done:

public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		entityliving1.setFire(50);
		itemstack.damageItem(1, entityliving1);
		return true;
	}

Where 50 is how long you want the fire to last, so you can experiment with that.

If you need anything else, please PM me.
diddnt work......

On the internet, nobody knows you're a dog.

Nobody.


#4

Kazemc95

Posted 17 January 2012 - 10:01 PM

View Postwoochikaboo, on 17 January 2012 - 08:34 PM, said:

diddnt work......
	public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		entityliving.setFire(50);
		itemstack.damageItem(1, entityliving1);
		return true;
	}
You have only to remove the " 1 " afterentityliving. entityliving = mob, entityliving1 = player ;)
Hope i helped.
If I helped please be thankful and press the awesom " + " button :D

#5

woochikaboo
  • Minecraft: woochikaboo

Posted 17 January 2012 - 10:15 PM

View PostKazemc95, on 17 January 2012 - 10:01 PM, said:

	public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		entityliving.setFire(50);
		itemstack.damageItem(1, entityliving1);
		return true;
	}
You have only to remove the " 1 " afterentityliving. entityliving = mob, entityliving1 = player ;)
Hope i helped.
tried that, just got errors, and when i looked at it the only option was to edit base classes :/

On the internet, nobody knows you're a dog.

Nobody.


#6

Kazemc95

Posted 17 January 2012 - 10:16 PM

View Postwoochikaboo, on 17 January 2012 - 10:15 PM, said:

tried that, just got errors, and when i looked at it the only option was to edit base classes :/
Sen us the entire file <_<
If I helped please be thankful and press the awesom " + " button :D

#7

woochikaboo
  • Minecraft: woochikaboo

Posted 17 January 2012 - 10:19 PM

View PostKazemc95, on 17 January 2012 - 10:01 PM, said:

	public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		entityliving.setFire(50);
		itemstack.damageItem(1, entityliving1);
		return true;
	}
You have only to remove the " 1 " afterentityliving. entityliving = mob, entityliving1 = player ;)
Hope i helped.
also i had to put a 1 here:
		public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
		{
		entityliving1.setFire(50); <---- that entityliving there
		itemstack.damageItem(1, entityliving1);
		return true;
		}

View PostKazemc95, on 17 January 2012 - 10:16 PM, said:

Sen us the entire file <_<
package net.minecraft.src;

public class Itemsaber extends Item
{
	private int weaponDamage;
	private final EnumToolMaterial field_40439_b;

	public Itemsaber(int i, EnumToolMaterial enumtoolmaterial)
	{
		super(i);
		field_40439_b = enumtoolmaterial;
		maxStackSize = 1;
		setMaxDamage(enumtoolmaterial.getMaxUses());
		weaponDamage = 4 + enumtoolmaterial.getDamageVsEntity();
	}

	public float getStrVsBlock(ItemStack itemstack, Block block)
	{
		return block.blockID != mod_starwars.crystalore.blockID ? 1.5F : 15F;
	}

	public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		itemstack.damageItem(1, entityliving1);
		return true;
	}

	public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
	{
		itemstack.damageItem(2, entityliving);
		return true;
	}

	public int getDamageVsEntity(Entity entity)
	{
		return weaponDamage;
	}

	public boolean isFull3D()
	{
		return true;
	}

	public EnumAction getItemUseAction(ItemStack itemstack)
	{
		return EnumAction.block;
	}

	public int getMaxItemUseDuration(ItemStack itemstack)
	{
		return 0x11940;
	}

	public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
	{
		entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
		return itemstack;
	}

	public boolean canHarvestBlock(Block block)
	{
		return block.blockID == mod_starwars.crystalore.blockID;
	}

	public int getItemEnchantability()
	{
		return field_40439_b.getEnchantability();
	}
	
	public boolean hitEntity1(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		entityliving1.setFire(50);
		itemstack.damageItem(1, entityliving1);
		return true;
	}
}

On the internet, nobody knows you're a dog.

Nobody.


#8

Kazemc95

Posted 18 January 2012 - 08:31 PM

View Postwoochikaboo, on 17 January 2012 - 10:19 PM, said:

also i had to put a 1 here:
		public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
		{
		entityliving1.setFire(50); <---- that entityliving there
		itemstack.damageItem(1, entityliving1);
		return true;
		}


package net.minecraft.src;

public class Itemsaber extends Item
{
	private int weaponDamage;
	private final EnumToolMaterial field_40439_b;

	public Itemsaber(int i, EnumToolMaterial enumtoolmaterial)
	{
		super(i);
		field_40439_b = enumtoolmaterial;
		maxStackSize = 1;
		setMaxDamage(enumtoolmaterial.getMaxUses());
		weaponDamage = 4 + enumtoolmaterial.getDamageVsEntity();
	}

	public float getStrVsBlock(ItemStack itemstack, Block block)
	{
		return block.blockID != mod_starwars.crystalore.blockID ? 1.5F : 15F;
	}

	public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		itemstack.damageItem(1, entityliving1);
		return true;
	}

	public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
	{
		itemstack.damageItem(2, entityliving);
		return true;
	}

	public int getDamageVsEntity(Entity entity)
	{
		return weaponDamage;
	}

	public boolean isFull3D()
	{
		return true;
	}

	public EnumAction getItemUseAction(ItemStack itemstack)
	{
		return EnumAction.block;
	}

	public int getMaxItemUseDuration(ItemStack itemstack)
	{
		return 0x11940;
	}

	public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
	{
		entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
		return itemstack;
	}

	public boolean canHarvestBlock(Block block)
	{
		return block.blockID == mod_starwars.crystalore.blockID;
	}

	public int getItemEnchantability()
	{
		return field_40439_b.getEnchantability();
	}
	
	public boolean hitEntity1(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		entityliving1.setFire(50);
		itemstack.damageItem(1, entityliving1);
		return true;
	}
}
Remove this part of code:
	public boolean hitEntity1(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		entityliving1.setFire(50);
		itemstack.damageItem(1, entityliving1);
		return true;
	}
I know why it is not working... You have created another boolean. You only have to put "entityliving.setFire(WhateverNumberYouiWant);" in your Hit entity, like that:
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		itemstack.damageItem(1, entityliving1);
		entityliving.setFire(WhateverNumberYouiWant);
		return true;
	}
Replace it !
If I helped please be thankful and press the awesom " + " button :D

#9

woochikaboo
  • Minecraft: woochikaboo

Posted 18 January 2012 - 08:38 PM

View PostKazemc95, on 18 January 2012 - 08:31 PM, said:

Remove this part of code:
	public boolean hitEntity1(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		entityliving1.setFire(50);
		itemstack.damageItem(1, entityliving1);
		return true;
	}
I know why it is not working... You have created another boolean. You only have to put "entityliving.setFire(WhateverNumberYouiWant);" in your Hit entity, like that:
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
	{
		itemstack.damageItem(1, entityliving1);
		entityliving.setFire(WhateverNumberYouiWant);
		return true;
	}
Replace it !
yea i worked it out yesterday. thanks though

On the internet, nobody knows you're a dog.

Nobody.


#10

Kazemc95

Posted 18 January 2012 - 09:19 PM

View Postwoochikaboo, on 18 January 2012 - 08:38 PM, said:

yea i worked it out yesterday. thanks though
Did it work for you??
If I helped please be thankful and press the awesom " + " button :D

#11

woochikaboo
  • Minecraft: woochikaboo

Posted 18 January 2012 - 09:22 PM

View PostKazemc95, on 18 January 2012 - 09:19 PM, said:

Did it work for you??
yea, also do you have a skype? i seem to see you alot on here. AND do you know how to make anew furnace?

On the internet, nobody knows you're a dog.

Nobody.


#12

Kazemc95

Posted 18 January 2012 - 09:27 PM

View Postwoochikaboo, on 18 January 2012 - 09:22 PM, said:

yea, also do you have a skype? i seem to see you alot on here. AND do you know how to make anew furnace?
Nice then if you want you can press the "+" button :P
By the way, i have skype but i am Spanish and i think you speak in English and my English is not very well... If you want you can add me and PM me your errors/ suggestions or whatever you want :D
PS: Sorry i don't know how to make a new furnace... i am looking for help about GUI's and TileEntity :S
If I helped please be thankful and press the awesom " + " button :D

#13

woochikaboo
  • Minecraft: woochikaboo

Posted 18 January 2012 - 11:09 PM

View PostKazemc95, on 18 January 2012 - 09:27 PM, said:

Nice then if you want you can press the "+" button :P
By the way, i have skype but i am Spanish and i think you speak in English and my English is not very well... If you want you can add me and PM me your errors/ suggestions or whatever you want :D
PS: Sorry i don't know how to make a new furnace... i am looking for help about GUI's and TileEntity :S
it dont matter.

On the internet, nobody knows you're a dog.

Nobody.