fixed bugs, memory leaks, etc

This commit is contained in:
bbldrizzy committed 2026-10-23 08:36:42 +01:00
1 parent aa4f6b6ddc
commit c3f8f23c1d
124 files changed
+1060 -420

No files matched your search

@@ -40,6 +40,7 @@ import net.minecraft.client.gui.screen.ChatScreen;
public class Prestige implements ModInitializer {
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 FontManager fontManager;
public static ModuleManager moduleManager;
@@ -95,23 +96,31 @@ public class Prestige implements ModInitializer {
.register(
(RenderCallback)(hudRenderer, hudContext) -> {
if (!selfDestructed) {
if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
if ((MinecraftAccess.mc.currentScreen == null || MinecraftAccess.mc.currentScreen instanceof ChatScreen)
&& eventBus.hasListeners(Render2DEvent.class)) {
new Render2DEvent((hudRenderer), (hudContext)).post();
}
try {
if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
if ((MinecraftAccess.mc.currentScreen == null || MinecraftAccess.mc.currentScreen instanceof ChatScreen)
&& eventBus.hasListeners(Render2DEvent.class)) {
new Render2DEvent((hudRenderer), (hudContext)).post();
}
new FrameEvent((hudRenderer), (hudContext)).post();
ShapeRenderer.flushDrawQueue();
new FrameEvent((hudRenderer), (hudContext)).post();
ShapeRenderer.flushDrawQueue();
}
} catch (Throwable error) {
logRenderError(error);
}
}
}
);
RenderEvents.WORLD_RENDER.register((RenderCallback)(worldRenderer, worldContext) -> {
if (!selfDestructed) {
if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
Render2D.captureViewport();
new Render3DEvent((worldRenderer), (worldContext)).post();
try {
if (MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().player != null) {
Render2D.captureViewport();
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() {
return EspShaderManager.enabled || eventBus != null && eventBus.hasListeners(Render3DEvent.class);
}
@@ -29,7 +29,7 @@ public class BotFilter implements MinecraftAccess {
public void onClientTick(ClientTickEvent event) {
this.validityCache.clear();
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) {
if (mc.world == null || mc.player == null || mc.getNetworkHandler() == null) {
return 0.0;
}
long worldTime = mc.world.getTime();
if (worldTime != this.cacheTime) {
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) {
if (context == null) {
context = this.raycastContext = new RaycastContext(null, null, ShapeType.COLLIDER, FluidHandling.ANY, mc.player);
}
Box box = entity.getBoundingBox();
if (boxOffset != null) {
box = box.offset(boxOffset.x, boxOffset.y, boxOffset.z);
@@ -22,7 +22,7 @@ public class TargetTracker implements MinecraftAccess {
@Subscribe
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;
}
}
@@ -1,7 +1,9 @@
package dev.zprestige.prestige.config;
import dev.zprestige.prestige.client.Prestige;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;
import java.util.Set;
import net.minecraft.resource.InputSupplier;
@@ -33,7 +35,7 @@ public class ClasspathResourcePack implements ResourcePack {
@Override
public Set getNamespaces(ResourceType type) {
return null;
return Set.of();
}
@Nullable
@@ -61,15 +63,24 @@ public class ClasspathResourcePack implements ResourcePack {
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) {
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) {
return new Resource(new ClasspathResourcePack(), () -> Prestige.class.getClassLoader().getResourceAsStream(path));
return new Resource(new ClasspathResourcePack(), () -> openOrThrow(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
public VertexConsumer lineWidth(float width) {
return null;
return this;
}
@Override
@@ -14,7 +14,14 @@ public class ModuleStateSync {
super();
this.hudDrawn = false;
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
@@ -23,12 +30,16 @@ public class ModuleStateSync {
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
boolean enabled = module.isEnabled();
if (enabled && !module.getLastEnabled()) {
module.applyState();
}
try {
if (enabled && !module.getLastEnabled()) {
module.applyState();
}
if (!enabled && module.getLastEnabled()) {
module.applyState();
if (!enabled && module.getLastEnabled()) {
module.applyState();
}
} catch (Throwable error) {
error.printStackTrace();
}
module.setLastEnabled(enabled);
@@ -102,8 +102,12 @@ public class HudEditorScreen extends BaseScreen {
this.lastFrameTime = System.currentTimeMillis();
RenderEvents.HUD_RENDER.register((RenderCallback)(renderBatch, renderMatrices) -> {
if (MinecraftAccess.mc.currentScreen == this) {
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());
try {
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());
} 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.render(batch, matrices, matrix);
try {
hudElement.render(batch, matrices, matrix);
} catch (Throwable error) {
Prestige.logRenderError(error); // one broken element must not take down the whole HUD
}
renderedAny = true;
}
}
@@ -65,6 +65,9 @@ public class ModuleNotificationsElement extends HudElement {
}
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
@@ -186,7 +189,9 @@ public class ModuleNotificationsElement extends HudElement {
RoundedRectShader.drawRoundedRect(batch, cameraData, matrix, toastX, toastY, toastWidth, toastHeight, backgroundColor, 4.0F);
GlTextureHandle typeIcon = this.getTypeIcon(toast.type);
float iconX = rightAligned ? toastRight - 5.5F - 10.0F : toastX + 5.5F;
RoundedTextureShader.drawTexture(batch, cameraData, matrix, typeIcon, iconX, toastY + (toastHeight - 10.0F) / 2.0F, 10.0F, 10.0F, iconColor);
if (typeIcon != null) {
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 messageWidth = Prestige.fontManager.getDefaultFont().getTextWidth(toast.message) * 0.75F;
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.lastFrameTime = System.currentTimeMillis();
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;
}
@@ -99,9 +99,17 @@ public class TargetElement extends HudElement {
this.targetName = targetPlayer.getName().getString();
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.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;
if (!Float.isFinite(this.distance)) {
this.distance = 0.0F;
}
if (this.targetUuid == null || !this.targetUuid.equals(targetPlayer.getUuid())) {
this.targetUuid = targetPlayer.getUuid();
this.displayedHealth = this.health;
@@ -8,6 +8,7 @@ import dev.zprestige.prestige.ui.mc.Entry;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.ToIntBiFunction;
import net.fabricmc.loader.api.FabricLoader;
@@ -22,6 +23,8 @@ import net.minecraft.client.MinecraftClient;
*/
public final class Bootstrap {
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() {}
@@ -85,6 +88,7 @@ public final class Bootstrap {
for (byte[] helper : result.helpers().values()) Definer.define(helper);
int code = redefine.applyAsInt(type, result.target());
if (code != 0) throw new IllegalStateException("redefine returned JVMTI error " + code);
ORIGINALS.put(type, current);
report.redefined++;
report.moved += result.movedMethods();
} catch (Throwable t) {
@@ -96,6 +100,31 @@ public final class Bootstrap {
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() {
try {
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. */
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. */
public static native int redefine(Class<?> type, byte[] bytes);
}
@@ -32,22 +32,26 @@ public class KeybindManager implements MinecraftAccess {
}
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
int moduleKey = VirtualKeyMapper.toGlfwKey(module.getKey());
if (module.getKeybind().isHoldMode()) {
if (module.isEnabled() && mc.currentScreen != null) {
module.toggle();
} else if (event.getAction() == 0) {
if (module.isEnabled() && moduleKey == event.getKey()) {
try {
int moduleKey = VirtualKeyMapper.toGlfwKey(module.getKey());
if (module.getKeybind().isHoldMode()) {
if (module.isEnabled() && mc.currentScreen != null) {
module.toggle();
} else if (event.getAction() == 0) {
if (module.isEnabled() && moduleKey == event.getKey()) {
module.toggle();
}
} else if (event.getAction() == 1 && mc.currentScreen == null && !module.isEnabled() && moduleKey == event.getKey()) {
module.toggle();
}
} else if (event.getAction() == 1 && mc.currentScreen == null && !module.isEnabled() && moduleKey == event.getKey()) {
} else if (mc.currentScreen == null
&& module.getKey() != -1
&& event.getAction() == 1
&& moduleKey == event.getKey()) {
module.toggle();
}
} else if (mc.currentScreen == null
&& module.getKey() != -1
&& event.getAction() == 1
&& moduleKey == event.getKey()) {
module.toggle();
} catch (Throwable error) {
error.printStackTrace();
}
}
}
@@ -73,20 +77,24 @@ public class KeybindManager implements MinecraftAccess {
@Subscribe
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())) {
if (module.getKey() != -1
&& MOUSE_KEYCODE_TO_BUTTON.containsKey(module.getKey())
&& (Integer)MOUSE_KEYCODE_TO_BUTTON.get(module.getKey()) == event.getButton()) {
if (module.getKeybind().isHoldMode()) {
if (event.getAction() == 1 && mc.currentScreen == null && !module.isEnabled()) {
module.toggle();
} else if (event.getAction() == 0 && module.isEnabled()) {
try {
if (module.getKey() != -1
&& MOUSE_KEYCODE_TO_BUTTON.containsKey(module.getKey())
&& (Integer)MOUSE_KEYCODE_TO_BUTTON.get(module.getKey()) == event.getButton()) {
if (module.getKeybind().isHoldMode()) {
if (event.getAction() == 1 && mc.currentScreen == null && !module.isEnabled()) {
module.toggle();
} else if (event.getAction() == 0 && module.isEnabled()) {
module.toggle();
}
} else if (mc.currentScreen == null && event.getAction() == 1) {
module.toggle();
}
} else if (mc.currentScreen == null && event.getAction() == 1) {
module.toggle();
}
} catch (Throwable error) {
error.printStackTrace();
}
}
}
@@ -7,6 +7,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.PotionContentsComponent;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -210,8 +211,12 @@ public class InventoryUtil implements MinecraftAccess {
public static boolean hasEffect(ItemStack stack, RegistryEntry effect) {
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) {
found = true;
}
@@ -3,15 +3,15 @@ package dev.zprestige.prestige.math;
import dev.zprestige.prestige.client.Prestige;
import dev.zprestige.prestige.network.BlockChangeListener;
import dev.zprestige.prestige.render.MinecraftAccess;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.util.math.BlockPos;
public final class BlockChangeTracker implements MinecraftAccess {
public static final Map CLEARED_BLOCKS = new HashMap();
public static final Map EXPLOSIONS = new HashMap();
public static final Map PLACED_BLOCKS = new HashMap();
public static final Map CLEARED_BLOCKS = new ConcurrentHashMap();
public static final Map EXPLOSIONS = new ConcurrentHashMap();
public static final Map PLACED_BLOCKS = new ConcurrentHashMap();
private static boolean listenerRegistered;
private BlockChangeTracker() {
@@ -8,7 +8,7 @@ import net.minecraft.util.math.Vec3d;
public class LegacyParticlePhysics extends HitParticlePhysics {
@Override
public void updateMotion(HitParticle particle, boolean physicsEnabled) {
if (!physicsEnabled) {
if (!physicsEnabled || MinecraftAccess.mc.world == null) {
this.applyLegacyMotion(particle);
} else {
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 {
@Override
public void updateMotion(HitParticle particle, boolean physicsEnabled) {
if (!physicsEnabled) {
if (!physicsEnabled || MinecraftAccess.mc.world == null) {
this.applyPopMotion(particle);
} else {
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
)
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);
if (HookBridge.postAmbientOcclusionEvent(event)) {
cir.setReturnValue(1.0F);
@@ -18,7 +18,7 @@ public class AbstractClientPlayerEntityMixin {
cancellable = true
)
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());
if (HookBridge.postPlayerSkinEvent(event)) {
ci.setReturnValue(HookBridge.getPlayerSkinTextures(event));
@@ -19,7 +19,7 @@ public class BlockMixin {
cancellable = true
)
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());
if (HookBridge.postDrawSideEvent(event)) {
cir.setReturnValue(HookBridge.shouldDrawSide(event));
@@ -18,12 +18,15 @@ public class CameraMixin {
cancellable = true
)
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);
if (HookBridge.postCameraPosEvent(event)) {
CameraPositionEvent.applyingOverride = true;
HookBridge.setCameraPos(HookBridge.createCameraPosAccessor((Camera)(Object)this), HookBridge.getCameraPosX(event), HookBridge.getCameraPosY(event), HookBridge.getCameraPosZ(event));
CameraPositionEvent.applyingOverride = false;
try {
HookBridge.setCameraPos(HookBridge.createCameraPosAccessor((Camera)(Object)this), HookBridge.getCameraPosX(event), HookBridge.getCameraPosY(event), HookBridge.getCameraPosZ(event));
} finally {
CameraPositionEvent.applyingOverride = false;
}
ci.cancel();
}
}
@@ -39,8 +42,11 @@ public class CameraMixin {
CameraRotationEvent event = HookBridge.createCameraRotationEvent(yaw, pitch);
if (HookBridge.postCameraRotationEvent(event)) {
CameraRotationEvent.applyingOverride = true;
HookBridge.setCameraRotation(HookBridge.createCameraRotationAccessor((Camera)(Object)this), HookBridge.getCameraYaw(event), HookBridge.getCameraPitch(event));
CameraRotationEvent.applyingOverride = false;
try {
HookBridge.setCameraRotation(HookBridge.createCameraRotationAccessor((Camera)(Object)this), HookBridge.getCameraYaw(event), HookBridge.getCameraPitch(event));
} finally {
CameraRotationEvent.applyingOverride = false;
}
ci.cancel();
}
}
@@ -18,7 +18,7 @@ public class ChunkOcclusionDataBuilderMixin {
cancellable = true
)
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))) {
ci.cancel();
}
@@ -20,7 +20,7 @@ public class ClientConnectionMixin {
cancellable = true
)
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);
if (HookBridge.postPacketReceiveEvent(event)) {
ci.cancel();
@@ -34,7 +34,12 @@ public class ClientPlayNetworkHandlerMixin {
target = {@CTarget("TAIL")}
)
private void postChunkDataEventAtTail(ChunkDataS2CPacket packet, InjectionCallback info) {
if (this.world == null) {
return;
}
WorldChunk chunk = this.world.getChunk(packet.getChunkX(), packet.getChunkZ());
HookBridge.postChunkDataEvent(HookBridge.createChunkDataEvent(chunk));
if (chunk != null) {
HookBridge.postChunkDataEvent(HookBridge.createChunkDataEvent(chunk));
}
}
}
@@ -55,8 +55,8 @@ public abstract class EntityMixin {
)
private void overrideBoundingBoxAtReturn(InjectionCallback cir) {
Entity entity = (Entity)(Object)this;
if (entity != null) {
if (HookBridge.hasBoundingBoxListeners(Prestige.eventBus, BoundingBoxEvent.class)) {
if (entity != null && MinecraftClient.getInstance().player != null) {
if (Prestige.eventBus != null && HookBridge.hasBoundingBoxListeners(Prestige.eventBus, BoundingBoxEvent.class)) {
Box box = (Box)cir.getReturnValue();
BoundingBoxEvent event = HookBridge.createBoundingBoxEvent(entity, box);
if (HookBridge.postBoundingBoxEvent(event)) {
@@ -52,7 +52,7 @@ public abstract class EntityRendererMixin<T extends Entity, S extends EntityRend
cancellable = true
)
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();
if (HookBridge.postEntitySkyLightEvent(event)) {
cir.setReturnValue(15);
@@ -76,6 +76,9 @@ public abstract class EntityRendererMixin<T extends Entity, S extends EntityRend
LabelTextEvent labelTextEvent = HookBridge.createLabelTextEvent(entity, originalDisplayName);
boolean labelTextCancelled = HookBridge.postLabelTextEvent(labelTextEvent);
displayName = HookBridge.getLabelText(labelTextEvent);
if (displayName == null) {
displayName = originalDisplayName;
}
if (!labelTextCancelled) {
HealthIndicatorEvent event = HookBridge.createHealthIndicatorEvent(player, "");
if (HookBridge.postHealthIndicatorEvent(event)) {
@@ -35,7 +35,7 @@ public class FogRendererMixin {
float cloudEnd,
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);
if (HookBridge.postFogBufferEvent(event)) {
Vector4f color = HookBridge.createFogBufferColor(
@@ -66,7 +66,7 @@ public class FogRendererMixin {
cancellable = true
)
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);
if (HookBridge.postFogColorEvent(event)) {
Color fogColor = HookBridge.getFogColor(event);
@@ -101,11 +101,14 @@ public class GameRendererMixin {
Camera camera = this.client.gameRenderer.getCamera();
MatrixStack matrixStack = HookBridge.createCameraMatrixStack();
RenderSystem.getModelViewStack().pushMatrix().mul(matrixStack.peek().getPositionMatrix());
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch()));
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180.0F));
dev.zprestige.prestige.render.Render2D.modelViewMatrix.set(RenderSystem.getModelViewMatrix());
dev.zprestige.prestige.render.Render2D.cameraRotationMatrix.set(matrixStack.peek().getPositionMatrix());
RenderSystem.getModelViewStack().popMatrix();
try {
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch()));
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180.0F));
dev.zprestige.prestige.render.Render2D.modelViewMatrix.set(RenderSystem.getModelViewMatrix());
dev.zprestige.prestige.render.Render2D.cameraRotationMatrix.set(matrixStack.peek().getPositionMatrix());
} finally {
RenderSystem.getModelViewStack().popMatrix();
}
}
}
@@ -147,7 +150,7 @@ public class GameRendererMixin {
if (Prestige.eventBus != null && HookBridge.hasReachListeners(Prestige.eventBus, ReachEvent.class)) {
Entity entity2 = this.client.getCameraEntity();
if (entity2 != null) {
if (this.client.world != null) {
if (this.client.world != null && this.client.player != null) {
Profilers.get().push("pick");
this.client.targetedEntity = null;
double reach = HookBridge.getBaseReachDistance();
@@ -19,7 +19,7 @@ public abstract class HeldItemRendererMixin {
cancellable = true
)
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);
if (HookBridge.postSwingArmEvent(event)) {
matrixStack.scale(2.0F, 2.0F, 2.0F);
@@ -34,7 +34,7 @@ public class InGameHudMixin {
cancellable = true
)
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();
if (HookBridge.postCrosshairRenderEvent(event)) {
ci.cancel();
@@ -48,7 +48,7 @@ public class InGameHudMixin {
cancellable = true
)
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())) {
ci.cancel();
}
@@ -61,7 +61,7 @@ public class InGameHudMixin {
cancellable = true
)
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())) {
ci.cancel();
}
@@ -17,7 +17,7 @@ public class ItemStackMixin {
cancellable = true
)
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())) {
info.setReturnValue(0);
}
@@ -30,7 +30,7 @@ public class ItemStackMixin {
cancellable = true
)
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())) {
ci.cancel();
}
@@ -29,7 +29,7 @@ public class LightmapTextureManagerMixin {
cancellable = true
)
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();
if (HookBridge.postLightmapEvent(event)) {
RenderSystem.getDevice().createCommandEncoder().clearColorTexture(this.glTexture, ColorHelper.getArgb(255, 255, 255, 255));
@@ -43,9 +43,7 @@ public class ModelCommandRendererMixin {
target = {@CTarget("RETURN")}
)
private void clearRenderLayerAtRenderReturn() {
if (EspShaderManager.enabled) {
ESP.CURRENT_RENDER_LAYER.remove();
}
ESP.CURRENT_RENDER_LAYER.remove();
}
@CRedirect(
@@ -24,7 +24,7 @@ public class MouseMixin {
cancellable = true
)
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);
if (HookBridge.postMouseMoveEvent(event)) {
ci.cancel();
@@ -18,7 +18,7 @@ public class ParticleManagerMixin {
cancellable = true
)
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();
if (HookBridge.postAddParticleEvent(event)) {
ci.cancel();
@@ -23,7 +23,7 @@ public class PlayerListEntryMixin {
cancellable = true
)
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));
if (HookBridge.postListEntrySkinEvent(event)) {
ci.setReturnValue(HookBridge.getListEntrySkinTextures(event));
@@ -20,7 +20,7 @@ public class SkyRenderingMixin {
target = {@CTarget("TAIL")}
)
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;
Color initialSky = HookBridge.createSkyColor(skyPacked >> 16 & 0xFF, skyPacked >> 8 & 0xFF, skyPacked & 0xFF);
int hzPacked = state.sunriseAndSunsetColor;
@@ -24,7 +24,7 @@ public class TextDisplayEntityRendererMixin {
)}
)
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);
String stringText = text.getString();
ClientWorld world = MinecraftClient.getInstance().world;
@@ -22,7 +22,7 @@ public class TextVisitFactoryMixin {
private static void replaceTextBeforeVisitFormatted(CArgs cArgs) {
String text = (String)cArgs.get(0);
if (text != null) {
if (!HookBridge.hasTextReplaceListeners(Prestige.eventBus, TextReplaceEvent.class)) {
if (Prestige.eventBus == null || !HookBridge.hasTextReplaceListeners(Prestige.eventBus, TextReplaceEvent.class)) {
return;
}
@@ -23,7 +23,7 @@ public class WorldChunkMixin {
target = {@CTarget("TAIL")}
)
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()) {
BlockStateUpdateEvent event = HookBridge.createBlockUpdateEvent(pos, state);
HookBridge.postBlockUpdateEvent(event);
@@ -18,7 +18,7 @@ public class WorldMixin {
cancellable = true
)
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())) {
cir.setReturnValue(0.0F);
}
@@ -31,7 +31,7 @@ public class WorldMixin {
cancellable = true
)
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());
if (HookBridge.postTimeOfDayEvent(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.HitResult.Type;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
public class AimAssist extends Module {
@@ -170,13 +171,7 @@ public class AimAssist extends Module {
float yawDelta = targetRotation.getYaw() - mc.player.getYaw();
float pitchDelta = targetRotation.getPitch() - mc.player.getPitch();
while (yawDelta > 180.0F) {
yawDelta -= 360.0F;
}
while (yawDelta < -180.0F) {
yawDelta += 360.0F;
}
yawDelta = MathHelper.wrapDegrees(yawDelta);
if (!(this.fov.getValue() < 360.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) {
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate) {
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;
}
this.bindPlacedAnchors.remove(blockUpdate.getPos());
this.ownAnchors.remove(blockUpdate.getPos());
mc.execute(() -> {
this.bindPlacedAnchors.remove(blockUpdate.getPos());
this.ownAnchors.remove(blockUpdate.getPos());
});
}
}
}
@@ -69,7 +69,7 @@ public class AnchorPlacer extends Module implements RotationProvider {
@Subscribe
public void onPacketReceive(PacketReceiveEvent event) {
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,25 +39,37 @@ public class AntiBot extends Module {
@Subscribe
public void onPacketReceive(PacketReceiveEvent event) {
if (this.mode.isSelected("Packet") && event.getPacket() instanceof EntityPositionS2CPacket && mc.world != null) {
Entity entity = mc.world.getEntityById(((EntityPositionS2CPacket)event.getPacket()).entityId());
if (entity == null) {
return;
}
if (entity instanceof PlayerEntity player && !Prestige.botFilter.getValidatedPlayers().contains(entity)) {
int threshold = this.validationThreshold.getValue();
int packetCount = (Integer)this.positionPacketCounts.getOrDefault(player, 0) + 1;
if (packetCount >= threshold) {
Prestige.botFilter.markValidated(player);
this.positionPacketCounts.remove(player);
} else {
this.positionPacketCounts.put(player, packetCount);
if (this.mode.isSelected("Packet") && event.getPacket() instanceof EntityPositionS2CPacket) {
int entityId = ((EntityPositionS2CPacket)event.getPacket()).entityId();
mc.execute(() -> {
if (mc.world == null) {
return;
}
}
Entity entity = mc.world.getEntityById(entityId);
if (entity == null) {
return;
}
if (entity instanceof PlayerEntity player && !Prestige.botFilter.getValidatedPlayers().contains(entity)) {
int threshold = this.validationThreshold.getValue();
int packetCount = (Integer)this.positionPacketCounts.getOrDefault(player, 0) + 1;
if (packetCount >= threshold) {
Prestige.botFilter.markValidated(player);
this.positionPacketCounts.remove(player);
} else {
this.positionPacketCounts.put(player, packetCount);
}
}
});
}
}
@Override
public void onDisable() {
this.positionPacketCounts.clear();
}
@Subscribe
public void onGameJoin(GameJoinEvent event) {
this.positionPacketCounts.clear();
@@ -198,7 +198,7 @@ public class AutoAnchor extends Module implements RotationProvider {
if (event.getPacket() instanceof BlockUpdateS2CPacket blockUpdate) {
this.blockUpdateCount++;
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;
}
BlockHitResult crosshairHit = (BlockHitResult)mc.crosshairTarget;
BlockHitResult crosshairHit = mc.crosshairTarget instanceof BlockHitResult blockCrosshair ? blockCrosshair : null;
if (crosshairHit != null
&& mc.world.getBlockState(crosshairHit.getBlockPos()).isOf(Blocks.RESPAWN_ANCHOR)
&& mc.world.getBlockState(crosshairHit.getBlockPos()).get(Properties.CHARGES) != 0) {
@@ -398,7 +398,7 @@ public class SafeAnchor extends Module implements RotationProvider {
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() {
if (mc.player.currentScreenHandler != mc.player.playerScreenHandler) {
return false;
}
return switch (this.mode.getValue()) {
case "Inventory" -> mc.currentScreen instanceof InventoryScreen;
case "Keybind" -> {
@@ -32,7 +32,7 @@ public class AutoPickaxe extends Module {
@Subscribe
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();
boolean notMining = this.onlyWhenMining.getValue() && GLFW.glfwGetMouseButton(mc.getWindow().getHandle(), 0) != 1;
HitResult hitResult = mc.crosshairTarget;
@@ -31,7 +31,7 @@ public class AutoPot extends Module {
@Subscribe
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");
if (autoMode && mc.player.getHealth() > this.health.getValue()) {
this.throwTimer.reset();
@@ -14,6 +14,10 @@ public class AutoText extends Module {
@Override
public void onEnable() {
String message = this.text.getValue().toString();
if (message.length() > 256) {
message = message.substring(0, 256);
}
if (message.startsWith("/")) {
Objects.requireNonNull(mc.getNetworkHandler()).sendChatCommand(message.substring(1));
} else {
@@ -20,7 +20,7 @@ public class AutoTool extends Module {
@Subscribe
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();
if (!mc.world.getBlockState(blockPos).isAir()) {
int toolSlot = this.findBestToolSlot(blockPos);
@@ -38,7 +38,7 @@ public class CartRefill extends Module {
float delayMs = this.delay.getValue().intValue();
if (timer.hasElapsed(delayMs)) {
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()) {
int cartSlot = this.findTntMinecartSlot();
if (cartSlot != -1) {
@@ -52,6 +52,10 @@ public class CartRefill extends Module {
}
private boolean isRefillAllowed() {
if (mc.player.currentScreenHandler != mc.player.playerScreenHandler) {
return false;
}
if (this.mode.getValue().equals("Always")) {
return mc.currentScreen instanceof InventoryScreen;
} else {
@@ -32,6 +32,10 @@ public class CartStealer extends Module {
@Subscribe
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.stealTimer.hasElapsedRandom(this.delay)) {
if (mc.player.currentScreenHandler instanceof ShulkerBoxScreenHandler shulkerHandler) {
@@ -24,6 +24,10 @@ public class ChestStealer extends Module {
@Subscribe
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.stealTimer.hasElapsed(this.delay.getValue())) {
if (mc.player.currentScreenHandler instanceof GenericContainerScreenHandler containerHandler) {
@@ -71,12 +71,14 @@ public class Criticals extends Module {
if (this.pendingTarget != null) {
if (this.ticksUntilAttack <= 0) {
this.replayingAttack = true;
if (mc.crosshairTarget.getType() == Type.ENTITY) {
PlayerInteractions.attackEntity(this.pendingTarget);
try {
if (mc.player != null && mc.crosshairTarget != null && mc.crosshairTarget.getType() == Type.ENTITY) {
PlayerInteractions.attackEntity(this.pendingTarget);
}
} finally {
this.replayingAttack = false;
this.pendingTarget = null;
}
this.replayingAttack = false;
this.pendingTarget = null;
} else {
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) {
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
public void onAttackEntity(AttackEntityEvent event) {
Entity target = event.getTarget();
if (target instanceof EndCrystalEntity) {
if (target instanceof EndCrystalEntity && mc.player != null) {
if (mc.player.getStatusEffect(StatusEffects.WEAKNESS) != null) {
return;
}
@@ -44,6 +44,7 @@ public class EnemyFaker extends Module {
&& event.getPlayerName() != null
&& event.getSkinTextures() != null
&& !this.fakeName.getValue().isEmpty()
&& mc.getNetworkHandler() != null
&& mc.getNetworkHandler().getPlayerListEntry(this.target.getUuid()) != null
&& mc.getNetworkHandler().getPlayerListEntry(this.target.getUuid()).getProfile() != null) {
if (event.getPlayerName()
@@ -86,7 +87,12 @@ public class EnemyFaker extends Module {
@Subscribe
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())) {
mc.world.removeEntity(player.getId(), RemovalReason.DISCARDED);
}
@@ -96,25 +102,50 @@ public class EnemyFaker extends Module {
if (this.update.getValue()) {
this.update.setValue(false);
if (!this.fakeName.getValue().isEmpty()) {
UUID uuid = MojangApi.fetchUuid(this.fakeName.getValue().toString());
if (uuid != null) {
GameProfile profile = MojangApi.fetchProfile(uuid);
CompletableFuture skinFuture = mc.getSkinProvider().fetchSkinTextures(profile);
skinFuture.thenAccept(skinResult -> {
if (((java.util.Optional)skinResult).isPresent()) {
this.fakeSkin = (SkinTextures)((java.util.Optional)skinResult).get();
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);
}
});
}
String requestedName = this.fakeName.getValue().toString();
// Mojang lookups block for several seconds on a bad connection, never do them on the game thread
Thread lookup = new Thread(() -> {
UUID uuid = MojangApi.fetchUuid(requestedName);
GameProfile profile = uuid == null ? null : MojangApi.fetchProfile(uuid);
if (profile != null) {
mc.execute(() -> this.applyFakeSkin(profile, requestedName));
}
}, "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() {
PlayerEntity closest = null;
if (mc.world == null || mc.player == null) {
return null;
}
for (PlayerEntity player : new ArrayList<>(mc.world.getPlayers())) {
if (!player.equals(mc.player)
@@ -27,6 +27,10 @@ public class FastPlace extends Module {
@Subscribe
public void onClientTick(ClientTickEvent event) {
if (mc.player == null) {
return;
}
if (!this.blocksOnly.getValue()
|| mc.player.getMainHandStack().getItem() instanceof BlockItem
|| mc.player.getOffHandStack().getItem() instanceof BlockItem) {
@@ -26,7 +26,7 @@ public class Friends extends Module {
@Subscribe
public void onTextReplace(TextReplaceEvent event) {
if (this.highlight.getValue()) {
if (this.highlight.getValue() && event.getText() != null) {
for (Object friendName : Prestige.friendManager.getFriends()) {
if (event.getText().contains((CharSequence)friendName)) {
event.setTarget((String)friendName);
@@ -71,7 +71,9 @@ public class Friends extends Module {
if (hitResult.getType() == Type.ENTITY) {
Entity targetEntity = ((EntityHitResult)hitResult).getEntity();
if (targetEntity instanceof PlayerEntity && Prestige.friendManager.isFriend(targetEntity.getName().getString())) {
mc.player.handSwinging = false;
if (mc.player != null) {
mc.player.handSwinging = false;
}
event.cancel();
}
}
@@ -34,7 +34,7 @@ public class KeyPearl extends Module {
@Subscribe
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.pearlThrown) {
InventoryUtil.selectSlot(this.previousSlot);
@@ -32,6 +32,10 @@ public class NameHider extends Module {
@Subscribe
public void onFrame(FrameEvent event) {
if (mc.player == null) {
return;
}
if (this.randomize.getValue()) {
if (this.rerollTimer.hasElapsed(this.speed.getValue())) {
this.replacementName = this.generateName();
@@ -47,7 +51,7 @@ public class NameHider extends Module {
@Subscribe
public void onTextReplace(TextReplaceEvent event) {
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.setText(this.replacementName);
event.cancel();
@@ -56,7 +60,9 @@ public class NameHider extends Module {
@Override
public void onEnable() {
this.replacementName = this.generateName();
if (mc.player != null) {
this.replacementName = this.generateName();
}
}
private String generateName() {
@@ -54,6 +54,10 @@ public class Refill extends Module {
}
private boolean isRefillAllowed() {
if (mc.player.currentScreenHandler != mc.player.playerScreenHandler) {
return false;
}
if (this.mode.getValue().equals("Always")) {
return mc.currentScreen instanceof InventoryScreen;
} else {
@@ -2,8 +2,19 @@ package dev.zprestige.prestige.module.misc;
import dev.zprestige.prestige.Module;
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.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 SelfDestruct() {
dev.zprestige.prestige.ui.bridge.Bootstrap.pre(this);
@@ -12,18 +23,54 @@ public class SelfDestruct extends Module {
@Override
public void onEnable() {
Prestige.selfDestructed = true;
Overlay.shutdown();
mc.setScreen(null);
for (Module module : (Iterable<Module>)(Prestige.moduleManager.getModules())) {
if (module.isEnabled()) {
module.toggle();
List<Module> modules = new ArrayList<>(Prestige.moduleManager.getModules());
for (Module module : modules) {
if (module == this) {
continue;
}
try {
if (module.isEnabled()) {
module.toggle();
}
} catch (Throwable error) {
error.printStackTrace();
}
module.dispose();
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());
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
@@ -36,6 +36,11 @@ public class Teams extends Module {
@Subscribe
public void onClientTick(ClientTickEvent event) {
if (mc.world == null || mc.player == null) {
teammates = new HashSet();
return;
}
HashSet currentTeammates = new HashSet();
for (PlayerEntity player : mc.world.getPlayers()) {
@@ -25,6 +25,10 @@ public class AutoJumpReset extends Module {
@Subscribe
public void onClientTick(ClientTickEvent event) {
if (mc.player == null) {
return;
}
DamageSource damageSource = mc.player.getRecentDamageSource();
if (mc.currentScreen == null
&& !mc.player.isBlocking()
@@ -28,7 +28,7 @@ public class AutoShortPearl extends Module implements RotationProvider {
@Subscribe
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());
if (damagedEntity == null || damagedEntity != mc.player) {
return;
@@ -45,6 +45,10 @@ public class AutoShortPearl extends Module implements RotationProvider {
@Override
public Rotation provideRotation() {
if (mc.player == null) {
return null;
}
if (this.throwPending) {
if (this.hitTimer.hasElapsed(this.delay.getValue()) && mc.isWindowFocused() && mc.currentScreen == null) {
float throwPitch = 89.0F + RandomUtil.RANDOM.nextFloat() * 2.0F;
@@ -69,6 +73,7 @@ public class AutoShortPearl extends Module implements RotationProvider {
@Override
public void onDisable() {
this.throwPending = false;
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.PacketSendEvent;
import dev.zprestige.prestige.event.FrameEvent;
import dev.zprestige.prestige.event.GameJoinEvent;
import dev.zprestige.prestige.event.Render3DEvent;
import dev.zprestige.prestige.math.UiMath;
import dev.zprestige.prestige.module.combat.AutoElytra;
@@ -137,6 +138,10 @@ public class FakeLag extends Module {
@Subscribe
public void onFrame(FrameEvent event) {
this.rangeFlushed = false;
if (mc.player == null || mc.world == null) {
return;
}
if (this.mode.getValue().equals("Knockback") && this.knockbackTimer.hasElapsedRandom(this.choke)) {
this.knockbackActive = false;
this.flushPackets();
@@ -173,7 +178,7 @@ public class FakeLag extends Module {
if (this.render.getValue()) {
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());
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());
}
}
@@ -188,17 +193,28 @@ public class FakeLag extends Module {
@Override
public void onDisable() {
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() {
if (mc.player != null && mc.world != null) {
this.flushing = true;
while (mc.getNetworkHandler() != null && !this.heldPackets.isEmpty()) {
PacketSender.sendPacket((Packet)this.heldPackets.poll());
try {
while (mc.getNetworkHandler() != null && !this.heldPackets.isEmpty()) {
PacketSender.sendPacket((Packet)this.heldPackets.poll());
}
} finally {
this.flushing = false;
}
this.flushing = false;
this.chokeTimer.reset();
this.choke.reroll();
this.lastFlushPos = PositionUtil.getPlayerPos();
@@ -16,6 +16,10 @@ public class FastBridge extends Module {
@Subscribe
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);
if (mc.player.getPitch() < 70.0F) {
releaseSneak = true;
@@ -38,4 +42,12 @@ public class FastBridge extends Module {
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
public void onClientTick(ClientTickEvent event) {
if (mc.currentScreen == null) {
if (mc.player != null && mc.currentScreen == null) {
mc.options.forwardKey.setPressed(false);
mc.options.backKey.setPressed(false);
mc.options.leftKey.setPressed(false);
@@ -153,7 +153,7 @@ public class Freecam extends Module {
@Subscribe
public void onRender3D(Render3DEvent event) {
if (this.renderPrevious.getValue()) {
if (this.renderPrevious.getValue() && mc.player != null) {
float bodyX = (float)this.frozenPos.x;
float bodyY = (float)this.frozenPos.y;
float bodyZ = (float)this.frozenPos.z;
@@ -19,6 +19,10 @@ public class NoJumpDelay extends Module {
@Subscribe
public void onClientTick(ClientTickEvent event) {
if (mc.player == null) {
return;
}
new JumpCooldownAccessor(mc.player).setJumpingCooldown(0);
}
}
@@ -16,7 +16,7 @@ public class Parkour extends Module {
@Subscribe
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()) {
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);
@@ -44,6 +44,10 @@ public class ShortPearl extends Module implements RotationProvider {
@Override
public Rotation provideRotation() {
if (mc.player == null) {
return null;
}
if (!this.mode.getValue().equals("Silent")) {
return null;
} else if (this.silentThrowAge != -1) {
@@ -73,7 +77,7 @@ public class ShortPearl extends Module implements RotationProvider {
@Subscribe
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())) {
switch (this.stage) {
case 0:
@@ -11,7 +11,7 @@ import dev.zprestige.prestige.event.PacketReceiveEvent;
import dev.zprestige.prestige.event.ClientTickEvent;
import dev.zprestige.prestige.event.GameJoinEvent;
import dev.zprestige.prestige.render.RandomUtil;
import java.util.ArrayList;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.Set;
import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket;
@@ -24,7 +24,7 @@ public class Velocity extends Module {
private BoolSetting ignoreExplosions;
private RangeSetting vertical;
private RangeSetting horizontal;
private ArrayList recentExplosions = new ArrayList();
private CopyOnWriteArrayList recentExplosions = new CopyOnWriteArrayList();
@Override
public Set getGamemodes() {
@@ -33,11 +33,9 @@ public class Velocity extends Module {
@Subscribe
public void onClientTick(ClientTickEvent event) {
new ArrayList<>(this.recentExplosions).forEach(explosion -> {
if (mc.player != null && mc.player.isOnGround()) {
this.recentExplosions.remove(((net.minecraft.network.packet.s2c.play.ExplosionS2CPacket)explosion));
}
});
if (mc.player != null && mc.player.isOnGround()) {
this.recentExplosions.clear();
}
}
@Subscribe
@@ -57,6 +55,10 @@ public class Velocity extends Module {
if (event.getPacket() instanceof ExplosionS2CPacket explosionPacket
&& explosionPacket.playerKnockback().isPresent()
&& explosionPacket.playerKnockback().get().lengthSquared() > 0.0) {
if (this.recentExplosions.size() >= 16) {
this.recentExplosions.remove(0);
}
this.recentExplosions.add(explosionPacket);
}
}
@@ -37,7 +37,7 @@ public class WTap extends Module {
public void onAttackEntity(AttackEntityEvent event) {
if (!this.tapPending && !this.forwardReleased) {
Entity target = event.getTarget();
if (target != null) {
if (target != null && mc.player != null) {
if (target instanceof PlayerEntity) {
if (mc.options.forwardKey.isPressed() && mc.player.isSprinting() && RandomUtil.RANDOM.nextFloat() * 100.0F <= this.chance.getValue()) {
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() {
return this.tapPending;
}
@@ -51,13 +51,17 @@ public class SpearMaceDoubleTap extends Module {
public void onPacketReceive(PacketReceiveEvent event) {
if (event.getPacket() instanceof EntityStatusS2CPacket) {
if (((EntityStatusS2CPacket)event.getPacket()).getStatus() == 2) {
int maceSlot = this.findBestMaceSlot();
if (maceSlot != -1 && mc.player.fallDistance > this.triggerFallDistance.getValue().floatValue()) {
mc.player.stopUsingItem();
InventoryUtil.selectSlot(maceSlot);
this.maceSwapTimer.reset();
this.pendingMaceHit = true;
}
mc.execute(() -> {
if (mc.player != null && mc.world != null) {
int maceSlot = this.findBestMaceSlot();
if (maceSlot != -1 && mc.player.fallDistance > this.triggerFallDistance.getValue().floatValue()) {
mc.player.stopUsingItem();
InventoryUtil.selectSlot(maceSlot);
this.maceSwapTimer.reset();
this.pendingMaceHit = true;
}
}
});
}
}
}
@@ -108,7 +112,7 @@ public class SpearMaceDoubleTap extends Module {
ItemStack stack = mc.player.getInventory().getStack(slot);
if (stack != null) {
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;
} else {
@@ -25,6 +25,10 @@ public class Animations extends Module {
@Subscribe
public void onRender3D(Render3DEvent event) {
if (mc.player == null) {
return;
}
HeldItemRendererAccessor heldItemRenderer = new HeldItemRendererAccessor(mc.getEntityRenderDispatcher().getHeldItemRenderer());
if (heldItemRenderer.getMainHandEquipProgress() <= 1.0F) {
heldItemRenderer.setMainHandEquipProgress(1.0F);
@@ -15,10 +15,10 @@ public class AntiResourcePack extends Module {
@Subscribe
public void onPacketReceive(PacketReceiveEvent event) {
if (event.getPacket() instanceof ResourcePackSendS2CPacket) {
if (event.getPacket() instanceof ResourcePackSendS2CPacket packet) {
event.cancel();
PacketSender.sendPacket(new ResourcePackStatusC2SPacket(mc.player.getUuid(), Status.ACCEPTED));
PacketSender.sendPacket(new ResourcePackStatusC2SPacket(mc.player.getUuid(), Status.SUCCESSFULLY_LOADED));
PacketSender.sendPacket(new ResourcePackStatusC2SPacket(packet.id(), Status.ACCEPTED));
PacketSender.sendPacket(new ResourcePackStatusC2SPacket(packet.id(), Status.SUCCESSFULLY_LOADED));
}
}
}
@@ -26,6 +26,7 @@ public class FreeLook extends Module {
public void onMouseUpdate(MouseUpdateEvent event) {
this.cameraYaw = (float)(this.cameraYaw + event.getDeltaX() * 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();
}
@@ -48,6 +49,9 @@ public class FreeLook extends Module {
@Override
public void onDisable() {
mc.options.setPerspective(this.previousPerspective);
if (this.previousPerspective != null) {
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
public void onAttackEntity(AttackEntityEvent event) {
Entity target = event.getTarget();
if (target == null) {
return;
}
for (int particleIndex = 0; particleIndex < this.amount.getValue(); particleIndex++) {
if (this.particles.size() <= this.lifespan.getValue() * 20) {
@@ -76,6 +84,12 @@ public class HitEffect extends Module {
@Subscribe
public void onRender3D(Render3DEvent event) {
if (mc.player == null || mc.world == null) {
this.particles.clear();
this.frameTimer.reset();
return;
}
if (this.particles.isEmpty()) {
this.frameTimer.reset();
} else {
@@ -177,24 +191,31 @@ public class HitEffect extends Module {
@Subscribe
public void onPacketReceive(PacketReceiveEvent event) {
// Packets are handled on the network thread; particles are used on the main thread.
if (this.totemPop.getValue()) {
if (event.getPacket() instanceof EntityStatusS2CPacket statusPacket && statusPacket.getStatus() == 35 && statusPacket.getEntity(mc.world) instanceof PlayerEntity player) {
for (int particleIndex = 0; particleIndex < this.amount.getValue() * 2; particleIndex++) {
if (this.particles.size() <= this.lifespan.getValue() * 20) {
this.particles
.add(
new HitParticle(
PositionUtil.getEntityPos(player),
new Vec3d(
player.getX() + (Math.random() - 0.5) * 0.5,
player.getY() + Math.random() * 1.0 + 0.5,
player.getZ() + (Math.random() - 0.5) * 0.5
),
AnimationMode.POP
)
);
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++) {
if (this.particles.size() <= this.lifespan.getValue() * 20) {
this.particles
.add(
new HitParticle(
PositionUtil.getEntityPos(player),
new Vec3d(
player.getX() + (Math.random() - 0.5) * 0.5,
player.getY() + Math.random() * 1.0 + 0.5,
player.getZ() + (Math.random() - 0.5) * 0.5
),
AnimationMode.POP
)
);
}
}
});
}
}
}
@@ -69,9 +69,16 @@ public class ItemESP extends Module {
for (Entry entry : (Iterable<Entry>)(entries)) {
this.labels.put((ItemEntity)entry.getKey(), (ItemEspLabel)entry.getValue());
}
} else {
this.labels = new LinkedHashMap();
}
}
@Override
public void onDisable() {
this.labels = new LinkedHashMap();
}
@Subscribe
public void onRender2D(Render2DEvent event) {
if (mc.world != null && mc.player != null) {
@@ -143,9 +143,20 @@ public class NameTags extends Module {
for (Entry sortedEntry : (Iterable<Entry>)(this.sortedEntries)) {
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
public void onRender2D(Render2DEvent event) {
if (mc.player != null) {
@@ -62,6 +62,7 @@ public class OreSimulation extends Module {
private RegistryKey cachedDimension;
private ClientWorld cachedWorld;
private Frustum frustum;
private long lastPrune;
@Subscribe
public void onRender3D(Render3DEvent event) {
@@ -69,6 +70,7 @@ public class OreSimulation extends Module {
int centerChunkX = mc.player.getChunkPos().x;
int centerChunkZ = mc.player.getChunkPos().z;
int radius = this.chunks.getValue();
this.pruneUnloadedChunks();
for (int ring = 0; ring <= radius; ring++) {
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) {
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;
@@ -69,6 +69,13 @@ public class PearlTrajectory extends Module {
}
}
@Override
public void onDisable() {
this.predictedPaths.clear();
this.landingMarkers.clear();
this.spawnTimes.clear();
}
@Subscribe
public void onRender3D(Render3DEvent event) {
if (mc.world != null && mc.player != null) {
@@ -50,8 +50,16 @@ public class ShieldRenderer extends Module {
@Subscribe
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()) {
UUID uuid = player.getUuid();
presentIds.add(uuid);
if (player.isUsingItem() && player.getStackInHand(player.getActiveHand()).getItem() instanceof ShieldItem) {
blockingTicks.put(uuid, (Integer)blockingTicks.getOrDefault(uuid, 0) + 1);
} 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.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
public void onRender3D(Render3DEvent event) {
if (mc.player != null) {
if (mc.player != null && mc.world != null) {
ItemStack heldStack = mc.player.getMainHandStack();
String mode = this.render.getValue().toString();
Vec3d playerPos = Render2D.getInterpolatedPos(mc.player);
@@ -240,17 +240,19 @@ public class Trajectories extends Module {
Vec3d renderPos = Render2D.getInterpolatedPos(mc.player);
Vec3d originalPos = PositionUtil.getPlayerPos();
player.setPosition(renderPos.x, renderPos.y, renderPos.z);
TrajectoriesSimulatedPearl pearl = new TrajectoriesSimulatedPearl(mc.world, player, Items.ENDER_PEARL.getDefaultStack());
pearl.setVelocity(player, this.smoothPitch, this.smoothYaw, 0.0F, 1.5F, 1.0F);
int steps = 0;
try {
TrajectoriesSimulatedPearl pearl = new TrajectoriesSimulatedPearl(mc.world, player, Items.ENDER_PEARL.getDefaultStack());
pearl.setVelocity(player, this.smoothPitch, this.smoothYaw, 0.0F, 1.5F, 1.0F);
int steps = 0;
while (!pearl.landed && steps++ < 1000) {
points.add(PositionUtil.getEntityPos(pearl));
pearl.tick();
while (!pearl.landed && steps++ < 1000) {
points.add(PositionUtil.getEntityPos(pearl));
pearl.tick();
}
} finally {
player.setPosition(originalPos);
}
player.setPosition(originalPos);
for (int pointIndex = 0; pointIndex < points.size() - 1; pointIndex++) {
Vec3d point = (Vec3d)points.get(pointIndex);
points.set(pointIndex, new Vec3d(point.x, point.y - 0.1F, point.z));
@@ -267,36 +269,41 @@ public class Trajectories extends Module {
Vec3d originalPos = PositionUtil.getPlayerPos();
float originalPitch = player.getPitch();
float originalYaw = player.getYaw();
player.setPosition(renderPos.x, renderPos.y, renderPos.z);
player.setPitch(this.smoothPitch);
player.setYaw(this.smoothYaw);
dev.zprestige.prestige.world.SimulatedBowArrow arrow = new dev.zprestige.prestige.world.SimulatedBowArrow(EntityType.ARROW, player, mc.world, arrowStack);
if (weapon instanceof CrossbowItem) {
Vec3d axis = player.getOppositeRotationVector(1.0F);
Quaternionf rotation = new Quaternionf().setAngleAxis((double)(angleOffset * (float) (Math.PI / 180.0)), axis.x, axis.y, axis.z);
Vector3f direction = player.getRotationVec(1.0F).toVector3f().rotate(rotation);
arrow.setVelocity(direction.x(), direction.y(), direction.z(), 3.15F, 1.0F);
} else {
arrow.setVelocity(player, this.smoothPitch, this.smoothYaw, 0.0F, BowItem.getPullProgress(mc.player.getItemUseTime()) * 3.0F, 1.0F);
boolean hitEntity;
try {
player.setPosition(renderPos.x, renderPos.y, renderPos.z);
player.setPitch(this.smoothPitch);
player.setYaw(this.smoothYaw);
dev.zprestige.prestige.world.SimulatedBowArrow arrow = new dev.zprestige.prestige.world.SimulatedBowArrow(EntityType.ARROW, player, mc.world, arrowStack);
if (weapon instanceof CrossbowItem) {
Vec3d axis = player.getOppositeRotationVector(1.0F);
Quaternionf rotation = new Quaternionf().setAngleAxis((double)(angleOffset * (float) (Math.PI / 180.0)), axis.x, axis.y, axis.z);
Vector3f direction = player.getRotationVec(1.0F).toVector3f().rotate(rotation);
arrow.setVelocity(direction.x(), direction.y(), direction.z(), 3.15F, 1.0F);
} else {
arrow.setVelocity(player, this.smoothPitch, this.smoothYaw, 0.0F, BowItem.getPullProgress(mc.player.getItemUseTime()) * 3.0F, 1.0F);
}
arrow.inFlight = true;
int steps = 0;
while (arrow.inFlight && steps++ < 1000) {
points.add(PositionUtil.getEntityPos(arrow));
arrow.tick();
}
hitEntity = arrow.hitEntity;
} finally {
player.setPosition(originalPos);
player.setPitch(originalPitch);
player.setYaw(originalYaw);
}
arrow.inFlight = true;
int steps = 0;
while (arrow.inFlight && steps++ < 1000) {
points.add(PositionUtil.getEntityPos(arrow));
arrow.tick();
}
player.setPosition(originalPos);
player.setPitch(originalPitch);
player.setYaw(originalYaw);
for (int pointIndex = 0; pointIndex < points.size() - 1; pointIndex++) {
Vec3d point = (Vec3d)points.get(pointIndex);
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
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();
int maxRange = this.maxDistance.getValue();
boolean includeInvisible = this.showInvisibles.getValue();
@@ -18,7 +18,16 @@ import net.minecraft.util.math.Vec3d;
public final class BlockChangeListener implements MinecraftAccess {
@Subscribe
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();
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 (blockUpdate.getState() != null && (blockUpdate.getState().isAir() || blockUpdate.getState().getBlock() == Blocks.FIRE)) {
BlockChangeTracker.markCleared(blockUpdate.getPos(), now);
@@ -5,6 +5,8 @@ import net.minecraft.network.packet.Packet;
public class PacketSender implements MinecraftAccess {
public static void sendPacket(Packet packet) {
mc.getNetworkHandler().sendPacket(packet);
if (mc.getNetworkHandler() != null) {
mc.getNetworkHandler().sendPacket(packet);
}
}
}
@@ -39,7 +39,7 @@ public class SilentSlotManager implements MinecraftAccess {
if (event.getPacket() instanceof PlayerInteractItemC2SPacket
|| event.getPacket() instanceof PlayerInteractBlockC2SPacket
|| event.getPacket() instanceof PlayerInteractEntityC2SPacket
&& InventoryUtil.isSword(mc.player.getMainHandStack())) {
&& mc.player != null && InventoryUtil.isSword(mc.player.getMainHandStack())) {
this.restoreSlot();
}
}
@@ -48,16 +48,22 @@ public class SilentSlotManager implements MinecraftAccess {
public void spoofSlot(int slot) {
this.spoofedSlot = slot;
this.sendingOwnPacket = true;
PacketSender.sendPacket(new UpdateSelectedSlotC2SPacket(slot));
this.sendingOwnPacket = false;
try {
PacketSender.sendPacket(new UpdateSelectedSlotC2SPacket(slot));
} finally {
this.sendingOwnPacket = false;
}
}
public void restoreSlot() {
if (this.spoofedSlot != -1) {
this.sendingOwnPacket = true;
PacketSender.sendPacket(new UpdateSelectedSlotC2SPacket(InventoryUtil.getSelectedSlot()));
this.sendingOwnPacket = false;
this.spoofedSlot = -1;
try {
PacketSender.sendPacket(new UpdateSelectedSlotC2SPacket(InventoryUtil.getSelectedSlot()));
} finally {
this.sendingOwnPacket = false;
this.spoofedSlot = -1;
}
}
}
@@ -27,15 +27,22 @@ public class TotemPopManager implements MinecraftAccess {
@Subscribe
public void onPacketReceive(PacketReceiveEvent event) {
if (event.getPacket() instanceof EntityStatusS2CPacket statusPacket && statusPacket.getStatus() == (int)TOTEM_POP_STATUS && statusPacket.getEntity(mc.world) instanceof PlayerEntity player) {
int pops = this.popCounts.getOrDefault(player.getUuid(), 0);
this.popCounts.put(player.getUuid(), ++pops);
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);
this.popCounts.put(player.getUuid(), ++pops);
}
});
}
}
@Subscribe
public void onClientTick(ClientTickEvent event) {
if (!this.popCounts.isEmpty()) {
if (mc.world == null) {
this.popCounts.clear();
} else if (!this.popCounts.isEmpty()) {
this.presentPlayers.clear();
for (PlayerEntity player : mc.world.getPlayers()) {
@@ -55,6 +55,10 @@ public class FieldAccessor extends ReflectionBase {
}
public Object get(Object target) {
if (!this.isStaticField && target == null) {
throw new NullPointerException("target cannot be null for instance field " + this.field);
}
try {
if (UNSAFE != null) {
return this.unsafeGet(target);
@@ -69,6 +73,10 @@ public class FieldAccessor extends ReflectionBase {
}
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 (UNSAFE != null) {
this.unsafeSet(null, value);
@@ -42,6 +42,10 @@ public final class MappedField {
}
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;
}
@@ -19,21 +19,20 @@ public abstract class ReflectionBase {
private static final Map RESOLVED_METHODS = new ConcurrentHashMap();
public static AccessibleObject forceAccessible(AccessibleObject member) {
if (UNSAFE == null) {
try {
member.setAccessible(true);
return member;
} else {
} catch (Throwable accessError) {
if (UNSAFE == null) {
throw accessError;
}
try {
UNSAFE.putBoolean(member, 12L, true);
return member;
} catch (Throwable unsafeError) {
try {
member.setAccessible(true);
} catch (Throwable ignored) {
}
return member;
} catch (Throwable ignored) {
}
return member;
}
}
@@ -215,7 +214,7 @@ public abstract class ReflectionBase {
char typeChar = descriptor.charAt(index);
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);
} else {
return toArrayType(primitiveForDescriptor(Integer.valueOf(typeChar)), arrayDepth);
@@ -10,8 +10,11 @@ import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Stream;
import org.lwjgl.opengl.ARBVertexArrayObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BufferSource {
private static final Logger LOGGER = LoggerFactory.getLogger(BufferSource.class);
private final WeakHashMap buffersByMode = new WeakHashMap();
private final Set pendingModes = new LinkedHashSet();
public static final boolean ASSERTIONS_DISABLED = !BufferSource.class.desiredAssertionStatus();
@@ -53,6 +56,8 @@ public class BufferSource {
MappedMeshBuilder builder = (MappedMeshBuilder)bufferData.activeBuilder().get();
if (!ASSERTIONS_DISABLED && builder == null) {
throw new AssertionError(MISSING_BUILDER_MESSAGE);
} else if (builder == null) {
return;
} else {
int indexCount = builder.getIndexCount();
int vertexCount = builder.getVertexCount();
@@ -66,11 +71,18 @@ public class BufferSource {
}
public void flush(CameraMatrices context) {
for (DrawPipeline drawMode : (Iterable<DrawPipeline>)(this.pendingModes)) {
this.draw(context, drawMode);
try {
for (DrawPipeline drawMode : (Iterable<DrawPipeline>)(this.pendingModes)) {
try {
this.draw(context, drawMode);
} catch (Throwable throwable) {
LOGGER.error("Failed to draw buffered pipeline", throwable);
}
}
} finally {
this.pendingModes.clear();
}
this.pendingModes.clear();
this.buffersByMode.size();
}
@@ -16,6 +16,7 @@ public class DrawCommandQueue {
private boolean initialized = false;
private final List commands = new ArrayList();
public float nextDepth = 0.0F;
private static final int MAX_QUEUED_COMMANDS = 200000;
private void ensureInitialized() {
if (!this.initialized) {
@@ -29,6 +30,10 @@ public class DrawCommandQueue {
}
public void enqueue(DrawCommand command) {
if (this.commands.size() >= MAX_QUEUED_COMMANDS) {
this.clear();
}
this.commands.add(new QueuedDraw(command, this.nextDepth));
this.nextDepth = Math.nextUp(this.nextDepth);
}
@@ -37,60 +42,69 @@ public class DrawCommandQueue {
if (this.commands.isEmpty()) {
this.nextDepth = 0.0F;
} else {
this.ensureInitialized();
int batchStart = 0;
boolean scissorEnabled = false;
try {
this.ensureInitialized();
int batchStart = 0;
while (batchStart < this.commands.size()) {
DrawBatchKey key = ((QueuedDraw)this.commands.get(batchStart)).drawable().getBatchKey();
int batchEnd = batchStart + 1;
while (batchStart < this.commands.size()) {
DrawBatchKey key = ((QueuedDraw)this.commands.get(batchStart)).drawable().getBatchKey();
int batchEnd = batchStart + 1;
while (batchEnd < this.commands.size() && ((QueuedDraw)this.commands.get(batchEnd)).drawable().getBatchKey().equals(key)) {
batchEnd++;
}
List batch = this.commands.subList(batchStart, batchEnd);
Vector4f scissor = key.scissorRect();
if (scissor != null) {
GL11.glEnable(3089);
int framebufferHeight = RenderCore.getFramebufferHeight();
float scale = RenderCore.getScaleFactor();
GL11.glScissor((int)(scissor.x * scale), (int)(framebufferHeight - scissor.y * scale - scissor.w * scale), (int)(scissor.z * scale), (int)(scissor.w * scale));
}
DrawPipeline pipeline = key.drawMode();
this.vertexArray
.setBindings(VertexArray.createBindings(this.vertexBuffer, pipeline.getVertexFormat()));
MappedMeshBuilder builder = new MappedMeshBuilder(pipeline.getVertexFormat(), this.vertexBuffer, this.indexBuffer);
int indexCount;
int vertexCount;
try {
for (QueuedDraw entry : (Iterable<QueuedDraw>)(batch)) {
entry.drawable().emitVertices(builder, entry.depth());
while (batchEnd < this.commands.size() && ((QueuedDraw)this.commands.get(batchEnd)).drawable().getBatchKey().equals(key)) {
batchEnd++;
}
vertexCount = builder.getVertexCount();
indexCount = builder.getIndexCount();
} catch (Throwable failure) {
List batch = this.commands.subList(batchStart, batchEnd);
Vector4f scissor = key.scissorRect();
if (scissor != null) {
GL11.glEnable(3089);
scissorEnabled = true;
int framebufferHeight = RenderCore.getFramebufferHeight();
float scale = RenderCore.getScaleFactor();
GL11.glScissor((int)(scissor.x * scale), (int)(framebufferHeight - scissor.y * scale - scissor.w * scale), (int)(scissor.z * scale), (int)(scissor.w * scale));
}
DrawPipeline pipeline = key.drawMode();
this.vertexArray
.setBindings(VertexArray.createBindings(this.vertexBuffer, pipeline.getVertexFormat()));
MappedMeshBuilder builder = new MappedMeshBuilder(pipeline.getVertexFormat(), this.vertexBuffer, this.indexBuffer);
int indexCount;
int vertexCount;
try {
builder.close();
} catch (Throwable closeFailure) {
failure.addSuppressed(closeFailure);
for (QueuedDraw entry : (Iterable<QueuedDraw>)(batch)) {
entry.drawable().emitVertices(builder, entry.depth());
}
vertexCount = builder.getVertexCount();
indexCount = builder.getIndexCount();
} catch (Throwable failure) {
try {
builder.close();
} catch (Throwable closeFailure) {
failure.addSuppressed(closeFailure);
}
throw failure;
}
throw failure;
}
builder.close();
pipeline.draw(context, this.vertexArray, this.indexBuffer, new MeshInfo(pipeline.getVertexFormat(), vertexCount, indexCount));
if (scissor != null) {
GL11.glDisable(3089);
scissorEnabled = false;
}
builder.close();
pipeline.draw(context, this.vertexArray, this.indexBuffer, new MeshInfo(pipeline.getVertexFormat(), vertexCount, indexCount));
if (scissor != null) {
batchStart = batchEnd;
}
} finally {
if (scissorEnabled) {
GL11.glDisable(3089);
}
batchStart = batchEnd;
this.clear();
}
this.clear();
}
}
@@ -49,17 +49,19 @@ public class DrawPipeline {
}
GlRenderPass pass = passBuilder.build();
pass.begin();
pass.uploadMatrices(context);
try {
pass.begin();
pass.uploadMatrices(context);
for (RenderStateElement applyState : this.states) {
applyState.apply(pass);
}
for (RenderStateElement applyState : this.states) {
applyState.apply(pass);
}
pass.drawIndexed(vertexArray, indexBuffer, this.primitiveMode, drawInfo.indexCount());
for (RenderStateElement cleanupState : this.states) {
cleanupState.cleanup();
pass.drawIndexed(vertexArray, indexBuffer, this.primitiveMode, drawInfo.indexCount());
} finally {
for (RenderStateElement cleanupState : this.states) {
cleanupState.cleanup();
}
}
}
}
@@ -56,7 +56,7 @@ public class EspShaderManager implements MinecraftAccess {
}
break;
} else {
entity = type.create(mc.world, null);
entity = createEntity(type);
if (entity != null) {
discardAfter = true;
break;
@@ -82,6 +82,14 @@ public class EspShaderManager implements MinecraftAccess {
}
}
private static Entity createEntity(EntityType type) {
try {
return type.create(mc.world, null);
} catch (Throwable ignored) {
return null;
}
}
private static Class getRendererModelClass(EntityRenderer renderer) {
Class rendererClass = renderer.getClass();
Class cached = (Class)rendererModelCache.get(rendererClass);
@@ -139,7 +147,7 @@ public class EspShaderManager implements MinecraftAccess {
}
break;
} else {
entity = type.create(mc.world, null);
entity = createEntity(type);
if (entity != null) {
discardAfter = true;
break;
Loaded 100 of 124 files, more files were not shown because too many files have changed in this diff. Show more