Skip to content

Commit 5189f0b

Browse files
committed
Fix patching merely claiming to work
Worked fine for testing the patches, but in doing so broke the patcher finding them to actually apply Updates ForgeFlower to match what the patches are generated using
1 parent 7abbdf4 commit 5189f0b

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ dependencies {
7474
compile 'com.nothome:javaxdelta:2.0.1' // GDIFF implementation for BinPatches
7575
compile 'com.google.code.gson:gson:2.2.4' // Used instead of Argo for buuilding changelog.
7676
compile 'com.github.tony19:named-regexp:0.2.3' // 1.7 Named regexp features
77-
compile 'net.minecraftforge:forgeflower:1.0.342-SNAPSHOT' // Fernflower Forge edition
77+
compile 'net.minecraftforge:forgeflower:1.5.380.22' // Fernflower Forge edition
7878

7979
shade 'net.md-5:SpecialSource:1.8.2' // deobf and reobf
8080

src/main/java/net/minecraftforge/gradle/tasks/PostDecompileTask.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,18 @@ public String asRead(String name, String file) throws Exception
127127
file = FFPatcher.processFile(file);
128128

129129
// patch the file
130-
Collection<File> patchFiles = patchesMap.get(name.replace('/', '.'));
130+
Collection<File> patchFiles = patchesMap.get(name);
131131
if (!patchFiles.isEmpty())
132132
{
133-
getLogger().debug("applying MCP patches");
133+
getLogger().debug("applying " + patchFiles.size() + " MCP patch(es)");
134134
ContextProvider provider = new ContextProvider(file);
135135
ContextualPatch patch = findPatch(patchFiles, provider,getLogger());
136136
if (patch != null) {
137137
patchErrors.add(new PatchAttempt(patch.patch(false),file));
138138
file = provider.getAsString();
139+
} else {
140+
//This shouldn't ever happen
141+
throw new IllegalStateException("Cannot find patches " + patchFiles + " for " + name);
139142
}
140143
}
141144

@@ -258,7 +261,7 @@ private static ContextualPatch findPatch(Collection<File> files, ContextProvider
258261
{
259262
ContextualPatch patch = null;
260263
File lastFile = null;
261-
boolean success = true;
264+
boolean success = false;
262265
for (File f : files)
263266
{
264267
logger.debug("trying MCP patch " + f.getName());

src/main/java/net/minecraftforge/gradle/user/UserBasePlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ protected void makeDecompTasks(final String globalPattern, final String localPat
314314
deobfDecomp.setExceptionsCfg(delayedFile(MCP_DATA_EXCEPTIONS));
315315
deobfDecomp.setInJar(transformedJar);
316316
deobfDecomp.setOutJar(deobfDecompJar);
317-
deobfDecomp.dependsOn(inputTask, TASK_GENERATE_SRGS, TASK_EXTRACT_DEP_ATS, TASK_DD_COMPILE, TASK_DD_PROVIDED); // todo grab correct task to depend on
317+
deobfDecomp.dependsOn(transformAccess);
318318
}
319319

320320
final ApplyFernFlowerTask decompile = makeTask(TASK_DECOMPILE, ApplyFernFlowerTask.class);

src/main/java/net/minecraftforge/gradle/util/patching/ContextualPatch.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ public List<PatchReport> patch(boolean dryRun) throws PatchException, IOExceptio
185185

186186
private void init() throws IOException
187187
{
188+
unreadPatchLine();
188189
if (patchString != null)
189190
{
190191
//Just read the string as is, without trying to read the magic/encoding as the string shuldn't need encoding!

0 commit comments

Comments
 (0)