fixed bugs, memory leaks, etc
This commit is contained in:
1 parent
aa4f6b6ddc
commit
c3f8f23c1d
124 files changed
+805
-165
No files matched your search
+2
-4
@@ -1,15 +1,13 @@
|
|||||||
# Builds the Prestige payload jar (remapped for the production Fabric runtime), then the Rust injector and loader DLL,
|
# Builds the Prestige payload jar (remapped for the production Fabric runtime), then the Rust injector and loader DLL,
|
||||||
# and collects PrestigeInjector.exe + prestige_native.dll in dist\.
|
# and collects PrestigeInjector.exe + prestige_native.dll in dist\.
|
||||||
$ErrorActionPreference = 'Stop'
|
# native tools write progress/notes to stderr; failures are detected through $LASTEXITCODE instead
|
||||||
|
$ErrorActionPreference = 'Continue'
|
||||||
Set-Location $PSScriptRoot
|
Set-Location $PSScriptRoot
|
||||||
if (Test-Path 'C:\Program Files\Eclipse Adoptium\jdk-21.0.12.101-hotspot') { $env:JAVA_HOME = 'C:\Program Files\Eclipse Adoptium\jdk-21.0.12.101-hotspot' }
|
if (Test-Path 'C:\Program Files\Eclipse Adoptium\jdk-21.0.12.101-hotspot') { $env:JAVA_HOME = 'C:\Program Files\Eclipse Adoptium\jdk-21.0.12.101-hotspot' }
|
||||||
& .\gradlew.bat remapJar --console=plain
|
& .\gradlew.bat remapJar --console=plain
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'gradle remapJar failed' }
|
if ($LASTEXITCODE -ne 0) { throw 'gradle remapJar failed' }
|
||||||
# cargo reports progress on stderr, which PowerShell would treat as an error under 'Stop'
|
|
||||||
$ErrorActionPreference = 'Continue'
|
|
||||||
cargo build --release --manifest-path injector\Cargo.toml
|
cargo build --release --manifest-path injector\Cargo.toml
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'cargo build failed' }
|
if ($LASTEXITCODE -ne 0) { throw 'cargo build failed' }
|
||||||
$ErrorActionPreference = 'Stop'
|
|
||||||
New-Item -ItemType Directory -Force dist | Out-Null
|
New-Item -ItemType Directory -Force dist | Out-Null
|
||||||
Copy-Item injector\target\release\PrestigeInjector.exe, injector\target\release\prestige_native.dll dist\ -Force
|
Copy-Item injector\target\release\PrestigeInjector.exe, injector\target\release\prestige_native.dll dist\ -Force
|
||||||
Write-Host 'Done: dist\PrestigeInjector.exe + dist\prestige_native.dll'
|
Write-Host 'Done: dist\PrestigeInjector.exe + dist\prestige_native.dll'
|
||||||
@@ -8,6 +8,8 @@ static JVMTI: AtomicPtr<*const *const c_void> = AtomicPtr::new(std::ptr::null_mu
|
|||||||
/// jclass whose bytes the ClassFileLoadHook should capture during the current RetransformClasses call (0 = none).
|
/// jclass whose bytes the ClassFileLoadHook should capture during the current RetransformClasses call (0 = none).
|
||||||
static CAPTURE_TARGET: AtomicUsize = AtomicUsize::new(0);
|
static CAPTURE_TARGET: AtomicUsize = AtomicUsize::new(0);
|
||||||
static CAPTURED: Mutex<Option<Vec<u8>>> = Mutex::new(None);
|
static CAPTURED: Mutex<Option<Vec<u8>>> = Mutex::new(None);
|
||||||
|
/// Serialises classBytes calls: CAPTURE_TARGET holds a thread-local jclass reference, so only one thread may capture at a time.
|
||||||
|
static CAPTURE_LOCK: Mutex<()> = Mutex::new(());
|
||||||
|
|
||||||
/// Acquires the JVMTI capabilities and enables the class file load hook. Called once from the worker thread.
|
/// Acquires the JVMTI capabilities and enables the class file load hook. Called once from the worker thread.
|
||||||
pub unsafe fn init_jvmti(vm: VmPtr) -> Result<(), String> {
|
pub unsafe fn init_jvmti(vm: VmPtr) -> Result<(), String> {
|
||||||
@@ -56,6 +58,7 @@ pub unsafe extern "system" fn native_class_bytes(env: EnvPtr, _cls: JClass, targ
|
|||||||
if jvmti.is_null() {
|
if jvmti.is_null() {
|
||||||
return std::ptr::null_mut();
|
return std::ptr::null_mut();
|
||||||
}
|
}
|
||||||
|
let _serial = CAPTURE_LOCK.lock();
|
||||||
if let Ok(mut slot) = CAPTURED.lock() {
|
if let Ok(mut slot) = CAPTURED.lock() {
|
||||||
*slot = None;
|
*slot = None;
|
||||||
}
|
}
|
||||||
@@ -86,6 +89,9 @@ pub unsafe extern "system" fn native_redefine(env: EnvPtr, _cls: JClass, target:
|
|||||||
}
|
}
|
||||||
let jni = Jni::new(env);
|
let jni = Jni::new(env);
|
||||||
let len = jni.get_array_length(bytes);
|
let len = jni.get_array_length(bytes);
|
||||||
|
if len < 0 {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
let mut buf = vec![0u8; len as usize];
|
let mut buf = vec![0u8; len as usize];
|
||||||
jni.get_byte_array_region(bytes, 0, len, buf.as_mut_ptr());
|
jni.get_byte_array_region(bytes, 0, len, buf.as_mut_ptr());
|
||||||
let def = ClassDefinition { klass: target, class_byte_count: len, class_bytes: buf.as_ptr() };
|
let def = ClassDefinition { klass: target, class_byte_count: len, class_bytes: buf.as_ptr() };
|
||||||
@@ -104,3 +110,30 @@ pub unsafe extern "system" fn native_log(env: EnvPtr, _cls: JClass, message: JOb
|
|||||||
let text = Jni::new(env).get_string_utf(message);
|
let text = Jni::new(env).get_string_utf(message);
|
||||||
crate::log!("[java] {text}");
|
crate::log!("[java] {text}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "system" {
|
||||||
|
fn FreeLibraryAndExitThread(module: *mut c_void, exit_code: u32) -> !;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// void release(): stops the JVMTI hook and unloads this DLL after a short delay (self destruct).
|
||||||
|
/// Java must not call any native of NativeBridge afterwards.
|
||||||
|
pub unsafe extern "system" fn native_release(env: EnvPtr, cls: JClass) {
|
||||||
|
let jvmti = JVMTI.swap(std::ptr::null_mut(), Ordering::SeqCst);
|
||||||
|
if !jvmti.is_null() {
|
||||||
|
if let Err(e) = disable_class_file_load_hook(jvmti) {
|
||||||
|
crate::log!("release: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Late calls from Java then throw UnsatisfiedLinkError instead of jumping into the unmapped DLL.
|
||||||
|
let rc = Jni::new(env).unregister_natives(cls);
|
||||||
|
if rc != JNI_OK {
|
||||||
|
crate::log!("release: UnregisterNatives failed ({rc})");
|
||||||
|
}
|
||||||
|
crate::log!("[java] released, unloading the loader");
|
||||||
|
let module = crate::MODULE as usize;
|
||||||
|
// The thread below runs code from this DLL until FreeLibraryAndExitThread; the delay lets in-flight native calls return.
|
||||||
|
let _ = std::thread::Builder::new().name("prestige-unload".into()).spawn(move || {
|
||||||
|
std::thread::sleep(std::time::Duration::from_millis(2000));
|
||||||
|
FreeLibraryAndExitThread(module as *mut c_void, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -123,6 +123,9 @@ impl Jni {
|
|||||||
pub unsafe fn register_natives(&self, c: JClass, methods: &[NativeMethod]) -> JInt {
|
pub unsafe fn register_natives(&self, c: JClass, methods: &[NativeMethod]) -> JInt {
|
||||||
f!(self, 215, unsafe extern "system" fn(EnvPtr, JClass, *const NativeMethod, JInt) -> JInt)(self.env, c, methods.as_ptr(), methods.len() as JInt)
|
f!(self, 215, unsafe extern "system" fn(EnvPtr, JClass, *const NativeMethod, JInt) -> JInt)(self.env, c, methods.as_ptr(), methods.len() as JInt)
|
||||||
}
|
}
|
||||||
|
pub unsafe fn unregister_natives(&self, c: JClass) -> JInt {
|
||||||
|
f!(self, 216, unsafe extern "system" fn(EnvPtr, JClass) -> JInt)(self.env, c)
|
||||||
|
}
|
||||||
pub unsafe fn exception_check(&self) -> bool {
|
pub unsafe fn exception_check(&self) -> bool {
|
||||||
f!(self, 228, unsafe extern "system" fn(EnvPtr) -> JBool)(self.env) != 0
|
f!(self, 228, unsafe extern "system" fn(EnvPtr) -> JBool)(self.env) != 0
|
||||||
}
|
}
|
||||||
@@ -168,6 +171,12 @@ pub unsafe fn attach_current_thread(vm: VmPtr) -> Result<EnvPtr, String> {
|
|||||||
Ok(env)
|
Ok(env)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Detaches the current thread (it must not hold Java frames); a thread attached from native code has to detach before it ends.
|
||||||
|
pub unsafe fn detach_current_thread(vm: VmPtr) {
|
||||||
|
let detach = std::mem::transmute::<*const c_void, unsafe extern "system" fn(VmPtr) -> JInt>(*(*vm).add(5));
|
||||||
|
detach(vm);
|
||||||
|
}
|
||||||
|
|
||||||
pub unsafe fn get_jvmti(vm: VmPtr) -> Result<JvmtiPtr, String> {
|
pub unsafe fn get_jvmti(vm: VmPtr) -> Result<JvmtiPtr, String> {
|
||||||
let get_env = std::mem::transmute::<*const c_void, unsafe extern "system" fn(VmPtr, *mut *mut c_void, JInt) -> JInt>(*(*vm).add(6));
|
let get_env = std::mem::transmute::<*const c_void, unsafe extern "system" fn(VmPtr, *mut *mut c_void, JInt) -> JInt>(*(*vm).add(6));
|
||||||
let mut out: *mut c_void = std::ptr::null_mut();
|
let mut out: *mut c_void = std::ptr::null_mut();
|
||||||
@@ -253,3 +262,19 @@ pub unsafe fn redefine_class(j: JvmtiPtr, def: &ClassDefinition) -> JInt {
|
|||||||
let f = std::mem::transmute::<*const c_void, unsafe extern "system" fn(JvmtiPtr, JInt, *const ClassDefinition) -> JInt>(*(*j).add(86));
|
let f = std::mem::transmute::<*const c_void, unsafe extern "system" fn(JvmtiPtr, JInt, *const ClassDefinition) -> JInt>(*(*j).add(86));
|
||||||
f(j, 1, def)
|
f(j, 1, def)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Disables the ClassFileLoadHook event and clears the callback table, so the JVM no longer calls into this DLL.
|
||||||
|
pub unsafe fn disable_class_file_load_hook(j: JvmtiPtr) -> Result<(), String> {
|
||||||
|
let set_mode = std::mem::transmute::<*const c_void, unsafe extern "C" fn(JvmtiPtr, JInt, JInt, JObject, ...) -> JInt>(*(*j).add(1));
|
||||||
|
let rc = set_mode(j, 0, EVENT_CLASS_FILE_LOAD_HOOK, std::ptr::null_mut());
|
||||||
|
if rc != 0 {
|
||||||
|
return Err(format!("SetEventNotificationMode(disable) failed ({rc})"));
|
||||||
|
}
|
||||||
|
let callbacks = [0usize; 40];
|
||||||
|
let set_callbacks = std::mem::transmute::<*const c_void, unsafe extern "system" fn(JvmtiPtr, *const usize, JInt) -> JInt>(*(*j).add(121));
|
||||||
|
let rc = set_callbacks(j, callbacks.as_ptr(), std::mem::size_of_val(&callbacks) as JInt);
|
||||||
|
if rc != 0 {
|
||||||
|
return Err(format!("SetEventCallbacks(clear) failed ({rc})"));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//! The loader worker: JVM discovery, payload installation into Fabric's Knot class loader, native registration, bootstrap.
|
//! The loader worker: JVM discovery, payload installation into Fabric's Knot class loader, native registration, bootstrap.
|
||||||
use crate::bridge::{init_jvmti, native_class_bytes, native_log, native_redefine};
|
use crate::bridge::{init_jvmti, native_class_bytes, native_log, native_redefine, native_release};
|
||||||
use crate::jni::*;
|
use crate::jni::*;
|
||||||
use crate::log;
|
use crate::log;
|
||||||
use std::ffi::{c_char, c_void};
|
use std::ffi::{c_char, c_void};
|
||||||
@@ -28,6 +28,13 @@ pub fn run() {
|
|||||||
unsafe fn install() -> Result<(), String> {
|
unsafe fn install() -> Result<(), String> {
|
||||||
let vm = find_vm()?;
|
let vm = find_vm()?;
|
||||||
let env = attach_current_thread(vm)?;
|
let env = attach_current_thread(vm)?;
|
||||||
|
struct Detach(VmPtr);
|
||||||
|
impl Drop for Detach {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
unsafe { detach_current_thread(self.0) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let _detach = Detach(vm);
|
||||||
let jni = Jni::new(env);
|
let jni = Jni::new(env);
|
||||||
log!("attached to the JVM");
|
log!("attached to the JVM");
|
||||||
|
|
||||||
@@ -160,6 +167,11 @@ unsafe fn register_natives(jni: &Jni, loader: JObject) -> Result<(), String> {
|
|||||||
signature: c"(Ljava/lang/Class;[B)I".as_ptr(),
|
signature: c"(Ljava/lang/Class;[B)I".as_ptr(),
|
||||||
fn_ptr: native_redefine as *const () as usize as *mut c_void,
|
fn_ptr: native_redefine as *const () as usize as *mut c_void,
|
||||||
},
|
},
|
||||||
|
NativeMethod {
|
||||||
|
name: c"release".as_ptr(),
|
||||||
|
signature: c"()V".as_ptr(),
|
||||||
|
fn_ptr: native_release as *const () as usize as *mut c_void,
|
||||||
|
},
|
||||||
NativeMethod {
|
NativeMethod {
|
||||||
name: c"log".as_ptr(),
|
name: c"log".as_ptr(),
|
||||||
signature: c"(Ljava/lang/String;)V".as_ptr(),
|
signature: c"(Ljava/lang/String;)V".as_ptr(),
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import net.minecraft.client.gui.screen.ChatScreen;
|
|||||||
|
|
||||||
public class Prestige implements ModInitializer {
|
public class Prestige implements ModInitializer {
|
||||||
private static final AtomicBoolean initialized = new AtomicBoolean(false);
|
private static final AtomicBoolean initialized = new AtomicBoolean(false);
|
||||||
|
private static final java.util.concurrent.atomic.AtomicInteger renderErrorCount = new java.util.concurrent.atomic.AtomicInteger();
|
||||||
public static EventBus eventBus;
|
public static EventBus eventBus;
|
||||||
public static FontManager fontManager;
|
public static FontManager fontManager;
|
||||||
public static ModuleManager moduleManager;
|
public static ModuleManager moduleManager;
|
||||||
@@ -95,6 +96,7 @@ public class Prestige implements ModInitializer {
|
|||||||
.register(
|
.register(
|
||||||
(RenderCallback)(hudRenderer, hudContext) -> {
|
(RenderCallback)(hudRenderer, hudContext) -> {
|
||||||
if (!selfDestructed) {
|
if (!selfDestructed) {
|
||||||
|
try {
|
||||||
if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
|
if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
|
||||||
if ((MinecraftAccess.mc.currentScreen == null || MinecraftAccess.mc.currentScreen instanceof ChatScreen)
|
if ((MinecraftAccess.mc.currentScreen == null || MinecraftAccess.mc.currentScreen instanceof ChatScreen)
|
||||||
&& eventBus.hasListeners(Render2DEvent.class)) {
|
&& eventBus.hasListeners(Render2DEvent.class)) {
|
||||||
@@ -104,15 +106,22 @@ public class Prestige implements ModInitializer {
|
|||||||
new FrameEvent((hudRenderer), (hudContext)).post();
|
new FrameEvent((hudRenderer), (hudContext)).post();
|
||||||
ShapeRenderer.flushDrawQueue();
|
ShapeRenderer.flushDrawQueue();
|
||||||
}
|
}
|
||||||
|
} catch (Throwable error) {
|
||||||
|
logRenderError(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RenderEvents.WORLD_RENDER.register((RenderCallback)(worldRenderer, worldContext) -> {
|
RenderEvents.WORLD_RENDER.register((RenderCallback)(worldRenderer, worldContext) -> {
|
||||||
if (!selfDestructed) {
|
if (!selfDestructed) {
|
||||||
|
try {
|
||||||
if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
|
if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
|
||||||
Render2D.captureViewport();
|
Render2D.captureViewport();
|
||||||
new Render3DEvent((worldRenderer), (worldContext)).post();
|
new Render3DEvent((worldRenderer), (worldContext)).post();
|
||||||
}
|
}
|
||||||
|
} catch (Throwable error) {
|
||||||
|
logRenderError(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -125,6 +134,12 @@ public class Prestige implements ModInitializer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void logRenderError(Throwable error) {
|
||||||
|
if (renderErrorCount.getAndIncrement() < 5) {
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean needsWorldRender() {
|
public static boolean needsWorldRender() {
|
||||||
return EspShaderManager.enabled || eventBus != null && eventBus.hasListeners(Render3DEvent.class);
|
return EspShaderManager.enabled || eventBus != null && eventBus.hasListeners(Render3DEvent.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class BotFilter implements MinecraftAccess {
|
|||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
this.validityCache.clear();
|
this.validityCache.clear();
|
||||||
if (!this.validatedPlayers.isEmpty()) {
|
if (!this.validatedPlayers.isEmpty()) {
|
||||||
this.validatedPlayers.removeIf(player -> !((net.minecraft.entity.Entity)player).isAlive());
|
this.validatedPlayers.removeIf(player -> !((net.minecraft.entity.Entity)player).isAlive() || ((net.minecraft.entity.Entity)player).isRemoved());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ public class ExplosionDamageCalculator implements MinecraftAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getCrystalDamage(LivingEntity target, Vec3d crystalPos, boolean predictMotion, BlockPos obsidianPos, boolean ignoreTerrain) {
|
public double getCrystalDamage(LivingEntity target, Vec3d crystalPos, boolean predictMotion, BlockPos obsidianPos, boolean ignoreTerrain) {
|
||||||
|
if (mc.world == null || mc.player == null || mc.getNetworkHandler() == null) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
long worldTime = mc.world.getTime();
|
long worldTime = mc.world.getTime();
|
||||||
if (worldTime != this.cacheTime) {
|
if (worldTime != this.cacheTime) {
|
||||||
this.damageCache.clear();
|
this.damageCache.clear();
|
||||||
@@ -305,6 +309,10 @@ public class ExplosionDamageCalculator implements MinecraftAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double getExposureWithOffset(Vec3d source, Entity entity, Vec3d boxOffset, RaycastContext context, BlockPos obsidianPos, boolean ignoreTerrain, BlockPos airPos, BlockPos placedBlockPos, BlockState placedBlockState) {
|
private double getExposureWithOffset(Vec3d source, Entity entity, Vec3d boxOffset, RaycastContext context, BlockPos obsidianPos, boolean ignoreTerrain, BlockPos airPos, BlockPos placedBlockPos, BlockState placedBlockState) {
|
||||||
|
if (context == null) {
|
||||||
|
context = this.raycastContext = new RaycastContext(null, null, ShapeType.COLLIDER, FluidHandling.ANY, mc.player);
|
||||||
|
}
|
||||||
|
|
||||||
Box box = entity.getBoundingBox();
|
Box box = entity.getBoundingBox();
|
||||||
if (boxOffset != null) {
|
if (boxOffset != null) {
|
||||||
box = box.offset(boxOffset.x, boxOffset.y, boxOffset.z);
|
box = box.offset(boxOffset.x, boxOffset.y, boxOffset.z);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class TargetTracker implements MinecraftAccess {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
if (this.target != null && (mc.world == null || !this.target.isAlive() || this.target.distanceTo(mc.player) > 15.0F || System.currentTimeMillis() - this.lastAttackTime > 5000L)) {
|
if (this.target != null && (mc.world == null || mc.player == null || !this.target.isAlive() || this.target.distanceTo(mc.player) > 15.0F || System.currentTimeMillis() - this.lastAttackTime > 5000L)) {
|
||||||
this.target = null;
|
this.target = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package dev.zprestige.prestige.config;
|
package dev.zprestige.prestige.config;
|
||||||
|
|
||||||
import dev.zprestige.prestige.client.Prestige;
|
import dev.zprestige.prestige.client.Prestige;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import net.minecraft.resource.InputSupplier;
|
import net.minecraft.resource.InputSupplier;
|
||||||
@@ -33,7 +35,7 @@ public class ClasspathResourcePack implements ResourcePack {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set getNamespaces(ResourceType type) {
|
public Set getNamespaces(ResourceType type) {
|
||||||
return null;
|
return Set.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -61,15 +63,24 @@ public class ClasspathResourcePack implements ResourcePack {
|
|||||||
public void close() {
|
public void close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static InputStream openOrThrow(String path) throws IOException {
|
||||||
|
InputStream stream = Prestige.class.getClassLoader().getResourceAsStream(path);
|
||||||
|
if (stream == null) {
|
||||||
|
throw new FileNotFoundException(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
public static Resource createAssetResource(Identifier id) {
|
public static Resource createAssetResource(Identifier id) {
|
||||||
return new Resource(new ClasspathResourcePack(), () -> Prestige.class.getClassLoader().getResourceAsStream("assets/prestige/" + id.getPath()));
|
return new Resource(new ClasspathResourcePack(), () -> openOrThrow("assets/prestige/" + id.getPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Resource createResource(String path) {
|
public static Resource createResource(String path) {
|
||||||
return new Resource(new ClasspathResourcePack(), () -> Prestige.class.getClassLoader().getResourceAsStream(path));
|
return new Resource(new ClasspathResourcePack(), () -> openOrThrow(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InputSupplier createInputSupplier(String path) {
|
public static InputSupplier createInputSupplier(String path) {
|
||||||
return () -> Prestige.class.getClassLoader().getResourceAsStream(path);
|
return () -> openOrThrow(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ public record OutlineCaptureConsumer(MeshBuilder writer) implements VertexConsum
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VertexConsumer lineWidth(float width) {
|
public VertexConsumer lineWidth(float width) {
|
||||||
return null;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,7 +14,14 @@ public class ModuleStateSync {
|
|||||||
super();
|
super();
|
||||||
this.hudDrawn = false;
|
this.hudDrawn = false;
|
||||||
Prestige.eventBus.register(this);
|
Prestige.eventBus.register(this);
|
||||||
RenderEvents.HUD_RENDER.register((RenderCallback)(renderer, context) -> this.hudDrawn = Prestige.hudEditorScreen.renderHud(renderer, context));
|
RenderEvents.HUD_RENDER.register((RenderCallback)(renderer, context) -> {
|
||||||
|
try {
|
||||||
|
this.hudDrawn = Prestige.hudEditorScreen.renderHud(renderer, context);
|
||||||
|
} catch (Throwable error) {
|
||||||
|
this.hudDrawn = false;
|
||||||
|
Prestige.logRenderError(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -23,6 +30,7 @@ public class ModuleStateSync {
|
|||||||
|
|
||||||
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
|
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
|
||||||
boolean enabled = module.isEnabled();
|
boolean enabled = module.isEnabled();
|
||||||
|
try {
|
||||||
if (enabled && !module.getLastEnabled()) {
|
if (enabled && !module.getLastEnabled()) {
|
||||||
module.applyState();
|
module.applyState();
|
||||||
}
|
}
|
||||||
@@ -30,6 +38,9 @@ public class ModuleStateSync {
|
|||||||
if (!enabled && module.getLastEnabled()) {
|
if (!enabled && module.getLastEnabled()) {
|
||||||
module.applyState();
|
module.applyState();
|
||||||
}
|
}
|
||||||
|
} catch (Throwable error) {
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
module.setLastEnabled(enabled);
|
module.setLastEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,8 +102,12 @@ public class HudEditorScreen extends BaseScreen {
|
|||||||
this.lastFrameTime = System.currentTimeMillis();
|
this.lastFrameTime = System.currentTimeMillis();
|
||||||
RenderEvents.HUD_RENDER.register((RenderCallback)(renderBatch, renderMatrices) -> {
|
RenderEvents.HUD_RENDER.register((RenderCallback)(renderBatch, renderMatrices) -> {
|
||||||
if (MinecraftAccess.mc.currentScreen == this) {
|
if (MinecraftAccess.mc.currentScreen == this) {
|
||||||
|
try {
|
||||||
Mouse mouse = MinecraftAccess.mc.mouse;
|
Mouse mouse = MinecraftAccess.mc.mouse;
|
||||||
this.renderEditor(renderBatch, renderMatrices, (int)Math.round(mouse.getX() / MinecraftAccess.mc.getWindow().getScaleFactor()), (int)Math.round(mouse.getY() / MinecraftAccess.mc.getWindow().getScaleFactor()), Render2D.getTickDelta());
|
this.renderEditor(renderBatch, renderMatrices, (int)Math.round(mouse.getX() / MinecraftAccess.mc.getWindow().getScaleFactor()), (int)Math.round(mouse.getY() / MinecraftAccess.mc.getWindow().getScaleFactor()), Render2D.getTickDelta());
|
||||||
|
} catch (Throwable error) {
|
||||||
|
Prestige.logRenderError(error); // do not let an editor render error reach the game loop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -456,7 +460,11 @@ public class HudEditorScreen extends BaseScreen {
|
|||||||
hudElement.resolvePosition();
|
hudElement.resolvePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
hudElement.render(batch, matrices, matrix);
|
hudElement.render(batch, matrices, matrix);
|
||||||
|
} catch (Throwable error) {
|
||||||
|
Prestige.logRenderError(error); // one broken element must not take down the whole HUD
|
||||||
|
}
|
||||||
renderedAny = true;
|
renderedAny = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ public class ModuleNotificationsElement extends HudElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.notifications.add(new ModuleToast(title, message, type));
|
this.notifications.add(new ModuleToast(title, message, type));
|
||||||
|
while (this.notifications.size() > 32) {
|
||||||
|
this.notifications.remove(0); // toasts only expire while the HUD is drawn; keep the list bounded
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -186,7 +189,9 @@ public class ModuleNotificationsElement extends HudElement {
|
|||||||
RoundedRectShader.drawRoundedRect(batch, cameraData, matrix, toastX, toastY, toastWidth, toastHeight, backgroundColor, 4.0F);
|
RoundedRectShader.drawRoundedRect(batch, cameraData, matrix, toastX, toastY, toastWidth, toastHeight, backgroundColor, 4.0F);
|
||||||
GlTextureHandle typeIcon = this.getTypeIcon(toast.type);
|
GlTextureHandle typeIcon = this.getTypeIcon(toast.type);
|
||||||
float iconX = rightAligned ? toastRight - 5.5F - 10.0F : toastX + 5.5F;
|
float iconX = rightAligned ? toastRight - 5.5F - 10.0F : toastX + 5.5F;
|
||||||
|
if (typeIcon != null) {
|
||||||
RoundedTextureShader.drawTexture(batch, cameraData, matrix, typeIcon, iconX, toastY + (toastHeight - 10.0F) / 2.0F, 10.0F, 10.0F, iconColor);
|
RoundedTextureShader.drawTexture(batch, cameraData, matrix, typeIcon, iconX, toastY + (toastHeight - 10.0F) / 2.0F, 10.0F, 10.0F, iconColor);
|
||||||
|
}
|
||||||
float titleWidth = Prestige.fontManager.getDefaultFont().getTextWidth(toast.title) * 0.9F;
|
float titleWidth = Prestige.fontManager.getDefaultFont().getTextWidth(toast.title) * 0.9F;
|
||||||
float messageWidth = Prestige.fontManager.getDefaultFont().getTextWidth(toast.message) * 0.75F;
|
float messageWidth = Prestige.fontManager.getDefaultFont().getTextWidth(toast.message) * 0.75F;
|
||||||
float titleX = rightAligned ? iconX - 3.0F - titleWidth : iconX + 10.0F + 3.0F;
|
float titleX = rightAligned ? iconX - 3.0F - titleWidth : iconX + 10.0F + 3.0F;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class TargetElement extends HudElement {
|
|||||||
this.frameTimeMs = System.currentTimeMillis() - this.lastFrameTime;
|
this.frameTimeMs = System.currentTimeMillis() - this.lastFrameTime;
|
||||||
this.lastFrameTime = System.currentTimeMillis();
|
this.lastFrameTime = System.currentTimeMillis();
|
||||||
PlayerEntity targetPlayer = mc.currentScreen instanceof HudEditorScreen ? mc.player : Prestige.targetTracker.getTarget();
|
PlayerEntity targetPlayer = mc.currentScreen instanceof HudEditorScreen ? mc.player : Prestige.targetTracker.getTarget();
|
||||||
if (targetPlayer != null && (targetPlayer.getUuid() == null || mc.getNetworkHandler().getPlayerListEntry(targetPlayer.getUuid()) == null)) {
|
if (targetPlayer != null && (mc.getNetworkHandler() == null || targetPlayer.getUuid() == null || mc.getNetworkHandler().getPlayerListEntry(targetPlayer.getUuid()) == null)) {
|
||||||
targetPlayer = null;
|
targetPlayer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,9 +99,17 @@ public class TargetElement extends HudElement {
|
|||||||
|
|
||||||
this.targetName = targetPlayer.getName().getString();
|
this.targetName = targetPlayer.getName().getString();
|
||||||
float rawHealth = targetPlayer.getHealth() + targetPlayer.getAbsorptionAmount();
|
float rawHealth = targetPlayer.getHealth() + targetPlayer.getAbsorptionAmount();
|
||||||
|
if (!Float.isFinite(rawHealth)) {
|
||||||
|
rawHealth = 0.0F; // NaN/Infinity health (server-controlled) would make floorToDecimals throw
|
||||||
|
}
|
||||||
|
|
||||||
this.health = (float)Math.ceil(rawHealth);
|
this.health = (float)Math.ceil(rawHealth);
|
||||||
this.healthFraction = this.getHealthFraction(targetPlayer);
|
this.healthFraction = UiMath.clamp(rawHealth / 20.0F, 0.0F, 1.0F);
|
||||||
this.distance = mc.player != null ? targetPlayer.distanceTo(mc.player) : 0.0F;
|
this.distance = mc.player != null ? targetPlayer.distanceTo(mc.player) : 0.0F;
|
||||||
|
if (!Float.isFinite(this.distance)) {
|
||||||
|
this.distance = 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.targetUuid == null || !this.targetUuid.equals(targetPlayer.getUuid())) {
|
if (this.targetUuid == null || !this.targetUuid.equals(targetPlayer.getUuid())) {
|
||||||
this.targetUuid = targetPlayer.getUuid();
|
this.targetUuid = targetPlayer.getUuid();
|
||||||
this.displayedHealth = this.health;
|
this.displayedHealth = this.health;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import dev.zprestige.prestige.ui.mc.Entry;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.ToIntBiFunction;
|
import java.util.function.ToIntBiFunction;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
@@ -22,6 +23,8 @@ import net.minecraft.client.MinecraftClient;
|
|||||||
*/
|
*/
|
||||||
public final class Bootstrap {
|
public final class Bootstrap {
|
||||||
private static boolean started;
|
private static boolean started;
|
||||||
|
/** Class bytes as they were before the hooks, kept so self destruct can put the game classes back. */
|
||||||
|
private static final Map<Class<?>, byte[]> ORIGINALS = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private Bootstrap() {}
|
private Bootstrap() {}
|
||||||
|
|
||||||
@@ -85,6 +88,7 @@ public final class Bootstrap {
|
|||||||
for (byte[] helper : result.helpers().values()) Definer.define(helper);
|
for (byte[] helper : result.helpers().values()) Definer.define(helper);
|
||||||
int code = redefine.applyAsInt(type, result.target());
|
int code = redefine.applyAsInt(type, result.target());
|
||||||
if (code != 0) throw new IllegalStateException("redefine returned JVMTI error " + code);
|
if (code != 0) throw new IllegalStateException("redefine returned JVMTI error " + code);
|
||||||
|
ORIGINALS.put(type, current);
|
||||||
report.redefined++;
|
report.redefined++;
|
||||||
report.moved += result.movedMethods();
|
report.moved += result.movedMethods();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
@@ -96,6 +100,31 @@ public final class Bootstrap {
|
|||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** True when this client was injected, i.e. hooks were applied through JVMTI and can be taken out again. */
|
||||||
|
public static boolean isInjected() {
|
||||||
|
return !ORIGINALS.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Self destruct, part 1: redefines every hooked class back to its original bytes so no game code references the client any
|
||||||
|
* more. Returns the number of classes that could not be restored.
|
||||||
|
*/
|
||||||
|
public static int uninstall() {
|
||||||
|
int failed = 0;
|
||||||
|
for (Map.Entry<Class<?>, byte[]> entry : ORIGINALS.entrySet()) {
|
||||||
|
try {
|
||||||
|
int code = NativeBridge.redefine(entry.getKey(), entry.getValue());
|
||||||
|
if (code != 0) throw new IllegalStateException("JVMTI error " + code);
|
||||||
|
ORIGINALS.remove(entry.getKey());
|
||||||
|
} catch (Throwable t) {
|
||||||
|
failed++;
|
||||||
|
log("could not restore " + entry.getKey().getName() + ": " + t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log("hooks removed" + (failed == 0 ? "" : ", " + failed + " classes could not be restored"));
|
||||||
|
return failed;
|
||||||
|
}
|
||||||
|
|
||||||
private static void initClient() {
|
private static void initClient() {
|
||||||
try {
|
try {
|
||||||
new Prestige().onInitialize();
|
new Prestige().onInitialize();
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ public final class NativeBridge {
|
|||||||
/** Appends a line to prestige-native.log, which the injector tails to show progress. */
|
/** Appends a line to prestige-native.log, which the injector tails to show progress. */
|
||||||
public static native void log(String message);
|
public static native void log(String message);
|
||||||
|
|
||||||
|
/** Disables the class file load hook and unloads prestige_native.dll shortly afterwards; nothing may call the natives after this. */
|
||||||
|
public static native void release();
|
||||||
|
|
||||||
/** JVMTI RedefineClasses for one class; returns the JVMTI error code, 0 on success. */
|
/** JVMTI RedefineClasses for one class; returns the JVMTI error code, 0 on success. */
|
||||||
public static native int redefine(Class<?> type, byte[] bytes);
|
public static native int redefine(Class<?> type, byte[] bytes);
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,7 @@ public class KeybindManager implements MinecraftAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
|
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
|
||||||
|
try {
|
||||||
int moduleKey = VirtualKeyMapper.toGlfwKey(module.getKey());
|
int moduleKey = VirtualKeyMapper.toGlfwKey(module.getKey());
|
||||||
if (module.getKeybind().isHoldMode()) {
|
if (module.getKeybind().isHoldMode()) {
|
||||||
if (module.isEnabled() && mc.currentScreen != null) {
|
if (module.isEnabled() && mc.currentScreen != null) {
|
||||||
@@ -49,6 +50,9 @@ public class KeybindManager implements MinecraftAccess {
|
|||||||
&& moduleKey == event.getKey()) {
|
&& moduleKey == event.getKey()) {
|
||||||
module.toggle();
|
module.toggle();
|
||||||
}
|
}
|
||||||
|
} catch (Throwable error) {
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +77,9 @@ public class KeybindManager implements MinecraftAccess {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMouseButton(MouseButtonEvent event) {
|
public void onMouseButton(MouseButtonEvent event) {
|
||||||
if (!Prestige.simulatedClickManager.isSimulated(event.getButton())) {
|
if (Prestige.simulatedClickManager != null && !Prestige.simulatedClickManager.isSimulated(event.getButton())) {
|
||||||
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
|
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
|
||||||
|
try {
|
||||||
if (module.getKey() != -1
|
if (module.getKey() != -1
|
||||||
&& MOUSE_KEYCODE_TO_BUTTON.containsKey(module.getKey())
|
&& MOUSE_KEYCODE_TO_BUTTON.containsKey(module.getKey())
|
||||||
&& (Integer)MOUSE_KEYCODE_TO_BUTTON.get(module.getKey()) == event.getButton()) {
|
&& (Integer)MOUSE_KEYCODE_TO_BUTTON.get(module.getKey()) == event.getButton()) {
|
||||||
@@ -88,6 +93,9 @@ public class KeybindManager implements MinecraftAccess {
|
|||||||
module.toggle();
|
module.toggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Throwable error) {
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||||
import net.minecraft.component.DataComponentTypes;
|
import net.minecraft.component.DataComponentTypes;
|
||||||
|
import net.minecraft.component.type.PotionContentsComponent;
|
||||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -210,8 +211,12 @@ public class InventoryUtil implements MinecraftAccess {
|
|||||||
|
|
||||||
public static boolean hasEffect(ItemStack stack, RegistryEntry effect) {
|
public static boolean hasEffect(ItemStack stack, RegistryEntry effect) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
PotionContentsComponent contents = stack.get(DataComponentTypes.POTION_CONTENTS);
|
||||||
|
if (contents == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (StatusEffectInstance instance : stack.get(DataComponentTypes.POTION_CONTENTS).getEffects()) {
|
for (StatusEffectInstance instance : contents.getEffects()) {
|
||||||
if (instance.getEffectType() == effect) {
|
if (instance.getEffectType() == effect) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ package dev.zprestige.prestige.math;
|
|||||||
import dev.zprestige.prestige.client.Prestige;
|
import dev.zprestige.prestige.client.Prestige;
|
||||||
import dev.zprestige.prestige.network.BlockChangeListener;
|
import dev.zprestige.prestige.network.BlockChangeListener;
|
||||||
import dev.zprestige.prestige.render.MinecraftAccess;
|
import dev.zprestige.prestige.render.MinecraftAccess;
|
||||||
import java.util.HashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public final class BlockChangeTracker implements MinecraftAccess {
|
public final class BlockChangeTracker implements MinecraftAccess {
|
||||||
public static final Map CLEARED_BLOCKS = new HashMap();
|
public static final Map CLEARED_BLOCKS = new ConcurrentHashMap();
|
||||||
public static final Map EXPLOSIONS = new HashMap();
|
public static final Map EXPLOSIONS = new ConcurrentHashMap();
|
||||||
public static final Map PLACED_BLOCKS = new HashMap();
|
public static final Map PLACED_BLOCKS = new ConcurrentHashMap();
|
||||||
private static boolean listenerRegistered;
|
private static boolean listenerRegistered;
|
||||||
|
|
||||||
private BlockChangeTracker() {
|
private BlockChangeTracker() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
public class LegacyParticlePhysics extends HitParticlePhysics {
|
public class LegacyParticlePhysics extends HitParticlePhysics {
|
||||||
@Override
|
@Override
|
||||||
public void updateMotion(HitParticle particle, boolean physicsEnabled) {
|
public void updateMotion(HitParticle particle, boolean physicsEnabled) {
|
||||||
if (!physicsEnabled) {
|
if (!physicsEnabled || MinecraftAccess.mc.world == null) {
|
||||||
this.applyLegacyMotion(particle);
|
this.applyLegacyMotion(particle);
|
||||||
} else {
|
} else {
|
||||||
if (!this.isPassable(MinecraftAccess.mc.world.getBlockState(BlockPos.ofFloored(particle.pos.x, particle.pos.y, particle.pos.z + particle.velocity.z)))) {
|
if (!this.isPassable(MinecraftAccess.mc.world.getBlockState(BlockPos.ofFloored(particle.pos.x, particle.pos.y, particle.pos.z + particle.velocity.z)))) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
public class PopParticlePhysics extends HitParticlePhysics {
|
public class PopParticlePhysics extends HitParticlePhysics {
|
||||||
@Override
|
@Override
|
||||||
public void updateMotion(HitParticle particle, boolean physicsEnabled) {
|
public void updateMotion(HitParticle particle, boolean physicsEnabled) {
|
||||||
if (!physicsEnabled) {
|
if (!physicsEnabled || MinecraftAccess.mc.world == null) {
|
||||||
this.applyPopMotion(particle);
|
this.applyPopMotion(particle);
|
||||||
} else {
|
} else {
|
||||||
if (!this.isPassable(MinecraftAccess.mc.world.getBlockState(BlockPos.ofFloored(particle.pos.x, particle.pos.y, particle.pos.z + particle.velocity.z)))) {
|
if (!this.isPassable(MinecraftAccess.mc.world.getBlockState(BlockPos.ofFloored(particle.pos.x, particle.pos.y, particle.pos.z + particle.velocity.z)))) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class AbstractBlockStateMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void overrideAmbientOcclusionLightLevelAtReturn(BlockView blockView, BlockPos blockPos, InjectionCallback cir) {
|
private void overrideAmbientOcclusionLightLevelAtReturn(BlockView blockView, BlockPos blockPos, InjectionCallback cir) {
|
||||||
if (HookBridge.hasAmbientOcclusionListeners(Prestige.eventBus, BlockVisibilityEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasAmbientOcclusionListeners(Prestige.eventBus, BlockVisibilityEvent.class)) {
|
||||||
BlockVisibilityEvent event = HookBridge.createAmbientOcclusionEvent(null);
|
BlockVisibilityEvent event = HookBridge.createAmbientOcclusionEvent(null);
|
||||||
if (HookBridge.postAmbientOcclusionEvent(event)) {
|
if (HookBridge.postAmbientOcclusionEvent(event)) {
|
||||||
cir.setReturnValue(1.0F);
|
cir.setReturnValue(1.0F);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class AbstractClientPlayerEntityMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void overridePlayerSkinAtGetSkinReturn(InjectionCallback ci) {
|
private void overridePlayerSkinAtGetSkinReturn(InjectionCallback ci) {
|
||||||
if (HookBridge.hasPlayerSkinListeners(Prestige.eventBus, SkinTexturesEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasPlayerSkinListeners(Prestige.eventBus, SkinTexturesEvent.class)) {
|
||||||
SkinTexturesEvent event = HookBridge.createPlayerSkinEvent((SkinTextures)ci.getReturnValue(), ((AbstractClientPlayerEntity)(Object)this).getName().getString());
|
SkinTexturesEvent event = HookBridge.createPlayerSkinEvent((SkinTextures)ci.getReturnValue(), ((AbstractClientPlayerEntity)(Object)this).getName().getString());
|
||||||
if (HookBridge.postPlayerSkinEvent(event)) {
|
if (HookBridge.postPlayerSkinEvent(event)) {
|
||||||
ci.setReturnValue(HookBridge.getPlayerSkinTextures(event));
|
ci.setReturnValue(HookBridge.getPlayerSkinTextures(event));
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class BlockMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
public static void overrideShouldDrawSideAtHead(BlockState state, BlockState otherState, Direction side, InjectionCallback cir) {
|
public static void overrideShouldDrawSideAtHead(BlockState state, BlockState otherState, Direction side, InjectionCallback cir) {
|
||||||
if (HookBridge.hasDrawSideListeners(Prestige.eventBus, BlockVisibilityEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasDrawSideListeners(Prestige.eventBus, BlockVisibilityEvent.class)) {
|
||||||
BlockVisibilityEvent event = HookBridge.createDrawSideEvent(state.getBlock());
|
BlockVisibilityEvent event = HookBridge.createDrawSideEvent(state.getBlock());
|
||||||
if (HookBridge.postDrawSideEvent(event)) {
|
if (HookBridge.postDrawSideEvent(event)) {
|
||||||
cir.setReturnValue(HookBridge.shouldDrawSide(event));
|
cir.setReturnValue(HookBridge.shouldDrawSide(event));
|
||||||
|
|||||||
@@ -18,12 +18,15 @@ public class CameraMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void overrideCameraPosAtSetPosHead(double x, double y, double z, InjectionCallback ci) {
|
private void overrideCameraPosAtSetPosHead(double x, double y, double z, InjectionCallback ci) {
|
||||||
if (!CameraPositionEvent.applyingOverride && HookBridge.hasCameraPosListeners(Prestige.eventBus, CameraPositionEvent.class)) {
|
if (!CameraPositionEvent.applyingOverride && Prestige.eventBus != null && HookBridge.hasCameraPosListeners(Prestige.eventBus, CameraPositionEvent.class)) {
|
||||||
CameraPositionEvent event = HookBridge.createCameraPosEvent(x, y, z);
|
CameraPositionEvent event = HookBridge.createCameraPosEvent(x, y, z);
|
||||||
if (HookBridge.postCameraPosEvent(event)) {
|
if (HookBridge.postCameraPosEvent(event)) {
|
||||||
CameraPositionEvent.applyingOverride = true;
|
CameraPositionEvent.applyingOverride = true;
|
||||||
|
try {
|
||||||
HookBridge.setCameraPos(HookBridge.createCameraPosAccessor((Camera)(Object)this), HookBridge.getCameraPosX(event), HookBridge.getCameraPosY(event), HookBridge.getCameraPosZ(event));
|
HookBridge.setCameraPos(HookBridge.createCameraPosAccessor((Camera)(Object)this), HookBridge.getCameraPosX(event), HookBridge.getCameraPosY(event), HookBridge.getCameraPosZ(event));
|
||||||
|
} finally {
|
||||||
CameraPositionEvent.applyingOverride = false;
|
CameraPositionEvent.applyingOverride = false;
|
||||||
|
}
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,8 +42,11 @@ public class CameraMixin {
|
|||||||
CameraRotationEvent event = HookBridge.createCameraRotationEvent(yaw, pitch);
|
CameraRotationEvent event = HookBridge.createCameraRotationEvent(yaw, pitch);
|
||||||
if (HookBridge.postCameraRotationEvent(event)) {
|
if (HookBridge.postCameraRotationEvent(event)) {
|
||||||
CameraRotationEvent.applyingOverride = true;
|
CameraRotationEvent.applyingOverride = true;
|
||||||
|
try {
|
||||||
HookBridge.setCameraRotation(HookBridge.createCameraRotationAccessor((Camera)(Object)this), HookBridge.getCameraYaw(event), HookBridge.getCameraPitch(event));
|
HookBridge.setCameraRotation(HookBridge.createCameraRotationAccessor((Camera)(Object)this), HookBridge.getCameraYaw(event), HookBridge.getCameraPitch(event));
|
||||||
|
} finally {
|
||||||
CameraRotationEvent.applyingOverride = false;
|
CameraRotationEvent.applyingOverride = false;
|
||||||
|
}
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class ChunkOcclusionDataBuilderMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void skipChunkOcclusionAtMarkClosedHead(BlockPos pos, InjectionCallback ci) {
|
private void skipChunkOcclusionAtMarkClosedHead(BlockPos pos, InjectionCallback ci) {
|
||||||
if (HookBridge.hasChunkOcclusionListeners(Prestige.eventBus, BlockVisibilityEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasChunkOcclusionListeners(Prestige.eventBus, BlockVisibilityEvent.class)) {
|
||||||
if (HookBridge.postChunkOcclusionEvent(HookBridge.createChunkOcclusionEvent(null))) {
|
if (HookBridge.postChunkOcclusionEvent(HookBridge.createChunkOcclusionEvent(null))) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ClientConnectionMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private static <T extends PacketListener> void postPacketReceiveEventAtHandlePacketHead(Packet<T> packet, PacketListener listener, InjectionCallback ci) {
|
private static <T extends PacketListener> void postPacketReceiveEventAtHandlePacketHead(Packet<T> packet, PacketListener listener, InjectionCallback ci) {
|
||||||
if (HookBridge.hasPacketReceiveListeners(Prestige.eventBus, PacketReceiveEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasPacketReceiveListeners(Prestige.eventBus, PacketReceiveEvent.class)) {
|
||||||
PacketReceiveEvent event = HookBridge.createPacketReceiveEvent(packet);
|
PacketReceiveEvent event = HookBridge.createPacketReceiveEvent(packet);
|
||||||
if (HookBridge.postPacketReceiveEvent(event)) {
|
if (HookBridge.postPacketReceiveEvent(event)) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
|
|||||||
@@ -34,7 +34,12 @@ public class ClientPlayNetworkHandlerMixin {
|
|||||||
target = {@CTarget("TAIL")}
|
target = {@CTarget("TAIL")}
|
||||||
)
|
)
|
||||||
private void postChunkDataEventAtTail(ChunkDataS2CPacket packet, InjectionCallback info) {
|
private void postChunkDataEventAtTail(ChunkDataS2CPacket packet, InjectionCallback info) {
|
||||||
|
if (this.world == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
WorldChunk chunk = this.world.getChunk(packet.getChunkX(), packet.getChunkZ());
|
WorldChunk chunk = this.world.getChunk(packet.getChunkX(), packet.getChunkZ());
|
||||||
|
if (chunk != null) {
|
||||||
HookBridge.postChunkDataEvent(HookBridge.createChunkDataEvent(chunk));
|
HookBridge.postChunkDataEvent(HookBridge.createChunkDataEvent(chunk));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -55,8 +55,8 @@ public abstract class EntityMixin {
|
|||||||
)
|
)
|
||||||
private void overrideBoundingBoxAtReturn(InjectionCallback cir) {
|
private void overrideBoundingBoxAtReturn(InjectionCallback cir) {
|
||||||
Entity entity = (Entity)(Object)this;
|
Entity entity = (Entity)(Object)this;
|
||||||
if (entity != null) {
|
if (entity != null && MinecraftClient.getInstance().player != null) {
|
||||||
if (HookBridge.hasBoundingBoxListeners(Prestige.eventBus, BoundingBoxEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasBoundingBoxListeners(Prestige.eventBus, BoundingBoxEvent.class)) {
|
||||||
Box box = (Box)cir.getReturnValue();
|
Box box = (Box)cir.getReturnValue();
|
||||||
BoundingBoxEvent event = HookBridge.createBoundingBoxEvent(entity, box);
|
BoundingBoxEvent event = HookBridge.createBoundingBoxEvent(entity, box);
|
||||||
if (HookBridge.postBoundingBoxEvent(event)) {
|
if (HookBridge.postBoundingBoxEvent(event)) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public abstract class EntityRendererMixin<T extends Entity, S extends EntityRend
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void forceFullSkyLightAtReturn(T entity, BlockPos pos, InjectionCallback cir) {
|
private void forceFullSkyLightAtReturn(T entity, BlockPos pos, InjectionCallback cir) {
|
||||||
if (HookBridge.hasEntitySkyLightListeners(Prestige.eventBus, FullBrightEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasEntitySkyLightListeners(Prestige.eventBus, FullBrightEvent.class)) {
|
||||||
FullBrightEvent event = HookBridge.createEntitySkyLightEvent();
|
FullBrightEvent event = HookBridge.createEntitySkyLightEvent();
|
||||||
if (HookBridge.postEntitySkyLightEvent(event)) {
|
if (HookBridge.postEntitySkyLightEvent(event)) {
|
||||||
cir.setReturnValue(15);
|
cir.setReturnValue(15);
|
||||||
@@ -76,6 +76,9 @@ public abstract class EntityRendererMixin<T extends Entity, S extends EntityRend
|
|||||||
LabelTextEvent labelTextEvent = HookBridge.createLabelTextEvent(entity, originalDisplayName);
|
LabelTextEvent labelTextEvent = HookBridge.createLabelTextEvent(entity, originalDisplayName);
|
||||||
boolean labelTextCancelled = HookBridge.postLabelTextEvent(labelTextEvent);
|
boolean labelTextCancelled = HookBridge.postLabelTextEvent(labelTextEvent);
|
||||||
displayName = HookBridge.getLabelText(labelTextEvent);
|
displayName = HookBridge.getLabelText(labelTextEvent);
|
||||||
|
if (displayName == null) {
|
||||||
|
displayName = originalDisplayName;
|
||||||
|
}
|
||||||
if (!labelTextCancelled) {
|
if (!labelTextCancelled) {
|
||||||
HealthIndicatorEvent event = HookBridge.createHealthIndicatorEvent(player, "");
|
HealthIndicatorEvent event = HookBridge.createHealthIndicatorEvent(player, "");
|
||||||
if (HookBridge.postHealthIndicatorEvent(event)) {
|
if (HookBridge.postHealthIndicatorEvent(event)) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class FogRendererMixin {
|
|||||||
float cloudEnd,
|
float cloudEnd,
|
||||||
InjectionCallback ci
|
InjectionCallback ci
|
||||||
) {
|
) {
|
||||||
if (HookBridge.hasFogBufferListeners(Prestige.eventBus, FogEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasFogBufferListeners(Prestige.eventBus, FogEvent.class)) {
|
||||||
FogEvent event = HookBridge.createFogBufferEvent(0.0F, 0.0F, Color.WHITE);
|
FogEvent event = HookBridge.createFogBufferEvent(0.0F, 0.0F, Color.WHITE);
|
||||||
if (HookBridge.postFogBufferEvent(event)) {
|
if (HookBridge.postFogBufferEvent(event)) {
|
||||||
Vector4f color = HookBridge.createFogBufferColor(
|
Vector4f color = HookBridge.createFogBufferColor(
|
||||||
@@ -66,7 +66,7 @@ public class FogRendererMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void overrideFogColorAtApplyFogTail(Camera camera, int viewDistance, RenderTickCounter tickCounter, float tickProgress, ClientWorld world, InjectionCallback ci) {
|
private void overrideFogColorAtApplyFogTail(Camera camera, int viewDistance, RenderTickCounter tickCounter, float tickProgress, ClientWorld world, InjectionCallback ci) {
|
||||||
if (HookBridge.hasFogColorListeners(Prestige.eventBus, FogEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasFogColorListeners(Prestige.eventBus, FogEvent.class)) {
|
||||||
FogEvent event = HookBridge.createFogColorEvent(0.0F, 0.0F, Color.WHITE);
|
FogEvent event = HookBridge.createFogColorEvent(0.0F, 0.0F, Color.WHITE);
|
||||||
if (HookBridge.postFogColorEvent(event)) {
|
if (HookBridge.postFogColorEvent(event)) {
|
||||||
Color fogColor = HookBridge.getFogColor(event);
|
Color fogColor = HookBridge.getFogColor(event);
|
||||||
|
|||||||
@@ -101,13 +101,16 @@ public class GameRendererMixin {
|
|||||||
Camera camera = this.client.gameRenderer.getCamera();
|
Camera camera = this.client.gameRenderer.getCamera();
|
||||||
MatrixStack matrixStack = HookBridge.createCameraMatrixStack();
|
MatrixStack matrixStack = HookBridge.createCameraMatrixStack();
|
||||||
RenderSystem.getModelViewStack().pushMatrix().mul(matrixStack.peek().getPositionMatrix());
|
RenderSystem.getModelViewStack().pushMatrix().mul(matrixStack.peek().getPositionMatrix());
|
||||||
|
try {
|
||||||
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch()));
|
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch()));
|
||||||
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180.0F));
|
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180.0F));
|
||||||
dev.zprestige.prestige.render.Render2D.modelViewMatrix.set(RenderSystem.getModelViewMatrix());
|
dev.zprestige.prestige.render.Render2D.modelViewMatrix.set(RenderSystem.getModelViewMatrix());
|
||||||
dev.zprestige.prestige.render.Render2D.cameraRotationMatrix.set(matrixStack.peek().getPositionMatrix());
|
dev.zprestige.prestige.render.Render2D.cameraRotationMatrix.set(matrixStack.peek().getPositionMatrix());
|
||||||
|
} finally {
|
||||||
RenderSystem.getModelViewStack().popMatrix();
|
RenderSystem.getModelViewStack().popMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@CInject(
|
@CInject(
|
||||||
target = {@CTarget("HEAD")},
|
target = {@CTarget("HEAD")},
|
||||||
@@ -147,7 +150,7 @@ public class GameRendererMixin {
|
|||||||
if (Prestige.eventBus != null && HookBridge.hasReachListeners(Prestige.eventBus, ReachEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasReachListeners(Prestige.eventBus, ReachEvent.class)) {
|
||||||
Entity entity2 = this.client.getCameraEntity();
|
Entity entity2 = this.client.getCameraEntity();
|
||||||
if (entity2 != null) {
|
if (entity2 != null) {
|
||||||
if (this.client.world != null) {
|
if (this.client.world != null && this.client.player != null) {
|
||||||
Profilers.get().push("pick");
|
Profilers.get().push("pick");
|
||||||
this.client.targetedEntity = null;
|
this.client.targetedEntity = null;
|
||||||
double reach = HookBridge.getBaseReachDistance();
|
double reach = HookBridge.getBaseReachDistance();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public abstract class HeldItemRendererMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void postSwingArmEventAtHead(float swingProgress, MatrixStack matrixStack, int i, Arm arm, InjectionCallback ci) {
|
private void postSwingArmEventAtHead(float swingProgress, MatrixStack matrixStack, int i, Arm arm, InjectionCallback ci) {
|
||||||
if (HookBridge.hasSwingArmListeners(Prestige.eventBus, SwingArmEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasSwingArmListeners(Prestige.eventBus, SwingArmEvent.class)) {
|
||||||
SwingArmEvent event = HookBridge.createSwingArmEvent(matrixStack, arm, swingProgress, 1.0F);
|
SwingArmEvent event = HookBridge.createSwingArmEvent(matrixStack, arm, swingProgress, 1.0F);
|
||||||
if (HookBridge.postSwingArmEvent(event)) {
|
if (HookBridge.postSwingArmEvent(event)) {
|
||||||
matrixStack.scale(2.0F, 2.0F, 2.0F);
|
matrixStack.scale(2.0F, 2.0F, 2.0F);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class InGameHudMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void hideCrosshairAtHead(DrawContext context, RenderTickCounter tickCounter, InjectionCallback ci) {
|
private void hideCrosshairAtHead(DrawContext context, RenderTickCounter tickCounter, InjectionCallback ci) {
|
||||||
if (HookBridge.hasCrosshairRenderListeners(Prestige.eventBus, RenderCrosshairEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasCrosshairRenderListeners(Prestige.eventBus, RenderCrosshairEvent.class)) {
|
||||||
RenderCrosshairEvent event = HookBridge.createCrosshairRenderEvent();
|
RenderCrosshairEvent event = HookBridge.createCrosshairRenderEvent();
|
||||||
if (HookBridge.postCrosshairRenderEvent(event)) {
|
if (HookBridge.postCrosshairRenderEvent(event)) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
@@ -48,7 +48,7 @@ public class InGameHudMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void hideScoreboardSidebarAtHead(DrawContext context, RenderTickCounter counter, InjectionCallback ci) {
|
private void hideScoreboardSidebarAtHead(DrawContext context, RenderTickCounter counter, InjectionCallback ci) {
|
||||||
if (HookBridge.hasScoreboardRenderListeners(Prestige.eventBus, RenderScoreboardEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasScoreboardRenderListeners(Prestige.eventBus, RenderScoreboardEvent.class)) {
|
||||||
if (HookBridge.postScoreboardRenderEvent(HookBridge.createScoreboardRenderEvent())) {
|
if (HookBridge.postScoreboardRenderEvent(HookBridge.createScoreboardRenderEvent())) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ public class InGameHudMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void hideOverlayMessageAtHead(DrawContext context, RenderTickCounter tickCounter, InjectionCallback ci) {
|
private void hideOverlayMessageAtHead(DrawContext context, RenderTickCounter tickCounter, InjectionCallback ci) {
|
||||||
if (HookBridge.hasOverlayMessageListeners(Prestige.eventBus, OverlayMessageEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasOverlayMessageListeners(Prestige.eventBus, OverlayMessageEvent.class)) {
|
||||||
if (HookBridge.postOverlayMessageEvent(HookBridge.createOverlayMessageEvent())) {
|
if (HookBridge.postOverlayMessageEvent(HookBridge.createOverlayMessageEvent())) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class ItemStackMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void suppressGetBobbingAnimationTimeAtHead(InjectionCallback info) {
|
private void suppressGetBobbingAnimationTimeAtHead(InjectionCallback info) {
|
||||||
if (HookBridge.hasGetBobbingTimeListeners(Prestige.eventBus, ItemBobbingEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasGetBobbingTimeListeners(Prestige.eventBus, ItemBobbingEvent.class)) {
|
||||||
if (HookBridge.postGetBobbingTimeEvent(HookBridge.createGetBobbingTimeEvent())) {
|
if (HookBridge.postGetBobbingTimeEvent(HookBridge.createGetBobbingTimeEvent())) {
|
||||||
info.setReturnValue(0);
|
info.setReturnValue(0);
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ public class ItemStackMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
public void suppressSetBobbingAnimationTimeAtHead(int bobbingAnimationTime, InjectionCallback ci) {
|
public void suppressSetBobbingAnimationTimeAtHead(int bobbingAnimationTime, InjectionCallback ci) {
|
||||||
if (HookBridge.hasSetBobbingTimeListeners(Prestige.eventBus, ItemBobbingEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasSetBobbingTimeListeners(Prestige.eventBus, ItemBobbingEvent.class)) {
|
||||||
if (HookBridge.postSetBobbingTimeEvent(HookBridge.createSetBobbingTimeEvent())) {
|
if (HookBridge.postSetBobbingTimeEvent(HookBridge.createSetBobbingTimeEvent())) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class LightmapTextureManagerMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void forceFullBrightLightmapAfterProfilerPush(float tickProgress, InjectionCallback ci) {
|
private void forceFullBrightLightmapAfterProfilerPush(float tickProgress, InjectionCallback ci) {
|
||||||
if (HookBridge.hasLightmapListeners(Prestige.eventBus, FullBrightEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasLightmapListeners(Prestige.eventBus, FullBrightEvent.class)) {
|
||||||
FullBrightEvent event = HookBridge.createLightmapEvent();
|
FullBrightEvent event = HookBridge.createLightmapEvent();
|
||||||
if (HookBridge.postLightmapEvent(event)) {
|
if (HookBridge.postLightmapEvent(event)) {
|
||||||
RenderSystem.getDevice().createCommandEncoder().clearColorTexture(this.glTexture, ColorHelper.getArgb(255, 255, 255, 255));
|
RenderSystem.getDevice().createCommandEncoder().clearColorTexture(this.glTexture, ColorHelper.getArgb(255, 255, 255, 255));
|
||||||
|
|||||||
@@ -43,10 +43,8 @@ public class ModelCommandRendererMixin {
|
|||||||
target = {@CTarget("RETURN")}
|
target = {@CTarget("RETURN")}
|
||||||
)
|
)
|
||||||
private void clearRenderLayerAtRenderReturn() {
|
private void clearRenderLayerAtRenderReturn() {
|
||||||
if (EspShaderManager.enabled) {
|
|
||||||
ESP.CURRENT_RENDER_LAYER.remove();
|
ESP.CURRENT_RENDER_LAYER.remove();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@CRedirect(
|
@CRedirect(
|
||||||
method = {"render(Lnet/minecraft/client/render/command/OrderedRenderCommandQueueImpl$ModelCommand;Lnet/minecraft/client/render/RenderLayer;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/client/render/OutlineVertexConsumerProvider;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;)V"},
|
method = {"render(Lnet/minecraft/client/render/command/OrderedRenderCommandQueueImpl$ModelCommand;Lnet/minecraft/client/render/RenderLayer;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/client/render/OutlineVertexConsumerProvider;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;)V"},
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class MouseMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void postMouseMoveEventAtUpdateMouseHead(double timeDelta, InjectionCallback ci) {
|
private void postMouseMoveEventAtUpdateMouseHead(double timeDelta, InjectionCallback ci) {
|
||||||
if (HookBridge.hasMouseMoveListeners(Prestige.eventBus, MouseUpdateEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasMouseMoveListeners(Prestige.eventBus, MouseUpdateEvent.class)) {
|
||||||
MouseUpdateEvent event = HookBridge.createMouseMoveEvent(this.cursorDeltaX, this.cursorDeltaY);
|
MouseUpdateEvent event = HookBridge.createMouseMoveEvent(this.cursorDeltaX, this.cursorDeltaY);
|
||||||
if (HookBridge.postMouseMoveEvent(event)) {
|
if (HookBridge.postMouseMoveEvent(event)) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class ParticleManagerMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void postAddParticleEventAtHead(Particle particle, InjectionCallback ci) {
|
private void postAddParticleEventAtHead(Particle particle, InjectionCallback ci) {
|
||||||
if (HookBridge.hasAddParticleListeners(Prestige.eventBus, AddParticleEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasAddParticleListeners(Prestige.eventBus, AddParticleEvent.class)) {
|
||||||
AddParticleEvent event = HookBridge.createAddParticleEvent();
|
AddParticleEvent event = HookBridge.createAddParticleEvent();
|
||||||
if (HookBridge.postAddParticleEvent(event)) {
|
if (HookBridge.postAddParticleEvent(event)) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class PlayerListEntryMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void overrideListEntrySkinAtGetSkinTexturesReturn(InjectionCallback ci) {
|
private void overrideListEntrySkinAtGetSkinTexturesReturn(InjectionCallback ci) {
|
||||||
if (this.profile != null && HookBridge.hasListEntrySkinListeners(Prestige.eventBus, SkinTexturesEvent.class)) {
|
if (this.profile != null && Prestige.eventBus != null && HookBridge.hasListEntrySkinListeners(Prestige.eventBus, SkinTexturesEvent.class)) {
|
||||||
SkinTexturesEvent event = HookBridge.createListEntrySkinEvent((SkinTextures)ci.getReturnValue(), HookBridge.getProfileName(this.profile));
|
SkinTexturesEvent event = HookBridge.createListEntrySkinEvent((SkinTextures)ci.getReturnValue(), HookBridge.getProfileName(this.profile));
|
||||||
if (HookBridge.postListEntrySkinEvent(event)) {
|
if (HookBridge.postListEntrySkinEvent(event)) {
|
||||||
ci.setReturnValue(HookBridge.getListEntrySkinTextures(event));
|
ci.setReturnValue(HookBridge.getListEntrySkinTextures(event));
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class SkyRenderingMixin {
|
|||||||
target = {@CTarget("TAIL")}
|
target = {@CTarget("TAIL")}
|
||||||
)
|
)
|
||||||
private void overrideSkyColorAtUpdateRenderStateTail(ClientWorld world, float tickDelta, Camera camera, SkyRenderState state, InjectionCallback ci) {
|
private void overrideSkyColorAtUpdateRenderStateTail(ClientWorld world, float tickDelta, Camera camera, SkyRenderState state, InjectionCallback ci) {
|
||||||
if (HookBridge.hasSkyColorListeners(Prestige.eventBus, SkyColorEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasSkyColorListeners(Prestige.eventBus, SkyColorEvent.class)) {
|
||||||
int skyPacked = state.skyColor;
|
int skyPacked = state.skyColor;
|
||||||
Color initialSky = HookBridge.createSkyColor(skyPacked >> 16 & 0xFF, skyPacked >> 8 & 0xFF, skyPacked & 0xFF);
|
Color initialSky = HookBridge.createSkyColor(skyPacked >> 16 & 0xFF, skyPacked >> 8 & 0xFF, skyPacked & 0xFF);
|
||||||
int hzPacked = state.sunriseAndSunsetColor;
|
int hzPacked = state.sunriseAndSunsetColor;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class TextDisplayEntityRendererMixin {
|
|||||||
)}
|
)}
|
||||||
)
|
)
|
||||||
public void modifyLabelTextBeforeWrapLines(CArgs cArgs) {
|
public void modifyLabelTextBeforeWrapLines(CArgs cArgs) {
|
||||||
if (HookBridge.hasTextDisplayLabelListeners(Prestige.eventBus, LabelTextEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasTextDisplayLabelListeners(Prestige.eventBus, LabelTextEvent.class)) {
|
||||||
Text text = (Text)cArgs.get(0);
|
Text text = (Text)cArgs.get(0);
|
||||||
String stringText = text.getString();
|
String stringText = text.getString();
|
||||||
ClientWorld world = MinecraftClient.getInstance().world;
|
ClientWorld world = MinecraftClient.getInstance().world;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class TextVisitFactoryMixin {
|
|||||||
private static void replaceTextBeforeVisitFormatted(CArgs cArgs) {
|
private static void replaceTextBeforeVisitFormatted(CArgs cArgs) {
|
||||||
String text = (String)cArgs.get(0);
|
String text = (String)cArgs.get(0);
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
if (!HookBridge.hasTextReplaceListeners(Prestige.eventBus, TextReplaceEvent.class)) {
|
if (Prestige.eventBus == null || !HookBridge.hasTextReplaceListeners(Prestige.eventBus, TextReplaceEvent.class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class WorldChunkMixin {
|
|||||||
target = {@CTarget("TAIL")}
|
target = {@CTarget("TAIL")}
|
||||||
)
|
)
|
||||||
private void postBlockUpdateEventAtSetBlockStateTail(BlockPos pos, BlockState state, int flags, InjectionCallback cir) {
|
private void postBlockUpdateEventAtSetBlockStateTail(BlockPos pos, BlockState state, int flags, InjectionCallback cir) {
|
||||||
if (HookBridge.hasBlockUpdateListeners(Prestige.eventBus, BlockStateUpdateEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasBlockUpdateListeners(Prestige.eventBus, BlockStateUpdateEvent.class)) {
|
||||||
if (this.world.isClient()) {
|
if (this.world.isClient()) {
|
||||||
BlockStateUpdateEvent event = HookBridge.createBlockUpdateEvent(pos, state);
|
BlockStateUpdateEvent event = HookBridge.createBlockUpdateEvent(pos, state);
|
||||||
HookBridge.postBlockUpdateEvent(event);
|
HookBridge.postBlockUpdateEvent(event);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class WorldMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void overrideRainGradientAtReturn(float delta, InjectionCallback cir) {
|
private void overrideRainGradientAtReturn(float delta, InjectionCallback cir) {
|
||||||
if (HookBridge.hasRainGradientListeners(Prestige.eventBus, RainGradientEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasRainGradientListeners(Prestige.eventBus, RainGradientEvent.class)) {
|
||||||
if (HookBridge.postRainGradientEvent(HookBridge.createRainGradientEvent())) {
|
if (HookBridge.postRainGradientEvent(HookBridge.createRainGradientEvent())) {
|
||||||
cir.setReturnValue(0.0F);
|
cir.setReturnValue(0.0F);
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ public class WorldMixin {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void overrideTimeOfDayAtReturn(InjectionCallback cir) {
|
private void overrideTimeOfDayAtReturn(InjectionCallback cir) {
|
||||||
if (HookBridge.hasTimeOfDayListeners(Prestige.eventBus, TimeOfDayEvent.class)) {
|
if (Prestige.eventBus != null && HookBridge.hasTimeOfDayListeners(Prestige.eventBus, TimeOfDayEvent.class)) {
|
||||||
TimeOfDayEvent event = HookBridge.createTimeOfDayEvent((Long)cir.getReturnValue());
|
TimeOfDayEvent event = HookBridge.createTimeOfDayEvent((Long)cir.getReturnValue());
|
||||||
if (HookBridge.postTimeOfDayEvent(event)) {
|
if (HookBridge.postTimeOfDayEvent(event)) {
|
||||||
cir.setReturnValue(HookBridge.getTimeOfDay(event));
|
cir.setReturnValue(HookBridge.getTimeOfDay(event));
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import net.minecraft.item.Items;
|
|||||||
import net.minecraft.util.hit.EntityHitResult;
|
import net.minecraft.util.hit.EntityHitResult;
|
||||||
import net.minecraft.util.hit.HitResult.Type;
|
import net.minecraft.util.hit.HitResult.Type;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public class AimAssist extends Module {
|
public class AimAssist extends Module {
|
||||||
@@ -170,13 +171,7 @@ public class AimAssist extends Module {
|
|||||||
float yawDelta = targetRotation.getYaw() - mc.player.getYaw();
|
float yawDelta = targetRotation.getYaw() - mc.player.getYaw();
|
||||||
float pitchDelta = targetRotation.getPitch() - mc.player.getPitch();
|
float pitchDelta = targetRotation.getPitch() - mc.player.getPitch();
|
||||||
|
|
||||||
while (yawDelta > 180.0F) {
|
yawDelta = MathHelper.wrapDegrees(yawDelta);
|
||||||
yawDelta -= 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (yawDelta < -180.0F) {
|
|
||||||
yawDelta += 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(this.fov.getValue() < 360.0F)
|
if (!(this.fov.getValue() < 360.0F)
|
||||||
|| !(Math.abs(yawDelta) > this.fov.getValue() / 2.0F) && !(Math.abs(pitchDelta) > this.fov.getValue() / 2.0F)) {
|
|| !(Math.abs(yawDelta) > this.fov.getValue() / 2.0F) && !(Math.abs(pitchDelta) > this.fov.getValue() / 2.0F)) {
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ public class AnchorExploder extends Module implements RotationProvider {
|
|||||||
public void onPacketReceive(PacketReceiveEvent event) {
|
public void onPacketReceive(PacketReceiveEvent event) {
|
||||||
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate) {
|
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate) {
|
||||||
if (blockUpdate.getState() != null && blockUpdate.getState().getBlock() != Blocks.RESPAWN_ANCHOR) {
|
if (blockUpdate.getState() != null && blockUpdate.getState().getBlock() != Blocks.RESPAWN_ANCHOR) {
|
||||||
this.ownAnchors.remove(blockUpdate.getPos());
|
mc.execute(() -> this.ownAnchors.remove(blockUpdate.getPos()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,8 +305,10 @@ public class AnchorMacro extends Module {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mc.execute(() -> {
|
||||||
this.bindPlacedAnchors.remove(blockUpdate.getPos());
|
this.bindPlacedAnchors.remove(blockUpdate.getPos());
|
||||||
this.ownAnchors.remove(blockUpdate.getPos());
|
this.ownAnchors.remove(blockUpdate.getPos());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ public class AnchorPlacer extends Module implements RotationProvider {
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPacketReceive(PacketReceiveEvent event) {
|
public void onPacketReceive(PacketReceiveEvent event) {
|
||||||
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate && blockUpdate.getState() != null && blockUpdate.getState().getBlock() != Blocks.RESPAWN_ANCHOR) {
|
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate && blockUpdate.getState() != null && blockUpdate.getState().getBlock() != Blocks.RESPAWN_ANCHOR) {
|
||||||
this.placedAnchors.remove(blockUpdate.getPos());
|
mc.execute(() -> this.placedAnchors.remove(blockUpdate.getPos()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,14 @@ public class AntiBot extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPacketReceive(PacketReceiveEvent event) {
|
public void onPacketReceive(PacketReceiveEvent event) {
|
||||||
if (this.mode.isSelected("Packet") && event.getPacket() instanceof EntityPositionS2CPacket && mc.world != null) {
|
if (this.mode.isSelected("Packet") && event.getPacket() instanceof EntityPositionS2CPacket) {
|
||||||
Entity entity = mc.world.getEntityById(((EntityPositionS2CPacket)event.getPacket()).entityId());
|
int entityId = ((EntityPositionS2CPacket)event.getPacket()).entityId();
|
||||||
|
mc.execute(() -> {
|
||||||
|
if (mc.world == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity entity = mc.world.getEntityById(entityId);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -55,9 +61,15 @@ public class AntiBot extends Module {
|
|||||||
this.positionPacketCounts.put(player, packetCount);
|
this.positionPacketCounts.put(player, packetCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
this.positionPacketCounts.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameJoin(GameJoinEvent event) {
|
public void onGameJoin(GameJoinEvent event) {
|
||||||
this.positionPacketCounts.clear();
|
this.positionPacketCounts.clear();
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ public class AutoAnchor extends Module implements RotationProvider {
|
|||||||
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate) {
|
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate) {
|
||||||
this.blockUpdateCount++;
|
this.blockUpdateCount++;
|
||||||
if (blockUpdate.getState() != null && blockUpdate.getState().getBlock() != Blocks.RESPAWN_ANCHOR) {
|
if (blockUpdate.getState() != null && blockUpdate.getState().getBlock() != Blocks.RESPAWN_ANCHOR) {
|
||||||
this.placedAnchors.remove(blockUpdate.getPos());
|
mc.execute(() -> this.placedAnchors.remove(blockUpdate.getPos()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public class DoubleAnchor extends Module {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockHitResult crosshairHit = (BlockHitResult)mc.crosshairTarget;
|
BlockHitResult crosshairHit = mc.crosshairTarget instanceof BlockHitResult blockCrosshair ? blockCrosshair : null;
|
||||||
if (crosshairHit != null
|
if (crosshairHit != null
|
||||||
&& mc.world.getBlockState(crosshairHit.getBlockPos()).isOf(Blocks.RESPAWN_ANCHOR)
|
&& mc.world.getBlockState(crosshairHit.getBlockPos()).isOf(Blocks.RESPAWN_ANCHOR)
|
||||||
&& mc.world.getBlockState(crosshairHit.getBlockPos()).get(Properties.CHARGES) != 0) {
|
&& mc.world.getBlockState(crosshairHit.getBlockPos()).get(Properties.CHARGES) != 0) {
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ public class SafeAnchor extends Module implements RotationProvider {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ownAnchors.remove(blockUpdate.getPos());
|
mc.execute(() -> this.ownAnchors.remove(blockUpdate.getPos()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,6 +92,10 @@ public class AutoArmor extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSwapAllowed() {
|
private boolean isSwapAllowed() {
|
||||||
|
if (mc.player.currentScreenHandler != mc.player.playerScreenHandler) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return switch (this.mode.getValue()) {
|
return switch (this.mode.getValue()) {
|
||||||
case "Inventory" -> mc.currentScreen instanceof InventoryScreen;
|
case "Inventory" -> mc.currentScreen instanceof InventoryScreen;
|
||||||
case "Keybind" -> {
|
case "Keybind" -> {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class AutoPickaxe extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onFrame(FrameEvent event) {
|
public void onFrame(FrameEvent event) {
|
||||||
if (mc.currentScreen == null && mc.isWindowFocused()) {
|
if (mc.player != null && mc.world != null && mc.currentScreen == null && mc.isWindowFocused()) {
|
||||||
BlockPos belowPos = mc.player.getBlockPos().down();
|
BlockPos belowPos = mc.player.getBlockPos().down();
|
||||||
boolean notMining = this.onlyWhenMining.getValue() && GLFW.glfwGetMouseButton(mc.getWindow().getHandle(), 0) != 1;
|
boolean notMining = this.onlyWhenMining.getValue() && GLFW.glfwGetMouseButton(mc.getWindow().getHandle(), 0) != 1;
|
||||||
HitResult hitResult = mc.crosshairTarget;
|
HitResult hitResult = mc.crosshairTarget;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class AutoPot extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
if (mc.currentScreen == null && mc.isWindowFocused()) {
|
if (mc.player != null && mc.currentScreen == null && mc.isWindowFocused()) {
|
||||||
boolean autoMode = this.mode.getValue().equals("Auto");
|
boolean autoMode = this.mode.getValue().equals("Auto");
|
||||||
if (autoMode && mc.player.getHealth() > this.health.getValue()) {
|
if (autoMode && mc.player.getHealth() > this.health.getValue()) {
|
||||||
this.throwTimer.reset();
|
this.throwTimer.reset();
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ public class AutoText extends Module {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
String message = this.text.getValue().toString();
|
String message = this.text.getValue().toString();
|
||||||
|
if (message.length() > 256) {
|
||||||
|
message = message.substring(0, 256);
|
||||||
|
}
|
||||||
|
|
||||||
if (message.startsWith("/")) {
|
if (message.startsWith("/")) {
|
||||||
Objects.requireNonNull(mc.getNetworkHandler()).sendChatCommand(message.substring(1));
|
Objects.requireNonNull(mc.getNetworkHandler()).sendChatCommand(message.substring(1));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class AutoTool extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onSendMovementPackets(SendMovementPacketsEvent event) {
|
public void onSendMovementPackets(SendMovementPacketsEvent event) {
|
||||||
if (mc.crosshairTarget instanceof BlockHitResult blockHit) {
|
if (mc.player != null && mc.world != null && mc.crosshairTarget instanceof BlockHitResult blockHit) {
|
||||||
BlockPos blockPos = blockHit.getBlockPos();
|
BlockPos blockPos = blockHit.getBlockPos();
|
||||||
if (!mc.world.getBlockState(blockPos).isAir()) {
|
if (!mc.world.getBlockState(blockPos).isAir()) {
|
||||||
int toolSlot = this.findBestToolSlot(blockPos);
|
int toolSlot = this.findBestToolSlot(blockPos);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class CartRefill extends Module {
|
|||||||
float delayMs = this.delay.getValue().intValue();
|
float delayMs = this.delay.getValue().intValue();
|
||||||
if (timer.hasElapsed(delayMs)) {
|
if (timer.hasElapsed(delayMs)) {
|
||||||
if (this.isRefillAllowed()) {
|
if (this.isRefillAllowed()) {
|
||||||
int hotbarSlot = this.targetSlot.getValue() - 1;
|
int hotbarSlot = Math.max(0, Math.min(8, this.targetSlot.getValue() - 1));
|
||||||
if (mc.player.getInventory().getStack(hotbarSlot).isEmpty()) {
|
if (mc.player.getInventory().getStack(hotbarSlot).isEmpty()) {
|
||||||
int cartSlot = this.findTntMinecartSlot();
|
int cartSlot = this.findTntMinecartSlot();
|
||||||
if (cartSlot != -1) {
|
if (cartSlot != -1) {
|
||||||
@@ -52,6 +52,10 @@ public class CartRefill extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRefillAllowed() {
|
private boolean isRefillAllowed() {
|
||||||
|
if (mc.player.currentScreenHandler != mc.player.playerScreenHandler) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.mode.getValue().equals("Always")) {
|
if (this.mode.getValue().equals("Always")) {
|
||||||
return mc.currentScreen instanceof InventoryScreen;
|
return mc.currentScreen instanceof InventoryScreen;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ public class CartStealer extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onFrame(FrameEvent event) {
|
public void onFrame(FrameEvent event) {
|
||||||
|
if (mc.player == null || mc.interactionManager == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.activateKey.getValue() == -1 || GLFW.glfwGetKey(mc.getWindow().getHandle(), this.activateKey.getValue()) == 1) {
|
if (this.activateKey.getValue() == -1 || GLFW.glfwGetKey(mc.getWindow().getHandle(), this.activateKey.getValue()) == 1) {
|
||||||
if (this.stealTimer.hasElapsedRandom(this.delay)) {
|
if (this.stealTimer.hasElapsedRandom(this.delay)) {
|
||||||
if (mc.player.currentScreenHandler instanceof ShulkerBoxScreenHandler shulkerHandler) {
|
if (mc.player.currentScreenHandler instanceof ShulkerBoxScreenHandler shulkerHandler) {
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ public class ChestStealer extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onFrame(FrameEvent event) {
|
public void onFrame(FrameEvent event) {
|
||||||
|
if (mc.player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.activateKey.getValue() != -1 && GLFW.glfwGetKey(mc.getWindow().getHandle(), this.activateKey.getValue()) == 1) {
|
if (this.activateKey.getValue() != -1 && GLFW.glfwGetKey(mc.getWindow().getHandle(), this.activateKey.getValue()) == 1) {
|
||||||
if (this.stealTimer.hasElapsed(this.delay.getValue())) {
|
if (this.stealTimer.hasElapsed(this.delay.getValue())) {
|
||||||
if (mc.player.currentScreenHandler instanceof GenericContainerScreenHandler containerHandler) {
|
if (mc.player.currentScreenHandler instanceof GenericContainerScreenHandler containerHandler) {
|
||||||
|
|||||||
@@ -71,12 +71,14 @@ public class Criticals extends Module {
|
|||||||
if (this.pendingTarget != null) {
|
if (this.pendingTarget != null) {
|
||||||
if (this.ticksUntilAttack <= 0) {
|
if (this.ticksUntilAttack <= 0) {
|
||||||
this.replayingAttack = true;
|
this.replayingAttack = true;
|
||||||
if (mc.crosshairTarget.getType() == Type.ENTITY) {
|
try {
|
||||||
|
if (mc.player != null && mc.crosshairTarget != null && mc.crosshairTarget.getType() == Type.ENTITY) {
|
||||||
PlayerInteractions.attackEntity(this.pendingTarget);
|
PlayerInteractions.attackEntity(this.pendingTarget);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
this.replayingAttack = false;
|
this.replayingAttack = false;
|
||||||
this.pendingTarget = null;
|
this.pendingTarget = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.ticksUntilAttack--;
|
this.ticksUntilAttack--;
|
||||||
}
|
}
|
||||||
@@ -92,6 +94,13 @@ public class Criticals extends Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
this.pendingTarget = null;
|
||||||
|
this.ticksUntilAttack = 0;
|
||||||
|
this.replayingAttack = false;
|
||||||
|
}
|
||||||
|
|
||||||
private void sendOffsetPosition(float yOffset) {
|
private void sendOffsetPosition(float yOffset) {
|
||||||
PacketSender.sendPacket(new PositionAndOnGround(mc.player.getX(), mc.player.getY() + yOffset, mc.player.getZ(), false, mc.player.horizontalCollision));
|
PacketSender.sendPacket(new PositionAndOnGround(mc.player.getX(), mc.player.getY() + yOffset, mc.player.getZ(), false, mc.player.horizontalCollision));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class CrystalOptimizer extends Module {
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onAttackEntity(AttackEntityEvent event) {
|
public void onAttackEntity(AttackEntityEvent event) {
|
||||||
Entity target = event.getTarget();
|
Entity target = event.getTarget();
|
||||||
if (target instanceof EndCrystalEntity) {
|
if (target instanceof EndCrystalEntity && mc.player != null) {
|
||||||
if (mc.player.getStatusEffect(StatusEffects.WEAKNESS) != null) {
|
if (mc.player.getStatusEffect(StatusEffects.WEAKNESS) != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class EnemyFaker extends Module {
|
|||||||
&& event.getPlayerName() != null
|
&& event.getPlayerName() != null
|
||||||
&& event.getSkinTextures() != null
|
&& event.getSkinTextures() != null
|
||||||
&& !this.fakeName.getValue().isEmpty()
|
&& !this.fakeName.getValue().isEmpty()
|
||||||
|
&& mc.getNetworkHandler() != null
|
||||||
&& mc.getNetworkHandler().getPlayerListEntry(this.target.getUuid()) != null
|
&& mc.getNetworkHandler().getPlayerListEntry(this.target.getUuid()) != null
|
||||||
&& mc.getNetworkHandler().getPlayerListEntry(this.target.getUuid()).getProfile() != null) {
|
&& mc.getNetworkHandler().getPlayerListEntry(this.target.getUuid()).getProfile() != null) {
|
||||||
if (event.getPlayerName()
|
if (event.getPlayerName()
|
||||||
@@ -86,7 +87,12 @@ public class EnemyFaker extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
for (PlayerEntity player : mc.world.getPlayers()) {
|
if (mc.world == null || mc.player == null) {
|
||||||
|
this.target = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (PlayerEntity player : new ArrayList<>(mc.world.getPlayers())) {
|
||||||
if (!player.equals(mc.player) && (player.isDead() || !player.isAlive())) {
|
if (!player.equals(mc.player) && (player.isDead() || !player.isAlive())) {
|
||||||
mc.world.removeEntity(player.getId(), RemovalReason.DISCARDED);
|
mc.world.removeEntity(player.getId(), RemovalReason.DISCARDED);
|
||||||
}
|
}
|
||||||
@@ -96,25 +102,50 @@ public class EnemyFaker extends Module {
|
|||||||
if (this.update.getValue()) {
|
if (this.update.getValue()) {
|
||||||
this.update.setValue(false);
|
this.update.setValue(false);
|
||||||
if (!this.fakeName.getValue().isEmpty()) {
|
if (!this.fakeName.getValue().isEmpty()) {
|
||||||
UUID uuid = MojangApi.fetchUuid(this.fakeName.getValue().toString());
|
String requestedName = this.fakeName.getValue().toString();
|
||||||
if (uuid != null) {
|
// Mojang lookups block for several seconds on a bad connection, never do them on the game thread
|
||||||
GameProfile profile = MojangApi.fetchProfile(uuid);
|
Thread lookup = new Thread(() -> {
|
||||||
CompletableFuture skinFuture = mc.getSkinProvider().fetchSkinTextures(profile);
|
UUID uuid = MojangApi.fetchUuid(requestedName);
|
||||||
skinFuture.thenAccept(skinResult -> {
|
GameProfile profile = uuid == null ? null : MojangApi.fetchProfile(uuid);
|
||||||
if (((java.util.Optional)skinResult).isPresent()) {
|
if (profile != null) {
|
||||||
this.fakeSkin = (SkinTextures)((java.util.Optional)skinResult).get();
|
mc.execute(() -> this.applyFakeSkin(profile, requestedName));
|
||||||
mc.player.sendMessage(Text.of("Fake skin updated to: " + this.fakeName.getValue()), false);
|
|
||||||
} else {
|
|
||||||
mc.player.sendMessage(Text.of("Failed to fetch skin for: " + this.fakeName.getValue()), false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
}, "Prestige-SkinLookup");
|
||||||
|
lookup.setDaemon(true);
|
||||||
|
lookup.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyFakeSkin(GameProfile profile, String requestedName) {
|
||||||
|
if (!this.isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CompletableFuture skinFuture = mc.getSkinProvider().fetchSkinTextures(profile);
|
||||||
|
skinFuture.thenAccept(skinResult -> {
|
||||||
|
if (((java.util.Optional)skinResult).isPresent()) {
|
||||||
|
this.fakeSkin = (SkinTextures)((java.util.Optional)skinResult).get();
|
||||||
|
if (mc.player != null) {
|
||||||
|
mc.player.sendMessage(Text.of("Fake skin updated to: " + requestedName), false);
|
||||||
|
}
|
||||||
|
} else if (mc.player != null) {
|
||||||
|
mc.player.sendMessage(Text.of("Failed to fetch skin for: " + requestedName), false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
this.target = null;
|
||||||
|
this.fakeSkin = null;
|
||||||
|
}
|
||||||
|
|
||||||
public static PlayerEntity findClosestEnemy() {
|
public static PlayerEntity findClosestEnemy() {
|
||||||
PlayerEntity closest = null;
|
PlayerEntity closest = null;
|
||||||
|
if (mc.world == null || mc.player == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
for (PlayerEntity player : new ArrayList<>(mc.world.getPlayers())) {
|
for (PlayerEntity player : new ArrayList<>(mc.world.getPlayers())) {
|
||||||
if (!player.equals(mc.player)
|
if (!player.equals(mc.player)
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ public class FastPlace extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
|
if (mc.player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.blocksOnly.getValue()
|
if (!this.blocksOnly.getValue()
|
||||||
|| mc.player.getMainHandStack().getItem() instanceof BlockItem
|
|| mc.player.getMainHandStack().getItem() instanceof BlockItem
|
||||||
|| mc.player.getOffHandStack().getItem() instanceof BlockItem) {
|
|| mc.player.getOffHandStack().getItem() instanceof BlockItem) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class Friends extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onTextReplace(TextReplaceEvent event) {
|
public void onTextReplace(TextReplaceEvent event) {
|
||||||
if (this.highlight.getValue()) {
|
if (this.highlight.getValue() && event.getText() != null) {
|
||||||
for (Object friendName : Prestige.friendManager.getFriends()) {
|
for (Object friendName : Prestige.friendManager.getFriends()) {
|
||||||
if (event.getText().contains((CharSequence)friendName)) {
|
if (event.getText().contains((CharSequence)friendName)) {
|
||||||
event.setTarget((String)friendName);
|
event.setTarget((String)friendName);
|
||||||
@@ -71,7 +71,9 @@ public class Friends extends Module {
|
|||||||
if (hitResult.getType() == Type.ENTITY) {
|
if (hitResult.getType() == Type.ENTITY) {
|
||||||
Entity targetEntity = ((EntityHitResult)hitResult).getEntity();
|
Entity targetEntity = ((EntityHitResult)hitResult).getEntity();
|
||||||
if (targetEntity instanceof PlayerEntity && Prestige.friendManager.isFriend(targetEntity.getName().getString())) {
|
if (targetEntity instanceof PlayerEntity && Prestige.friendManager.isFriend(targetEntity.getName().getString())) {
|
||||||
|
if (mc.player != null) {
|
||||||
mc.player.handSwinging = false;
|
mc.player.handSwinging = false;
|
||||||
|
}
|
||||||
event.cancel();
|
event.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class KeyPearl extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
if (mc.currentScreen == null && mc.isWindowFocused()) {
|
if (mc.player != null && mc.currentScreen == null && mc.isWindowFocused()) {
|
||||||
if (this.actionTimer.hasElapsed(this.delay.getValue())) {
|
if (this.actionTimer.hasElapsed(this.delay.getValue())) {
|
||||||
if (this.pearlThrown) {
|
if (this.pearlThrown) {
|
||||||
InventoryUtil.selectSlot(this.previousSlot);
|
InventoryUtil.selectSlot(this.previousSlot);
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ public class NameHider extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onFrame(FrameEvent event) {
|
public void onFrame(FrameEvent event) {
|
||||||
|
if (mc.player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.randomize.getValue()) {
|
if (this.randomize.getValue()) {
|
||||||
if (this.rerollTimer.hasElapsed(this.speed.getValue())) {
|
if (this.rerollTimer.hasElapsed(this.speed.getValue())) {
|
||||||
this.replacementName = this.generateName();
|
this.replacementName = this.generateName();
|
||||||
@@ -47,7 +51,7 @@ public class NameHider extends Module {
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onTextReplace(TextReplaceEvent event) {
|
public void onTextReplace(TextReplaceEvent event) {
|
||||||
String username = mc.getSession().getUsername();
|
String username = mc.getSession().getUsername();
|
||||||
if (event.getText().contains(username)) {
|
if (username != null && !username.isEmpty() && event.getText() != null && event.getText().contains(username)) {
|
||||||
event.setTarget(mc.getSession().getUsername());
|
event.setTarget(mc.getSession().getUsername());
|
||||||
event.setText(this.replacementName);
|
event.setText(this.replacementName);
|
||||||
event.cancel();
|
event.cancel();
|
||||||
@@ -56,8 +60,10 @@ public class NameHider extends Module {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
if (mc.player != null) {
|
||||||
this.replacementName = this.generateName();
|
this.replacementName = this.generateName();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String generateName() {
|
private String generateName() {
|
||||||
if (this.mode.getValue().equals("Custom")) {
|
if (this.mode.getValue().equals("Custom")) {
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ public class Refill extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRefillAllowed() {
|
private boolean isRefillAllowed() {
|
||||||
|
if (mc.player.currentScreenHandler != mc.player.playerScreenHandler) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.mode.getValue().equals("Always")) {
|
if (this.mode.getValue().equals("Always")) {
|
||||||
return mc.currentScreen instanceof InventoryScreen;
|
return mc.currentScreen instanceof InventoryScreen;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,8 +2,19 @@ package dev.zprestige.prestige.module.misc;
|
|||||||
|
|
||||||
import dev.zprestige.prestige.Module;
|
import dev.zprestige.prestige.Module;
|
||||||
import dev.zprestige.prestige.client.Prestige;
|
import dev.zprestige.prestige.client.Prestige;
|
||||||
|
import dev.zprestige.prestige.inject.Bootstrap;
|
||||||
|
import dev.zprestige.prestige.inject.NativeBridge;
|
||||||
|
import dev.zprestige.prestige.ui.mc.Overlay;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the client from the running game.
|
||||||
|
*
|
||||||
|
* Stage 1 (this tick): stop all client logic, close the menu, switch every other module off.
|
||||||
|
* Stage 2 (next tick, after Module.toggle has returned): dispose the modules and empty the module list.
|
||||||
|
* Stage 3 (injected clients only): put the original bytes back into every hooked game class and let the native loader unload.
|
||||||
|
*/
|
||||||
public class SelfDestruct extends Module {
|
public class SelfDestruct extends Module {
|
||||||
public SelfDestruct() {
|
public SelfDestruct() {
|
||||||
dev.zprestige.prestige.ui.bridge.Bootstrap.pre(this);
|
dev.zprestige.prestige.ui.bridge.Bootstrap.pre(this);
|
||||||
@@ -12,18 +23,54 @@ public class SelfDestruct extends Module {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Prestige.selfDestructed = true;
|
Prestige.selfDestructed = true;
|
||||||
|
Overlay.shutdown();
|
||||||
mc.setScreen(null);
|
mc.setScreen(null);
|
||||||
|
|
||||||
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
|
List<Module> modules = new ArrayList<>(Prestige.moduleManager.getModules());
|
||||||
|
for (Module module : modules) {
|
||||||
|
if (module == this) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
if (module.isEnabled()) {
|
if (module.isEnabled()) {
|
||||||
module.toggle();
|
module.toggle();
|
||||||
}
|
}
|
||||||
|
} catch (Throwable error) {
|
||||||
module.dispose();
|
error.printStackTrace();
|
||||||
module.getKeybind().setValue(-1);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disposing this module now would null its own "Enabled" value while Module.toggle still has to read it.
|
||||||
|
mc.execute(() -> dispose(modules));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dispose(List<Module> modules) {
|
||||||
|
for (Module module : modules) {
|
||||||
|
try {
|
||||||
|
module.dispose();
|
||||||
|
module.getKeybind().setValue(-1);
|
||||||
|
} catch (Throwable error) {
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
Prestige.moduleManager.setModules(new ArrayList());
|
Prestige.moduleManager.setModules(new ArrayList());
|
||||||
|
|
||||||
|
if (Bootstrap.isInjected()) {
|
||||||
|
// one more tick so no hook of the current tick is still being entered when the original classes come back
|
||||||
|
mc.execute(() -> mc.execute(SelfDestruct::unhook));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void unhook() {
|
||||||
|
try {
|
||||||
|
Bootstrap.uninstall();
|
||||||
|
NativeBridge.release();
|
||||||
|
} catch (UnsatisfiedLinkError ignored) {
|
||||||
|
// loader already gone
|
||||||
|
} catch (Throwable error) {
|
||||||
|
// an Error escaping a main-thread task would take the whole game down
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ public class Teams extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
|
if (mc.world == null || mc.player == null) {
|
||||||
|
teammates = new HashSet();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HashSet currentTeammates = new HashSet();
|
HashSet currentTeammates = new HashSet();
|
||||||
|
|
||||||
for (PlayerEntity player : mc.world.getPlayers()) {
|
for (PlayerEntity player : mc.world.getPlayers()) {
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ public class AutoJumpReset extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
|
if (mc.player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DamageSource damageSource = mc.player.getRecentDamageSource();
|
DamageSource damageSource = mc.player.getRecentDamageSource();
|
||||||
if (mc.currentScreen == null
|
if (mc.currentScreen == null
|
||||||
&& !mc.player.isBlocking()
|
&& !mc.player.isBlocking()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class AutoShortPearl extends Module implements RotationProvider {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPacketReceive(PacketReceiveEvent event) {
|
public void onPacketReceive(PacketReceiveEvent event) {
|
||||||
if (event.getPacket() instanceof EntityDamageS2CPacket damagePacket) {
|
if (mc.world != null && mc.player != null && event.getPacket() instanceof EntityDamageS2CPacket damagePacket) {
|
||||||
Entity damagedEntity = mc.world.getEntityById(damagePacket.entityId());
|
Entity damagedEntity = mc.world.getEntityById(damagePacket.entityId());
|
||||||
if (damagedEntity == null || damagedEntity != mc.player) {
|
if (damagedEntity == null || damagedEntity != mc.player) {
|
||||||
return;
|
return;
|
||||||
@@ -45,6 +45,10 @@ public class AutoShortPearl extends Module implements RotationProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Rotation provideRotation() {
|
public Rotation provideRotation() {
|
||||||
|
if (mc.player == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.throwPending) {
|
if (this.throwPending) {
|
||||||
if (this.hitTimer.hasElapsed(this.delay.getValue()) && mc.isWindowFocused() && mc.currentScreen == null) {
|
if (this.hitTimer.hasElapsed(this.delay.getValue()) && mc.isWindowFocused() && mc.currentScreen == null) {
|
||||||
float throwPitch = 89.0F + RandomUtil.RANDOM.nextFloat() * 2.0F;
|
float throwPitch = 89.0F + RandomUtil.RANDOM.nextFloat() * 2.0F;
|
||||||
@@ -69,6 +73,7 @@ public class AutoShortPearl extends Module implements RotationProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
this.throwPending = false;
|
||||||
Prestige.silentRotationManager.removeRotationProvider(this);
|
Prestige.silentRotationManager.removeRotationProvider(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ import dev.zprestige.prestige.combat.TargetSelector;
|
|||||||
import dev.zprestige.prestige.event.PacketReceiveEvent;
|
import dev.zprestige.prestige.event.PacketReceiveEvent;
|
||||||
import dev.zprestige.prestige.event.PacketSendEvent;
|
import dev.zprestige.prestige.event.PacketSendEvent;
|
||||||
import dev.zprestige.prestige.event.FrameEvent;
|
import dev.zprestige.prestige.event.FrameEvent;
|
||||||
|
import dev.zprestige.prestige.event.GameJoinEvent;
|
||||||
import dev.zprestige.prestige.event.Render3DEvent;
|
import dev.zprestige.prestige.event.Render3DEvent;
|
||||||
import dev.zprestige.prestige.math.UiMath;
|
import dev.zprestige.prestige.math.UiMath;
|
||||||
import dev.zprestige.prestige.module.combat.AutoElytra;
|
import dev.zprestige.prestige.module.combat.AutoElytra;
|
||||||
@@ -137,6 +138,10 @@ public class FakeLag extends Module {
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onFrame(FrameEvent event) {
|
public void onFrame(FrameEvent event) {
|
||||||
this.rangeFlushed = false;
|
this.rangeFlushed = false;
|
||||||
|
if (mc.player == null || mc.world == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.mode.getValue().equals("Knockback") && this.knockbackTimer.hasElapsedRandom(this.choke)) {
|
if (this.mode.getValue().equals("Knockback") && this.knockbackTimer.hasElapsedRandom(this.choke)) {
|
||||||
this.knockbackActive = false;
|
this.knockbackActive = false;
|
||||||
this.flushPackets();
|
this.flushPackets();
|
||||||
@@ -173,7 +178,7 @@ public class FakeLag extends Module {
|
|||||||
if (this.render.getValue()) {
|
if (this.render.getValue()) {
|
||||||
StopWatch activeTimer = this.knockbackActive ? this.knockbackTimer : this.chokeTimer;
|
StopWatch activeTimer = this.knockbackActive ? this.knockbackTimer : this.chokeTimer;
|
||||||
float chokeDuration = this.mode.getValue().equals("Manual") ? 1000.0F : (this.rangeFlushed ? this.rangeChoke.getRolled() : this.choke.getRolled());
|
float chokeDuration = this.mode.getValue().equals("Manual") ? 1000.0F : (this.rangeFlushed ? this.rangeChoke.getRolled() : this.choke.getRolled());
|
||||||
if (!(activeTimer.getElapsed() / chokeDuration / 2.0F < 0.1F)) {
|
if (chokeDuration > 0.0F && !(activeTimer.getElapsed() / chokeDuration / 2.0F < 0.1F)) {
|
||||||
ShapeRenderer.drawGlowRing(event.context, event.renderer, (float)this.lastFlushPos.x, (float)this.lastFlushPos.y, (float)this.lastFlushPos.z, Math.min(0.5F, activeTimer.getElapsed() / chokeDuration / 2.0F), 0.005F, 0.1F, UiMath.withAlpha(UiMath.getAccentColor().brighter(), Math.min(1.0F, activeTimer.getElapsed() / chokeDuration)), UiMath.getAccentColor());
|
ShapeRenderer.drawGlowRing(event.context, event.renderer, (float)this.lastFlushPos.x, (float)this.lastFlushPos.y, (float)this.lastFlushPos.z, Math.min(0.5F, activeTimer.getElapsed() / chokeDuration / 2.0F), 0.005F, 0.1F, UiMath.withAlpha(UiMath.getAccentColor().brighter(), Math.min(1.0F, activeTimer.getElapsed() / chokeDuration)), UiMath.getAccentColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,17 +193,28 @@ public class FakeLag extends Module {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
this.flushPackets();
|
this.flushPackets();
|
||||||
|
// packets of an old world must never be replayed into a new one
|
||||||
|
this.heldPackets.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onGameJoin(GameJoinEvent event) {
|
||||||
|
this.heldPackets.clear();
|
||||||
|
this.knockbackActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void flushPackets() {
|
private void flushPackets() {
|
||||||
if (mc.player != null && mc.world != null) {
|
if (mc.player != null && mc.world != null) {
|
||||||
this.flushing = true;
|
this.flushing = true;
|
||||||
|
|
||||||
|
try {
|
||||||
while (mc.getNetworkHandler() != null && !this.heldPackets.isEmpty()) {
|
while (mc.getNetworkHandler() != null && !this.heldPackets.isEmpty()) {
|
||||||
PacketSender.sendPacket((Packet)this.heldPackets.poll());
|
PacketSender.sendPacket((Packet)this.heldPackets.poll());
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
this.flushing = false;
|
this.flushing = false;
|
||||||
|
}
|
||||||
|
|
||||||
this.chokeTimer.reset();
|
this.chokeTimer.reset();
|
||||||
this.choke.reroll();
|
this.choke.reroll();
|
||||||
this.lastFlushPos = PositionUtil.getPlayerPos();
|
this.lastFlushPos = PositionUtil.getPlayerPos();
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ public class FastBridge extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
|
if (mc.player == null || mc.world == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean releaseSneak = !(mc.player.getMainHandStack().getItem() instanceof BlockItem) && !(mc.player.getOffHandStack().getItem() instanceof BlockItem);
|
boolean releaseSneak = !(mc.player.getMainHandStack().getItem() instanceof BlockItem) && !(mc.player.getOffHandStack().getItem() instanceof BlockItem);
|
||||||
if (mc.player.getPitch() < 70.0F) {
|
if (mc.player.getPitch() < 70.0F) {
|
||||||
releaseSneak = true;
|
releaseSneak = true;
|
||||||
@@ -38,4 +42,12 @@ public class FastBridge extends Module {
|
|||||||
this.sneakForced = true;
|
this.sneakForced = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
if (this.sneakForced) {
|
||||||
|
mc.options.sneakKey.setPressed(false);
|
||||||
|
this.sneakForced = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ public class Freecam extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
if (mc.currentScreen == null) {
|
if (mc.player != null && mc.currentScreen == null) {
|
||||||
mc.options.forwardKey.setPressed(false);
|
mc.options.forwardKey.setPressed(false);
|
||||||
mc.options.backKey.setPressed(false);
|
mc.options.backKey.setPressed(false);
|
||||||
mc.options.leftKey.setPressed(false);
|
mc.options.leftKey.setPressed(false);
|
||||||
@@ -153,7 +153,7 @@ public class Freecam extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onRender3D(Render3DEvent event) {
|
public void onRender3D(Render3DEvent event) {
|
||||||
if (this.renderPrevious.getValue()) {
|
if (this.renderPrevious.getValue() && mc.player != null) {
|
||||||
float bodyX = (float)this.frozenPos.x;
|
float bodyX = (float)this.frozenPos.x;
|
||||||
float bodyY = (float)this.frozenPos.y;
|
float bodyY = (float)this.frozenPos.y;
|
||||||
float bodyZ = (float)this.frozenPos.z;
|
float bodyZ = (float)this.frozenPos.z;
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ public class NoJumpDelay extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
|
if (mc.player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new JumpCooldownAccessor(mc.player).setJumpingCooldown(0);
|
new JumpCooldownAccessor(mc.player).setJumpingCooldown(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ public class Parkour extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
if (mc.player.isOnGround() && !mc.options.jumpKey.isPressed()) {
|
if (mc.player != null && mc.world != null && mc.player.isOnGround() && !mc.options.jumpKey.isPressed()) {
|
||||||
if (!mc.player.isSneaking() && !mc.options.sneakKey.isPressed()) {
|
if (!mc.player.isSneaking() && !mc.options.sneakKey.isPressed()) {
|
||||||
Box edgeBox = mc.player.getBoundingBox().offset(0.0, -0.5, 0.0)
|
Box edgeBox = mc.player.getBoundingBox().offset(0.0, -0.5, 0.0)
|
||||||
.expand(-this.distance.randomInRange() / 100.0, 0.0, -this.distance.randomInRange() / 100.0);
|
.expand(-this.distance.randomInRange() / 100.0, 0.0, -this.distance.randomInRange() / 100.0);
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ public class ShortPearl extends Module implements RotationProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Rotation provideRotation() {
|
public Rotation provideRotation() {
|
||||||
|
if (mc.player == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.mode.getValue().equals("Silent")) {
|
if (!this.mode.getValue().equals("Silent")) {
|
||||||
return null;
|
return null;
|
||||||
} else if (this.silentThrowAge != -1) {
|
} else if (this.silentThrowAge != -1) {
|
||||||
@@ -73,7 +77,7 @@ public class ShortPearl extends Module implements RotationProvider {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onFrame(FrameEvent event) {
|
public void onFrame(FrameEvent event) {
|
||||||
if (this.mode.getValue().equals("Legit")) {
|
if (mc.player != null && this.mode.getValue().equals("Legit")) {
|
||||||
if (this.stageTimer.hasElapsed(this.minDelay.getValue())) {
|
if (this.stageTimer.hasElapsed(this.minDelay.getValue())) {
|
||||||
switch (this.stage) {
|
switch (this.stage) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import dev.zprestige.prestige.event.PacketReceiveEvent;
|
|||||||
import dev.zprestige.prestige.event.ClientTickEvent;
|
import dev.zprestige.prestige.event.ClientTickEvent;
|
||||||
import dev.zprestige.prestige.event.GameJoinEvent;
|
import dev.zprestige.prestige.event.GameJoinEvent;
|
||||||
import dev.zprestige.prestige.render.RandomUtil;
|
import dev.zprestige.prestige.render.RandomUtil;
|
||||||
import java.util.ArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket;
|
import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket;
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ public class Velocity extends Module {
|
|||||||
private BoolSetting ignoreExplosions;
|
private BoolSetting ignoreExplosions;
|
||||||
private RangeSetting vertical;
|
private RangeSetting vertical;
|
||||||
private RangeSetting horizontal;
|
private RangeSetting horizontal;
|
||||||
private ArrayList recentExplosions = new ArrayList();
|
private CopyOnWriteArrayList recentExplosions = new CopyOnWriteArrayList();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set getGamemodes() {
|
public Set getGamemodes() {
|
||||||
@@ -33,11 +33,9 @@ public class Velocity extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
new ArrayList<>(this.recentExplosions).forEach(explosion -> {
|
|
||||||
if (mc.player != null && mc.player.isOnGround()) {
|
if (mc.player != null && mc.player.isOnGround()) {
|
||||||
this.recentExplosions.remove(((net.minecraft.network.packet.s2c.play.ExplosionS2CPacket)explosion));
|
this.recentExplosions.clear();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -57,6 +55,10 @@ public class Velocity extends Module {
|
|||||||
if (event.getPacket() instanceof ExplosionS2CPacket explosionPacket
|
if (event.getPacket() instanceof ExplosionS2CPacket explosionPacket
|
||||||
&& explosionPacket.playerKnockback().isPresent()
|
&& explosionPacket.playerKnockback().isPresent()
|
||||||
&& explosionPacket.playerKnockback().get().lengthSquared() > 0.0) {
|
&& explosionPacket.playerKnockback().get().lengthSquared() > 0.0) {
|
||||||
|
if (this.recentExplosions.size() >= 16) {
|
||||||
|
this.recentExplosions.remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
this.recentExplosions.add(explosionPacket);
|
this.recentExplosions.add(explosionPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class WTap extends Module {
|
|||||||
public void onAttackEntity(AttackEntityEvent event) {
|
public void onAttackEntity(AttackEntityEvent event) {
|
||||||
if (!this.tapPending && !this.forwardReleased) {
|
if (!this.tapPending && !this.forwardReleased) {
|
||||||
Entity target = event.getTarget();
|
Entity target = event.getTarget();
|
||||||
if (target != null) {
|
if (target != null && mc.player != null) {
|
||||||
if (target instanceof PlayerEntity) {
|
if (target instanceof PlayerEntity) {
|
||||||
if (mc.options.forwardKey.isPressed() && mc.player.isSprinting() && RandomUtil.RANDOM.nextFloat() * 100.0F <= this.chance.getValue()) {
|
if (mc.options.forwardKey.isPressed() && mc.player.isSprinting() && RandomUtil.RANDOM.nextFloat() * 100.0F <= this.chance.getValue()) {
|
||||||
this.reaction.reroll();
|
this.reaction.reroll();
|
||||||
@@ -77,6 +77,12 @@ public class WTap extends Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
this.tapPending = false;
|
||||||
|
this.forwardReleased = false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isTapPending() {
|
public boolean isTapPending() {
|
||||||
return this.tapPending;
|
return this.tapPending;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ public class SpearMaceDoubleTap extends Module {
|
|||||||
public void onPacketReceive(PacketReceiveEvent event) {
|
public void onPacketReceive(PacketReceiveEvent event) {
|
||||||
if (event.getPacket() instanceof EntityStatusS2CPacket) {
|
if (event.getPacket() instanceof EntityStatusS2CPacket) {
|
||||||
if (((EntityStatusS2CPacket)event.getPacket()).getStatus() == 2) {
|
if (((EntityStatusS2CPacket)event.getPacket()).getStatus() == 2) {
|
||||||
|
mc.execute(() -> {
|
||||||
|
if (mc.player != null && mc.world != null) {
|
||||||
int maceSlot = this.findBestMaceSlot();
|
int maceSlot = this.findBestMaceSlot();
|
||||||
if (maceSlot != -1 && mc.player.fallDistance > this.triggerFallDistance.getValue().floatValue()) {
|
if (maceSlot != -1 && mc.player.fallDistance > this.triggerFallDistance.getValue().floatValue()) {
|
||||||
mc.player.stopUsingItem();
|
mc.player.stopUsingItem();
|
||||||
@@ -59,6 +61,8 @@ public class SpearMaceDoubleTap extends Module {
|
|||||||
this.pendingMaceHit = true;
|
this.pendingMaceHit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +112,7 @@ public class SpearMaceDoubleTap extends Module {
|
|||||||
ItemStack stack = mc.player.getInventory().getStack(slot);
|
ItemStack stack = mc.player.getInventory().getStack(slot);
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
float level = EnchantmentHelper.getLevel(
|
float level = EnchantmentHelper.getLevel(
|
||||||
mc.world.getRegistryManager().getOptional(Enchantments.BREACH.getRegistryRef()).get().getEntry(Enchantments.DENSITY.getValue()).get(), stack
|
mc.world.getRegistryManager().getOptional(Enchantments.BREACH.getRegistryRef()).get().getEntry(Enchantments.BREACH.getValue()).get(), stack
|
||||||
);
|
);
|
||||||
return (int)level;
|
return (int)level;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ public class Animations extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onRender3D(Render3DEvent event) {
|
public void onRender3D(Render3DEvent event) {
|
||||||
|
if (mc.player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HeldItemRendererAccessor heldItemRenderer = new HeldItemRendererAccessor(mc.getEntityRenderDispatcher().getHeldItemRenderer());
|
HeldItemRendererAccessor heldItemRenderer = new HeldItemRendererAccessor(mc.getEntityRenderDispatcher().getHeldItemRenderer());
|
||||||
if (heldItemRenderer.getMainHandEquipProgress() <= 1.0F) {
|
if (heldItemRenderer.getMainHandEquipProgress() <= 1.0F) {
|
||||||
heldItemRenderer.setMainHandEquipProgress(1.0F);
|
heldItemRenderer.setMainHandEquipProgress(1.0F);
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ public class AntiResourcePack extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPacketReceive(PacketReceiveEvent event) {
|
public void onPacketReceive(PacketReceiveEvent event) {
|
||||||
if (event.getPacket() instanceof ResourcePackSendS2CPacket) {
|
if (event.getPacket() instanceof ResourcePackSendS2CPacket packet) {
|
||||||
event.cancel();
|
event.cancel();
|
||||||
PacketSender.sendPacket(new ResourcePackStatusC2SPacket(mc.player.getUuid(), Status.ACCEPTED));
|
PacketSender.sendPacket(new ResourcePackStatusC2SPacket(packet.id(), Status.ACCEPTED));
|
||||||
PacketSender.sendPacket(new ResourcePackStatusC2SPacket(mc.player.getUuid(), Status.SUCCESSFULLY_LOADED));
|
PacketSender.sendPacket(new ResourcePackStatusC2SPacket(packet.id(), Status.SUCCESSFULLY_LOADED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,7 @@ public class FreeLook extends Module {
|
|||||||
public void onMouseUpdate(MouseUpdateEvent event) {
|
public void onMouseUpdate(MouseUpdateEvent event) {
|
||||||
this.cameraYaw = (float)(this.cameraYaw + event.getDeltaX() * 0.1F);
|
this.cameraYaw = (float)(this.cameraYaw + event.getDeltaX() * 0.1F);
|
||||||
this.cameraPitch = (float)(this.cameraPitch + event.getDeltaY() * 0.1F);
|
this.cameraPitch = (float)(this.cameraPitch + event.getDeltaY() * 0.1F);
|
||||||
|
this.cameraPitch = Math.max(-90.0F, Math.min(90.0F, this.cameraPitch));
|
||||||
event.cancel();
|
event.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +49,9 @@ public class FreeLook extends Module {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
if (this.previousPerspective != null) {
|
||||||
mc.options.setPerspective(this.previousPerspective);
|
mc.options.setPerspective(this.previousPerspective);
|
||||||
|
this.previousPerspective = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,9 +54,17 @@ public class HitEffect extends Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
this.particles.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onAttackEntity(AttackEntityEvent event) {
|
public void onAttackEntity(AttackEntityEvent event) {
|
||||||
Entity target = event.getTarget();
|
Entity target = event.getTarget();
|
||||||
|
if (target == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int particleIndex = 0; particleIndex < this.amount.getValue(); particleIndex++) {
|
for (int particleIndex = 0; particleIndex < this.amount.getValue(); particleIndex++) {
|
||||||
if (this.particles.size() <= this.lifespan.getValue() * 20) {
|
if (this.particles.size() <= this.lifespan.getValue() * 20) {
|
||||||
@@ -76,6 +84,12 @@ public class HitEffect extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onRender3D(Render3DEvent event) {
|
public void onRender3D(Render3DEvent event) {
|
||||||
|
if (mc.player == null || mc.world == null) {
|
||||||
|
this.particles.clear();
|
||||||
|
this.frameTimer.reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.particles.isEmpty()) {
|
if (this.particles.isEmpty()) {
|
||||||
this.frameTimer.reset();
|
this.frameTimer.reset();
|
||||||
} else {
|
} else {
|
||||||
@@ -177,8 +191,14 @@ public class HitEffect extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPacketReceive(PacketReceiveEvent event) {
|
public void onPacketReceive(PacketReceiveEvent event) {
|
||||||
|
// Packets are handled on the network thread; particles are used on the main thread.
|
||||||
if (this.totemPop.getValue()) {
|
if (this.totemPop.getValue()) {
|
||||||
if (event.getPacket() instanceof EntityStatusS2CPacket statusPacket && statusPacket.getStatus() == 35 && statusPacket.getEntity(mc.world) instanceof PlayerEntity player) {
|
if (event.getPacket() instanceof EntityStatusS2CPacket statusPacket && statusPacket.getStatus() == 35) {
|
||||||
|
mc.execute(() -> {
|
||||||
|
if (mc.world == null || !(statusPacket.getEntity(mc.world) instanceof PlayerEntity player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int particleIndex = 0; particleIndex < this.amount.getValue() * 2; particleIndex++) {
|
for (int particleIndex = 0; particleIndex < this.amount.getValue() * 2; particleIndex++) {
|
||||||
if (this.particles.size() <= this.lifespan.getValue() * 20) {
|
if (this.particles.size() <= this.lifespan.getValue() * 20) {
|
||||||
this.particles
|
this.particles
|
||||||
@@ -195,6 +215,7 @@ public class HitEffect extends Module {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,9 +69,16 @@ public class ItemESP extends Module {
|
|||||||
for (Entry entry : (Iterable<Entry>)(entries)) {
|
for (Entry entry : (Iterable<Entry>)(entries)) {
|
||||||
this.labels.put((ItemEntity)entry.getKey(), (ItemEspLabel)entry.getValue());
|
this.labels.put((ItemEntity)entry.getKey(), (ItemEspLabel)entry.getValue());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.labels = new LinkedHashMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
this.labels = new LinkedHashMap();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onRender2D(Render2DEvent event) {
|
public void onRender2D(Render2DEvent event) {
|
||||||
if (mc.world != null && mc.player != null) {
|
if (mc.world != null && mc.player != null) {
|
||||||
|
|||||||
@@ -143,9 +143,20 @@ public class NameTags extends Module {
|
|||||||
for (Entry sortedEntry : (Iterable<Entry>)(this.sortedEntries)) {
|
for (Entry sortedEntry : (Iterable<Entry>)(this.sortedEntries)) {
|
||||||
this.displayEntries.put((PlayerEntity)sortedEntry.getKey(), (dev.zprestige.prestige.combat.NameTagEntry)sortedEntry.getValue());
|
this.displayEntries.put((PlayerEntity)sortedEntry.getKey(), (dev.zprestige.prestige.combat.NameTagEntry)sortedEntry.getValue());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.entriesByPlayer.clear();
|
||||||
|
this.sortedEntries.clear();
|
||||||
|
this.displayEntries.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
this.entriesByPlayer.clear();
|
||||||
|
this.sortedEntries.clear();
|
||||||
|
this.displayEntries.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onRender2D(Render2DEvent event) {
|
public void onRender2D(Render2DEvent event) {
|
||||||
if (mc.player != null) {
|
if (mc.player != null) {
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public class OreSimulation extends Module {
|
|||||||
private RegistryKey cachedDimension;
|
private RegistryKey cachedDimension;
|
||||||
private ClientWorld cachedWorld;
|
private ClientWorld cachedWorld;
|
||||||
private Frustum frustum;
|
private Frustum frustum;
|
||||||
|
private long lastPrune;
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onRender3D(Render3DEvent event) {
|
public void onRender3D(Render3DEvent event) {
|
||||||
@@ -69,6 +70,7 @@ public class OreSimulation extends Module {
|
|||||||
int centerChunkX = mc.player.getChunkPos().x;
|
int centerChunkX = mc.player.getChunkPos().x;
|
||||||
int centerChunkZ = mc.player.getChunkPos().z;
|
int centerChunkZ = mc.player.getChunkPos().z;
|
||||||
int radius = this.chunks.getValue();
|
int radius = this.chunks.getValue();
|
||||||
|
this.pruneUnloadedChunks();
|
||||||
|
|
||||||
for (int ring = 0; ring <= radius; ring++) {
|
for (int ring = 0; ring <= radius; ring++) {
|
||||||
for (int chunkX = -ring + centerChunkX; chunkX <= ring + centerChunkX; chunkX++) {
|
for (int chunkX = -ring + centerChunkX; chunkX <= ring + centerChunkX; chunkX++) {
|
||||||
@@ -82,6 +84,23 @@ public class OreSimulation extends Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drops simulated ores of chunks that are no longer loaded so the cache cannot grow without bound.
|
||||||
|
private void pruneUnloadedChunks() {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
ClientWorld world = mc.world;
|
||||||
|
if (world == null || now - this.lastPrune < 5000L) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastPrune = now;
|
||||||
|
RegistryKey dimension = world.getRegistryKey();
|
||||||
|
this.chunkOres.keySet().removeIf(key -> {
|
||||||
|
DimensionChunkKey chunkKey = (DimensionChunkKey)key;
|
||||||
|
return !chunkKey.dimension().equals(dimension)
|
||||||
|
|| world.getChunk(ChunkPos.getPackedX(chunkKey.chunkPos()), ChunkPos.getPackedZ(chunkKey.chunkPos()), ChunkStatus.FULL, false) == null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void renderChunk(Render3DEvent event, int chunkX, int chunkZ) {
|
private void renderChunk(Render3DEvent event, int chunkX, int chunkZ) {
|
||||||
if (this.frustum == null || this.frustum.isVisible(new Box(chunkX << 4, -64.0, chunkZ << 4, (chunkX << 4) + 16, 320.0, (chunkZ << 4) + 16))) {
|
if (this.frustum == null || this.frustum.isVisible(new Box(chunkX << 4, -64.0, chunkZ << 4, (chunkX << 4) + 16, 320.0, (chunkZ << 4) + 16))) {
|
||||||
ClientWorld world = mc.world;
|
ClientWorld world = mc.world;
|
||||||
|
|||||||
@@ -69,6 +69,13 @@ public class PearlTrajectory extends Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
this.predictedPaths.clear();
|
||||||
|
this.landingMarkers.clear();
|
||||||
|
this.spawnTimes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onRender3D(Render3DEvent event) {
|
public void onRender3D(Render3DEvent event) {
|
||||||
if (mc.world != null && mc.player != null) {
|
if (mc.world != null && mc.player != null) {
|
||||||
|
|||||||
@@ -50,8 +50,16 @@ public class ShieldRenderer extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
|
if (mc.world == null) {
|
||||||
|
blockingTicks.clear();
|
||||||
|
brokenTicksRemaining.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.Set<UUID> presentIds = new java.util.HashSet<>();
|
||||||
for (PlayerEntity player : mc.world.getPlayers()) {
|
for (PlayerEntity player : mc.world.getPlayers()) {
|
||||||
UUID uuid = player.getUuid();
|
UUID uuid = player.getUuid();
|
||||||
|
presentIds.add(uuid);
|
||||||
if (player.isUsingItem() && player.getStackInHand(player.getActiveHand()).getItem() instanceof ShieldItem) {
|
if (player.isUsingItem() && player.getStackInHand(player.getActiveHand()).getItem() instanceof ShieldItem) {
|
||||||
blockingTicks.put(uuid, (Integer)blockingTicks.getOrDefault(uuid, 0) + 1);
|
blockingTicks.put(uuid, (Integer)blockingTicks.getOrDefault(uuid, 0) + 1);
|
||||||
} else {
|
} else {
|
||||||
@@ -59,6 +67,7 @@ public class ShieldRenderer extends Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blockingTicks.keySet().retainAll(presentIds);
|
||||||
brokenTicksRemaining.entrySet().removeIf(entry -> (Integer)((java.util.Map.Entry)entry).getValue() <= 1);
|
brokenTicksRemaining.entrySet().removeIf(entry -> (Integer)((java.util.Map.Entry)entry).getValue() <= 1);
|
||||||
brokenTicksRemaining.replaceAll((playerId, ticksLeft) -> ((java.lang.Integer)ticksLeft) > 1 ? ((java.lang.Integer)ticksLeft) - 1 : ((java.lang.Integer)ticksLeft));
|
brokenTicksRemaining.replaceAll((playerId, ticksLeft) -> ((java.lang.Integer)ticksLeft) > 1 ? ((java.lang.Integer)ticksLeft) - 1 : ((java.lang.Integer)ticksLeft));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class Trajectories extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onRender3D(Render3DEvent event) {
|
public void onRender3D(Render3DEvent event) {
|
||||||
if (mc.player != null) {
|
if (mc.player != null && mc.world != null) {
|
||||||
ItemStack heldStack = mc.player.getMainHandStack();
|
ItemStack heldStack = mc.player.getMainHandStack();
|
||||||
String mode = this.render.getValue().toString();
|
String mode = this.render.getValue().toString();
|
||||||
Vec3d playerPos = Render2D.getInterpolatedPos(mc.player);
|
Vec3d playerPos = Render2D.getInterpolatedPos(mc.player);
|
||||||
@@ -240,6 +240,7 @@ public class Trajectories extends Module {
|
|||||||
Vec3d renderPos = Render2D.getInterpolatedPos(mc.player);
|
Vec3d renderPos = Render2D.getInterpolatedPos(mc.player);
|
||||||
Vec3d originalPos = PositionUtil.getPlayerPos();
|
Vec3d originalPos = PositionUtil.getPlayerPos();
|
||||||
player.setPosition(renderPos.x, renderPos.y, renderPos.z);
|
player.setPosition(renderPos.x, renderPos.y, renderPos.z);
|
||||||
|
try {
|
||||||
TrajectoriesSimulatedPearl pearl = new TrajectoriesSimulatedPearl(mc.world, player, Items.ENDER_PEARL.getDefaultStack());
|
TrajectoriesSimulatedPearl pearl = new TrajectoriesSimulatedPearl(mc.world, player, Items.ENDER_PEARL.getDefaultStack());
|
||||||
pearl.setVelocity(player, this.smoothPitch, this.smoothYaw, 0.0F, 1.5F, 1.0F);
|
pearl.setVelocity(player, this.smoothPitch, this.smoothYaw, 0.0F, 1.5F, 1.0F);
|
||||||
int steps = 0;
|
int steps = 0;
|
||||||
@@ -248,8 +249,9 @@ public class Trajectories extends Module {
|
|||||||
points.add(PositionUtil.getEntityPos(pearl));
|
points.add(PositionUtil.getEntityPos(pearl));
|
||||||
pearl.tick();
|
pearl.tick();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
player.setPosition(originalPos);
|
player.setPosition(originalPos);
|
||||||
|
}
|
||||||
|
|
||||||
for (int pointIndex = 0; pointIndex < points.size() - 1; pointIndex++) {
|
for (int pointIndex = 0; pointIndex < points.size() - 1; pointIndex++) {
|
||||||
Vec3d point = (Vec3d)points.get(pointIndex);
|
Vec3d point = (Vec3d)points.get(pointIndex);
|
||||||
@@ -267,6 +269,8 @@ public class Trajectories extends Module {
|
|||||||
Vec3d originalPos = PositionUtil.getPlayerPos();
|
Vec3d originalPos = PositionUtil.getPlayerPos();
|
||||||
float originalPitch = player.getPitch();
|
float originalPitch = player.getPitch();
|
||||||
float originalYaw = player.getYaw();
|
float originalYaw = player.getYaw();
|
||||||
|
boolean hitEntity;
|
||||||
|
try {
|
||||||
player.setPosition(renderPos.x, renderPos.y, renderPos.z);
|
player.setPosition(renderPos.x, renderPos.y, renderPos.z);
|
||||||
player.setPitch(this.smoothPitch);
|
player.setPitch(this.smoothPitch);
|
||||||
player.setYaw(this.smoothYaw);
|
player.setYaw(this.smoothYaw);
|
||||||
@@ -288,15 +292,18 @@ public class Trajectories extends Module {
|
|||||||
arrow.tick();
|
arrow.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hitEntity = arrow.hitEntity;
|
||||||
|
} finally {
|
||||||
player.setPosition(originalPos);
|
player.setPosition(originalPos);
|
||||||
player.setPitch(originalPitch);
|
player.setPitch(originalPitch);
|
||||||
player.setYaw(originalYaw);
|
player.setYaw(originalYaw);
|
||||||
|
}
|
||||||
|
|
||||||
for (int pointIndex = 0; pointIndex < points.size() - 1; pointIndex++) {
|
for (int pointIndex = 0; pointIndex < points.size() - 1; pointIndex++) {
|
||||||
Vec3d point = (Vec3d)points.get(pointIndex);
|
Vec3d point = (Vec3d)points.get(pointIndex);
|
||||||
points.set(pointIndex, new Vec3d(point.x, point.y - 0.1F, point.z));
|
points.set(pointIndex, new Vec3d(point.x, point.y - 0.1F, point.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TrajectoryPath(points, arrow.hitEntity);
|
return new TrajectoryPath(points, hitEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,10 @@ public class TwoDESP extends Module {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
if (mc.world != null && mc.player != null) {
|
if (mc.world == null || mc.player == null) {
|
||||||
|
this.visibleTargets.clear();
|
||||||
|
this.animatedBoxes.clear();
|
||||||
|
} else {
|
||||||
this.visibleTargets.clear();
|
this.visibleTargets.clear();
|
||||||
int maxRange = this.maxDistance.getValue();
|
int maxRange = this.maxDistance.getValue();
|
||||||
boolean includeInvisible = this.showInvisibles.getValue();
|
boolean includeInvisible = this.showInvisibles.getValue();
|
||||||
|
|||||||
@@ -18,7 +18,16 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
public final class BlockChangeListener implements MinecraftAccess {
|
public final class BlockChangeListener implements MinecraftAccess {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPacketReceive(PacketReceiveEvent event) {
|
public void onPacketReceive(PacketReceiveEvent event) {
|
||||||
|
// Packets arrive on the netty thread; BlockChangeTracker maps are plain HashMaps read on the client thread.
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
if (mc.isOnThread()) {
|
||||||
|
handleReceive(event, now);
|
||||||
|
} else {
|
||||||
|
mc.execute(() -> handleReceive(event, now));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handleReceive(PacketReceiveEvent event, long now) {
|
||||||
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate) {
|
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate) {
|
||||||
if (blockUpdate.getState() != null && (blockUpdate.getState().isAir() || blockUpdate.getState().getBlock() == Blocks.FIRE)) {
|
if (blockUpdate.getState() != null && (blockUpdate.getState().isAir() || blockUpdate.getState().getBlock() == Blocks.FIRE)) {
|
||||||
BlockChangeTracker.markCleared(blockUpdate.getPos(), now);
|
BlockChangeTracker.markCleared(blockUpdate.getPos(), now);
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import net.minecraft.network.packet.Packet;
|
|||||||
|
|
||||||
public class PacketSender implements MinecraftAccess {
|
public class PacketSender implements MinecraftAccess {
|
||||||
public static void sendPacket(Packet packet) {
|
public static void sendPacket(Packet packet) {
|
||||||
|
if (mc.getNetworkHandler() != null) {
|
||||||
mc.getNetworkHandler().sendPacket(packet);
|
mc.getNetworkHandler().sendPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -39,7 +39,7 @@ public class SilentSlotManager implements MinecraftAccess {
|
|||||||
if (event.getPacket() instanceof PlayerInteractItemC2SPacket
|
if (event.getPacket() instanceof PlayerInteractItemC2SPacket
|
||||||
|| event.getPacket() instanceof PlayerInteractBlockC2SPacket
|
|| event.getPacket() instanceof PlayerInteractBlockC2SPacket
|
||||||
|| event.getPacket() instanceof PlayerInteractEntityC2SPacket
|
|| event.getPacket() instanceof PlayerInteractEntityC2SPacket
|
||||||
&& InventoryUtil.isSword(mc.player.getMainHandStack())) {
|
&& mc.player != null && InventoryUtil.isSword(mc.player.getMainHandStack())) {
|
||||||
this.restoreSlot();
|
this.restoreSlot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,18 +48,24 @@ public class SilentSlotManager implements MinecraftAccess {
|
|||||||
public void spoofSlot(int slot) {
|
public void spoofSlot(int slot) {
|
||||||
this.spoofedSlot = slot;
|
this.spoofedSlot = slot;
|
||||||
this.sendingOwnPacket = true;
|
this.sendingOwnPacket = true;
|
||||||
|
try {
|
||||||
PacketSender.sendPacket(new UpdateSelectedSlotC2SPacket(slot));
|
PacketSender.sendPacket(new UpdateSelectedSlotC2SPacket(slot));
|
||||||
|
} finally {
|
||||||
this.sendingOwnPacket = false;
|
this.sendingOwnPacket = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void restoreSlot() {
|
public void restoreSlot() {
|
||||||
if (this.spoofedSlot != -1) {
|
if (this.spoofedSlot != -1) {
|
||||||
this.sendingOwnPacket = true;
|
this.sendingOwnPacket = true;
|
||||||
|
try {
|
||||||
PacketSender.sendPacket(new UpdateSelectedSlotC2SPacket(InventoryUtil.getSelectedSlot()));
|
PacketSender.sendPacket(new UpdateSelectedSlotC2SPacket(InventoryUtil.getSelectedSlot()));
|
||||||
|
} finally {
|
||||||
this.sendingOwnPacket = false;
|
this.sendingOwnPacket = false;
|
||||||
this.spoofedSlot = -1;
|
this.spoofedSlot = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getSpoofedSlot() {
|
public int getSpoofedSlot() {
|
||||||
return this.spoofedSlot;
|
return this.spoofedSlot;
|
||||||
|
|||||||
@@ -27,15 +27,22 @@ public class TotemPopManager implements MinecraftAccess {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPacketReceive(PacketReceiveEvent event) {
|
public void onPacketReceive(PacketReceiveEvent event) {
|
||||||
if (event.getPacket() instanceof EntityStatusS2CPacket statusPacket && statusPacket.getStatus() == (int)TOTEM_POP_STATUS && statusPacket.getEntity(mc.world) instanceof PlayerEntity player) {
|
if (event.getPacket() instanceof EntityStatusS2CPacket statusPacket && statusPacket.getStatus() == (int)TOTEM_POP_STATUS) {
|
||||||
|
// Packets arrive on the netty thread; touch the world and pop map on the client thread only.
|
||||||
|
mc.execute(() -> {
|
||||||
|
if (mc.world != null && statusPacket.getEntity(mc.world) instanceof PlayerEntity player) {
|
||||||
int pops = this.popCounts.getOrDefault(player.getUuid(), 0);
|
int pops = this.popCounts.getOrDefault(player.getUuid(), 0);
|
||||||
this.popCounts.put(player.getUuid(), ++pops);
|
this.popCounts.put(player.getUuid(), ++pops);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onClientTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
if (!this.popCounts.isEmpty()) {
|
if (mc.world == null) {
|
||||||
|
this.popCounts.clear();
|
||||||
|
} else if (!this.popCounts.isEmpty()) {
|
||||||
this.presentPlayers.clear();
|
this.presentPlayers.clear();
|
||||||
|
|
||||||
for (PlayerEntity player : mc.world.getPlayers()) {
|
for (PlayerEntity player : mc.world.getPlayers()) {
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ public class FieldAccessor extends ReflectionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object get(Object target) {
|
public Object get(Object target) {
|
||||||
|
if (!this.isStaticField && target == null) {
|
||||||
|
throw new NullPointerException("target cannot be null for instance field " + this.field);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (UNSAFE != null) {
|
if (UNSAFE != null) {
|
||||||
return this.unsafeGet(target);
|
return this.unsafeGet(target);
|
||||||
@@ -69,6 +73,10 @@ public class FieldAccessor extends ReflectionBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void set(Object target, Object value) {
|
public void set(Object target, Object value) {
|
||||||
|
if (!this.isStaticField && target == null) {
|
||||||
|
throw new NullPointerException("target cannot be null for instance field " + this.field);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isStaticField) {
|
if (this.isStaticField) {
|
||||||
if (UNSAFE != null) {
|
if (UNSAFE != null) {
|
||||||
this.unsafeSet(null, value);
|
this.unsafeSet(null, value);
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ public final class MappedField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Object resolveTarget(Object target) {
|
private Object resolveTarget(Object target) {
|
||||||
|
if (!this.isStatic && target == null) {
|
||||||
|
throw new NullPointerException("target cannot be null for instance field " + this.field);
|
||||||
|
}
|
||||||
|
|
||||||
return this.isStatic ? this.staticBase : target;
|
return this.isStatic ? this.staticBase : target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,23 +19,22 @@ public abstract class ReflectionBase {
|
|||||||
private static final Map RESOLVED_METHODS = new ConcurrentHashMap();
|
private static final Map RESOLVED_METHODS = new ConcurrentHashMap();
|
||||||
|
|
||||||
public static AccessibleObject forceAccessible(AccessibleObject member) {
|
public static AccessibleObject forceAccessible(AccessibleObject member) {
|
||||||
if (UNSAFE == null) {
|
try {
|
||||||
member.setAccessible(true);
|
member.setAccessible(true);
|
||||||
return member;
|
return member;
|
||||||
} else {
|
} catch (Throwable accessError) {
|
||||||
|
if (UNSAFE == null) {
|
||||||
|
throw accessError;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UNSAFE.putBoolean(member, 12L, true);
|
UNSAFE.putBoolean(member, 12L, true);
|
||||||
return member;
|
|
||||||
} catch (Throwable unsafeError) {
|
|
||||||
try {
|
|
||||||
member.setAccessible(true);
|
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return member;
|
return member;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeFinalModifier(Field field) {
|
public static void removeFinalModifier(Field field) {
|
||||||
try {
|
try {
|
||||||
@@ -215,7 +214,7 @@ public abstract class ReflectionBase {
|
|||||||
|
|
||||||
char typeChar = descriptor.charAt(index);
|
char typeChar = descriptor.charAt(index);
|
||||||
if (typeChar == 'L') {
|
if (typeChar == 'L') {
|
||||||
Class elementClass = Class.forName(descriptor.substring(index + 1, descriptor.indexOf(59, index)).replace('/', '.'));
|
Class elementClass = Class.forName(descriptor.substring(index + 1, descriptor.indexOf(59, index)).replace('/', '.'), false, classLoader);
|
||||||
return toArrayType(elementClass, arrayDepth);
|
return toArrayType(elementClass, arrayDepth);
|
||||||
} else {
|
} else {
|
||||||
return toArrayType(primitiveForDescriptor(Integer.valueOf(typeChar)), arrayDepth);
|
return toArrayType(primitiveForDescriptor(Integer.valueOf(typeChar)), arrayDepth);
|
||||||
|
|||||||
Loaded 100 of 124 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user