Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/discord-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ jobs:

(
cd "$source_dir"
zip -qr "$GITHUB_WORKSPACE/V5-Release.zip" .
zip -qr "$GITHUB_WORKSPACE/V5-Mojmap.zip" .
)
- name: Upload Release zip to R2
if: ${{ endsWith(github.repository, '/V5') && github.ref == 'refs/heads/main' }}
if: ${{ endsWith(github.repository, '/V5') && github.ref == 'refs/heads/mojmap' }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
wrangler r2 object put v5-builds/V5-Release.zip --file V5-Release.zip --remote
wrangler r2 object put v5-builds/V5-Mojmap.zip --file V5-Mojmap.zip --remote

- name: Send to Discord
env:
Expand Down
4 changes: 3 additions & 1 deletion failsafes/AlertUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ class AlertUtilsClass {
* Uses GLFW to grab the window on a failsafe if they have the setting toggled (WIP)
*/
_grabWindowOnFailsafe() {
return;
// todo: fix: broken due to 26.1 mappings
try {
const GLFW = org.lwjgl.glfw.GLFW;
const windowHandle = Client.getMinecraft().getWindow().getHandle();
const windowHandle = Client.getMinecraft().getWindow();

const wasIconified = GLFW.glfwGetWindowAttrib(windowHandle, GLFW.GLFW_ICONIFIED) === GLFW.GLFW_TRUE;
const wasMaximized = GLFW.glfwGetWindowAttrib(windowHandle, GLFW.GLFW_MAXIMIZED) === GLFW.GLFW_TRUE;
Expand Down
4 changes: 2 additions & 2 deletions failsafes/impl/ChatMentionFailsafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Chat } from '../../utils/Chat';
import { MacroState } from '../../utils/MacroState';
import { Failsafe } from '../Failsafe';
import FailsafeUtils from '../FailsafeUtils';
import { GameMessageS2C } from '../../utils/Packets';
import { ClientboundSystemChatPacket } from '../../utils/Packets';

class ChatMentionFailsafe extends Failsafe {
constructor() {
Expand Down Expand Up @@ -33,7 +33,7 @@ class ChatMentionFailsafe extends Failsafe {
if (!result.isBlocked) return;

this.onTrigger(result);
}).setFilteredClass(GameMessageS2C);
}).setFilteredClass(ClientboundSystemChatPacket);
}

scanMessage(msg, fullMessage = msg) {
Expand Down
15 changes: 8 additions & 7 deletions failsafes/impl/RotationFailsafe.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Chat } from '../../utils/Chat';
import { MathUtils } from '../../utils/Math';
import { MacroState } from '../../utils/MacroState';
import { PlayerPositionLookS2C } from '../../utils/Packets';
import { ClientboundPlayerPositionPacket } from '../../utils/Packets';
import { Failsafe } from '../Failsafe';
import FailsafeUtils from '../FailsafeUtils';

Expand All @@ -25,13 +25,13 @@ class RotationFailsafe extends Failsafe {
const currPitch = Player.getPitch();

const pos = packet.change().position();
const newX = pos.x;
const newY = pos.y;
const newZ = pos.z;
const newX = Number(pos.x());
const newY = Number(pos.y());
const newZ = Number(pos.z());

const change = packet.change();
const newYaw = change.yaw();
const newPitch = change.pitch();
const newYaw = Number(change.yRot());
const newPitch = Number(change.xRot());

const dx = Math.abs(newX - fromX);
const dy = Math.abs(newY - fromY);
Expand All @@ -41,6 +41,7 @@ class RotationFailsafe extends Failsafe {
const yawDiff = Math.abs(MathUtils.getAngleDifference(currYaw, newYaw));
const pitchDiff = Math.abs(newPitch - currPitch);

// todo: this isnt what a null rotation packet is, which retard made these failsafes?
if (yawDiff === 0 && pitchDiff === 0) {
Chat.messageDebug('null rotation packet ignored (yawDiff=0, pitchDiff=0)', false);
return;
Expand All @@ -53,7 +54,7 @@ class RotationFailsafe extends Failsafe {
if (this.disabled || !MacroState.isFailsafeMacroRunning() || scheduledAt < this._disabledUntil) return;
this.onTrigger(currYaw, currPitch, newYaw, newPitch, yawDiff, pitchDiff);
}, this._getReactionDelay(this.settings));
}).setFilteredClass(PlayerPositionLookS2C);
}).setFilteredClass(ClientboundPlayerPositionPacket);
}

onTrigger(fromYaw, fromPitch, toYaw, toPitch, yawDiff, pitchDiff) {
Expand Down
4 changes: 2 additions & 2 deletions failsafes/impl/SlotChangeFailsafe.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Chat } from '../../utils/Chat';
import { MacroState } from '../../utils/MacroState';
import { UpdateSelectedSlotS2C } from '../../utils/Packets';
import { ClientboundSetHeldSlotPacket } from '../../utils/Packets';
import { Failsafe } from '../Failsafe';
import FailsafeUtils from '../FailsafeUtils';

Expand All @@ -27,7 +27,7 @@ class SlotChangeFailsafe extends Failsafe {
if (this.disabled || !MacroState.isFailsafeMacroRunning() || scheduledAt < this._disabledUntil) return;
this.onTrigger(currentSlot, newSlot);
}, this._getReactionDelay(this.settings));
}).setFilteredClass(UpdateSelectedSlotS2C);
}).setFilteredClass(ClientboundSetHeldSlotPacket);
}

onTrigger(fromSlot, toSlot) {
Expand Down
18 changes: 9 additions & 9 deletions failsafes/impl/TeleportFailsafe.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Chat } from '../../utils/Chat';
import { MacroState } from '../../utils/MacroState';
import { PlayerInteractItemC2S, PlayerPositionLookS2C, CommandExecutionC2S } from '../../utils/Packets';
import { ServerboundUseItemPacket, ClientboundPlayerPositionPacket, ServerboundChatCommandPacket } from '../../utils/Packets';
import PathConfig from '../../utils/pathfinder/PathConfig';
import { Failsafe } from '../Failsafe';
import FailsafeUtils from '../FailsafeUtils';
Expand Down Expand Up @@ -32,7 +32,7 @@ class TeleportFailsafe extends Failsafe {
register('packetSent', () => {
if (!MacroState.isFailsafeMacroRunning()) return;
lastRightClickTime = Date.now();
}).setFilteredClass(PlayerInteractItemC2S);
}).setFilteredClass(ServerboundUseItemPacket);

register('packetSent', (packet) => {
if (!MacroState.isFailsafeMacroRunning()) return;
Expand All @@ -47,7 +47,7 @@ class TeleportFailsafe extends Failsafe {
pendingWarpIgnoreTimer = null;
}, WARP_IGNORE_TIMEOUT_MS);
}
}).setFilteredClass(CommandExecutionC2S);
}).setFilteredClass(ServerboundChatCommandPacket);
}

shouldIgnoreWarpTeleport(x, y, z) {
Expand Down Expand Up @@ -135,9 +135,9 @@ class TeleportFailsafe extends Failsafe {
const change = packet.change();
const pos = change.position();

const newX = pos.x;
const newY = pos.y;
const newZ = pos.z;
const newX = Number(pos.x());
const newY = Number(pos.y());
const newZ = Number(pos.z());

const dx = newX - fromX;
const dy = newY - fromY;
Expand All @@ -147,8 +147,8 @@ class TeleportFailsafe extends Failsafe {

const data = {
distance,
yaw: change.yaw(),
pitch: change.pitch(),
yaw: Number(change.yRot()),
pitch: Number(change.xRot()),
currYaw: Player.getYaw(),
currPitch: Player.getPitch(),
lastRightClickTime,
Expand Down Expand Up @@ -180,7 +180,7 @@ class TeleportFailsafe extends Failsafe {
if (this.disabled || !MacroState.isFailsafeMacroRunning() || scheduledAt < this._disabledUntil || this._shouldDisableTeleport(data)) return;
this.onTrigger(fromX, fromY, fromZ, newX, newY, newZ, distance);
}, this._getReactionDelay(this.settings));
}).setFilteredClass(PlayerPositionLookS2C);
}).setFilteredClass(ClientboundPlayerPositionPacket);
}

handleNullPacket(x, y, z) {
Expand Down
13 changes: 7 additions & 6 deletions failsafes/impl/VelocityFailsafe.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Chat } from '../../utils/Chat';
import { MacroState } from '../../utils/MacroState';
import { EntityVelocityUpdateS2C } from '../../utils/Packets';
import { ClientboundSetEntityMotionPacket } from '../../utils/Packets';
import { Failsafe } from '../Failsafe';
import FailsafeUtils from '../FailsafeUtils';

Expand All @@ -24,7 +24,7 @@ class VelocityFailsafe extends Failsafe {
this._handleVelocityOnDamageDisabled();
if (this.disabled) return;
const playerMP = Player.asPlayerMP();
if (!playerMP || packet?.getEntityId() !== playerMP?.mcValue?.getId()) return;
if (!playerMP || packet?.id?.() !== playerMP?.mcValue?.getId()) return;

const x = Math.floor(Player.getX());
const y = Math.floor(Player.getY()) - 1;
Expand All @@ -36,9 +36,10 @@ class VelocityFailsafe extends Failsafe {
this.settings = FailsafeUtils.getFailsafeSettings('Velocity');
if (!this.settings.isEnabled) return;

const vx = packet?.getVelocity().x;
const vy = packet?.getVelocity().y;
const vz = packet?.getVelocity().z;
const movement = packet?.movement?.();
const vx = movement?.x;
const vy = movement?.y;
const vz = movement?.z;
const speed = Math.hypot(vx, vy, vz);

if (this._shouldDisableVelocity(speed, blockName)) return;
Expand All @@ -48,7 +49,7 @@ class VelocityFailsafe extends Failsafe {
return;
this.onTrigger(speed);
}, this._getReactionDelay(this.settings));
}).setFilteredClass(EntityVelocityUpdateS2C);
}).setFilteredClass(ClientboundSetEntityMotionPacket);
}

_handleVelocityOnDamageDisabled() {
Expand Down
2 changes: 1 addition & 1 deletion gui/GUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ export const openGui = () => {
};

export const closeGui = () => {
GuiState.myGui.close();
Client.currentGui.close();
};
2 changes: 1 addition & 1 deletion gui/NotificationManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class NotificationManager {

try {
const window = Client.getMinecraft().getWindow();
const scale = window.getScaleFactor();
const scale = window.getGuiScale();
const mouseX = Client.getMouseX() / scale;
const mouseY = Client.getMouseY() / scale;

Expand Down
4 changes: 2 additions & 2 deletions gui/OverlayUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ class OverlayUtils {
const sw = Renderer.screen.getWidth();
const sh = Renderer.screen.getHeight();
if (sw === 0) return;
Client.getMinecraft().gameRenderer.renderBlur();
Client.getMinecraft().gameRenderer.processBlurEffect();
this.editorBoxes = {};
this.drawingGUI = true;

Expand Down Expand Up @@ -1010,7 +1010,7 @@ class OverlayUtils {
}

openPositionsGUI() {
GuiState.myGui.close();
Client.currentGui.close();
Overlays.Gui.open();
}

Expand Down
7 changes: 6 additions & 1 deletion gui/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ export const setGuiClickSoundEnabled = (enabled) => {

export const playClickSound = () => {
if (!guiClickSoundEnabled) return;
World.getWorld().playSoundClient(SoundEvent.of(Identifier.of('minecraft', 'entity.experience_orb.pickup')), SoundCategory.MASTER, 0.5, 1.0);
World.getWorld().playPlayerSound(
SoundEvent.createVariableRangeEvent(Identifier.fromNamespaceAndPath('minecraft', 'entity.experience_orb.pickup')),
SoundCategory.MASTER,
0.5,
1.0
);
};

const profilePath = new File(globalAssetsDir, 'discordProfile.png');
Expand Down
2 changes: 1 addition & 1 deletion gui/categories/CategoryManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const createCategoriesManager = (deps) => {

const enabledByClick = typeof module.requestToggleFromUser === 'function' ? module.requestToggleFromUser() : false;
if (module.isMacro && enabledByClick && GuiState.myGui.isOpen()) {
GuiState.myGui.close();
Client.currentGui.close();
}
},
{ showContainer: false }
Expand Down
2 changes: 1 addition & 1 deletion gui/core/GuiEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ GuiState.myGui.registerScrolled(handleScroll);
NVG.registerV5Render(() => {
if (GuiState.myGui.isOpen()) {
const window = Client.getMinecraft().getWindow();
const scale = window.getScaleFactor();
const scale = window.getGuiScale();
const mouseX = Client.getMouseX() / scale;
const mouseY = Client.getMouseY() / scale;
drawGUI(mouseX, mouseY);
Expand Down
2 changes: 1 addition & 1 deletion gui/core/GuiRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const drawGUI = (mouseX, mouseY) => {
const centerX = targetBackground.x + targetBackground.width / 2;
const centerY = targetBackground.y + targetBackground.height / 2;

Client.getMinecraft().gameRenderer.renderBlur();
Client.getMinecraft().gameRenderer.processBlurEffect();

try {
NVG.beginFrame(Renderer.screen.getWidth(), Renderer.screen.getHeight());
Expand Down
8 changes: 4 additions & 4 deletions loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import './gui/GUI';
/* CORE */
import './utils/Config';
import './utils/backend/WebSocket';
import { RequestCommandCompletionsC2S } from './utils/Packets';
import { ServerboundCommandSuggestionPacket } from './utils/Packets';

register('packetSent', (packet, event) => {
if (packet.getPartialCommand().toLowerCase().startsWith('/v5')) cancel(event);
}).setFilteredClass(RequestCommandCompletionsC2S);
if (packet.getCommand().toLowerCase().startsWith('/v5')) cancel(event);
}).setFilteredClass(ServerboundCommandSuggestionPacket);

/* Utils */
import { MacroState } from './utils/MacroState';
Expand All @@ -23,7 +23,7 @@ import './modules/other/MacroControllers';
import './modules/other/DiscordIntegration';
import './utils/pathfinder/PathFinder';
import './utils/pathfinder/EtherwarpPathfinder';
import './utils/Clipping';
//import './utils/Clipping';
import './utils/Misc';
import './failsafes/FailsafeManager';
import './utils/SkyblockEvents';
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "V5",
"creator": "Zurviq, Rdbt, EpilsonPhoenix and Contributors",
"description": "Cheaters get banned",
"version": "1.0.0 beta",
"version": "5.0.1",
"entry": "loader.js",
"requires": ["requestV2", "WebSocket"]
}
2 changes: 1 addition & 1 deletion modules/combat/CombatBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class Combat extends ModuleBase {
const mcItem = item?.toMC ? item.toMC() : item;
if (!mcItem) return false;

const profileType = net.minecraft.component.DataComponentTypes.PROFILE;
const profileType = net.minecraft.core.component.DataComponents.PROFILE;
const profileComponent = mcItem.get(profileType);
const profileString = profileComponent?.getGameProfile?.()?.toString() || '';
if (!profileString) return false;
Expand Down
12 changes: 6 additions & 6 deletions modules/farming/FarmingMacro/FarmHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default class FarmHandler {
const playerBlockY = Math.round(player.getY());
const playerBlockZ = Math.floor(player.getZ());

let yaw = ((player.getYaw() % 360) + 360) % 360;
let yaw = ((MathUtils.wrapTo180(player.getYRot()) % 360) + 360) % 360;
const scanResults = [];
const range = [-5, -4, -3, -2, -1, 1, 2, 3, 4, 5];

Expand Down Expand Up @@ -144,7 +144,7 @@ export default class FarmHandler {

getBlockInFront(offsetDist = 1, yOffset = 0) {
const player = Player.getPlayer();
let yaw = ((player.getYaw() % 360) + 360) % 360;
let yaw = ((MathUtils.wrapTo180(player.getYRot()) % 360) + 360) % 360;
let dx = 0,
dz = 0;

Expand Down Expand Up @@ -197,11 +197,11 @@ export default class FarmHandler {
} else {
if (!macro.decidePrompted) macro.message(`&cMacro can't decide, press A or D!`);
macro.decidePrompted = true;
if (Client.getMinecraft().options.leftKey.isPressed()) {
if (Client.getMinecraft().options.keyLeft.isDown()) {
macro.movementKey = 'a';
macro.ignoreKeys = ['d', 's'];
macro.decidePrompted = false;
} else if (Client.getMinecraft().options.rightKey.isPressed()) {
} else if (Client.getMinecraft().options.keyRight.isDown()) {
macro.movementKey = 'd';
macro.ignoreKeys = ['a', 's'];
macro.decidePrompted = false;
Expand All @@ -212,7 +212,7 @@ export default class FarmHandler {

checkForCrop(checkForAge = true, yOffset = 1) {
const playerEntity = Player.getPlayer();
let yaw = ((playerEntity.getYaw() % 360) + 360) % 360;
let yaw = ((MathUtils.wrapTo180(playerEntity.getYRot()) % 360) + 360) % 360;

let fx = 0,
fz = 0; // Forward
Expand Down Expand Up @@ -282,7 +282,7 @@ export default class FarmHandler {
areChunksLoaded(x, z) {
const chunkX = Math.floor(x) >> 4;
const chunkZ = Math.floor(z) >> 4;
return World.getWorld().getChunkManager().isChunkLoaded(chunkX, chunkZ);
return World.getWorld().getChunkSource().hasChunk(chunkX, chunkZ);
}

getAngle(point) {
Expand Down
Loading
Loading