BloodMagic/BM_src/WayofTime/alchemicalWizardry/common/entity/projectile/EntityMeteor.java
Fenn e3644f2d2b Massive rework of configs, items and blocks.
I redone where the items/blocsks are stored and how the configs are
handled to clean up it and give space. You can change the config line to
AWWayofTime if you want to keep the compatibility with old configs. Now
you reference the blocks from the ModBlocks and Items from the ModItems.
2014-01-17 21:05:38 +00:00

65 lines
1.7 KiB
Java

package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityMeteor extends EnergyBlastProjectile {
private int meteorID;
public EntityMeteor(World par1World)
{
super(par1World);
this.meteorID = 0;
}
public EntityMeteor(World par1World, double par2, double par4, double par6, int meteorID)
{
super(par1World, par2, par4, par6);
this.meteorID = meteorID;
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.fallingBlock;
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (worldObj.isRemote)
{
return;
}
if (mop.typeOfHit == EnumMovingObjectType.ENTITY && mop.entityHit != null)
{
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == EnumMovingObjectType.TILE)
{
MeteorRegistry.createMeteorImpact(worldObj, mop.blockX, mop.blockY, mop.blockZ, this.meteorID);
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
} else
{
MeteorRegistry.createMeteorImpact(worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, meteorID);
}
this.setDead();
}
}