Voxiom Client

Let's you see players and items behind walls in voxiom.io. Comes with an aimbot that locks aim at nearest enemy and auto fires at them. Also shows ores and names of the items that are far far away.

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

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

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

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!)

Advertisement:

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!)

Advertisement:

// ==UserScript==
// @name         Voxiom Client
// @namespace    http://tampermonkey.net/
// @version      4.9.18
// @description  Let's you see players and items behind walls in voxiom.io. Comes with an aimbot that locks aim at nearest enemy and auto fires at them. Also shows ores and names of the items that are far far away.
// @author       Eukiryos
// @match        *://voxiom.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=voxiom.io
// @grant        none
// @run-at       document-start
// @require      https://unpkg.com/[email protected]/build/three.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]
// @license MIT 
// ==/UserScript==

const THREE = window.THREE;
delete window.THREE;

const settings = {
	showPlayers: true,
	showPlayerNames: true,
	showItems: true,
	showItemNames: false,
	showBlocks: true,
	showLines: true,
	showOres: true,
	worldWireframe: false,
	aimbotEnabled: true,
	aimbotOnRightMouse: false,
	aimBehindWalls: false,
	aimHeight: 0.9,
	targetZoneRadius: 80,
	showTargetZone: true,
	autoFire: true,
	isSniper: false,
	aimAtEveryone: false,
	createdBy: 'Eukiryos',
	editAimbotBlacklist() {

		const currList = Object.keys( aimbotBlacklist ).join( ', ' );
		const string = prompt( 'Enter usernames of players for whom aimbot should be disabled.\nSeparated by single comma:', currList );

		if ( string !== null ) {

			aimbotBlacklist = {};
			string.split( ',' )
				.map( name => name.trim().toLowerCase() )
				.filter( name => name.length > 0 )
				.forEach( name => ( aimbotBlacklist[ name ] = true ) );

			updateBlacklistBtn();

		}

	}
};

const keyToSetting = {
	'KeyV': 'showPlayers',
	'KeyI': 'showItems',
	'KeyN': 'showItemNames',
	'KeyL': 'showBlocks',
	'KeyB': 'aimbotEnabled',
	'KeyT': 'aimbotOnRightMouse',
	'KeyK': 'autoFire',
	'Semicolon': 'worldWireframe',
	'Comma': 'showOres'
};

let aimbotBlacklist = {};

function updateBlacklistBtn() {

	let name = 'Edit Aimbot Blacklist';

	const n = Object.keys( aimbotBlacklist ).length;
	if ( n > 0 ) name = `${name} (${n} user${n === 1 ? '' : 's'})`;

	controllers.editAimbotBlacklist.name( name );

}

const shadowHost = document.createElement( 'div' );
Object.assign( shadowHost.style, {
	position: 'absolute',
	top: 0,
	left: 0,
	width: '100%',
	height: '100%',
	pointerEvents: 'none'
} );
const shadow = shadowHost.attachShadow( { mode: 'open' } );

let enableDocumentOverride = false;

function setDocumentOverride( prop, value ) {

	const old = document[ prop ];

	Object.defineProperty( document, prop, {
		get() {

			return enableDocumentOverride ? value : old;

		},
		writeable: true,
		configurable: true
	} );

}

let gui;
let controllers;

function initGui() {

	const settingToKey = {};
	for ( const key in keyToSetting ) {

		settingToKey[ keyToSetting[ key ] ] = key;

	}

	const keyOverride = {
		'Semicolon': ';',
		'Comma': ','
	};

	setDocumentOverride( 'body', shadow );
	setDocumentOverride( 'head', shadow );
	setDocumentOverride( 'querySelector', () => null );

	enableDocumentOverride = true;
	gui = new lil.GUI();
	enableDocumentOverride = false;

	controllers = {};
	for ( const key in settings ) {

		let name = fromCamel( key );
		let shortKey = settingToKey[ key ];

		if ( shortKey ) {

			if ( keyOverride[ shortKey ] ) shortKey = keyOverride[ shortKey ];
			else if ( shortKey.startsWith( 'Key' ) ) shortKey = shortKey.slice( 3 );
			name = `[${shortKey}] ${name}`;

		}

		controllers[ key ] = gui.add( settings, key ).name( name ).listen();

	}

	controllers.aimHeight.min( 0 ).max( 1.5 );
	controllers.targetZoneRadius.min( 20 ).max( 500 ).step( 5 );
	controllers.createdBy.disable();
	addDescription( controllers.targetZoneRadius, 'Basic mode only aims and shoots inside this circle.' );
	addDescription( controllers.aimbotOnRightMouse, 'Hold right mouse to use aimbot (basic mode).' );
	addDescription( controllers.aimBehindWalls, 'ON = shoot through walls. OFF = wall check enabled.' );
	addDescription( controllers.isSniper, 'Auto scope and shoot when aimbot locks a target.' );
	addDescription( controllers.aimAtEveryone, 'Enable this to make aimbot work in Survival mode.' );
	updateBlacklistBtn();

	const titleEl = gui.domElement.querySelector( '.title' );
	titleEl.innerText = `[/] Controls`;

}

function addDescription( controller, text ) {

	const div = document.createElement( 'div' );
	div.className = 'my-lil-gui-desc';
	div.innerText = text;
	controller.domElement.querySelector( '.name' ).appendChild( div );

}

function fromCamel( text ) {

	const result = text.replace( /([A-Z])/g, ' $1' );
	return result.charAt( 0 ).toUpperCase() + result.slice( 1 );

}

let isRightDown = false;
window.addEventListener( 'mousedown', event => {

	if ( event.button === 2 && event.isTrusted ) isRightDown = true;

} );
window.addEventListener( 'mouseup', event => {

	if ( event.button === 2 && event.isTrusted ) isRightDown = false;

} );

function canUseAimbot() {

	if ( ! settings.aimbotEnabled ) return false;
	if ( settings.isSniper ) return true;
	if ( ! settings.aimbotOnRightMouse ) return true;
	return isRightDown;

}

function hasLineOfSight( from, to, chunks ) {

	if ( settings.aimBehindWalls ) return true;

	const dist = from.distanceTo( to );
	direction.subVectors( to, from ).normalize();
	raycaster.set( from, direction );

	for ( const chunk of chunks ) {

		if ( ! raycaster.ray.intersectsBox( chunk.box ) ) continue;

		const hit = raycaster.intersectObject( chunk )[ 0 ];
		if ( hit && hit.distance < dist - 0.05 ) return false;

	}

	return true;

}

const geometry = new THREE.EdgesGeometry( new THREE.BoxGeometry( 1, 1, 1 ).translate( 0, 0.5, 0 ) );

const entityRootMatrix = new THREE.Matrix4();
const gameMeshMatrix = new THREE.Matrix4();
const localHitboxMatrix = new THREE.Matrix4();
const aimPartBox = new THREE.Box3();
const aimPartPos = new THREE.Vector3();
const aimFallbackPos = new THREE.Vector3();

const camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 1000 );

const renderer = new THREE.WebGLRenderer( {
	alpha: true,
	antialias: true
} );

renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.domElement.id = 'overlayCanvas';

window.addEventListener( 'resize', () => {

	renderer.setSize( window.innerWidth, window.innerHeight );

} );

const colors = {
	enemy: 'red',
	team: 'blue',
	block: 'green',
	item: 'gold'
};
for ( const key in colors ) {

	const color = new THREE.Color( colors[ key ] );
	color.rawColor = colors[ key ];
	colors[ key ] = color;

}

function MyMaterial( color ) {

	return new THREE.RawShaderMaterial( {
		vertexShader: `

		attribute vec3 position;

		uniform mat4 projectionMatrix;
		uniform mat4 modelViewMatrix;

		void main() {

			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
			gl_Position.z = 1.0;

		}

		`,
		fragmentShader: `

		precision mediump float;

		uniform vec3 color;

		void main() {

			gl_FragColor = vec4( color, 1.0 );

		}

		`,
		uniforms: {
			color: { value: color }
		}
	} );

}

function PlayerHitboxMaterial( color, opacity ) {

	return new THREE.RawShaderMaterial( {
		transparent: true,
		depthWrite: false,
		depthTest: false,
		side: THREE.DoubleSide,
		vertexShader: `

		attribute vec3 position;

		uniform mat4 projectionMatrix;
		uniform mat4 modelViewMatrix;

		void main() {

			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
			gl_Position.z = 1.0;

		}

		`,
		fragmentShader: `

		precision mediump float;

		uniform vec3 color;
		uniform float opacity;

		void main() {

			gl_FragColor = vec4( color, opacity );

		}

		`,
		uniforms: {
			color: { value: color },
			opacity: { value: opacity }
		}
	} );

}

function isNametagMesh( object ) {

	try {

		return object.material?.map?.image instanceof HTMLCanvasElement;

	} catch {

		return false;

	}

}

function traverseEntity( root, callback ) {

	const stack = [ root ];
	const seen = new WeakSet();

	while ( stack.length ) {

		const object = stack.pop();
		if ( ! object || typeof object !== 'object' || seen.has( object ) ) continue;

		seen.add( object );
		callback( object );

		const kids = object[ childrenKey ];
		if ( ! Array.isArray( kids ) ) continue;

		for ( let i = 0; i < kids.length; i ++ ) stack.push( kids[ i ] );

	}

}

function isLikelyHitboxMesh( object ) {

	try {

		const geo = object.geometry;
		const pos = geo?.attributes?.position;
		if ( ! pos ) return false;
		if ( isNametagMesh( object ) ) return false;

		const vertCount = pos.count;
		const indexCount = geo.index?.count ?? 0;
		const name = ( object.name || '' ).toLowerCase();

		if ( name.includes( 'hit' ) || name.includes( 'coll' ) || name.includes( 'hurt' ) ) return true;

		if ( object.visible === false && vertCount <= 512 ) return true;

		if ( vertCount === 8 || vertCount === 24 ) return true;
		if ( vertCount === 8 && indexCount === 36 ) return true;

		return false;

	} catch {

		return false;

	}

}

function cloneGameGeometry( geo ) {

	const clone = new THREE.BufferGeometry();
	clone.setAttribute(
		'position',
		new THREE.BufferAttribute( geo.attributes.position.array.slice(), 3 )
	);

	if ( geo.index ) {

		clone.setIndex( new THREE.BufferAttribute( geo.index.array.slice(), 1 ) );

	}

	return clone;

}

function setLocalTransformFromGameMesh( overlay, entityRoot, gameMesh ) {

	entityRootMatrix.fromArray( entityRoot[ matrixWorldKey ][ elementsKey ] );
	gameMeshMatrix.fromArray( gameMesh[ matrixWorldKey ][ elementsKey ] );
	localHitboxMatrix.copy( entityRootMatrix ).invert().multiply( gameMeshMatrix );
	localHitboxMatrix.decompose( overlay.position, overlay.quaternion, overlay.scale );

}

function collectHitboxMeshes( entity ) {

	const hits = [];

	traverseEntity( entity, object => {

		if ( object === entity ) return;
		if ( isLikelyHitboxMesh( object ) ) hits.push( object );

	} );

	if ( hits.length === 0 ) {

		traverseEntity( entity, object => {

			if ( object === entity ) return;
			if ( isNametagMesh( object ) ) return;

			const pos = object.geometry?.attributes?.position;
			if ( ! pos || pos.count > 512 ) return;

			hits.push( object );

		} );

	}

	return hits;

}

function buildPlayerHitboxes( entity, teamColor ) {

	const group = new THREE.Group();
	entity.myHitboxSources = [];
	entity.aimPartsCache = null;

	for ( const source of collectHitboxMeshes( entity ) ) {

		const overlay = new THREE.Mesh(
			cloneGameGeometry( source.geometry ),
			PlayerHitboxMaterial( teamColor.clone(), 0.35 )
		);
		overlay.frustumCulled = false;
		setLocalTransformFromGameMesh( overlay, entity, source );
		group.add( overlay );
		entity.myHitboxSources.push( { src: source, overlay } );

	}

	return group;

}

function syncPlayerHitboxes( entity ) {

	if ( ! entity.myHitboxSources ) return;

	for ( let i = 0; i < entity.myHitboxSources.length; i ++ ) {

		const { src, overlay } = entity.myHitboxSources[ i ];
		setLocalTransformFromGameMesh( overlay, entity, src );

	}

}

function setHitboxGroupColor( entity, color ) {

	if ( ! entity.myHitboxSources ) return;

	for ( let i = 0; i < entity.myHitboxSources.length; i ++ ) {

		entity.myHitboxSources[ i ].overlay.material.uniforms.color.value = color;

	}

}

function getEntityAimParts( entity ) {

	if ( entity.myHitboxSources?.length ) {

		return entity.myHitboxSources.map( entry => entry.src );

	}

	if ( ! entity.aimPartsCache ) {

		entity.aimPartsCache = collectHitboxMeshes( entity );

	}

	return entity.aimPartsCache;

}

function getPartWorldCenter( gameMesh, target ) {

	gameMeshMatrix.fromArray( gameMesh[ matrixWorldKey ][ elementsKey ] );

	const geo = gameMesh.geometry;

	if ( geo?.attributes?.position ) {

		if ( ! geo.boundingBox ) geo.computeBoundingBox();

		if ( geo.boundingBox ) {

			aimPartBox.copy( geo.boundingBox ).applyMatrix4( gameMeshMatrix );
			return aimPartBox.getCenter( target );

		}

	}

	return target.setFromMatrixPosition( gameMeshMatrix );

}

function pickBestVisibleBodyPart( entity, chunks ) {

	const parts = getEntityAimParts( entity );
	let bestScore = Infinity;
	let bestPos = null;

	for ( let i = 0; i < parts.length; i ++ ) {

		getPartWorldCenter( parts[ i ], aimPartPos );

		if ( Math.hypot( aimPartPos.x - camera.position.x, aimPartPos.z - camera.position.z ) <= 1 ) continue;

		const score = getScreenPixelDistance( aimPartPos );

		if ( score > settings.targetZoneRadius ) continue;
		if ( ! hasLineOfSight( camera.position, aimPartPos, chunks ) ) continue;

		if ( score < bestScore ) {

			bestScore = score;
			bestPos = aimPartPos.clone();

		}

	}

	if ( ! bestPos ) {

		aimFallbackPos.copy( entity.myContainer.position );
		aimFallbackPos.y += settings.aimHeight;

		if ( Math.hypot( aimFallbackPos.x - camera.position.x, aimFallbackPos.z - camera.position.z ) <= 1 ) return null;

		const score = getScreenPixelDistance( aimFallbackPos );

		if ( score > settings.targetZoneRadius ) return null;
		if ( ! hasLineOfSight( camera.position, aimFallbackPos, chunks ) ) return null;

		return { score, pos: aimFallbackPos.clone() };

	}

	return { score: bestScore, pos: bestPos };

}

let target;
let gameCamera;

let projectionMatrixKey;
let matrixWorldKey;
let elementsKey;

function inject() {

	Object.defineProperty( Object.prototype, 'overrideMaterial', {
		set( value ) {

			setTimeout( () => checkScene( this ), 0 );
			this._overrideMaterial = value;

		},
		get() {

			return this._overrideMaterial;

		},
		configurable: true
	} );

	Object.defineProperty( Object.prototype, 'far', {
		set( value ) {

			this._far = value;

		},
		get() {

			checkCamera( this );
			return this._far;

		},
		configurable: true
	} );

}

const postRunName = Math.random().toString(32).slice(0, 10).toUpperCase();

window[postRunName] = function () {

	function installWebGLHooks( WebGL ) {

		if ( ! WebGL || WebGL.__voxiomHooked ) return;
		WebGL.__voxiomHooked = true;

	const blocks = [
		[ 0, 3 ],
		[ 1, 3 ],
		[ 4, 2 ],
		[ 5, 2 ],
		[ 7, 3 ],

		[ 2, 2 ],

		[ 0, 4 ], [ 1, 4 ], [ 2, 4 ],
		[ 0, 5 ], [ 1, 5 ], [ 2, 5 ],
		[ 0, 6 ], [ 1, 6 ], [ 2, 6 ]
	];
	const blockCheck = blocks.map( ( [ x, y ] ) => `( p.x == ${x.toFixed( 1 )} && p.y == ${y.toFixed( 1 )} )` ).join( ' || ' );

	WebGL.shaderSource = new Proxy( WebGL.shaderSource, {
		apply( target, thisArgs, args ) {

			let [ shader, src ] = args;

			if ( src.indexOf( 'vRealUv = realUv;' ) > - 1 ) {

				src = src.replace( 'void main()', `

				uniform bool showOres;
				uniform float currTime;

				void main()` )
				.replace( 'vRealUv = realUv;', `vRealUv = realUv;

				float atlasDim = 16.0;
				float tilePosX = max(0.01, min(0.99, fract(vRealUv.z)));
				float tilePosY = max(0.01, min(0.99, fract(vRealUv.w)));
				vec2 uv = vec2(vRealUv.x * (1.0 / atlasDim) + tilePosX * (1.0 / atlasDim), vRealUv.y * (1.0 / atlasDim) + tilePosY * (1.0 / atlasDim));

				if ( showOres ) {

					vec2 p = uv * ( atlasDim - 1.0 );
					p.x = fract( p.x ) > 0.5 ? ceil( p.x ) : floor( p.x );
					p.y = fract( p.y ) > 0.5 ? ceil( p.y ) : floor( p.y );
					if ( ${blockCheck} ) {

						gl_Position.z = 0.99;
						vAo += 0.25 + abs( sin( currTime * 2.0 ) ) * 0.5;

					}

				}

				` );

				shader.isChunkShader = true;

			}

			args[ 1 ] = src;

			return Reflect.apply( ...arguments );

		}
	} );

	WebGL.attachShader = new Proxy( WebGL.attachShader, {
		apply( target, thisArgs, [ program, shader ] ) {

			if ( shader.isChunkShader ) program.isChunkProgram = true;

			return Reflect.apply( ...arguments );

		}
	} );

	WebGL.useProgram = new Proxy( WebGL.useProgram, {
		apply( target, gl, [ program ] ) {

			Reflect.apply( ...arguments );

			if ( program.isChunkProgram ) {

				if ( ! program.initialized ) {

					program.uniforms = {
						showOres: gl.getUniformLocation( program, 'showOres' ),
						currTime: gl.getUniformLocation( program, 'currTime' )
					};
					program.initialized = true;

				}

				gl.uniform1i( program.uniforms.showOres, settings.showOres );
				gl.uniform1f( program.uniforms.currTime, performance.now() / 1000 );

			}

		}
	} );

	}

	const CTX = CanvasRenderingContext2D.prototype;
	CTX.fillText = new Proxy( CTX.fillText, {
		apply( target, ctx, [ text ] ) {

			ctx.canvas.lastText = text;

			return Reflect.apply( ...arguments );

		}
	} );

	installWebGLHooks( WebGLRenderingContext.prototype );
	installWebGLHooks( typeof WebGL2RenderingContext !== 'undefined' ? WebGL2RenderingContext.prototype : null );

	const props = [ 'far', 'overrideMaterial' ];

	document.addEventListener = new Proxy( document.addEventListener, {
		apply( target, thisArgs, args ) {

			if ( args[ 0 ].startsWith( 'vis' ) ) {

				for ( const prop of props ) delete Object.prototype[ prop ];

				const old = window.setInterval;
				window.setInterval = function () {};

				setTimeout( function () {

					window.setInterval = old;
					inject();

				}, 0 );

			}

			return Reflect.apply( ...arguments );

		}
	} );

	Object.getOwnPropertyNames = new Proxy( Object.getOwnPropertyNames, {
		apply( target, thisArgs, [ object ] ) {

			const list = Reflect.apply( ...arguments );

			if ( object === Object.prototype ) {

				props.forEach( prop => removeFromList( list, prop ) );

			}

			return list;

		}
	} );

	Object.prototype.hasOwnProperty = new Proxy( Object.prototype.hasOwnProperty, {
		apply( target, thisArgs, [ prop ] ) {

			if ( props.includes( prop ) ) return false;

			return Reflect.apply( ...arguments );

		}
	} );

	Object.getOwnPropertyDescriptor = new Proxy( Object.getOwnPropertyDescriptor, {
		apply( target, thisArgs, [ object, prop ] ) {

			if ( object === Object.prototype && props.includes( prop ) ) return undefined;

			return Reflect.apply( ...arguments );

		}
	} );

	Object.getOwnPropertyDescriptors = new Proxy( Object.getOwnPropertyDescriptors, {
		apply( target, thisArgs, [ object ] ) {

			const result = Reflect.apply( ...arguments );

			if ( object === Object.prototype ) {

				props.forEach( prop => ( delete result[ prop ] ) );

			}

			return result;

		}
	} );

	addElements();
	tryToAddElements();
}

function removeQueries() {

	const url = new URL( window.location.href );
	url.searchParams.delete( 'showAd' );
	url.searchParams.delete( 'scriptVersion' );

	window.history.pushState( null, '', url.href );

}

function removeFromList( list, item ) {

	const index = list.indexOf( item );
	if ( index > - 1 ) list.splice( index, 1 );

}

const hooked = new WeakMap();

function checkCamera( object ) {

	if ( object instanceof THREE.PerspectiveCamera || hooked.get( object ) ) return;

	let foundProjectionMatrix = false;

	for ( const key in object ) {

		const value = object[ key ];
		if ( value && typeof value === 'object' ) {

			const prop = Object.keys( value )[ 0 ];
			const array = value[ prop ];

			if ( Array.isArray( array ) && array[ 11 ] === - 1 ) {

				elementsKey = prop;
				projectionMatrixKey = key;
				foundProjectionMatrix = true;

			}

		} else if ( typeof value === 'function' ) {

			const match = /verse'\]\(this\['([^']+)'\]\);/.exec( value.toString() );
			if ( match ) matrixWorldKey = match[ 1 ];

		}

	}

	if ( ! foundProjectionMatrix ) return;

	hooked.set( object, true );

	console.log( 'Hooking camera!', {
		projectionMatrixKey,
		matrixWorldKey,
		elementsKey
	} );

	object[ projectionMatrixKey ] = new Proxy( object[ projectionMatrixKey ], {
		get() {

			setTransform( camera, object );
			camera.near = object.near;
			camera.far = object.far;
			camera.aspect = object.aspect;
			camera.fov = object.fov;
			camera.updateProjectionMatrix();

			gameCamera = object;

			return Reflect.get( ...arguments );

		}
	} );

}

function setTransform( targetObject, sourceObject ) {

	const matrix = new THREE.Matrix4().fromArray( sourceObject[ matrixWorldKey ][ elementsKey ] );
	matrix.decompose( targetObject.position, targetObject.quaternion, targetObject.scale );

}

let worldScene;
let childrenKey;

function checkScene( scene ) {

	if ( scene instanceof THREE.Scene || scene === worldScene ) return;

	for ( const key in scene ) {

		const children = scene[ key ];

		if ( Array.isArray( children ) && children.length === 9 ) {

			for ( const child of children ) {

				if ( typeof child !== 'object' || ! child.hasOwnProperty( 'uuid' ) ) return;

			}

			worldScene = scene;
			childrenKey = key;
			console.log( { worldScene, childrenKey } );
			return;

		}

	}

}

function isBlock( entity ) {

	try {

		const mesh = entity[ childrenKey ][ 0 ];
		return mesh.geometry.index.count === 36;

	} catch {

		return false;

	}

}

function isPlayer( entity ) {

	try {

		return entity[ childrenKey ].length > 2 || ! entity[ childrenKey ][ 1 ].geometry;

	} catch {

		return false;

	}

}

function isEnemy( entity ) {

	for ( const child of entity[ childrenKey ] ) {

		try {

			const image = child.material.map.image;

			if ( image instanceof HTMLCanvasElement ) {

				entity.username = image.lastText;
				return false;

			}

		} catch {}

	}

	return true;

}

const chunkMaterial = new THREE.MeshNormalMaterial();
const raycaster = new THREE.Raycaster();
const direction = new THREE.Vector3();

const line = new THREE.LineSegments( new THREE.BufferGeometry(), MyMaterial( colors.enemy ) );
line.frustumCulled = false;
const linePositions = new THREE.BufferAttribute( new Float32Array( 200 * 2 * 3 ), 3 );
line.geometry.setAttribute( 'position', linePositions );

const screenPos = new THREE.Vector3();

function getScreenPixelDistance( worldPos ) {

	screenPos.copy( worldPos );
	screenPos.project( camera );

	const x = ( screenPos.x * 0.5 + 0.5 ) * window.innerWidth;
	const y = ( - screenPos.y * 0.5 + 0.5 ) * window.innerHeight;
	const cx = window.innerWidth * 0.5;
	const cy = window.innerHeight * 0.5;

	return Math.hypot( x - cx, y - cy );

}

function isInTargetZone( worldPos ) {

	return getScreenPixelDistance( worldPos ) <= settings.targetZoneRadius;

}

function updateTargetZoneVisual() {

	if ( ! targetZoneEl ) return;

	if ( ! settings.showTargetZone ) {

		targetZoneEl.style.display = 'none';
		return;

	}

	const size = settings.targetZoneRadius * 2;

	targetZoneEl.style.display = 'block';
	targetZoneEl.style.width = `${ size }px`;
	targetZoneEl.style.height = `${ size }px`;

}

function animate() {

	window.requestAnimationFrame( animate );

	if ( ! worldScene ) return;

	const now = Date.now();

	const scene = new THREE.Scene();

	const rawChunks = worldScene[ childrenKey ][ 4 ][ childrenKey ];
	const chunks = [];

	for ( const chunk of rawChunks ) {

		if ( ! chunk.geometry ) continue;

		let myChunk = chunk.myChunk;

		if ( ! myChunk ) {

			const positionArray = chunk.geometry.attributes.position.array;
			if ( positionArray.length === 0 ) continue;

			const geometry = new THREE.BufferGeometry();
			geometry.setAttribute(
				'position',
				new THREE.BufferAttribute( positionArray, 3 )
			);
			geometry.setIndex(
				new THREE.BufferAttribute( chunk.geometry.index.array, 1 )
			);
			geometry.computeVertexNormals();
			geometry.computeBoundingBox();

			myChunk = new THREE.Mesh( geometry, chunkMaterial );
			myChunk.box = new THREE.Box3();
			chunk.myChunk = myChunk;

		}

		if ( chunk.material ) chunk.material.wireframe = settings.worldWireframe;

		setTransform( myChunk, chunk );
		myChunk.updateMatrixWorld();
		myChunk.box.copy( myChunk.geometry.boundingBox ).applyMatrix4( myChunk.matrixWorld );
		chunks.push( myChunk );

	}

	chunks.sort( ( a, b ) => {

		return camera.position.distanceTo( a.position ) - camera.position.distanceTo( b.position );

	} );

	let lineCounter = 0;
	const lineOrigin = camera.localToWorld( new THREE.Vector3( 0, 4, - 10 ) );

	const entities = worldScene[ childrenKey ][ 5 ][ childrenKey ];

	let targetPlayer;
	let bestTargetScore = Infinity;

	for ( let i = 0; i < entities.length; i ++ ) {

		const entity = entities[ i ];
		if ( entity[ childrenKey ].length === 0 ) continue;

		if ( ! entity.myContainer ) {

			entity.myContainer = new THREE.Object3D();
			entity.discoveredAt = now;

		}

		if ( now - entity.discoveredAt < 500 ) continue;

		if ( ! entity.myBox ) {

			let box;

			if ( isPlayer( entity ) ) {

				entity.isPlayer = true;
				entity.isEnemy = isEnemy( entity );
				const teamColor = entity.isEnemy ? colors.enemy : colors.team;
				box = buildPlayerHitboxes( entity, teamColor );

			} else {

				entity.isBlock = isBlock( entity );
				box = new THREE.LineSegments( geometry );
				box.material = MyMaterial( entity.isBlock ? colors.block : colors.item );
				box.scale.set( 0.25, 0.1, 0.25 );

				if ( ! entity.isBlock ) {

					const sprite = createSprite( entity.name, colors.item.rawColor );
					sprite.position.y = sprite.scale.y + 0.2;
					entity.myContainer.add( sprite );
					entity.mySprite = sprite;

				}

			}

			entity.myBox = box;
			entity.myContainer.add( entity.myBox );

		}

		if ( entity.isPlayer ) {

			entity.myBox.visible = settings.showPlayers;

			if ( ! entity.myHitboxSources?.length && now - entity.discoveredAt > 1500 && ! entity.hitboxRetried ) {

				entity.hitboxRetried = true;
				const teamColor = entity.isEnemy ? colors.enemy : colors.team;
				const group = buildPlayerHitboxes( entity, teamColor );

				if ( group.children.length > 0 ) {

					while ( entity.myBox.children.length > 0 ) entity.myBox.remove( entity.myBox.children[ 0 ] );

					while ( group.children.length > 0 ) entity.myBox.add( group.children[ 0 ] );

					entity.aimPartsCache = null;

				}

			}

		} else if ( entity.isBlock ) {

			entity.myBox.visible = settings.showBlocks;

		} else {

			entity.myBox.visible = settings.showItems;
			entity.mySprite.visible = settings.showItemNames;

		}

		if ( typeof entity.visible === 'boolean' && ! entity.visible ) continue;

		setTransform( entity.myContainer, entity );

		if ( entity.isPlayer ) syncPlayerHitboxes( entity );

		scene.add( entity.myContainer );

		if ( ! entity.isPlayer ) continue;

		const isBlacklisted = typeof entity.username === 'string' && aimbotBlacklist[ entity.username.toLowerCase() ];
		const isAimbotTarget = ! isBlacklisted && ( settings.aimAtEveryone || entity.isEnemy );

		if ( isAimbotTarget ) {

			linePositions.setXYZ( lineCounter ++, lineOrigin.x, lineOrigin.y, lineOrigin.z );
			const p = entity.myContainer.position;
			linePositions.setXYZ( lineCounter ++, p.x, p.y + 1.25, p.z );

		}

		if ( isAimbotTarget !== entity.wasAimbotTarget ) {

			updatePlayerColors( entity, isAimbotTarget );
			entity.wasAimbotTarget = isAimbotTarget;

		}

		if ( entity.usernameSprite ) entity.usernameSprite.visible = settings.showPlayerNames;

		//

		const shouldExecuteAimbot = canUseAimbot();

		if ( ! shouldExecuteAimbot || ! gameCamera ) continue;

		if ( isAimbotTarget && now - entity.discoveredAt > 2000 ) {

			aimFallbackPos.copy( entity.myContainer.position );
			aimFallbackPos.y += settings.aimHeight;

			if ( Math.hypot( aimFallbackPos.x - camera.position.x, aimFallbackPos.z - camera.position.z ) <= 1 ) continue;

			const targetScore = getScreenPixelDistance( aimFallbackPos );

			if ( targetScore > settings.targetZoneRadius ) continue;

			if ( targetScore < bestTargetScore ) {

				if ( ! hasLineOfSight( camera.position, aimFallbackPos, chunks ) ) continue;

				targetPlayer = entity;
				bestTargetScore = targetScore;

			}

		}

	}

	if ( targetPlayer && canUseAimbot() ) {

		const pick = pickBestVisibleBodyPart( targetPlayer, chunks );
		const aimPos = pick?.pos;

		const inZone = aimPos && isInTargetZone( aimPos );
		const clearShot = inZone && hasLineOfSight( camera.position, aimPos, chunks );

		if ( clearShot ) lookAt( gameCamera, aimPos.x, aimPos.y, aimPos.z );

		if ( settings.isSniper ) {

			updateSniperCombat( clearShot );

		} else if ( settings.autoFire && clearShot ) {

			setFire( true );

		} else {

			setFire( false );

		}

	} else if ( settings.isSniper ) {

		updateSniperCombat( false );

	} else {

		setFire( false );

	}

	if ( settings.showLines ) {

		linePositions.needsUpdate = true;
		line.geometry.setDrawRange( 0, lineCounter );
		scene.add( line );

	}

	updateTargetZoneVisual();

	renderer.render( scene, camera );

}

function lookAt( object, x, y, z ) {

	const dummy = new THREE.PerspectiveCamera();

	setTransform( dummy, object );
	dummy.lookAt( x, y, z );

	object.rotation.set(
		dummy.rotation.x,
		dummy.rotation.y,
		dummy.rotation.z,
		dummy.rotation.order
	);

}

function updatePlayerColors( entity, isAimbotTarget ) {

	const hitboxColor = entity.isEnemy ? colors.enemy : colors.team;
	setHitboxGroupColor( entity, hitboxColor );

	const nametagColor = isAimbotTarget ? colors.enemy : colors.team;

	if ( entity.usernameSprite ) {

		entity.myContainer.remove( entity.usernameSprite );
		entity.usernameSprite = null;

	}

	if ( entity.username ) {

		const sprite = createSprite( entity.username, nametagColor.rawColor );
		sprite.position.y = sprite.scale.y + 1.25;
		entity.myContainer.add( sprite );
		entity.usernameSprite = sprite;

	}

}

function createSprite( text, bgColor = '#000' ) {

	const fontSize = 40;
	const strokeSize = 10;
	const font = 'normal ' + fontSize + 'px Arial';

	const canvas = document.createElement( 'canvas' );
	const ctx = canvas.getContext( '2d' );

	ctx.font = font;
	canvas.width = ctx.measureText( text ).width + strokeSize * 2;
	canvas.height = fontSize + strokeSize * 2;

	ctx.fillStyle = bgColor;
	ctx.fillRect( 0, 0, canvas.width, canvas.height );

	ctx.font = font;
	ctx.fillStyle = 'white';
	ctx.textBaseline = 'top';
	ctx.textAlign = 'left';
	ctx.lineWidth = strokeSize;
	ctx.strokeText( text, strokeSize, strokeSize );
	ctx.fillText( text, strokeSize, strokeSize );

	const material = new THREE.SpriteMaterial( {
		map: new THREE.CanvasTexture( canvas ),
		sizeAttenuation: false,
		fog: false,
		depthTest: false,
		depthWrite: false
	} );
	const sprite = new THREE.Sprite( material );
	sprite.center.y = 0;

	sprite.scale.y = 0.035;
	sprite.scale.x = sprite.scale.y * canvas.width / canvas.height;

	return sprite;

}

let lastFireStatus = false;
let sniperTimers = [];

const sniperCombat = {
	engaged: false,
	scoped: false,
	scopeStartedAt: 0,
	lastShotAt: 0,
	shotInProgress: false
};

const SNIPER_SCOPE_MS = 280;
const SNIPER_SHOT_MS = 70;
const SNIPER_CYCLE_MS = 480;

const MOVEMENT_KEYS = [
	{ code: 'KeyW', key: 'w', keyCode: 87 },
	{ code: 'KeyA', key: 'a', keyCode: 65 },
	{ code: 'KeyS', key: 's', keyCode: 83 },
	{ code: 'KeyD', key: 'd', keyCode: 68 },
	{ code: 'Space', key: ' ', keyCode: 32 },
	{ code: 'ShiftLeft', key: 'Shift', keyCode: 16 },
	{ code: 'ShiftRight', key: 'Shift', keyCode: 16 }
];

const MOVEMENT_KEY_CODES = new Set( MOVEMENT_KEYS.map( k => k.code ) );

function dispatchKey( type, { code, key, keyCode } ) {

	document.dispatchEvent( new KeyboardEvent( type, {
		key,
		code,
		keyCode,
		which: keyCode,
		bubbles: true,
		cancelable: true
	} ) );

}

function stopMovement() {

	for ( const keyInfo of MOVEMENT_KEYS ) {

		dispatchKey( 'keyup', keyInfo );

	}

}

window.addEventListener( 'keydown', event => {

	if ( ! settings.isSniper || ! sniperCombat.engaged ) return;
	if ( ! MOVEMENT_KEY_CODES.has( event.code ) ) return;

	event.stopImmediatePropagation();
	event.preventDefault();
	stopMovement();

}, true );

function clearSniperTimers() {

	sniperTimers.forEach( clearTimeout );
	sniperTimers = [];

}

function scheduleSniper( fn, ms ) {

	sniperTimers.push( setTimeout( fn, ms ) );

}

function dispatchMouse( type, button, buttons ) {

	const which = button === 0 ? 1 : button === 1 ? 2 : button === 2 ? 3 : 0;

	document.dispatchEvent( new MouseEvent( type, {
		button,
		buttons,
		which,
		bubbles: true,
		cancelable: true,
		view: window
	} ) );

}

function releaseAllMouse() {

	dispatchMouse( 'mouseup', 0, 0 );
	dispatchMouse( 'mouseup', 2, 0 );

}

function resetSniperCombat() {

	clearSniperTimers();
	releaseAllMouse();
	sniperCombat.engaged = false;
	sniperCombat.scoped = false;
	sniperCombat.scopeStartedAt = 0;
	sniperCombat.lastShotAt = 0;
	sniperCombat.shotInProgress = false;
	lastFireStatus = false;

}

function updateSniperCombat( engage ) {

	if ( ! engage ) {

		if ( sniperCombat.engaged ) resetSniperCombat();
		return;

	}

	const now = Date.now();
	sniperCombat.engaged = true;
	lastFireStatus = true;

	stopMovement();

	if ( ! sniperCombat.scoped ) {

		if ( ! sniperCombat.scopeStartedAt ) {

			sniperCombat.scopeStartedAt = now;
			dispatchMouse( 'mousedown', 2, 2 );

		}

		if ( now - sniperCombat.scopeStartedAt < SNIPER_SCOPE_MS ) return;

		sniperCombat.scoped = true;
		sniperCombat.lastShotAt = 0;

	}

	if ( sniperCombat.shotInProgress ) return;
	if ( now - sniperCombat.lastShotAt < SNIPER_CYCLE_MS ) return;

	sniperCombat.shotInProgress = true;
	dispatchMouse( 'mousedown', 0, 3 );

	scheduleSniper( () => {

		if ( ! sniperCombat.engaged ) return;

		dispatchMouse( 'mouseup', 0, 2 );
		sniperCombat.shotInProgress = false;
		sniperCombat.lastShotAt = Date.now();

	}, SNIPER_SHOT_MS );

}

function setFire( bool ) {

	if ( settings.isSniper ) return;

	if ( lastFireStatus === bool ) return;
	lastFireStatus = bool;

	if ( ! bool ) {

		dispatchMouse( 'mouseup', 0, 0 );
		return;

	}

	dispatchMouse( 'mousedown', 0, 1 );

}

window.requestAnimationFrame( animate );

function startHooks() {

	setTimeout( () => {

		if ( typeof window[ postRunName ] === 'function' ) {

			window[ postRunName ]();

		}

	}, 0 );

}

if ( true ) {

	console.log( 'Voxiom cheat initializing' );

	try {

		Object.defineProperty( Object.prototype, 'amogus', {
			value: 69,
			configurable: true
		} );
		delete Object.prototype.amogus;

		for ( let i = 0, l = document.scripts.length; i < l; i ++ ) {

			if ( document.scripts[ i ].innerHTML.indexOf( 'function DUWAC' ) > - 1 ) {

				console.log( 'DUWAC detected; CSP blocks inline rewrite — using direct hooks' );
				break;

			}

		}

		startHooks();
		removeQueries();

	} catch ( error ) {

		console.warn( 'Init error, starting hooks anyway:', error );
		startHooks();

	}

}

const el = document.createElement( 'div' );

el.innerHTML = `<style>

* {
	pointer-events: all;
}

.msg {
	position: absolute;
	left: 10px;
	bottom: 10px;
	background: rgba(50, 0, 0, 0.8);
	color: #fff;
	padding: 15px;
	animation: msg 0.5s forwards, msg 0.5s reverse forwards 3s;
	z-index: 999999;
	pointer-events: none;
}

.msg, .lil-gui {
	font-family: cursive;
}

@keyframes msg {
	from {
		transform: translate(-120%, 0);
	}

	to {
		transform: none;
	}
}

#overlayCanvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.my-lil-gui-desc {
	font-size: 0.8em;
	opacity: 0.8;
	max-width: 100px;
	line-height: 1;
	white-space: normal !important;
}

</style>
<div class="msg" style="display: none;"></div>`;

const msgEl = el.querySelector( '.msg' );

const targetZoneEl = document.createElement( 'div' );
Object.assign( targetZoneEl.style, {
	position: 'absolute',
	left: '50%',
	top: '50%',
	transform: 'translate(-50%, -50%)',
	border: '2px solid rgba(0, 255, 102, 0.55)',
	borderRadius: '50%',
	pointerEvents: 'none',
	boxSizing: 'border-box',
	display: 'none'
} );

function addElements() {

	while ( el.children.length > 0 ) {

		shadow.appendChild( el.children[ 0 ] );

	}

	shadow.appendChild( renderer.domElement );
	shadow.appendChild( targetZoneEl );

	initGui();

}

function tryToAddElements() {

	if ( document.body ) {

		document.body.appendChild( shadowHost );
		return;

	}

	setTimeout( tryToAddElements, 100 );

}

function toggleSetting( key ) {

	settings[ key ] = ! settings[ key ];
	showMsg( fromCamel( key ), settings[ key ] );

}

window.addEventListener( 'keyup', function ( event ) {

	const active = document.activeElement;
	if ( active && ( active.tagName === 'INPUT' || active.tagName === 'TEXTAREA' ) ) return;

	if ( keyToSetting[ event.code ] ) {

		toggleSetting( keyToSetting[ event.code ] );

	}

	switch ( event.code ) {

		case 'Slash' :
			if ( gui ) gui._hidden ? gui.show() : gui.hide();
			break;

	}

} );

function showMsg( name, bool ) {

	msgEl.innerText = name + ': ' + ( bool ? 'ON' : 'OFF' );

	msgEl.style.display = 'none';
	void msgEl.offsetWidth;
	msgEl.style.display = '';

}

window.__debug = () => ( { worldScene, childrenKey, gameCamera, matrixWorldKey, elementsKey } );