Cuberealm.io Wireframe Mode

Wireframe script for CubeRealm! Makes blocks mostly invisible, while you can still see what block it is (not just glass). Great for dungeon searching!

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Cuberealm.io Wireframe Mode
// @namespace   cooluser1481
// @match       https://cuberealm.io/*
// @version     1.0.2
// @author      cooluser1481
// @description Wireframe script for CubeRealm! Makes blocks mostly invisible, while you can still see what block it is (not just glass). Great for dungeon searching!
// @license     GPL3
// ==/UserScript==

(function() {
    'use strict';

    // original drawing methods
    const originalDrawElements = WebGL2RenderingContext.prototype.drawElements;
    const originalDrawArrays = WebGL2RenderingContext.prototype.drawArrays;

    // drawElements function cuberealm uses to draw
    WebGL2RenderingContext.prototype.drawElements = function(mode, count, type, offset) {
        // replace triangle with lines for wireframe mesh
        if (mode === this.TRIANGLES) {
            mode = this.LINES; // LINE_STRIP is worse
        }
        return originalDrawElements.call(this, mode, count, type, offset);
    };

    // Patch this as well
    WebGL2RenderingContext.prototype.drawArrays = function(mode, first, count) {
        if (mode === this.TRIANGLES) {
            mode = this.LINE_LOOP;
        }
        return originalDrawArrays.call(this, mode, first, count);
    };
})();