本文整理匯總了Java中net.minecraft.util.math.Vec3i.getY方法的典型用法代碼示例。如果您正苦於以下問題:Java Vec3i.getY方法的具體用法?Java Vec3i.getY怎麽用?Java Vec3i.getY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.math.Vec3i
的用法示例。
在下文中一共展示了Vec3i.getY方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onWorldDraw
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
@Override
protected void onWorldDraw(float delta, float x, float y, float z) {
float mx, my, mz;
if (!safeShow) return;
if (--safeUpdate < 0) {
safeUpdate = 13;
reCheckSafe(fix(x), fix(y), fix(z));
}
if (safeGhost) GL11.glDisable(GL11.GL_DEPTH_TEST);
else GL11.glEnable( GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_FOG);
GL11.glBegin(GL11.GL_LINES);
for (int i = 0; i < safeCur; ++i) {
Vec3i pos = safePoses[i];
Color color = safeMarks[i];
GL11.glColor3ub(color.rb, color.gb, color.bb);
mx = pos.getX() - x; my = pos.getY() - y; mz = pos.getZ() - z;
GL11.glVertex3f(mx+0.9f,my+0.01f,mz+0.9f);
GL11.glVertex3f(mx+0.1f,my+0.01f,mz+0.1f);
GL11.glVertex3f(mx+0.9f,my+0.01f,mz+0.1f);
GL11.glVertex3f(mx+0.1f,my+0.01f,mz+0.9f);
}
GL11.glEnd();
}
示例2: rotateFacePerspective
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
/**
* Rotates given surface vector around the center of the texture by the given degree.
*
*/
protected static Vec3i rotateFacePerspective(Vec3i vec, Rotation rotation, TextureScale scale)
{
switch(rotation)
{
case ROTATE_90:
return new Vec3i(vec.getY(), scale.sliceCountMask - vec.getX(), vec.getZ());
case ROTATE_180:
return new Vec3i(scale.sliceCountMask - vec.getX(), scale.sliceCountMask - vec.getY(), vec.getZ());
case ROTATE_270:
return new Vec3i(scale.sliceCountMask - vec.getY(), vec.getX(), vec.getZ());
case ROTATE_NONE:
default:
return vec;
}
}
示例3: sizeInChunksNear
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
public int sizeInChunksNear(BlockPos pos, int chunkRadius)
{
int result = 0;
int i = 0;
Vec3i offset = Useful.getDistanceSortedCircularOffset(i);
while(offset.getY() <= chunkRadius)
{
result += sizeInChunkAt(pos.add(offset.getX() * 16, 0, offset.getZ() * 16));
offset = Useful.getDistanceSortedCircularOffset(++i);
}
return result;
}
示例4: existingChunksNear
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
public Iterator<T> existingChunksNear(BlockPos pos, int chunkRadius)
{
return new AbstractIterator<T>()
{
private int i = 0;
@Override
protected T computeNext()
{
Vec3i offset = Useful.getDistanceSortedCircularOffset(i++);
while(offset != null && offset.getY() <= chunkRadius)
{
T result = getIfExists(pos.add(offset.getX() * 16, 0, offset.getZ() * 16));
if(result != null) return result;
offset = Useful.getDistanceSortedCircularOffset(i++);
}
return (T)this.endOfData();
}
};
}
示例5: rotate
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
public static EnumFacing rotate(Matrix4f matrix, EnumFacing facing)
{
Vec3i dir = facing.getDirectionVec();
Vector4f vec = new Vector4f(dir.getX(), dir.getY(), dir.getZ(), 0);
matrix.transform(vec);
return EnumFacing.getFacingFromVector(vec.x, vec.y, vec.z);
}
示例6: getFacingFromVertexData
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
public static EnumFacing getFacingFromVertexData(int[] faceData)
{
Vector3f vector3f = new Vector3f(Float.intBitsToFloat(faceData[0]), Float.intBitsToFloat(faceData[1]), Float.intBitsToFloat(faceData[2]));
Vector3f vector3f1 = new Vector3f(Float.intBitsToFloat(faceData[7]), Float.intBitsToFloat(faceData[8]), Float.intBitsToFloat(faceData[9]));
Vector3f vector3f2 = new Vector3f(Float.intBitsToFloat(faceData[14]), Float.intBitsToFloat(faceData[15]), Float.intBitsToFloat(faceData[16]));
Vector3f vector3f3 = new Vector3f();
Vector3f vector3f4 = new Vector3f();
Vector3f vector3f5 = new Vector3f();
Vector3f.sub(vector3f, vector3f1, vector3f3);
Vector3f.sub(vector3f2, vector3f1, vector3f4);
Vector3f.cross(vector3f4, vector3f3, vector3f5);
float f = (float)Math.sqrt((double)(vector3f5.x * vector3f5.x + vector3f5.y * vector3f5.y + vector3f5.z * vector3f5.z));
vector3f5.x /= f;
vector3f5.y /= f;
vector3f5.z /= f;
EnumFacing enumfacing = null;
float f1 = 0.0F;
for (EnumFacing enumfacing1 : EnumFacing.values())
{
Vec3i vec3i = enumfacing1.getDirectionVec();
Vector3f vector3f6 = new Vector3f((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ());
float f2 = Vector3f.dot(vector3f5, vector3f6);
if (f2 >= 0.0F && f2 > f1)
{
f1 = f2;
enumfacing = enumfacing1;
}
}
if (enumfacing == null)
{
return EnumFacing.UP;
}
else
{
return enumfacing;
}
}
示例7: getFacingFromVertexData
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
public static EnumFacing getFacingFromVertexData(int[] faceData)
{
Vector3f vector3f = new Vector3f(Float.intBitsToFloat(faceData[0]), Float.intBitsToFloat(faceData[1]), Float.intBitsToFloat(faceData[2]));
Vector3f vector3f1 = new Vector3f(Float.intBitsToFloat(faceData[7]), Float.intBitsToFloat(faceData[8]), Float.intBitsToFloat(faceData[9]));
Vector3f vector3f2 = new Vector3f(Float.intBitsToFloat(faceData[14]), Float.intBitsToFloat(faceData[15]), Float.intBitsToFloat(faceData[16]));
Vector3f vector3f3 = new Vector3f();
Vector3f vector3f4 = new Vector3f();
Vector3f vector3f5 = new Vector3f();
Vector3f.sub(vector3f, vector3f1, vector3f3);
Vector3f.sub(vector3f2, vector3f1, vector3f4);
Vector3f.cross(vector3f4, vector3f3, vector3f5);
float f = (float)Math.sqrt(vector3f5.x * vector3f5.x + vector3f5.y * vector3f5.y + vector3f5.z * vector3f5.z);
vector3f5.x /= f;
vector3f5.y /= f;
vector3f5.z /= f;
EnumFacing enumfacing = null;
float f1 = 0.0F;
for (EnumFacing enumfacing1 : EnumFacing.values())
{
Vec3i vec3i = enumfacing1.getDirectionVec();
Vector3f vector3f6 = new Vector3f(vec3i.getX(), vec3i.getY(), vec3i.getZ());
float f2 = Vector3f.dot(vector3f5, vector3f6);
if (f2 >= 0.0F && f2 > f1)
{
f1 = f2;
enumfacing = enumfacing1;
}
}
if (enumfacing == null)
{
return EnumFacing.UP;
}
else
{
return enumfacing;
}
}
示例8: getRotationMatrix
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
/**
* Create a matrix that rotates around the specified axis by the specified angle.
*
* @param axis The axis
* @param radians The angle in radians
* @return The rotation matrix
*/
public static Matrix3d getRotationMatrix(EnumFacing.Axis axis, double radians) {
final Vec3i axisDirectionVector = AXIS_DIRECTION_VECTORS.get(axis);
final AxisAngle4d axisAngle = new AxisAngle4d(axisDirectionVector.getX(), axisDirectionVector.getY(), axisDirectionVector.getZ(), radians);
final Matrix3d rotationMatrix = new Matrix3d();
rotationMatrix.set(axisAngle);
return rotationMatrix;
}
示例9: shootPlayer
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
private void shootPlayer(World world, BlockPos pos, Entity ent) {
if (!(ent instanceof EntityPlayer)) return;
IBlockState state = world.getBlockState(pos);
EnumFacing facing = state.getValue(PROPERTY_FACING);
Vec3i vec = facing.getDirectionVec();
//double scale = 1.2d;
Vec3d motion = new Vec3d(vec.getX()*scale, vec.getY()*scale, vec.getZ()*scale);
ent.motionX = adjustScalar(ent.motionX, motion.x);
ent.motionY = adjustScalar(ent.motionY, motion.y);
ent.motionZ = adjustScalar(ent.motionZ, motion.z);
}
示例10: isConnected
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
public boolean isConnected(World world, BlockPos from, BlockPos to){
Vec3i diff = from.subtract(to);
if(diff.getX() * diff.getZ() != 0)
return false;
return diff.getY() == 0 || !isBlockedDiagonal(world, from, to);
}
示例11: getNeighborACoordinate
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
@Override
public BlockPos getNeighborACoordinate(int index) {
if (index > Facing.values().length) index = 0;
Vec3i coord = Facing.values()[index].getDirectionVec();
return new BlockPos(
pos.getX() + coord.getX(),
pos.getY() + coord.getY(),
pos.getZ() + coord.getZ()
);
}
示例12: getSurfaceVector
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
/**
* Transform input vector so that x & y correspond with u / v on the given face, with u,v origin at upper left
* and z is depth, where positive values represent distance into the face (away from viewer). <br><br>
*
* Coordinates are start masked to the scale of the texture being used and when we reverse an orthogonalAxis,
* we use the texture's sliceMask as the basis so that we remain within the frame of the
* texture scale we are using. <br><br>
*
* Note that the x, y components are for determining min/max UV values.
* They should NOT be used to set vertex UV coordinates directly.
* All bigtex models should have lockUV = true, which means that
* uv coordinates will be derived at time of quad bake by projecting each
* vertex onto the plane of the quad's nominal face.
* Setting UV coordinates on a quad with lockUV=true has no effect.
*/
protected static Vec3i getSurfaceVector(Vec3i vec, EnumFacing face, TextureScale scale)
{
int sliceCountMask = scale.sliceCountMask;
int x = vec.getX() & sliceCountMask;
int y = vec.getY() & sliceCountMask;
int z = vec.getZ() & sliceCountMask;
switch(face)
{
case EAST:
return new Vec3i(sliceCountMask - z, sliceCountMask - y, -vec.getX());
case WEST:
return new Vec3i(z, sliceCountMask - y, vec.getX());
case NORTH:
return new Vec3i(sliceCountMask - x, sliceCountMask - y, vec.getZ());
case SOUTH:
return new Vec3i(x, sliceCountMask - y, -vec.getZ());
case DOWN:
return new Vec3i(x, sliceCountMask - z, vec.getY());
case UP:
default:
return new Vec3i(x, z, -vec.getY());
}
}
示例13: transform
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
/** returns a copy of this quad with the given transformation applied */
public RawQuad transform(Matrix4d matrix)
{
RawQuad result = this.clone();
// transform vertices
for(int i = 0; i < result.vertexCount; i++)
{
Vertex vertex = result.getVertex(i);
Vector4d temp = new Vector4d(vertex.x, vertex.y, vertex.z, 1.0);
matrix.transform(temp);
if(Math.abs(temp.w - 1.0) > 1e-5) temp.scale(1.0 / temp.w);
result.setVertex(i, vertex.withXYZ(temp.x, temp.y, temp.z));
}
// transform nominal face
// our matrix transform has block center as its origin,
// so need to translate face vectors to/from block center
// origin before/applying matrix.
if(this.face != null)
{
Vec3i curNorm = this.face.getDirectionVec();
Vector4d newFaceVec = new Vector4d(curNorm.getX() + 0.5, curNorm.getY() + 0.5, curNorm.getZ() + 0.5, 1.0);
matrix.transform(newFaceVec);
newFaceVec.x -= 0.5;
newFaceVec.y -= 0.5;
newFaceVec.z -= 0.5;
result.setFace(QuadHelper.computeFaceForNormal(newFaceVec));
}
return result;
}
示例14: placeRuneAtEntity
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
private void placeRuneAtEntity(IRune rune, ItemStack[][] pattern,World world, BlockPos lookPos, EnumFacing playerFacing,EntityPlayer player) {
Vec3i pos = rune.getEntityPosition();
int dX = pos.getX(),dY = pos.getY();
EnumFacing left = playerFacing.rotateYCCW();
BlockPos newTL = lookPos.offset(left, dX).offset(playerFacing, dY);
PlacePatternTopLeft(pattern, world, newTL, playerFacing, player);
}
示例15: makePlane
import net.minecraft.util.math.Vec3i; //導入方法依賴的package包/類
/**
* Makes a flat plane along two directions
*/
public static void makePlane(int startX, int startY, int startZ, int width, int height, EnumFacing right, EnumFacing up, IShapeable shapeable) {
if (width < 0 || height < 0) return;
int lineOffsetX, lineOffsetY, lineOffsetZ;
// We offset each line by up, and then apply it right
final Vec3i v = up.getDirectionVec();
for (int h = 0; h <= height; h++) {
lineOffsetX = startX + (h * v.getX());
lineOffsetY = startY + (h * v.getY());
lineOffsetZ = startZ + (h * v.getZ());
makeLine(lineOffsetX, lineOffsetY, lineOffsetZ, right, width, shapeable);
}
}