Начинающий
- Статус
- Онлайн
- Регистрация
- 20 Июн 2025
- Сообщения
- 25
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
увидел эту функцию в васте ленде, снял для вас обфускацию с функции и сливаю его вам. Если честно хз зайдет вам или нет, но думаю пастеры сожрут
ss нету тк простой показ информации о шахте
ss нету тк простой показ информации о шахте
MineHelper:
package dev.wasteland.client.managers.module.impl.misc;
import dev.wasteland.client.api.events.orbit.EventTarget;
import dev.wasteland.client.api.interfaces.Minecraft;
import dev.wasteland.client.managers.events.render.Render2DEvent;
import dev.wasteland.client.managers.events.render.Render3DEvent;
import dev.wasteland.client.managers.module.Category;
import dev.wasteland.client.managers.module.Module;
import dev.wasteland.client.managers.module.ModuleInfo;
import dev.wasteland.client.managers.module.impl.render.HUD;
import dev.wasteland.client.managers.module.settings.impl.BooleanSetting;
import dev.wasteland.client.managers.module.settings.impl.FloatSetting;
import dev.wasteland.client.managers.module.settings.impl.ModeSetting;
import dev.wasteland.client.managers.module.settings.impl.MultiSelectSetting;
import dev.wasteland.client.utils.other.ModuleUtils;
import dev.wasteland.client.utils.render.color.ColorUtils;
import dev.wasteland.client.utils.render.draw.BoxRenderer;
import dev.wasteland.client.utils.render.draw.RectUtil;
import dev.wasteland.client.utils.render.draw.RenderUtil;
import dev.wasteland.client.utils.render.draw.RoundedCorners;
import dev.wasteland.client.utils.render.font.Fonts;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.shapes.VoxelShape;
import org.lwjgl.opengl.GL11;
import java.awt.Color;
import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ModuleInfo(
name = "MineHelper",
category = Category.MISC,
description = "Таджек + рынок"
)
public class MineHelper extends Module {
@Getter
public final MultiSelectSetting oresSettings = new MultiSelectSetting(
this,
"Руды",
new BooleanSetting("Уголь", true),
new BooleanSetting("Железо", true),
new BooleanSetting("Редстоун", true),
new BooleanSetting("Золото", true),
new BooleanSetting("Изумруды", true),
new BooleanSetting("Алмазы", true),
new BooleanSetting("Незерит", true),
new BooleanSetting("Лазурит", true),
new BooleanSetting("Адская золотая руда", true)
);
@Getter
public final BooleanSetting showMine = new BooleanSetting(this, "Показывать шахту", true);
@Getter
public final BooleanSetting showOres = new BooleanSetting(this, "Показывать руды", true);
@Getter
private final MultiSelectSetting renderSettings;
@Getter
private final ModeSetting highlightType;
@Getter
private final FloatSetting borderScale;
@Getter
private final FloatSetting searchRadius;
@Getter
private final FloatSetting boxesPerFrame;
@Getter
private final FloatSetting cacheUpdateFrequency;
@Getter
public final Pattern timePattern;
@Getter
private final Map<BlockPos, OreInfo> oreCache;
@Getter
private BlockPos lastPlayerPos;
@Getter
private long lastUpdateTime;
public MineHelper() {
this.renderSettings = new MultiSelectSetting(
this,
"Рендеринг",
new BooleanSetting("Заливка", true),
new BooleanSetting("Обводка", true),
new BooleanSetting("Штрихи", false)
).setVisibility(() -> showOres.getValue());
this.highlightType = new ModeSetting(
this,
"Тип выделения",
"По боксу",
"По боксу",
"По границам"
).setVisibility(() -> showOres.getValue());
this.borderScale = new FloatSetting(
this,
"Масштаб границ",
0.05F,
0.01F,
0.1F,
0.005F
).setVisibility(() -> showOres.getValue());
this.searchRadius = new FloatSetting(
this,
"Радиус поиска",
24.0F,
8.0F,
48.0F,
1.0F
).setVisibility(() -> showOres.getValue());
this.boxesPerFrame = new FloatSetting(
this,
"Лимит боксов/кадр",
400.0F,
50.0F,
1500.0F,
10.0F
).setVisibility(() -> showOres.getValue());
this.cacheUpdateFrequency = new FloatSetting(
this,
"Частота обновления кэша (мс)",
1000.0F,
500.0F,
5000.0F,
100.0F
).setVisibility(() -> showOres.getValue());
this.timePattern = Pattern.compile("^(\\d{1,2}):(\\d{2})$");
this.oreCache = new HashMap<>();
this.lastPlayerPos = null;
this.lastUpdateTime = 0L;
}
public static MineHelper getInstance() {
return ModuleUtils.getModule(MineHelper.class);
}
@Override
public void onDisable() {
super.onDisable();
oreCache.clear();
lastPlayerPos = null;
lastUpdateTime = 0L;
}
private static void renderBackground(MatrixStack matrixStack, int x, int y, int width, int height) {
HUD.getInstance().drawBlur(matrixStack, (float)x, (float)y, (float)width, (float)height, 1.0F);
}
@EventTarget
public void onRender2D(Render2DEvent event) {
if (!showMine.getValue()) {
return;
}
Minecraft mc = Minecraft.getInstance();
if (mc == null || mc.player == null || mc.world == null) {
return;
}
MatrixStack matrixStack = event.getMatrixStack();
List<ArmorStandEntity> armorStands = getArmorStands(mc);
String mineName = "";
for (ArmorStandEntity entity : armorStands) {
String rawName = entity.getName().getString().trim();
if (rawName.contains("Следующая:")) {
rawName = rawName.replaceAll("§[0-9a-fklmnor]", "");
mineName = rawName.replace("Следующая:", "").trim();
break;
}
}
String timerValue = "";
for (ArmorStandEntity entity : armorStands) {
String name = entity.getName().getString().trim();
if (name.contains("Обновление через:")) {
ArmorStandEntity closestTimer = null;
double bestDistance = Double.MAX_VALUE;
for (ArmorStandEntity candidate : armorStands) {
String candidateName = candidate.getName().getString().trim();
if (timePattern.matcher(candidateName).matches()) {
double dy = Math.abs(candidate.getPosY() - entity.getPosY());
if (dy < bestDistance) {
bestDistance = dy;
closestTimer = candidate;
}
}
}
if (closestTimer != null) {
Matcher matcher = timePattern.matcher(closestTimer.getName().getString().trim());
if (matcher.matches()) {
int minutes = Integer.parseInt(matcher.group(1));
int seconds = Integer.parseInt(matcher.group(2));
timerValue = String.format("%02d:%02d", minutes, seconds);
}
}
break;
}
}
int screenWidth = mc.getMainWindow().getScaledWidth();
int screenHeight = mc.getMainWindow().getScaledHeight();
String title = "Авто Шахта";
String info = mineName.isEmpty() && timerValue.isEmpty()
? "—"
: mineName + (timerValue.isEmpty() ? "" : " " + timerValue);
int titleWidth = mc.fontRenderer.getStringWidth(title);
int infoWidth = mc.fontRenderer.getStringWidth(info);
int textWidth = Math.max(titleWidth, infoWidth);
int paddingX = 8;
int paddingY = 6;
int iconWidth = 18;
int gap = 6;
int panelWidth = iconWidth + gap + textWidth + 4;
int panelHeight = 16 + paddingY * 2;
int centerX = screenWidth / 2;
int topY = (int)((float)screenHeight / 7.5F);
int panelX = centerX - panelWidth / 2;
int panelY = topY - 18;
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
renderBackground(matrixStack, panelX, panelY, panelWidth, panelHeight);
RenderUtil.drawRoundedRect(
matrixStack,
(float)panelX,
(float)panelY,
32.0F,
(float)panelHeight,
ColorUtils.setAlpha(new Color(-16777216, true).getRGB(), 0.15F),
RoundedCorners.create(6.0F, 6.0F, 0.0F, 0.0F)
);
RectUtil.drawRect(
matrixStack,
(double)(panelX + 32),
(double)panelY,
0.8D,
(double)panelHeight,
ColorUtils.getColor(255, 4)
);
ItemStack pickaxe = new ItemStack(Items.DIAMOND_PICKAXE);
int iconX = panelX + paddingX + (iconWidth - 16) / 2;
int iconY = panelY + paddingY + (panelHeight - paddingY * 2 - 16) / 2;
mc.getItemRenderer().renderItemAndEffectIntoGUI(pickaxe, iconX - 2, iconY - 1);
int textX = iconX + iconWidth + gap + 5;
int titleY = panelY + paddingY + 1;
int infoY = titleY + 10 + 2;
int infoColor = -3618616;
Fonts.render(
matrixStack,
title,
(double)textX,
(double)(titleY - 1),
HUD.getInstance().getMainColor(),
ColorUtils.setAlpha(HUD.getInstance().getMainColor(), 0.6F),
7.0F
);
Fonts.render(
matrixStack,
info,
(float)textX,
(float)(infoY - 4),
infoColor,
6.5F
);
}
private List<ArmorStandEntity> getArmorStands(Minecraft mc) {
return mc.world.getEntitiesWithinAABB(
ArmorStandEntity.class,
mc.player.getBoundingBox().grow(24.0D)
).stream()
.filter(Entity::hasCustomName)
.sorted(Comparator.comparingDouble(e -> e.getDistance(mc.player)))
.collect(Collectors.toList());
}
@EventTarget(priority = -500)
public void onRender3D(Render3DEvent event) {
if (!showOres.getValue()) {
return;
}
Minecraft mc = Minecraft.getInstance();
if (mc == null || mc.world == null || mc.player == null) {
return;
}
boolean showOutline = renderSettings.isEnabled("Обводка");
boolean showDecorations = renderSettings.isEnabled("Штрихи");
boolean showFill = renderSettings.isEnabled("Заливка");
if (!showOutline && !showDecorations && !showFill) {
return;
}
boolean renderByBorders = highlightType.is("По границам");
float expandAmount = borderScale.getValue() / 2.0F;
BlockPos playerPos = mc.player.getPosition();
updateOreCache(playerPos);
int rendered = 0;
int maxBoxes = MathHelper.floor(boxesPerFrame.getValue());
for (Entry<BlockPos, OreInfo> entry : oreCache.entrySet()) {
if (rendered >= maxBoxes) {
break;
}
BlockPos pos = entry.getKey();
OreInfo oreInfo = entry.getValue();
double distance = playerPos.distanceSq(pos);
int radius = MathHelper.floor(searchRadius.getValue());
if (distance > (radius * radius) || !isOreEnabled(oreInfo.name)) {
continue;
}
BlockState state = mc.world.getBlockState(pos);
if (state == null) {
continue;
}
VoxelShape shape = state.getShape(mc.world, pos);
if (shape == null || shape.isEmpty()) {
continue;
}
int baseColor = ColorUtils.interpolateColor(
oreInfo.color.getRGB(),
-1,
0.06F
);
int fillColor = ColorUtils.setAlpha(baseColor, 0.076F);
int lineColor = ColorUtils.setAlpha(baseColor, 0.5F);
int decorationColor = ColorUtils.setAlpha(baseColor, 0.35F);
if (renderByBorders) {
shape.forEachEdge((x1, y1, z1, x2, y2, z2) -> {
AxisAlignedBB box = new AxisAlignedBB(x1, y1, z1, x2, y2, z2)
.offset(pos)
.grow(expandAmount);
renderBox(
event,
box,
showOutline,
showDecorations,
showFill,
lineColor,
decorationColor,
fillColor
);
});
} else {
shape.forEachBox((x1, y1, z1, x2, y2, z2) -> {
AxisAlignedBB box = new AxisAlignedBB(x1, y1, z1, x2, y2, z2)
.offset(pos);
renderBox(
event,
box,
showOutline,
showDecorations,
showFill,
lineColor,
decorationColor,
fillColor
);
});
}
rendered++;
}
}
private void renderBox(
Render3DEvent event,
AxisAlignedBB box,
boolean outline,
boolean decorations,
boolean fill,
int lineColor,
int decorationColor,
int fillColor
) {
if (box == null) {
return;
}
Minecraft mc = Minecraft.getInstance();
if (!mc.worldRenderer.getClippingHelper().isBoundingBoxInFrustum(box)) {
return;
}
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
GL11.glLineWidth(0.125F);
BoxRenderer.renderBox(
event,
() -> {
BoxRenderer.drawBox(
event.getMatrixStack(),
BoxRenderer.getBufferBuilder(),
BoxRenderer.getVertexBuffer(),
box,
outline,
decorations,
fill,
lineColor,
decorationColor,
fillColor
);
},
true,
true
);
GL11.glLineWidth(1.0F);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_DONT_CARE);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
private void updateOreCache(BlockPos playerPos) {
long currentTime = System.currentTimeMillis();
boolean shouldUpdate = lastPlayerPos == null
|| lastPlayerPos.distanceSq(playerPos) > 16.0D
|| (currentTime - lastUpdateTime) > cacheUpdateFrequency.getValue();
if (!shouldUpdate) {
return;
}
oreCache.clear();
lastPlayerPos = playerPos;
lastUpdateTime = currentTime;
int radius = MathHelper.floor(searchRadius.getValue()) + 8;
int maxOres = MathHelper.floor(boxesPerFrame.getValue()) * 2;
int found = 0;
for (int dx = -radius; dx <= radius && found < maxOres; dx++) {
for (int dy = -radius; dy <= radius && found < maxOres; dy++) {
for (int dz = -radius; dz <= radius && found < maxOres; dz++) {
BlockPos pos = playerPos.add(dx, dy, dz);
if (playerPos.distanceSq(pos) > (radius * radius)) {
continue;
}
Minecraft mc = Minecraft.getInstance();
BlockState state = mc.world.getBlockState(pos);
if (state == null) {
continue;
}
Block block = state.getBlock();
OreInfo oreInfo = getOreInfo(block);
if (oreInfo != null) {
oreCache.put(pos, oreInfo);
found++;
}
}
}
}
}
private boolean isOreEnabled(String oreName) {
BooleanSetting setting = oresSettings.getSetting(oreName);
return setting != null && setting.getValue();
}
private OreInfo getOreInfo(Block block) {
if (block == Blocks.COAL_ORE) {
return new OreInfo("Уголь", 2829099);
} else if (block == Blocks.IRON_ORE) {
return new OreInfo("Железо", 12689801);
} else if (block == Blocks.REDSTONE_ORE) {
return new OreInfo("Редстоун", 13644852);
} else if (block == Blocks.GOLD_ORE) {
return new OreInfo("Золото", 14730049);
} else if (block == Blocks.EMERALD_ORE) {
return new OreInfo("Изумруды", 4116590);
} else if (block == Blocks.DIAMOND_ORE) {
return new OreInfo("Алмазы", 4118758);
} else if (block == Blocks.ANCIENT_DEBRIS) {
return new OreInfo("Незерит", 7027246);
} else if (block == Blocks.LAPIS_ORE) {
return new OreInfo("Лазурит", 3102678);
} else if (block == Blocks.NETHER_GOLD_ORE) {
return new OreInfo("Адская золотая руда", 14730049);
}
return null;
}
private static class OreInfo {
final String name;
final Color color;
OreInfo(String name, int rgb) {
this.name = name;
this.color = new Color(rgb, false);
}
}
}