001 package net.minecraft.util;
002
003 import net.minecraft.entity.Entity;
004
005 public class MovingObjectPosition
006 {
007 /** What type of ray trace hit was this? 0 = block, 1 = entity */
008 public EnumMovingObjectType typeOfHit;
009
010 /** x coordinate of the block ray traced against */
011 public int blockX;
012
013 /** y coordinate of the block ray traced against */
014 public int blockY;
015
016 /** z coordinate of the block ray traced against */
017 public int blockZ;
018
019 /**
020 * Which side was hit. If its -1 then it went the full length of the ray trace. Bottom = 0, Top = 1, East = 2, West
021 * = 3, North = 4, South = 5.
022 */
023 public int sideHit;
024
025 /** The vector position of the hit */
026 public Vec3 hitVec;
027
028 /** The hit entity */
029 public Entity entityHit;
030
031 /** Used to determine what sub-segment is hit */
032 public int subHit = -1;
033
034 public MovingObjectPosition(int par1, int par2, int par3, int par4, Vec3 par5Vec3)
035 {
036 this.typeOfHit = EnumMovingObjectType.TILE;
037 this.blockX = par1;
038 this.blockY = par2;
039 this.blockZ = par3;
040 this.sideHit = par4;
041 this.hitVec = par5Vec3.myVec3LocalPool.getVecFromPool(par5Vec3.xCoord, par5Vec3.yCoord, par5Vec3.zCoord);
042 }
043
044 public MovingObjectPosition(Entity par1Entity)
045 {
046 this.typeOfHit = EnumMovingObjectType.ENTITY;
047 this.entityHit = par1Entity;
048 this.hitVec = par1Entity.worldObj.getWorldVec3Pool().getVecFromPool(par1Entity.posX, par1Entity.posY, par1Entity.posZ);
049 }
050 }