下面列出了net.minecraft.util.EnumFacing#UP 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public EnumFacing getFacingFromMeta(int meta) {
if (meta == 0 || meta == 6) {
return EnumFacing.EAST;
}
if (meta == 1 || meta == 7) {
return EnumFacing.WEST;
}
if (meta == 2 || meta == 8) {
return EnumFacing.NORTH;
}
if (meta == 3 || meta == 9) {
return EnumFacing.SOUTH;
}
if (meta == 4 || meta == 10) {
return EnumFacing.UP;
}
if (meta == 5 || meta == 11) {
return EnumFacing.DOWN;
}
return EnumFacing.EAST;
}
public EnumFacing toForgeDirection() {
switch (this) {
case XNeg:
return EnumFacing.WEST;
case XPos:
return EnumFacing.EAST;
case YNeg:
return EnumFacing.DOWN;
case YPos:
return EnumFacing.UP;
case ZNeg:
return EnumFacing.NORTH;
case ZPos:
return EnumFacing.SOUTH;
default:
throw new IllegalArgumentException(toString());
}
}
@Override
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
{
if (net.minecraftforge.common.ForgeModContainer.disableStairSlabCulling)
return super.doesSideBlockRendering(state, world, pos, face);
if (state.isOpaqueCube())
return true;
net.minecraft.block.BlockSlab.EnumBlockHalf side = state.getValue(HALF);
return (side == net.minecraft.block.BlockSlab.EnumBlockHalf.TOP && face == EnumFacing.UP) || (side == net.minecraft.block.BlockSlab.EnumBlockHalf.BOTTOM && face == EnumFacing.DOWN);
}
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
if (side == EnumFacing.UP)
{
return true;
} else
{
return blockAccess.getBlockState(pos.offset(side)).getBlock() == this ? true : super.shouldSideBeRendered(state, blockAccess, pos, side);
}
}
public static RenderSide bySide(EnumFacing side) {
if (side == EnumFacing.UP) {
return TOP;
} else if (side == EnumFacing.DOWN) {
return BOTTOM;
} else return SIDE;
}
@Override
protected void onImpact(RayTraceResult result) {
if (result.sideHit == EnumFacing.UP) {
inGround = true;
blockPosCollidedAt = result.getBlockPos();
} else {
if (result.sideHit.getAxis() == EnumFacing.Axis.Z) {
this.motionZ = 0;
} else if (result.sideHit.getAxis() == EnumFacing.Axis.X) {
this.motionX = 0;
} else if (result.sideHit.getAxis() == EnumFacing.Axis.Y) {
this.motionY = 0;
}
}
}
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (facing != EnumFacing.UP) {
return EnumActionResult.FAIL;
} else {
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
if (!block.isReplaceable(worldIn, pos)) {
pos = pos.offset(facing);
}
ItemStack itemstack = player.getHeldItem(hand);
if (player.canPlayerEdit(pos, facing, itemstack) && this.block.canPlaceBlockAt(worldIn, pos)) {
EnumFacing enumfacing = EnumFacing.fromAngle((double) player.rotationYaw);
int i = enumfacing.getFrontOffsetX();
int j = enumfacing.getFrontOffsetZ();
boolean flag = i < 0 && hitZ < 0.5F || i > 0 && hitZ > 0.5F || j < 0 && hitX > 0.5F || j > 0 && hitX < 0.5F;
placeDoor(worldIn, pos, enumfacing, this.block, flag);
SoundType soundtype = worldIn.getBlockState(pos).getBlock().getSoundType(worldIn.getBlockState(pos), worldIn, pos, player);
worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
itemstack.shrink(1);
return EnumActionResult.SUCCESS;
} else {
return EnumActionResult.FAIL;
}
}
}
@SubscribeEvent
public void drawBlockHighlightEvent(DrawBlockHighlightEvent evt)
{
RayTraceResult target = evt.getTarget();
if(target.typeOfHit != RayTraceResult.Type.BLOCK)
return;
World world = evt.getPlayer().world;
EntityPlayer player = evt.getPlayer();
IBlockState state = world.getBlockState(target.getBlockPos());
double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.getPartialTicks();
double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.getPartialTicks();
double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.getPartialTicks();
double hitX = Math.round((target.hitVec.xCoord - target.getBlockPos().getX())*100)/100.0d;
double hitY = Math.round((target.hitVec.yCoord - target.getBlockPos().getY())*100)/100.0d;
double hitZ = Math.round((target.hitVec.zCoord - target.getBlockPos().getZ())*100)/100.0d;
AxisAlignedBB box = null;
int index = getIndex(hitX, hitZ);
if((state.getBlock() == TFCBlocks.SmallVessel) || (target.sideHit == EnumFacing.UP && player.getHeldItemMainhand().getItem() == TFCItems.PotteryVessel &&
state.getBlock().isSideSolid(state, world, target.getBlockPos(), EnumFacing.UP) && player.isSneaking() && player.getHeldItemMainhand().getItemDamage() == 1))
{
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.disableCull();
if(index == 0)
box = aabb0.offset(target.getBlockPos());
else if(index == 1)
box = aabb1.offset(target.getBlockPos());
else if(index == 2)
box = aabb2.offset(target.getBlockPos());
else
box = aabb3.offset(target.getBlockPos());
if(state.getBlock() != TFCBlocks.SmallVessel)
box = box.offset(0, 1, 0);
GlStateManager.enableTexture2D();
Core.bindTexture(selectTex);
drawFace(box.expand(0.002F, 0.002F, 0.002F).offset(-posX, -posY, -posZ), new float[]{1f,1f,1f, 1f}, EnumFacing.UP);
GlStateManager.disableTexture2D();
GlStateManager.enableCull();
GlStateManager.disableBlend();
}
}
public WrapperEnumFacing getUP() {
return new WrapperEnumFacing(EnumFacing.UP);
}
private void renderFullnessBar(float fullness, double x, double y, double z, EnumFacing side, EnumFacing barrelFront)
{
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
if (side == EnumFacing.UP || side == EnumFacing.DOWN)
{
GlStateManager.rotate(LABEL_ROT_SIDE_Y[barrelFront.getIndex()], 0, 1, 0);
GlStateManager.rotate(90f * side.getYOffset(), 1, 0, 0);
}
else
{
GlStateManager.rotate(LABEL_ROT_SIDE_Y[side.getIndex()], 0, 1, 0);
}
GlStateManager.translate(-0.3, -0.43, -0.001);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
int r_b = 0x03;
int g_b = 0x03;
int b_b = 0x20;
buffer.pos( 0, 0, 0).color(r_b, g_b, b_b, 255).endVertex();
buffer.pos( 0, 0.08, 0).color(r_b, g_b, b_b, 255).endVertex();
buffer.pos(0.6, 0.08, 0).color(r_b, g_b, b_b, 255).endVertex();
buffer.pos(0.6, 0, 0).color(r_b, g_b, b_b, 255).endVertex();
int r_f = 0x20;
int g_f = 0x90;
int b_f = 0xF0;
float e = fullness * 0.57f;
buffer.pos(0.585 , 0.065, -0.001).color(r_f, g_f, b_f, 255).endVertex();
buffer.pos(0.585 , 0.015, -0.001).color(r_f, g_f, b_f, 255).endVertex();
buffer.pos(0.585 - e, 0.015, -0.001).color(r_f, g_f, b_f, 255).endVertex();
buffer.pos(0.585 - e, 0.065, -0.001).color(r_f, g_f, b_f, 255).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos origPos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
ItemStack stack = playerIn.getHeldItem(hand);
IBlockState iblockstate = worldIn.getBlockState(origPos);
Block block = iblockstate.getBlock();
BlockPos pos = origPos.offset(side);
if (stack.getMaxStackSize() == 0)
{
return EnumActionResult.FAIL;
}
if (!playerIn.canPlayerEdit(pos, side, stack))
{
return EnumActionResult.FAIL;
}
if (worldIn.mayPlace(this.block, pos, false, side, (Entity)null))
{
int meta = getMetadata(stack.getMetadata());
IBlockState scanState;
//Scan out to make sure there is another beam in the facing direction
int range = WoodType.getTypeFromMeta(stack.getItemDamage()).getSupportRange();
BlockPos scanPos;
int foundRange = -1;
if(side == EnumFacing.UP || side == EnumFacing.DOWN)
{
foundRange = 1;
}
for(int i = 1; i <= range && foundRange == -1; i++)
{
scanPos = origPos.offset(side, i);
scanState = worldIn.getBlockState(scanPos);
scanState = scanState.getBlock().getActualState(scanState, worldIn, scanPos);
if(scanState.getBlock() instanceof BlockWoodSupport)
{
if(!scanState.getValue(BlockWoodSupport.SPAN))
{
foundRange = i;
break;
}
}
else if(scanState.getBlock().isReplaceable(worldIn, pos))
{
continue;
}
else
{
break;
}
}
if(foundRange != -1 && stack.getMaxStackSize() >= foundRange)
{
for(int i = 1; i <= foundRange; i++)
{
scanPos = origPos.offset(side, i);
IBlockState iblockstate1 = this.block.getStateForPlacement(worldIn, scanPos.offset(side.getOpposite()), side, hitX, hitY, hitZ, meta, playerIn);
if (placeBlockAt(stack, playerIn, worldIn, scanPos, side, hitX, hitY, hitZ, iblockstate1))
{
worldIn.playSound(scanPos.getX() + 0.5F, scanPos.getY() + 0.5F, scanPos.getZ() + 0.5F, this.block.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, (this.block.getSoundType().getVolume() + 1.0F) / 2.0F, this.block.getSoundType().getPitch() * 0.8F, true);
stack.shrink(1);
}
}
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
@Override
public boolean canConnectTo(EnumFacing side, IAgriConnectable connectable) {
return (side != EnumFacing.UP)
&& (connectable instanceof IAgriFluidComponent)
&& (connectable.canConnectTo(EnumFacing.UP, this));
}
@Override
public boolean activate(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack heldItem = player.getHeldItem(hand);
if(heldItem.getItem()!=null) {
if(heldItem.getItem() instanceof ItemWrench) {
if (side == EnumFacing.UP || side == EnumFacing.DOWN){
if (Math.abs(hitX-0.75) > Math.abs(hitZ-0.75)){
if (hitX < 0.75){
this.west = forceConnection(west);
}
else {
this.east = forceConnection(east);
}
}
else {
if (hitZ < 0.75){
this.north = forceConnection(north);
}
else {
this.south = forceConnection(south);
}
}
}
if (side == EnumFacing.EAST || side == EnumFacing.WEST){
if (Math.abs(hitY-0.75) > Math.abs(hitZ-0.75)){
if (hitY < 0.75){
this.down = forceConnection(down);
}
else {
this.up = forceConnection(up);
}
}
else {
if (hitZ < 0.75){
this.north = forceConnection(north);
}
else {
this.south = forceConnection(south);
}
}
}
if (side == EnumFacing.NORTH || side == EnumFacing.SOUTH){
if (Math.abs(hitX-0.75) > Math.abs(hitY-0.75)){
if (hitX < 0.75){
this.west = forceConnection(west);
}
else {
this.east = forceConnection(east);
}
}
else {
if (hitY < 0.75){
this.down = forceConnection(down);
}
else {
this.up = forceConnection(up);
}
}
}
getAdjacentPipes(world);
markDirty();
return true;
}
}
return false;
}
private void renderLockIcon(double x, double y, double z, double offsetX, double offsetY,
EnumFacing side, EnumFacing barrelFront, ResourceLocation texture)
{
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
if (side == EnumFacing.UP || side == EnumFacing.DOWN)
{
GlStateManager.rotate(LABEL_ROT_SIDE_Y[barrelFront.getIndex()], 0, 1, 0);
GlStateManager.rotate(90f * side.getYOffset(), 1, 0, 0);
}
else
{
GlStateManager.rotate(LABEL_ROT_SIDE_Y[side.getIndex()], 0, 1, 0);
}
GlStateManager.rotate(180, 0, 0, 1);
GlStateManager.translate(offsetX, offsetY, -0.001);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.enableRescaleNormal();
GlStateManager.disableLighting();
this.mc.getTextureManager().bindTexture(texture);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos( 0, 0, 0).tex(0, 0).endVertex();
buffer.pos( 0, 0.15, 0).tex(0, 1).endVertex();
buffer.pos(0.15, 0.15, 0).tex(1, 1).endVertex();
buffer.pos(0.15, 0, 0).tex(1, 0).endVertex();
tessellator.draw();
GlStateManager.disableRescaleNormal();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
ItemStack itemstack = player.getHeldItem(hand);
if (!itemstack.isEmpty() && player.canPlayerEdit(pos, facing, itemstack))
{
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
BlockPos blockpos = pos;
if ((facing != EnumFacing.UP || block != this.block) && !block.isReplaceable(worldIn, pos))
{
blockpos = pos.offset(facing);
iblockstate = worldIn.getBlockState(blockpos);
block = iblockstate.getBlock();
}
if (block == this.block)
{
int i = iblockstate.getValue(BlockSnow.LAYERS);
if (i < 8)
{
IBlockState iblockstate1 = iblockstate.withProperty(BlockSnow.LAYERS, i + 1);
AxisAlignedBB axisalignedbb = iblockstate1.getCollisionBoundingBox(worldIn, blockpos);
if (axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(blockpos)) && worldIn.setBlockState(blockpos, iblockstate1, 10))
{
SoundType soundtype = this.block.getSoundType(iblockstate1, worldIn, pos, player);
worldIn.playSound(player, blockpos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
if (player instanceof EntityPlayerMP)
{
CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP)player, pos, itemstack);
}
itemstack.shrink(1);
return EnumActionResult.SUCCESS;
}
}
}
return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
else
{
return EnumActionResult.FAIL;
}
}
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand,
EnumFacing facing, float hitX, float hitY, float hitZ) {
if (worldIn.isRemote) {
return EnumActionResult.SUCCESS;
} else if (facing != EnumFacing.UP) {
return EnumActionResult.FAIL;
} else {
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
boolean flag = block.isReplaceable(worldIn, pos);
if (!flag) {
pos = pos.up();
}
int i = MathHelper.floor(playerIn.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
EnumFacing enumfacing = EnumFacing.getHorizontal(i);
BlockPos blockpos = pos.offset(enumfacing);
ItemStack itemstack = playerIn.getHeldItem(hand);
if (playerIn.canPlayerEdit(pos, facing, itemstack) && playerIn.canPlayerEdit(blockpos, facing, itemstack)) {
boolean flag1 = worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
boolean flag2 = flag || worldIn.isAirBlock(pos);
boolean flag3 = flag1 || worldIn.isAirBlock(blockpos);
if (flag2 && flag3 && worldIn.getBlockState(pos.down()).isTopSolid()
&& worldIn.getBlockState(blockpos.down()).isFullCube()) {
IBlockState iblockstate1 = BlockLoader.FUTON.getDefaultState()
.withProperty(BlockFuton.OCCUPIED, Boolean.valueOf(false))
.withProperty(BlockHorizontal.FACING, enumfacing)
.withProperty(BlockFuton.PART, BlockFuton.EnumPartType.FOOT);
if (worldIn.setBlockState(pos, iblockstate1, 11)) {
IBlockState iblockstate2 = iblockstate1.withProperty(BlockFuton.PART,
BlockFuton.EnumPartType.HEAD);
worldIn.setBlockState(blockpos, iblockstate2, 11);
}
SoundType soundtype = iblockstate1.getBlock().getSoundType(iblockstate1, worldIn, pos, playerIn);
worldIn.playSound(null, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS,
(soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
itemstack.shrink(1);
return EnumActionResult.SUCCESS;
}
return EnumActionResult.FAIL;
}
return EnumActionResult.FAIL;
}
}
public EnumFacing getHeadingForNode(){
if (route.peek() == null) {
return EnumFacing.UP;
}
return route.pop();
}
@SubscribeEvent
public void drawBlockHighlightEvent(DrawBlockHighlightEvent evt)
{
if(evt.getTarget().typeOfHit != RayTraceResult.Type.BLOCK)
return;
if(evt.getTarget().sideHit != EnumFacing.UP)
return;
World world = evt.getPlayer().world;
if(world.getBlockState(evt.getTarget().getBlockPos()).getBlock() != TFCBlocks.Anvil)
return;
double posX = evt.getPlayer().lastTickPosX + (evt.getPlayer().posX - evt.getPlayer().lastTickPosX) * evt.getPartialTicks();
double posY = evt.getPlayer().lastTickPosY + (evt.getPlayer().posY - evt.getPlayer().lastTickPosY) * evt.getPartialTicks();
double posZ = evt.getPlayer().lastTickPosZ + (evt.getPlayer().posZ - evt.getPlayer().lastTickPosZ) * evt.getPartialTicks();
double hitX = Math.round((evt.getTarget().hitVec.xCoord - evt.getTarget().getBlockPos().getX())*100)/100.0d;
double hitY = Math.round((evt.getTarget().hitVec.yCoord - evt.getTarget().getBlockPos().getY())*100)/100.0d;
double hitZ = Math.round((evt.getTarget().hitVec.zCoord - evt.getTarget().getBlockPos().getZ())*100)/100.0d;
int divX = (int) Math.floor(hitX * 8);
int divY = (int) Math.floor(hitY * 8);
int divZ = (int) Math.floor(hitZ * 8);
//get the targeted sub block coords
double subX = divX/8D;
double subY = divY/8D;
double subZ = divZ/8D;
TileAnvil te = (TileAnvil) world.getTileEntity(evt.getTarget().getBlockPos());
EnumFacing facing = world.getBlockState(evt.getTarget().getBlockPos()).getValue(BlockAnvil.FACING);
if(facing == EnumFacing.NORTH || facing == EnumFacing.SOUTH)
{
if(divX == 0 || divX == 7 || divZ < 2 || divZ > 5)
return;
divX -= 1; divZ -= 2;
if(te.getStrikePoint(divX, divZ) == null)
return;
}
if(facing == EnumFacing.EAST || facing == EnumFacing.WEST)
{
if(divZ == 0 || divZ == 7 || divX < 2 || divX > 5)
return;
divX -= 2; divZ -= 1;
if(te.getStrikePoint(divZ, divX) == null)
return;
}
//create the box size
double minX = evt.getTarget().getBlockPos().getX() + subX;
double minY = evt.getTarget().getBlockPos().getY() + subY;
double minZ = evt.getTarget().getBlockPos().getZ() + subZ;
double maxX = minX + 0.125;
double maxY = minY + 0.07;
double maxZ = minZ + 0.125;
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.disableCull();
GlStateManager.disableTexture2D();
//Draw the mini Box
drawBox(new AxisAlignedBB(minX,minY,minZ,maxX,maxY,maxZ).expand(0.002F, 0.002F, 0.002F).offset(-posX, -posY, -posZ), new float[]{1,0.5f,0, 0.5f});
GlStateManager.enableTexture2D();
GlStateManager.enableCull();
GlStateManager.disableBlend();
}
@Override
public boolean emitsEnergyTo(IEnergyAcceptor var1, EnumFacing side) {
return side == EnumFacing.UP;
}
public static RayTraceResult getViewTrace(
Entity entity, Vec3d direction, float partialTicks, double reach, double reachAttack) {
if (entity == null) {
return null;
}
Vec3d eyes = entity.getPositionEyes(partialTicks);
RayTraceResult trace = entity.rayTrace(reach, partialTicks);
Vec3d dir = direction.scale(reach);
Vec3d lookDir = eyes.add(dir);
double hitDistance = trace == null ? reachAttack : trace.hitVec.distanceTo(eyes);
Entity hitEntity = null;
Vec3d hitEntityVec = null;
for (Entity ent :
getWorld()
.getEntitiesInAABBexcluding(
entity,
entity.getEntityBoundingBox().expand(dir.x, dir.y, dir.y).grow(1.D),
Predicates.and(
EntitySelectors.NOT_SPECTATING,
ent -> ent != null && ent.canBeCollidedWith()))) {
AxisAlignedBB bb = ent.getEntityBoundingBox().grow(ent.getCollisionBorderSize());
RayTraceResult tr = bb.calculateIntercept(eyes, lookDir);
if (bb.contains(eyes)) {
if (hitDistance > 0.D) {
hitEntity = ent;
hitEntityVec = tr == null ? eyes : tr.hitVec;
hitDistance = 0.D;
}
} else if (tr != null) {
double dist = eyes.distanceTo(tr.hitVec);
if (dist < hitDistance || hitDistance == 0.D) {
if (entity.getLowestRidingEntity() == ent.getLowestRidingEntity()
&& !ent.canRiderInteract()) {
if (hitDistance == 0.D) {
hitEntity = ent;
hitEntityVec = tr.hitVec;
}
} else {
hitEntity = ent;
hitEntityVec = tr.hitVec;
hitDistance = dist;
}
}
}
}
if (hitEntity != null && reach > 3.D && eyes.distanceTo(hitEntityVec) > 3.D) {
return new RayTraceResult(Type.MISS, hitEntityVec, EnumFacing.UP, new BlockPos(hitEntityVec));
} else if (hitEntity != null && trace == null && hitDistance < reachAttack) {
return new RayTraceResult(hitEntity, hitEntityVec);
} else {
return trace;
}
}