Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
add back libs & logger
Browse files Browse the repository at this point in the history
  • Loading branch information
CubeWhy committed Jul 31, 2023
1 parent 490df10 commit 77145ea
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
dependencies {
include fileTree(dir: "libs", includes: ['*.jar'])

include 'org.newdawn.slick:core:1.0.0@core'
// include 'org.newdawn.slick:core:1.0.0@core'

// Don't update mixin
include("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
Expand Down
Binary file added libs/slick.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private void register(Class<? extends CosmeticsBase> clazz) {
} catch (IllegalAccessException e) {
register((CosmeticsBase) ClassUtils.INSTANCE.getObjectInstance(clazz));
} catch (Throwable e) {
e.printStackTrace();
logger.catching(e);
logger.error("Can't load cosmetic " + clazz.getName());
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/cubewhy/lunarcn/event/Event.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package org.cubewhy.lunarcn.event;

import org.cubewhy.lunarcn.utils.ClientUtils;

import java.util.ArrayList;

import static org.cubewhy.lunarcn.utils.ClientUtils.*;

public class Event {
/**
* Call a event
Expand All @@ -17,7 +21,7 @@ public Event callEvent() {
try {
data.target.invoke(data.source, this);
} catch (Exception e) {
e.printStackTrace();
logger.catching(e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.StringUtils;
import org.cubewhy.lunarcn.utils.ClientUtils;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.UnicodeFont;
Expand All @@ -15,6 +16,8 @@
import java.util.List;
import java.util.regex.Pattern;

import static org.cubewhy.lunarcn.utils.ClientUtils.*;

public class CustomFontRenderer {

private static final Pattern COLOR_CODE_PATTERN;
Expand All @@ -41,7 +44,7 @@ public CustomFontRenderer(final String fontName, final float fontSize) {
this.unicodeFont.loadGlyphs();
}
catch (FontFormatException | IOException | SlickException e) {
e.printStackTrace();
logger.catching(e);
}
this.antiAliasingFactor = resolution.getScaleFactor();
}
Expand Down Expand Up @@ -102,7 +105,7 @@ public int drawString(final String text, float x, float y, final int color) {
}
}
catch (FontFormatException | IOException | SlickException e) {
e.printStackTrace();
logger.catching(e);
}
this.antiAliasingFactor = resolution.getScaleFactor();
GL11.glPushMatrix();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.cubewhy.lunarcn.event.events.WorldEvent;
import org.cubewhy.lunarcn.files.configs.ClientConfigFile;
import org.cubewhy.lunarcn.gui.SplashProgress;
import org.cubewhy.lunarcn.utils.ClientUtils;
import org.cubewhy.lunarcn.utils.FileUtils;
import org.cubewhy.lunarcn.utils.GitUtils;
import org.cubewhy.lunarcn.utils.ImageUtils;
Expand All @@ -38,6 +39,8 @@
import java.io.IOException;
import java.nio.ByteBuffer;

import static org.cubewhy.lunarcn.utils.ClientUtils.logger;

@Mixin(Minecraft.class)
abstract public class MixinMinecraft {
@Shadow
Expand Down Expand Up @@ -131,7 +134,7 @@ private void setWindowIcon() {
ImageUtils.readImageToBuffer(image)
});
} catch (IOException e) {
e.printStackTrace();
logger.catching(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.util.MessageSerializer2;
import org.cubewhy.lunarcn.event.events.PacketEvent;
import org.cubewhy.lunarcn.proxy.ProxyManager;
import org.cubewhy.lunarcn.utils.ClientUtils;
import org.cubewhy.lunarcn.utils.PacketUtils;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -25,6 +26,8 @@
import java.net.InetAddress;
import java.net.Proxy;

import static org.cubewhy.lunarcn.utils.ClientUtils.logger;

@Mixin(NetworkManager.class)
public class MixinNetworkManager {
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("RETURN"))
Expand Down Expand Up @@ -59,8 +62,8 @@ private static void createNetworkManagerAndConnect(InetAddress address, int serv
protected void initChannel(Channel channel) {
try {
channel.config().setOption(ChannelOption.TCP_NODELAY, true);
} catch (ChannelException var3) {
var3.printStackTrace();
} catch (ChannelException e) {
logger.catching(e);
}
channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.CLIENTBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.SERVERBOUND)).addLast("packet_handler", networkmanager);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import net.minecraft.launchwrapper.IClassTransformer;
import org.cubewhy.lunarcn.utils.ClassUtils;
import org.cubewhy.lunarcn.utils.ClientUtils;
import org.cubewhy.lunarcn.utils.NodeUtils;
import org.objectweb.asm.tree.*;

import static org.cubewhy.lunarcn.utils.ClientUtils.*;
import static org.objectweb.asm.Opcodes.*;

public class ForgeNetworkTransformer implements IClassTransformer {
Expand Down Expand Up @@ -42,7 +44,7 @@ public byte[] transform(String name, String transformedName, byte[] basicClass)

return ClassUtils.INSTANCE.toBytes(classNode);
} catch (final Throwable throwable) {
throwable.printStackTrace();
logger.catching(throwable);
}
}

Expand All @@ -51,7 +53,7 @@ public byte[] transform(String name, String transformedName, byte[] basicClass)
final ClassNode classNode = ClassUtils.INSTANCE.toClassNode(basicClass);

classNode.methods.stream().filter(method -> {
if (method instanceof MethodNode) {
if (method != null) {
return ((MethodNode) method).name.equals("channelRead0");
}
return false;
Expand All @@ -72,7 +74,7 @@ public byte[] transform(String name, String transformedName, byte[] basicClass)

return ClassUtils.INSTANCE.toBytes(classNode);
} catch (final Throwable throwable) {
throwable.printStackTrace();
logger.catching(throwable);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.cubewhy.lunarcn.injection.transformers;

import net.minecraft.launchwrapper.IClassTransformer;
import org.cubewhy.lunarcn.utils.ClientUtils;
import org.cubewhy.lunarcn.utils.NodeUtils;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
Expand All @@ -11,6 +12,8 @@
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicBoolean;

import static org.cubewhy.lunarcn.utils.ClientUtils.*;

public class OptimizeTransformer implements IClassTransformer {

private static final HashMap<String, String> transformMap = new HashMap<>();
Expand Down Expand Up @@ -64,7 +67,7 @@ public byte[] transform(String name, String transformedName, byte[] basicClass)
return NodeUtils.INSTANCE.toBytes(classNode);
}
} catch (final Throwable throwable) {
throwable.printStackTrace();
logger.catching(throwable);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private void register(Class<? extends Module> moduleClass) {
} catch (IllegalAccessException e) {
register((Module) ClassUtils.INSTANCE.getObjectInstance(moduleClass));
} catch (Throwable e) {
e.printStackTrace();
logger.catching(e);
logger.error("Can't load module " + moduleClass.getName());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void autoRefresh() {
logger.info("Refreshing " + account.getUserName());
} catch (IOException e) {
logger.error("Failed to refresh " + account.getUserName());
e.printStackTrace();
logger.catching(e);
}
}
}
Expand Down Expand Up @@ -245,7 +245,7 @@ public void loginWithBrowser() {
Desktop desktop = Desktop.getDesktop();
desktop.browse(uri);
} catch (Exception e) {
e.printStackTrace();
logger.catching(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import java.util.List;
import java.util.*;

import static org.cubewhy.lunarcn.utils.ClientUtils.logger;

/*
* Created by Eric Golde 7/10/2019
*/
Expand All @@ -30,7 +32,7 @@ private UnicodeFontRenderer(String fontName, int fontType, float fontSize, float
try {
this.unicodeFont = new UnicodeFont(getFontByName(fontName).deriveFont(fontSize * this.antiAliasingFactor));
} catch (FontFormatException | IOException e) {
e.printStackTrace();
logger.catching(e);
}
this.kerning = kerning;

Expand All @@ -40,7 +42,7 @@ private UnicodeFontRenderer(String fontName, int fontType, float fontSize, float
try {
this.unicodeFont.loadGlyphs();
} catch (Exception e) {
e.printStackTrace();
logger.catching(e);
}

for (int i = 0; i < 32; i++) {
Expand Down Expand Up @@ -74,7 +76,7 @@ private UnicodeFontRenderer(Font font, float kerning, float antiAliasingFactor)
try {
this.unicodeFont.loadGlyphs();
} catch (Exception e) {
e.printStackTrace();
logger.catching(e);
}

for (int i = 0; i < 32; i++) {
Expand Down

0 comments on commit 77145ea

Please sign in to comment.