Package net.minecraft.util

Examples of net.minecraft.util.Vec3.normalize()


        flag = true;
      }

      if(flag)
      {
        vec = vec.normalize().addVector(0.0D, -6.0D, 0.0D);
      }
    }
    vec = vec.normalize();
    return vec;
  }
View Full Code Here


      if(flag)
      {
        vec = vec.normalize().addVector(0.0D, -6.0D, 0.0D);
      }
    }
    vec = vec.normalize();
    return vec;
  }
}
View Full Code Here

    @Override
    public void onPlayerTickActive(EntityPlayer player, ItemStack item) {
        Vec3 playerHorzFacing = player.getLookVec();
        playerHorzFacing.yCoord = 0;
        playerHorzFacing.normalize();
        PlayerInputMap movementInput = PlayerInputMap.getInputMapFor(player.getCommandSenderName());
        boolean sneakkey = movementInput.sneakKey;
        float forwardkey = movementInput.forwardKey;
        ItemStack torso = player.getCurrentArmor(2);
        boolean hasParachute = false;
View Full Code Here

            }
            desiredDirection.xCoord = desiredDirection.xCoord * Math.signum(forwardkey) + strafeX * Math.signum(strafekey);
            desiredDirection.yCoord = flightVerticality * desiredDirection.yCoord * Math.signum(forwardkey) + (jumpkey ? 1 : 0) - (downkey ? 1 : 0);
            desiredDirection.zCoord = desiredDirection.zCoord * Math.signum(forwardkey) + strafeZ * Math.signum(strafekey);

            desiredDirection = desiredDirection.normalize();
            // Gave up on this... I suck at math apparently
            // double ux = player.motionX / thrust;
            // double uy = player.motionY / thrust;
            // double uz = player.motionZ / thrust;
            // double vx = desiredDirection.xCoord;
View Full Code Here

            thrustUsed += thrust;

        } else {
            Vec3 playerHorzFacing = player.getLookVec();
            playerHorzFacing.yCoord = 0;
            playerHorzFacing.normalize();
            if (forwardkey == 0) {
                player.motionY += thrust;
            } else {
                player.motionY += thrust / root2;
                player.motionX += playerHorzFacing.xCoord * thrust / root2 * Math.signum(forwardkey);
 
View Full Code Here

        double xoffset = 1.3f;
        double yoffset = -.2;
        double zoffset = 0.3f;
        Vec3 horzdir = direction.normalize();
        horzdir.yCoord = 0;
        horzdir = horzdir.normalize();
        double cx = source.posX + direction.xCoord * xoffset - direction.yCoord * horzdir.xCoord * yoffset - horzdir.zCoord * zoffset;
        double cy = source.posY + source.getEyeHeight() + direction.yCoord * xoffset + (1 - Math.abs(direction.yCoord)) * yoffset;
        double cz = source.posZ + direction.zCoord * xoffset - direction.yCoord * horzdir.zCoord * yoffset + horzdir.xCoord * zoffset;
        double dx = x - cx;
        double dy = y - cy;
View Full Code Here

                isBlockSolid(world, x - 1, y + 1, z,     4) ||
                isBlockSolid(world, x + 1, y + 1, z,     5);

            if (flag)
            {
                vec = vec.normalize().addVector(0.0D, -6.0D, 0.0D);
            }
        }
        vec = vec.normalize();
        return vec;
    }
View Full Code Here

            if (flag)
            {
                vec = vec.normalize().addVector(0.0D, -6.0D, 0.0D);
            }
        }
        vec = vec.normalize();
        return vec;
    }

    /* IFluidBlock */
    @Override
View Full Code Here

            x += vec3d.xCoord - mx;
            y += (vec3d1.yCoord + vec3d2.yCoord) / 2D - my;
            z += vec3d.zCoord - mz;
            Vec3 vec3d3 = vec3d2.addVector(-vec3d1.xCoord, -vec3d1.yCoord, -vec3d1.zCoord);
            if (vec3d3.lengthVector() != 0.0D) {
                vec3d3 = vec3d3.normalize();
                yaw = (float) (Math.atan2(vec3d3.zCoord, vec3d3.xCoord) / Math.PI) * 180;
                pitch = (float) (Math.atan(vec3d3.yCoord) * 73D);
            }
        }
        if (cart instanceof IDirectionalCart) {
View Full Code Here

    private void calculateVector(double dist) {
        Vec3 endPoint = Vec3.createVectorHelper(endX, endY, endZ);
        Vec3 vecParticle = Vec3.createVectorHelper(posX, posY, posZ);

        Vec3 vel = vecParticle.subtract(endPoint);
        vel = vel.normalize();
       
        float velScale = 0.1f;
        this.motionX = vel.xCoord * velScale;
        this.motionY = vel.yCoord * velScale + 0.2 * (dist / maxDist);
        this.motionZ = vel.zCoord * velScale;
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.