Greasy Fork 还支持 简体中文。

MineCraft Keybind

Rebinds the MineFun.io controls for easier use by MineCraft players

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

// ==UserScript==
// @name         MineCraft Keybind
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Rebinds the MineFun.io controls for easier use by MineCraft players
// @author  Qwerty Matthew
// @license  MIT
// @match        https://minefun.io/*
// @match        https://*.minefun.io/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function remapKey(e) {
        // Leave the keys alone if you're typing in chat
        if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') return;

        // 1. CROUCH: Left Shift triggers 'C'.
        if (e.code === 'ShiftLeft') {
            Object.defineProperty(e, 'code', { value: 'KeyC' });
        }
        // DISABLE ORIGINAL C: If you press physical C, stop it from triggering crouch
        else if (e.code === 'KeyC') {
            e.preventDefault();
            e.stopPropagation();
            Object.defineProperty(e, 'code', { value: 'None' });
        }

        // 2. SPRINT: Right Option / Alt (right of spacebar) triggers 'ShiftLeft'
        else if (e.code === 'AltRight') {
            Object.defineProperty(e, 'code', { value: 'ShiftLeft' });
        }

        // 3. INVENTORY: 'E' triggers 'X'.
        else if (e.code === 'KeyE') {
            Object.defineProperty(e, 'code', { value: 'KeyX' });
        }
        // DISABLE ORIGINAL X: If you press physical X, stop it from opening inventory
        else if (e.code === 'KeyX') {
            e.preventDefault();
            e.stopPropagation();
            Object.defineProperty(e, 'code', { value: 'None' });
        }
    }

    // Capture everything instantly on the way down and up
    window.addEventListener('keydown', remapKey, true);
    window.addEventListener('keyup', remapKey, true);

})();