Java 类org.lwjgl.input.Keyboard 实例源码

项目:Backmemed    文件:FileManager.java   
public void loadMacros() {
    try {
        File file = new File(xdolfDir.getAbsolutePath(), "macros.txt");
        FileInputStream fstream = new FileInputStream(file.getAbsolutePath());
        DataInputStream in = new DataInputStream(fstream);
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String line;
        while((line = br.readLine()) != null) {
            String curLine = line.toLowerCase().trim();
            String[] s = curLine.split(":");
            String cmd = s[0];
            int id = Keyboard.getKeyIndex(s[1].toUpperCase());
            Macro m = new Macro(id, cmd);
        }
        br.close();
    } catch(Exception e) {
        e.printStackTrace();
        saveMacros();
    }
}
项目:BaseClient    文件:GuiScreenBook.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.buttonList.clear();
    Keyboard.enableRepeatEvents(true);

    if (this.bookIsUnsigned)
    {
        this.buttonList.add(this.buttonSign = new GuiButton(3, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.format("book.signButton", new Object[0])));
        this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.format("gui.done", new Object[0])));
        this.buttonList.add(this.buttonFinalize = new GuiButton(5, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.format("book.finalizeButton", new Object[0])));
        this.buttonList.add(this.buttonCancel = new GuiButton(4, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.format("gui.cancel", new Object[0])));
    }
    else
    {
        this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 - 100, 4 + this.bookImageHeight, 200, 20, I18n.format("gui.done", new Object[0])));
    }

    int i = (this.width - this.bookImageWidth) / 2;
    int j = 2;
    this.buttonList.add(this.buttonNextPage = new GuiScreenBook.NextPageButton(1, i + 120, j + 154, true));
    this.buttonList.add(this.buttonPreviousPage = new GuiScreenBook.NextPageButton(2, i + 38, j + 154, false));
    this.updateButtons();
}
项目:Zombe-Modpack    文件:Minecraft.java   
public void dispatchKeypresses()
{
    int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();

    if (i != 0 && !Keyboard.isRepeatEvent())
    {
        if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L)
        {
            if (Keyboard.getEventKeyState())
            {
                if (i == this.gameSettings.keyBindFullscreen.getKeyCode())
                {
                    this.toggleFullscreen();
                }
                else if (i == this.gameSettings.keyBindScreenshot.getKeyCode())
                {
                    this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc));
                }
            }
        }
    }
}
项目:CustomWorldGen    文件:GuiScreen.java   
/**
 * Delegates mouse and keyboard input.
 */
public void handleInput() throws IOException
{
    if (Mouse.isCreated())
    {
        while (Mouse.next())
        {
            if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue;
            this.handleMouseInput();
            if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this));
        }
    }

    if (Keyboard.isCreated())
    {
        while (Keyboard.next())
        {
            if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue;
            this.handleKeyboardInput();
            if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this));
        }
    }
}
项目:Zombe-Modpack    文件:KeyHelper.java   
public static int getKeyId(String name) {
    if (name.equals("") || name.equals("NONE")) return Keyboard.KEY_NONE;
    name = name.toUpperCase();
    String param = null;
    if (name.startsWith("MOUSE")) {
        param = name.substring(5);
    }
    if (name.startsWith("BUTTON")) {
        param = name.substring(6);
    }
    if (param != null) {
        try {
            int button = Integer.parseInt(param);
            if (button >= 0 && button < 256) return button | MOUSE;
        } catch (Exception e) {
        }
        return -1;
    }
    int key = Keyboard.getKeyIndex(name.toUpperCase());
    return key;
}
项目:Wurst-MC-1.12    文件:GuiServerFinder.java   
/**
 * "Called when the screen is unloaded. Used to disable keyboard repeat
 * events."
 */
@Override
public void onGuiClosed()
{
    state = ServerFinderState.CANCELLED;
    WurstClient.INSTANCE.analytics.trackEvent("server finder", "cancel",
        "gui closed", working);

    if(MiscUtils.isInteger(maxThreadsBox.getText()))
    {
        WurstClient.INSTANCE.options.serverFinderThreads =
            Integer.valueOf(maxThreadsBox.getText());
        ConfigFiles.OPTIONS.save();
    }
    Keyboard.enableRepeatEvents(false);
}
项目:SerenityCE    文件:SerenityPluginGui.java   
@Override
public void call(KeyEvent event) {
    int key = Keyboard.KEY_RSHIFT;
    if (event.getKey() == key) {
        if (mc.currentScreen == null) {
            for (KeyBinding keyBinding : mc.gameSettings.keyBindings)
                if (keyBinding.getKeyCode() == key)
                    return;
            if (!wasSetUp) {
                setup(guiManager);
                wasSetUp = true;
            }
            mc.displayGuiScreen(new GuiSerenity(guiManager));
        }
    }
}
项目:Machines-and-Stuff    文件:BlockAccumulator.java   
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if(!worldIn.isRemote) {
        if(playerIn.inventory.getCurrentItem().getItem() == MItems.WRENCH) {
            TileEntityAccumulator tile = (TileEntityAccumulator) worldIn.getTileEntity(pos);
            EnumFacing face = facing;
            if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)){
                face = face.getOpposite();
            }
            AccumulatorInfo info = tile.getInfoForFace(face);
            tile.getInfoForFace(face).setIoInfo(info.getIoInfo().getNext());
            tile.markDirty();
            return true;
        } else
            playerIn.openGui(MAS.INSTANCE, 1, worldIn, pos.getX(), pos.getY(), pos.getZ());
    }
    return true;
}
项目:BaseClient    文件:GuiScreenAddServer.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 18, I18n.format("addServer.add", new Object[0])));
    this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 18, I18n.format("gui.cancel", new Object[0])));
    this.buttonList.add(this.serverResourcePacks = new GuiButton(2, this.width / 2 - 100, this.height / 4 + 72, I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText()));
    this.serverNameField = new GuiTextField(0, this.fontRendererObj, this.width / 2 - 100, 66, 200, 20);
    this.serverNameField.setFocused(true);
    this.serverNameField.setText(this.serverData.serverName);
    this.serverIPField = new GuiTextField(1, this.fontRendererObj, this.width / 2 - 100, 106, 200, 20);
    this.serverIPField.setMaxStringLength(128);
    this.serverIPField.setText(this.serverData.serverIP);
    this.serverIPField.func_175205_a(this.field_181032_r);
    ((GuiButton)this.buttonList.get(0)).enabled = this.serverIPField.getText().length() > 0 && this.serverIPField.getText().split(":").length > 0 && this.serverNameField.getText().length() > 0;
}
项目:GeneralLaymansAestheticSpyingScreen    文件:GuiWirelessOrder.java   
@Override
public void initGui()
{
    Keyboard.enableRepeatEvents(true);

    this.guiLeft = (this.width - this.xSize) / 2;
    this.guiTop = (this.height - this.ySize) / 2;

    buttonList.clear();
    buttonList.add(new GuiButton(ID_CONFIRM, guiLeft + (xSize - 50) / 2, guiTop + ySize + 2, 50, 20, I18n.translateToLocal("gui.done")));
    buttonList.add(new GuiButton(ID_WIRELESS_ORDER, guiLeft + xSize + 1, guiTop , 20, 20, ""));
    buttonList.add(new GuiButton(ID_UP, guiLeft + xSize + 1, guiTop + 21 , 20, 20, "^"));
    buttonList.add(new GuiButton(ID_DOWN, guiLeft + xSize + 1, guiTop + 41, 20, 20, "v"));

    channels = new ArrayList<>(master.wirelessPos);
    trackList = new GuiWirelessList(this, 93 - 10, ySize - 22, guiTop + 11, guiTop + ySize - 5, guiLeft + 5, 8, channels);

    rotateX = 0F;
    rotateY = 0F;

    releasedMouse = false;
}
项目:Backmemed    文件:GuiFlatPresets.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.buttonList.clear();
    Keyboard.enableRepeatEvents(true);
    this.presetsTitle = I18n.format("createWorld.customize.presets.title", new Object[0]);
    this.presetsShare = I18n.format("createWorld.customize.presets.share", new Object[0]);
    this.listText = I18n.format("createWorld.customize.presets.list", new Object[0]);
    this.export = new GuiTextField(2, this.fontRendererObj, 50, 40, this.width - 100, 20);
    this.list = new GuiFlatPresets.ListSlot();
    this.export.setMaxStringLength(1230);
    this.export.setText(this.parentScreen.getPreset());
    this.btnSelect = this.addButton(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.format("createWorld.customize.presets.select", new Object[0])));
    this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.format("gui.cancel", new Object[0])));
    this.updateButtonValidity();
}
项目:DecompiledMinecraft    文件:GuiCommandBlock.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done", new Object[0])));
    this.buttonList.add(this.cancelBtn = new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel", new Object[0])));
    this.buttonList.add(this.field_175390_s = new GuiButton(4, this.width / 2 + 150 - 20, 150, 20, 20, "O"));
    this.commandTextField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20);
    this.commandTextField.setMaxStringLength(32767);
    this.commandTextField.setFocused(true);
    this.commandTextField.setText(this.localCommandBlock.getCommand());
    this.previousOutputTextField = new GuiTextField(3, this.fontRendererObj, this.width / 2 - 150, 150, 276, 20);
    this.previousOutputTextField.setMaxStringLength(32767);
    this.previousOutputTextField.setEnabled(false);
    this.previousOutputTextField.setText("-");
    this.field_175389_t = this.localCommandBlock.shouldTrackOutput();
    this.func_175388_a();
    this.doneBtn.enabled = this.commandTextField.getText().trim().length() > 0;
}
项目:Backmemed    文件:GuiScreenServerList.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    this.mc.gameSettings.lastServer = this.ipEdit.getText();
    this.mc.gameSettings.saveOptions();
}
项目:SerenityCE    文件:Sneak.java   
@Override
protected void onDisable() {
    if (!Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) {
        KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false);
        if (this.sneaking) {
            mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));
            this.sneaking = false;
        }
    }

    this.sneaking = false;
}
项目:DecompiledMinecraft    文件:GuiRepair.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    super.onGuiClosed();
    Keyboard.enableRepeatEvents(false);
    this.inventorySlots.removeCraftingFromCrafters(this);
}
项目:DecompiledMinecraft    文件:GuiMultiplayer.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);

    if (this.lanServerDetector != null)
    {
        this.lanServerDetector.interrupt();
        this.lanServerDetector = null;
    }

    this.oldServerPinger.clearPendingNetworks();
}
项目:MRCEngine    文件:Camera.java   
public void move() {
    if(Keyboard.isKeyDown(Keyboard.KEY_D)) {
        position.x += 1f;
    }
    if(Keyboard.isKeyDown(Keyboard.KEY_A)) {
        position.x -= 1f;
    }
    if(Keyboard.isKeyDown(Keyboard.KEY_S)) {
        position.z += 1f;
    }
    if(Keyboard.isKeyDown(Keyboard.KEY_W)) {
        position.z -= 1f;
    }

    if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
        position.y += 1f;
    }if(Keyboard.isKeyDown(Keyboard.KEY_Z)) {
        position.y -= 1f;
    }

    if(Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
        yaw += 1f;
    }
    if(Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
        yaw -= 1f;
    }

    if(Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
        pitch += 1f;
    }
    if(Keyboard.isKeyDown(Keyboard.KEY_UP)) {
        pitch -= 1f;
    }
}
项目:BaseClient    文件:GuiEditSign.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.buttonList.clear();
    Keyboard.enableRepeatEvents(true);
    this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120, I18n.format("gui.done", new Object[0])));
    this.tileSign.setEditable(false);
}
项目:BaseClient    文件:AccountScreen.java   
public void handleKeyboardInput() throws IOException {
    if (Keyboard.getEventKey() == 1 && this.currentScreen != null) {
        this.currentScreen = null;
    } else if (Keyboard.getEventKeyState()) {
        if (this.currentScreen != null) {
            this.currentScreen.onKeyPress(Keyboard.getEventCharacter(), Keyboard.getEventKey());
        }
        super.handleKeyboardInput();
    }
}
项目:pnc-repressurized    文件:GuiKeroseneLamp.java   
@Override
protected void keyTyped(char key, int keyCode) throws IOException {
    if ((keyCode == Keyboard.KEY_RETURN || keyCode == Keyboard.KEY_TAB) && rangeWidget.isFocused()) {
        sendPacketToServer(rangeWidget.getValue());
    } else {
        super.keyTyped(key, keyCode);
    }
}
项目:BaseClient    文件:GuiChat.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.sentHistoryCursor = this.mc.ingameGUI.getChatGUI().getSentMessages().size();
    this.inputField = new GuiTextField(0, this.fontRendererObj, 4, this.height - 12, this.width - 4, 12);
    this.inputField.setMaxStringLength(100);
    this.inputField.setEnableBackgroundDrawing(false);
    this.inputField.setFocused(true);
    this.inputField.setText(this.defaultInputFieldText);
    this.inputField.setCanLoseFocus(false);
}
项目:pnc-repressurized    文件:GuiPastebin.java   
/**
 * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
 */
@Override
protected void keyTyped(char par1, int par2) throws IOException {
    if (par2 == 1) {
        Keyboard.enableRepeatEvents(false);
        mc.displayGuiScreen(parentScreen);
        onGuiClosed();
    } else {
        super.keyTyped(par1, par2);
    }
}
项目:BaseClient    文件:GuiRepair.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    super.onGuiClosed();
    Keyboard.enableRepeatEvents(false);
    this.inventorySlots.removeCraftingFromCrafters(this);
}
项目:BaseClient    文件:TabGUI.java   
private void right(int key) {
    if (this.screen == 0 && getModsForCurrentCategory().size() != 0) {
           this.screen = 1;
       } else if (this.screen == 1 && key == Keyboard.KEY_RETURN) {
           this.getCurrentModule().toggle();
       } else if (this.screen == 1 && this.getSettingForCurrentMod() != null && this.getCurrentModule() != null) {
        this.editMode = false;
           this.screen = 2;
       } else if (this.screen == 2 && key == Keyboard.KEY_RETURN) {
           this.editMode = !this.editMode;
       }

}
项目:pnc-repressurized    文件:GuiSentryTurret.java   
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
    super.drawGuiContainerForegroundLayer(x, y);
    fontRenderer.drawString("Upgr.", 28, 19, 4210752);
    fontRenderer.drawString(I18n.format("gui.sentryTurret.ammo"), 80, 19, 4210752);
    fontRenderer.drawString(I18n.format("gui.sentryTurret.targetFilter"), 80, 53, 4210752);
    if (Keyboard.isKeyDown(Keyboard.KEY_F1)) {
        GuiUtils.showPopupHelpScreen(this, fontRenderer,
                PneumaticCraftUtils.convertStringIntoList(I18n.format("gui.entityFilter.helpText"), 60));
    } else if (x >= guiLeft + 76 && y >= guiTop + 51 && x <= guiLeft + 153 && y <= guiTop + 74) {
        // cursor inside the entity filter area
        String str = I18n.format("gui.entityFilter");
        fontRenderer.drawString(str, (xSize - fontRenderer.getStringWidth(str)) / 2, ySize + 5, 0x808080);
    }
}
项目:Backmemed    文件:GuiChat.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.sentHistoryCursor = this.mc.ingameGUI.getChatGUI().getSentMessages().size();
    this.inputField = new GuiTextField(0, this.fontRendererObj, 4, this.height - 12, this.width - 4, 12);
    this.inputField.setMaxStringLength(256);
    this.inputField.setEnableBackgroundDrawing(false);
    this.inputField.setFocused(true);
    this.inputField.setText(this.defaultInputFieldText);
    this.inputField.setCanLoseFocus(false);
    this.tabCompleter = new GuiChat.ChatTabCompleter(this.inputField);
}
项目:Zombe-Modpack    文件:Keys.java   
private int getKeyPressed() {
    for (int i = 1; i < keysDown.length; ++i)
        if (keysDown[i] && !keysPrev[i]) return i;
    for (int i = 0; i < mouseDown.length && i < Mouse.getButtonCount(); ++i)
        if (mouseDown[i] && !mousePrev[i]) return i | KeyHelper.MOUSE;
    return Keyboard.KEY_NONE;
}
项目:OpenGL-Bullet-engine    文件:Renderer.java   
@Override
public void onKey(KeyEvent e){
    Gui openGui=guiHandler.getOpenGui();
    if(openGui==null){
        if(e.code==Keyboard.KEY_ESCAPE){
            if(e.action==KeyAction.RELEASE) guiHandler.openGui(new GuiPause());
        }
        return;
    }
    openGui.onKey(e);
}
项目:OpenGL-Bullet-engine    文件:Camera.java   
public void update(){
        viewDistance.update();
        prevPos.set(pos);

        MOVE.set(0, 0, 0);
        if(Keyboard.isKeyDown(Keyboard.KEY_D)) MOVE.addX(1);
        if(Keyboard.isKeyDown(Keyboard.KEY_A)) MOVE.addX(-1);

        if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)) MOVE.addY(1);
        if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) MOVE.addY(-1);

        if(Keyboard.isKeyDown(Keyboard.KEY_S)) MOVE.addZ(1);
        if(Keyboard.isKeyDown(Keyboard.KEY_W)) MOVE.addZ(-1);

        Vector4f vec4=new Vector4f(MOVE.x, MOVE.y, MOVE.z, 1);
        Matrix4f mat=new Matrix4f();
        EFF_POS.set(rot).mul(-1);
        EFF_POS.x=0;
        MatrixUtil.rotate(mat, EFF_POS);

        Matrix4f.transform(mat, vec4, vec4);
        MOVE.x=vec4.x;
        MOVE.y=vec4.y;
        MOVE.z=vec4.z;
//      MOVE.mul(100);
//      if(EntityCrazyCube.CAM!=null&&false){
//          pos.set(EntityCrazyCube.CAM.pos);
//      }else
        pos.add(MOVE);
        viewDistance.setValue((viewDistance.getValue()+viewDistanceWanted)/2);
    }
项目:BaseClient    文件:GuiEditSign.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    NetHandlerPlayClient nethandlerplayclient = this.mc.getNetHandler();

    if (nethandlerplayclient != null)
    {
        nethandlerplayclient.addToSendQueue(new C12PacketUpdateSign(this.tileSign.getPos(), this.tileSign.signText));
    }

    this.tileSign.setEditable(true);
}
项目:BaseClient    文件:GuiEditSign.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    this.buttonList.clear();
    Keyboard.enableRepeatEvents(true);
    this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120, I18n.format("gui.done", new Object[0])));
    this.tileSign.setEditable(false);
}
项目:FreeWorld    文件:PlayerEntity.java   
@Override
protected void move(){
    location.removeYaw(Mouse.getDY()* 0.05F);
    location.addPitch(Mouse.getDX()* 0.05F);

    if(location.getYaw() < -90.0f) location.setYaw(-90.0f);
    if(location.getYaw() > 90.0f) location.setYaw(90.0f);

    float zDir = 0.0f, xDir = 0.0f, yDir = 0.0f;
    if(Keyboard.isKeyDown(Keyboard.KEY_UP)){
        zDir = -speed;
    }

    if(Keyboard.isKeyDown(Keyboard.KEY_DOWN)){
        zDir = speed;
    }
    if(Keyboard.isKeyDown(Keyboard.KEY_LEFT)){
        xDir = -speed;
    }
    if(Keyboard.isKeyDown(Keyboard.KEY_RIGHT)){
        xDir = speed;
    }
    if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)){
        yDir = speed+0.02f;
    }
    if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)){
        yDir = -speed;
    }

    double rad = Math.toRadians((location.getPitch()));
    velocity.addX(xDir * Math.cos(rad) - zDir * Math.sin(rad)).addY(yDir).addZ(zDir * Math.cos(rad) + xDir * Math.sin(rad));

    location.addX((float) velocity.getX()).addY((float)velocity.getY()).addZ((float)velocity.getZ());
    velocity.multiplyX(0.7f).multiplyY(0.7f).multiplyZ(0.7f);

    updateRayCast();
}
项目:BaseClient    文件:GuiEditSign.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    NetHandlerPlayClient nethandlerplayclient = this.mc.getNetHandler();

    if (nethandlerplayclient != null)
    {
        nethandlerplayclient.addToSendQueue(new C12PacketUpdateSign(this.tileSign.getPos(), this.tileSign.signText));
    }

    this.tileSign.setEditable(true);
}
项目:CustomWorldGen    文件:GuiMultiplayer.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);

    if (this.lanServerDetector != null)
    {
        this.lanServerDetector.interrupt();
        this.lanServerDetector = null;
    }

    this.oldServerPinger.clearPendingNetworks();
}
项目:BaseClient    文件:GuiMultiplayer.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();

    if (!this.initialized)
    {
        this.initialized = true;
        this.savedServerList = new ServerList(this.mc);
        this.savedServerList.loadServerList();
        this.lanServerList = new LanServerDetector.LanServerList();

        try
        {
            this.lanServerDetector = new LanServerDetector.ThreadLanServerFind(this.lanServerList);
            this.lanServerDetector.start();
        }
        catch (Exception exception)
        {
            logger.warn("Unable to start LAN server detection: " + exception.getMessage());
        }

        this.serverListSelector = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36);
        this.serverListSelector.func_148195_a(this.savedServerList);
    }
    else
    {
        this.serverListSelector.setDimensions(this.width, this.height, 32, this.height - 64);
    }

    this.createButtons();
}
项目:BaseClient    文件:RenderGlobal.java   
public void updateClouds()
{
    if (Config.isShaders() && Keyboard.isKeyDown(61) && Keyboard.isKeyDown(19))
    {
        Shaders.uninit();
    }

    ++this.cloudTickCounter;

    if (this.cloudTickCounter % 20 == 0)
    {
        this.cleanupDamagedBlocks(this.damagedBlocks.values().iterator());
    }
}
项目:CustomWorldGen    文件:GuiEditCommandBlockMinecart.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.doneButton = this.addButton(new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done", new Object[0])));
    this.cancelButton = this.addButton(new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel", new Object[0])));
    this.outputButton = this.addButton(new GuiButton(4, this.width / 2 + 150 - 20, 150, 20, 20, "O"));
    this.commandField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20);
    this.commandField.setMaxStringLength(32500);
    this.commandField.setFocused(true);
    this.commandField.setText(this.commandBlockLogic.getCommand());
    this.previousEdit = new GuiTextField(3, this.fontRendererObj, this.width / 2 - 150, 150, 276, 20);
    this.previousEdit.setMaxStringLength(32500);
    this.previousEdit.setEnabled(false);
    this.previousEdit.setText("-");
    this.trackOutput = this.commandBlockLogic.shouldTrackOutput();
    this.updateCommandOutput();
    this.doneButton.enabled = !this.commandField.getText().trim().isEmpty();
    this.tabCompleter = new TabCompleter(this.commandField, true)
    {
        @Nullable
        public BlockPos getTargetBlockPos()
        {
            return GuiEditCommandBlockMinecart.this.commandBlockLogic.getPosition();
        }
    };
}
项目:DecompiledMinecraft    文件:GuiScreenServerList.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    this.mc.gameSettings.lastServer = this.field_146302_g.getText();
    this.mc.gameSettings.saveOptions();
}
项目:ObsidianSuite    文件:TimelineKeyMappings.java   
public TimelineKeyMappings(TimelineController controller)
{
    this.controller = controller;

    keyMappings = new KeyMapping(controller.timelineFrame);

    keyMappings.addKey(KeyEvent.VK_SPACE, Keyboard.KEY_SPACE, "spacePressed", new SpaceAction());
    keyMappings.addKey(KeyEvent.VK_W, Keyboard.KEY_W, "wPressed", new WAction());
    keyMappings.addKey(KeyEvent.VK_S, Keyboard.KEY_S, "sPressed", new SAction());
    keyMappings.addKey(KeyEvent.VK_A, Keyboard.KEY_A, "aPressed", new AAction());
    keyMappings.addKey(KeyEvent.VK_D, Keyboard.KEY_D, "dPressed", new DAction());
    keyMappings.addCtrlKey(KeyEvent.VK_Z, Keyboard.KEY_Z, "undoReleased", new UndoAction());
    keyMappings.addCtrlKey(KeyEvent.VK_Y, Keyboard.KEY_Y, "redoReleased", new RedoAction());
    keyMappings.addKey(KeyEvent.VK_ESCAPE, Keyboard.KEY_ESCAPE, "escPressed", new EscAction());
    keyMappings.addKey(KeyEvent.VK_DELETE, Keyboard.KEY_DELETE, "deletePressed", new DeleteAction());
    keyMappings.addCtrlKey(KeyEvent.VK_R, Keyboard.KEY_R, "rPressed", new ResetAction());
    keyMappings.addCtrlKey(KeyEvent.VK_C, Keyboard.KEY_C, "cPressed", new CopyAction());
    keyMappings.addCtrlKey(KeyEvent.VK_V, Keyboard.KEY_V, "vPressed", new PasteAction());
    keyMappings.addCtrlShiftKey(KeyEvent.VK_ADD, Keyboard.KEY_ADD, "addAllPressed", new AddAction(true));
    keyMappings.addCtrlShiftKey(KeyEvent.VK_SUBTRACT, Keyboard.KEY_SUBTRACT, "removeAllPressed", new RemoveAction(true));
    keyMappings.addCtrlKey(KeyEvent.VK_ADD, Keyboard.KEY_ADD, "addPressed", new AddAction(false));
    keyMappings.addCtrlKey(KeyEvent.VK_SUBTRACT, Keyboard.KEY_SUBTRACT, "removePressed", new RemoveAction(false));

    int[] numpadKey = new int[] {
            Keyboard.KEY_NUMPAD0, Keyboard.KEY_NUMPAD1, Keyboard.KEY_NUMPAD2, Keyboard.KEY_NUMPAD3,
            Keyboard.KEY_NUMPAD4, Keyboard.KEY_NUMPAD5, Keyboard.KEY_NUMPAD6, Keyboard.KEY_NUMPAD7,
            Keyboard.KEY_NUMPAD8, Keyboard.KEY_NUMPAD9};

    for (int j = 0; j <= 9; j++)
    {
        keyMappings.addKey(KeyEvent.VK_NUMPAD0 + j, numpadKey[j], "numpad" + j, new ChangeViewAction(j));
    }
}
项目:CustomWorldGen    文件:GuiEditArrayEntries.java   
@Override
public void keyTyped(char eventChar, int eventKey)
{
    if (owningScreen.enabled || eventKey == Keyboard.KEY_LEFT || eventKey == Keyboard.KEY_RIGHT
            || eventKey == Keyboard.KEY_HOME || eventKey == Keyboard.KEY_END)
    {
        String validChars = "0123456789";
        String before = this.textFieldValue.getText();
        if (validChars.contains(String.valueOf(eventChar)) ||
                (!before.startsWith("-") && this.textFieldValue.getCursorPosition() == 0 && eventChar == '-')
                || (!before.contains(".") && eventChar == '.')
                || eventKey == Keyboard.KEY_BACK || eventKey == Keyboard.KEY_DELETE || eventKey == Keyboard.KEY_LEFT || eventKey == Keyboard.KEY_RIGHT
                || eventKey == Keyboard.KEY_HOME || eventKey == Keyboard.KEY_END)
            this.textFieldValue.textboxKeyTyped((owningScreen.enabled ? eventChar : Keyboard.CHAR_NONE), eventKey);

        if (!textFieldValue.getText().trim().isEmpty() && !textFieldValue.getText().trim().equals("-"))
        {
            try
            {
                double value = Double.parseDouble(textFieldValue.getText().trim());
                if (value < Double.valueOf(configElement.getMinValue().toString()) || value > Double.valueOf(configElement.getMaxValue().toString()))
                    this.isValidValue = false;
                else
                    this.isValidValue = true;
            }
            catch (Throwable e)
            {
                this.isValidValue = false;
            }
        }
        else
            this.isValidValue = false;
    }
}