| 1 | package net.minecraft.entity.projectile;
|
| 2 |
|
| 3 | import net.minecraft.entity.Entity;
|
| 4 | import net.minecraft.entity.EntityLivingBase;
|
| 5 | import net.minecraft.nbt.NBTTagCompound;
|
| 6 | import net.minecraft.util.DamageSource;
|
| 7 | import net.minecraft.util.MovingObjectPosition;
|
| 8 | import net.minecraft.world.World;
|
| 9 |
|
| 10 | public class EntityLargeFireball extends EntityFireball
|
| 11 | {
|
| 12 | public int explosionPower = 1;
|
| 13 |
|
| 14 | public EntityLargeFireball(World worldIn)
|
| 15 | {
|
| 16 | super(worldIn);
|
| 17 | }
|
| 18 |
|
| 19 | public EntityLargeFireball(World worldIn, double x, double y, double z, double accelX, double accelY, double accelZ)
|
| 20 | {
|
| 21 | super(worldIn, x, y, z, accelX, accelY, accelZ);
|
| 22 | }
|
| 23 |
|
| 24 | public EntityLargeFireball(World worldIn, EntityLivingBase shooter, double accelX, double accelY, double accelZ)
|
| 25 | {
|
| 26 | super(worldIn, shooter, accelX, accelY, accelZ);
|
| 27 | }
|
| 28 |
|
| 29 | /**
|
| 30 | * Called when this EntityFireball hits a block or entity.
|
| 31 | */
|
| 32 | protected void onImpact(MovingObjectPosition movingObject)
|
| 33 | {
|
| 34 | if (!this.worldObj.isRemote)
|
| 35 | {
|
| 36 | if (movingObject.entityHit != null)
|
| 37 | {
|
| 38 | movingObject.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 6.0F);
|
| 39 | this.applyEnchantments(this.shootingEntity, movingObject.entityHit);
|
| 40 | }
|
| 41 |
|
| 42 | boolean flag = this.worldObj.getGameRules().getBoolean("mobGriefing");
|
| 43 | this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, (float)this.explosionPower, flag, flag);
|
| 44 | this.setDead();
|
| 45 | }
|
| 46 | }
|
| 47 |
|
| 48 | /**
|
| 49 | * (abstract) Protected helper method to write subclass entity data to NBT.
|
| 50 | */
|
| 51 | public void writeEntityToNBT(NBTTagCompound tagCompound)
|
| 52 | {
|
| 53 | super.writeEntityToNBT(tagCompound);
|
| 54 | tagCompound.setInteger("ExplosionPower", this.explosionPower);
|
| 55 | }
|
| 56 |
|
| 57 | /**
|
| 58 | * (abstract) Protected helper method to read subclass entity data from NBT.
|
| 59 | */
|
| 60 | public void readEntityFromNBT(NBTTagCompound tagCompund)
|
| 61 | {
|
| 62 | super.readEntityFromNBT(tagCompund);
|
| 63 |
|
| 64 | if (tagCompund.hasKey("ExplosionPower", 99))
|
| 65 | {
|
| 66 | this.explosionPower = tagCompund.getInteger("ExplosionPower");
|
| 67 | }
|
| 68 | }
|
| 69 | }
|
| 70 |
|