Thanks! I have now registered my Dispenser behavior, however I am using an item with metadata and need to get the damage value of the item that is going to be shot, so that I can change the entity that spawns.
The easy way of normally doing this without metadata would to use the code DispenserBehaviorEgg.java uses
final class DispenserBehaviorEgg extends BehaviorProjectileDispense
{
/**
* Return the projectile entity spawned by this dispense behavior.
*/
protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition)
{
return new EntityEgg(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ());
}
}
But there is no itemstack argument I can use to find the damage value.
Then I looked in the behavior for BehaviorDefaultDispenseItem, used by fireworks, mob eggs, etc so similar to what I am doing, and it has a method called
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
I have tried modifying my Dispenser Behaviour to use this, and have managed to get it to shoot my custom item out, howver it does not spawn the entity that it normally does when it hits the ground (when you throw it yourself) . I know it must have got to this part of code, because it is in the same place that the particles are told to appear, and they show up fine...
If anyone could shed some light on this, I'd be very happy!