Начинающий
- Статус
- Оффлайн
- Регистрация
- 5 Мар 2026
- Сообщения
- 9
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
сливаю вам вот такие прикольные чамсы, т.к. они меня уже заебали со своими багами, кто хочет - сможет довести до идеала, у меня просто нету времени, думаю будет кому полезно
SS -
SS -
Пожалуйста, авторизуйтесь для просмотра ссылки.
Java:
package tech.phantom.client.modules.impl.render;
import com.darkmagician6.eventapi.EventTarget;
import com.mojang.blaze3d.platform.GlStateManager.DstFactor;
import com.mojang.blaze3d.platform.GlStateManager.SrcFactor;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gl.ShaderProgramKeys;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.*;
import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import org.joml.Matrix4f;
import org.joml.Vector3f;
import org.lwjgl.opengl.GL11;
import tech.phantom.base.events.impl.entity.EventRenderEntity;
import tech.phantom.client.modules.api.Category;
import tech.phantom.client.modules.api.Module;
import tech.phantom.client.modules.api.ModuleAnnotation;
import tech.phantom.client.modules.api.setting.impl.BooleanSetting;
import tech.phantom.client.modules.api.setting.impl.ModeSetting;
import tech.phantom.client.modules.api.setting.impl.NumberSetting;
import tech.phantom.phantom;
import tech.phantom.utility.render.display.base.color.ColorRGBA;
@ModuleAnnotation(name = "Chams", category = Category.RENDER, description = "Цветная модель игроков из боксов")
public class Chams extends Module {
public static final Chams INSTANCE = new Chams();
private final ModeSetting targets = new ModeSetting("Цели");
private final ModeSetting.Value targetsAll = new ModeSetting.Value(targets, "Все").select();
private final ModeSetting.Value targetsEnemies = new ModeSetting.Value(targets, "Враги");
private final ModeSetting.Value targetsFriends = new ModeSetting.Value(targets, "Друзья");
private final BooleanSetting useThemeColor = new BooleanSetting("Цвет темы", true);
private final NumberSetting colorR = new NumberSetting("R", 255f, 0f, 255f, 1f, () -> !useThemeColor.isEnabled());
private final NumberSetting colorG = new NumberSetting("G", 100f, 0f, 255f, 1f, () -> !useThemeColor.isEnabled());
private final NumberSetting colorB = new NumberSetting("B", 100f, 0f, 255f, 1f, () -> !useThemeColor.isEnabled());
private final NumberSetting alpha = new NumberSetting("Прозрачность", 160f, 10f, 255f, 5f);
private final NumberSetting fillAlpha = new NumberSetting("Прозрачность заливки", 50f, 5f, 200f, 5f);
private final NumberSetting lineWidth = new NumberSetting("Толщина линий", 1.5f, 0.5f, 5f, 0.5f);
private final NumberSetting layers = new NumberSetting("Слои", 1f, 1f, 3f, 1f);
private final BooleanSetting throughWalls = new BooleanSetting("Сквозь стены", true);
private Chams() {}
public static volatile boolean suppressFeatures = false;
public static final java.util.Set<String> chamsPlayers = java.util.Collections.newSetFromMap(new java.util.concurrent.ConcurrentHashMap<>());
// ОПТИМИЗАЦИЯ: Кэш для cuboids
private static final java.util.Map<ModelPart, java.util.List<ModelPart.Cuboid>> CUBOID_CACHE = new java.util.concurrent.ConcurrentHashMap<>();
private static java.lang.reflect.Field cuboidField = null;
static {
try {
for (java.lang.reflect.Field f : ModelPart.class.getDeclaredFields()) {
if (f.getType() == java.util.List.class) {
f.setAccessible(true);
cuboidField = f;
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public boolean shouldHidePlayer(PlayerEntity player) {
if (!isEnabled()) return false;
if (player == mc.player && mc.options.getPerspective().isFirstPerson()) return false;
boolean isFriend = phantom.getInstance().getFriendManager()
.isFriend(player.getGameProfile().getName());
if (targetsEnemies.isSelected() && isFriend) return false;
if (targetsFriends.isSelected() && !isFriend) return false;
return true;
}
@EventTarget
public void onRenderEntity(EventRenderEntity event) {
if (!(event.entity instanceof PlayerEntity player)) return;
if (!shouldHidePlayer(player)) return;
if (!(event.state instanceof PlayerEntityRenderState)) return;
if (!(event.model instanceof PlayerEntityModel playerModel)) return;
boolean isFriend = phantom.getInstance().getFriendManager()
.isFriend(player.getGameProfile().getName());
boolean depth = !throughWalls.isEnabled();
float lw = lineWidth.getCurrent();
int numLayers = (int) layers.getCurrent();
MatrixStack ms = event.matrixStack;
for (int i = 0; i < numLayers; i++) {
float expand = i * 0.012f;
int layerAlpha = Math.max(10, (int)(alpha.getCurrent() / (1f + i * 1.5f)));
int layerFillAlpha = Math.max(5, (int)(fillAlpha.getCurrent() / (1f + i * 1.5f)));
int lineCol = getColor(isFriend, layerAlpha).getRGB();
int fillCol = getColor(isFriend, layerFillAlpha).getRGB();
renderPart(ms, playerModel.head, lineCol, fillCol, depth, lw, expand);
renderPart(ms, playerModel.body, lineCol, fillCol, depth, lw, expand);
renderPart(ms, playerModel.rightArm, lineCol, fillCol, depth, lw, expand);
renderPart(ms, playerModel.leftArm, lineCol, fillCol, depth, lw, expand);
renderPart(ms, playerModel.rightLeg, lineCol, fillCol, depth, lw, expand);
renderPart(ms, playerModel.leftLeg, lineCol, fillCol, depth, lw, expand);
}
event.cancel();
}
@SuppressWarnings("unchecked")
private void renderPart(MatrixStack ms, ModelPart part, int lineCol, int fillCol, boolean depth, float lw, float expand) {
ms.push();
part.rotate(ms);
MatrixStack.Entry entry = ms.peek();
// ОПТИМИЗАЦИЯ: Кэш вместо рефлексии каждый кадр
java.util.List<ModelPart.Cuboid> cuboids = CUBOID_CACHE.get(part);
if (cuboids == null && cuboidField != null) {
try {
cuboids = (java.util.List<ModelPart.Cuboid>) cuboidField.get(part);
if (cuboids != null && !cuboids.isEmpty()) {
CUBOID_CACHE.put(part, cuboids);
}
} catch (Exception ignored) {}
}
if (cuboids != null) {
for (ModelPart.Cuboid cuboid : cuboids) {
float x1 = cuboid.minX / 16f - expand;
float y1 = cuboid.minY / 16f - expand;
float z1 = cuboid.minZ / 16f - expand;
float x2 = cuboid.maxX / 16f + expand;
float y2 = cuboid.maxY / 16f + expand;
float z2 = cuboid.maxZ / 16f + expand;
renderCuboid(entry, x1, y1, z1, x2, y2, z2, lineCol, fillCol, depth, lw);
}
}
ms.pop();
}
private void renderCuboid(MatrixStack.Entry entry, float x1, float y1, float z1,
float x2, float y2, float z2,
int lineCol, int fillCol, boolean depth, float lw) {
int la = (lineCol >> 24) & 0xFF, lr = (lineCol >> 16) & 0xFF,
lg = (lineCol >> 8) & 0xFF, lb = lineCol & 0xFF;
int fa = (fillCol >> 24) & 0xFF, fr = (fillCol >> 16) & 0xFF,
fg = (fillCol >> 8) & 0xFF, fb = fillCol & 0xFF;
Matrix4f mat = entry.getPositionMatrix();
RenderSystem.enableBlend();
RenderSystem.blendFunc(SrcFactor.SRC_ALPHA, DstFactor.ONE_MINUS_CONSTANT_ALPHA);
RenderSystem.disableCull();
if (!depth) {
RenderSystem.disableDepthTest();
} else {
RenderSystem.enableDepthTest();
RenderSystem.depthFunc(GL11.GL_ALWAYS);
}
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
GL11.glPolygonOffset(-1.0f, -1.0f);
RenderSystem.depthMask(false);
RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR);
BufferBuilder fill = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
// bottom
fill.vertex(mat, x1, y1, z1).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y1, z1).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y1, z2).color(fr, fg, fb, fa);
fill.vertex(mat, x1, y1, z2).color(fr, fg, fb, fa);
// top
fill.vertex(mat, x1, y2, z1).color(fr, fg, fb, fa);
fill.vertex(mat, x1, y2, z2).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y2, z2).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y2, z1).color(fr, fg, fb, fa);
// north
fill.vertex(mat, x1, y1, z1).color(fr, fg, fb, fa);
fill.vertex(mat, x1, y2, z1).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y2, z1).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y1, z1).color(fr, fg, fb, fa);
// south
fill.vertex(mat, x1, y1, z2).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y1, z2).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y2, z2).color(fr, fg, fb, fa);
fill.vertex(mat, x1, y2, z2).color(fr, fg, fb, fa);
// west
fill.vertex(mat, x1, y1, z1).color(fr, fg, fb, fa);
fill.vertex(mat, x1, y1, z2).color(fr, fg, fb, fa);
fill.vertex(mat, x1, y2, z2).color(fr, fg, fb, fa);
fill.vertex(mat, x1, y2, z1).color(fr, fg, fb, fa);
// east
fill.vertex(mat, x2, y1, z1).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y2, z1).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y2, z2).color(fr, fg, fb, fa);
fill.vertex(mat, x2, y1, z2).color(fr, fg, fb, fa);
BufferRenderer.drawWithGlobalProgram(fill.end());
RenderSystem.depthMask(true);
GL11.glPolygonOffset(-2.0f, -2.0f);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES);
RenderSystem.lineWidth(lw);
BufferBuilder line = Tessellator.getInstance().begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
drawEdge(line, entry, x1,y1,z1, x2,y1,z1, lr,lg,lb,la);
drawEdge(line, entry, x2,y1,z1, x2,y1,z2, lr,lg,lb,la);
drawEdge(line, entry, x2,y1,z2, x1,y1,z2, lr,lg,lb,la);
drawEdge(line, entry, x1,y1,z2, x1,y1,z1, lr,lg,lb,la);
drawEdge(line, entry, x1,y2,z1, x2,y2,z1, lr,lg,lb,la);
drawEdge(line, entry, x2,y2,z1, x2,y2,z2, lr,lg,lb,la);
drawEdge(line, entry, x2,y2,z2, x1,y2,z2, lr,lg,lb,la);
drawEdge(line, entry, x1,y2,z2, x1,y2,z1, lr,lg,lb,la);
drawEdge(line, entry, x1,y1,z1, x1,y2,z1, lr,lg,lb,la);
drawEdge(line, entry, x2,y1,z1, x2,y2,z1, lr,lg,lb,la);
drawEdge(line, entry, x2,y1,z2, x2,y2,z2, lr,lg,lb,la);
drawEdge(line, entry, x1,y1,z2, x1,y2,z2, lr,lg,lb,la);
BufferRenderer.drawWithGlobalProgram(line.end());
RenderSystem.lineWidth(1f);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
GL11.glPolygonOffset(0.0f, 0.0f);
GL11.glPolygonOffset(0.0f, 0.0f);
if (depth) {
RenderSystem.depthFunc(GL11.GL_LEQUAL);
}
if (!depth) RenderSystem.enableDepthTest();
RenderSystem.enableCull();
RenderSystem.disableBlend();
}
private void drawEdge(BufferBuilder buf, MatrixStack.Entry entry,
float x1, float y1, float z1,
float x2, float y2, float z2,
int r, int g, int b, int a) {
float dx = x2 - x1, dy = y2 - y1, dz = z2 - z1;
float len = (float) Math.sqrt(dx * dx + dy * dy + dz * dz);
if (len == 0) return;
Vector3f normal = entry.transformNormal(dx / len, dy / len, dz / len, new Vector3f());
Matrix4f mat = entry.getPositionMatrix();
buf.vertex(mat, x1, y1, z1).color(r, g, b, a).normal(normal.x, normal.y, normal.z);
buf.vertex(mat, x2, y2, z2).color(r, g, b, a).normal(normal.x, normal.y, normal.z);
}
private ColorRGBA getColor(boolean isFriend, int a) {
if (isFriend) return new ColorRGBA(0, 220, 80, a);
if (useThemeColor.isEnabled())
return phantom.getInstance().getThemeManager().getCurrentTheme().getColor().withAlpha(a);
return new ColorRGBA((int)colorR.getCurrent(), (int)colorG.getCurrent(), (int)colorB.getCurrent(), a);
}
}
Последнее редактирование: