fix: fonts
This commit is contained in:
@@ -9,6 +9,8 @@ import lombok.Setter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import shit.zen.event.EventBus;
|
||||
import shit.zen.event.EventTarget;
|
||||
import shit.zen.event.impl.TickEvent;
|
||||
import shit.zen.manager.CommandManager;
|
||||
import shit.zen.manager.ConfigManager;
|
||||
import shit.zen.manager.HudManager;
|
||||
@@ -84,7 +86,6 @@ public class ZenClient extends ClientBase {
|
||||
this.rotationHandler = new RotationHandler();
|
||||
this.eventBus.register(this.rotationHandler);
|
||||
this.moduleManager = new ModuleManager();
|
||||
this.moduleManager.initModules();
|
||||
this.hudManager = new HudManager();
|
||||
this.commandManager = new CommandManager();
|
||||
this.commandManager.initCommands();
|
||||
@@ -94,6 +95,7 @@ public class ZenClient extends ClientBase {
|
||||
this.eventBus.register(this.lagManager);
|
||||
this.targetManager = new TargetManager();
|
||||
this.eventBus.register(this.targetManager);
|
||||
this.eventBus.register(this);
|
||||
this.encryption = new Encryption(Encryption.Algorithm.AES);
|
||||
registerPatches();
|
||||
if (PatchAgent.getInstrumentation() != null) {
|
||||
@@ -108,6 +110,16 @@ public class ZenClient extends ClientBase {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean moduleInit = false;
|
||||
|
||||
@EventTarget
|
||||
public void onTick(TickEvent e) {
|
||||
if (isReady() && !moduleInit) {
|
||||
moduleInit = true;
|
||||
this.moduleManager.initModules();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isReady() {
|
||||
return instance != null
|
||||
&& ZenClient.instance.eventBus != null
|
||||
@@ -118,14 +130,10 @@ public class ZenClient extends ClientBase {
|
||||
&& mc.player.tickCount > 5;
|
||||
}
|
||||
|
||||
public static boolean isOwner(String string) {
|
||||
public static boolean isOwner(String username) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String decodeString(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
public void disconnectFromServer() {
|
||||
isReady = false;
|
||||
if (this.configManager != null) {
|
||||
|
||||
@@ -52,7 +52,7 @@ extends Screen {
|
||||
}
|
||||
}
|
||||
|
||||
public static PanelClickGui Đ;
|
||||
public static PanelClickGui panelClickGui = new PanelClickGui();
|
||||
|
||||
private boolean searchActive = false;
|
||||
private boolean searchFocused = false;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package shit.zen.gui.panel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import shit.zen.ClientBase;
|
||||
import shit.zen.ZenClient;
|
||||
import shit.zen.gui.PanelClickGui;
|
||||
import shit.zen.modules.KeyBind;
|
||||
import shit.zen.modules.Module;
|
||||
import shit.zen.render.DrawContext;
|
||||
import shit.zen.render.FontPresets;
|
||||
import shit.zen.render.FontRenderer;
|
||||
import shit.zen.render.GlHelper;
|
||||
@@ -71,7 +70,7 @@ extends ClientBase {
|
||||
if (ZenClient.isReady()) {
|
||||
ZenClient.instance.getConfigManager().saveAll();
|
||||
}
|
||||
PanelClickGui.Đ.addToast(this.targetModule.getName() + " keybind cleared");
|
||||
PanelClickGui.panelClickGui.addToast(this.targetModule.getName() + " keybind cleared");
|
||||
}
|
||||
this.cancel();
|
||||
return true;
|
||||
@@ -83,7 +82,7 @@ extends ClientBase {
|
||||
}
|
||||
KeyBind keyBind = new KeyBind(n);
|
||||
String string = keyBind.getName();
|
||||
PanelClickGui.Đ.addToast(this.targetModule.getName() + " bound to " + string.toUpperCase());
|
||||
PanelClickGui.panelClickGui.addToast(this.targetModule.getName() + " bound to " + string.toUpperCase());
|
||||
this.cancel();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,11 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import shit.zen.ClientBase;
|
||||
import shit.zen.ZenClient;
|
||||
import shit.zen.gui.PanelClickGui;
|
||||
import shit.zen.gui.panel.ModuleListPanel.AnimationState;
|
||||
import shit.zen.modules.Category;
|
||||
import shit.zen.modules.Module;
|
||||
import shit.zen.render.DrawContext;
|
||||
@@ -338,11 +336,11 @@ extends ClientBase {
|
||||
if (n5 == 0) {
|
||||
module.toggle();
|
||||
String string = module.isEnabled() ? "On" : "Off";
|
||||
PanelClickGui.Đ.addToast(module.getName() + " Module " + string);
|
||||
PanelClickGui.panelClickGui.addToast(module.getName() + " Module " + string);
|
||||
} else if (n5 == 1) {
|
||||
this.hoveredModule = module;
|
||||
} else if (n5 == 2) {
|
||||
PanelClickGui.Đ.selectModule(module);
|
||||
PanelClickGui.panelClickGui.selectModule(module);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2,15 +2,13 @@ package shit.zen.gui.panel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import shit.zen.ClientBase;
|
||||
import shit.zen.gui.PanelClickGui;
|
||||
import shit.zen.gui.panel.SettingsPanel.AnimationState;
|
||||
import shit.zen.gui.panel.setting.SettingRenderer;
|
||||
import shit.zen.gui.panel.setting.SettingRendererRegistry;
|
||||
import shit.zen.modules.Module;
|
||||
import shit.zen.render.DrawContext;
|
||||
import shit.zen.render.FontPresets;
|
||||
import shit.zen.render.FontRenderer;
|
||||
import shit.zen.render.GlHelper;
|
||||
@@ -393,7 +391,7 @@ extends ClientBase {
|
||||
if (n5 == 0 && n3 >= n18 && n3 <= n18 + n16 * 2 && n4 >= n19 && n4 <= n19 + n16) {
|
||||
this.currentModule.toggle();
|
||||
String string = this.currentModule.isEnabled() ? "On" : "Off";
|
||||
PanelClickGui.Đ.addToast(this.currentModule.getName() + " Module " + string);
|
||||
PanelClickGui.panelClickGui.addToast(this.currentModule.getName() + " Module " + string);
|
||||
return true;
|
||||
}
|
||||
List<Setting<?>> list = this.currentModule.getSettings();
|
||||
|
||||
@@ -132,7 +132,7 @@ implements SettingRenderer {
|
||||
boolean bl = booleanSetting.getValue() == false;
|
||||
booleanSetting.setValue(bl);
|
||||
String string = bl ? "On" : "Off";
|
||||
PanelClickGui.Đ.addToast(booleanSetting.getName() + " is " + string);
|
||||
PanelClickGui.panelClickGui.addToast(booleanSetting.getName() + " is " + string);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -147,7 +147,7 @@ implements SettingRenderer {
|
||||
String string2 = stringArray[i];
|
||||
modeSetting.setValue(string2);
|
||||
this.openStates.put(modeSetting, false);
|
||||
PanelClickGui.Đ.addToast(modeSetting.getName() + " set to " + string2);
|
||||
PanelClickGui.panelClickGui.addToast(modeSetting.getName() + " set to " + string2);
|
||||
return true;
|
||||
}
|
||||
if (!bl2) {
|
||||
|
||||
@@ -91,7 +91,7 @@ implements SettingRenderer {
|
||||
multiSelectSetting.getValue().add(string);
|
||||
}
|
||||
boolean bl = multiSelectSetting.isSelected(string);
|
||||
PanelClickGui.Đ.addToast(string + (bl ? " enabled" : " disabled"));
|
||||
PanelClickGui.panelClickGui.addToast(string + (bl ? " enabled" : " disabled"));
|
||||
return true;
|
||||
}
|
||||
n7 += n8;
|
||||
|
||||
@@ -152,9 +152,9 @@ implements SettingRenderer {
|
||||
double d3 = editingNumberSetting.getMax().doubleValue();
|
||||
d = Math.max(d2, Math.min(d3, d));
|
||||
NumberSettingRenderer.applyValueStatic(editingNumberSetting, d);
|
||||
PanelClickGui.Đ.addToast(editingNumberSetting.getName() + " set to " + String.format(Locale.US, "%.1f", new Object[]{d}));
|
||||
PanelClickGui.panelClickGui.addToast(editingNumberSetting.getName() + " set to " + String.format(Locale.US, "%.1f", new Object[]{d}));
|
||||
} catch (NumberFormatException numberFormatException) {
|
||||
PanelClickGui.Đ.addToast("Invalid input, edit cancelled");
|
||||
PanelClickGui.panelClickGui.addToast("Invalid input, edit cancelled");
|
||||
}
|
||||
NumberSettingRenderer.cancelEdit();
|
||||
}
|
||||
@@ -247,7 +247,7 @@ implements SettingRenderer {
|
||||
double d3 = numberSetting.getMax().doubleValue();
|
||||
double d4 = Math.min(d3, d + d2);
|
||||
this.applyValue(numberSetting, d4);
|
||||
PanelClickGui.Đ.addToast(numberSetting.getName() + " set to " + this.formatValue(d4));
|
||||
PanelClickGui.panelClickGui.addToast(numberSetting.getName() + " set to " + this.formatValue(d4));
|
||||
}
|
||||
|
||||
private void decrementValue(NumberSetting numberSetting) {
|
||||
@@ -256,7 +256,7 @@ implements SettingRenderer {
|
||||
double d3 = numberSetting.getMin().doubleValue();
|
||||
double d4 = Math.max(d3, d - d2);
|
||||
this.applyValue(numberSetting, d4);
|
||||
PanelClickGui.Đ.addToast(numberSetting.getName() + " set to " + this.formatValue(d4));
|
||||
PanelClickGui.panelClickGui.addToast(numberSetting.getName() + " set to " + this.formatValue(d4));
|
||||
}
|
||||
|
||||
private void applyValue(NumberSetting numberSetting, double d) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.List;
|
||||
import net.minecraft.util.Mth;
|
||||
import shit.zen.ClientBase;
|
||||
import shit.zen.event.impl.Render2DEvent;
|
||||
import shit.zen.render.DrawContext;
|
||||
import shit.zen.render.Paint;
|
||||
import shit.zen.render.Renderer;
|
||||
import shit.zen.render.RoundedRectangle;
|
||||
@@ -22,7 +21,7 @@ public class DynamicIsland {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public IHudElement Đ() {
|
||||
public IHudElement visible() {
|
||||
for (IHudElement element : this.owner.elements) {
|
||||
if (element.isVisible()) return element;
|
||||
}
|
||||
@@ -43,7 +42,7 @@ public class DynamicIsland {
|
||||
public void onRender2D(Render2DEvent render2DEvent) {
|
||||
float f;
|
||||
float f2;
|
||||
IHudElement.Size iHudElement$Size;
|
||||
IHudElement.Size size;
|
||||
if (ClientBase.mc.player == null) {
|
||||
return;
|
||||
}
|
||||
@@ -54,27 +53,27 @@ public class DynamicIsland {
|
||||
float f3 = (float)(l - this.lastFrameTimestamp) / 1000.0f;
|
||||
this.lastFrameTimestamp = l;
|
||||
f3 = Math.min(f3, 0.033333335f);
|
||||
IHudElement iHudElement = this.activeElementSelector.Đ();
|
||||
IHudElement iHudElement = this.activeElementSelector.visible();
|
||||
if (this.activeElement != iHudElement) {
|
||||
this.outgoingElement = this.activeElement;
|
||||
this.activeElement = iHudElement;
|
||||
this.transitionAnim.reset(0.0f);
|
||||
this.transitionAnim.setTargetValue(1.0f);
|
||||
if (this.outgoingElement == null) {
|
||||
iHudElement$Size = this.activeElement.getHudAlignment();
|
||||
this.widthAnim.reset(iHudElement$Size.width());
|
||||
this.heightAnim.reset(iHudElement$Size.height());
|
||||
size = this.activeElement.getHudAlignment();
|
||||
this.widthAnim.reset(size.width());
|
||||
this.heightAnim.reset(size.height());
|
||||
this.transitionAnim.reset(1.0f);
|
||||
}
|
||||
}
|
||||
iHudElement$Size = this.activeElement.getHudAlignment();
|
||||
float f4 = iHudElement$Size.width();
|
||||
float f5 = iHudElement$Size.height();
|
||||
size = this.activeElement.getHudAlignment();
|
||||
float f4 = size.width();
|
||||
float f5 = size.height();
|
||||
float f6 = this.transitionAnim.getValue();
|
||||
if (this.outgoingElement != null && f6 < 1.0f) {
|
||||
IHudElement.Size iHudElement$Size2 = this.outgoingElement.getHudAlignment();
|
||||
f4 = Mth.lerp(f6, iHudElement$Size2.width(), iHudElement$Size.width());
|
||||
f5 = Mth.lerp(f6, iHudElement$Size2.height(), iHudElement$Size.height());
|
||||
f4 = Mth.lerp(f6, iHudElement$Size2.width(), size.width());
|
||||
f5 = Mth.lerp(f6, iHudElement$Size2.height(), size.height());
|
||||
}
|
||||
this.widthAnim.setTargetValue(f4);
|
||||
this.heightAnim.setTargetValue(f5);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package shit.zen.modules.impl.render;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import shit.zen.gui.NewClickGui;
|
||||
@@ -25,7 +24,7 @@ extends Module {
|
||||
if (this.styleSetting.is("Old")) {
|
||||
mc.setScreen(new OldClickGui());
|
||||
} else if (this.styleSetting.is("Panel")) {
|
||||
mc.setScreen(PanelClickGui.Đ);
|
||||
mc.setScreen(PanelClickGui.panelClickGui);
|
||||
} else {
|
||||
mc.setScreen(new NewClickGui());
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Watermark extends Module {
|
||||
if (!this.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
switch ((String) this.styleSetting.getValue()) {
|
||||
switch (this.styleSetting.getValue()) {
|
||||
case "Neverlose":
|
||||
this.neverloseWatermark.onRender2D(render2DEvent);
|
||||
break;
|
||||
|
||||
@@ -295,10 +295,9 @@ public class OpalNameTag extends NameTagStyle {
|
||||
if (last != null && now - last < 1000L) {
|
||||
return this.decodedNameCache.get(name);
|
||||
}
|
||||
String decoded = ZenClient.decodeString(name);
|
||||
this.decodedNameCache.put(name, decoded);
|
||||
this.decodedNameCache.put(name, name);
|
||||
this.nameDecodeTimestamps.put(name, now);
|
||||
return decoded;
|
||||
return name;
|
||||
}
|
||||
|
||||
private record ItemRenderData(ItemStack itemStack, Vector2f position) {
|
||||
|
||||
@@ -8,13 +8,12 @@ import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import it.unimi.dsi.fastutil.chars.Char2IntArrayMap;
|
||||
import it.unimi.dsi.fastutil.chars.Char2ObjectArrayMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectList;
|
||||
import it.unimi.dsi.fastutil.objects.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.io.Closeable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -191,105 +190,102 @@ implements Closeable {
|
||||
public void drawStringRGB(PoseStack poseStack, String string, float f, float f2, float f3, float f4, float f5, float f6) {
|
||||
this.drawStringRGBFull(poseStack, string, f, f2, f3, f4, f5, f6, false, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
*/
|
||||
public void drawStringRGBFull(PoseStack poseStack, String string, float f, float f2, float f3, float f4, float f5, float f6, boolean bl, int n) {
|
||||
public void drawStringRGBFull(PoseStack var1, String var2, float var3, float var4, float var5, float var6, float var7, float var8, boolean var9, int var10) {
|
||||
if (this.preloadFuture != null && !this.preloadFuture.isDone()) {
|
||||
try {
|
||||
this.preloadFuture.get();
|
||||
} catch (InterruptedException | ExecutionException throwable) {
|
||||
// empty catch block
|
||||
} catch (ExecutionException | InterruptedException var44) {
|
||||
}
|
||||
}
|
||||
|
||||
this.checkGuiScaleChanged();
|
||||
float f7 = f3;
|
||||
float f8 = f4;
|
||||
float f9 = f5;
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(MathUtil.round(f, 1), MathUtil.round(f2 -= 1.0f, 1), 0.0);
|
||||
poseStack.scale(1.0f / (float)this.scale, 1.0f / (float)this.scale, 1.0f);
|
||||
float var13 = var5;
|
||||
float var14 = var6;
|
||||
float var15 = var7;
|
||||
var1.pushPose();
|
||||
var1.translate(MathUtil.round(var3, 1), MathUtil.round(--var4, 1), 0.0);
|
||||
var1.scale(1.0F / this.scale, 1.0F / this.scale, 1.0F);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
|
||||
Matrix4f matrix4f = poseStack.last().pose();
|
||||
char[] cArray = string.toCharArray();
|
||||
float f10 = 0.0f;
|
||||
float f11 = 0.0f;
|
||||
boolean bl2 = false;
|
||||
int n2 = 0;
|
||||
Object2ObjectMap<ResourceLocation, ObjectList<CustomFont.GlyphEntry>> object2ObjectMap = this.glyphPageMap;
|
||||
synchronized (object2ObjectMap) {
|
||||
for (int i = 0; i < cArray.length; ++i) {
|
||||
char c = cArray[i];
|
||||
if (bl2) {
|
||||
bl2 = false;
|
||||
char c2 = Character.toUpperCase(c);
|
||||
if (MC_COLOR_CODES.containsKey(c2)) {
|
||||
int n3 = MC_COLOR_CODES.get(c2);
|
||||
int[] rgb = CustomFont.colorToRGB(n3);
|
||||
f7 = rgb[0] / 255.0f;
|
||||
f8 = rgb[1] / 255.0f;
|
||||
f9 = rgb[2] / 255.0f;
|
||||
continue;
|
||||
Matrix4f var16 = var1.last().pose();
|
||||
char[] var17 = var2.toCharArray();
|
||||
float var18 = 0.0F;
|
||||
float var19 = 0.0F;
|
||||
boolean var20 = false;
|
||||
int var21 = 0;
|
||||
synchronized (this.glyphPageMap) {
|
||||
for (int var23 = 0; var23 < var17.length; var23++) {
|
||||
char var24 = var17[var23];
|
||||
if (var20) {
|
||||
var20 = false;
|
||||
char var25 = Character.toUpperCase(var24);
|
||||
if (MC_COLOR_CODES.containsKey(var25)) {
|
||||
int var26 = MC_COLOR_CODES.get(var25);
|
||||
int[] var27 = colorToRGB(var26);
|
||||
var13 = var27[0] / 255.0F;
|
||||
var14 = var27[1] / 255.0F;
|
||||
var15 = var27[2] / 255.0F;
|
||||
} else if (var25 == 'R') {
|
||||
var13 = var5;
|
||||
var14 = var6;
|
||||
var15 = var7;
|
||||
}
|
||||
} else if (var24 == 167) {
|
||||
var20 = true;
|
||||
} else if (var24 == '\n') {
|
||||
var19 += this.getStringHeight(var2.substring(var21, var23)) * this.scale;
|
||||
var18 = 0.0F;
|
||||
var21 = var23 + 1;
|
||||
} else {
|
||||
Glyph var49 = this.getOrLoadGlyph(var24);
|
||||
if (var49 != null) {
|
||||
if (var49.value() != ' ') {
|
||||
ResourceLocation var51 = var49.owner().textureLocation;
|
||||
GlyphEntry var53 = new GlyphEntry(var18, var19, var13, var14, var15, var49);
|
||||
this.glyphPageMap.computeIfAbsent(var51, var0 -> new ObjectArrayList<>()).add(var53);
|
||||
}
|
||||
|
||||
var18 += var49.width() + this.letterSpacing;
|
||||
}
|
||||
if (c2 != 'R') continue;
|
||||
f7 = f3;
|
||||
f8 = f4;
|
||||
f9 = f5;
|
||||
continue;
|
||||
}
|
||||
if (c == '§') {
|
||||
bl2 = true;
|
||||
continue;
|
||||
}
|
||||
if (c == '\n') {
|
||||
f11 += this.getStringHeight(string.substring(n2, i)) * (float)this.scale;
|
||||
f10 = 0.0f;
|
||||
n2 = i + 1;
|
||||
continue;
|
||||
}
|
||||
Glyph glyph = this.getOrLoadGlyph(c);
|
||||
if (glyph == null) continue;
|
||||
if (glyph.value() != ' ') {
|
||||
ResourceLocation resourceLocation = glyph.owner().textureLocation;
|
||||
CustomFont.GlyphEntry entry = new CustomFont.GlyphEntry(f10, f11, f7, f8, f9, glyph);
|
||||
this.glyphPageMap.computeIfAbsent(resourceLocation, k -> new ObjectArrayList<>()).add(entry);
|
||||
}
|
||||
f10 += (float)glyph.width() + this.letterSpacing;
|
||||
}
|
||||
for (ResourceLocation resourceLocation : this.glyphPageMap.keySet()) {
|
||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||
ObjectList<CustomFont.GlyphEntry> list = this.glyphPageMap.get(resourceLocation);
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
BufferBuilder bufferBuilder = tesselator.getBuilder();
|
||||
bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR);
|
||||
for (CustomFont.GlyphEntry customFont$GlyphEntry : list) {
|
||||
float f12 = customFont$GlyphEntry.atX;
|
||||
float f13 = customFont$GlyphEntry.atY;
|
||||
float f14 = customFont$GlyphEntry.r;
|
||||
float f15 = customFont$GlyphEntry.g;
|
||||
float f16 = customFont$GlyphEntry.b;
|
||||
Glyph glyph = customFont$GlyphEntry.toDraw;
|
||||
GlyphPage glyphPage = glyph.owner();
|
||||
float f17 = glyph.width();
|
||||
float f18 = glyph.height();
|
||||
float f19 = (float)glyph.u() / (float)glyphPage.imageWidth;
|
||||
float f20 = (float)glyph.v() / (float)glyphPage.imageHeight;
|
||||
float f21 = (float)(glyph.u() + glyph.width()) / (float)glyphPage.imageWidth;
|
||||
float f22 = (float)(glyph.v() + glyph.height()) / (float)glyphPage.imageHeight;
|
||||
bufferBuilder.vertex(matrix4f, f12 + 0.0f, f13 + f18, 0.0f).uv(f19, f22).color(f14, f15, f16, f6).endVertex();
|
||||
bufferBuilder.vertex(matrix4f, f12 + f17, f13 + f18, 0.0f).uv(f21, f22).color(f14, f15, f16, f6).endVertex();
|
||||
bufferBuilder.vertex(matrix4f, f12 + f17, f13 + 0.0f, 0.0f).uv(f21, f20).color(f14, f15, f16, f6).endVertex();
|
||||
bufferBuilder.vertex(matrix4f, f12 + 0.0f, f13 + 0.0f, 0.0f).uv(f19, f20).color(f14, f15, f16, f6).endVertex();
|
||||
|
||||
for (ResourceLocation var48 : this.glyphPageMap.keySet()) {
|
||||
RenderSystem.setShaderTexture(0, var48);
|
||||
List<GlyphEntry> var50 = this.glyphPageMap.get(var48);
|
||||
Tesselator var52 = Tesselator.getInstance();
|
||||
BufferBuilder var28 = var52.getBuilder();
|
||||
var28.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR);
|
||||
|
||||
for (GlyphEntry var29 : var50) {
|
||||
float var30 = var29.atX;
|
||||
float var31 = var29.atY;
|
||||
float var32 = var29.r;
|
||||
float var33 = var29.g;
|
||||
float var34 = var29.b;
|
||||
Glyph var35 = var29.toDraw;
|
||||
GlyphPage var36 = var35.owner();
|
||||
float var37 = var35.width();
|
||||
float var38 = var35.height();
|
||||
float var39 = (float) var35.u() / var36.imageWidth;
|
||||
float var40 = (float) var35.v() / var36.imageHeight;
|
||||
float var41 = (float) (var35.u() + var35.width()) / var36.imageWidth;
|
||||
float var42 = (float) (var35.v() + var35.height()) / var36.imageHeight;
|
||||
var28.vertex(var16, var30 + 0.0F, var31 + var38, 0.0F).uv(var39, var42).color(var32, var33, var34, var8).endVertex();
|
||||
var28.vertex(var16, var30 + var37, var31 + var38, 0.0F).uv(var41, var42).color(var32, var33, var34, var8).endVertex();
|
||||
var28.vertex(var16, var30 + var37, var31 + 0.0F, 0.0F).uv(var41, var40).color(var32, var33, var34, var8).endVertex();
|
||||
var28.vertex(var16, var30 + 0.0F, var31 + 0.0F, 0.0F).uv(var39, var40).color(var32, var33, var34, var8).endVertex();
|
||||
}
|
||||
tesselator.end();
|
||||
|
||||
var52.end();
|
||||
}
|
||||
|
||||
this.glyphPageMap.clear();
|
||||
}
|
||||
poseStack.popPose();
|
||||
|
||||
var1.popPose();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,109 +1,103 @@
|
||||
package shit.zen.render;
|
||||
|
||||
import shit.zen.render.CustomFont;
|
||||
import shit.zen.render.FontMetricsImpl;
|
||||
import shit.zen.render.Fonts;
|
||||
import shit.zen.render.GlyphMetrics;
|
||||
import shit.zen.render.Path;
|
||||
import shit.zen.render.Rectangle;
|
||||
import lombok.Getter;
|
||||
|
||||
public final class FontRenderer {
|
||||
@Getter
|
||||
private final String fontName;
|
||||
@Getter
|
||||
private final float size;
|
||||
private CustomFont customFont;
|
||||
|
||||
public FontRenderer(String string, float f) {
|
||||
this.fontName = string;
|
||||
this.size = f;
|
||||
public FontRenderer(String var1, float var2) {
|
||||
this.fontName = var1;
|
||||
this.size = var2;
|
||||
}
|
||||
|
||||
public FontRenderer(CustomFont customFont, float f) {
|
||||
public FontRenderer(CustomFont var1, float var2) {
|
||||
this.fontName = null;
|
||||
this.size = f;
|
||||
this.customFont = customFont;
|
||||
}
|
||||
|
||||
public String getFontName() {
|
||||
return this.fontName;
|
||||
}
|
||||
|
||||
public float getSize() {
|
||||
return this.size;
|
||||
this.size = var2;
|
||||
this.customFont = var1;
|
||||
}
|
||||
|
||||
public CustomFont getFont() {
|
||||
if (this.customFont == null && this.fontName != null) {
|
||||
this.customFont = Fonts.getCustomFont(this.fontName, this.size);
|
||||
}
|
||||
|
||||
return this.customFont;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
CustomFont customFont = this.getFont();
|
||||
return customFont == null ? 0 : System.identityHashCode(customFont);
|
||||
CustomFont var3 = this.getFont();
|
||||
return var3 == null ? 0 : System.identityHashCode(var3);
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
public FontRenderer withBold(boolean bl) {
|
||||
public FontRenderer withBold(boolean var1) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public FontRenderer withItalic(boolean bl) {
|
||||
public FontRenderer withItalic(boolean var1) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public FontRenderer withColor(Object object) {
|
||||
public FontRenderer withColor(Object var1) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Rectangle getBounds(String string) {
|
||||
if (string == null || string.isEmpty()) {
|
||||
return Rectangle.ofXYWH(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
public Rectangle getBounds(String var1) {
|
||||
if (var1 != null && !var1.isEmpty()) {
|
||||
CustomFont var4 = this.getFont();
|
||||
if (var4 == null) {
|
||||
return Rectangle.ofXYWH(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
} else {
|
||||
float var5 = var4.getStringWidth(var1);
|
||||
float var6 = var4.getStringHeight(var1);
|
||||
return Rectangle.ofXYWH(0.0F, 0.0F, var5, var6);
|
||||
}
|
||||
} else {
|
||||
return Rectangle.ofXYWH(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
CustomFont customFont = this.getFont();
|
||||
if (customFont == null) {
|
||||
return Rectangle.ofXYWH(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
float f = customFont.getStringWidth(string);
|
||||
float f2 = customFont.getStringHeight(string);
|
||||
return Rectangle.ofXYWH(0.0f, 0.0f, f, f2);
|
||||
}
|
||||
|
||||
public float getWidth(String string) {
|
||||
if (string == null || string.isEmpty()) {
|
||||
return 0.0f;
|
||||
public float getWidth(String var1) {
|
||||
if (var1 != null && !var1.isEmpty()) {
|
||||
CustomFont var4 = this.getFont();
|
||||
return var4 == null ? 0.0F : var4.getStringWidth(var1);
|
||||
} else {
|
||||
return 0.0F;
|
||||
}
|
||||
CustomFont customFont = this.getFont();
|
||||
return customFont == null ? 0.0f : customFont.getStringWidth(string);
|
||||
}
|
||||
|
||||
public short[] getGlyphCodes(String string) {
|
||||
public short[] getGlyphCodes(String var1) {
|
||||
return new short[0];
|
||||
}
|
||||
|
||||
public Path getGlyphPath(short s) {
|
||||
public Path getGlyphPath(short var1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public GlyphMetrics getMetrics() {
|
||||
CustomFont customFont = this.getFont();
|
||||
if (customFont == null) {
|
||||
return new GlyphMetrics(-this.size * 0.8f, this.size * 0.2f, this.size * 1.2f, this.size * 0.7f);
|
||||
CustomFont var3 = this.getFont();
|
||||
if (var3 == null) {
|
||||
return new GlyphMetrics(-this.size * 0.8F, this.size * 0.2F, this.size * 1.2F, this.size * 0.7F);
|
||||
} else {
|
||||
FontMetricsImpl var4 = var3.getFontMetrics();
|
||||
int var5 = var3.getScale();
|
||||
if (var5 <= 0) {
|
||||
var5 = 1;
|
||||
}
|
||||
|
||||
float var6 = -var4.getAscent() / var5;
|
||||
float var7 = (float)var4.getDescent() / var5;
|
||||
float var8 = (float)var4.getLeading() / var5;
|
||||
float var9 = (float)var4.getHeight() / var5;
|
||||
float var10 = var4.getAscent() * 0.7F / var5;
|
||||
return new GlyphMetrics(var6, var7, var9, var10);
|
||||
}
|
||||
FontMetricsImpl fontMetricsImpl = customFont.getFontMetrics();
|
||||
int n = customFont.getScale();
|
||||
if (n <= 0) {
|
||||
n = 1;
|
||||
}
|
||||
float f = -((float)fontMetricsImpl.getAscent()) / (float)n;
|
||||
float f2 = (float)fontMetricsImpl.getDescent() / (float)n;
|
||||
float f3 = (float)fontMetricsImpl.getLeading() / (float)n;
|
||||
float f4 = (float)fontMetricsImpl.getHeight() / (float)n;
|
||||
float f5 = (float)fontMetricsImpl.getAscent() * 0.7f / (float)n;
|
||||
GlyphMetrics glyphMetrics = new GlyphMetrics(f, f2, f4, f5);
|
||||
return glyphMetrics;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Reference in New Issue
Block a user