Java 类net.minecraft.util.math.Vec2f 实例源码

项目:BetterBeginningsReborn    文件:InfusionRender.java   
private void renderIngredients(TileEntityInfusionRepair te, double x, double y, double z, float partialTicks)
   {
GlStateManager.pushMatrix();
IItemHandler itemHandler = CapUtils.getItemHandler(te);
for(int slot = 0; slot < 8; slot++)
{
    ItemStack stack = itemHandler.getStackInSlot(TileEntityInfusionRepair.SLOT_ENCH_ITEM + 1 + slot);
    Vec2f ingredientPos = ingredientPositions[slot];
    if(Prep1_11.isEmpty(stack)) continue;

    GlStateManager.pushMatrix();
    GlStateManager.translate(ingredientPos.x * PIXEL_SIZE, -0.15F, ingredientPos.y * PIXEL_SIZE);
    GlStateManager.scale(0.5F, 0.5F, 0.5F);
    GlStateManager.rotate(((mc.player.ticksExisted + partialTicks) * 60.0f) / 10.0F, 0.0F, 1.0F, 0.0F);
    mc.getRenderItem().renderItem(stack, TransformType.GROUND);
    GlStateManager.scale(1.0F, 1.0F, 1.0F);
    GlStateManager.popMatrix();
}
GlStateManager.popMatrix();
   }
项目:Engination    文件:BlockGravityField.java   
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
    EnumFacing facing = EnumFacing.UP;
    Vec2f rot = placer.getPitchYaw();
    //System.out.println("Placer x: "+rot.x+" y:"+rot.y+" yaw:"+placer.getRotationYawHead());

    if (rot.x > 45) {
        facing = EnumFacing.DOWN;
    } else if (rot.x > -45) {
        facing = placer.getAdjustedHorizontalFacing();
    }

    world.setBlockState(pos,
            this.getStateFromMeta(stack.getMetadata())
                .withProperty(FACING, facing));
}
项目:MobTotems    文件:CarvingSelectorGui.java   
public TotemType getTypeHoveredOver(float centerX, float centerY, int mouseX, int mouseY) {
    TotemType typeHoveredOver = TotemType.NONE;
    for (TotemType type : TotemType.values()) {
        float baseAngle = (360 / TotemType.values().length);
        double angle = (baseAngle * type.getMeta()) - ANGLE_OFFSET;

        double mouseAngle = getMouseAngle(new Vec2f(centerX, centerY), new Vec2f(mouseX, mouseY));
        double minToCheck = sanitizeDegree(angle - (baseAngle / 2));
        double maxToCheck = sanitizeDegree(angle + (baseAngle / 2));
        if (minToCheck > maxToCheck) {
            minToCheck -= 360;
        }
        if (mouseAngle > minToCheck
                && mouseAngle < maxToCheck) {
            typeHoveredOver = type;
        }
    }
    return typeHoveredOver;
}
项目:Thermionics    文件:FX.java   
private static Vec2f pickPolar(float rmin, float rmax) {
    float yaw = rnd.nextFloat()*TAU;
    float dist = rnd.nextFloat()*(rmax-rmin) + rmin; 
    float x = MathHelper.cos(yaw)*dist;
    float z = MathHelper.sin(yaw)*dist;
    return new Vec2f(x,z);
}
项目:Thermionics    文件:FX.java   
private static void pickRing(float r, float angularDensity) {
    for(float theta = 0; theta<TAU; theta+=angularDensity) {
        float x = MathHelper.cos(theta)*r;
        float z = MathHelper.sin(theta)*r;
        locationBuffer.add(new Vec2f(x,z));
    }
}
项目:Thermionics    文件:FX.java   
@Override
public void update(World world) {
    if (ticks%3==0) {
        locationBuffer.clear();
        pickRing(0.5f, SEGMENTS);
        for(Vec2f vec : locationBuffer) {
            Particle particle = new ParticleVelocity(world,
                    x+vec.x, y+0.5f, z+vec.y,
                    0f, -0.3f, 0f
                    );
            particle.setParticleTextureIndex(5); //Midway through redstone
            particle.setRBGColorF(0.7f, 0.2f, 0.7f);


            Minecraft.getMinecraft().effectRenderer.addEffect(particle);
        }
    }
    float sx = (rnd.nextFloat()*2) - 1;
    float sz = (rnd.nextFloat()*2) - 1;
    if (rnd.nextBoolean()) {
        Particle star = new ParticleVelocity(world,
                x+sx, y-0.5f, z+sz,
                0f, 0.35f, 0f
                );
        star.setParticleTextureIndex(65); //Crit stars
        Minecraft.getMinecraft().effectRenderer.addEffect(star);
    }
    //star.setRBGColorF(0.7f, 0.2f, 0.7f);

    if (ticks>9) die();
}
项目:CustomWorldGen    文件:Entity.java   
/**
 * returns the Entity's pitch and yaw as a Vec2f
 */
@SideOnly(Side.CLIENT)
public Vec2f getPitchYaw()
{
    Vec2f vec2f = new Vec2f(this.rotationPitch, this.rotationYaw);
    return vec2f;
}
项目:ModularMachinery    文件:DynamicMachineRenderContext.java   
public Vec2f getCurrentRenderOffset(float x, float z) {
    Minecraft mc = Minecraft.getMinecraft();
    double sc = new ScaledResolution(mc).getScaleFactor();
    double oX = x + 16D / sc;
    double oZ = z + 16D / sc;
    Vec3d tr = getCurrentMachineTranslate();
    return new Vec2f((float) (oX + tr.x), (float) (oZ + tr.z));
}
项目:DynamicSurroundings    文件:MathStuff.java   
public static Vec2f rotate(@Nonnull final Vec2f coord, final float radians) {
       final float f = cos(radians);
       final float f1 = sin(radians);
       final float d0 = coord.x * f + coord.y * f1;
       final float d1 = coord.y * f - coord.x * f1;
       return new Vec2f(d0, d1);
}
项目:AquaMunda    文件:Plane.java   
public Vec2f intersect(Vec3d r1, Vec3d r2) {
//        System.out.println("Plane[" + v(s1) + " | " + v(s2) + " | " + v(s3) + " | " + v(s4) + "]");
//        System.out.println("    Ray[" + v(r1) + " | " + v(r2) + "]");

        Vec3d dS21 = s2.subtract(s1);
        Vec3d dS31 = s3.subtract(s1);
        Vec3d n = dS21.crossProduct(dS31);

        // 2.
        Vec3d dR = r1.subtract(r2);

        double ndotdR = n.dotProduct(dR);

        if (Math.abs(ndotdR) < 1e-6f) { // Choose your tolerance
            return null;
        }

        double t = -n.dotProduct(r1.subtract(s1)) / ndotdR;
        Vec3d M = r1.add(dR.scale(t));

        // 3.
        Vec3d dMS1 = M.subtract(s1);
        double u = dMS1.dotProduct(dS21);
        double v = dMS1.dotProduct(dS31);

//        System.out.println("    u = " + u + "," + v);
//        System.out.println("    M = " + v(M));

        // 4.
        if (u >= 0.0 && u <= dS21.dotProduct(dS21) &&
                v >= 0.0 && v <= dS31.dotProduct(dS31)) {
            return new Vec2f((float)u, (float)v);
        } else {
            return null;
        }
    }
项目:UniversalRemote    文件:EntityPlayerMPProxy.java   
@Override
public Vec2f getPitchYaw() {
    return super.getPitchYaw();
}
项目:UniversalRemote    文件:EntityPlayerProxy.java   
@Override
public Vec2f getPitchYaw() {
    return super.getPitchYaw();
}
项目:Backmemed    文件:Entity.java   
/**
 * returns the Entity's pitch and yaw as a Vec2f
 */
public Vec2f getPitchYaw()
{
    Vec2f vec2f = new Vec2f(this.rotationPitch, this.rotationYaw);
    return vec2f;
}
项目:Backmemed    文件:MovementInput.java   
public Vec2f getMoveVector()
{
    return new Vec2f(this.moveStrafe, this.moveForward);
}
项目:CustomWorldGen    文件:MovementInput.java   
public Vec2f getMoveVector()
{
    return new Vec2f(this.moveStrafe, this.moveForward);
}
项目:DynamicSurroundings    文件:ShaderProgram.java   
public void set(final String name, final Vec2f vector) throws ShaderException {
    this.set(name, vector.x, vector.y);
}
项目:MobTotems    文件:CarvingSelectorGui.java   
public double getMouseAngle(Vec2f referencePoint, Vec2f mousePos) {
    Vec2f relativePos = new Vec2f(mousePos.x - referencePoint.x, mousePos.y - referencePoint.y);
    double degrees = Math.toDegrees(Math.atan2(relativePos.y, relativePos.x));
    return sanitizeDegree(degrees);
}
项目:ExpandedRailsMod    文件:Entity.java   
@SideOnly(Side.CLIENT)
public Vec2f func_189653_aC()
{
    Vec2f vec2f = new Vec2f(this.rotationPitch, this.rotationYaw);
    return vec2f;
}