Jump to content

Maxi07

Members
  • Posts

    107
  • Joined

  • Last visited

Posts posted by Maxi07

  1. This are my current thoughts and experiments to this:

     

    I added

    task sourceJar(type: Jar) {
    	classifier = 'sources'
    	from sourceSets.main.allJava
    }

    to my build.gradle and "artifact sourceJar" to the publish

     

    Now a source jar is generated on publish. But, unlike the jar, it is not reobfed (srg)

     

    What I expect to happen is the following: 

    1. On publish the jar and the sources.jar get generated and reobfed (not only the jar)

    2. GenEclipseRuns copies the files to .gradle\caches\forge_gradle\deobf_dependencies and mappes them. So the file is now [jar_name]_mapped_snapshot_20200723-1.16.1.jar. And the obfed sources.jar gets mapped too and is then [jar_name]_mapped_snapshot_20200723-1.16.1-sources.jar

    3. GenEclipseRuns then should tell eclipse that the jar is the lib and that the source can be found in the sources.jar (I can tell eclipse manually where to find the source and javadoc files, but only if it is a java project and not a gradle project)

     

    Does this makes sense and is good system? (I am sorry, if this is completly stupid)

    If it is:

    neither 1, nor 2, nor 3 are happening

     

    I dont know if this is the system you are already working on.

     

    -------------------------------------------------------------------------------

     

    @DaemonUmbra

    What is your current progress?

    What have you already done?

    Is there any way I can help speeding this up or an alternative?

     

    And thanks for trying to help me!

  2. On 9/1/2020 at 12:17 AM, DaemonUmbra said:

    from what Lex has said he originally made a dependency configuration that deobfed and added sources

    But, restoring the source code, via decompiling will never be better then the original.

    If using a source.jar works, why not using it? The source.jar is just not generating. But other modders manage it to generate it on publish (example: https://dvs1.progwml6.com/files/maven/mezz/jei/jei-1.16.1/7.0.1.10/), so it is possible. The Question is just how?

    And the default build.gradle seems to be broken:

    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

    because it is not made by default

  3. By the way, I now switched from a flatDir to a maven (similar like Ommina said), because it is a bit simpler for me.

    And I also learned a bit new about maven and gradle. I am 99.99% sure I need the sources.jar. I already looked where eclipse found the source for minecraft and forge, it's the sources.jar.

    image.png.8d301780eed47efd472f604a8be30587.pngWith these files my maven looks almost like the one from other mods, except the sources.jar (and sources.jar.sha1/md5).

    So when I run publish the [jar name]-sources.jar has to be geratend too!

     

    I already tried adding the line 

    makeObfSourceJar = true
    

    but then is crashed

     

    @DaemonUmbra and everyone, do you have any idea how to do this?

     

    Sorry for bad english at this post

  4. 2 hours ago, Maxi07 said:

    I think, now I have finally got the solution!

     

    After I saw the topic "[1.14.4] How add JEI to own mod?", I focused on trying to find out how other mods do this.

    The problem is clear: eclipse has found no source code. And I think this is not a bug, there is just no source code.

    As far as I know, the faltDir behaves like a regular maven repository. At any mod I have looked (forge too), there is either a [jar name]-sources.jar (it is like the regular jar, but every .class file is the .java file) or the jar not only contains the .class file, but also the .java files. For example the mezz.jei repo at https://dvs1.progwml6.com/files/maven/

     

    Lines from my build.gradle:

    
    // The mappings can be changed at any time, and must be in the following format.
    // snapshot_YYYYMMDD   Snapshot are built nightly.
    // stable_#            Stables are built at the discretion of the MCP team.
    // Use non-default mappings at your own risk. they may not always work.
    // Simply re-run your setup task after changing the mappings to update your workspace.
    mappings channel: 'snapshot', version: '20200723-1.16.1'
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
    
    // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
    
    // Default run configurations.
    // These can be tweaked, removed, or duplicated as needed.

    The is the comment "an Srg named sources jar is made by default". The fact that it is srg named should not matter, because it gets mapped. But the fact that a [jar name]-sources.jar is created is interesting.

     

    If I were right right, I would just have to find this [jar name]-sources.jar.

    And is where I need your help. Where is the sources.jar? Or do I have to add makeObfSourceJar = true (maybe the default is not working)

    Just to make sure we stay on topic, here is my main question

  5. I think, now I have finally got the solution!

     

    After I saw the topic "[1.14.4] How add JEI to own mod?", I focused on trying to find out how other mods do this.

    The problem is clear: eclipse has found no source code. And I think this is not a bug, there is just no source code.

    As far as I know, the faltDir behaves like a regular maven repository. At any mod I have looked (forge too), there is either a [jar name]-sources.jar (it is like the regular jar, but every .class file is the .java file) or the jar not only contains the .class file, but also the .java files. For example the mezz.jei repo at https://dvs1.progwml6.com/files/maven/

     

    Lines from my build.gradle:

    // The mappings can be changed at any time, and must be in the following format.
    // snapshot_YYYYMMDD   Snapshot are built nightly.
    // stable_#            Stables are built at the discretion of the MCP team.
    // Use non-default mappings at your own risk. they may not always work.
    // Simply re-run your setup task after changing the mappings to update your workspace.
    mappings channel: 'snapshot', version: '20200723-1.16.1'
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
    
    // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
    
    // Default run configurations.
    // These can be tweaked, removed, or duplicated as needed.

    The is the comment "an Srg named sources jar is made by default". The fact that it is srg named should not matter, because it gets mapped. But the fact that a [jar name]-sources.jar is created is interesting.

     

    If I were right right, I would just have to find this [jar name]-sources.jar.

    And is where I need your help. Where is the sources.jar? Or do I have to add makeObfSourceJar = true (maybe the default is not working)

  6. I fused my source code to a new blank mdk (to make sure all mdk file are up to date) and run .\gradlew genEclipseRuns in PowerShell. And then I imported the folder as "existing gradle project" in eclipse. (I did this for both projects, and I also build a new jar of my lib mod with gradlew build)

     

    It does still not work. Here are the build.gradle files of both mods:

    The lib mod:

    buildscript {
        repositories {
            maven { url = 'https://files.minecraftforge.net/maven' }
            jcenter()
            mavenCentral()
        }
        dependencies {
            classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
        }
    }
    apply plugin: 'net.minecraftforge.gradle'
    // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
    apply plugin: 'eclipse'
    apply plugin: 'maven-publish'
    
    version = '1.16.1-1.1'
    group = 'maxi.simpledev' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
    archivesBaseName = 'simpledev'
    
    sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
    
    println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
    minecraft {
        // The mappings can be changed at any time, and must be in the following format.
        // snapshot_YYYYMMDD   Snapshot are built nightly.
        // stable_#            Stables are built at the discretion of the MCP team.
        // Use non-default mappings at your own risk. they may not always work.
        // Simply re-run your setup task after changing the mappings to update your workspace.
        mappings channel: 'snapshot', version: '20200723-1.16.1'
        // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
        
        // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
    
        // Default run configurations.
        // These can be tweaked, removed, or duplicated as needed.
        runs {
            client {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                mods {
                    simpledev {
                        source sourceSets.main
                    }
                }
            }
    
            server {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                mods {
                    simpledev {
                        source sourceSets.main
                    }
                }
            }
    
            data {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                args '--mod', 'simpledev', '--all', '--output', file('src/generated/resources/')
    
                mods {
                    simpledev {
                        source sourceSets.main
                    }
                }
            }
        }
    }
    
    dependencies {
        // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
        // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
        // The userdev artifact is a special name and will get all sorts of transformations applied to it.
        minecraft 'net.minecraftforge:forge:1.16.1-32.0.108'
    
        // You may put jars on which you depend on in ./libs or you may define them like so..
        // compile "some.group:artifact:version:classifier"
        // compile "some.group:artifact:version"
    
        // Real examples
        // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
        // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
    
        // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
        // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
    
        // These dependencies get remapped to your current MCP mappings
        // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
    
        // For more info...
        // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
        // http://www.gradle.org/docs/current/userguide/dependency_management.html
    
    }
    
    // Example for how to get properties into the manifest for reading by the runtime..
    jar {
        manifest {
            attributes([
                "Specification-Title": "simpledev",
                "Specification-Vendor": "simpledev",
                "Specification-Version": "1", // We are version 1 of ourselves
                "Implementation-Title": project.name,
                "Implementation-Version": "${version}",
                "Implementation-Vendor" :"simpledev",
                "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
            ])
        }
    }
    
    // Example configuration to allow publishing using the maven-publish task
    // This is the preferred method to reobfuscate your jar file
    jar.finalizedBy('reobfJar') 
    // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
    //publish.dependsOn('reobfJar')
    
    publishing {
        publications {
            mavenJava(MavenPublication) {
                artifact jar
            }
        }
        repositories {
            maven {
                url "file:///${project.projectDir}/mcmodsrepo"
            }
        }
    }

     

    The mod which need the lib mod:

    buildscript {
        repositories {
            maven { url = 'https://files.minecraftforge.net/maven' }
            jcenter()
            mavenCentral()
        }
        dependencies {
            classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
        }
    }
    apply plugin: 'net.minecraftforge.gradle'
    // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
    apply plugin: 'eclipse'
    apply plugin: 'maven-publish'
    
    version = '1.16.1-1.0'
    group = 'maxi.extended_resources' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
    archivesBaseName = 'extended_resources'
    
    sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
    
    println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
    minecraft {
        // The mappings can be changed at any time, and must be in the following format.
        // snapshot_YYYYMMDD   Snapshot are built nightly.
        // stable_#            Stables are built at the discretion of the MCP team.
        // Use non-default mappings at your own risk. they may not always work.
        // Simply re-run your setup task after changing the mappings to update your workspace.
        mappings channel: 'snapshot', version: '20200723-1.16.1'
        // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
        
        // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
    
        // Default run configurations.
        // These can be tweaked, removed, or duplicated as needed.
        runs {
            client {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                mods {
                    extended_resources {
                        source sourceSets.main
                    }
                }
            }
    
            server {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                mods {
                    extended_resources {
                        source sourceSets.main
                    }
                }
            }
    
            data {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                args '--mod', 'extended_resources', '--all', '--output', file('src/generated/resources/')
    
                mods {
                    extended_resources {
                        source sourceSets.main
                    }
                }
            }
        }
    }
    
    repositories {
    	flatDir { 
    		dir 'libs' 
    	}
    }
    
    dependencies {
        // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
        // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
        // The userdev artifact is a special name and will get all sorts of transformations applied to it.
        minecraft 'net.minecraftforge:forge:1.16.1-32.0.108'
    
        // You may put jars on which you depend on in ./libs or you may define them like so..
        // compile "some.group:artifact:version:classifier"
        // compile "some.group:artifact:version"
    
        compile fg.deobf('maxi.simpledev:simpledev:1.16.1-1.1')
    
        // Real examples
        // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
        // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
    
        // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
        // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
    
        // These dependencies get remapped to your current MCP mappings
        // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
    
        // For more info...
        // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
        // http://www.gradle.org/docs/current/userguide/dependency_management.html
    
    }
    
    // Example for how to get properties into the manifest for reading by the runtime..
    jar {
        manifest {
            attributes([
                "Specification-Title": "extended_resources",
                "Specification-Vendor": "extended_resources",
                "Specification-Version": "1", // We are version 1 of ourselves
                "Implementation-Title": project.name,
                "Implementation-Version": "${version}",
                "Implementation-Vendor" :"extended_resources",
                "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
            ])
        }
    }
    
    // Example configuration to allow publishing using the maven-publish task
    // This is the preferred method to reobfuscate your jar file
    jar.finalizedBy('reobfJar') 
    // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
    //publish.dependsOn('reobfJar')
    
    publishing {
        publications {
            mavenJava(MavenPublication) {
                artifact jar
            }
        }
        repositories {
            maven {
                url "file:///${project.projectDir}/mcmodsrepo"
            }
        }
    }

     

    Also my problem is bit different now:

    "Reffrecend Libaries" is now called "Project and External Dependencies", I think it is because it's now a gradle project instead of a normal java project

    image.png.4015ed25f6298191948060d0f7f5b65e.png

  7. I want to update my mod from 1.16.1 to 1.16.2. But now the ore gen part is completely broken.

     

    This code worked on 1.15.2 and 1.16.1:

    public class OreGen {
    	
    	public static void generateEmoulriteOre() {
    		for(Biome biome : ForgeRegistries.BIOMES) {
    			ConfiguredPlacement<DepthAverageConfig> genPlacementConfig = Placement.COUNT_DEPTH_AVERAGE.configure(new DepthAverageConfig(1, 20, 10));
    			biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE
    					.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, RegisterBlocks.EMOULRITE_ORE.get().getDefaultState(), 6))
    					.withPlacement(genPlacementConfig));
    		}
    	}
    	
    	
    	public static void generateTeleriteOre() {
    		
    		for(Biome biome : ForgeRegistries.BIOMES) {
    			ConfiguredPlacement<CountRangeConfig> genPlacementConfig = Placement.COUNT_RANGE.configure(new CountRangeConfig(2, 0, 0, 256));
    			biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE
    					.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType
    							.create("END_STONE", "end_stone", new BlockMatcher(Blocks.END_STONE)), RegisterBlocks.TELERITE_ORE.get().getDefaultState(), 6))
    					.withPlacement(genPlacementConfig));
    		}
    
    	}
    
    }

     

    But like I said, now it is very broken. I know that 1.16.2 has added experimental support for custom biomes in datapacks, and that there were probably some backend changes, but I didn't know that there were so much. And everything that has changed is obfuscated :(

    Can somebody help me please: What do I have to change?

  8. 10 hours ago, HairyPotatoCats said:

    When I try and run ./gradlew genEclipseRuns on a Mac it runs fine then gets stuck at 88%. Please help.

    (Let me know if you need any log text or something of that sort.)

    How long have you waited? It can take up to 20min, my PC need 15min. But only the first time after changing the forge version or the mappings takes long.

×
×
  • Create New...

Important Information

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