001 package net.minecraft.src;
002
003 public class EntitySmallFireball extends EntityFireball
004 {
005 public EntitySmallFireball(World par1World)
006 {
007 super(par1World);
008 this.setSize(0.3125F, 0.3125F);
009 }
010
011 public EntitySmallFireball(World par1World, EntityLiving par2EntityLiving, double par3, double par5, double par7)
012 {
013 super(par1World, par2EntityLiving, par3, par5, par7);
014 this.setSize(0.3125F, 0.3125F);
015 }
016
017 public EntitySmallFireball(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
018 {
019 super(par1World, par2, par4, par6, par8, par10, par12);
020 this.setSize(0.3125F, 0.3125F);
021 }
022
023 /**
024 * Called when this EntityFireball hits a block or entity.
025 */
026 protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
027 {
028 if (!this.worldObj.isRemote)
029 {
030 if (par1MovingObjectPosition.entityHit != null)
031 {
032 if (!par1MovingObjectPosition.entityHit.isImmuneToFire() && par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 5))
033 {
034 par1MovingObjectPosition.entityHit.setFire(5);
035 }
036 }
037 else
038 {
039 int var2 = par1MovingObjectPosition.blockX;
040 int var3 = par1MovingObjectPosition.blockY;
041 int var4 = par1MovingObjectPosition.blockZ;
042
043 switch (par1MovingObjectPosition.sideHit)
044 {
045 case 0:
046 --var3;
047 break;
048 case 1:
049 ++var3;
050 break;
051 case 2:
052 --var4;
053 break;
054 case 3:
055 ++var4;
056 break;
057 case 4:
058 --var2;
059 break;
060 case 5:
061 ++var2;
062 }
063
064 if (this.worldObj.isAirBlock(var2, var3, var4))
065 {
066 this.worldObj.setBlockWithNotify(var2, var3, var4, Block.fire.blockID);
067 }
068 }
069
070 this.setDead();
071 }
072 }
073
074 /**
075 * Returns true if other Entities should be prevented from moving through this Entity.
076 */
077 public boolean canBeCollidedWith()
078 {
079 return false;
080 }
081
082 /**
083 * Called when the entity is attacked.
084 */
085 public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
086 {
087 return false;
088 }
089 }