Skip to content

Commit 8ef2031

Browse files
authored
Merge pull request #129 from j10a1n15/chore/feature-removal
2 parents 2247a41 + a2b2564 commit 8ef2031

File tree

70 files changed

+585
-3789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+585
-3789
lines changed

src/main/java/club/sk1er/patcher/Patcher.java

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,18 @@
1010
import club.sk1er.patcher.asm.render.screen.GuiChatTransformer;
1111
import club.sk1er.patcher.commands.PatcherCommand;
1212
import club.sk1er.patcher.config.PatcherConfig;
13-
import club.sk1er.patcher.config.PatcherSoundConfig;
1413
import club.sk1er.patcher.ducks.FontRendererExt;
1514
import club.sk1er.patcher.hooks.EntityRendererHook;
16-
import club.sk1er.patcher.hooks.MinecraftHook;
1715
import club.sk1er.patcher.mixins.features.network.packet.C01PacketChatMessageMixin_ExtendedChatLength;
1816
import club.sk1er.patcher.render.ScreenshotPreview;
1917
import club.sk1er.patcher.screen.PatcherMenuEditor;
2018
import club.sk1er.patcher.screen.render.caching.HUDCaching;
2119
import club.sk1er.patcher.screen.render.overlay.ArmorStatusRenderer;
2220
import club.sk1er.patcher.screen.render.overlay.GlanceRenderer;
23-
import club.sk1er.patcher.screen.render.overlay.ImagePreview;
2421
import club.sk1er.patcher.screen.render.overlay.metrics.MetricsRenderer;
2522
import club.sk1er.patcher.screen.render.title.TitleFix;
26-
import club.sk1er.patcher.util.chat.ChatHandler;
2723
import club.sk1er.patcher.util.enhancement.EnhancementManager;
28-
import club.sk1er.patcher.util.enhancement.ReloadListener;
2924
import club.sk1er.patcher.util.forge.EntrypointCaching;
30-
import club.sk1er.patcher.util.fov.FovHandler;
3125
import club.sk1er.patcher.util.keybind.FunctionKeyChanger;
3226
import club.sk1er.patcher.util.keybind.KeybindDropModifier;
3327
import club.sk1er.patcher.util.keybind.MousePerspectiveKeybindHandler;
@@ -36,15 +30,12 @@
3630
import club.sk1er.patcher.util.status.ProtocolVersionDetector;
3731
import club.sk1er.patcher.util.world.SavesWatcher;
3832
import club.sk1er.patcher.util.world.render.entity.EntityRendering;
39-
import club.sk1er.patcher.util.world.sound.SoundHandler;
4033
import club.sk1er.patcher.util.world.sound.audioswitcher.AudioSwitcher;
4134
import com.google.gson.JsonObject;
4235
import net.minecraft.client.Minecraft;
4336
import net.minecraft.client.gui.FontRenderer;
44-
import net.minecraft.client.resources.IReloadableResourceManager;
4537
import net.minecraft.client.settings.KeyBinding;
4638
import net.minecraftforge.common.ForgeVersion;
47-
import net.minecraftforge.common.MinecraftForge;
4839
import net.minecraftforge.fml.client.registry.ClientRegistry;
4940
import net.minecraftforge.fml.common.Loader;
5041
import net.minecraftforge.fml.common.Mod;
@@ -94,7 +85,6 @@ public class Patcher
9485
private KeyBinding dropModifier, hideScreen, customDebug, clearShaders;
9586

9687
private PatcherConfig patcherConfig;
97-
private PatcherSoundConfig patcherSoundConfig;
9888

9989
private boolean loadedGalacticFontRenderer;
10090

@@ -112,13 +102,6 @@ public void onInit(FMLInitializationEvent event) {
112102
);
113103

114104
patcherConfig = PatcherConfig.INSTANCE;
115-
//todo
116-
//patcherSoundConfig = new PatcherSoundConfig(null, null);
117-
118-
SoundHandler soundHandler = new SoundHandler();
119-
IReloadableResourceManager resourceManager = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
120-
resourceManager.registerReloadListener(soundHandler);
121-
resourceManager.registerReloadListener(new ReloadListener());
122105

123106
registerCommands(
124107
new PatcherCommand(),
@@ -128,13 +111,12 @@ public void onInit(FMLInitializationEvent event) {
128111
);
129112

130113
registerEvents(
131-
this, soundHandler, dropModifier, audioSwitcher,
132-
new EntityRendering(), new FovHandler(),
133-
new ChatHandler(), new GlanceRenderer(),
134-
new ArmorStatusRenderer(), new PatcherMenuEditor(), new ImagePreview(),
114+
this, dropModifier, audioSwitcher,
115+
new EntityRendering(), new GlanceRenderer(),
116+
new ArmorStatusRenderer(), new PatcherMenuEditor(),
135117
new TitleFix(), new LinuxKeybindFix(),
136118
new MetricsRenderer(), new HUDCaching(), new EntityRendererHook(),
137-
MinecraftHook.INSTANCE, ScreenshotPreview.INSTANCE,
119+
ScreenshotPreview.INSTANCE,
138120
new MousePerspectiveKeybindHandler()
139121
);
140122

@@ -326,13 +308,8 @@ private void loadBlacklistedServers() {
326308
}
327309

328310
private void fixSettings() {
329-
if (PatcherConfig.fireOverlayHeight < -0.5F || PatcherConfig.fireOverlayHeight > 1.5F) {
330-
PatcherConfig.fireOverlayHeight = 0.0F;
331-
}
332311
if (PatcherConfig.customZoomSensitivity > 1.0F) PatcherConfig.customZoomSensitivity = 1.0F;
333-
if (PatcherConfig.imagePreviewWidth > 1.0F) PatcherConfig.imagePreviewWidth = 0.5F;
334312
if (PatcherConfig.previewScale > 1.0F) PatcherConfig.previewScale = 1.0F;
335-
if (PatcherConfig.unfocusedFPSAmount < 15) PatcherConfig.unfocusedFPSAmount = 15;
336313

337314
this.forceSaveConfig();
338315
}
@@ -348,15 +325,6 @@ private void detectIncompatibilities(List<ModContainer> activeModList) {
348325
PatcherConfig.entityCulling = false;
349326
}
350327

351-
if ((modId.equals("labymod") || modId.equals("enhancements")) || modId.equals("hychat")) {
352-
if (PatcherConfig.compactChat) {
353-
Notifications.enqueue(
354-
Notifications.Type.Error,
355-
"Patcher", baseMessage + "Compact Chat is now disabled.");
356-
PatcherConfig.compactChat = false;
357-
}
358-
}
359-
360328
if (PatcherConfig.optimizedFontRenderer && modId.equals("smoothfont")) {
361329
Notifications.enqueue(
362330
Notifications.Type.Error,
@@ -418,10 +386,6 @@ public PatcherConfig getPatcherConfig() {
418386
return patcherConfig;
419387
}
420388

421-
public PatcherSoundConfig getPatcherSoundConfig() {
422-
return patcherSoundConfig;
423-
}
424-
425389
public static Logger getLogger() {
426390
return logger;
427391
}

src/main/java/club/sk1er/patcher/asm/render/screen/GuiChatTransformer.java

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -86,92 +86,10 @@ public void transform(ClassNode classNode, String name) {
8686
}
8787
break;
8888
}
89-
90-
case "keyTyped":
91-
case "func_73869_a": {
92-
final ListIterator<AbstractInsnNode> iterator = methodNode.instructions.iterator();
93-
94-
while (iterator.hasNext()) {
95-
AbstractInsnNode next = iterator.next();
96-
97-
if (next instanceof MethodInsnNode && next.getOpcode() == Opcodes.INVOKEVIRTUAL) {
98-
final String methodNameInsn = mapMethodNameFromNode(next);
99-
100-
if (methodNameInsn.equals("displayGuiScreen") || methodNameInsn.equals("func_147108_a")) {
101-
AbstractInsnNode unused = next;
102-
for (int i = 0; i < 8; i++) {
103-
unused = unused.getPrevious();
104-
}
105-
106-
boolean insert = unused instanceof MethodInsnNode && unused.getOpcode() == Opcodes.INVOKEVIRTUAL;
107-
108-
if (insert) {
109-
for (int i = 0; i < 4; i++) {
110-
next = next.getPrevious();
111-
}
112-
113-
LabelNode gotoInsn = new LabelNode();
114-
methodNode.instructions.insertBefore(next, checkChat(gotoInsn));
115-
116-
for (int i = 0; i < 4; i++) {
117-
next = next.getNext();
118-
}
119-
120-
methodNode.instructions.insertBefore(next.getNext(), gotoInsn);
121-
}
122-
}
123-
}
124-
}
125-
126-
break;
127-
}
128-
129-
case "func_73864_a":
130-
case "mouseClicked": {
131-
final ListIterator<AbstractInsnNode> iterator = methodNode.instructions.iterator();
132-
133-
while (iterator.hasNext()) {
134-
final AbstractInsnNode next = iterator.next();
135-
136-
if (next instanceof MethodInsnNode && next.getOpcode() == Opcodes.INVOKEVIRTUAL) {
137-
final String methodInsnName = mapMethodNameFromNode(next);
138-
if (methodInsnName.equals("handleComponentClick") || methodInsnName.equals("func_175276_a")) {
139-
methodNode.instructions.insertBefore(next.getNext().getNext(),
140-
new MethodInsnNode(Opcodes.INVOKESTATIC, getHookClass("GuiNewChatHook"), "mouseClicked", "()V", false));
141-
}
142-
}
143-
}
144-
145-
break;
146-
}
14789
}
14890
}
14991
}
15092

151-
private InsnList checkChat(LabelNode gotoInsn) {
152-
InsnList list = new InsnList();
153-
list.add(getPatcherSetting("shiftChat", "Z"));
154-
LabelNode ifeq = new LabelNode();
155-
list.add(new JumpInsnNode(Opcodes.IFEQ, ifeq));
156-
list.add(new VarInsnNode(Opcodes.ALOAD, 0));
157-
list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", "holdingShift", "Z"));
158-
LabelNode ifne = new LabelNode();
159-
list.add(new JumpInsnNode(Opcodes.IFNE, ifne));
160-
list.add(new VarInsnNode(Opcodes.ALOAD, 0));
161-
list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", "field_146297_k", "Lnet/minecraft/client/Minecraft;"));
162-
list.add(new InsnNode(Opcodes.ACONST_NULL));
163-
list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/Minecraft", "func_147108_a", "(Lnet/minecraft/client/gui/GuiScreen;)V", false));
164-
list.add(new JumpInsnNode(Opcodes.GOTO, gotoInsn));
165-
list.add(ifne);
166-
list.add(new VarInsnNode(Opcodes.ALOAD, 0));
167-
list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", "field_146415_a", "Lnet/minecraft/client/gui/GuiTextField;"));
168-
list.add(new LdcInsnNode(""));
169-
list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", "func_146180_a", "(Ljava/lang/String;)V", false));
170-
list.add(new JumpInsnNode(Opcodes.GOTO, gotoInsn));
171-
list.add(ifeq);
172-
return list;
173-
}
174-
17593
private InsnList setText() {
17694
InsnList list = new InsnList();
17795
list.add(new VarInsnNode(Opcodes.ILOAD, 1));

src/main/java/club/sk1er/patcher/commands/PatcherCommand.java

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -51,88 +51,11 @@ public void fov(@Param("amount") float amount) {
5151
mc.gameSettings.saveOptions();
5252
}
5353

54-
@Handler(value = {"scale", "invscale", "inventoryscale"}, description = "Change the scale of your inventory independent of your GUI scale.")
55-
public void scale(@Param
56-
//TODO
57-
//(autoCompletesTo = {"help", "off", "none", "small", "normal", "large", "auto", "0", "1", "2", "3", "4", "5"})
58-
String argument) {
59-
if (argument.equalsIgnoreCase("help")) {
60-
ChatUtilities.sendMessage(new MCSimpleTextHolder(" Inventory Scale").withFormatting(MCTextFormat.YELLOW), false);
61-
ChatUtilities.sendMessage(new MCSimpleTextHolder("Usage: /inventoryscale <scaling>").withFormatting(MCTextFormat.GRAY), false);
62-
ChatUtilities.sendMessage(new MCSimpleTextHolder("Scaling may be a number between 1-5, or").withFormatting(MCTextFormat.GRAY), false);
63-
ChatUtilities.sendMessage(new MCSimpleTextHolder("small/normal/large/auto").withFormatting(MCTextFormat.GRAY), false);
64-
ChatUtilities.sendMessage(new MCSimpleTextHolder("Use '/inventoryscale off' to disable scaling.").withFormatting(MCTextFormat.GRAY), false);
65-
return;
66-
}
67-
68-
if (argument.equalsIgnoreCase("off") || argument.equalsIgnoreCase("none")) {
69-
ChatUtilities.sendNotification("Inventory Scale", "Disabled inventory scaling.");
70-
PatcherConfig.inventoryScale = 0;
71-
Patcher.instance.forceSaveConfig();
72-
return;
73-
}
74-
75-
int scaling;
76-
if (argument.equalsIgnoreCase("small")) {
77-
scaling = 1;
78-
} else if (argument.equalsIgnoreCase("normal")) {
79-
scaling = 2;
80-
} else if (argument.equalsIgnoreCase("large")) {
81-
scaling = 3;
82-
} else if (argument.equalsIgnoreCase("auto")) {
83-
scaling = 5;
84-
} else {
85-
try {
86-
scaling = Integer.parseInt(argument);
87-
} catch (Exception e) {
88-
ChatUtilities.sendNotification("Inventory Scale", "Invalid scaling identifier. Use '/patcher scale help' for assistance.");
89-
return;
90-
}
91-
}
92-
93-
if (scaling < 1) {
94-
ChatUtilities.sendNotification("Inventory Scale", "Disabled inventory scaling.");
95-
PatcherConfig.inventoryScale = 0;
96-
Patcher.instance.forceSaveConfig();
97-
return;
98-
} else if (scaling > 5) {
99-
ChatUtilities.sendNotification("Inventory Scale", "Invalid scaling. Must be between 1-5.");
100-
return;
101-
}
102-
103-
ChatUtilities.sendNotification("Inventory Scale", "Set inventory scaling to " + scaling);
104-
PatcherConfig.inventoryScale = scaling;
105-
Patcher.instance.forceSaveConfig();
106-
}
107-
10854
@Handler(value = "sendcoords", description = "Send your current coordinates in chat. Anything after 'sendcoords' will be put at the end of the message.")
10955
public void sendcoords(@Param("additional information") @Nullable String message) {
11056
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
11157
player.sendChatMessage("x: " + (int) player.posX + ", y: " + (int) player.posY + ", z: " + (int) player.posZ +
11258
// might be an issue if they provide a long message?
11359
" " + ((message == null) ? "" : message));
11460
}
115-
116-
@Handler(value = "sounds", description = "Open the Sound Configuration GUI.")
117-
public void sounds() {
118-
//todo
119-
//Patcher.instance.getPatcherSoundConfig().openGui();
120-
}
121-
122-
@Handler(value = "fps", description = "Choose what to limit the game's framerate to outside of Minecraft's options. 0 will use your normal framerate.")
123-
public void fps(@Param("amount") int amount) {
124-
if (amount < 0) {
125-
ChatUtilities.sendNotification("Custom FPS Limiter", "You cannot set your framerate to a negative number.");
126-
return;
127-
} else if (amount == PatcherConfig.customFpsLimit) {
128-
ChatUtilities.sendNotification("Custom FPS Limiter", "Custom framerate is already set to this value.");
129-
return;
130-
}
131-
132-
PatcherConfig.customFpsLimit = amount;
133-
Patcher.instance.forceSaveConfig();
134-
135-
String message = amount == 0 ? "Custom framerate was reset." : "Custom framerate set to " + amount + ".";
136-
ChatUtilities.sendNotification("Custom FPS Limiter", message);
137-
}
13861
}

0 commit comments

Comments
 (0)