Package net.minecraft.src

Examples of net.minecraft.src.Minecraft


  public void poll(float delta)
    {
        if (!isInitialized())
            return;

        Minecraft mc = Minecraft.getMinecraft();

        // Poll hydras; get orientation, and position information in metres
        Sixense.getAllNewestData(newData);

        // Update the controller manager, allowing us to determine which
        // controller is the 'Left' controller, and which is the 'Right'
        // (if calibrated)
        cm.update(newData);
        int leftIndex = cm.getIndex(EnumControllerDesc.P1L);
        int rightIndex = cm.getIndex(EnumControllerDesc.P1R);

        ControllerData cont1, cont2;
        if (leftIndex != -1 && rightIndex != -1)
        {
            if (mc.vrSettings.posTrackHydraUseController1)
            {
                cont1 = newData[leftIndex];
                cont2 = newData[rightIndex];
            }
            else
            {
                cont1 = newData[rightIndex];
                cont2 = newData[leftIndex];
            }
        }
        else
        {
            // Not yet calibrated
            cont1 = newData[0];
            cont2 = newData[1];
        }

        EnumSetupStep step = cm.getCurrentStep();
        switch ( step )
        {
            case P1C2_IDLE:
                hydraRunning = true;
                calibrationStep = "";
                break;
            default:
                hydraRunning = false;
                if (step != null)
                {
                    //System.out.println("HYDRA: " + step.toString());
                    calibrationStep = cm.getStepString();
                }
                break;
        }

        if (hydraRunning)
        {
            cont1Yaw   = cont1.yaw;
            cont1Pitch = cont1.pitch;
            cont1Roll  = cont1.roll;
            cont1OrientationQuat_xyzw = cont1.rot_quat;

            cont2Yaw   = cont2.yaw;
            cont2Pitch = cont2.pitch;
            cont2Roll  = cont2.roll;
            cont2OrientationQuat_xyzw = cont2.rot_quat;
        }
        else
        {
            cont1Yaw   = 0;
            cont1Pitch = 0;
            cont1Roll  = 0;
            cont1OrientationQuat_xyzw = IDENTITY_QUAT;

            cont2Yaw   = 0;
            cont2Pitch = 0;
            cont2Roll  = 0;
            cont2OrientationQuat_xyzw = IDENTITY_QUAT;
        }

        userScale = SCALE * mc.vrSettings.posTrackHydraDistanceScale;

        cont1PosX = userScale * cont1.pos[0] * XDIRECTION;
        cont1PosY = userScale * cont1.pos[1] * YDIRECTION;
        cont1PosZ = userScale * cont1.pos[2] * ZDIRECTION;

        cont2PosX = userScale * cont2.pos[0] * XDIRECTION;
        cont2PosY = userScale * cont2.pos[1] * YDIRECTION;
        cont2PosZ = userScale * cont2.pos[2] * ZDIRECTION;

        if( mc.lookaimController != this) return;
        if( mc.theWorld != null )
        {
          EntityClientPlayerMP thePlayer = mc.thePlayer;
         
          //buttons?
          //TODO: move this somewhere sane and make configurable
          GameSettings settings = mc.gameSettings;
 
          if((cont2.buttons & EnumButton.START.mask())>0 &&
            (lastcont2Buttons & EnumButton.START.mask()) == 0)
          {
            if(mc.currentScreen != null)
              thePlayer.closeScreen();
            else
              settings.keyBindInventory.pressTime=1;
          }

          if((cont1.buttons & EnumButton.START.mask())>0 &&
            (lastcont1Buttons & EnumButton.START.mask()) == 0)
          {
            if(mc.currentScreen != null)
              thePlayer.closeScreen();
            else
              mc.displayInGameMenu();
          }
        
          //In game!
          if( mc.currentScreen == null )
          {
            hydraMouseX = 0;
            hydraMouseY = 0;

            //aim/body adjustments
            float headYaw = 0;
            if( mc.vrSettings.keyholeHeadRelative )
              headYaw = mc.headTracker.getHeadYawDegrees();
           
            //Adjust keyhole width on controller pitch; otherwise its a very narrow window at the top and bottom
            float keyholeYaw = mc.vrSettings.aimKeyholeWidthDegrees/2/MathHelper.cos(cont2Pitch*PIOVER180);
           
            float bodyYawT = cont2Yaw - baseStationYawOffset; //

              if( bodyYawT > headYaw + keyholeYaw  )
              {
                bodyYawT = Math.min(10,bodyYawT - headYaw - keyholeYaw) * 0.1f*mc.vrSettings.joystickSensitivity; //TODO: add new sensitivity
                //Controller pointing too far right, move body to the right
                  aimYaw = headYaw + keyholeYaw;
              }
              else if( bodyYawT < headYaw -keyholeYaw )
              {
                //Controller pointing too far left, move body to the left
                bodyYawT = Math.max(-10,bodyYawT -headYaw + keyholeYaw) * 0.1f*mc.vrSettings.joystickSensitivity;
                  aimYaw = headYaw - keyholeYaw;
              }
              else
              {
                aimYaw = bodyYawT;
                bodyYawT = 0;
              }
              bodyYaw += bodyYawT;
                bodyYaw %= 360;
           
            if( thePlayer != null )
            {
              if( Math.abs(cont2.joystick_y)>0.01)
                thePlayer.movementInput.baseMoveForward = cont2.joystick_y;
              else
                thePlayer.movementInput.baseMoveForward = 0.0f;
             
              if( Math.abs(cont2.joystick_x)>0.01)
                thePlayer.movementInput.baseMoveStrafe = -cont2.joystick_x;
              else
                thePlayer.movementInput.baseMoveStrafe = 0.0f;
            }
   
            //Do buttons
            if( cont2.trigger > 0.05 )
            {
              if( !leftMouseClicked )
                mc.clickMouse(0);
              settings.keyBindAttack.pressed = true;
              leftMouseClicked = true;
            }
            else
            {
              leftMouseClicked = false;
              settings.keyBindAttack.pressed = false;
            }
             
            if((cont2.buttons & EnumButton.BUMPER.mask()) >0 &&
               (lastcont2Buttons & EnumButton.BUMPER.mask()) == 0)
            {
              mc.clickMouse(1);
            }

            settings.keyBindUseItem.pressed = (cont2.buttons & EnumButton.BUMPER.mask()) >0 ;
           
            if((cont2.buttons & EnumButton.JOYSTICK.mask())>0 &&
View Full Code Here


    @Override
  public void resetOriginRotation() {
    resetOriginRotation = true;

        Minecraft mc = Minecraft.getMinecraft();
        if( resetOriginRotation && mc.headTracker == this )
        {
          float prevTotalYaw = mc.lookaimController.getBodyYawDegrees() + getHeadYawDegrees();
          yawOffset = cont1Yaw;
          if( mc.thePlayer == null )
View Full Code Here

    int _textureType;

    protected static FBO_SUPPORT fboSupport = FBO_SUPPORT.USE_EXT_UNKNOWN;

  public FBOParams(String fboName, int textureType, int internalFormat, int baseFormat, int bufferType, int fboWidth, int fboHeight ) throws Exception {
        Minecraft mc = Minecraft.getMinecraft();
        _textureType = textureType;

        if (fboSupport == FBO_SUPPORT.USE_EXT_UNKNOWN)
        {
            // The framebuffer, which regroups 0, 1, or more textures, and 0 or 1 depth buffer.
            try {
                _frameBufferId = GL30.glGenFramebuffers();
                fboSupport = FBO_SUPPORT.USE_GL30;
            }
            catch (IllegalStateException ex)
            {
                System.out.println("[Minecrift] FBO creation: GL30.glGenFramebuffers not supported. Attempting to use EXTFramebufferObject.glGenFramebuffersEXT");
                fboSupport = FBO_SUPPORT.USE_EXT;

                try {
                    _frameBufferId = EXTFramebufferObject.glGenFramebuffersEXT();
                }
                catch (IllegalStateException ex1)
                {
                    System.out.println("[Minecrift] FBO creation: EXTFramebufferObject.glGenFramebuffersEXT not supported, FBO creation failed.");
                    throw ex1;
                }
            }
        }
        else if (fboSupport == FBO_SUPPORT.USE_GL30)
        {
            _frameBufferId = GL30.glGenFramebuffers();
        }
        else
        {
            _frameBufferId = EXTFramebufferObject.glGenFramebuffersEXT();
        }

        if (fboSupport == FBO_SUPPORT.USE_GL30)
        {
            _colorTextureId = GL11.glGenTextures();
            _depthRenderBufferId = GL30.glGenRenderbuffers();

            GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, _frameBufferId);
            mc.checkGLError("FBO bind framebuffer");

            GL11.glBindTexture(textureType, _colorTextureId);
            mc.checkGLError("FBO bind texture");

            GL11.glEnable(textureType);
            GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
            GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
            GL11.glTexImage2D(textureType, 0, internalFormat, fboWidth, fboHeight, 0, baseFormat, bufferType, (java.nio.ByteBuffer) null);

            System.out.println("[Minecrift] FBO '" + fboName + "': w: " + fboWidth + ", h: " + fboHeight);

            GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, textureType, _colorTextureId, 0);

            mc.checkGLError("FBO bind texture framebuffer");

            GL30.glBindRenderbuffer(GL30.GL_RENDERBUFFER, _depthRenderBufferId);                // bind the depth renderbuffer
            GL30.glRenderbufferStorage(GL30.GL_RENDERBUFFER, GL14.GL_DEPTH_COMPONENT24, fboWidth, fboHeight); // get the data space for it
            GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL30.GL_RENDERBUFFER, _depthRenderBufferId);
            mc.checkGLError("FBO bind depth framebuffer");
        }
        else
        {
            _colorTextureId = GL11.glGenTextures();
            _depthRenderBufferId = EXTFramebufferObject.glGenRenderbuffersEXT();

            EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _frameBufferId);
            mc.checkGLError("FBO bind framebuffer");

            GL11.glBindTexture(textureType, _colorTextureId);
            mc.checkGLError("FBO bind texture");

            GL11.glEnable(textureType);
            GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
            GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
            GL11.glTexImage2D(textureType, 0, internalFormat, fboWidth, fboHeight, 0, baseFormat, bufferType, (java.nio.ByteBuffer) null);
            System.out.println("[Minecrift] FBO '" + fboName + "': w: " + fboWidth + ", h: " + fboHeight);

            EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, textureType, _colorTextureId, 0);

            mc.checkGLError("FBO bind texture framebuffer");

            EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, _depthRenderBufferId);                // bind the depth renderbuffer
            EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, GL14.GL_DEPTH_COMPONENT24, fboWidth, fboHeight); // get the data space for it
            EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, _depthRenderBufferId);
            mc.checkGLError("FBO bind depth framebuffer");
        }

        if (!checkFramebufferStatus())
        {
            // OK, if we have an error here - then throw an exception
View Full Code Here

    if (Configuration.getBetterGrass() > 2) {
      Configuration.setBetterGrass(0);
    }
    Configuration.write();
   
    Minecraft game = SpoutClient.getHandle();
    TexturePackChangeHandler.earlyInitialize("com.prupe.mcpatcher.mob.CTMUtils", "reset");   
    TexturePackChangeHandler.beforeChange1(true);
    game.refreshResources();
    TexturePackChangeHandler.afterChange1(true);
   
    if (game.getMinecraft().theWorld != null) {
      game.renderGlobal.updateAllRenderers();     
    }
  }
View Full Code Here

  @Override
  public void onButtonClick() {
    Configuration.setConnectedTextures(!Configuration.isConnectedTextures());
    Configuration.write();
   
    Minecraft game = SpoutClient.getHandle();
    TexturePackChangeHandler.earlyInitialize("com.prupe.mcpatcher.mob.CTMUtils", "reset");
    TexturePackChangeHandler.beforeChange1(true);   
    game.refreshResources();
    TexturePackChangeHandler.afterChange1(true);
    if (Minecraft.getMinecraft().theWorld != null) {
      Minecraft.getMinecraft().renderGlobal.updateAllRenderers();
    }
  }
View Full Code Here

    String var27 = (String)var17.valueOf(var13);
    File var28 = (File)var17.valueOf(var4);
    File var29 = var17.has(var5) ? (File)var17.valueOf(var5) : new File(var28, "assets/");
    File var30 = var17.has(var6) ? (File)var17.valueOf(var6) : new File(var28, "resourcepacks/");
    Session var31 = new Session((String)var11.value(var17), (String)var12.value(var17));
    Minecraft var32 = new Minecraft(var31, var23, var24, var25, var26, var28, var29, var30, var20, var27);   
    String var33 = (String)var17.valueOf(var2);

    if (var33 != null) {
      var32.setServer(var33, ((Integer)var17.valueOf(var3)).intValue());
    }

    Runtime.getRuntime().addShutdownHook(new MainShutdownHook());

    if (!var18.isEmpty()) {
      System.out.println("Completely ignored arguments: " + var18);
    }

    Thread.currentThread().setName("Minecraft main thread");
    DownloadAssets.importOldConfig();
    var32.run();
  }
View Full Code Here

      if (!chunkCache.extendedLevelsInChunkCache()) {
        ++chunksUpdated;
        RenderBlocks blockRenderer = new RenderBlocks(chunkCache);

        Minecraft game = SpoutClient.getHandle();
        int currentTexture = 0;
        int limit = skipRenderPass.length; // MCPatcher 2.4.4 requires 4, anything less and things get missed.
        int defaultTexture = Minecraft.getMinecraft().renderEngine.getTextureId(new ResourceLocation("textures/atlas/blocks.png"));       
        TextureUtil.bindTexture(defaultTexture);
View Full Code Here

    output.write(max);
    output.write(min);
  }

  public void run(int PlayerId) {
    Minecraft game = SpoutClient.getHandle();
    if (game != null) {
      GameSettings settings = game.gameSettings;
      if (view > -1 && view < 4) {
        settings.renderDistance = view;
      }
View Full Code Here

TOP

Related Classes of net.minecraft.src.Minecraft

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.