本文整理汇总了Java中net.minecraft.util.math.MathHelper.epsilonEquals方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.epsilonEquals方法的具体用法?Java MathHelper.epsilonEquals怎么用?Java MathHelper.epsilonEquals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.math.MathHelper
的用法示例。
在下文中一共展示了MathHelper.epsilonEquals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyFacing
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
private void applyFacing(int[] p_178408_1_, EnumFacing p_178408_2_)
{
int[] aint = new int[p_178408_1_.length];
System.arraycopy(p_178408_1_, 0, aint, 0, p_178408_1_.length);
float[] afloat = new float[EnumFacing.values().length];
afloat[EnumFaceDirection.Constants.WEST_INDEX] = 999.0F;
afloat[EnumFaceDirection.Constants.DOWN_INDEX] = 999.0F;
afloat[EnumFaceDirection.Constants.NORTH_INDEX] = 999.0F;
afloat[EnumFaceDirection.Constants.EAST_INDEX] = -999.0F;
afloat[EnumFaceDirection.Constants.UP_INDEX] = -999.0F;
afloat[EnumFaceDirection.Constants.SOUTH_INDEX] = -999.0F;
int i = p_178408_1_.length / 4;
for (int j = 0; j < 4; ++j)
{
int k = i * j;
float f = Float.intBitsToFloat(aint[k]);
float f1 = Float.intBitsToFloat(aint[k + 1]);
float f2 = Float.intBitsToFloat(aint[k + 2]);
if (f < afloat[EnumFaceDirection.Constants.WEST_INDEX])
{
afloat[EnumFaceDirection.Constants.WEST_INDEX] = f;
}
if (f1 < afloat[EnumFaceDirection.Constants.DOWN_INDEX])
{
afloat[EnumFaceDirection.Constants.DOWN_INDEX] = f1;
}
if (f2 < afloat[EnumFaceDirection.Constants.NORTH_INDEX])
{
afloat[EnumFaceDirection.Constants.NORTH_INDEX] = f2;
}
if (f > afloat[EnumFaceDirection.Constants.EAST_INDEX])
{
afloat[EnumFaceDirection.Constants.EAST_INDEX] = f;
}
if (f1 > afloat[EnumFaceDirection.Constants.UP_INDEX])
{
afloat[EnumFaceDirection.Constants.UP_INDEX] = f1;
}
if (f2 > afloat[EnumFaceDirection.Constants.SOUTH_INDEX])
{
afloat[EnumFaceDirection.Constants.SOUTH_INDEX] = f2;
}
}
EnumFaceDirection enumfacedirection = EnumFaceDirection.getFacing(p_178408_2_);
for (int j1 = 0; j1 < 4; ++j1)
{
int k1 = i * j1;
EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = enumfacedirection.getVertexInformation(j1);
float f8 = afloat[enumfacedirection$vertexinformation.xIndex];
float f3 = afloat[enumfacedirection$vertexinformation.yIndex];
float f4 = afloat[enumfacedirection$vertexinformation.zIndex];
p_178408_1_[k1] = Float.floatToRawIntBits(f8);
p_178408_1_[k1 + 1] = Float.floatToRawIntBits(f3);
p_178408_1_[k1 + 2] = Float.floatToRawIntBits(f4);
for (int l = 0; l < 4; ++l)
{
int i1 = i * l;
float f5 = Float.intBitsToFloat(aint[i1]);
float f6 = Float.intBitsToFloat(aint[i1 + 1]);
float f7 = Float.intBitsToFloat(aint[i1 + 2]);
if (MathHelper.epsilonEquals(f8, f5) && MathHelper.epsilonEquals(f3, f6) && MathHelper.epsilonEquals(f4, f7))
{
p_178408_1_[k1 + 4] = aint[i1 + 4];
p_178408_1_[k1 + 4 + 1] = aint[i1 + 4 + 1];
}
}
}
}
示例2: applyFacing
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
private void applyFacing(int[] p_178408_1_, EnumFacing p_178408_2_)
{
int[] aint = new int[p_178408_1_.length];
System.arraycopy(p_178408_1_, 0, aint, 0, p_178408_1_.length);
float[] afloat = new float[EnumFacing.values().length];
afloat[EnumFaceDirection.Constants.WEST_INDEX] = 999.0F;
afloat[EnumFaceDirection.Constants.DOWN_INDEX] = 999.0F;
afloat[EnumFaceDirection.Constants.NORTH_INDEX] = 999.0F;
afloat[EnumFaceDirection.Constants.EAST_INDEX] = -999.0F;
afloat[EnumFaceDirection.Constants.UP_INDEX] = -999.0F;
afloat[EnumFaceDirection.Constants.SOUTH_INDEX] = -999.0F;
for (int i = 0; i < 4; ++i)
{
int j = 7 * i;
float f = Float.intBitsToFloat(aint[j]);
float f1 = Float.intBitsToFloat(aint[j + 1]);
float f2 = Float.intBitsToFloat(aint[j + 2]);
if (f < afloat[EnumFaceDirection.Constants.WEST_INDEX])
{
afloat[EnumFaceDirection.Constants.WEST_INDEX] = f;
}
if (f1 < afloat[EnumFaceDirection.Constants.DOWN_INDEX])
{
afloat[EnumFaceDirection.Constants.DOWN_INDEX] = f1;
}
if (f2 < afloat[EnumFaceDirection.Constants.NORTH_INDEX])
{
afloat[EnumFaceDirection.Constants.NORTH_INDEX] = f2;
}
if (f > afloat[EnumFaceDirection.Constants.EAST_INDEX])
{
afloat[EnumFaceDirection.Constants.EAST_INDEX] = f;
}
if (f1 > afloat[EnumFaceDirection.Constants.UP_INDEX])
{
afloat[EnumFaceDirection.Constants.UP_INDEX] = f1;
}
if (f2 > afloat[EnumFaceDirection.Constants.SOUTH_INDEX])
{
afloat[EnumFaceDirection.Constants.SOUTH_INDEX] = f2;
}
}
EnumFaceDirection enumfacedirection = EnumFaceDirection.getFacing(p_178408_2_);
for (int i1 = 0; i1 < 4; ++i1)
{
int j1 = 7 * i1;
EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = enumfacedirection.getVertexInformation(i1);
float f8 = afloat[enumfacedirection$vertexinformation.xIndex];
float f3 = afloat[enumfacedirection$vertexinformation.yIndex];
float f4 = afloat[enumfacedirection$vertexinformation.zIndex];
p_178408_1_[j1] = Float.floatToRawIntBits(f8);
p_178408_1_[j1 + 1] = Float.floatToRawIntBits(f3);
p_178408_1_[j1 + 2] = Float.floatToRawIntBits(f4);
for (int k = 0; k < 4; ++k)
{
int l = 7 * k;
float f5 = Float.intBitsToFloat(aint[l]);
float f6 = Float.intBitsToFloat(aint[l + 1]);
float f7 = Float.intBitsToFloat(aint[l + 2]);
if (MathHelper.epsilonEquals(f8, f5) && MathHelper.epsilonEquals(f3, f6) && MathHelper.epsilonEquals(f4, f7))
{
p_178408_1_[j1 + 4] = aint[l + 4];
p_178408_1_[j1 + 4 + 1] = aint[l + 4 + 1];
}
}
}
}