Jump to content

denoflions

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by denoflions

  1. When building a project written in Groovy ForgeGradle seems to have awareness of the fact that it is Groovy since it generates the appropriate tasks to compile it. However, the output doesn't seem to get reobf'd since I get an endless stream of 'No such property' errors any time I hit an obf'd field or method. So unless I've done something wrong configuring my project, I assume getting a mod written in Groovy to load in an obf'd environment is impossible without a go-between java class or metaClass shenanigans. Am I wrong here? edit: I've figured out the solution. You need to set every class that interacts with obf'd minecraft classes to CompileStatic. I wrote a hacky gradle task to accomplish this across the whole project automatically. Slap the following into your build.gradle and away you go. task staticGroovy{ def base = new File("src/main/groovy") base.eachFileRecurse { if (!it.isDirectory()){ if (it.getName().contains(".groovy")){ def bail = false def import_added = false def anno_added = false def list = [] as List<String> def marker = "//Preprocessed." def file = it list.add(marker) it.eachLine { if (it.contains(marker)){ bail = true } def name = FilenameUtils.removeExtension(file.getName()) if (it.contains("class ${name}") && it.contains("{") && !anno_added){ list.add("@CompileStatic") anno_added = true } list.add(it) if (it.contains("package ") && !import_added){ list.add("") list.add("import groovy.transform.CompileStatic") import_added = true } } if (!bail){ BufferedWriter out = new BufferedWriter(new FileWriter(it)) list.each{ out.write(it) out.newLine() } out.flush() out.close() } } } } } sourceMainGroovy.dependsOn staticGroovy
  2. Out of curiosity, what is the difference? Intellij prompts you to import when you open the project generated by the idea task. After the auto-import you have access to all the gradle tasks just like in your tutorial.
  3. I have a mod project that uses maven for dependencies. I use Intellij IDEA Ultimate for my IDE. Once I have set up the project using the idea switch for ForgeGradle how would I update the dependencies? Changing them in build.gradle and running the idea switch again doesn't seem to work. I'd rather not have to recreate the project file every time as I'd have to wait for it to index and import the gradle settings every time.
  4. Indeed I am checking the right things. Example: Code in Intelij: http://i.imgur.com/L81PXCch.png Class file compiled by gradle: http://i.imgur.com/NqUjQk1h.png Class file compiled by the old mcp scripts in 953: http://i.imgur.com/5WpPeQPh.png The mod fails to load in a normal minecraft environment as soon as it hits a deobf'd field.
  5. I'm seeing this as well. "gradlew.bat build" gives you classes that aren't reobfuscated. I see the reobf task get called in the console, however the jar that gets spit out in build/libs is unobfuscated as well as all the class files in build/classes.
  6. See my answer over in the ASM thread. It will accomplish what you want. http://www.minecraftforge.net/forum/index.php/topic,3402.msg22537.html#msg22537
  7. The only way I've seen it done is to modify the class and package it with your coremod. Override the class with a Transformer like how NEI does. Here is an example of a class overrider in the same vein as NEI. Link. Here is it being used in a Transformer. Link. You set the location in your FMLLoadingPlugin in injectData with a line like: location = (File) data.get("coremodLocation");
  8. The slot index corresponds to the slot of an ItemStack array that you should have created in your TileEntity. All of the IInventory implemented methods should point to that array. It basically maps out so that each slot in a GUI lines up with a slot in that array. So you put something in the slot that you designated slot 0 in your Container, it will go in 0 slot of the array inside the TileEntity and you can reference it from there.
  9. I do this (sort of) with Plugins for Forestry's Butcher Knife. I just cause the player to 'drop' the item when the conditions are met. It looks a bit silly but its far more simple than any other way I've come across.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.