Skip to content

Commit

Permalink
Replace Minecraft.ttf with Minecraftia.ttf. Modifiable hud and client…
Browse files Browse the repository at this point in the history
… font size. Added fade out in StorageESP and fixed scaffold/
  • Loading branch information
tanishisherewithhh committed Aug 31, 2024
1 parent 01e33be commit d7ad7fc
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/main/java/dev/heliosclient/hud/HudElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class HudElement implements ISettingChange, ISaveAndLoad, Listener {
protected static final MinecraftClient mc = MinecraftClient.getInstance();
public String name;
public String description;
public int height = FontManager.fontSize;
public int height = FontManager.hudFontSize;
public int width = 10;
public int x;
public int y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public void renderElement(DrawContext drawContext, TextRenderer textRenderer) {

Renderer2D.drawString(drawContext.getMatrices(),text,x + 2,y, ColorManager.INSTANCE.hudColor);

y += (int) (Renderer2D.getStringHeight(text) + 3);
y += Math.round(Renderer2D.getStringHeight(text)) + 3;
height += Math.round(Renderer2D.getStringHeight(text)) + 3;
}

this.width = width;
this.height = Math.max(10, height + 1);
this.height = height + 1;
}
}
6 changes: 3 additions & 3 deletions src/main/java/dev/heliosclient/managers/FontManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class FontManager implements Listener {
public static Font[] fonts, iconFonts;
public static Font[] originalFonts;
public static int fontSize = 8;
public static int hudFontSize = 8, clientFontSize = 8;
public static ArrayList<String> fontNames = new ArrayList<>();
public static FontManager INSTANCE = new FontManager();

Expand Down Expand Up @@ -44,8 +44,8 @@ public void onTick(TickEvent.CLIENT event) {
}

public void registerFonts() {
FontRenderers.fontRenderer = new FontRenderer(fonts, fontSize);
FontRenderers.fxfontRenderer = new fxFontRenderer(fonts, 8f);
FontRenderers.fontRenderer = new FontRenderer(fonts, hudFontSize);
FontRenderers.fxfontRenderer = new fxFontRenderer(fonts, clientFontSize);
FontRenderers.iconRenderer = new fxFontRenderer(iconFonts, 10f);

FontRenderers.Super_Small_fxfontRenderer = new fxFontRenderer(fonts, 4f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private boolean placeBlockPos(BlockPos pos, int itemSlot) {
}

if (placeResult) {
if (render.value && mc.player.getMainHandStack() != null) {
if (render.value) {
if (clientColorCycle.value) {
GradientBlockRenderer.renderGradientBlock(
ColorManager.INSTANCE::getPrimaryGradientStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
import dev.heliosclient.module.Module_;
import dev.heliosclient.module.settings.BooleanSetting;
import dev.heliosclient.module.settings.SettingGroup;
import dev.heliosclient.util.blocks.ChunkUtils;
import dev.heliosclient.util.ColorUtils;
import dev.heliosclient.util.blocks.ChunkUtils;
import dev.heliosclient.util.render.Renderer3D;
import dev.heliosclient.util.render.color.LineColor;
import dev.heliosclient.util.render.color.QuadColor;
import net.minecraft.block.BlockState;
import net.minecraft.block.ChestBlock;
import net.minecraft.block.entity.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.vehicle.ChestBoatEntity;
import net.minecraft.entity.vehicle.ChestMinecartEntity;
import net.minecraft.entity.vehicle.HopperMinecartEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.shape.VoxelShape;

import java.awt.*;
Expand Down Expand Up @@ -59,7 +62,14 @@ public class StorageESP extends Module_ {
.onSettingChange(this)
.build()
);

BooleanSetting fade = sgGeneral.add(new BooleanSetting.Builder()
.name("Fade when close")
.description("Fades out the ESP when you get closer to the storage blocks")
.value(false)
.defaultValue(false)
.onSettingChange(this)
.build()
);

public StorageESP() {
super("StorageESP", "Highlights storage blocks", Categories.RENDER);
Expand Down Expand Up @@ -112,10 +122,24 @@ else if (entity instanceof ChestBoatEntity)
}

private void renderStorageBlock(Color c, BlockPos pos) {
int changedColor = ColorUtils.changeAlpha(c, 100).getRGB();
double distanceFromPos = mc.player.getBlockPos().getSquaredDistance(pos);
int alphaClamp = 100;
if(fade.value) {
alphaClamp = (int) MathHelper.clamp(150 * (distanceFromPos / 400), 0, 150);
if(alphaClamp <= 2)return;
}

int changedColor = ColorUtils.changeAlphaGetInt(c.getRGB(), alphaClamp);
QuadColor color = QuadColor.single(changedColor);
LineColor lineColor = LineColor.single(changedColor);
VoxelShape shape = mc.world.getBlockState(pos).getOutlineShape(mc.world, pos);
VoxelShape shape;
BlockState state = mc.world.getBlockState(pos);

if (state.getBlock() instanceof ChestBlock p) {
shape = p.getOutlineShape(state,null,null,null);
} else{
shape = state.getOutlineShape(mc.world, pos);
}

if (shape == null || shape.isEmpty()) return;

Expand Down
35 changes: 27 additions & 8 deletions src/main/java/dev/heliosclient/module/sysmodules/ClickGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import dev.heliosclient.util.animation.AnimationUtils;
import dev.heliosclient.util.fontutils.FontRenderers;
import dev.heliosclient.util.fontutils.FontUtils;
import dev.heliosclient.util.fontutils.fxFontRenderer;
import dev.heliosclient.util.render.Renderer2D;
import me.x150.renderer.font.FontRenderer;
import org.lwjgl.glfw.GLFW;
Expand All @@ -26,7 +27,6 @@
import java.util.ArrayList;
import java.util.List;

import static dev.heliosclient.managers.FontManager.fontSize;
import static dev.heliosclient.managers.FontManager.fonts;

/**
Expand Down Expand Up @@ -111,9 +111,20 @@ public class ClickGUI extends Module_ {
.shouldRender(() -> FontRenderer.value == 0)
.build()
);
public DoubleSetting FontSize = sgMisc.add(new DoubleSetting.Builder()
.name("Font Size")
.description("Change your FontSize")
public DoubleSetting hudFontSize = sgMisc.add(new DoubleSetting.Builder()
.name("Hud Font Size")
.description("Change your hud's fontSize")
.onSettingChange(this)
.defaultValue(8.0)
.min(1)
.max(15)
.roundingPlace(1)
.shouldRender(() -> FontRenderer.value == 0)
.build()
);
public DoubleSetting clientFontSize = sgMisc.add(new DoubleSetting.Builder()
.name("Client Font Size")
.description("Change your client's (clickGUI) FontSize")
.onSettingChange(this)
.defaultValue(8.0)
.min(1)
Expand Down Expand Up @@ -370,13 +381,20 @@ public void onSettingChange(Setting<?> setting) {
Renderer2D.renderer = Renderer2D.Renderers.values()[FontRenderer.value];
pause = Pause.value;
keybinds = Keybinds.value;
fontSize = ((int) FontSize.value);
FontManager.hudFontSize = hudFontSize.getInt();
FontManager.clientFontSize = clientFontSize.getInt();

//Font changes
if (HeliosClient.MC.getWindow() != null) {
if (setting == FontRenderer || setting == FontSize || setting == loadFonts || setting == Font) {
if (setting == FontRenderer || setting == loadFonts || setting == Font) {
fonts = FontUtils.rearrangeFontsArray(FontManager.originalFonts, FontManager.originalFonts[Font.value]);
FontRenderers.fontRenderer = new FontRenderer(fonts, fontSize);
FontRenderers.fontRenderer = new FontRenderer(fonts, FontManager.hudFontSize);
FontRenderers.fxfontRenderer = new fxFontRenderer(fonts, FontManager.clientFontSize);
EventManager.postEvent(new FontChangeEvent(fonts));
}
if(setting == hudFontSize || setting == clientFontSize){
FontRenderers.fontRenderer = new FontRenderer(fonts, FontManager.hudFontSize);
FontRenderers.fxfontRenderer = new fxFontRenderer(fonts, FontManager.clientFontSize);
EventManager.postEvent(new FontChangeEvent(fonts));
}

Expand Down Expand Up @@ -408,7 +426,8 @@ public void onLoad() {

pause = Pause.value;
keybinds = Keybinds.value;
fontSize = ((int) FontSize.value);
FontManager.hudFontSize = hudFontSize.getInt();
FontManager.clientFontSize = clientFontSize.getInt();

fonts = FontUtils.rearrangeFontsArray(FontManager.originalFonts, FontManager.originalFonts[Font.value]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public void render(DrawContext drawContext, int mouseX, int mouseY, float delta)

navBar.render(drawContext, textRenderer, mouseX, mouseY);
Tooltip.tooltip.render(drawContext, textRenderer, mouseX, mouseY);
FontManager.fontSize = (int) HeliosClient.CLICKGUI.FontSize.value;
FontManager.hudFontSize = (int) HeliosClient.CLICKGUI.hudFontSize.value;
FontManager.clientFontSize = (int) HeliosClient.CLICKGUI.clientFontSize.value;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/heliosclient/util/blocks/BlockUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public static boolean isClickable(Block block) {
}

public static boolean place(BlockPos pos, boolean rotate, boolean clientSideRotation, boolean airPlace, Hand hand) {
if (!canPlace(pos, mc.world.getBlockState(pos)))
if (!canPlace(pos, mc.world.getBlockState(pos)) || mc.player.getStackInHand(hand) == null || mc.player.getStackInHand(hand).isEmpty())
return false;

Vec3d hitPos = Vec3d.ofCenter(pos);
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/dev/heliosclient/util/fontutils/FontLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.*;
import java.util.List;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Objects;

public class FontLoader {
private static final String FONTS_FOLDER = "heliosclient/fonts";
private static final String ICON_FONTS_FOLDER = "heliosclient/fonts/icons";
private static final String[] DEFAULT_FONT = {"Minecraft.ttf", "Comfortaa.ttf", "JetBrainsMono.ttf", "Nunito.ttf","DComicFont.ttf"};
private static final String[] DEFAULT_FONT = {"Minecraftia.ttf", "Comfortaa.ttf", "JetBrainsMono.ttf", "Nunito.ttf","DComicFont.ttf"};
private static final String[] DEFAULT_ICON_FONT = {"fontello.ttf", "icons2.ttf", "icons.ttf"};
public static Font[] COMICALFONTS = null;
private static final String COMICAL_FONT_NAME = "DComicFont.ttf";
Expand Down
Binary file not shown.

0 comments on commit d7ad7fc

Please sign in to comment.