1
Urget help needed
Hi,
I am working on a sword using eclispe and i wanted it to shoot a fireball when right clicked. Here is my code
The problem is that EntityFireball fireball = new EntityFireball the "new EntityFireball" comes with an error saying "cannot instantiate the type EntityFireball"
and my minecraft crashes when i run it.
Please can some on help!!!
Thanks
I am working on a sword using eclispe and i wanted it to shoot a fireball when right clicked. Here is my code
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
if (!world.isRemote) {
Vec3 v3 = player.getLook(1);
EntityFireball fireball = new EntityFireball(world, player.posX, player.posY + player.eyeHeight, player.posZ, v3.xCoord, v3.yCoord, v3.zCoord);
fireball.shootingEntity = player;
world.playSoundAtEntity(player, "mob.ghast.fireball", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
world.spawnEntityInWorld(fireball);
The problem is that EntityFireball fireball = new EntityFireball the "new EntityFireball" comes with an error saying "cannot instantiate the type EntityFireball"
and my minecraft crashes when i run it.
Please can some on help!!!
Thanks
Create an account or sign in to comment.
1
1
EntityFireball is an abstract class, and therefor cannot be instantiated. Abstract classes are generally used to be extended by other classes.
In this case, the what you really want is EntitySmallFireball or EntityLargeFireball. They both extend EntityFireball and can be instantiated.
In this case, the what you really want is EntitySmallFireball or EntityLargeFireball. They both extend EntityFireball and can be instantiated.