MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
522 stars 444 forks source link

Build Failed, Cannot Find Hunk Target #365

Closed jackie-scholl closed 5 years ago

jackie-scholl commented 8 years ago

Hi,

This is my first time ever building a minecraft mod, so I might just be making a stupid mistake. I tried following the tutorial at http://www.minecraftforge.net/wiki/Installation/Source to install Forge. I downloaded forge-1.9-12.16.0.1865-1.9-mdk.zip, unzipped it, and ran ./gradlew setupDecompWorkspace --refresh-dependencies. The command definitely seems to do stuff, but it ends up with an error, copied below. The error seems similar to #235 and #344. Minecraft wasn't updated to 1.9, so I did that, and also I had been using an early version of Java 9, so I switched back to Java 8. I got the same error again. Is there anything I can do to fix this?

Jackies-MacBook-Pro:forge-1.9-12.16.0.1865-1.9-mdk jackie$ ./gradlew setupDecompWorkspace --refresh-dependencies
#################################################
         ForgeGradle 2.1-SNAPSHOT-da90449        
  https://github.com/MinecraftForge/ForgeGradle  
#################################################
               Powered by MCP unknown               
             http://modcoderpack.com             
         by: Searge, ProfMobius, Fesh0r,         
         R4wk, ZeuX, IngisKahn, bspkrs           
#################################################
:deobfCompileDummyTask
:deobfProvidedDummyTask
:getVersionJson
:extractUserdev UP-TO-DATE
:extractDependencyATs SKIPPED
:extractMcpData SKIPPED
:extractMcpMappings SKIPPED
:genSrgs SKIPPED
:downloadClient SKIPPED
:downloadServer SKIPPED
:splitServerJar SKIPPED
:mergeJars SKIPPED
:deobfMcSRG SKIPPED
:decompileMc SKIPPED
:fixMcSources
Patching failed: minecraft\net\minecraft\util\math\Cartesian.java
Hunk 1 failed! Cannot find hunk target
       }

       public List<T> apply(Object[] p_apply_1_) {
-         return Arrays.<T>asList((Object[])p_apply_1_);
+         return Arrays.<T>asList((T[])p_apply_1_);
       }
    }

File state
package net.minecraft.util.math;

import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.UnmodifiableIterator;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;

public class Cartesian {
   public static <T> Iterable<T[]> func_179318_a(Class<T> p_179318_0_, Iterable<? extends Iterable<? extends T>> p_179318_1_) {
      return new Cartesian.Product(p_179318_0_, (Iterable[])func_179322_b(Iterable.class, p_179318_1_));
   }

   public static <T> Iterable<List<T>> func_179321_a(Iterable<? extends Iterable<? extends T>> p_179321_0_) {
      return func_179323_b(func_179318_a(Object.class, p_179321_0_));
   }

   private static <T> Iterable<List<T>> func_179323_b(Iterable<Object[]> p_179323_0_) {
      return Iterables.transform(p_179323_0_, new Cartesian.GetList());
   }

   private static <T> T[] func_179322_b(Class<? super T> p_179322_0_, Iterable<? extends T> p_179322_1_) {
      List<T> list = Lists.<T>newArrayList();

      for(T t : p_179322_1_) {
         list.add(t);
      }

      return (T[])((Object[])list.toArray(func_179319_b(p_179322_0_, list.size())));
   }

   private static <T> T[] func_179319_b(Class<? super T> p_179319_0_, int p_179319_1_) {
      return (T[])((Object[])((Object[])Array.newInstance(p_179319_0_, p_179319_1_)));
   }

   static class GetList<T> implements Function<Object[], List<T>> {
      private GetList() {
      }

      public List<T> apply(Object[] p_apply_1_) {
         return Arrays.asList((Object[])p_apply_1_);
      }
   }

   static class Product<T> implements Iterable<T[]> {
      private final Class<T> field_179429_a;
      private final Iterable<? extends T>[] field_179428_b;

      private Product(Class<T> p_i46020_1_, Iterable<? extends T>[] p_i46020_2_) {
         this.field_179429_a = p_i46020_1_;
         this.field_179428_b = p_i46020_2_;
      }

      public Iterator<T[]> iterator() {
         return (Iterator<T[]>)(this.field_179428_b.length <= 0?Collections.singletonList((Object[])Cartesian.func_179319_b(this.field_179429_a, 0)).iterator():new Cartesian.Product.ProductIterator(this.field_179429_a, this.field_179428_b));
      }

      static class ProductIterator<T> extends UnmodifiableIterator<T[]> {
         private int field_179426_a;
         private final Iterable<? extends T>[] field_179424_b;
         private final Iterator<? extends T>[] field_179425_c;
         private final T[] field_179423_d;

         private ProductIterator(Class<T> p_i46018_1_, Iterable<? extends T>[] p_i46018_2_) {
            this.field_179426_a = -2;
            this.field_179424_b = p_i46018_2_;
            this.field_179425_c = (Iterator[])Cartesian.func_179319_b(Iterator.class, this.field_179424_b.length);

            for(int i = 0; i < this.field_179424_b.length; ++i) {
               this.field_179425_c[i] = p_i46018_2_[i].iterator();
            }

            this.field_179423_d = Cartesian.func_179319_b(p_i46018_1_, this.field_179425_c.length);
         }

         private void func_179422_b() {
            this.field_179426_a = -1;
            Arrays.fill(this.field_179425_c, (Object)null);
            Arrays.fill(this.field_179423_d, (Object)null);
         }

         public boolean hasNext() {
            if(this.field_179426_a == -2) {
               this.field_179426_a = 0;

               for(Iterator<? extends T> iterator1 : this.field_179425_c) {
                  if(!iterator1.hasNext()) {
                     this.func_179422_b();
                     break;
                  }
               }

               return true;
            } else {
               if(this.field_179426_a >= this.field_179425_c.length) {
                  for(this.field_179426_a = this.field_179425_c.length - 1; this.field_179426_a >= 0; --this.field_179426_a) {
                     Iterator<? extends T> iterator = this.field_179425_c[this.field_179426_a];
                     if(iterator.hasNext()) {
                        break;
                     }

                     if(this.field_179426_a == 0) {
                        this.func_179422_b();
                        break;
                     }

                     iterator = this.field_179424_b[this.field_179426_a].iterator();
                     this.field_179425_c[this.field_179426_a] = iterator;
                     if(!iterator.hasNext()) {
                        this.func_179422_b();
                        break;
                     }
                  }
               }

               return this.field_179426_a >= 0;
            }
         }

         public T[] next() {
            if(!this.hasNext()) {
               throw new NoSuchElementException();
            } else {
               while(this.field_179426_a < this.field_179425_c.length) {
                  this.field_179423_d[this.field_179426_a] = this.field_179425_c[this.field_179426_a].next();
                  ++this.field_179426_a;
               }

               return (T[])((Object[])this.field_179423_d.clone());
            }
         }
      }
   }
}

Patching failed: minecraft\net\minecraft\client\renderer\texture\TextureManager.java
Hunk 2 failed! Cannot find hunk target
          this.field_110585_a.put(p_110579_1_, (ITextureObject)p_110579_2_);
          flag = false;
       } catch (Throwable throwable) {
+         final ITextureObject p_110579_2_f = p_110579_2_;
          CrashReport crashreport = CrashReport.func_85055_a(throwable, "Registering texture");
          CrashReportCategory crashreportcategory = crashreport.func_85058_a("Resource location being registered");
          crashreportcategory.func_71507_a("Resource location", p_110579_1_);
          crashreportcategory.func_71500_a("Texture object class", new Callable<String>() {
             public String call() throws Exception {
-               return p_110579_2_.getClass().getName();
+               return p_110579_2_f.getClass().getName();
             }
          });
          throw new ReportedException(crashreport);
File state
package net.minecraft.client.renderer.texture;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.Callable;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.ITickable;
import net.minecraft.client.renderer.texture.ITickableTextureObject;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@SideOnly(Side.CLIENT)
public class TextureManager implements ITickable, IResourceManagerReloadListener {
   private static final Logger field_147646_a = LogManager.getLogger();
   private final Map<ResourceLocation, ITextureObject> field_110585_a = Maps.<ResourceLocation, ITextureObject>newHashMap();
   private final List<ITickable> field_110583_b = Lists.<ITickable>newArrayList();
   private final Map<String, Integer> field_110584_c = Maps.<String, Integer>newHashMap();
   private IResourceManager field_110582_d;

   public TextureManager(IResourceManager p_i1284_1_) {
      this.field_110582_d = p_i1284_1_;
   }

   public void func_110577_a(ResourceLocation p_110577_1_) {
      ITextureObject itextureobject = (ITextureObject)this.field_110585_a.get(p_110577_1_);
      if(itextureobject == null) {
         itextureobject = new SimpleTexture(p_110577_1_);
         this.func_110579_a(p_110577_1_, itextureobject);
      }

      TextureUtil.func_94277_a(itextureobject.func_110552_b());
   }

   public boolean func_110580_a(ResourceLocation p_110580_1_, ITickableTextureObject p_110580_2_) {
      if(this.func_110579_a(p_110580_1_, p_110580_2_)) {
         this.field_110583_b.add(p_110580_2_);
         return true;
      } else {
         return false;
      }
   }

   public boolean func_110579_a(ResourceLocation p_110579_1_, final ITextureObject p_110579_2_) {
      boolean flag = true;

      try {
         ((ITextureObject)p_110579_2_).func_110551_a(this.field_110582_d);
      } catch (IOException ioexception) {
         field_147646_a.warn((String)("Failed to load texture: " + p_110579_1_), (Throwable)ioexception);
         p_110579_2_ = TextureUtil.field_111001_a;
         this.field_110585_a.put(p_110579_1_, p_110579_2_);
         flag = false;
      } catch (Throwable throwable) {
         CrashReport crashreport = CrashReport.func_85055_a(throwable, "Registering texture");
         CrashReportCategory crashreportcategory = crashreport.func_85058_a("Resource location being registered");
         crashreportcategory.func_71507_a("Resource location", p_110579_1_);
         crashreportcategory.func_71500_a("Texture object class", new Callable<String>() {
            public String call() throws Exception {
               return p_110579_2_.getClass().getName();
            }
         });
         throw new ReportedException(crashreport);
      }

      this.field_110585_a.put(p_110579_1_, p_110579_2_);
      return flag;
   }

   public ITextureObject func_110581_b(ResourceLocation p_110581_1_) {
      return (ITextureObject)this.field_110585_a.get(p_110581_1_);
   }

   public ResourceLocation func_110578_a(String p_110578_1_, DynamicTexture p_110578_2_) {
      Integer integer = (Integer)this.field_110584_c.get(p_110578_1_);
      if(integer == null) {
         integer = Integer.valueOf(1);
      } else {
         integer = Integer.valueOf(integer.intValue() + 1);
      }

      this.field_110584_c.put(p_110578_1_, integer);
      ResourceLocation resourcelocation = new ResourceLocation(String.format("dynamic/%s_%d", new Object[]{p_110578_1_, integer}));
      this.func_110579_a(resourcelocation, p_110578_2_);
      return resourcelocation;
   }

   public void func_110550_d() {
      for(ITickable itickable : this.field_110583_b) {
         itickable.func_110550_d();
      }

   }

   public void func_147645_c(ResourceLocation p_147645_1_) {
      ITextureObject itextureobject = this.func_110581_b(p_147645_1_);
      if(itextureobject != null) {
         TextureUtil.func_147942_a(itextureobject.func_110552_b());
      }

   }

   public void func_110549_a(IResourceManager p_110549_1_) {
      for(Entry<ResourceLocation, ITextureObject> entry : this.field_110585_a.entrySet()) {
         this.func_110579_a((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue());
      }

   }
}

:fixMcSources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':fixMcSources'.
> com.cloudbees.diff.PatchException: Cannot find hunk target

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 32.552 secs
AbrarSyed commented 8 years ago

try running ./gradlew clean and setting up again.. @LexManos looks like the MCP patches failed.. they been updated yet?

jackie-scholl commented 8 years ago

@AbrarSyed that worked! Thank you!

Edit: Nope :(

jackie-scholl commented 8 years ago

My apologies, I wasn't paying attention and saw "BUILD SUCCESSFUL." Turns out the clean was successful, but when I tried to run ./gradlew setupDecompWorkspace --refresh-dependencies after that, it failed again :(

jackie-scholl commented 8 years ago

I also get an error when I try it with the 1.8.9 mdk. I tried building straight from the source on Github, and I was able to successfully run "build" but there was no "setupDecompWorkspace" task to run.

Guichaguri commented 8 years ago

Same here, I'm using the tweaker-client plugin. Minecraft 1.9 with MCP snapshot_20160312 Crash log

jriwanek commented 8 years ago

Have you tried using a newer mapping version?

Guichaguri commented 8 years ago

Yes, I'm using snapshot_20160507, but still not working

Guichaguri commented 8 years ago

I updated ForgeGradle to 2.1-SNAPSHOT and it now works.

jriwanek commented 8 years ago

Looks like That'll solve @raptortech-js's problem too.

bms-1984 commented 7 years ago

I'm now having this same problem with ForgeGradle 2.3 (have already tried 2.2, same issue), Forge 1.12 - 14.21.0.2334, and MCP Mappings 20170618. Same log and all that. Anyone know anything?

bms-1984 commented 7 years ago

Nevermind, cleanCache fixed this.

ghost commented 7 years ago

@BenjaminSutter I'm getting the same error on the same version you are. I tried gradlew cleanCache but the same error still happens.

themericks commented 7 years ago

Has this been resolved? I'm getting the same problem with Forge 1.12-14.21.1.2387 and ForgeGradle 2.3...

EDIT: stupid me, forgot to update MCP. Worked with snapshot_20170712.

Volikaris commented 7 years ago

Guys, I've been trying to do this for last 8 hours, reinstalling JAVA several times, different IDK'S .. tried different Forge versions, different ForgeGradle, different snapshots... STILL I get one damn error.

Help me, I am already googling on how to hang myself because of that.. >_>

or maybe someone can just give me a CLEAN install of that working? Couldn't find that either.. (if it matters 1.8 or 1.9 JDK/JRE w/e) I wanted Forge for 1.12 with that stupid setupDecompWorkspace done and working..

ghost commented 7 years ago

I fixed it by setting up the mdk again, you can copy paste the src folder and you'll still have your mod code.

Volikaris commented 7 years ago

I tried like re-running it at least dozen times on each setup that worked for other people.. Could you maybe give me a clean install after setupDecompWorkspace by yourself? .zip it and upload ? I would be so glad.

Mumfrey commented 7 years ago

I tried like re-running it at least dozen times on each setup that worked for other people.. Could you maybe give me a clean install after setupDecompWorkspace by yourself? .zip it and upload ? I would be so glad.

You realise that the whole point of decompiling locally is that distributing decompiled jars is not allowed? If it's not working for you then it's most likely that some crappy artefacts from a previous run are still hanging around in the cache. Run the following command

gradle cleanCache

To clear out your gradle cache and then run the decompilation again, making sure you're running the correct build of forgegradle for the version you're trying to decompile (for 1.12.x this is going to be 2.3).

Volikaris commented 7 years ago

I have quite clean installation of Windows itself. I also did the cleanCache... I have downloaded MDK from minecraftforge.net so it had ForgeGradle in it. manually updated the snapshot to various versions.. using recommended Forge MDK for 1.12.. am I missing something?

And yes, its for 1.12... forgegradle 2.3 ...

EDIT: And for example "setupDevWorkspace" works.. is it enough to "write" mods in java?

Volikaris commented 7 years ago

Not sure what changed throughout those 3 days, but this morning I've opened MCP snapshots too see the newest version. Instead of 0823 I used 0825 ... and guess what.. the whole damn thing just worked, without any cleanCache or clean or ANYTHING.. I am confused, but anyway big thanks for the help :)

EDIT : Just in case ANYONE wonders : Java : JDK 8u144, ForgeGradle 2.3, MC 1.12, Forge 14.21.1.2387-mdk, MCP snapshot 20170825

Takakura-Anri commented 5 years ago

Problem still occurs on mcp stable_39.

Using Oracle JDK 8u202 and Forge 2814

EDIT: Upgrade to Gradle 2.9 and remove ALL cache folders include ~/.gradle, build/, .gradle/ and run ./gradlew --refresh-dependencies cleanCache setupDecompWorkspace solve this issue.

jriwanek commented 5 years ago

Update to atleast gradle 2.14, and make sure you're using FG2.3 for Minecraft 1.12.2

mahtaran commented 5 years ago

Can confirm that this issue still persists/reappeared. Tried to setup a workspace with Forge version 1.12.2-14.23.5.2844, and I got the error. Changed it back to 1.12.2-14.23.5.2768 and it now works fine. ForgeGradle version: 2.3-SNAPSHOT-7764e3e Gradle version: 4.9 Java version: 1.8.0_221 25.221-b11

Error:

Execution failed for task ':applySourcePatches'.
> com.cloudbees.diff.PatchException: Cannot find hunk target

Let me know if you need the entire stacktrace.

Zeitheron commented 5 years ago

Got the same issue, when trying to use 1.12.2-14.23.5.2844. Found out that 1.12.2-14.23.5.2838 seems to work fine. @Mahtaran

mahtaran commented 5 years ago

If I had to guess, it has something to do with @LexManos's changes with the new Jenkinsfile. In particular this commit, which changes the line numbers of the patch file for no apparent reason. https://github.com/MinecraftForge/MinecraftForge/commit/ae2cb06d2cb4f7fcf99f2725e8b19a11aaae1537#diff-97673260fb0239af80fa467c2f5f5086

LexManos commented 5 years ago

I can rerun the patch gen. but it should load fine, as it does on our jenkins file. In these cases we need more detailed reports. Namely, exact is, jdk, and gradle versions. As well as the produced fernflower output jar which you technically cant give us as its mojangs code. So it makes this hard.

mahtaran commented 5 years ago

Well, I use the latest Oracle JDK8. Gradle is 4.9 as noted above, but the issue also persists with the Gradle version bundled with the MDK. And if you could give me a clue what to look for in the FernFlower output, I can have a look at it.

LexManos commented 5 years ago

We need a diff between your ff output and a good ff output. Go to discord people may be able to help you figure it out there. I am out of town at the moment and cant really do remote debugging for you.

mahtaran commented 5 years ago

👍

ThexXTURBOXx commented 5 years ago

@Mahtaran Did you get it working yet? I was struggling with getting 2844 to work, too. 2838 worked for me as well though.

mahtaran commented 5 years ago

We figured out that it was because of a bundled patch file which should not exist, Lex will have a look at it once he gets back (Thursday). In the meantime, it is best to use an older version.

ThexXTURBOXx commented 5 years ago

Ah okay, very nice. Good work!

unresolvedsymbol commented 5 years ago

No new version to fix this yet? This breaks the mdk completely if you try updating to 2844..

mahtaran commented 5 years ago

Read my message.

Lex will have a look at it once he gets back (Thursday). In the meantime, it is best to use an older version.

LexManos commented 5 years ago

https://github.com/MinecraftForge/ForgeGradle/commit/813b905cb0dc63073e7a8dbc0154d3905154d104#diff-3bd5d195a2534aec6dcc70a8970ab9d7

2844 has been redeployed with this fix

CammiePone commented 4 years ago

I'm still having this issue, even on 2847 with a brand new workspace. image

kepexx commented 4 years ago

I'm having this issue with forge-1.8.9-11.15.1.1722-mdk. I'm not sure how to update ForgeGradle (should I just get a newer MDK?) and/or how to change the MCP version. I don't even have MCP installed, should I install it? Brand new workspace.

ThexXTURBOXx commented 4 years ago

You don't need to upgrade ForgeGradle or install the MCP yourself. If a specific MDK isn't working, try another one. It's, of course, best to use the newest one for the version, you want to be modding for. Try updating your MDK to the newest version for 1.8.9 and if that one doesn't work as well, try one version older and so on (but report back, if the newest one doesn't work as well! Also, post a log then).

FinnT730 commented 4 years ago

We don't support anything under 1.14 anymore, 1.8 is broken since Maven changed something, nothing you can even do about it. Not even us.

So, please update to a modern version of the game, and please don't say it is the most popular one, since it is NOT

kepexx commented 4 years ago

@ThexXTURBOXx latest version didnt work, same error:

> Task :fixMcSources FAILED
Patching failed: minecraft\net\minecraft\util\Cartesian.java
Hunk 1 failed! Cannot find hunk target
       }

       public List<T> apply(Object[] p_apply_1_) {
-         return Arrays.<T>asList((Object[])p_apply_1_);
+         return Arrays.<T>asList((T[])p_apply_1_);
       }
    }

File state
package net.minecraft.util;

import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.UnmodifiableIterator;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;

public class Cartesian {
   public static <T> Iterable<T[]> func_179318_a(Class<T> p_179318_0_, Iterable<? extends Iterable<? extends T>> p_179318_1_) {
      return new Cartesian.Product(p_179318_0_, (Iterable[])func_179322_b(Iterable.class, p_179318_1_));
   }

   public static <T> Iterable<List<T>> func_179321_a(Iterable<? extends Iterable<? extends T>> p_179321_0_) {
      return func_179323_b(func_179318_a(Object.class, p_179321_0_));
   }

   private static <T> Iterable<List<T>> func_179323_b(Iterable<Object[]> p_179323_0_) {
      return Iterables.transform(p_179323_0_, new Cartesian.GetList());
   }

   private static <T> T[] func_179322_b(Class<? super T> p_179322_0_, Iterable<? extends T> p_179322_1_) {
      List<T> list = Lists.<T>newArrayList();

      for(T t : p_179322_1_) {
         list.add(t);
      }

      return (T[])((Object[])list.toArray(func_179319_b(p_179322_0_, list.size())));
   }

   private static <T> T[] func_179319_b(Class<? super T> p_179319_0_, int p_179319_1_) {
      return (T[])((Object[])((Object[])Array.newInstance(p_179319_0_, p_179319_1_)));
   }

   static class GetList<T> implements Function<Object[], List<T>> {
      private GetList() {
      }

      public List<T> apply(Object[] p_apply_1_) {
         return Arrays.asList((Object[])p_apply_1_);
      }
   }

   static class Product<T> implements Iterable<T[]> {
      private final Class<T> field_179429_a;
      private final Iterable<? extends T>[] field_179428_b;

      private Product(Class<T> p_i46020_1_, Iterable<? extends T>[] p_i46020_2_) {
         this.field_179429_a = p_i46020_1_;
         this.field_179428_b = p_i46020_2_;
      }

      public Iterator<T[]> iterator() {
         return (Iterator<T[]>)(this.field_179428_b.length <= 0?Collections.singletonList((Object[])Cartesian.func_179319_b(this.field_179429_a, 0)).iterator():new Cartesian.Product.ProductIterator(this.field_179429_a, this.field_179428_b));
      }

      static class ProductIterator<T> extends UnmodifiableIterator<T[]> {
         private int field_179426_a;
         private final Iterable<? extends T>[] field_179424_b;
         private final Iterator<? extends T>[] field_179425_c;
         private final T[] field_179423_d;

         private ProductIterator(Class<T> p_i46018_1_, Iterable<? extends T>[] p_i46018_2_) {
            this.field_179426_a = -2;
            this.field_179424_b = p_i46018_2_;
            this.field_179425_c = (Iterator[])Cartesian.func_179319_b(Iterator.class, this.field_179424_b.length);

            for(int i = 0; i < this.field_179424_b.length; ++i) {
               this.field_179425_c[i] = p_i46018_2_[i].iterator();
            }

            this.field_179423_d = Cartesian.func_179319_b(p_i46018_1_, this.field_179425_c.length);
         }

         private void func_179422_b() {
            this.field_179426_a = -1;
            Arrays.fill(this.field_179425_c, (Object)null);
            Arrays.fill(this.field_179423_d, (Object)null);
         }

         public boolean hasNext() {
            if(this.field_179426_a == -2) {
               this.field_179426_a = 0;

               for(Iterator<? extends T> iterator1 : this.field_179425_c) {
                  if(!iterator1.hasNext()) {
                     this.func_179422_b();
                     break;
                  }
               }

               return true;
            } else {
               if(this.field_179426_a >= this.field_179425_c.length) {
                  for(this.field_179426_a = this.field_179425_c.length - 1; this.field_179426_a >= 0; --this.field_179426_a) {
                     Iterator<? extends T> iterator = this.field_179425_c[this.field_179426_a];
                     if(iterator.hasNext()) {
                        break;
                     }

                     if(this.field_179426_a == 0) {
                        this.func_179422_b();
                        break;
                     }

                     iterator = this.field_179424_b[this.field_179426_a].iterator();
                     this.field_179425_c[this.field_179426_a] = iterator;
                     if(!iterator.hasNext()) {
                        this.func_179422_b();
                        break;
                     }
                  }
               }

               return this.field_179426_a >= 0;
            }
         }

         public T[] next() {
            if(!this.hasNext()) {
               throw new NoSuchElementException();
            } else {
               while(this.field_179426_a < this.field_179425_c.length) {
                  this.field_179423_d[this.field_179426_a] = this.field_179425_c[this.field_179426_a].next();
                  ++this.field_179426_a;
               }

               return (T[])((Object[])this.field_179423_d.clone());
            }
         }
      }
   }
}

Patching failed: minecraft\net\minecraft\client\renderer\texture\TextureManager.java
Hunk 2 failed! Cannot find hunk target
          this.field_110585_a.put(p_110579_1_, (ITextureObject)p_110579_2_);
          flag = false;
       } catch (Throwable throwable) {
+         final ITextureObject p_110579_2_f = p_110579_2_;
          CrashReport crashreport = CrashReport.func_85055_a(throwable, "Registering texture");
          CrashReportCategory crashreportcategory = crashreport.func_85058_a("Resource location being registered");
          crashreportcategory.func_71507_a("Resource location", p_110579_1_);
          crashreportcategory.func_71500_a("Texture object class", new Callable<String>() {
             public String call() throws Exception {
-               return p_110579_2_.getClass().getName();
+               return p_110579_2_f.getClass().getName();
             }
          });
          throw new ReportedException(crashreport);
File state
package net.minecraft.client.renderer.texture;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.Callable;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.ITickable;
import net.minecraft.client.renderer.texture.ITickableTextureObject;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@SideOnly(Side.CLIENT)
public class TextureManager implements ITickable, IResourceManagerReloadListener {
   private static final Logger field_147646_a = LogManager.getLogger();
   private final Map<ResourceLocation, ITextureObject> field_110585_a = Maps.<ResourceLocation, ITextureObject>newHashMap();
   private final List<ITickable> field_110583_b = Lists.<ITickable>newArrayList();
   private final Map<String, Integer> field_110584_c = Maps.<String, Integer>newHashMap();
   private IResourceManager field_110582_d;

   public TextureManager(IResourceManager p_i1284_1_) {
      this.field_110582_d = p_i1284_1_;
   }

   public void func_110577_a(ResourceLocation p_110577_1_) {
      ITextureObject itextureobject = (ITextureObject)this.field_110585_a.get(p_110577_1_);
      if(itextureobject == null) {
         itextureobject = new SimpleTexture(p_110577_1_);
         this.func_110579_a(p_110577_1_, itextureobject);
      }

      TextureUtil.func_94277_a(itextureobject.func_110552_b());
   }

   public boolean func_110580_a(ResourceLocation p_110580_1_, ITickableTextureObject p_110580_2_) {
      if(this.func_110579_a(p_110580_1_, p_110580_2_)) {
         this.field_110583_b.add(p_110580_2_);
         return true;
      } else {
         return false;
      }
   }

   public boolean func_110579_a(ResourceLocation p_110579_1_, final ITextureObject p_110579_2_) {
      boolean flag = true;

      try {
         ((ITextureObject)p_110579_2_).func_110551_a(this.field_110582_d);
      } catch (IOException ioexception) {
         field_147646_a.warn((String)("Failed to load texture: " + p_110579_1_), (Throwable)ioexception);
         p_110579_2_ = TextureUtil.field_111001_a;
         this.field_110585_a.put(p_110579_1_, p_110579_2_);
         flag = false;
      } catch (Throwable throwable) {
         CrashReport crashreport = CrashReport.func_85055_a(throwable, "Registering texture");
         CrashReportCategory crashreportcategory = crashreport.func_85058_a("Resource location being registered");
         crashreportcategory.func_71507_a("Resource location", p_110579_1_);
         crashreportcategory.func_71500_a("Texture object class", new Callable<String>() {
            public String call() throws Exception {
               return p_110579_2_.getClass().getName();
            }
         });
         throw new ReportedException(crashreport);
      }

      this.field_110585_a.put(p_110579_1_, p_110579_2_);
      return flag;
   }

   public ITextureObject func_110581_b(ResourceLocation p_110581_1_) {
      return (ITextureObject)this.field_110585_a.get(p_110581_1_);
   }

   public ResourceLocation func_110578_a(String p_110578_1_, DynamicTexture p_110578_2_) {
      Integer integer = (Integer)this.field_110584_c.get(p_110578_1_);
      if(integer == null) {
         integer = Integer.valueOf(1);
      } else {
         integer = Integer.valueOf(integer.intValue() + 1);
      }

      this.field_110584_c.put(p_110578_1_, integer);
      ResourceLocation resourcelocation = new ResourceLocation(String.format("dynamic/%s_%d", new Object[]{p_110578_1_, integer}));
      this.func_110579_a(resourcelocation, p_110578_2_);
      return resourcelocation;
   }

   public void func_110550_d() {
      for(ITickable itickable : this.field_110583_b) {
         itickable.func_110550_d();
      }

   }

   public void func_147645_c(ResourceLocation p_147645_1_) {
      ITextureObject itextureobject = this.func_110581_b(p_147645_1_);
      if(itextureobject != null) {
         TextureUtil.func_147942_a(itextureobject.func_110552_b());
      }

   }

   public void func_110549_a(IResourceManager p_110549_1_) {
      for(Entry<ResourceLocation, ITextureObject> entry : this.field_110585_a.entrySet()) {
         this.func_110579_a((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue());
      }

   }
}

Execution failed for task ':fixMcSources'.
> com.cloudbees.diff.PatchException: Cannot find hunk target

@FinnT730 all of the PvP community uses 1.8, and thats mainly who I'm targeting

FinnT730 commented 4 years ago

@FireCubez Like I said before, this is a issue with Maven, Forge can't fix this. And, people want to believe that many people still play 1.8 or 1.7 a lot, but that is false, please look at this chart

ThexXTURBOXx commented 4 years ago

@FireCubez Are you maybe using Java 9+? Try java -version and javac -version in your terminal and make sure, you are using Java 8. If it still doesn't work with Java 8, then there is not much you and I can do, I am sorry.

kepexx commented 4 years ago

Oh, yeah i'm not using Java 8

ThexXTURBOXx commented 4 years ago

@FinnT730 No need to argue about which version is the most popular. If you don't want to help, then please stay out of such discussions. He may still have reasons to develop for this specific version, as I am also still modding for e.g. 1.4.7 and 1.2.5. Also, the chart is wrong for this purpose, because the servers may be using BungeeCord and so on, which let you join using many other versions. It is still true, that 1.8(.9) is a very popular version (as client), as 1.7(.10) was before (just take a look at the number of Hack Clients available for 1.8(.9) in particular).

FinnT730 commented 4 years ago

Fine, but this will be a issue even when using Java 8 (or even 7 for that matter), since Maven is broken for Forge,

kepexx commented 4 years ago

yeah, same error. I guess i'll just do source modification

ThexXTURBOXx commented 4 years ago

That's weird, I successfully set up a new workspace like a week ago (1.8.9 as well) and it worked for me using latest JDK 8. @FireCubez Did you try java -version and javac -version and verified, that it is really using Java 8 and not the other Java installation? Also, maybe try just gradlew setupDevWorkspace --refresh-dependencies and not the setupDecompWorkspace task. If it still does not work after all of this, I can't help any further. Maybe it worked for me then because I still have some neccessary files in my cache.

kepexx commented 4 years ago

@ThexXTURBOXx strangly, javac doesn't even work. i.e. its not in the path seemingly. this is a new windows install so i dont have it from before

kepexx commented 4 years ago

can you give me the MDK you used?

ThexXTURBOXx commented 4 years ago

Try adding your installed JDK to the PATH and also to the JAVA_HOME variable (ask Google for this please). Also, for legal reasons, nobody may share the cache files and the MDK. I used 1722 with mappings stable_20.

kepexx commented 4 years ago

okay, I got setupDevWorkspace --refresh-dependencies to work