Package net.minecraft.util

Examples of net.minecraft.util.MovingObjectPosition


        return mop;
    }

    public MovingObjectPosition rayTraceCuboid(Vector3 start, Vector3 end, Cuboid6 cuboid, Entity e)
    {
        MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
        if(mop != null)
        {
            mop.typeOfHit = MovingObjectType.ENTITY;
            mop.entityHit = e;
        }
View Full Code Here


    }
   
    public MovingObjectPosition rayTraceCuboids(Vector3 start, Vector3 end, List<IndexedCuboid6> cuboids)
    {
        double c_dist = Double.MAX_VALUE;
        MovingObjectPosition c_hit = null;
       
        for(IndexedCuboid6 cuboid : cuboids)
        {
            MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
            if(mop != null && s_dist < c_dist)
            {
                mop = new ExtendedMOP(mop, cuboid.data, s_dist);
                c_dist = s_dist;
                c_hit = mop;
View Full Code Here

        return c_hit;
    }

    public MovingObjectPosition rayTraceCuboids(Vector3 start, Vector3 end, List<IndexedCuboid6> cuboids, BlockCoord pos, Block block)
    {
        MovingObjectPosition mop = rayTraceCuboids(start, end, cuboids);
        if(mop != null)
        {
            mop.typeOfHit = MovingObjectType.BLOCK;
            mop.blockX = pos.x;
            mop.blockY = pos.y;
View Full Code Here

    public void rayTraceCuboids(Vector3 start, Vector3 end, List<IndexedCuboid6> cuboids, BlockCoord pos, Block block, List<ExtendedMOP> hitList)
    {
        for(IndexedCuboid6 cuboid : cuboids)
        {
            MovingObjectPosition mop = rayTraceCuboid(start, end, cuboid);
            if(mop != null)
            {
                ExtendedMOP emop = new ExtendedMOP(mop, cuboid.data, s_dist);
                emop.typeOfHit = MovingObjectType.BLOCK;
                emop.blockX = pos.x;
View Full Code Here

        catch (final Throwable cnfe)
        {

        }

        MovingObjectPosition pos = event.target;
      final Block blockID = event.world.getBlock(pos.blockX, pos.blockY, pos.blockZ);

        if (GalacticraftCore.isPlanetsLoaded && blockID == MarsBlocks.blockSludge && event.world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0)
        {
          event.world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
View Full Code Here

                this.setDead();
            }

            Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
            Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
            MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
            vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
            vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

            if (movingobjectposition != null)
            {
                vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
            }

            Entity entity = null;
            List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
            double d0 = 0.0D;
            int i;
            float f1;

            for (i = 0; i < list.size(); ++i)
            {
                Entity entity1 = (Entity) list.get(i);

                if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
                {
                    f1 = 0.3F;
                    AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
                    MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);

                    if (movingobjectposition1 != null)
                    {
                        double d1 = vec31.distanceTo(movingobjectposition1.hitVec);

                        if (d1 < d0 || d0 == 0.0D)
                        {
                            entity = entity1;
                            d0 = d1;
                        }
                    }
                }
            }

            if (entity != null)
            {
                movingobjectposition = new MovingObjectPosition(entity);
            }

            if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
            {
                EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;
View Full Code Here

        final float var17 = MathHelper.sin(-var5 * 0.017453292F);
        final float var18 = var15 * var16;
        final float var20 = var14 * var16;
        final double var21 = 5.0D;
        final Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21);
        final MovingObjectPosition var24 = par2World.rayTraceBlocks(var13, var23, true);

        if (var24 == null)
        {
            return par1ItemStack;
        }
View Full Code Here

        if (damage > itemStack.getMaxDamage())
        {
            return itemStack;
        }

        MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);

        if (movingobjectposition == null)
        {
            return itemStack;
        }
View Full Code Here

    {
        final int useTime = this.getMaxItemUseDuration(par1ItemStack) - par4;

        boolean placed = false;

        final MovingObjectPosition var12 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);

        float var7 = useTime / 20.0F;
        var7 = (var7 * var7 + var7 * 2.0F) / 3.0F;

        if (var7 > 1.0F)
View Full Code Here

    public ChunkPosition getPlayerLookingAtBlock(EntityPlayerMP player, float reach)
    {
        Vec3 vec3d = Vec3.createVectorHelper(player.posX, (player.posY + 1.6200000000000001D) - player.yOffset, player.posZ);
        Vec3 vec3d1 = player.getLook(1.0F);
        Vec3 vec3d2 = vec3d.addVector(vec3d1.xCoord * reach, vec3d1.yCoord * reach, vec3d1.zCoord * reach);
        MovingObjectPosition hit = player.worldObj.rayTraceBlocks(vec3d, vec3d2);
        if(hit == null || hit.typeOfHit != MovingObjectType.BLOCK)
        {
            return null;
        }
       
View Full Code Here

TOP

Related Classes of net.minecraft.util.MovingObjectPosition

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.