0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-19 17:02:13 +02:00

Add WurstClient.MC constant

This commit is contained in:
Alexander 2019-07-12 15:52:26 +02:00
parent 41f5c5350b
commit b063276e75
5 changed files with 15 additions and 16 deletions

View File

@ -11,6 +11,6 @@ import net.minecraft.client.MinecraftClient;
public abstract class Feature
{
protected static final MinecraftClient MC = MinecraftClient.getInstance();
protected static final WurstClient WURST = WurstClient.INSTANCE;
protected static final MinecraftClient MC = WurstClient.MC;
}

View File

@ -23,7 +23,7 @@ import net.wurstclient.hack.HackList;
public enum WurstClient
{
INSTANCE;
public static final MinecraftClient MC = MinecraftClient.getInstance();
public static final String VERSION = "7.0";
private WurstAnalytics analytics;
@ -65,8 +65,7 @@ public enum WurstClient
private Path createWurstFolder()
{
MinecraftClient mc = MinecraftClient.getInstance();
Path dotMinecraftFolder = mc.runDirectory.toPath();
Path dotMinecraftFolder = MC.runDirectory.toPath();
Path wurstFolder = dotMinecraftFolder.resolve("wurst");
try

View File

@ -31,6 +31,8 @@ import net.wurstclient.util.json.JsonUtils;
public final class ClickGui
{
private static final MinecraftClient MC = WurstClient.MC;
private final ArrayList<Window> windows = new ArrayList<>();
private final ArrayList<Popup> popups = new ArrayList<>();
private final Path windowsFile;
@ -79,8 +81,7 @@ public final class ClickGui
int x = 5;
int y = 5;
net.minecraft.client.util.Window sr =
MinecraftClient.getInstance().window;
net.minecraft.client.util.Window sr = MC.window;
for(Window window : windows)
{
window.pack();
@ -499,9 +500,8 @@ public final class ClickGui
if(tooltip != null)
{
String[] lines = tooltip.split("\n");
MinecraftClient mc = MinecraftClient.getInstance();
// TODO: TextRenderer fr = Fonts.segoe15;
TextRenderer fr = mc.textRenderer;
TextRenderer fr = MC.textRenderer;
int tw = 0;
int th = lines.length * fr.fontHeight;
@ -511,8 +511,8 @@ public final class ClickGui
if(lw > tw)
tw = lw;
}
int sw = mc.currentScreen.width;
int sh = mc.currentScreen.height;
int sw = MC.currentScreen.width;
int sh = MC.currentScreen.height;
int xt1 = mouseX + tw + 11 <= sw ? mouseX + 8 : mouseX - tw - 8;
int xt2 = xt1 + tw + 3;
@ -684,8 +684,7 @@ public final class ClickGui
GL11.glVertex2i(x4, y3);
GL11.glEnd();
net.minecraft.client.util.Window sr =
MinecraftClient.getInstance().window;
net.minecraft.client.util.Window sr = MC.window;
int sf = (int)sr.getScaleFactor();
GL11.glScissor(x1 * sf, (sr.getScaledHeight() - y2) * sf,
window.getWidth() * sf, (y2 - y3) * sf);
@ -815,7 +814,7 @@ public final class ClickGui
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1, 1, 1, 1);
// TODO: TextRenderer fr = Fonts.segoe18;
TextRenderer fr = MinecraftClient.getInstance().textRenderer;
TextRenderer fr = MC.textRenderer;
String title = fr.trimToWidth(window.getTitle(), x3 - x1);
fr.draw(title, x1 + 2, y1, 0xf0f0f0);
}

View File

@ -9,8 +9,8 @@ package net.wurstclient.clickgui;
import java.util.ArrayList;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.wurstclient.WurstClient;
public final class Window
{
@ -114,7 +114,7 @@ public final class Window
maxChildWidth = c.getDefaultWidth();
maxChildWidth += 4;
TextRenderer tr = MinecraftClient.getInstance().textRenderer;
TextRenderer tr = WurstClient.MC.textRenderer;
int titleBarWidth = tr.getStringWidth(title) + 4;
if(minimizable)
titleBarWidth += 11;

View File

@ -11,12 +11,13 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.ChatHud;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.wurstclient.WurstClient;
public enum ChatUtils
{
;
private static final MinecraftClient MC = MinecraftClient.getInstance();
private static final MinecraftClient MC = WurstClient.MC;
public static final String WURST_PREFIX =
"\u00a7c[\u00a76Wurst\u00a7c]\u00a7r ";