| 1 | /*
|
| 2 | * This file is part of the Combatant Client distribution.
|
| 3 | * Copyright (c) 2026 pivosos2007.
|
| 4 | *
|
| 5 | * Licensed under the GNU General Public License v3.0.
|
| 6 | */
|
| 7 |
|
| 8 | package combatant.client.features.module.modules.visuals;
|
| 9 |
|
| 10 |
|
| 11 | import com.mojang.blaze3d.GpuFormat;
|
| 12 | import com.mojang.blaze3d.ProjectionType;
|
| 13 | import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
| 14 | import com.mojang.blaze3d.pipeline.RenderTarget;
|
| 15 | import com.mojang.blaze3d.pipeline.TextureTarget;
|
| 16 | import com.mojang.blaze3d.systems.RenderSystem;
|
| 17 | import com.mojang.blaze3d.textures.AddressMode;
|
| 18 | import com.mojang.blaze3d.textures.FilterMode;
|
| 19 | import com.mojang.blaze3d.textures.GpuSampler;
|
| 20 | import com.mojang.blaze3d.textures.GpuTextureView;
|
| 21 | import com.mojang.blaze3d.vertex.PoseStack;
|
| 22 | import combatant.client.config.values.*;
|
| 23 | import combatant.client.features.gui.hud.HudRenderSpace;
|
| 24 | import combatant.client.features.module.*;
|
| 25 | import combatant.client.features.module.Module;
|
| 26 | import net.minecraft.client.Minecraft;
|
| 27 | import net.minecraft.client.renderer.LevelRenderer;
|
| 28 | import net.minecraft.client.renderer.ProjectionMatrixBuffer;
|
| 29 | import net.minecraft.client.renderer.RenderBuffers;
|
| 30 | import net.minecraft.client.renderer.SubmitNodeStorage;
|
| 31 | import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
| 32 | import net.minecraft.client.renderer.entity.EntityRenderer;
|
| 33 | import net.minecraft.client.renderer.entity.state.EntityRenderState;
|
| 34 | import net.minecraft.client.renderer.feature.FeatureRenderDispatcher;
|
| 35 | import net.minecraft.client.renderer.state.level.LevelRenderState;
|
| 36 | import net.minecraft.core.registries.BuiltInRegistries;
|
| 37 | import net.minecraft.resources.Identifier;
|
| 38 | import net.minecraft.world.entity.Entity;
|
| 39 | import net.minecraft.world.entity.LivingEntity;
|
| 40 | import net.minecraft.world.entity.player.Player;
|
| 41 | import net.minecraft.world.phys.AABB;
|
| 42 | import net.minecraft.world.phys.Vec3;
|
| 43 | import org.joml.Matrix4f;
|
| 44 | import org.joml.Quaternionf;
|
| 45 | import combatant.client.config.common.CommonSettingSchemas;
|
| 46 | import combatant.client.features.gui.clickgui.settings.TextListSetting;
|
| 47 | import combatant.client.features.module.modules.combat.Hitbox;
|
| 48 | import combatant.client.features.relations.CategoryService;
|
| 49 | import combatant.client.features.relations.CategoryType;
|
| 50 | import combatant.client.mixins.accessors.EntityRenderManagerAccessor;
|
| 51 | import combatant.client.mixins.accessors.EntityRendererAccessor;
|
| 52 | import combatant.client.mixins.accessors.LevelRendererAccessor;
|
| 53 | import combatant.client.render.ShaderEspRenderContext;
|
| 54 | import combatant.client.render.compat.EntityCullingCompat;
|
| 55 | import combatant.client.render.engine.RenderState;
|
| 56 | import combatant.client.render.engine.animation.AnimationUtility;
|
| 57 | import combatant.client.render.engine.animation.AnimatedRenderColors;
|
| 58 | import combatant.client.render.engine.core.CombatantWorldMatrices;
|
| 59 | import combatant.client.render.engine.core.CombatantRenderSystem;
|
| 60 | import combatant.client.render.engine.pipeline.CombatantRenderPipelines;
|
| 61 | import combatant.client.render.engine.postprocess.PostProcessManager;
|
| 62 | import combatant.client.render.engine.postprocess.PostProcessExecutionContext;
|
| 63 | import combatant.client.render.engine.postprocess.PostProcessPass;
|
| 64 | import combatant.client.render.engine.postprocess.PostProcessBackendResourceOwner;
|
| 65 | import combatant.client.render.engine.postprocess.SeparableMaskBlurComputeBackend;
|
| 66 | import combatant.client.render.engine.rhi.CombatantRhi;
|
| 67 | import combatant.client.render.engine.renderer.FullScreenRenderer;
|
| 68 | import combatant.client.render.engine.renderer.MeshRenderer;
|
| 69 | import combatant.client.render.engine.renderer.Renderer2D;
|
| 70 | import combatant.client.render.engine.renderer.Renderer3D;
|
| 71 | import combatant.client.render.engine.text.TextRenderer;
|
| 72 | import combatant.client.render.engine.uniform.MeshBuilder;
|
| 73 | import combatant.client.render.engine.uniform.impl.ShaderEspBlurUniforms;
|
| 74 | import combatant.client.render.engine.uniform.impl.ShaderEspGradientUniforms;
|
| 75 | import combatant.client.render.engine.uniform.impl.ShaderEspSmokeUniforms;
|
| 76 | import combatant.client.render.iris.IrisCombatantFrameHooks;
|
| 77 | import combatant.client.render.helpers.MatteHudStyle;
|
| 78 | import combatant.client.render.helpers.ScreenProjection;
|
| 79 | import combatant.client.render.helpers.ScreenSpaceOverlay2D;
|
| 80 | import combatant.client.util.player.PlayerHealthResolver;
|
| 81 |
|
| 82 | import java.util.*;
|
| 83 |
|
| 84 | //todo Description
|
| 85 | @ModuleInfo(id = "esp", displayName = "ESP", aliases = {"wallhack", "wh", "outline"}, category = ModuleCategory.VISUALS)
|
| 86 | public class ESP extends Module {
|
| 87 |
|
| 88 | private static final String MODE_FULL = "Full";
|
| 89 | private static final String MODE_CORNERS = "Corners";
|
| 90 | private static final String MODE_3D = "3D";
|
| 91 | private static final String MODE_SHADER = "Шейдер";
|
| 92 | private static final String SHADER_FILL_SOLID = "Solid";
|
| 93 | private static final String SHADER_FILL_SMOKE = "Smoke";
|
| 94 | private static final String COLOR_SOURCE_RELATIONS = "Relations";
|
| 95 | private static final String COLOR_SOURCE_CUSTOM = "Custom";
|
| 96 | private static final int OUTLINE_ALPHA = 145;
|
| 97 | private static final int COLOR_ALPHA = 210;
|
| 98 | private static final int HEALTH_ALPHA = 220;
|
| 99 | private static final int ABSORB_RGB = 0x3AA7FF;
|
| 100 | private static final float OUTLINE_EXPAND = 1.5f;
|
| 101 | private static final float OUTLINE_THICKNESS = 1.5f;
|
| 102 | private static final float COLOR_THICKNESS = 2.0f;
|
| 103 | private static final float GRAD_LIGHTEN = 0.30f;
|
| 104 | private static final float GRAD_DARKEN = 0.42f;
|
| 105 | private static final float HEALTH_BAR_WIDTH = 5.0f;
|
| 106 | private static final float HEALTH_BAR_GAP = 8.0f;
|
| 107 | private static final float HEALTH_BAR_INSET = 1.0f;
|
| 108 | private static final double AABB_TOP_OFFSET = 0.18;
|
| 109 | private static final float CORNER_SEGMENT_FRACTION = 0.27f;
|
| 110 | private static final boolean PIXEL_SNAP = true;
|
| 111 | private static final double SHADER_MAX_DISTANCE = 128.0;
|
| 112 | private static final float BOX_3D_GRADIENT_SPEED = 0.00115f;
|
| 113 | private static ProjectionMatrixBuffer shaderEspProjection;
|
| 114 | private static GpuSampler shaderEspSampler;
|
| 115 | private final Minecraft mc = Minecraft.getInstance();
|
| 116 | private final BooleanValue renderEntities =
|
| 117 | bool("espRenderEntities", "render_entities", false);
|
| 118 | private final RGBColorValue entityColor =
|
| 119 | visibleWhen(colorNoAlpha("espEntityColor", "entity_color", "#78C8FF"), renderEntities::get);
|
| 120 | private final ItemIdSetValue searchEntities =
|
| 121 | visibleWhen(itemList("espSearchEntities", "search_entities", TextListSetting.PickerMode.ENTITIES), renderEntities::get);
|
| 122 | private final BooleanValue renderSelf =
|
| 123 | bool("espRenderSelf", "render_self", false);
|
| 124 | private final ModeValue boxMode =
|
| 125 | modeCommon("espBoxMode", "box_mode", CommonSettingSchemas.ESP_BOX_MODE, MODE_FULL, MODE_FULL, MODE_CORNERS, MODE_3D, MODE_SHADER);
|
| 126 | private final ModeValue frameColorSource =
|
| 127 | visibleWhen(modeSetting("espFrameColorSource", "frame_color_source", COLOR_SOURCE_RELATIONS,
|
| 128 | COLOR_SOURCE_RELATIONS, COLOR_SOURCE_CUSTOM), () -> !is3DBox());
|
| 129 | private final EnumValue<AnimatedRenderColors.Mode> frameColorMode =
|
| 130 | visibleWhen(enumCommon("espFrameColorMode", "frame_color_mode",
|
| 131 | CommonSettingSchemas.RENDER_COLOR_MODE, AnimatedRenderColors.Mode.STATIC,
|
| 132 | AnimatedRenderColors.Mode.STATIC,
|
| 133 | AnimatedRenderColors.Mode.RAINBOW,
|
| 134 | AnimatedRenderColors.Mode.LIGHT_RAINBOW,
|
| 135 | AnimatedRenderColors.Mode.SKY,
|
| 136 | AnimatedRenderColors.Mode.FADE,
|
| 137 | AnimatedRenderColors.Mode.DOUBLE_COLOR,
|
| 138 | AnimatedRenderColors.Mode.ANALOGOUS,
|
| 139 | AnimatedRenderColors.Mode.THEME), this::usesCustomFrameColors);
|
| 140 | private final RGBColorValue framePrimaryColor =
|
| 141 | visibleWhen(common(colorNoAlpha("espFramePrimaryColor", "frame_primary_color", "#78C8FF"),
|
| 142 | CommonSettingSchemas.RENDER_PRIMARY_COLOR.commonI18nKey()), this::usesPrimaryFrameColor);
|
| 143 | private final RGBColorValue frameSecondaryColor =
|
| 144 | visibleWhen(common(colorNoAlpha("espFrameSecondaryColor", "frame_secondary_color", "#B064FF"),
|
| 145 | CommonSettingSchemas.RENDER_SECONDARY_COLOR.commonI18nKey()), this::usesSecondaryFrameColor);
|
| 146 | private final NumberValue<Integer> frameColorSpeed =
|
| 147 | visibleWhen(numCommon("espFrameColorSpeed", "frame_color_speed", CommonSettingSchemas.RENDER_COLOR_SPEED,
|
| 148 | 18, 2, 54), this::usesAnimatedFrameColors);
|
| 149 | private final NumberValue<Integer> frameColorPhase =
|
| 150 | visibleWhen(num("espFrameColorPhase", "frame_color_phase", 0, -360, 360), this::usesAnimatedFrameColors);
|
| 151 | private final NumberValue<Integer> frameColorSpread =
|
| 152 | visibleWhen(num("espFrameColorSpread", "frame_color_spread", 180, -720, 720), this::usesAnimatedFrameColors);
|
| 153 | private final NumberValue<Float> frameGradientAngle =
|
| 154 | visibleWhen(num("espFrameGradientAngle", "frame_gradient_angle", 90.0f, -180.0f, 180.0f), this::usesAnimatedFrameColors);
|
| 155 | private final NumberValue<Float> frameGradientStrength =
|
| 156 | visibleWhen(num("espFrameGradientStrength", "frame_gradient_strength", 1.0f, 0.0f, 2.0f), this::usesAnimatedFrameColors);
|
| 157 | private final SetValue shaderChamsEntities =
|
| 158 | visibleWhen(textList("espShaderChamsEntities", "shader_chams_entities",
|
| 159 | TextListSetting.PickerMode.ENTITIES, Set.of("minecraft:end_crystal")), this::isShaderBox);
|
| 160 | private final RGBColorValue shaderChamsEntityColor =
|
| 161 | visibleWhen(colorNoAlpha("espShaderChamsEntityColor", "shader_chams_entity_color", "#B064FF"), this::isShaderBox);
|
| 162 | private final BooleanValue healthBar =
|
| 163 | visibleWhen(boolCommon("espHealthBar", "health_bar_left", CommonSettingSchemas.ESP_HEALTH_BAR, true), () -> !is3DBox() && !isShaderBox());
|
| 164 | private final BooleanMapValue healthBarTargets =
|
| 165 | visibleWhen(group("espHealthBarTargets", "health_bar_targets", new LinkedHashMap<>() {{
|
| 166 | put("players", true);
|
| 167 | put("friends", true);
|
| 168 | put("enemies", true);
|
| 169 | put("staff", true);
|
| 170 | put("entities", false);
|
| 171 | }}), () -> healthBar.get() && !is3DBox() && !isShaderBox());
|
| 172 | private final BooleanValue healthBarGradient =
|
| 173 | visibleWhen(boolCommon("espHealthBarGradient", "health_bar_gradient", CommonSettingSchemas.ESP_HEALTH_BAR_GRADIENT, true), () -> healthBar.get() && !is3DBox() && !isShaderBox());
|
| 174 | private final BooleanValue healthBarLimitDistance =
|
| 175 | visibleWhen(bool("espHealthBarLimitDistance", "health_bar_limit_distance", false),
|
| 176 | () -> healthBar.get() && !is3DBox() && !isShaderBox());
|
| 177 | private final NumberValue<Integer> healthBarDistance =
|
| 178 | visibleWhen(numCommon("espHealthBarDistance", "health_bar_distance", CommonSettingSchemas.ESP_HEALTH_BAR_DISTANCE, 80, 5, 256),
|
| 179 | () -> healthBar.get() && healthBarLimitDistance.get() && !is3DBox() && !isShaderBox());
|
| 180 | private final NumberValue<Float> box3dLineWidth =
|
| 181 | visibleWhen(numCommon("esp3dLineWidth", "line_width", CommonSettingSchemas.ESP_LINE_WIDTH, 1.5f, 0.5f, 6.0f), this::is3DBox);
|
| 182 | private final NumberValue<Float> box3dGradientStrength =
|
| 183 | visibleWhen(num("esp3dGradientStrength", "gradient_strength", 1.35f, 0.0f, 2.5f), this::is3DBox);
|
| 184 | private final NumberValue<Float> box3dFillAlpha =
|
| 185 | visibleWhen(num("esp3dFillAlpha", "fill_alpha", 0.30f, 0.0f, 1.0f), this::is3DBox);
|
| 186 | private final NumberValue<Float> box3dOutlineAlpha =
|
| 187 | visibleWhen(num("esp3dOutlineAlpha", "outline_alpha", 1.0f, 0.0f, 1.0f), this::is3DBox);
|
| 188 | private final BooleanValue shaderGlow =
|
| 189 | visibleWhen(bool("espShaderGlowEnabled", "shader_glow_enabled", true), this::isShaderBox);
|
| 190 | private final NumberValue<Float> shaderGlowStrength =
|
| 191 | visibleWhen(num("espShaderGlowStrength", "shader_glow_strength", 8.0f, 1.0f, 48.0f), () -> isShaderBox() && shaderGlow.get());
|
| 192 | private final NumberValue<Float> shaderGlowAlpha =
|
| 193 | visibleWhen(num("espShaderGlowAlpha", "shader_glow_alpha", 0.72f, 0.0f, 1.0f), () -> isShaderBox() && shaderGlow.get());
|
| 194 | private final NumberValue<Float> shaderGlowIntensity =
|
| 195 | visibleWhen(num("espShaderGlowIntensity", "shader_glow_intensity", 1.25f, 0.10f, 4.0f), () -> isShaderBox() && shaderGlow.get());
|
| 196 | private final BooleanValue shaderOutline =
|
| 197 | visibleWhen(bool("espShaderOutlineEnabled", "shader_outline_enabled", true), this::isShaderBox);
|
| 198 | private final NumberValue<Float> shaderOutlineWidth =
|
| 199 | visibleWhen(num("espShaderOutlineWidth", "shader_outline_width", 2.0f, 0.5f, 18.0f), () -> isShaderBox() && shaderOutline.get());
|
| 200 | private final NumberValue<Float> shaderOutlineAlpha =
|
| 201 | visibleWhen(num("espShaderOutlineAlpha", "shader_outline_alpha", 0.92f, 0.0f, 1.0f), () -> isShaderBox() && shaderOutline.get());
|
| 202 | private final NumberValue<Float> shaderOutlineIntensity =
|
| 203 | visibleWhen(num("espShaderOutlineIntensity", "shader_outline_intensity", 1.15f, 0.10f, 4.0f), () -> isShaderBox() && shaderOutline.get());
|
| 204 | private final BooleanValue shaderFill =
|
| 205 | visibleWhen(bool("espShaderFillEnabled", "shader_fill_enabled", true), this::isShaderBox);
|
| 206 | private final ModeValue shaderFillStyle =
|
| 207 | visibleWhen(modeSetting("espShaderFillStyle", "shader_fill_style", SHADER_FILL_SOLID, SHADER_FILL_SOLID, SHADER_FILL_SMOKE),
|
| 208 | () -> isShaderBox() && shaderFill.get());
|
| 209 | private final NumberValue<Float> shaderSmokeScale =
|
| 210 | visibleWhen(num("espShaderSmokeScale", "shader_smoke_scale", 2.60f, 0.35f, 8.0f),
|
| 211 | () -> isShaderBox() && shaderFill.get() && isShaderSmokeFill());
|
| 212 | private final NumberValue<Float> shaderSmokeSpeed =
|
| 213 | visibleWhen(num("espShaderSmokeSpeed", "shader_smoke_speed", 0.55f, 0.0f, 3.0f),
|
| 214 | () -> isShaderBox() && shaderFill.get() && isShaderSmokeFill());
|
| 215 | private final NumberValue<Integer> shaderSmokeOctaves =
|
| 216 | visibleWhen(num("espShaderSmokeOctaves", "shader_smoke_octaves", 4, 1, 6),
|
| 217 | () -> isShaderBox() && shaderFill.get() && isShaderSmokeFill());
|
| 218 | private final NumberValue<Float> shaderSmokeContrast =
|
| 219 | visibleWhen(num("espShaderSmokeContrast", "shader_smoke_contrast", 1.20f, 0.35f, 3.0f),
|
| 220 | () -> isShaderBox() && shaderFill.get() && isShaderSmokeFill());
|
| 221 | private final NumberValue<Float> shaderFillAlpha =
|
| 222 | visibleWhen(num("espShaderFillAlpha", "shader_fill_alpha", 0.41f, 0.0f, 1.0f),
|
| 223 | () -> isShaderBox() && shaderFill.get());
|
| 224 | private final NumberValue<Float> shaderDarkMultiplier =
|
| 225 | visibleWhen(num("espShaderDarkMultiplier", "shader_dark_multiplier", 0.55f, 0.0f, 1.5f), this::isShaderBox);
|
| 226 | private final PostProcessPass shaderEspPass = new ShaderEspPass();
|
| 227 | private final SubmitNodeStorage shaderEspCommandQueue = new SubmitNodeStorage();
|
| 228 | private TextureTarget shaderMask;
|
| 229 | private TextureTarget shaderBlurBuffer;
|
| 230 | private TextureTarget shaderEffectBuffer;
|
| 231 | private final SeparableMaskBlurComputeBackend shaderEspComputeBlur = new SeparableMaskBlurComputeBackend();
|
| 232 | private FeatureRenderDispatcher shaderEspRenderDispatcher;
|
| 233 | private RenderBuffers shaderEspRenderBuffers;
|
| 234 | private int shaderBufferW = -1;
|
| 235 | private int shaderBufferH = -1;
|
| 236 |
|
| 237 | {
|
| 238 | PostProcessManager.register(shaderEspPass);
|
| 239 | }
|
| 240 |
|
| 241 | private static boolean containsEntityId(Set<String> selected, Identifier id) {
|
| 242 | String full = id.toString();
|
| 243 | String path = id.getPath();
|
| 244 | for (String raw : selected) {
|
| 245 | if (raw == null || raw.isBlank()) {
|
| 246 | continue;
|
| 247 | }
|
| 248 | String normalized = raw.trim().toLowerCase(Locale.ROOT);
|
| 249 | if (full.equals(normalized) || path.equals(normalized)) {
|
| 250 | return true;
|
| 251 | }
|
| 252 | if (!normalized.contains(":") && full.equals("minecraft:" + normalized)) {
|
| 253 | return true;
|
| 254 | }
|
| 255 | }
|
| 256 | return false;
|
| 257 | }
|
| 258 |
|
| 259 | private static GpuSampler getShaderEspSampler() {
|
| 260 | if (shaderEspSampler != null) {
|
| 261 | return shaderEspSampler;
|
| 262 | }
|
| 263 | shaderEspSampler = RenderSystem.getDevice().createSampler(
|
| 264 | AddressMode.CLAMP_TO_EDGE,
|
| 265 | AddressMode.CLAMP_TO_EDGE,
|
| 266 | FilterMode.LINEAR,
|
| 267 | FilterMode.LINEAR,
|
| 268 | 1,
|
| 269 | OptionalDouble.empty()
|
| 270 | );
|
| 271 | return shaderEspSampler;
|
| 272 | }
|
| 273 |
|
| 274 | private static void clearFramebuffer(RenderTarget framebuffer) {
|
| 275 | if (framebuffer == null || framebuffer.getColorTexture() == null) {
|
| 276 | return;
|
| 277 | }
|
| 278 | RenderSystem.getDevice().createCommandEncoder().clearColorTexture(framebuffer.getColorTexture(), new org.joml.Vector4f(0.0f, 0.0f, 0.0f, 0.0f));
|
| 279 | }
|
| 280 |
|
| 281 | private static String formatHealth(float health) {
|
| 282 | if (Math.abs(health - Math.round(health)) < 0.05f) {
|
| 283 | return Math.round(health) + " HP";
|
| 284 | }
|
| 285 | return String.format(Locale.ROOT, "%.1f HP", health);
|
| 286 | }
|
| 287 |
|
| 288 | private static void addFilledBox(MeshBuilder mesh,
|
| 289 | AABB box,
|
| 290 | int c000, int c001, int c010, int c011,
|
| 291 | int c100, int c101, int c110, int c111) {
|
| 292 | double minX = box.minX;
|
| 293 | double minY = box.minY;
|
| 294 | double minZ = box.minZ;
|
| 295 | double maxX = box.maxX;
|
| 296 | double maxY = box.maxY;
|
| 297 | double maxZ = box.maxZ;
|
| 298 |
|
| 299 | quad(mesh, minX, minY, minZ, c000, maxX, minY, minZ, c100, maxX, minY, maxZ, c101, minX, minY, maxZ, c001);
|
| 300 | quad(mesh, minX, maxY, minZ, c010, minX, maxY, maxZ, c011, maxX, maxY, maxZ, c111, maxX, maxY, minZ, c110);
|
| 301 | quad(mesh, minX, minY, maxZ, c001, maxX, minY, maxZ, c101, maxX, maxY, maxZ, c111, minX, maxY, maxZ, c011);
|
| 302 | quad(mesh, minX, minY, minZ, c000, minX, maxY, minZ, c010, maxX, maxY, minZ, c110, maxX, minY, minZ, c100);
|
| 303 | quad(mesh, maxX, minY, minZ, c100, maxX, maxY, minZ, c110, maxX, maxY, maxZ, c111, maxX, minY, maxZ, c101);
|
| 304 | quad(mesh, minX, minY, minZ, c000, minX, minY, maxZ, c001, minX, maxY, maxZ, c011, minX, maxY, minZ, c010);
|
| 305 | }
|
| 306 |
|
| 307 | private static void addOutlineBox(MeshBuilder mesh,
|
| 308 | AABB box,
|
| 309 | int c000, int c001, int c010, int c011,
|
| 310 | int c100, int c101, int c110, int c111) {
|
| 311 | double minX = box.minX;
|
| 312 | double minY = box.minY;
|
| 313 | double minZ = box.minZ;
|
| 314 | double maxX = box.maxX;
|
| 315 | double maxY = box.maxY;
|
| 316 | double maxZ = box.maxZ;
|
| 317 |
|
| 318 | line(mesh, minX, minY, minZ, c000, maxX, minY, minZ, c100);
|
| 319 | line(mesh, maxX, minY, minZ, c100, maxX, minY, maxZ, c101);
|
| 320 | line(mesh, maxX, minY, maxZ, c101, minX, minY, maxZ, c001);
|
| 321 | line(mesh, minX, minY, maxZ, c001, minX, minY, minZ, c000);
|
| 322 |
|
| 323 | line(mesh, minX, maxY, minZ, c010, maxX, maxY, minZ, c110);
|
| 324 | line(mesh, maxX, maxY, minZ, c110, maxX, maxY, maxZ, c111);
|
| 325 | line(mesh, maxX, maxY, maxZ, c111, minX, maxY, maxZ, c011);
|
| 326 | line(mesh, minX, maxY, maxZ, c011, minX, maxY, minZ, c010);
|
| 327 |
|
| 328 | line(mesh, minX, minY, minZ, c000, minX, maxY, minZ, c010);
|
| 329 | line(mesh, maxX, minY, minZ, c100, maxX, maxY, minZ, c110);
|
| 330 | line(mesh, maxX, minY, maxZ, c101, maxX, maxY, maxZ, c111);
|
| 331 | line(mesh, minX, minY, maxZ, c001, minX, maxY, maxZ, c011);
|
| 332 | }
|
| 333 |
|
| 334 | private static void quad(MeshBuilder mesh,
|
| 335 | double x1, double y1, double z1, int c1,
|
| 336 | double x2, double y2, double z2, int c2,
|
| 337 | double x3, double y3, double z3, int c3,
|
| 338 | double x4, double y4, double z4, int c4) {
|
| 339 | mesh.ensureQuadCapacity();
|
| 340 | putVertex(mesh, x1, y1, z1, c1);
|
| 341 | int i1 = mesh.next();
|
| 342 | putVertex(mesh, x2, y2, z2, c2);
|
| 343 | int i2 = mesh.next();
|
| 344 | putVertex(mesh, x3, y3, z3, c3);
|
| 345 | int i3 = mesh.next();
|
| 346 | putVertex(mesh, x4, y4, z4, c4);
|
| 347 | int i4 = mesh.next();
|
| 348 | mesh.quad(i1, i2, i3, i4);
|
| 349 | }
|
| 350 |
|
| 351 | private static void quad(MeshBuilder mesh,
|
| 352 | double x1, double y1, double z1,
|
| 353 | double x2, double y2, double z2,
|
| 354 | double x3, double y3, double z3,
|
| 355 | double x4, double y4, double z4,
|
| 356 | int r, int g, int b, int a) {
|
| 357 | mesh.ensureQuadCapacity();
|
| 358 | int i1 = mesh.vec3(x1, y1, z1).color(r, g, b, a).next();
|
| 359 | int i2 = mesh.vec3(x2, y2, z2).color(r, g, b, a).next();
|
| 360 | int i3 = mesh.vec3(x3, y3, z3).color(r, g, b, a).next();
|
| 361 | int i4 = mesh.vec3(x4, y4, z4).color(r, g, b, a).next();
|
| 362 | mesh.quad(i1, i2, i3, i4);
|
| 363 | }
|
| 364 |
|
| 365 | private static void line(MeshBuilder mesh,
|
| 366 | double x1, double y1, double z1, int c1,
|
| 367 | double x2, double y2, double z2, int c2) {
|
| 368 | mesh.ensureLineCapacity();
|
| 369 | putVertex(mesh, x1, y1, z1, c1);
|
| 370 | int i1 = mesh.next();
|
| 371 | putVertex(mesh, x2, y2, z2, c2);
|
| 372 | int i2 = mesh.next();
|
| 373 | mesh.line(i1, i2);
|
| 374 | }
|
| 375 |
|
| 376 | private static void line(MeshBuilder mesh,
|
| 377 | double x1, double y1, double z1,
|
| 378 | double x2, double y2, double z2,
|
| 379 | int r, int g, int b, int a) {
|
| 380 | mesh.ensureLineCapacity();
|
| 381 | int i1 = mesh.vec3(x1, y1, z1).color(r, g, b, a).next();
|
| 382 | int i2 = mesh.vec3(x2, y2, z2).color(r, g, b, a).next();
|
| 383 | mesh.line(i1, i2);
|
| 384 | }
|
| 385 |
|
| 386 | private static void putVertex(MeshBuilder mesh, double x, double y, double z, int argb) {
|
| 387 | mesh.vec3(x, y, z).color(
|
| 388 | (argb >>> 16) & 0xFF,
|
| 389 | (argb >>> 8) & 0xFF,
|
| 390 | argb & 0xFF,
|
| 391 | (argb >>> 24) & 0xFF
|
| 392 | );
|
| 393 | }
|
| 394 |
|
| 395 | private static int boxGradientColor(int baseRgb, AABB box, double x, double y, double z, int alpha, float strength) {
|
| 396 | double nx = safeRatio(x - box.minX, box.maxX - box.minX);
|
| 397 | double ny = safeRatio(y - box.minY, box.maxY - box.minY);
|
| 398 | double nz = safeRatio(z - box.minZ, box.maxZ - box.minZ);
|
| 399 | double phase = AnimationUtility.time(BOX_3D_GRADIENT_SPEED)
|
| 400 | + (box.minX + box.minY * 0.7 + box.minZ * 1.3) * 0.18;
|
| 401 | double waveA = 0.5 + 0.5 * Math.sin(phase + nx * 2.65 + ny * 5.30 - nz * 1.75);
|
| 402 | double waveB = 0.5 + 0.5 * Math.sin(phase * 0.72 - nx * 3.10 + ny * 1.35 + nz * 4.40);
|
| 403 | float t = clamp01((float) (ny * 0.44 + nz * 0.18 + (1.0 - nx) * 0.16 + waveA * 0.16 + waveB * 0.12));
|
| 404 |
|
| 405 | int darkRgb = mixRgb(baseRgb, 0x000000, clamp01(0.18f + 0.36f * strength));
|
| 406 | int lightRgb = mixRgb(baseRgb, 0xFFFFFF, clamp01(0.16f + 0.40f * strength));
|
| 407 | int gradientRgb = mixRgb(darkRgb, lightRgb, t);
|
| 408 | int preservedRgb = mixRgb(baseRgb, gradientRgb, clamp01(strength));
|
| 409 | return withAlpha(preservedRgb, alpha);
|
| 410 | }
|
| 411 |
|
| 412 | private static double safeRatio(double value, double length) {
|
| 413 | if (length <= 0.0001) return 0.0;
|
| 414 | if (value <= 0.0) return 0.0;
|
| 415 | if (value >= length) return 1.0;
|
| 416 | return value / length;
|
| 417 | }
|
| 418 |
|
| 419 | private boolean usesCustomFrameColors() {
|
| 420 | return !is3DBox() && COLOR_SOURCE_CUSTOM.equalsIgnoreCase(frameColorSource.get());
|
| 421 | }
|
| 422 |
|
| 423 | private boolean usesAnimatedFrameColors() {
|
| 424 | return usesCustomFrameColors() && AnimatedRenderColors.animated(frameColorMode.get());
|
| 425 | }
|
| 426 |
|
| 427 | private boolean usesPrimaryFrameColor() {
|
| 428 | if (!usesCustomFrameColors()) return false;
|
| 429 | return switch (frameColorMode.get()) {
|
| 430 | case STATIC, FADE, DOUBLE_COLOR, ANALOGOUS -> true;
|
| 431 | case RAINBOW, LIGHT_RAINBOW, SKY, THEME -> false;
|
| 432 | };
|
| 433 | }
|
| 434 |
|
| 435 | private boolean usesSecondaryFrameColor() {
|
| 436 | return usesCustomFrameColors() && AnimatedRenderColors.usesSecondary(frameColorMode.get());
|
| 437 | }
|
| 438 |
|
| 439 | private static float shaderSmokeTime() {
|
| 440 | return (System.currentTimeMillis() % 600_000L) / 1000.0f;
|
| 441 | }
|
| 442 |
|
| 443 | private int customPaletteColor(double tx, double ty, int alpha) {
|
| 444 | float progress = gradientProgress(tx, ty, frameGradientAngle.get());
|
| 445 | float spread = frameColorSpread.get() * frameGradientStrength.get();
|
| 446 | int phase = frameColorPhase.get() + Math.round(progress * spread);
|
| 447 | int primary = withAlpha(framePrimaryColor.getArgb(), alpha);
|
| 448 | int secondary = withAlpha(frameSecondaryColor.getArgb(), alpha);
|
| 449 | return AnimatedRenderColors.withAlpha(AnimatedRenderColors.resolve(
|
| 450 | frameColorMode.get(),
|
| 451 | frameColorSpeed.get(),
|
| 452 | phase,
|
| 453 | primary,
|
| 454 | secondary,
|
| 455 | true
|
| 456 | ), alpha);
|
| 457 | }
|
| 458 |
|
| 459 | private int shaderPalettePrimary() {
|
| 460 | int primary = withAlpha(framePrimaryColor.getArgb(), 255);
|
| 461 | return AnimatedRenderColors.angularPrimaryColor(frameColorMode.get(), primary);
|
| 462 | }
|
| 463 |
|
| 464 | private int shaderPaletteSecondary() {
|
| 465 | int primary = withAlpha(framePrimaryColor.getArgb(), 255);
|
| 466 | int secondary = withAlpha(frameSecondaryColor.getArgb(), 255);
|
| 467 | return AnimatedRenderColors.angularSecondaryColor(frameColorMode.get(), primary, secondary);
|
| 468 | }
|
| 469 |
|
| 470 | private float shaderPaletteBaseAngle() {
|
| 471 | if (!usesAnimatedFrameColors()) return frameColorPhase.get();
|
| 472 | int speed = Math.max(1, frameColorSpeed.get());
|
| 473 | long timeAngle = (System.currentTimeMillis() / speed) % 360L;
|
| 474 | return (float) timeAngle + frameColorPhase.get();
|
| 475 | }
|
| 476 |
|
| 477 | private float shaderPaletteSpread() {
|
| 478 | return frameColorSpread.get() * frameGradientStrength.get();
|
| 479 | }
|
| 480 |
|
| 481 | private static float gradientProgress(double tx, double ty, float angleDeg) {
|
| 482 | double x = Math.max(0.0, Math.min(1.0, tx));
|
| 483 | double y = Math.max(0.0, Math.min(1.0, ty));
|
| 484 | double radians = Math.toRadians(angleDeg);
|
| 485 | double dx = Math.cos(radians);
|
| 486 | double dy = Math.sin(radians);
|
| 487 | double projection = x * dx + y * dy;
|
| 488 | double min = Math.min(0.0, dx) + Math.min(0.0, dy);
|
| 489 | double max = Math.max(0.0, dx) + Math.max(0.0, dy);
|
| 490 | double range = max - min;
|
| 491 | if (range <= 1.0e-6) return 0.5f;
|
| 492 | return clamp01((float) ((projection - min) / range));
|
| 493 | }
|
| 494 |
|
| 495 | private static int withAlpha(int rgb, int alpha) {
|
| 496 | int a = clamp(alpha);
|
| 497 | return (a << 24) | (rgb & 0x00FFFFFF);
|
| 498 | }
|
| 499 |
|
| 500 | private static int alpha255(float alpha) {
|
| 501 | return clamp(Math.round(clamp01(alpha) * 255.0f));
|
| 502 | }
|
| 503 |
|
| 504 | private static int mixRgb(int rgbA, int rgbB, float t) {
|
| 505 | float clamped = Math.max(0f, Math.min(1f, t));
|
| 506 | int ar = (rgbA >>> 16) & 0xFF;
|
| 507 | int ag = (rgbA >>> 8) & 0xFF;
|
| 508 | int ab = rgbA & 0xFF;
|
| 509 | int br = (rgbB >>> 16) & 0xFF;
|
| 510 | int bg = (rgbB >>> 8) & 0xFF;
|
| 511 | int bb = rgbB & 0xFF;
|
| 512 |
|
| 513 | int r = Math.round(ar + (br - ar) * clamped);
|
| 514 | int g = Math.round(ag + (bg - ag) * clamped);
|
| 515 | int b = Math.round(ab + (bb - ab) * clamped);
|
| 516 | return (clamp(r) << 16) | (clamp(g) << 8) | clamp(b);
|
| 517 | }
|
| 518 |
|
| 519 | private static int scaleRgb(int rgb, float multiplier) {
|
| 520 | float m = Math.max(0.0f, Math.min(2.0f, multiplier));
|
| 521 | int r = Math.round(((rgb >>> 16) & 0xFF) * m);
|
| 522 | int g = Math.round(((rgb >>> 8) & 0xFF) * m);
|
| 523 | int b = Math.round((rgb & 0xFF) * m);
|
| 524 | return (clamp(r) << 16) | (clamp(g) << 8) | clamp(b);
|
| 525 | }
|
| 526 |
|
| 527 | private static float clamp01(float v) {
|
| 528 | if (v < 0f) return 0f;
|
| 529 | if (v > 1f) return 1f;
|
| 530 | return v;
|
| 531 | }
|
| 532 |
|
| 533 | private static int healthRgb(float ratio) {
|
| 534 | float t = clamp01(ratio);
|
| 535 | if (t >= 0.5f) {
|
| 536 | float k = (t - 0.5f) / 0.5f;
|
| 537 | return mixRgb(0xFFFF00, 0x00FF00, k);
|
| 538 | }
|
| 539 | float k = t / 0.5f;
|
| 540 | return mixRgb(0xFF0000, 0xFFFF00, k);
|
| 541 | }
|
| 542 |
|
| 543 | private static int clamp(int v) {
|
| 544 | if (v < 0) return 0;
|
| 545 | if (v > 255) return 255;
|
| 546 | return v;
|
| 547 | }
|
| 548 |
|
| 549 | private static int mixArgb(int a, int b, float t) {
|
| 550 | float clamped = clamp01(t);
|
| 551 | int aa = (a >>> 24) & 0xFF;
|
| 552 | int ar = (a >>> 16) & 0xFF;
|
| 553 | int ag = (a >>> 8) & 0xFF;
|
| 554 | int ab = a & 0xFF;
|
| 555 | int ba = (b >>> 24) & 0xFF;
|
| 556 | int br = (b >>> 16) & 0xFF;
|
| 557 | int bg = (b >>> 8) & 0xFF;
|
| 558 | int bb = b & 0xFF;
|
| 559 |
|
| 560 | int oa = Math.round(aa + (ba - aa) * clamped);
|
| 561 | int or = Math.round(ar + (br - ar) * clamped);
|
| 562 | int og = Math.round(ag + (bg - ag) * clamped);
|
| 563 | int ob = Math.round(ab + (bb - ab) * clamped);
|
| 564 | return (clamp(oa) << 24) | (clamp(or) << 16) | (clamp(og) << 8) | clamp(ob);
|
| 565 | }
|
| 566 |
|
| 567 | @Override
|
| 568 | public HudRenderSpace getHudRenderSpace() {
|
| 569 | return HudRenderSpace.UNSCALED_LOGICAL;
|
| 570 | }
|
| 571 |
|
| 572 | @Override
|
| 573 | public HudPhase getHudPhase() {
|
| 574 | return HudPhase.BEFORE_MISC_OVERLAYS;
|
| 575 | }
|
| 576 |
|
| 577 | @Override
|
| 578 | public WorldPhase getWorldPhase() {
|
| 579 | return WorldPhase.END_MAIN;
|
| 580 | }
|
| 581 |
|
| 582 | @Override
|
| 583 | public void onRenderHudEngine(Renderer2D renderer, TextRenderer textRenderer, float tickDelta) {
|
| 584 | if (!isEnabled() || mc.level == null || mc.player == null) return;
|
| 585 |
|
| 586 | Vec3 camPos = mc.gameRenderer.mainCamera().position();
|
| 587 |
|
| 588 | if (!is3DBox() && !isShaderBox()) {
|
| 589 | List<RenderEntry> playerEntries = collectPlayerEntries(camPos);
|
| 590 | playerEntries.sort(Comparator.comparingDouble(RenderEntry::distSq).reversed());
|
| 591 |
|
| 592 | for (RenderEntry entry : playerEntries) {
|
| 593 | draw2DESP(renderer, entry.entity(), tickDelta, entry.color(), entry.distSq());
|
| 594 | }
|
| 595 | }
|
| 596 |
|
| 597 | renderSearchEntityOverlay(renderer, textRenderer, tickDelta, camPos);
|
| 598 | }
|
| 599 |
|
| 600 | @Override
|
| 601 | public void onRenderWorldEngine(Renderer3D renderer, Renderer3D depthRenderer, float tickDelta) {
|
| 602 | if (!isEnabled() || !is3DBox() || mc.level == null || mc.player == null) return;
|
| 603 |
|
| 604 | Vec3 camPos = mc.gameRenderer.mainCamera().position();
|
| 605 | List<RenderEntry> entries = collectPlayerEntries(camPos);
|
| 606 | if (entries.isEmpty()) return;
|
| 607 |
|
| 608 | float previousLineWidth = RenderState.lineWidth;
|
| 609 | MeshBuilder lines;
|
| 610 | MeshBuilder tris;
|
| 611 | try {
|
| 612 | RenderState.lineWidth = box3dLineWidth.get();
|
| 613 | lines = renderer.batch(CombatantRenderPipelines.WORLD_COLORED_LINES, Renderer3D.DepthMode.NONE);
|
| 614 | tris = renderer.batch(CombatantRenderPipelines.WORLD_COLORED, Renderer3D.DepthMode.NONE);
|
| 615 | } finally {
|
| 616 | RenderState.lineWidth = previousLineWidth;
|
| 617 | }
|
| 618 |
|
| 619 | entries.sort(Comparator.comparingDouble(RenderEntry::distSq).reversed());
|
| 620 | for (RenderEntry entry : entries) {
|
| 621 | Entity entity = entry.entity();
|
| 622 | AABB box = resolveWorldBox(entity, tickDelta, shouldUseHitboxExpansion(entity));
|
| 623 | int color = resolve3DColor(entity, entry.color());
|
| 624 | add3DBox(tris, lines, box, color);
|
| 625 | }
|
| 626 | }
|
| 627 |
|
| 628 | @Override
|
| 629 | public void onDisable() {
|
| 630 | shaderEspComputeBlur.close();
|
| 631 | closeShaderEspRenderDispatcher();
|
| 632 | }
|
| 633 |
|
| 634 | private void closeShaderEspRenderDispatcher() {
|
| 635 | if (shaderEspRenderDispatcher != null) {
|
| 636 | shaderEspRenderDispatcher.close();
|
| 637 | shaderEspRenderDispatcher = null;
|
| 638 | }
|
| 639 | if (shaderEspRenderBuffers != null) {
|
| 640 | shaderEspRenderBuffers.close();
|
| 641 | shaderEspRenderBuffers = null;
|
| 642 | }
|
| 643 | }
|
| 644 |
|
| 645 | private List<RenderEntry> collectPlayerEntries(Vec3 camPos) {
|
| 646 | List<RenderEntry> entries = new ArrayList<>();
|
| 647 |
|
| 648 | for (Player player : mc.level.players()) {
|
| 649 | if (!shouldRenderPlayer(player)) continue;
|
| 650 | int color = resolvePlayerColor(player);
|
| 651 | double distSq = player.distanceToSqr(camPos);
|
| 652 | entries.add(new RenderEntry(player, color, distSq));
|
| 653 | }
|
| 654 |
|
| 655 | return entries;
|
| 656 | }
|
| 657 |
|
| 658 | private List<RenderEntry> collectSearchEntityEntries(Vec3 camPos) {
|
| 659 | List<RenderEntry> entries = new ArrayList<>();
|
| 660 | if (!renderEntities.get()) return entries;
|
| 661 |
|
| 662 | int color = entityColor.getArgb();
|
| 663 | for (Entity entity : mc.level.entitiesForRendering()) {
|
| 664 | if (!shouldRenderEntity(entity)) continue;
|
| 665 | double distSq = entity.distanceToSqr(camPos);
|
| 666 | entries.add(new RenderEntry(entity, color, distSq));
|
| 667 | }
|
| 668 |
|
| 669 | return entries;
|
| 670 | }
|
| 671 |
|
| 672 | private boolean shouldRenderPlayer(Player p) {
|
| 673 | if (p == null) return false;
|
| 674 | if (p == mc.player) {
|
| 675 | if (mc.options.getCameraType().isFirstPerson()) return false;
|
| 676 | return renderSelf.get();
|
| 677 | }
|
| 678 | return true;
|
| 679 | }
|
| 680 |
|
| 681 | private boolean shouldRenderEntity(Entity e) {
|
| 682 | if (e == null) return false;
|
| 683 | if (e instanceof Player) return false;
|
| 684 | if (e == mc.player) return false;
|
| 685 | Identifier id = BuiltInRegistries.ENTITY_TYPE.getKey(e.getType());
|
| 686 | if (id == null) return false;
|
| 687 | return searchEntities.get().contains(id.toString());
|
| 688 | }
|
| 689 |
|
| 690 | private int resolvePlayerColor(Player p) {
|
| 691 | return CategoryService.getColor(p);
|
| 692 | }
|
| 693 |
|
| 694 | private int resolve3DColor(Entity entity, int fallbackColor) {
|
| 695 | if (entity instanceof Player player) {
|
| 696 | return CategoryService.getColor(player);
|
| 697 | }
|
| 698 | return fallbackColor;
|
| 699 | }
|
| 700 |
|
| 701 | private boolean renderShaderEsp(GpuTextureView src, GpuTextureView dst, float tickDelta) {
|
| 702 | if (!isEnabled() || !isShaderBox() || mc.level == null || mc.player == null) {
|
| 703 | return false;
|
| 704 | }
|
| 705 | if (!shaderGlow.get() && !shaderOutline.get() && !shaderFill.get()) {
|
| 706 | return false;
|
| 707 | }
|
| 708 |
|
| 709 | Vec3 camPos = mc.gameRenderer.mainCamera().position();
|
| 710 | List<RenderEntry> entries = collectShaderEntries(camPos);
|
| 711 | if (entries.isEmpty()) {
|
| 712 | return false;
|
| 713 | }
|
| 714 |
|
| 715 | ensureShaderBuffers();
|
| 716 | if (shaderMask == null || shaderBlurBuffer == null || shaderEffectBuffer == null) {
|
| 717 | return false;
|
| 718 | }
|
| 719 |
|
| 720 | if (!renderShaderEntityMask(entries, tickDelta)) {
|
| 721 | return false;
|
| 722 | }
|
| 723 |
|
| 724 | PostProcessManager.copy(src, dst);
|
| 725 |
|
| 726 | int width = mc.getWindow().getWidth();
|
| 727 | int height = mc.getWindow().getHeight();
|
| 728 | return renderShaderColorPass(dst, width, height);
|
| 729 | }
|
| 730 |
|
| 731 | private List<RenderEntry> collectShaderEntries(Vec3 camPos) {
|
| 732 | List<RenderEntry> entries = new ArrayList<>();
|
| 733 | double maxDistSq = SHADER_MAX_DISTANCE * SHADER_MAX_DISTANCE;
|
| 734 |
|
| 735 | for (RenderEntry entry : collectPlayerEntries(camPos)) {
|
| 736 | if (entry.distSq() > maxDistSq) {
|
| 737 | continue;
|
| 738 | }
|
| 739 | entries.add(entry);
|
| 740 | }
|
| 741 |
|
| 742 | for (RenderEntry entry : collectShaderChamsEntityEntries(camPos, maxDistSq)) {
|
| 743 | entries.add(entry);
|
| 744 | }
|
| 745 |
|
| 746 | entries.sort(Comparator.comparingDouble(RenderEntry::distSq).reversed());
|
| 747 | return entries;
|
| 748 | }
|
| 749 |
|
| 750 | private List<RenderEntry> collectShaderChamsEntityEntries(Vec3 camPos, double maxDistSq) {
|
| 751 | List<RenderEntry> entries = new ArrayList<>();
|
| 752 | Set<String> selected = shaderChamsEntities.get();
|
| 753 | if (selected == null || selected.isEmpty()) {
|
| 754 | return entries;
|
| 755 | }
|
| 756 |
|
| 757 | int color = shaderChamsEntityColor.getArgb();
|
| 758 | for (Entity entity : mc.level.entitiesForRendering()) {
|
| 759 | if (!shouldRenderShaderChamsEntity(entity, selected)) {
|
| 760 | continue;
|
| 761 | }
|
| 762 | double distSq = entity.distanceToSqr(camPos);
|
| 763 | if (distSq > maxDistSq) {
|
| 764 | continue;
|
| 765 | }
|
| 766 | entries.add(new RenderEntry(entity, color, distSq));
|
| 767 | }
|
| 768 | return entries;
|
| 769 | }
|
| 770 |
|
| 771 | private boolean shouldRenderShaderChamsEntity(Entity entity, Set<String> selected) {
|
| 772 | if (entity == null) return false;
|
| 773 | if (entity instanceof Player) return false;
|
| 774 | if (entity == mc.player) return false;
|
| 775 |
|
| 776 | Identifier id = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType());
|
| 777 | if (id == null) return false;
|
| 778 | return containsEntityId(selected, id);
|
| 779 | }
|
| 780 |
|
| 781 | private boolean renderShaderColorPass(GpuTextureView dst, int width, int height) {
|
| 782 | if (shaderMask.getColorTextureView() == null) {
|
| 783 | return false;
|
| 784 | }
|
| 785 |
|
| 786 | float darkMultiplier = shaderDarkMultiplier.get();
|
| 787 | boolean rendered = false;
|
| 788 |
|
| 789 | if (shaderGlow.get()) {
|
| 790 | float glowRadius = Math.max(1.0f, shaderGlowStrength.get());
|
| 791 | GpuTextureView glowMask = blurShaderMask(shaderMask, shaderEffectBuffer, glowRadius, width, height);
|
| 792 | drawShaderGradient(glowMask, dst, width, height,
|
| 793 | alpha255(shaderGlowAlpha.get()),
|
| 794 | darkMultiplier,
|
| 795 | shaderGlowIntensity.get());
|
| 796 | rendered = true;
|
| 797 | }
|
| 798 |
|
| 799 | if (shaderFill.get()) {
|
| 800 | if (isShaderSmokeFill()) {
|
| 801 | drawShaderSmoke(shaderMask, dst, width, height);
|
| 802 | } else {
|
| 803 | drawShaderGradient(shaderMask.getColorTextureView(), dst, width, height,
|
| 804 | alpha255(shaderFillAlpha.get()),
|
| 805 | darkMultiplier,
|
| 806 | 1.0f);
|
| 807 | }
|
| 808 | rendered = true;
|
| 809 | }
|
| 810 |
|
| 811 | if (shaderOutline.get()) {
|
| 812 | float outlineRadius = Math.max(0.5f, shaderOutlineWidth.get());
|
| 813 | GpuTextureView outlineMask = blurShaderMask(shaderMask, shaderEffectBuffer, outlineRadius, width, height);
|
| 814 | drawShaderGradient(outlineMask, dst, width, height,
|
| 815 | alpha255(shaderOutlineAlpha.get()),
|
| 816 | darkMultiplier,
|
| 817 | shaderOutlineIntensity.get());
|
| 818 | rendered = true;
|
| 819 | }
|
| 820 |
|
| 821 | return rendered;
|
| 822 | }
|
| 823 |
|
| 824 | private GpuTextureView blurShaderMask(RenderTarget input, RenderTarget output, float radius, int width, int height) {
|
| 825 | GpuTextureView inputView = input != null ? input.getColorTextureView() : null;
|
| 826 | if (inputView == null) return null;
|
| 827 |
|
| 828 | GpuTextureView compute = shaderEspComputeBlur.blur(
|
| 829 | CombatantRenderSystem.rhi(), inputView, inputView, getShaderEspSampler(),
|
| 830 | width, height, Math.min(radius, 63.0f));
|
| 831 | if (compute != null) return compute;
|
| 832 |
|
| 833 | clearFramebuffer(shaderBlurBuffer);
|
| 834 | ShaderEspBlurUniforms.update(width, height, Math.min(radius, 63.0f), 1.0f, 0.0f);
|
| 835 | FullScreenRenderer.begin("Combatant Fullscreen Pass")
|
| 836 | .attachment(shaderBlurBuffer.getColorTextureView())
|
| 837 | .pipeline(CombatantRenderPipelines.SHADER_ESP_SHADOW)
|
| 838 | .uniform("ShaderEspBlur", ShaderEspBlurUniforms.get())
|
| 839 | .sampler("u_Texture", inputView, getShaderEspSampler())
|
| 840 | .sampler("u_Mask", inputView, getShaderEspSampler())
|
| 841 | .end();
|
| 842 |
|
| 843 | clearFramebuffer(output);
|
| 844 | ShaderEspBlurUniforms.update(width, height, Math.min(radius, 63.0f), 0.0f, 1.0f);
|
| 845 | FullScreenRenderer.begin("Combatant Fullscreen Pass")
|
| 846 | .attachment(output.getColorTextureView())
|
| 847 | .pipeline(CombatantRenderPipelines.SHADER_ESP_SHADOW)
|
| 848 | .uniform("ShaderEspBlur", ShaderEspBlurUniforms.get())
|
| 849 | .sampler("u_Texture", shaderBlurBuffer.getColorTextureView(), getShaderEspSampler())
|
| 850 | .sampler("u_Mask", inputView, getShaderEspSampler())
|
| 851 | .end();
|
| 852 | return output.getColorTextureView();
|
| 853 | }
|
| 854 |
|
| 855 | private void drawShaderGradient(GpuTextureView input, GpuTextureView dst, int width, int height, int alpha,
|
| 856 | float darkMultiplier, float intensity) {
|
| 857 | if (input == null || dst == null) return;
|
| 858 | boolean overrideColor = usesCustomFrameColors();
|
| 859 | ShaderEspGradientUniforms.update(
|
| 860 | 0.0f,
|
| 861 | 0.0f,
|
| 862 | width,
|
| 863 | height,
|
| 864 | shaderPalettePrimary(),
|
| 865 | shaderPaletteSecondary(),
|
| 866 | AnimatedRenderColors.shaderMode(frameColorMode.get()),
|
| 867 | shaderPaletteBaseAngle(),
|
| 868 | shaderPaletteSpread(),
|
| 869 | frameGradientAngle.get(),
|
| 870 | darkMultiplier,
|
| 871 | overrideColor ? 1.0f : 0.0f,
|
| 872 | Math.max(0.0f, Math.min(4.0f, intensity)),
|
| 873 | alpha / 255.0f
|
| 874 | );
|
| 875 | FullScreenRenderer.begin("Combatant Fullscreen Pass")
|
| 876 | .attachment(dst)
|
| 877 | .pipeline(CombatantRenderPipelines.SHADER_ESP_GRADIENT)
|
| 878 | .uniform("ShaderEspGradient", ShaderEspGradientUniforms.get())
|
| 879 | .sampler("u_Texture", input, getShaderEspSampler())
|
| 880 | .end();
|
| 881 | }
|
| 882 |
|
| 883 | private void drawShaderSmoke(RenderTarget input, GpuTextureView dst, int width, int height) {
|
| 884 | boolean overrideColor = usesCustomFrameColors();
|
| 885 | ShaderEspSmokeUniforms.update(
|
| 886 | 0.0f,
|
| 887 | 0.0f,
|
| 888 | width,
|
| 889 | height,
|
| 890 | shaderSmokeTime(),
|
| 891 | shaderSmokeScale.get(),
|
| 892 | shaderSmokeSpeed.get(),
|
| 893 | clamp01(shaderFillAlpha.get()),
|
| 894 | shaderSmokeOctaves.get(),
|
| 895 | shaderSmokeContrast.get(),
|
| 896 | overrideColor ? 1.0f : 0.0f,
|
| 897 | 1.0f,
|
| 898 | shaderPalettePrimary(),
|
| 899 | shaderPaletteSecondary(),
|
| 900 | AnimatedRenderColors.shaderMode(frameColorMode.get()),
|
| 901 | shaderPaletteBaseAngle(),
|
| 902 | shaderPaletteSpread(),
|
| 903 | frameGradientAngle.get()
|
| 904 | );
|
| 905 | FullScreenRenderer.begin("Combatant Fullscreen Pass")
|
| 906 | .attachment(dst)
|
| 907 | .pipeline(CombatantRenderPipelines.SHADER_ESP_SMOKE)
|
| 908 | .uniform("ShaderEspSmoke", ShaderEspSmokeUniforms.get())
|
| 909 | .sampler("u_Texture", input.getColorTextureView(), getShaderEspSampler())
|
| 910 | .end();
|
| 911 | }
|
| 912 |
|
| 913 | private void ensureShaderBuffers() {
|
| 914 | int width = mc.getWindow().getWidth();
|
| 915 | int height = mc.getWindow().getHeight();
|
| 916 | if (width <= 0 || height <= 0) {
|
| 917 | return;
|
| 918 | }
|
| 919 |
|
| 920 | boolean sizeChanged = width != shaderBufferW || height != shaderBufferH;
|
| 921 | if (shaderMask == null) {
|
| 922 | shaderMask = new TextureTarget("combatant-shader-esp-mask", width, height, true, GpuFormat.RGBA8_UNORM);
|
| 923 | shaderBlurBuffer = new TextureTarget("combatant-shader-esp-blur", width, height, false, GpuFormat.RGBA8_UNORM);
|
| 924 | shaderEffectBuffer = new TextureTarget("combatant-shader-esp-effect", width, height, false, GpuFormat.RGBA8_UNORM);
|
| 925 | shaderBufferW = width;
|
| 926 | shaderBufferH = height;
|
| 927 | } else if (sizeChanged) {
|
| 928 | shaderMask.resize(width, height);
|
| 929 | shaderBlurBuffer.resize(width, height);
|
| 930 | shaderEffectBuffer.resize(width, height);
|
| 931 | shaderBufferW = width;
|
| 932 | shaderBufferH = height;
|
| 933 | }
|
| 934 |
|
| 935 | }
|
| 936 |
|
| 937 | private boolean renderShaderEntityMask(List<RenderEntry> entries, float tickDelta) {
|
| 938 | if (entries.isEmpty() || shaderMask == null) {
|
| 939 | return false;
|
| 940 | }
|
| 941 |
|
| 942 | LevelRenderer worldRenderer = mc.levelRenderer;
|
| 943 | if (worldRenderer == null) {
|
| 944 | return false;
|
| 945 | }
|
| 946 |
|
| 947 | // Shader ESP already softens/dilates the silhouette in post. Rendering the auxiliary
|
| 948 | // mask with world MSAA multiplies the entity pass cost (and forces a resolve) without
|
| 949 | // producing a meaningful final-quality gain, so keep this mask single-sampled.
|
| 950 | RenderTarget target = shaderMask;
|
| 951 |
|
| 952 | var colorTex = target.getColorTexture();
|
| 953 | if (colorTex == null) {
|
| 954 | return false;
|
| 955 | }
|
| 956 |
|
| 957 | var encoder = RenderSystem.getDevice().createCommandEncoder();
|
| 958 | encoder.clearColorTexture(colorTex, new org.joml.Vector4f(0.0f, 0.0f, 0.0f, 0.0f));
|
| 959 |
|
| 960 | var depthTex = target.getDepthTexture();
|
| 961 | if (depthTex != null) {
|
| 962 | encoder.clearDepthTexture(depthTex, 1.0);
|
| 963 | }
|
| 964 |
|
| 965 | GpuTextureView prevColor = RenderSystem.outputColorTextureOverride;
|
| 966 | GpuTextureView prevDepth = RenderSystem.outputDepthTextureOverride;
|
| 967 | GpuBufferSlice prevProjection = RenderSystem.getProjectionMatrixBuffer();
|
| 968 | ProjectionType prevProjectionType = RenderSystem.getProjectionType();
|
| 969 | Matrix4f prevMeshProjection = MeshRenderer.projection();
|
| 970 | Matrix4f prevWorldProjection = new Matrix4f(RenderState.worldProjection);
|
| 971 | boolean prevRendering3D = RenderState.rendering3D;
|
| 972 |
|
| 973 | RenderSystem.outputColorTextureOverride = target.getColorTextureView();
|
| 974 | RenderSystem.outputDepthTextureOverride = target.getDepthTextureView();
|
| 975 |
|
| 976 | if (shaderEspProjection == null) {
|
| 977 | shaderEspProjection = new ProjectionMatrixBuffer("combatant-shader-esp-projection");
|
| 978 | }
|
| 979 | Matrix4f espProjection = CombatantWorldMatrices.renderProjectionMatrix();
|
| 980 | if (espProjection == null) {
|
| 981 | espProjection = new Matrix4f(RenderState.worldProjection);
|
| 982 | }
|
| 983 | RenderSystem.setProjectionMatrix(shaderEspProjection.getBuffer(espProjection), ProjectionType.PERSPECTIVE);
|
| 984 | MeshRenderer.setProjection(espProjection);
|
| 985 | RenderState.worldProjection.set(espProjection);
|
| 986 | RenderState.rendering3D = true;
|
| 987 |
|
| 988 | var modelView = RenderSystem.getModelViewStack();
|
| 989 | modelView.pushMatrix();
|
| 990 | modelView.identity();
|
| 991 | Matrix4f capturedPosition = CombatantWorldMatrices.positionMatrix();
|
| 992 | if (capturedPosition != null) {
|
| 993 | modelView.mul(capturedPosition);
|
| 994 | } else if (mc.gameRenderer != null && mc.gameRenderer.mainCamera() != null) {
|
| 995 | modelView.mul(new Matrix4f().rotation(mc.gameRenderer.mainCamera().rotation().conjugate(new Quaternionf())));
|
| 996 | }
|
| 997 |
|
| 998 | PoseStack matrices = new PoseStack();
|
| 999 | boolean pushed = false;
|
| 1000 |
|
| 1001 | try (ShaderEspRenderContext.Scope ignored = ShaderEspRenderContext.enter()) {
|
| 1002 | LevelRendererAccessor accessor = (LevelRendererAccessor) worldRenderer;
|
| 1003 | LevelRenderState base = accessor.combatant$getWorldRenderState();
|
| 1004 | if (base == null || base.cameraRenderState == null) {
|
| 1005 | return false;
|
| 1006 | }
|
| 1007 |
|
| 1008 | LevelRenderState temp = new LevelRenderState();
|
| 1009 | temp.cameraRenderState = base.cameraRenderState;
|
| 1010 | temp.shouldShowEntityOutlines = true;
|
| 1011 |
|
| 1012 | shaderEspCommandQueue.getSubmitsPerOrder().clear();
|
| 1013 |
|
| 1014 | EntityRenderDispatcher entityRenderManager = mc.getEntityRenderDispatcher();
|
| 1015 | for (RenderEntry entry : entries) {
|
| 1016 | Entity entity = entry.entity();
|
| 1017 | EntityCullingCompat.forceVisibleForShaderEsp(entity);
|
| 1018 | EntityRenderer<?, ?> entityRenderer =
|
| 1019 | ((EntityRenderManagerAccessor) entityRenderManager).combatant$invokeGetRenderer(entity);
|
| 1020 | if (entityRenderer == null) {
|
| 1021 | continue;
|
| 1022 | }
|
| 1023 |
|
| 1024 | EntityRenderState state = ((EntityRendererAccessor) entityRenderer).combatant$invokeCreateRenderState();
|
| 1025 | ((EntityRendererAccessor) entityRenderer).combatant$invokeUpdateRenderState(entity, state, tickDelta);
|
| 1026 | if (state == null) {
|
| 1027 | continue;
|
| 1028 | }
|
| 1029 |
|
| 1030 | state.outlineColor = 0xFF000000 | (entry.color() & 0x00FFFFFF);
|
| 1031 | state.shadowRadius = 0.0f;
|
| 1032 | state.shadowPieces.clear();
|
| 1033 | state.nameTag = null;
|
| 1034 | state.nameTagAttachment = null;
|
| 1035 | temp.entityRenderStates.add(state);
|
| 1036 | }
|
| 1037 |
|
| 1038 | if (temp.entityRenderStates.isEmpty()) {
|
| 1039 | return false;
|
| 1040 | }
|
| 1041 |
|
| 1042 | FeatureRenderDispatcher dispatcher = getShaderEspRenderDispatcher();
|
| 1043 | if (dispatcher == null) {
|
| 1044 | return false;
|
| 1045 | }
|
| 1046 |
|
| 1047 | boolean standaloneDispatcher = dispatcher == shaderEspRenderDispatcher && shaderEspRenderBuffers != null;
|
| 1048 | accessor.combatant$invokeSubmitEntities(matrices, temp, shaderEspCommandQueue);
|
| 1049 | pushed = true;
|
| 1050 | try {
|
| 1051 | try (FeatureRenderDispatcher.PreparedFrame prepared = dispatcher.prepareFrame(shaderEspCommandQueue)) {
|
| 1052 | if (!prepared.hasAnyOutline()) {
|
| 1053 | return false;
|
| 1054 | }
|
| 1055 | prepared.executeOutline();
|
| 1056 | }
|
| 1057 | } finally {
|
| 1058 | if (standaloneDispatcher) {
|
| 1059 | shaderEspRenderBuffers.endFrame();
|
| 1060 | }
|
| 1061 | }
|
| 1062 | } finally {
|
| 1063 | modelView.popMatrix();
|
| 1064 | MeshRenderer.setProjection(prevMeshProjection);
|
| 1065 | RenderState.worldProjection.set(prevWorldProjection);
|
| 1066 | RenderState.rendering3D = prevRendering3D;
|
| 1067 | if (prevProjection != null && prevProjectionType != null) {
|
| 1068 | RenderSystem.setProjectionMatrix(prevProjection, prevProjectionType);
|
| 1069 | }
|
| 1070 | RenderSystem.outputColorTextureOverride = prevColor;
|
| 1071 | RenderSystem.outputDepthTextureOverride = prevDepth;
|
| 1072 | shaderEspCommandQueue.getSubmitsPerOrder().clear();
|
| 1073 | }
|
| 1074 |
|
| 1075 | return true;
|
| 1076 | }
|
| 1077 |
|
| 1078 | private FeatureRenderDispatcher getShaderEspRenderDispatcher() {
|
| 1079 | if (IrisCombatantFrameHooks.isRenderingAfterIrisFinalization()) {
|
| 1080 | return getStandaloneShaderEspRenderDispatcher();
|
| 1081 | }
|
| 1082 | if (mc != null && mc.levelRenderer instanceof LevelRendererAccessor accessor) {
|
| 1083 | FeatureRenderDispatcher dispatcher = accessor.combatant$getEntityRenderDispatcher();
|
| 1084 | if (dispatcher != null) {
|
| 1085 | return dispatcher;
|
| 1086 | }
|
| 1087 | }
|
| 1088 | return getStandaloneShaderEspRenderDispatcher();
|
| 1089 | }
|
| 1090 |
|
| 1091 | private FeatureRenderDispatcher getStandaloneShaderEspRenderDispatcher() {
|
| 1092 | if (shaderEspRenderDispatcher != null) {
|
| 1093 | return shaderEspRenderDispatcher;
|
| 1094 | }
|
| 1095 | if (mc.gameRenderer == null || mc.getModelManager() == null || mc.getAtlasManager() == null || mc.font == null) {
|
| 1096 | return null;
|
| 1097 | }
|
| 1098 | shaderEspRenderBuffers = new RenderBuffers(1);
|
| 1099 | shaderEspRenderDispatcher = new FeatureRenderDispatcher(
|
| 1100 | shaderEspRenderBuffers,
|
| 1101 | mc.getModelManager(),
|
| 1102 | mc.getAtlasManager(),
|
| 1103 | mc.font,
|
| 1104 | mc.gameRenderer.gameRenderState()
|
| 1105 | );
|
| 1106 | return shaderEspRenderDispatcher;
|
| 1107 | }
|
| 1108 |
|
| 1109 | private void renderSearchEntityOverlay(Renderer2D renderer, TextRenderer fallbackTextRenderer, float tickDelta, Vec3 camPos) {
|
| 1110 | List<RenderEntry> entries = collectSearchEntityEntries(camPos);
|
| 1111 | if (entries.isEmpty()) return;
|
| 1112 |
|
| 1113 | entries.sort(Comparator.comparingDouble(RenderEntry::distSq).reversed());
|
| 1114 |
|
| 1115 | TextRenderer labelRenderer = ScreenSpaceOverlay2D.labelRenderer(fallbackTextRenderer);
|
| 1116 | List<SearchLabelEntry> labels = new ArrayList<>();
|
| 1117 | boolean measureStarted = false;
|
| 1118 | if (!labelRenderer.isBuilding()) {
|
| 1119 | labelRenderer.begin(ScreenSpaceOverlay2D.TEXT_SCALE, true, false);
|
| 1120 | measureStarted = true;
|
| 1121 | }
|
| 1122 |
|
| 1123 | for (RenderEntry entry : entries) {
|
| 1124 | Entity entity = entry.entity();
|
| 1125 | AABB box = resolveWorldBox(entity, tickDelta, false);
|
| 1126 | ScreenSpaceOverlay2D.ScreenRect rect = ScreenSpaceOverlay2D.projectBox(box, tickDelta);
|
| 1127 | if (rect == null) continue;
|
| 1128 |
|
| 1129 | ScreenSpaceOverlay2D.LabelEntry label = createSearchEntityLabel(labelRenderer, entity, entry.color(), rect);
|
| 1130 | labels.add(new SearchLabelEntry(entry.entity(), entry.distSq(), rect, entry.color(), label));
|
| 1131 | }
|
| 1132 |
|
| 1133 | if (measureStarted) {
|
| 1134 | labelRenderer.end();
|
| 1135 | }
|
| 1136 | if (labels.isEmpty()) return;
|
| 1137 |
|
| 1138 | labels.sort(Comparator.comparingDouble(SearchLabelEntry::distSq).reversed());
|
| 1139 | for (SearchLabelEntry entry : labels) {
|
| 1140 | renderSearchEntityLabelPass(renderer, labelRenderer, entry);
|
| 1141 | }
|
| 1142 | }
|
| 1143 |
|
| 1144 | private void renderSearchEntityLabelPass(Renderer2D renderer,
|
| 1145 | TextRenderer labelRenderer,
|
| 1146 | SearchLabelEntry entry) {
|
| 1147 | ScreenSpaceOverlay2D.ScreenRect rect = entry.rect();
|
| 1148 | ScreenSpaceOverlay2D.LabelEntry label = entry.label();
|
| 1149 | MatteHudStyle.drawFrame(renderer, rect.minX(), rect.minY(), rect.width(), rect.height(), entry.color(), 1.0f);
|
| 1150 | if (shouldRenderHealthBar(entry.entity()) && healthBarInRange(entry.distSq())) {
|
| 1151 | drawHealthBar(renderer, rect.minX(), rect.minY(), rect.maxX(), rect.maxY(), entry.entity());
|
| 1152 | }
|
| 1153 | MatteHudStyle.drawLabelPlate(renderer, label.x(), label.y(), label.totalWidth(), label.height(), 1.0f);
|
| 1154 |
|
| 1155 | boolean renderStarted = false;
|
| 1156 | if (!labelRenderer.isBuilding()) {
|
| 1157 | labelRenderer.begin(ScreenSpaceOverlay2D.TEXT_SCALE);
|
| 1158 | renderStarted = true;
|
| 1159 | }
|
| 1160 | try {
|
| 1161 | ScreenSpaceOverlay2D.renderLabels(labelRenderer, List.of(label), false);
|
| 1162 | } finally {
|
| 1163 | if (renderStarted) {
|
| 1164 | labelRenderer.end();
|
| 1165 | }
|
| 1166 | }
|
| 1167 | Renderer2D.flushBatch(Renderer2D.FlushReason.EXPLICIT);
|
| 1168 | }
|
| 1169 |
|
| 1170 | private ScreenSpaceOverlay2D.LabelEntry createSearchEntityLabel(TextRenderer labelRenderer, Entity entity,
|
| 1171 | int baseColor,
|
| 1172 | ScreenSpaceOverlay2D.ScreenRect rect) {
|
| 1173 | String name = entity.getDisplayName() != null ? entity.getDisplayName().getString() : entity.getName().getString();
|
| 1174 | if (entity instanceof LivingEntity living) {
|
| 1175 | PlayerHealthResolver.HealthSnapshot health = PlayerHealthResolver.resolve(living);
|
| 1176 | float max = health.maxHealth();
|
| 1177 | if (max > 0.0f) {
|
| 1178 | float ratio = clamp01(health.totalHealth() / max);
|
| 1179 | String hpText = formatHealth(health.totalHealth());
|
| 1180 | return ScreenSpaceOverlay2D.createCenteredLabel(
|
| 1181 | labelRenderer,
|
| 1182 | name,
|
| 1183 | hpText,
|
| 1184 | baseColor,
|
| 1185 | withAlpha(healthRgb(ratio), 235),
|
| 1186 | rect
|
| 1187 | );
|
| 1188 | }
|
| 1189 | }
|
| 1190 | return ScreenSpaceOverlay2D.createCenteredLabel(labelRenderer, name, baseColor, rect);
|
| 1191 | }
|
| 1192 |
|
| 1193 | private void draw2DESP(Renderer2D renderer, Entity entity, float tickDelta, int baseColor, double distSq) {
|
| 1194 | AABB box = resolveWorldBox(entity, tickDelta, false);
|
| 1195 | ScreenBox screen = project(box, tickDelta);
|
| 1196 | if (screen == null) return;
|
| 1197 |
|
| 1198 | drawBoxESP(renderer, screen.minX(), screen.minY(), screen.maxX(), screen.maxY(), baseColor);
|
| 1199 | if (shouldRenderHealthBar(entity) && healthBarInRange(distSq)) {
|
| 1200 | drawHealthBar(renderer, screen.minX(), screen.minY(), screen.maxX(), screen.maxY(), entity);
|
| 1201 | }
|
| 1202 | }
|
| 1203 |
|
| 1204 | private AABB resolveWorldBox(Entity entity, float tickDelta, boolean hitboxExpanded) {
|
| 1205 | Vec3 pos = entity.getPosition(tickDelta);
|
| 1206 | AABB box = entity.getBoundingBox().move(
|
| 1207 | pos.x - entity.getX(),
|
| 1208 | pos.y - entity.getY(),
|
| 1209 | pos.z - entity.getZ()
|
| 1210 | );
|
| 1211 |
|
| 1212 | Hitbox hitbox = Modules.get(Hitbox.class);
|
| 1213 | if (hitboxExpanded && hitbox != null) {
|
| 1214 | box = box.inflate(hitbox.getPadding());
|
| 1215 | }
|
| 1216 |
|
| 1217 | return new AABB(box.minX, box.minY, box.minZ, box.maxX, box.maxY + AABB_TOP_OFFSET, box.maxZ);
|
| 1218 | }
|
| 1219 |
|
| 1220 | private ScreenBox project(AABB box, float tickDelta) {
|
| 1221 | Vec3[] pts = new Vec3[]{
|
| 1222 | new Vec3(box.minX, box.minY, box.minZ),
|
| 1223 | new Vec3(box.minX, box.minY, box.maxZ),
|
| 1224 | new Vec3(box.minX, box.maxY, box.minZ),
|
| 1225 | new Vec3(box.minX, box.maxY, box.maxZ),
|
| 1226 | new Vec3(box.maxX, box.minY, box.minZ),
|
| 1227 | new Vec3(box.maxX, box.minY, box.maxZ),
|
| 1228 | new Vec3(box.maxX, box.maxY, box.minZ),
|
| 1229 | new Vec3(box.maxX, box.maxY, box.maxZ)
|
| 1230 | };
|
| 1231 |
|
| 1232 | double minX = Double.POSITIVE_INFINITY;
|
| 1233 | double minY = Double.POSITIVE_INFINITY;
|
| 1234 | double maxX = Double.NEGATIVE_INFINITY;
|
| 1235 | double maxY = Double.NEGATIVE_INFINITY;
|
| 1236 |
|
| 1237 | for (Vec3 p : pts) {
|
| 1238 | Vec3 screen = ScreenProjection.worldToScreen(p, tickDelta);
|
| 1239 | if (screen == null) continue;
|
| 1240 | minX = Math.min(minX, screen.x);
|
| 1241 | minY = Math.min(minY, screen.y);
|
| 1242 | maxX = Math.max(maxX, screen.x);
|
| 1243 | maxY = Math.max(maxY, screen.y);
|
| 1244 | }
|
| 1245 |
|
| 1246 | if (minX == Double.POSITIVE_INFINITY) return null;
|
| 1247 | if (maxX <= minX || maxY <= minY) return null;
|
| 1248 |
|
| 1249 | if (PIXEL_SNAP) {
|
| 1250 | minX = Math.floor(minX);
|
| 1251 | minY = Math.floor(minY);
|
| 1252 | maxX = Math.ceil(maxX);
|
| 1253 | maxY = Math.ceil(maxY);
|
| 1254 | }
|
| 1255 |
|
| 1256 | return new ScreenBox(minX, minY, maxX, maxY);
|
| 1257 | }
|
| 1258 |
|
| 1259 | private void drawBoxESP(Renderer2D renderer, double minX, double minY, double maxX, double maxY, int baseColor) {
|
| 1260 | ColorResolver gradient;
|
| 1261 | if (usesCustomFrameColors()) {
|
| 1262 | gradient = new AnimatedFrameGradient(COLOR_ALPHA);
|
| 1263 | } else {
|
| 1264 | int baseRgb = baseColor & 0x00FFFFFF;
|
| 1265 | int darkRgb = mixRgb(baseRgb, 0x000000, GRAD_DARKEN);
|
| 1266 | int lightRgb = mixRgb(baseRgb, 0xFFFFFF, GRAD_LIGHTEN);
|
| 1267 | gradient = new Gradient(
|
| 1268 | withAlpha(lightRgb, COLOR_ALPHA),
|
| 1269 | withAlpha(baseRgb, COLOR_ALPHA),
|
| 1270 | withAlpha(lightRgb, COLOR_ALPHA),
|
| 1271 | withAlpha(darkRgb, COLOR_ALPHA)
|
| 1272 | );
|
| 1273 | }
|
| 1274 | int outline = withAlpha(0x000000, OUTLINE_ALPHA);
|
| 1275 | drawOutline(renderer,
|
| 1276 | minX - OUTLINE_EXPAND, minY - OUTLINE_EXPAND,
|
| 1277 | maxX + OUTLINE_EXPAND, maxY + OUTLINE_EXPAND,
|
| 1278 | OUTLINE_THICKNESS, SolidColor.of(outline));
|
| 1279 |
|
| 1280 | drawOutline(renderer, minX, minY, maxX, maxY, COLOR_THICKNESS, gradient);
|
| 1281 | double innerInset = COLOR_THICKNESS;
|
| 1282 | drawOutline(renderer,
|
| 1283 | minX + innerInset, minY + innerInset,
|
| 1284 | maxX - innerInset, maxY - innerInset,
|
| 1285 | OUTLINE_THICKNESS, SolidColor.of(outline));
|
| 1286 | }
|
| 1287 |
|
| 1288 | private boolean shouldRenderHealthBar(Entity entity) {
|
| 1289 | if (!healthBar.get() || is3DBox() || isShaderBox() || !(entity instanceof LivingEntity)) {
|
| 1290 | return false;
|
| 1291 | }
|
| 1292 | if (!(entity instanceof Player player)) {
|
| 1293 | return healthBarTargets.get("entities");
|
| 1294 | }
|
| 1295 |
|
| 1296 | CategoryType type = CategoryService.get(player);
|
| 1297 | return switch (type) {
|
| 1298 | case STAFF -> healthBarTargets.get("staff");
|
| 1299 | case FRIEND, BEDWARS_SELF -> healthBarTargets.get("friends");
|
| 1300 | case ENEMY, BEDWARS_ENEMY -> healthBarTargets.get("enemies");
|
| 1301 | case DEFAULT -> healthBarTargets.get("players");
|
| 1302 | };
|
| 1303 | }
|
| 1304 |
|
| 1305 | private boolean healthBarInRange(double distSq) {
|
| 1306 | if (!healthBarLimitDistance.get()) {
|
| 1307 | return true;
|
| 1308 | }
|
| 1309 | double maxDist = Math.max(0.0, healthBarDistance.get());
|
| 1310 | return distSq <= maxDist * maxDist;
|
| 1311 | }
|
| 1312 |
|
| 1313 | private void drawHealthBar(Renderer2D renderer, double x1, double y1, double x2, double y2, Entity entity) {
|
| 1314 | if (!(entity instanceof LivingEntity living)) return;
|
| 1315 | double height = y2 - y1;
|
| 1316 | if (height <= 0.0) return;
|
| 1317 |
|
| 1318 | PlayerHealthResolver.HealthSnapshot health = PlayerHealthResolver.resolve(living);
|
| 1319 | float max = health.maxHealth();
|
| 1320 | if (max <= 0f) return;
|
| 1321 | float current = health.totalHealth();
|
| 1322 | float ratio = clamp01(current / max);
|
| 1323 | float absorption = Math.max(0f, health.absorption());
|
| 1324 | float absorptionRatio = clamp01(absorption / max);
|
| 1325 |
|
| 1326 | double barX = x1 - HEALTH_BAR_GAP - HEALTH_BAR_WIDTH;
|
| 1327 | double barY = y1;
|
| 1328 |
|
| 1329 | renderer.quad(barX, barY, HEALTH_BAR_WIDTH, height, 0xFF000000);
|
| 1330 |
|
| 1331 | double inset = Math.min(HEALTH_BAR_INSET, Math.min(HEALTH_BAR_WIDTH * 0.45, height * 0.1));
|
| 1332 | double innerX = barX + inset;
|
| 1333 | double innerY = barY + inset;
|
| 1334 | double innerW = Math.max(0.0, HEALTH_BAR_WIDTH - inset * 2.0);
|
| 1335 | double innerH = Math.max(0.0, height - inset * 2.0);
|
| 1336 |
|
| 1337 | double fillH = innerH * ratio;
|
| 1338 | if (fillH <= 0.0) return;
|
| 1339 | double fillY = innerY + (innerH - fillH);
|
| 1340 | if (healthBarGradient.get()) {
|
| 1341 | float topT = clamp01((float) (fillH / Math.max(0.0001, innerH)));
|
| 1342 | int topRgb = mixRgb(0xFF0000, 0x00FF00, topT);
|
| 1343 | int bottomRgb = 0xFF0000;
|
| 1344 | renderer.quad(
|
| 1345 | innerX, fillY, innerW, fillH,
|
| 1346 | withAlpha(topRgb, HEALTH_ALPHA),
|
| 1347 | withAlpha(topRgb, HEALTH_ALPHA),
|
| 1348 | withAlpha(bottomRgb, HEALTH_ALPHA),
|
| 1349 | withAlpha(bottomRgb, HEALTH_ALPHA)
|
| 1350 | );
|
| 1351 | } else {
|
| 1352 | int rgb = healthRgb(ratio);
|
| 1353 | renderer.quad(innerX, fillY, innerW, fillH, withAlpha(rgb, HEALTH_ALPHA));
|
| 1354 | }
|
| 1355 |
|
| 1356 | if (absorptionRatio > 0f) {
|
| 1357 | float totalRatio = clamp01(current / max);
|
| 1358 | double absorbH = innerH * Math.min(absorptionRatio, totalRatio);
|
| 1359 | if (absorbH > 0.0) {
|
| 1360 | double absorbY = innerY + (innerH - absorbH);
|
| 1361 | renderer.quad(innerX, absorbY, innerW, absorbH, withAlpha(ABSORB_RGB, HEALTH_ALPHA));
|
| 1362 | }
|
| 1363 | }
|
| 1364 | }
|
| 1365 |
|
| 1366 | private void drawOutline(Renderer2D renderer, double x1, double y1, double x2, double y2,
|
| 1367 | double thickness, ColorResolver colors) {
|
| 1368 | double width = x2 - x1;
|
| 1369 | double height = y2 - y1;
|
| 1370 | if (width <= 0 || height <= 0 || thickness <= 0.0) return;
|
| 1371 |
|
| 1372 | if (isCornerBox()) {
|
| 1373 | drawOutlineCorners(renderer, x1, y1, x2, y2, thickness, colors);
|
| 1374 | return;
|
| 1375 | }
|
| 1376 |
|
| 1377 | drawGradientQuad(renderer, x1, y1, x2, y1 + thickness, x1, y1, x2, y2, colors);
|
| 1378 | drawGradientQuad(renderer, x1, y2 - thickness, x2, y2, x1, y1, x2, y2, colors);
|
| 1379 | drawGradientQuad(renderer, x1, y1, x1 + thickness, y2, x1, y1, x2, y2, colors);
|
| 1380 | drawGradientQuad(renderer, x2 - thickness, y1, x2, y2, x1, y1, x2, y2, colors);
|
| 1381 | }
|
| 1382 |
|
| 1383 | private void drawOutlineCorners(Renderer2D renderer, double x1, double y1, double x2, double y2,
|
| 1384 | double thickness, ColorResolver colors) {
|
| 1385 | double width = x2 - x1;
|
| 1386 | double height = y2 - y1;
|
| 1387 | if (width <= 0 || height <= 0) return;
|
| 1388 |
|
| 1389 | double seg = Math.min(width, height) * CORNER_SEGMENT_FRACTION;
|
| 1390 | double minSeg = thickness * 2.0;
|
| 1391 | double segX = Math.min(width * 0.5, Math.max(seg, minSeg));
|
| 1392 | double segY = Math.min(height * 0.5, Math.max(seg, minSeg));
|
| 1393 |
|
| 1394 | drawCornerSegment(renderer, x1, y1, x1 + segX, y1 + thickness, x1, y1, x2, y2, colors);
|
| 1395 | drawCornerSegment(renderer, x1, y1, x1 + thickness, y1 + segY, x1, y1, x2, y2, colors);
|
| 1396 |
|
| 1397 | drawCornerSegment(renderer, x2 - segX, y1, x2, y1 + thickness, x1, y1, x2, y2, colors);
|
| 1398 | drawCornerSegment(renderer, x2 - thickness, y1, x2, y1 + segY, x1, y1, x2, y2, colors);
|
| 1399 |
|
| 1400 | drawCornerSegment(renderer, x1, y2 - thickness, x1 + segX, y2, x1, y1, x2, y2, colors);
|
| 1401 | drawCornerSegment(renderer, x1, y2 - segY, x1 + thickness, y2, x1, y1, x2, y2, colors);
|
| 1402 |
|
| 1403 | drawCornerSegment(renderer, x2 - segX, y2 - thickness, x2, y2, x1, y1, x2, y2, colors);
|
| 1404 | drawCornerSegment(renderer, x2 - thickness, y2 - segY, x2, y2, x1, y1, x2, y2, colors);
|
| 1405 | }
|
| 1406 |
|
| 1407 | private void drawCornerSegment(Renderer2D renderer,
|
| 1408 | double sx1, double sy1, double sx2, double sy2,
|
| 1409 | double boxX1, double boxY1, double boxX2, double boxY2,
|
| 1410 | ColorResolver colors) {
|
| 1411 | drawGradientQuad(renderer, sx1, sy1, sx2, sy2, boxX1, boxY1, boxX2, boxY2, colors);
|
| 1412 | }
|
| 1413 |
|
| 1414 | private void drawGradientQuad(Renderer2D renderer,
|
| 1415 | double sx1, double sy1, double sx2, double sy2,
|
| 1416 | double boxX1, double boxY1, double boxX2, double boxY2,
|
| 1417 | ColorResolver colors) {
|
| 1418 | double width = sx2 - sx1;
|
| 1419 | double height = sy2 - sy1;
|
| 1420 | if (width <= 0.0 || height <= 0.0) return;
|
| 1421 |
|
| 1422 | if (colors instanceof AnimatedFrameGradient && usesAnimatedFrameColors()) {
|
| 1423 | double major = Math.max(width, height);
|
| 1424 | int steps = Math.max(1, Math.min(24, (int) Math.ceil(major / 6.0)));
|
| 1425 | if (steps > 1) {
|
| 1426 | if (width >= height) {
|
| 1427 | for (int i = 0; i < steps; i++) {
|
| 1428 | double ax1 = sx1 + width * (i / (double) steps);
|
| 1429 | double ax2 = sx1 + width * ((i + 1.0) / steps);
|
| 1430 | drawGradientQuadSingle(renderer, ax1, sy1, ax2, sy2,
|
| 1431 | boxX1, boxY1, boxX2, boxY2, colors);
|
| 1432 | }
|
| 1433 | } else {
|
| 1434 | for (int i = 0; i < steps; i++) {
|
| 1435 | double ay1 = sy1 + height * (i / (double) steps);
|
| 1436 | double ay2 = sy1 + height * ((i + 1.0) / steps);
|
| 1437 | drawGradientQuadSingle(renderer, sx1, ay1, sx2, ay2,
|
| 1438 | boxX1, boxY1, boxX2, boxY2, colors);
|
| 1439 | }
|
| 1440 | }
|
| 1441 | return;
|
| 1442 | }
|
| 1443 | }
|
| 1444 |
|
| 1445 | drawGradientQuadSingle(renderer, sx1, sy1, sx2, sy2,
|
| 1446 | boxX1, boxY1, boxX2, boxY2, colors);
|
| 1447 | }
|
| 1448 |
|
| 1449 | private static void drawGradientQuadSingle(Renderer2D renderer,
|
| 1450 | double sx1, double sy1, double sx2, double sy2,
|
| 1451 | double boxX1, double boxY1, double boxX2, double boxY2,
|
| 1452 | ColorResolver colors) {
|
| 1453 | renderer.quad(
|
| 1454 | sx1, sy1, sx2 - sx1, sy2 - sy1,
|
| 1455 | colors.colorAt(sx1, sy1, boxX1, boxY1, boxX2, boxY2),
|
| 1456 | colors.colorAt(sx2, sy1, boxX1, boxY1, boxX2, boxY2),
|
| 1457 | colors.colorAt(sx2, sy2, boxX1, boxY1, boxX2, boxY2),
|
| 1458 | colors.colorAt(sx1, sy2, boxX1, boxY1, boxX2, boxY2)
|
| 1459 | );
|
| 1460 | }
|
| 1461 |
|
| 1462 | private void add3DBox(MeshBuilder tris, MeshBuilder lines, AABB box, int argb) {
|
| 1463 | int rgb = argb & 0x00FFFFFF;
|
| 1464 | int fillAlpha = alpha255(box3dFillAlpha.get());
|
| 1465 | int outlineAlpha = alpha255(box3dOutlineAlpha.get());
|
| 1466 | float gradientStrength = Math.max(0.0f, Math.min(2.5f, box3dGradientStrength.get()));
|
| 1467 |
|
| 1468 | int c000 = boxGradientColor(rgb, box, box.minX, box.minY, box.minZ, fillAlpha, gradientStrength);
|
| 1469 | int c001 = boxGradientColor(rgb, box, box.minX, box.minY, box.maxZ, fillAlpha, gradientStrength);
|
| 1470 | int c010 = boxGradientColor(rgb, box, box.minX, box.maxY, box.minZ, fillAlpha, gradientStrength);
|
| 1471 | int c011 = boxGradientColor(rgb, box, box.minX, box.maxY, box.maxZ, fillAlpha, gradientStrength);
|
| 1472 | int c100 = boxGradientColor(rgb, box, box.maxX, box.minY, box.minZ, fillAlpha, gradientStrength);
|
| 1473 | int c101 = boxGradientColor(rgb, box, box.maxX, box.minY, box.maxZ, fillAlpha, gradientStrength);
|
| 1474 | int c110 = boxGradientColor(rgb, box, box.maxX, box.maxY, box.minZ, fillAlpha, gradientStrength);
|
| 1475 | int c111 = boxGradientColor(rgb, box, box.maxX, box.maxY, box.maxZ, fillAlpha, gradientStrength);
|
| 1476 |
|
| 1477 | addFilledBox(tris, box, c000, c001, c010, c011, c100, c101, c110, c111);
|
| 1478 | addOutlineBox(lines, box,
|
| 1479 | withAlpha(c000, outlineAlpha),
|
| 1480 | withAlpha(c001, outlineAlpha),
|
| 1481 | withAlpha(c010, outlineAlpha),
|
| 1482 | withAlpha(c011, outlineAlpha),
|
| 1483 | withAlpha(c100, outlineAlpha),
|
| 1484 | withAlpha(c101, outlineAlpha),
|
| 1485 | withAlpha(c110, outlineAlpha),
|
| 1486 | withAlpha(c111, outlineAlpha));
|
| 1487 | }
|
| 1488 |
|
| 1489 | public boolean shouldRenderHitboxReplacement(Entity entity) {
|
| 1490 | if (!isEnabled() || !is3DBox()) return false;
|
| 1491 | if (entity == null) return false;
|
| 1492 | if (entity instanceof Player player) {
|
| 1493 | return shouldRenderPlayer(player) && shouldUseHitboxExpansion(entity);
|
| 1494 | }
|
| 1495 | return false;
|
| 1496 | }
|
| 1497 |
|
| 1498 | private boolean shouldUseHitboxExpansion(Entity entity) {
|
| 1499 | Hitbox hitbox = Modules.get(Hitbox.class);
|
| 1500 | return hitbox != null && hitbox.isReplacementCandidate(entity);
|
| 1501 | }
|
| 1502 |
|
| 1503 | public boolean shouldLiftNameTagsSection(Player player) {
|
| 1504 | return isEnabled() && isNameTagsLiftBoxMode() && shouldRenderPlayer(player);
|
| 1505 | }
|
| 1506 |
|
| 1507 | private boolean isNameTagsLiftBoxMode() {
|
| 1508 | return MODE_FULL.equalsIgnoreCase(boxMode.get())
|
| 1509 | || MODE_CORNERS.equalsIgnoreCase(boxMode.get());
|
| 1510 | }
|
| 1511 |
|
| 1512 | private boolean isShaderSmokeFill() {
|
| 1513 | return SHADER_FILL_SMOKE.equalsIgnoreCase(shaderFillStyle.get());
|
| 1514 | }
|
| 1515 |
|
| 1516 | private boolean isCornerBox() {
|
| 1517 | return MODE_CORNERS.equalsIgnoreCase(boxMode.get());
|
| 1518 | }
|
| 1519 |
|
| 1520 | private boolean is3DBox() {
|
| 1521 | return MODE_3D.equalsIgnoreCase(boxMode.get());
|
| 1522 | }
|
| 1523 |
|
| 1524 | private boolean isShaderBox() {
|
| 1525 | return MODE_SHADER.equalsIgnoreCase(boxMode.get());
|
| 1526 | }
|
| 1527 |
|
| 1528 | @FunctionalInterface
|
| 1529 | private interface ColorResolver {
|
| 1530 | int colorAt(double x, double y, double boxX1, double boxY1, double boxX2, double boxY2);
|
| 1531 | }
|
| 1532 |
|
| 1533 | private record RenderEntry(Entity entity, int color, double distSq) {
|
| 1534 | }
|
| 1535 |
|
| 1536 | private record SearchLabelEntry(Entity entity, double distSq, ScreenSpaceOverlay2D.ScreenRect rect, int color,
|
| 1537 | ScreenSpaceOverlay2D.LabelEntry label) {
|
| 1538 | }
|
| 1539 |
|
| 1540 | private record ScreenBox(double minX, double minY, double maxX, double maxY) {
|
| 1541 | }
|
| 1542 |
|
| 1543 | private record SolidColor(int color) implements ColorResolver {
|
| 1544 | static SolidColor of(int color) {
|
| 1545 | return new SolidColor(color);
|
| 1546 | }
|
| 1547 |
|
| 1548 | @Override
|
| 1549 | public int colorAt(double x, double y, double boxX1, double boxY1, double boxX2, double boxY2) {
|
| 1550 | return color;
|
| 1551 | }
|
| 1552 | }
|
| 1553 |
|
| 1554 | private final class AnimatedFrameGradient implements ColorResolver {
|
| 1555 | private final int alpha;
|
| 1556 |
|
| 1557 | private AnimatedFrameGradient(int alpha) {
|
| 1558 | this.alpha = alpha;
|
| 1559 | }
|
| 1560 |
|
| 1561 | @Override
|
| 1562 | public int colorAt(double x, double y, double boxX1, double boxY1, double boxX2, double boxY2) {
|
| 1563 | double width = Math.max(1.0e-6, boxX2 - boxX1);
|
| 1564 | double height = Math.max(1.0e-6, boxY2 - boxY1);
|
| 1565 | double tx = (x - boxX1) / width;
|
| 1566 | double ty = (y - boxY1) / height;
|
| 1567 | return customPaletteColor(tx, ty, alpha);
|
| 1568 | }
|
| 1569 | }
|
| 1570 |
|
| 1571 | private record Gradient(int topLeft, int topRight, int bottomRight, int bottomLeft) implements ColorResolver {
|
| 1572 | private static double safeRatio(double value, double length) {
|
| 1573 | if (length <= 0.0001) return 0.0;
|
| 1574 | if (value <= 0.0) return 0.0;
|
| 1575 | if (value >= length) return 1.0;
|
| 1576 | return value / length;
|
| 1577 | }
|
| 1578 |
|
| 1579 | @Override
|
| 1580 | public int colorAt(double x, double y, double boxX1, double boxY1, double boxX2, double boxY2) {
|
| 1581 | double tx = safeRatio(x - boxX1, boxX2 - boxX1);
|
| 1582 | double ty = safeRatio(y - boxY1, boxY2 - boxY1);
|
| 1583 |
|
| 1584 | int top = mixArgb(topLeft, topRight, (float) tx);
|
| 1585 | int bottom = mixArgb(bottomLeft, bottomRight, (float) tx);
|
| 1586 | return mixArgb(top, bottom, (float) ty);
|
| 1587 | }
|
| 1588 | }
|
| 1589 |
|
| 1590 | private final class ShaderEspPass implements PostProcessPass, PostProcessBackendResourceOwner {
|
| 1591 | @Override
|
| 1592 | public boolean isActive() {
|
| 1593 | return ESP.this.isEnabled()
|
| 1594 | && ESP.this.isShaderBox()
|
| 1595 | && mc.player != null
|
| 1596 | && mc.level != null;
|
| 1597 | }
|
| 1598 |
|
| 1599 | @Override
|
| 1600 | public Phase getPhase() {
|
| 1601 | return Phase.PRE_HAND;
|
| 1602 | }
|
| 1603 |
|
| 1604 | @Override
|
| 1605 | public boolean render(PostProcessExecutionContext execution) {
|
| 1606 | if (execution == null || execution.context() == null) return false;
|
| 1607 | return ESP.this.renderShaderEsp(
|
| 1608 | execution.source(), execution.destination(), execution.context().tickDelta());
|
| 1609 | }
|
| 1610 |
|
| 1611 | @Override
|
| 1612 | public void releaseBackendResources(CombatantRhi owner) {
|
| 1613 | shaderEspComputeBlur.release(owner);
|
| 1614 | }
|
| 1615 | }
|
| 1616 | }
|
| 1617 |
|