Jump to content

Custom Arrows


Zcelo12

Recommended Posts

Hello,

I want to create poison arrows. The problem is that i don't know how to do that.

I already found a tutorial, but this one is with Modloader and I'Ve to create a custom bow.

 

Is there a tutorial how i can only create custom arrows with Forge?

 

 

Link to comment
Share on other sites

Sadly there is no tutorial for this, but, when i figure out how to use it, i will write one.

 

Somehow there is a way to not have to use custom bows, but rather use the IArrowLoose and IArrowNock handlers. I haven't successfully got either working. But, in order to get more help we need code.

 

Just some tips, what exactly is the problem you're having, post your code, be patient.

Link to comment
Share on other sites

  • 2 weeks later...

This may be done completely wrong, but i got a way to have it work.

 

 

package bonesticks.items;

import bonesticks.bEntityArrow;
import bonesticks.bItem;
import net.minecraft.src.Enchantment;
import net.minecraft.src.EnchantmentHelper;
import net.minecraft.src.EntityArrow;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
import net.minecraft.src.forge.IArrowLooseHandler;
import net.minecraft.src.forge.IArrowNockHandler;
import net.minecraft.src.forge.ITextureProvider;
import net.minecraft.src.forge.MinecraftForge;

public class bItemArrow extends Item implements ITextureProvider, IArrowLooseHandler, IArrowNockHandler
{

public bItemArrow(int par1) 
{
	super(par1);
}

@Override
public ItemStack onArrowNock(ItemStack itemstack, World world, EntityPlayer player) 
{
	if(player.inventory.hasItem(bItem.boneArrow.shiftedIndex))
	{
		if(itemstack.itemID == Item.bow.shiftedIndex || itemstack.itemID == bItem.Bow.shiftedIndex)
		{
			return new ItemStack(bItem.bBow, 1, itemstack.getItemDamage());
		}
		else if (itemstack.itemID == bItem.boneBow.shiftedIndex)
		{
			return new ItemStack(bItem.boneBowBA, 1, itemstack.getItemDamage());
		}
	}
	else if(player.inventory.hasItem(Item.arrow.shiftedIndex))
	{
		if(itemstack.itemID == bItem.boneBowBA.shiftedIndex)
		{
			return new ItemStack(bItem.boneBow, 1, itemstack.getItemDamage());
		}

		else if (itemstack.itemID == Item.bow.shiftedIndex || itemstack.itemID == bItem.bBow.shiftedIndex)
		{
			return new ItemStack(bItem.Bow, 1, itemstack.getItemDamage());
		}
	}
	return null;
}

@Override
public boolean onArrowLoose(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) 
{
	return true;
}

@Override
public String getTextureFile() {
	return ("/bonesticks/pictures/terrain.png");
}
}

 

 

In short, my understanding is that onArrowLoose is just used to indicate to the arrow to shift the change bows for different arrows.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.