Package com.flansmod.common.guns.raytracing

Examples of com.flansmod.common.guns.raytracing.BlockHit


      else if(motionZ != 0)
        lambda = (float)(hitVec.zCoord / motionZ);
     
      if(lambda < 0)
        lambda = -lambda;
      hits.add(new BlockHit(hit, lambda));
    }
       
    //We hit something
    if(!hits.isEmpty())
    {
      //Sort the hits according to the intercept position
      Collections.sort(hits);
     
      for(BulletHit bulletHit : hits)
      {
        if(bulletHit instanceof DriveableHit)
        {
          DriveableHit driveableHit = (DriveableHit)bulletHit;
          penetratingPower = driveableHit.driveable.bulletHit(this, driveableHit, penetratingPower);
          if(FlansMod.DEBUG)
            worldObj.spawnEntityInWorld(new EntityDebugDot(worldObj, new Vector3f(posX + motionX * driveableHit.intersectTime, posY + motionY * driveableHit.intersectTime, posZ + motionZ * driveableHit.intersectTime), 1000, 0F, 0F, 1F));

        }
        else if(bulletHit instanceof PlayerBulletHit)
        {
          PlayerBulletHit playerHit = (PlayerBulletHit)bulletHit;
          penetratingPower = playerHit.hitbox.hitByBullet(this, penetratingPower);
          if(FlansMod.DEBUG)
            worldObj.spawnEntityInWorld(new EntityDebugDot(worldObj, new Vector3f(posX + motionX * playerHit.intersectTime, posY + motionY * playerHit.intersectTime, posZ + motionZ * playerHit.intersectTime), 1000, 1F, 0F, 0F));
        }
        else if(bulletHit instanceof EntityHit)
        {
          EntityHit entityHit = (EntityHit)bulletHit;
          if(entityHit.entity.attackEntityFrom(getBulletDamage(false), damage * type.damageVsLiving) && entityHit.entity instanceof EntityLivingBase)
          {
            EntityLivingBase living = (EntityLivingBase)entityHit.entity;
            for(PotionEffect effect : type.hitEffects)
            {
              living.addPotionEffect(new PotionEffect(effect));
            }
            //If the attack was allowed, we should remove their immortality cooldown so we can shoot them again. Without this, any rapid fire gun become useless
            living.arrowHitTimer++;
            living.hurtResistantTime = living.maxHurtResistantTime / 2;
          }
          if(type.setEntitiesOnFire)
            entityHit.entity.setFire(20);
          penetratingPower -= 1F;
          if(FlansMod.DEBUG)
            worldObj.spawnEntityInWorld(new EntityDebugDot(worldObj, new Vector3f(posX + motionX * entityHit.intersectTime, posY + motionY * entityHit.intersectTime, posZ + motionZ * entityHit.intersectTime), 1000, 1F, 1F, 0F));
        }
        else if(bulletHit instanceof BlockHit)
        {
          BlockHit blockHit = (BlockHit)bulletHit;
          MovingObjectPosition raytraceResult = blockHit.raytraceResult;
          //If the hit wasn't an entity hit, then it must've been a block hit
          int xTile = raytraceResult.blockX;
          int yTile = raytraceResult.blockY;
          int zTile = raytraceResult.blockZ;
View Full Code Here

TOP

Related Classes of com.flansmod.common.guns.raytracing.BlockHit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.