Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.88 KB | None | 0 0
  1. package com.mrzorse.startrek.entities;
  2.  
  3.  
  4.  
  5. import com.mrzorse.startrek.api.weaponeffects.SimpleEffects;
  6. import com.mrzorse.startrek.api.weapons.WeaponShot;
  7.  
  8. import cpw.mods.fml.relauncher.Side;
  9. import cpw.mods.fml.relauncher.SideOnly;
  10. import net.minecraft.block.Block;
  11. import net.minecraft.entity.EntityLivingBase;
  12. import net.minecraft.entity.monster.EntityBlaze;
  13. import net.minecraft.entity.passive.EntityCow;
  14. import net.minecraft.entity.player.EntityPlayer;
  15. import net.minecraft.entity.projectile.EntityFireball;
  16. import net.minecraft.entity.projectile.EntityThrowable;
  17. import net.minecraft.init.Blocks;
  18. import net.minecraft.potion.Potion;
  19. import net.minecraft.potion.PotionEffect;
  20. import net.minecraft.util.DamageSource;
  21. import net.minecraft.util.MovingObjectPosition;
  22. import net.minecraft.util.Vec3;
  23. import net.minecraft.util.MovingObjectPosition.MovingObjectType;
  24. import net.minecraft.world.EnumDifficulty;
  25. import net.minecraft.world.World;
  26.  
  27. public class EntityPhaserBoltStun extends EntityThrowable{
  28.     private double explosionRadius = 1.0F;
  29.     private double toh = 1.0F;
  30.     private int life = 300;
  31.     private int color;
  32.    
  33.     private int distanceTraveled;
  34.  
  35.     public EntityPhaserBoltStun(World par1World) {
  36.         super(par1World);
  37.     }
  38.    
  39.     public EntityPhaserBoltStun(World par1World, double arg1Double, double arg2Double, double arg3Double, WeaponShot shot) {
  40.        
  41.         super(par1World, arg1Double, arg2Double, arg3Double);
  42.    
  43. //      this.life = shot.getRange();
  44. //      this.color = shot.getColor();
  45.     }
  46.     public void onUpdate(){
  47.         super.onUpdate();
  48.         if(this.isInWater()){
  49.             this.setDead();
  50.         }
  51.  
  52.         distanceTraveled+=Vec3.createVectorHelper(motionX,motionY,motionZ).lengthVector();
  53.         if(distanceTraveled > 35){
  54.             this.setDead();
  55.         }
  56.        
  57.     }
  58.  
  59.     public EntityPhaserBoltStun(World par1World, EntityLivingBase arg1EntityLivingBase) {
  60.         super(par1World, arg1EntityLivingBase);
  61.     }
  62. //  @Override
  63. //  protected void onImpact(MovingObjectPosition mop) {
  64. //      //System.out.println("Phaser is firing");
  65. //      System.out.println(mop.entityHit);
  66. //     
  67. //      if (mop.entityHit != null) {
  68. //          System.out.println("Hit a Entity");
  69. //         
  70. //         
  71. //          mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
  72. //      }
  73. //         
  74. //                 
  75. //       
  76. //  }
  77.     public boolean canBeCollidedWith()
  78.     {
  79.         return true;  
  80.     }
  81.    
  82.     @SideOnly(Side.CLIENT)
  83.     protected void onImpact(MovingObjectPosition mop)
  84.     {
  85.        
  86.         System.out.println(worldObj.isRemote);
  87.        
  88.         if(mop.typeOfHit == MovingObjectType.BLOCK){
  89.             Block blockHit = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
  90.             if(blockHit == Blocks.water || blockHit == Blocks.lava){
  91.                 this.setDead();
  92.             }
  93.         }
  94.        
  95.         if(mop.entityHit != null){
  96.            
  97.              //Amount of damage done to entity
  98.             byte b0 = 1;
  99.          
  100.            
  101.             //This causes the entity to get damaged or hurt
  102.             EntityLivingBase target = (EntityLivingBase)mop.entityHit;
  103.             mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)b0);
  104.             SimpleEffects.setPotionEffects(target, 1000, 100, "blindness");
  105.             SimpleEffects.setPotionEffects(target, 1000, 100, "slowness");
  106.             SimpleEffects.setPotionEffects(target, 1000, 100, "mining fatigue");
  107.            
  108.            
  109.        
  110.         }
  111.  
  112.         for (int i = 0; i < 8; ++i)
  113.         {
  114.            
  115.             this.worldObj.spawnParticle("reddust", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
  116.         }
  117.         this.setDead();
  118.         if (!this.worldObj.isRemote)
  119.         {
  120.             this.setDead();
  121.         }
  122.     }
  123.     protected float getGravityVelocity()
  124.     {
  125.         return 0.0F;
  126.     }
  127. //  public float getLife()
  128. //    {
  129. //        return 1f-((float)distanceTraveled/(float)life);
  130. //    }
  131.     public int getColor()
  132.     {
  133.         return color;
  134.     }
  135.  
  136.  
  137.  
  138.    
  139.  
  140.  
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement