11package net .neoforged .gradle .userdev .runtime .extension ;
22
3+ import com .google .common .collect .Lists ;
4+ import com .google .common .collect .Maps ;
35import net .neoforged .gradle .common .dependency .ExtraJarDependencyManager ;
46import net .neoforged .gradle .common .runtime .extensions .CommonRuntimeExtension ;
57import net .neoforged .gradle .common .runtime .tasks .BinaryAccessTransformer ;
4143import org .jetbrains .annotations .Nullable ;
4244
4345import java .io .File ;
46+ import java .io .Serial ;
4447import java .util .List ;
4548import java .util .Map ;
4649import java .util .Objects ;
@@ -232,7 +235,7 @@ public UserDevRuntimeExtension(Project project)
232235 final FileTree userDevJar )
233236 {
234237 return (steps , functions ) -> {
235- if (!useCombinedJarWithNeoForgeOnRecompile (userDevProfile ) || ! isObfuscatedVersion ( userDevProfile . getNeoForm (). get ()) )
238+ if (!useCombinedJarWithNeoForgeOnRecompile (userDevProfile ))
236239 {
237240 return ;
238241 }
@@ -244,6 +247,7 @@ public UserDevRuntimeExtension(Project project)
244247 steps .removeIf (step -> step .getType ().equals ("merge" ));
245248 steps .removeIf (step -> step .getType ().equals ("mergeMappings" ));
246249 steps .removeIf (step -> step .getType ().equals ("rename" ));
250+ steps .removeIf (step -> step .getType ().equals ("preProcessJar" ));
247251
248252 final int decompileIndex = ListUtils .removeIfAndReturnIndex (
249253 steps , step -> step .getType ().equals ("decompile" )
@@ -256,6 +260,7 @@ public UserDevRuntimeExtension(Project project)
256260 "decompile" , "decompile" ,
257261 Map .of (
258262 "libraries" , "{listLibrariesOutput}" ,
263+ "inputLibraries" , "{listLibrariesOutput}" ,
259264 "input" , "{setupOutput}"
260265 )
261266 )
@@ -294,47 +299,37 @@ private record SetupConfiguration(
294299 private SetupConfiguration buildSetupConfiguration (final UserdevProfile userDevProfile , final FileTree userDevJar )
295300 {
296301 final Decompiler decompilerSubsystemConfiguration = getProject ().getExtensions ().getByType (Subsystems .class ).getDecompiler ();
297- if (decompilerSubsystemConfiguration .getIsDisabled ().get () && useCombinedJarWithNeoForgeOnRecompile (userDevProfile ))
298- {
299- return new SetupConfiguration (
300- List .of (
301- "--task" , "PROCESS_MINECRAFT_JAR" ,
302- "--input" , "{client}" ,
303- "--input" , "{server}" ,
304- "--output" , "{output}" ,
305- "--input-mappings" , "{clientMappings}" ,
306- "--neoform-data" , "{neoform}" ,
307- "--apply-patches" , "{patches}"
308- ),
309- Map .of (
310- "client" , "{downloadClientOutput}" ,
311- "clientMappings" , "{downloadClientMappingsOutput}" ,
312- "server" , "{downloadServerOutput}" ,
313- "neoform" , "{neoform}" ,
314- "patches" , userDevProfile .getBinaryPatchFile ()
315- .map (patchFilePath -> userDevJar
316- .matching (matcher -> matcher .include (patchFilePath ))
317- .getSingleFile ()).get ().getAbsolutePath ()
318- )
319- );
302+ final List <String > arguments = Lists .newArrayList (
303+ "--task" , "PROCESS_MINECRAFT_JAR" ,
304+ "--input" , "{client}" ,
305+ "--input" , "{server}" ,
306+ "--output" , "{output}" ,
307+ "--neoform-data" , "{neoform}"
308+ );
309+ final Map <String , String > values = Maps .newHashMap (Map .of (
310+ "client" , "{downloadClientOutput}" ,
311+ "server" , "{downloadServerOutput}" ,
312+ "neoform" , "{neoform}"
313+ ));
314+
315+ if (isObfuscatedVersion (userDevProfile .getNeoForm ().get ())) {
316+ arguments .addAll (List .of (
317+ "--input-mappings" , "{clientMappings}"
318+ ));
319+ values .put ("clientMappings" , "{downloadClientMappingsOutput}" );
320320 }
321321
322- return new SetupConfiguration (
323- List .of (
324- "--task" , "PROCESS_MINECRAFT_JAR" ,
325- "--input" , "{client}" ,
326- "--input" , "{server}" ,
327- "--output" , "{output}" ,
328- "--input-mappings" , "{clientMappings}" ,
329- "--neoform-data" , "{neoform}"
330- ),
331- Map .of (
332- "client" , "{downloadClientOutput}" ,
333- "clientMappings" , "{downloadClientMappingsOutput}" ,
334- "server" , "{downloadServerOutput}" ,
335- "neoform" , "{neoform}"
336- )
337- );
322+ if (decompilerSubsystemConfiguration .getIsDisabled ().get () && useCombinedJarWithNeoForgeOnRecompile (userDevProfile )) {
323+ arguments .addAll (List .of (
324+ "--apply-patches" , "{patches}"
325+ ));
326+ values .put ("patches" , userDevProfile .getBinaryPatchFile ()
327+ .map (patchFilePath -> userDevJar
328+ .matching (matcher -> matcher .include (patchFilePath ))
329+ .getSingleFile ()).get ().getAbsolutePath ());
330+ }
331+
332+ return new SetupConfiguration (arguments , values );
338333 }
339334
340335 private boolean useCombinedJarWithNeoForgeOnRecompile (final UserdevProfile userDevProfile )
0 commit comments