From 0945eebf7e72d1759d754e92e7cd183577b00386 Mon Sep 17 00:00:00 2001 From: Jake Ward Date: Tue, 27 Feb 2024 13:53:50 +0000 Subject: [PATCH 01/10] fix: Imgur links not being previewed and extra extension sometimes being added (#169) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix Imgur links not previewing & extra extension being added * Remove unused import Added this when debugging the issue and i forgor to remove 💀 --- .../sk1er/patcher/screen/render/overlay/ImagePreview.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/club/sk1er/patcher/screen/render/overlay/ImagePreview.java b/src/main/java/club/sk1er/patcher/screen/render/overlay/ImagePreview.java index 7063778e2..e048b351c 100644 --- a/src/main/java/club/sk1er/patcher/screen/render/overlay/ImagePreview.java +++ b/src/main/java/club/sk1er/patcher/screen/render/overlay/ImagePreview.java @@ -82,7 +82,7 @@ private void handle(String value) { return; } - if (value.contains("imgur.com/")) { + if (value.contains("imgur.com/") && !value.contains("i.imgur")) { final String[] split = value.split("/"); value = String.format("https://i.imgur.com/%s.png", split[split.length - 1]); } @@ -156,6 +156,10 @@ private void loadUrl(String url) { connection.setUseCaches(true); connection.setInstanceFollowRedirects(true); connection.addRequestProperty("User-Agent", "Patcher Image Previewer"); + if (url.contains("imgur")) { + // Prevents redirect to main website + connection.addRequestProperty("Referer", "https://imgur.com/"); + } connection.setReadTimeout(15000); connection.setConnectTimeout(15000); connection.setDoOutput(true); From 063489b3e2356b924573485b2e6a794c2351ff38 Mon Sep 17 00:00:00 2001 From: sychic <47618543+Sychic@users.noreply.github.com> Date: Fri, 15 Mar 2024 20:22:48 -0400 Subject: [PATCH 02/10] ImagePreview: add logging for url lookup fail instead of silent failing --- .../club/sk1er/patcher/screen/render/overlay/ImagePreview.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/club/sk1er/patcher/screen/render/overlay/ImagePreview.java b/src/main/java/club/sk1er/patcher/screen/render/overlay/ImagePreview.java index e048b351c..64d4d4f5f 100644 --- a/src/main/java/club/sk1er/patcher/screen/render/overlay/ImagePreview.java +++ b/src/main/java/club/sk1er/patcher/screen/render/overlay/ImagePreview.java @@ -73,6 +73,7 @@ private void handle(String value) { if (!found) return; } catch (MalformedURLException e) { + Patcher.instance.getLogger().error("Error during url lookup: " + value, e); return; } From d130368f4d8e98d3f493d85314944a6d1b0a7733 Mon Sep 17 00:00:00 2001 From: Oondanomala <87101222+Oondanomala@users.noreply.github.com> Date: Sat, 16 Mar 2024 02:40:37 +0100 Subject: [PATCH 03/10] IncentoryScaleCommand: hide command alias from autocompletion (#174) --- .../java/club/sk1er/patcher/commands/InventoryScaleCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/club/sk1er/patcher/commands/InventoryScaleCommand.java b/src/main/java/club/sk1er/patcher/commands/InventoryScaleCommand.java index 50e72ff72..1cebda255 100644 --- a/src/main/java/club/sk1er/patcher/commands/InventoryScaleCommand.java +++ b/src/main/java/club/sk1er/patcher/commands/InventoryScaleCommand.java @@ -21,6 +21,6 @@ public void handle() { @Nullable @Override public Set getCommandAliases() { - return Collections.singleton(new Alias("inventoryscale")); + return Collections.singleton(new Alias("inventoryscale", true)); } } From ac807ba9f8617560b2e17af3e54b83fb8ee4def6 Mon Sep 17 00:00:00 2001 From: sychic <47618543+Sychic@users.noreply.github.com> Date: Fri, 15 Mar 2024 21:38:01 -0400 Subject: [PATCH 04/10] feat: add clicked commands to chat history closes #172 --- .../sk1er/patcher/config/PatcherConfig.java | 9 +++++++++ .../GuiChatMixin_SafeChatClicksHistory.java | 19 +++++++++++++++++++ src/main/resources/patcher.mixins.json | 5 +++-- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 src/main/java/club/sk1er/patcher/mixins/features/GuiChatMixin_SafeChatClicksHistory.java diff --git a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java index b803e6ad7..0f222bfec 100644 --- a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java +++ b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java @@ -1121,6 +1121,13 @@ public static int getInventoryScale() { ) public static boolean safeChatClicks; + @Property( + type = PropertyType.SWITCH, name = "Safe Chat Clicks History", + description = "Adds commands sent from clicking chat messages to the chat history.", + category = "Screens", subcategory = "Chat" + ) + public static boolean safeChatClicksHistory; + @Property( type = PropertyType.SWITCH, name = "Smart Disconnect", description = "Choose between disconnecting or relogging when clicking the disconnect button.\n§eOnly works on Multiplayer servers.", @@ -1311,6 +1318,8 @@ public PatcherConfig() { addDependency("cacheFontData", "optimizedFontRenderer"); addDependency("chunkUpdateLimit", "limitChunks"); + addDependency("safeChatClicksHistory", "safeChatClicks"); + Arrays.asList( "screenshotNoFeedback", "compactScreenshotResponse", "autoCopyScreenshot", "screenshotPreview", "previewTime", "previewAnimationStyle", "previewScale", "favoriteScreenshot", diff --git a/src/main/java/club/sk1er/patcher/mixins/features/GuiChatMixin_SafeChatClicksHistory.java b/src/main/java/club/sk1er/patcher/mixins/features/GuiChatMixin_SafeChatClicksHistory.java new file mode 100644 index 000000000..89bbadc51 --- /dev/null +++ b/src/main/java/club/sk1er/patcher/mixins/features/GuiChatMixin_SafeChatClicksHistory.java @@ -0,0 +1,19 @@ +package club.sk1er.patcher.mixins.features; + +import club.sk1er.patcher.config.PatcherConfig; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiScreen; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +@Mixin(GuiScreen.class) +public abstract class GuiChatMixin_SafeChatClicksHistory extends Gui { + + @ModifyArg(method = "handleComponentClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;sendChatMessage(Ljava/lang/String;Z)V"), index = 1) + public boolean patcher$handleComponentClick(boolean addToChat) { + + return addToChat || (PatcherConfig.safeChatClicksHistory && ((Object) this) instanceof GuiChat); + } +} diff --git a/src/main/resources/patcher.mixins.json b/src/main/resources/patcher.mixins.json index 9d7884995..46e15d184 100644 --- a/src/main/resources/patcher.mixins.json +++ b/src/main/resources/patcher.mixins.json @@ -24,8 +24,6 @@ "accessors.KeyBindingAccessor", "accessors.MinecraftAccessor", "accessors.MinecraftForgeClientAccessor", - "accessors.optifine.ConfigAccessor", - "accessors.optifine.CustomColorsAccessor", "accessors.PositionedSoundAccessor", "accessors.RenderManagerAccessor", "accessors.ResourcePackRepositoryAccessor", @@ -33,6 +31,8 @@ "accessors.SoundManagerAccessor", "accessors.SoundRegistryAccessor", "accessors.WorldRendererAccessor", + "accessors.optifine.ConfigAccessor", + "accessors.optifine.CustomColorsAccessor", "bugfixes.BlockFluidRendererMixin_FixStitching", "bugfixes.BlockModelRendererMixin_SmoothLighting", "bugfixes.CommandHandlerMixin_CaseCommands", @@ -129,6 +129,7 @@ "features.FontRenderMixin_ShadowTypes", "features.GuiAchievementMixin_CancelRender", "features.GuiChatMixin_ExtendedChatLength", + "features.GuiChatMixin_SafeChatClicksHistory", "features.GuiContainerMixin_ClickOutOfContainers", "features.GuiContainerMixin_DropModifierKey", "features.GuiIngameForgeMixin_ActionbarText", From a32c2c0ea921d7cf9b5334b80230dcf10fffeff9 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Fri, 15 Mar 2024 22:32:26 -0400 Subject: [PATCH 05/10] fix: add dev mappings to ASM transformers (#173) --- .../render/ForgeHooksClientTransformer.java | 2 +- .../render/screen/GuiModListTransformer.java | 2 +- .../render/screen/GuiUtilsTransformer.java | 8 ++-- .../EntityRendererReflectionOptimizer.java | 4 +- ...tendedBlockStorageReflectionOptimizer.java | 2 +- .../witherfix/EntityWitherTransformer.java | 2 +- .../packet/S34PacketMapsTransformer.java | 4 +- .../particle/EffectRendererTransformer.java | 10 ++--- .../asm/render/screen/GuiChatTransformer.java | 26 ++++++------- .../InventoryEffectRendererTransformer.java | 6 +-- .../render/world/RenderGlobalTransformer.java | 4 +- .../world/entity/RenderPlayerTransformer.java | 10 ++--- .../world/entity/RenderWitherTransformer.java | 2 +- .../world/entity/RenderXPOrbTransformer.java | 2 +- .../WorldVertexBufferUploaderTransformer.kt | 39 ++++++++++++------- 15 files changed, 68 insertions(+), 55 deletions(-) diff --git a/src/main/java/club/sk1er/patcher/asm/external/forge/render/ForgeHooksClientTransformer.java b/src/main/java/club/sk1er/patcher/asm/external/forge/render/ForgeHooksClientTransformer.java index 511198fb0..5c92d572f 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/forge/render/ForgeHooksClientTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/forge/render/ForgeHooksClientTransformer.java @@ -38,7 +38,7 @@ public void transform(ClassNode classNode, String name) { if (next instanceof MethodInsnNode && next.getOpcode() == Opcodes.INVOKEVIRTUAL) { final String methodInsnName = mapMethodNameFromNode(next); if (methodInsnName.equals("getY") || methodInsnName.equals("func_177956_o")) { - ((MethodInsnNode) next).name = "func_177952_p"; // getZ + ((MethodInsnNode) next).name = isDevelopment() ? "getZ" : "func_177952_p"; break; } } diff --git a/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiModListTransformer.java b/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiModListTransformer.java index c56367841..7027f0a71 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiModListTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiModListTransformer.java @@ -41,7 +41,7 @@ public void transform(ClassNode classNode, String name) { // auto-closing stream if (next instanceof MethodInsnNode && ((MethodInsnNode) next).name.equals("read")) { ((MethodInsnNode) next).owner = "net/minecraft/client/renderer/texture/TextureUtil"; - ((MethodInsnNode) next).name = "func_177053_a"; // readBufferedImage + ((MethodInsnNode) next).name = isDevelopment() ? "readBufferedImage" : "func_177053_a"; ((MethodInsnNode) next).desc = "(Ljava/io/InputStream;)Ljava/awt/image/BufferedImage;"; break; } diff --git a/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiUtilsTransformer.java b/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiUtilsTransformer.java index c0b5da2ef..a80df4886 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiUtilsTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiUtilsTransformer.java @@ -34,14 +34,14 @@ public void transform(ClassNode classNode, String name) { } } } else if (next instanceof VarInsnNode && next.getOpcode() == Opcodes.ISTORE && ((VarInsnNode) next).var == 17) { - methodNode.instructions.insert(next, new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179097_i", "()V", false)); + methodNode.instructions.insert(next, new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "disableDepth" : "func_179097_i", "()V", false)); } } methodNode.instructions.insert(getMoveForward()); methodNode.instructions.insertBefore( methodNode.instructions.getLast().getPrevious(), - new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179121_F", "()V", false) + new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "popMatrix" : "func_179121_F", "()V", false) ); } } @@ -49,11 +49,11 @@ public void transform(ClassNode classNode, String name) { private InsnList getMoveForward() { InsnList insnList = new InsnList(); - insnList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179094_E", "()V", false)); + insnList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "pushMatrix" : "func_179094_E", "()V", false)); insnList.add(new LdcInsnNode(0F)); insnList.add(new LdcInsnNode(0F)); insnList.add(new LdcInsnNode(-1F)); - insnList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179109_b", "(FFF)V", false)); + insnList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "translate" : "func_179109_b", "(FFF)V", false)); return insnList; } } diff --git a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/EntityRendererReflectionOptimizer.java b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/EntityRendererReflectionOptimizer.java index 06c4b3e29..a89a968e3 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/EntityRendererReflectionOptimizer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/EntityRendererReflectionOptimizer.java @@ -48,8 +48,8 @@ public void transform(ClassNode classNode, String name) { private InsnList optimizeReflection() { InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/EntityRenderer", "field_78531_r", "Lnet/minecraft/client/Minecraft;")); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", "field_71462_r", "Lnet/minecraft/client/gui/GuiScreen;")); + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/EntityRenderer", isDevelopment() ? "mc" : "field_78531_r", "Lnet/minecraft/client/Minecraft;")); + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", isDevelopment() ? "currentScreen" : "field_71462_r", "Lnet/minecraft/client/gui/GuiScreen;")); list.add(new VarInsnNode(Opcodes.ILOAD, 8)); list.add(new VarInsnNode(Opcodes.ILOAD, 9)); list.add(new VarInsnNode(Opcodes.FLOAD, 1)); diff --git a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/ExtendedBlockStorageReflectionOptimizer.java b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/ExtendedBlockStorageReflectionOptimizer.java index 65fea0eb5..b9ac149f2 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/ExtendedBlockStorageReflectionOptimizer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/ExtendedBlockStorageReflectionOptimizer.java @@ -16,7 +16,7 @@ public String[] getClassName() { public void transform(ClassNode classNode, String name) { for (MethodNode methodNode : classNode.methods) { final String methodName = mapMethodName(classNode, methodNode); - if (methodName.equals("func_177484_a")) { + if (methodName.equals("set") || methodName.equals("func_177484_a")) { final InsnList instructions = methodNode.instructions; final Iterator iterator = instructions.iterator(); while (iterator.hasNext()) { diff --git a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/witherfix/EntityWitherTransformer.java b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/witherfix/EntityWitherTransformer.java index 19c62ca06..d9012f4b4 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/witherfix/EntityWitherTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/witherfix/EntityWitherTransformer.java @@ -45,7 +45,7 @@ public void transform(ClassNode classNode, String name) { private InsnList checkVisibility() { InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/entity/boss/EntityWither", "func_82150_aj", "()Z", false)); + list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/entity/boss/EntityWither", isDevelopment() ? "isInvisible" : "func_82150_aj", "()Z", false)); LabelNode ifeq = new LabelNode(); list.add(new JumpInsnNode(Opcodes.IFEQ, ifeq)); list.add(new InsnNode(Opcodes.RETURN)); diff --git a/src/main/java/club/sk1er/patcher/asm/network/packet/S34PacketMapsTransformer.java b/src/main/java/club/sk1er/patcher/asm/network/packet/S34PacketMapsTransformer.java index ba92f9513..45260210f 100644 --- a/src/main/java/club/sk1er/patcher/asm/network/packet/S34PacketMapsTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/network/packet/S34PacketMapsTransformer.java @@ -46,7 +46,7 @@ public void transform(ClassNode classNode, String name) { } } - public static InsnList checkMapBytesLength() { + public InsnList checkMapBytesLength() { InsnList list = new InsnList(); LabelNode checkSize = new LabelNode(); @@ -54,7 +54,7 @@ public static InsnList checkMapBytesLength() { list.add(new FieldInsnNode( Opcodes.GETFIELD, "net/minecraft/network/play/server/S34PacketMaps", - "field_179741_h", + isDevelopment() ? "mapDataBytes" : "field_179741_h", "[B" )); list.add(new InsnNode(Opcodes.DUP)); diff --git a/src/main/java/club/sk1er/patcher/asm/render/particle/EffectRendererTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/particle/EffectRendererTransformer.java index f59ee3922..f1c6bccbc 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/particle/EffectRendererTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/particle/EffectRendererTransformer.java @@ -58,15 +58,15 @@ private InsnList reassignRotation() { list.add(new LdcInsnNode(0.017453292F)); list.add(new VarInsnNode(Opcodes.FSTORE, 3)); // actual fix for mc-74764 - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178808_b", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationX" : "func_178808_b", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 4)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178803_d", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationZ" : "func_178803_d", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 5)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178805_e", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationYZ" : "func_178805_e", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 6)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178807_f", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationXY" : "func_178807_f", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 7)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178809_c", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationXZ" : "func_178809_c", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 8)); return list; } diff --git a/src/main/java/club/sk1er/patcher/asm/render/screen/GuiChatTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/screen/GuiChatTransformer.java index 8161211e4..cffdc51b6 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/screen/GuiChatTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/screen/GuiChatTransformer.java @@ -158,15 +158,15 @@ private InsnList checkChat(LabelNode gotoInsn) { LabelNode ifne = new LabelNode(); list.add(new JumpInsnNode(Opcodes.IFNE, ifne)); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", "field_146297_k", "Lnet/minecraft/client/Minecraft;")); + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", isDevelopment() ? "mc" : "field_146297_k", "Lnet/minecraft/client/Minecraft;")); list.add(new InsnNode(Opcodes.ACONST_NULL)); - list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/Minecraft", "func_147108_a", "(Lnet/minecraft/client/gui/GuiScreen;)V", false)); + list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/Minecraft", isDevelopment() ? "displayGuiScreen" : "func_147108_a", "(Lnet/minecraft/client/gui/GuiScreen;)V", false)); list.add(new JumpInsnNode(Opcodes.GOTO, gotoInsn)); list.add(ifne); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", "field_146415_a", "Lnet/minecraft/client/gui/GuiTextField;")); + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", isDevelopment() ? "inputField" : "field_146415_a", "Lnet/minecraft/client/gui/GuiTextField;")); list.add(new LdcInsnNode("")); - list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", "func_146180_a", "(Ljava/lang/String;)V", false)); + list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", isDevelopment() ? "setText" : "func_146180_a", "(Ljava/lang/String;)V", false)); list.add(new JumpInsnNode(Opcodes.GOTO, gotoInsn)); list.add(ifeq); return list; @@ -180,16 +180,16 @@ private InsnList setText() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - "field_146415_a", // inputField + isDevelopment() ? "inputField" : "field_146415_a", "Lnet/minecraft/client/gui/GuiTextField;")); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - "field_146409_v", // defaultInputFieldText + isDevelopment() ? "defaultInputFieldText" : "field_146409_v", "Ljava/lang/String;")); list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", - "func_146180_a", // setText + isDevelopment() ? "setText" : "func_146180_a", "(Ljava/lang/String;)V", false)); LabelNode gotoInsn = new LabelNode(); @@ -198,12 +198,12 @@ private InsnList setText() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - "field_146415_a", // inputField + isDevelopment() ? "inputField" : "field_146415_a", "Lnet/minecraft/client/gui/GuiTextField;")); list.add(new VarInsnNode(Opcodes.ALOAD, 2)); list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", - "func_146180_a", // setText + isDevelopment() ? "setText" : "func_146180_a", "(Ljava/lang/String;)V", false)); list.add(gotoInsn); @@ -215,7 +215,7 @@ private InsnList createWasInitBefore() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - "field_146415_a", // inputField + isDevelopment() ? "inputField" : "field_146415_a", "Lnet/minecraft/client/gui/GuiTextField;")); LabelNode ifnull = new LabelNode(); list.add(new JumpInsnNode(Opcodes.IFNULL, ifnull)); @@ -232,11 +232,11 @@ private InsnList createWasInitBefore() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - "field_146415_a", // inputField + isDevelopment() ? "inputField" : "field_146415_a", "Lnet/minecraft/client/gui/GuiTextField;")); list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", - "func_146179_b", // getText + isDevelopment() ? "getText" : "func_146179_b", "()Ljava/lang/String;", false)); LabelNode gotoInsn2 = new LabelNode(); @@ -251,7 +251,7 @@ private InsnList createWasInitBefore() { private InsnList getOption(LabelNode ifne) { InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/gui/GuiChat", "func_146272_n", "()Z", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/gui/GuiChat", isDevelopment() ? "isShiftKeyDown" : "func_146272_n", "()Z", false)); list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/gui/GuiChat", "holdingShift", "Z")); list.add(getPatcherSetting("transparentChatInputField", "Z")); list.add(new JumpInsnNode(Opcodes.IFNE, ifne)); diff --git a/src/main/java/club/sk1er/patcher/asm/render/screen/InventoryEffectRendererTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/screen/InventoryEffectRendererTransformer.java index 4c796fa4c..96f5c454e 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/screen/InventoryEffectRendererTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/screen/InventoryEffectRendererTransformer.java @@ -64,15 +64,15 @@ private InsnList newEffectLogic() { list.add(new JumpInsnNode(Opcodes.IFEQ, ifeq)); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", "field_146294_l", // width + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", isDevelopment() ? "width" : "field_146294_l", "I")); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", "field_146999_f", // xSize + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", isDevelopment() ? "xSize" : "field_146999_f", "I")); list.add(new InsnNode(Opcodes.ISUB)); list.add(new InsnNode(Opcodes.ICONST_2)); list.add(new InsnNode(Opcodes.IDIV)); - list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", "field_147003_i", // guiLeft + list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", isDevelopment() ? "guiLeft" : "field_147003_i", "I")); list.add(new InsnNode(Opcodes.RETURN)); list.add(ifeq); diff --git a/src/main/java/club/sk1er/patcher/asm/render/world/RenderGlobalTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/world/RenderGlobalTransformer.java index 76db066eb..a538af8d2 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/world/RenderGlobalTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/world/RenderGlobalTransformer.java @@ -76,12 +76,12 @@ public void transform(ClassNode classNode, String name) { if (next.getOpcode() == Opcodes.INVOKEVIRTUAL) { if (methodInsnName.equals("getClosestDistance") || methodInsnName.equals("func_177729_b")) { methodNode.instructions.insertBefore(next.getPrevious().getPrevious().getPrevious(), - new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179106_n", "()V", false)); + new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "disableFog" : "func_179106_n", "()V", false)); } } else if (next.getOpcode() == Opcodes.INVOKESTATIC) { if ((methodInsnName.equals("depthMask") || methodInsnName.equals("func_179132_a")) && next.getPrevious().getOpcode() == Opcodes.ICONST_1) { methodNode.instructions.insert(next, - new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179127_m", "()V", false) + new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "enableFog" : "func_179127_m", "()V", false) ); } } diff --git a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderPlayerTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderPlayerTransformer.java index 58cefae87..ae89f8d30 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderPlayerTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderPlayerTransformer.java @@ -38,7 +38,7 @@ public void transform(ClassNode classNode, String name) { for (MethodNode methodNode : classNode.methods) { String methodName = mapMethodName(classNode, methodNode); - MethodInsnNode disableBlend = new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179084_k", "()V", false); + MethodInsnNode disableBlend = new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "disableBlend" : "func_179084_k", "()V", false); switch (methodName) { //#if MC==10809 case "renderRightArm": @@ -110,18 +110,18 @@ private InsnList checkHatLayer() { InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 1)); list.add(new FieldInsnNode(Opcodes.GETSTATIC, "net/minecraft/entity/player/EnumPlayerModelParts", "HAT", "Lnet/minecraft/entity/player/EnumPlayerModelParts;")); - list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/entity/AbstractClientPlayer", "func_175148_a", "(Lnet/minecraft/entity/player/EnumPlayerModelParts;)Z", false)); + list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/entity/AbstractClientPlayer", isDevelopment() ? "func_175148_a" : "isWearing", "(Lnet/minecraft/entity/player/EnumPlayerModelParts;)Z", false)); return list; } - public static InsnList enableBlend() { + public InsnList enableBlend() { InsnList list = new InsnList(); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179147_l", "()V", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "enableBlend" : "func_179147_l", "()V", false)); list.add(new IntInsnNode(Opcodes.SIPUSH, GL11.GL_SRC_ALPHA)); list.add(new IntInsnNode(Opcodes.SIPUSH, GL11.GL_ONE_MINUS_SRC_ALPHA)); list.add(new InsnNode(Opcodes.ICONST_1)); list.add(new InsnNode(Opcodes.ICONST_0)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179120_a", "(IIII)V", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "tryBlendFuncSeparate" : "func_179120_a", "(IIII)V", false)); return list; } } diff --git a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderWitherTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderWitherTransformer.java index d80aa1234..5e8cd1436 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderWitherTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderWitherTransformer.java @@ -45,7 +45,7 @@ private InsnList dynamicShadowScale() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new VarInsnNode(Opcodes.FLOAD, 3)); list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Math", "abs", "(F)F", false)); - list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/renderer/entity/RenderWither", "field_76989_e", "F")); + list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/renderer/entity/RenderWither", isDevelopment() ? "shadowSize" : "field_76989_e", "F")); return list; } } diff --git a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderXPOrbTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderXPOrbTransformer.java index d5eec901d..52d33418d 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderXPOrbTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderXPOrbTransformer.java @@ -66,7 +66,7 @@ private InsnList fixRenderHeight() { list.add(new InsnNode(Opcodes.FCONST_0)); list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", - "func_179109_b", // translate + isDevelopment() ? "translate" : "func_179109_b", "(FFF)V", false)); return list; diff --git a/src/main/kotlin/club/sk1er/patcher/asm/external/optifine/WorldVertexBufferUploaderTransformer.kt b/src/main/kotlin/club/sk1er/patcher/asm/external/optifine/WorldVertexBufferUploaderTransformer.kt index e2e863639..f7e5d2c85 100644 --- a/src/main/kotlin/club/sk1er/patcher/asm/external/optifine/WorldVertexBufferUploaderTransformer.kt +++ b/src/main/kotlin/club/sk1er/patcher/asm/external/optifine/WorldVertexBufferUploaderTransformer.kt @@ -27,15 +27,28 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { private val vertexFormatElement = "net/minecraft/client/renderer/vertex/VertexFormatElement" private val oldOptifine = ClassTransformer.optifineVersion == "I7" private val sVertexBuilder = if (oldOptifine) "shadersmod/client/SVertexBuilder" else "net/optifine/shaders/SVertexBuilder" + private val mapping = mapOf( + "func_178989_h" to "getVertexCount", + "func_178979_i" to "getDrawMode", + "func_178973_g" to "getVertexFormat", + "func_177338_f" to "getNextOffset", + "func_178966_f" to "getByteBuffer", + "func_177343_g" to "getElements", + "func_177375_c" to "getUsage", + "func_178965_a" to "reset" + ) + + private val String.environmentName: String + inline get() = if (!isDevelopment) this else mapping.getOrElse(this) { throw IllegalArgumentException("No mapping for $this")} private fun removeReflectionCall() = assembleBlock { aload_1 - invokevirtual(worldRenderer, "func_178989_h", int) + invokevirtual(worldRenderer, "func_178989_h".environmentName, int) ifle(L["1"]) if (!oldOptifine) { aload_1 - invokevirtual(worldRenderer, "func_178979_i", int) + invokevirtual(worldRenderer, "func_178979_i".environmentName, int) bipush(7) if_icmpne(L["3"]) invokestatic("Config", "isQuadsToTriangles", boolean) @@ -46,16 +59,16 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { } aload_1 - invokevirtual(worldRenderer, "func_178973_g", vertexFormat) + invokevirtual(worldRenderer, "func_178973_g".environmentName, vertexFormat) astore_2 aload_2 - invokevirtual(vertexFormat, "func_177338_f", int) + invokevirtual(vertexFormat, "func_177338_f".environmentName, int) istore_3 aload_1 - invokevirtual(worldRenderer, "func_178966_f", ByteBuffer::class) + invokevirtual(worldRenderer, "func_178966_f".environmentName, ByteBuffer::class) astore(4) aload_2 - invokevirtual(vertexFormat, "func_177343_g", List::class) + invokevirtual(vertexFormat, "func_177343_g".environmentName, List::class) astore(5) iconst_0 istore(6) @@ -70,7 +83,7 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { checkcast(vertexFormatElement) astore(7) aload(7) - invokevirtual(vertexFormatElement, "func_177375_c", "$vertexFormatElement\$EnumUsage" as TypeLike) + invokevirtual(vertexFormatElement, "func_177375_c".environmentName, "$vertexFormatElement\$EnumUsage" as TypeLike) aload(2) iload(6) iload(3) @@ -91,19 +104,19 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { invokestatic("Config", "isShaders", boolean) ifeq(L["18"]) aload_1 - invokevirtual(worldRenderer, "func_178979_i", int) + invokevirtual(worldRenderer, "func_178979_i".environmentName, int) iconst_0 aload_1 - invokevirtual(worldRenderer, "func_178989_h", int) + invokevirtual(worldRenderer, "func_178989_h".environmentName, int) aload_1 invokestatic(sVertexBuilder, "drawArrays", void, int, int, int, worldRenderer) goto(L["17"]) +L["18"] aload_1 - invokevirtual(worldRenderer, "func_178979_i", int) + invokevirtual(worldRenderer, "func_178979_i".environmentName, int) iconst_0 aload_1 - invokevirtual(worldRenderer, "func_178989_h", int) + invokevirtual(worldRenderer, "func_178989_h".environmentName, int) invokestatic(GL11::class, "glDrawArrays", void, int, int, int) +L["17"] iconst_0 @@ -121,7 +134,7 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { checkcast(vertexFormatElement) astore(9) aload(9) - invokevirtual(vertexFormatElement, "func_177375_c", "$vertexFormatElement\$EnumUsage" as TypeLike) + invokevirtual(vertexFormatElement, "func_177375_c".environmentName, "$vertexFormatElement\$EnumUsage" as TypeLike) aload_2 iload(7) iload_3 @@ -131,7 +144,7 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { goto(L["21"]) +L["1"] aload_1 - invokevirtual(worldRenderer, "func_178965_a", void) + invokevirtual(worldRenderer, "func_178965_a".environmentName, void) _return } } \ No newline at end of file From 05bd4c243e97b34e9c7c671e6faf0cfb0ba630e5 Mon Sep 17 00:00:00 2001 From: Oondanomala <87101222+Oondanomala@users.noreply.github.com> Date: Sat, 16 Mar 2024 16:06:46 +0100 Subject: [PATCH 06/10] new: remove vertical view bobbing (#168) --- src/main/java/club/sk1er/patcher/config/PatcherConfig.java | 7 +++++++ .../mixins/features/EntityRendererMixin_ViewBobbing.java | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java index 0f222bfec..f706b8278 100644 --- a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java +++ b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java @@ -548,6 +548,13 @@ public class PatcherConfig extends Vigilant { ) public static boolean removeViewBobbing; + @Property( + type = PropertyType.SWITCH, name = "Remove Vertical Bobbing", + description = "While using View Bobbing, remove the vertical bobbing like in 1.14+.", + category = "Miscellaneous", subcategory = "General" + ) + public static boolean removeVerticalViewBobbing; + @Property( type = PropertyType.SWITCH, name = "Remove Map Bobbing", description = "While using View Bobbing, remove the hand bobbing when holding a map.", diff --git a/src/main/java/club/sk1er/patcher/mixins/features/EntityRendererMixin_ViewBobbing.java b/src/main/java/club/sk1er/patcher/mixins/features/EntityRendererMixin_ViewBobbing.java index 1d04589fe..c2b2b032f 100644 --- a/src/main/java/club/sk1er/patcher/mixins/features/EntityRendererMixin_ViewBobbing.java +++ b/src/main/java/club/sk1er/patcher/mixins/features/EntityRendererMixin_ViewBobbing.java @@ -2,6 +2,7 @@ import club.sk1er.patcher.config.PatcherConfig; import club.sk1er.patcher.hooks.EntityRendererHook; +import gg.essential.lib.mixinextras.injector.WrapWithCondition; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.settings.GameSettings; import org.spongepowered.asm.mixin.Dynamic; @@ -25,4 +26,9 @@ public class EntityRendererMixin_ViewBobbing { private boolean patcher$viewBobbing(GameSettings instance) { return instance.viewBobbing && !PatcherConfig.removeViewBobbing; } + + @WrapWithCondition(method = "setupViewBobbing", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V", ordinal = 2)) + public boolean patcher$verticalViewBobbing(float angle, float x, float y, float z) { + return !PatcherConfig.removeVerticalViewBobbing; + } } From 186a005ae6c30305e72946e00f26eb05806ed7f6 Mon Sep 17 00:00:00 2001 From: sychic <47618543+Sychic@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:59:48 -0400 Subject: [PATCH 07/10] change: version --- root.gradle.kts | 2 +- src/main/java/club/sk1er/patcher/Patcher.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/root.gradle.kts b/root.gradle.kts index f19740cec..85d81f9db 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -9,7 +9,7 @@ plugins { // betas will be "1.x.x+beta-y" / "1.x.x+branch_beta-y" // rcs will be 1.x.x+rc-y // extra branches will be 1.x.x+branch-y -version = "1.8.7" +version = "1.8.8" preprocess { "1.12.2"(11202, "srg") { diff --git a/src/main/java/club/sk1er/patcher/Patcher.java b/src/main/java/club/sk1er/patcher/Patcher.java index 59b372c60..29149e643 100644 --- a/src/main/java/club/sk1er/patcher/Patcher.java +++ b/src/main/java/club/sk1er/patcher/Patcher.java @@ -90,7 +90,7 @@ public class Patcher { // betas will be "1.x.x+beta-y" / "1.x.x+branch_beta-y" // rcs will be 1.x.x+rc-y // extra branches will be 1.x.x+branch-y - public static final String VERSION = "1.8.7"; + public static final String VERSION = "1.8.8"; private final Logger logger = LogManager.getLogger("Patcher"); private final File logsDirectory = new File(Minecraft.getMinecraft().mcDataDir + File.separator + "logs" + File.separator); From fa4b3beeb8bafbb597fa161b92e433e61503370d Mon Sep 17 00:00:00 2001 From: sychic <47618543+Sychic@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:33:25 -0400 Subject: [PATCH 08/10] Revert "fix: add dev mappings to ASM transformers (#173)" This reverts commit a32c2c0ea921d7cf9b5334b80230dcf10fffeff9. --- .../render/ForgeHooksClientTransformer.java | 2 +- .../render/screen/GuiModListTransformer.java | 2 +- .../render/screen/GuiUtilsTransformer.java | 8 ++-- .../EntityRendererReflectionOptimizer.java | 4 +- ...tendedBlockStorageReflectionOptimizer.java | 2 +- .../witherfix/EntityWitherTransformer.java | 2 +- .../packet/S34PacketMapsTransformer.java | 4 +- .../particle/EffectRendererTransformer.java | 10 ++--- .../asm/render/screen/GuiChatTransformer.java | 26 ++++++------- .../InventoryEffectRendererTransformer.java | 6 +-- .../render/world/RenderGlobalTransformer.java | 4 +- .../world/entity/RenderPlayerTransformer.java | 10 ++--- .../world/entity/RenderWitherTransformer.java | 2 +- .../world/entity/RenderXPOrbTransformer.java | 2 +- .../WorldVertexBufferUploaderTransformer.kt | 39 +++++++------------ 15 files changed, 55 insertions(+), 68 deletions(-) diff --git a/src/main/java/club/sk1er/patcher/asm/external/forge/render/ForgeHooksClientTransformer.java b/src/main/java/club/sk1er/patcher/asm/external/forge/render/ForgeHooksClientTransformer.java index 5c92d572f..511198fb0 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/forge/render/ForgeHooksClientTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/forge/render/ForgeHooksClientTransformer.java @@ -38,7 +38,7 @@ public void transform(ClassNode classNode, String name) { if (next instanceof MethodInsnNode && next.getOpcode() == Opcodes.INVOKEVIRTUAL) { final String methodInsnName = mapMethodNameFromNode(next); if (methodInsnName.equals("getY") || methodInsnName.equals("func_177956_o")) { - ((MethodInsnNode) next).name = isDevelopment() ? "getZ" : "func_177952_p"; + ((MethodInsnNode) next).name = "func_177952_p"; // getZ break; } } diff --git a/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiModListTransformer.java b/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiModListTransformer.java index 7027f0a71..c56367841 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiModListTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiModListTransformer.java @@ -41,7 +41,7 @@ public void transform(ClassNode classNode, String name) { // auto-closing stream if (next instanceof MethodInsnNode && ((MethodInsnNode) next).name.equals("read")) { ((MethodInsnNode) next).owner = "net/minecraft/client/renderer/texture/TextureUtil"; - ((MethodInsnNode) next).name = isDevelopment() ? "readBufferedImage" : "func_177053_a"; + ((MethodInsnNode) next).name = "func_177053_a"; // readBufferedImage ((MethodInsnNode) next).desc = "(Ljava/io/InputStream;)Ljava/awt/image/BufferedImage;"; break; } diff --git a/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiUtilsTransformer.java b/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiUtilsTransformer.java index a80df4886..c0b5da2ef 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiUtilsTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/forge/render/screen/GuiUtilsTransformer.java @@ -34,14 +34,14 @@ public void transform(ClassNode classNode, String name) { } } } else if (next instanceof VarInsnNode && next.getOpcode() == Opcodes.ISTORE && ((VarInsnNode) next).var == 17) { - methodNode.instructions.insert(next, new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "disableDepth" : "func_179097_i", "()V", false)); + methodNode.instructions.insert(next, new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179097_i", "()V", false)); } } methodNode.instructions.insert(getMoveForward()); methodNode.instructions.insertBefore( methodNode.instructions.getLast().getPrevious(), - new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "popMatrix" : "func_179121_F", "()V", false) + new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179121_F", "()V", false) ); } } @@ -49,11 +49,11 @@ public void transform(ClassNode classNode, String name) { private InsnList getMoveForward() { InsnList insnList = new InsnList(); - insnList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "pushMatrix" : "func_179094_E", "()V", false)); + insnList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179094_E", "()V", false)); insnList.add(new LdcInsnNode(0F)); insnList.add(new LdcInsnNode(0F)); insnList.add(new LdcInsnNode(-1F)); - insnList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "translate" : "func_179109_b", "(FFF)V", false)); + insnList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179109_b", "(FFF)V", false)); return insnList; } } diff --git a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/EntityRendererReflectionOptimizer.java b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/EntityRendererReflectionOptimizer.java index a89a968e3..06c4b3e29 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/EntityRendererReflectionOptimizer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/EntityRendererReflectionOptimizer.java @@ -48,8 +48,8 @@ public void transform(ClassNode classNode, String name) { private InsnList optimizeReflection() { InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/EntityRenderer", isDevelopment() ? "mc" : "field_78531_r", "Lnet/minecraft/client/Minecraft;")); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", isDevelopment() ? "currentScreen" : "field_71462_r", "Lnet/minecraft/client/gui/GuiScreen;")); + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/EntityRenderer", "field_78531_r", "Lnet/minecraft/client/Minecraft;")); + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", "field_71462_r", "Lnet/minecraft/client/gui/GuiScreen;")); list.add(new VarInsnNode(Opcodes.ILOAD, 8)); list.add(new VarInsnNode(Opcodes.ILOAD, 9)); list.add(new VarInsnNode(Opcodes.FLOAD, 1)); diff --git a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/ExtendedBlockStorageReflectionOptimizer.java b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/ExtendedBlockStorageReflectionOptimizer.java index b9ac149f2..65fea0eb5 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/ExtendedBlockStorageReflectionOptimizer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/reflectionoptimizations/common/ExtendedBlockStorageReflectionOptimizer.java @@ -16,7 +16,7 @@ public String[] getClassName() { public void transform(ClassNode classNode, String name) { for (MethodNode methodNode : classNode.methods) { final String methodName = mapMethodName(classNode, methodNode); - if (methodName.equals("set") || methodName.equals("func_177484_a")) { + if (methodName.equals("func_177484_a")) { final InsnList instructions = methodNode.instructions; final Iterator iterator = instructions.iterator(); while (iterator.hasNext()) { diff --git a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/witherfix/EntityWitherTransformer.java b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/witherfix/EntityWitherTransformer.java index d9012f4b4..19c62ca06 100644 --- a/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/witherfix/EntityWitherTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/external/mods/optifine/witherfix/EntityWitherTransformer.java @@ -45,7 +45,7 @@ public void transform(ClassNode classNode, String name) { private InsnList checkVisibility() { InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/entity/boss/EntityWither", isDevelopment() ? "isInvisible" : "func_82150_aj", "()Z", false)); + list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/entity/boss/EntityWither", "func_82150_aj", "()Z", false)); LabelNode ifeq = new LabelNode(); list.add(new JumpInsnNode(Opcodes.IFEQ, ifeq)); list.add(new InsnNode(Opcodes.RETURN)); diff --git a/src/main/java/club/sk1er/patcher/asm/network/packet/S34PacketMapsTransformer.java b/src/main/java/club/sk1er/patcher/asm/network/packet/S34PacketMapsTransformer.java index 45260210f..ba92f9513 100644 --- a/src/main/java/club/sk1er/patcher/asm/network/packet/S34PacketMapsTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/network/packet/S34PacketMapsTransformer.java @@ -46,7 +46,7 @@ public void transform(ClassNode classNode, String name) { } } - public InsnList checkMapBytesLength() { + public static InsnList checkMapBytesLength() { InsnList list = new InsnList(); LabelNode checkSize = new LabelNode(); @@ -54,7 +54,7 @@ public InsnList checkMapBytesLength() { list.add(new FieldInsnNode( Opcodes.GETFIELD, "net/minecraft/network/play/server/S34PacketMaps", - isDevelopment() ? "mapDataBytes" : "field_179741_h", + "field_179741_h", "[B" )); list.add(new InsnNode(Opcodes.DUP)); diff --git a/src/main/java/club/sk1er/patcher/asm/render/particle/EffectRendererTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/particle/EffectRendererTransformer.java index f1c6bccbc..f59ee3922 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/particle/EffectRendererTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/particle/EffectRendererTransformer.java @@ -58,15 +58,15 @@ private InsnList reassignRotation() { list.add(new LdcInsnNode(0.017453292F)); list.add(new VarInsnNode(Opcodes.FSTORE, 3)); // actual fix for mc-74764 - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationX" : "func_178808_b", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178808_b", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 4)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationZ" : "func_178803_d", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178803_d", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 5)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationYZ" : "func_178805_e", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178805_e", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 6)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationXY" : "func_178807_f", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178807_f", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 7)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", isDevelopment() ? "getRotationXZ" : "func_178809_c", "()F", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/ActiveRenderInfo", "func_178809_c", "()F", false)); list.add(new VarInsnNode(Opcodes.FSTORE, 8)); return list; } diff --git a/src/main/java/club/sk1er/patcher/asm/render/screen/GuiChatTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/screen/GuiChatTransformer.java index cffdc51b6..8161211e4 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/screen/GuiChatTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/screen/GuiChatTransformer.java @@ -158,15 +158,15 @@ private InsnList checkChat(LabelNode gotoInsn) { LabelNode ifne = new LabelNode(); list.add(new JumpInsnNode(Opcodes.IFNE, ifne)); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", isDevelopment() ? "mc" : "field_146297_k", "Lnet/minecraft/client/Minecraft;")); + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", "field_146297_k", "Lnet/minecraft/client/Minecraft;")); list.add(new InsnNode(Opcodes.ACONST_NULL)); - list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/Minecraft", isDevelopment() ? "displayGuiScreen" : "func_147108_a", "(Lnet/minecraft/client/gui/GuiScreen;)V", false)); + list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/Minecraft", "func_147108_a", "(Lnet/minecraft/client/gui/GuiScreen;)V", false)); list.add(new JumpInsnNode(Opcodes.GOTO, gotoInsn)); list.add(ifne); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", isDevelopment() ? "inputField" : "field_146415_a", "Lnet/minecraft/client/gui/GuiTextField;")); + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", "field_146415_a", "Lnet/minecraft/client/gui/GuiTextField;")); list.add(new LdcInsnNode("")); - list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", isDevelopment() ? "setText" : "func_146180_a", "(Ljava/lang/String;)V", false)); + list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", "func_146180_a", "(Ljava/lang/String;)V", false)); list.add(new JumpInsnNode(Opcodes.GOTO, gotoInsn)); list.add(ifeq); return list; @@ -180,16 +180,16 @@ private InsnList setText() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - isDevelopment() ? "inputField" : "field_146415_a", + "field_146415_a", // inputField "Lnet/minecraft/client/gui/GuiTextField;")); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - isDevelopment() ? "defaultInputFieldText" : "field_146409_v", + "field_146409_v", // defaultInputFieldText "Ljava/lang/String;")); list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", - isDevelopment() ? "setText" : "func_146180_a", + "func_146180_a", // setText "(Ljava/lang/String;)V", false)); LabelNode gotoInsn = new LabelNode(); @@ -198,12 +198,12 @@ private InsnList setText() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - isDevelopment() ? "inputField" : "field_146415_a", + "field_146415_a", // inputField "Lnet/minecraft/client/gui/GuiTextField;")); list.add(new VarInsnNode(Opcodes.ALOAD, 2)); list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", - isDevelopment() ? "setText" : "func_146180_a", + "func_146180_a", // setText "(Ljava/lang/String;)V", false)); list.add(gotoInsn); @@ -215,7 +215,7 @@ private InsnList createWasInitBefore() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - isDevelopment() ? "inputField" : "field_146415_a", + "field_146415_a", // inputField "Lnet/minecraft/client/gui/GuiTextField;")); LabelNode ifnull = new LabelNode(); list.add(new JumpInsnNode(Opcodes.IFNULL, ifnull)); @@ -232,11 +232,11 @@ private InsnList createWasInitBefore() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/gui/GuiChat", - isDevelopment() ? "inputField" : "field_146415_a", + "field_146415_a", // inputField "Lnet/minecraft/client/gui/GuiTextField;")); list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/gui/GuiTextField", - isDevelopment() ? "getText" : "func_146179_b", + "func_146179_b", // getText "()Ljava/lang/String;", false)); LabelNode gotoInsn2 = new LabelNode(); @@ -251,7 +251,7 @@ private InsnList createWasInitBefore() { private InsnList getOption(LabelNode ifne) { InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/gui/GuiChat", isDevelopment() ? "isShiftKeyDown" : "func_146272_n", "()Z", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/gui/GuiChat", "func_146272_n", "()Z", false)); list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/gui/GuiChat", "holdingShift", "Z")); list.add(getPatcherSetting("transparentChatInputField", "Z")); list.add(new JumpInsnNode(Opcodes.IFNE, ifne)); diff --git a/src/main/java/club/sk1er/patcher/asm/render/screen/InventoryEffectRendererTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/screen/InventoryEffectRendererTransformer.java index 96f5c454e..4c796fa4c 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/screen/InventoryEffectRendererTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/screen/InventoryEffectRendererTransformer.java @@ -64,15 +64,15 @@ private InsnList newEffectLogic() { list.add(new JumpInsnNode(Opcodes.IFEQ, ifeq)); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", isDevelopment() ? "width" : "field_146294_l", + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", "field_146294_l", // width "I")); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); - list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", isDevelopment() ? "xSize" : "field_146999_f", + list.add(new FieldInsnNode(Opcodes.GETFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", "field_146999_f", // xSize "I")); list.add(new InsnNode(Opcodes.ISUB)); list.add(new InsnNode(Opcodes.ICONST_2)); list.add(new InsnNode(Opcodes.IDIV)); - list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", isDevelopment() ? "guiLeft" : "field_147003_i", + list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/renderer/InventoryEffectRenderer", "field_147003_i", // guiLeft "I")); list.add(new InsnNode(Opcodes.RETURN)); list.add(ifeq); diff --git a/src/main/java/club/sk1er/patcher/asm/render/world/RenderGlobalTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/world/RenderGlobalTransformer.java index a538af8d2..76db066eb 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/world/RenderGlobalTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/world/RenderGlobalTransformer.java @@ -76,12 +76,12 @@ public void transform(ClassNode classNode, String name) { if (next.getOpcode() == Opcodes.INVOKEVIRTUAL) { if (methodInsnName.equals("getClosestDistance") || methodInsnName.equals("func_177729_b")) { methodNode.instructions.insertBefore(next.getPrevious().getPrevious().getPrevious(), - new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "disableFog" : "func_179106_n", "()V", false)); + new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179106_n", "()V", false)); } } else if (next.getOpcode() == Opcodes.INVOKESTATIC) { if ((methodInsnName.equals("depthMask") || methodInsnName.equals("func_179132_a")) && next.getPrevious().getOpcode() == Opcodes.ICONST_1) { methodNode.instructions.insert(next, - new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "enableFog" : "func_179127_m", "()V", false) + new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179127_m", "()V", false) ); } } diff --git a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderPlayerTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderPlayerTransformer.java index ae89f8d30..58cefae87 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderPlayerTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderPlayerTransformer.java @@ -38,7 +38,7 @@ public void transform(ClassNode classNode, String name) { for (MethodNode methodNode : classNode.methods) { String methodName = mapMethodName(classNode, methodNode); - MethodInsnNode disableBlend = new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "disableBlend" : "func_179084_k", "()V", false); + MethodInsnNode disableBlend = new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179084_k", "()V", false); switch (methodName) { //#if MC==10809 case "renderRightArm": @@ -110,18 +110,18 @@ private InsnList checkHatLayer() { InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 1)); list.add(new FieldInsnNode(Opcodes.GETSTATIC, "net/minecraft/entity/player/EnumPlayerModelParts", "HAT", "Lnet/minecraft/entity/player/EnumPlayerModelParts;")); - list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/entity/AbstractClientPlayer", isDevelopment() ? "func_175148_a" : "isWearing", "(Lnet/minecraft/entity/player/EnumPlayerModelParts;)Z", false)); + list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "net/minecraft/client/entity/AbstractClientPlayer", "func_175148_a", "(Lnet/minecraft/entity/player/EnumPlayerModelParts;)Z", false)); return list; } - public InsnList enableBlend() { + public static InsnList enableBlend() { InsnList list = new InsnList(); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "enableBlend" : "func_179147_l", "()V", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179147_l", "()V", false)); list.add(new IntInsnNode(Opcodes.SIPUSH, GL11.GL_SRC_ALPHA)); list.add(new IntInsnNode(Opcodes.SIPUSH, GL11.GL_ONE_MINUS_SRC_ALPHA)); list.add(new InsnNode(Opcodes.ICONST_1)); list.add(new InsnNode(Opcodes.ICONST_0)); - list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", isDevelopment() ? "tryBlendFuncSeparate" : "func_179120_a", "(IIII)V", false)); + list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", "func_179120_a", "(IIII)V", false)); return list; } } diff --git a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderWitherTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderWitherTransformer.java index 5e8cd1436..d80aa1234 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderWitherTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderWitherTransformer.java @@ -45,7 +45,7 @@ private InsnList dynamicShadowScale() { list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new VarInsnNode(Opcodes.FLOAD, 3)); list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Math", "abs", "(F)F", false)); - list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/renderer/entity/RenderWither", isDevelopment() ? "shadowSize" : "field_76989_e", "F")); + list.add(new FieldInsnNode(Opcodes.PUTFIELD, "net/minecraft/client/renderer/entity/RenderWither", "field_76989_e", "F")); return list; } } diff --git a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderXPOrbTransformer.java b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderXPOrbTransformer.java index 52d33418d..d5eec901d 100644 --- a/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderXPOrbTransformer.java +++ b/src/main/java/club/sk1er/patcher/asm/render/world/entity/RenderXPOrbTransformer.java @@ -66,7 +66,7 @@ private InsnList fixRenderHeight() { list.add(new InsnNode(Opcodes.FCONST_0)); list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/minecraft/client/renderer/GlStateManager", - isDevelopment() ? "translate" : "func_179109_b", + "func_179109_b", // translate "(FFF)V", false)); return list; diff --git a/src/main/kotlin/club/sk1er/patcher/asm/external/optifine/WorldVertexBufferUploaderTransformer.kt b/src/main/kotlin/club/sk1er/patcher/asm/external/optifine/WorldVertexBufferUploaderTransformer.kt index f7e5d2c85..e2e863639 100644 --- a/src/main/kotlin/club/sk1er/patcher/asm/external/optifine/WorldVertexBufferUploaderTransformer.kt +++ b/src/main/kotlin/club/sk1er/patcher/asm/external/optifine/WorldVertexBufferUploaderTransformer.kt @@ -27,28 +27,15 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { private val vertexFormatElement = "net/minecraft/client/renderer/vertex/VertexFormatElement" private val oldOptifine = ClassTransformer.optifineVersion == "I7" private val sVertexBuilder = if (oldOptifine) "shadersmod/client/SVertexBuilder" else "net/optifine/shaders/SVertexBuilder" - private val mapping = mapOf( - "func_178989_h" to "getVertexCount", - "func_178979_i" to "getDrawMode", - "func_178973_g" to "getVertexFormat", - "func_177338_f" to "getNextOffset", - "func_178966_f" to "getByteBuffer", - "func_177343_g" to "getElements", - "func_177375_c" to "getUsage", - "func_178965_a" to "reset" - ) - - private val String.environmentName: String - inline get() = if (!isDevelopment) this else mapping.getOrElse(this) { throw IllegalArgumentException("No mapping for $this")} private fun removeReflectionCall() = assembleBlock { aload_1 - invokevirtual(worldRenderer, "func_178989_h".environmentName, int) + invokevirtual(worldRenderer, "func_178989_h", int) ifle(L["1"]) if (!oldOptifine) { aload_1 - invokevirtual(worldRenderer, "func_178979_i".environmentName, int) + invokevirtual(worldRenderer, "func_178979_i", int) bipush(7) if_icmpne(L["3"]) invokestatic("Config", "isQuadsToTriangles", boolean) @@ -59,16 +46,16 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { } aload_1 - invokevirtual(worldRenderer, "func_178973_g".environmentName, vertexFormat) + invokevirtual(worldRenderer, "func_178973_g", vertexFormat) astore_2 aload_2 - invokevirtual(vertexFormat, "func_177338_f".environmentName, int) + invokevirtual(vertexFormat, "func_177338_f", int) istore_3 aload_1 - invokevirtual(worldRenderer, "func_178966_f".environmentName, ByteBuffer::class) + invokevirtual(worldRenderer, "func_178966_f", ByteBuffer::class) astore(4) aload_2 - invokevirtual(vertexFormat, "func_177343_g".environmentName, List::class) + invokevirtual(vertexFormat, "func_177343_g", List::class) astore(5) iconst_0 istore(6) @@ -83,7 +70,7 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { checkcast(vertexFormatElement) astore(7) aload(7) - invokevirtual(vertexFormatElement, "func_177375_c".environmentName, "$vertexFormatElement\$EnumUsage" as TypeLike) + invokevirtual(vertexFormatElement, "func_177375_c", "$vertexFormatElement\$EnumUsage" as TypeLike) aload(2) iload(6) iload(3) @@ -104,19 +91,19 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { invokestatic("Config", "isShaders", boolean) ifeq(L["18"]) aload_1 - invokevirtual(worldRenderer, "func_178979_i".environmentName, int) + invokevirtual(worldRenderer, "func_178979_i", int) iconst_0 aload_1 - invokevirtual(worldRenderer, "func_178989_h".environmentName, int) + invokevirtual(worldRenderer, "func_178989_h", int) aload_1 invokestatic(sVertexBuilder, "drawArrays", void, int, int, int, worldRenderer) goto(L["17"]) +L["18"] aload_1 - invokevirtual(worldRenderer, "func_178979_i".environmentName, int) + invokevirtual(worldRenderer, "func_178979_i", int) iconst_0 aload_1 - invokevirtual(worldRenderer, "func_178989_h".environmentName, int) + invokevirtual(worldRenderer, "func_178989_h", int) invokestatic(GL11::class, "glDrawArrays", void, int, int, int) +L["17"] iconst_0 @@ -134,7 +121,7 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { checkcast(vertexFormatElement) astore(9) aload(9) - invokevirtual(vertexFormatElement, "func_177375_c".environmentName, "$vertexFormatElement\$EnumUsage" as TypeLike) + invokevirtual(vertexFormatElement, "func_177375_c", "$vertexFormatElement\$EnumUsage" as TypeLike) aload_2 iload(7) iload_3 @@ -144,7 +131,7 @@ class WorldVertexBufferUploaderTransformer : PatcherTransformer { goto(L["21"]) +L["1"] aload_1 - invokevirtual(worldRenderer, "func_178965_a".environmentName, void) + invokevirtual(worldRenderer, "func_178965_a", void) _return } } \ No newline at end of file From 2eb6c3fb6977e5ea539426f2b3f881703b8bcc14 Mon Sep 17 00:00:00 2001 From: sychic <47618543+Sychic@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:35:24 -0400 Subject: [PATCH 09/10] change: make "safe chat clicks history" not depend on "safe chat clicks" --- src/main/java/club/sk1er/patcher/config/PatcherConfig.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java index f706b8278..3e52f4e58 100644 --- a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java +++ b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java @@ -1325,8 +1325,6 @@ public PatcherConfig() { addDependency("cacheFontData", "optimizedFontRenderer"); addDependency("chunkUpdateLimit", "limitChunks"); - addDependency("safeChatClicksHistory", "safeChatClicks"); - Arrays.asList( "screenshotNoFeedback", "compactScreenshotResponse", "autoCopyScreenshot", "screenshotPreview", "previewTime", "previewAnimationStyle", "previewScale", "favoriteScreenshot", From 4ce6e196e5ad1339f8a0ab96eb5680c2f6464583 Mon Sep 17 00:00:00 2001 From: sychic <47618543+Sychic@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:36:16 -0400 Subject: [PATCH 10/10] change: update version --- root.gradle.kts | 2 +- src/main/java/club/sk1er/patcher/Patcher.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/root.gradle.kts b/root.gradle.kts index 85d81f9db..dfb77839d 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -9,7 +9,7 @@ plugins { // betas will be "1.x.x+beta-y" / "1.x.x+branch_beta-y" // rcs will be 1.x.x+rc-y // extra branches will be 1.x.x+branch-y -version = "1.8.8" +version = "1.8.9" preprocess { "1.12.2"(11202, "srg") { diff --git a/src/main/java/club/sk1er/patcher/Patcher.java b/src/main/java/club/sk1er/patcher/Patcher.java index 29149e643..8c8807bc3 100644 --- a/src/main/java/club/sk1er/patcher/Patcher.java +++ b/src/main/java/club/sk1er/patcher/Patcher.java @@ -90,7 +90,7 @@ public class Patcher { // betas will be "1.x.x+beta-y" / "1.x.x+branch_beta-y" // rcs will be 1.x.x+rc-y // extra branches will be 1.x.x+branch-y - public static final String VERSION = "1.8.8"; + public static final String VERSION = "1.8.9"; private final Logger logger = LogManager.getLogger("Patcher"); private final File logsDirectory = new File(Minecraft.getMinecraft().mcDataDir + File.separator + "logs" + File.separator);