@@ -100,7 +100,7 @@ protected Stage[] setStages() {
100100 stage (getLocalizedStage ("patch" ), 88 ,
101101 () -> {
102102 if (mcp .getOptions ().getBooleanParameter (TaskParameter .PATCHES ) && Files .exists (patchesPath )) {
103- patch (this , ffOut , ffOut , patchesPath );
103+ TaskApplyPatch . patch (this , ffOut , ffOut , patchesPath );
104104 }
105105 }),
106106 stage (getLocalizedStage ("copysrc" ), 90 ,
@@ -176,7 +176,6 @@ public ClassStorage applyInjector() throws IOException {
176176 }
177177 }
178178 injector .addTransform (storage -> Transform .decomposeVars (storage ));
179- injector .addTransform (storage -> Transform .fixTryCatchRange (storage ));
180179 injector .addTransform (storage -> Transform .replaceCommonConstants (storage ));
181180 if (hasLWJGL ) injector .addVisitor (new GLConstants (null ));
182181 injector .restoreSourceFile ();
@@ -187,6 +186,21 @@ public ClassStorage applyInjector() throws IOException {
187186 if (Files .exists (exc )) {
188187 injector .fixExceptions (exc );
189188 }
189+ if (side == Side .MERGED ) {
190+ Path acc = MCPPaths .get (mcp , MCPPaths .ACCESS , Side .CLIENT );
191+ if (Files .exists (acc )) {
192+ injector .fixAccess (acc );
193+ }
194+ acc = MCPPaths .get (mcp , MCPPaths .ACCESS , Side .SERVER );
195+ if (Files .exists (acc )) {
196+ injector .fixAccess (acc );
197+ }
198+ } else {
199+ final Path acc = MCPPaths .get (mcp , MCPPaths .ACCESS , side );
200+ if (Files .exists (acc )) {
201+ injector .fixAccess (acc );
202+ }
203+ }
190204 injector .transform ();
191205 injector .write (rdiOut );
192206 return injector .getStorage ();
@@ -206,23 +220,6 @@ public static Mappings getMappings(Path mappingsPath, ClassStorage storage, Side
206220 return mappings ;
207221 }
208222
209- public static void patch (Task task , Path base , Path out , Path patches ) throws IOException {
210- ByteArrayOutputStream logger = new ByteArrayOutputStream ();
211- PatchOperation patchOperation = PatchOperation .builder ()
212- .basePath (base )
213- .patchesPath (patches )
214- .outputPath (out )
215- .mode (PatchMode .OFFSET )
216- .filter (p -> p .endsWith (".java" ))
217- .build ();
218- boolean success = patchOperation .doPatch ();
219- patchOperation .getSummary ().print (new PrintStream (logger ), false );
220- if (!success ) {
221- task .addMessage (logger .toString (), Task .INFO );
222- task .addMessage ("Patching failed!" , Task .ERROR );
223- }
224- }
225-
226223 public static String getLaunchArgs (MCP mcp ) {
227224 List <String > args = TaskRun .getLaunchArgs (mcp );
228225 for (int i = 0 ; i < args .size (); i ++) {
0 commit comments