Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.elias.adminweapons.common;
- import java.util.List;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityCreature;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.effect.EntityLightningBolt;
- import net.minecraft.entity.monster.EntityEnderman;
- import net.minecraft.entity.projectile.EntityThrowable;
- import net.minecraft.util.AxisAlignedBB;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.MovingObjectPosition;
- import net.minecraft.world.World;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- public class EntityLightningStaffProjectile extends EntityThrowable {
- public EntityLightningStaffProjectile(World p_i1782_1_)
- {
- super(p_i1782_1_);
- }
- public EntityLightningStaffProjectile(World p_i1783_1_, EntityLivingBase p_i1783_2_, double x, double y, double z)
- {
- super(p_i1783_1_, p_i1783_2_);
- this.setPositionAndRotation(x, y + 1.5D, z, p_i1783_2_.rotationYaw, p_i1783_2_.rotationPitch);
- }
- @SideOnly(Side.CLIENT)
- public EntityLightningStaffProjectile(World p_i1784_1_, double p_i1784_2_, double p_i1784_4_, double p_i1784_6_)
- {
- super(p_i1784_1_, p_i1784_2_, p_i1784_4_, p_i1784_6_);
- }
- /**
- * Called when this EntityThrowable hits a block or entity.
- */
- protected void onImpact(MovingObjectPosition p_70184_1_)
- {
- if (p_70184_1_.entityHit != null)
- {
- worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, posX + rand.nextDouble(), posY, posZ + rand.nextDouble()));
- p_70184_1_.entityHit.attackEntityFrom(DamageSource.generic, Float.MAX_VALUE);
- if(!worldObj.isRemote)
- {
- if(rand.nextInt(20) == 0)
- {
- setDead();
- }
- }
- }
- if(p_70184_1_.typeOfHit == p_70184_1_.typeOfHit.BLOCK)
- {
- if(!worldObj.isRemote)
- {
- if(rand.nextInt(20) == 0)
- {
- setDead();
- }
- worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, posX, posY, posZ));
- if(AdminWeapons.allowWeaponsGriefing)
- {
- worldObj.setBlockToAir(p_70184_1_.blockX, p_70184_1_.blockY, p_70184_1_.blockZ);
- }
- }
- }
- if(p_70184_1_.entityHit instanceof EntityEnderman)
- {
- p_70184_1_.entityHit.worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, p_70184_1_.entityHit.posX, p_70184_1_.entityHit.posY, p_70184_1_.entityHit.posZ));
- }
- }
- protected float getGravityVelocity()
- {
- return 0.0001F;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement