Jump to content

[SOLVE[1.7.10]Some but not all assets in JAR don't work, but all work in Eclipse


Recommended Posts

Posted

I must be missing something simple, but I've been stumped for couple days on this.  Basically, when I run in Eclipse all assets work including custom block textures, custom entity textures, custom sounds, the mod logo, and the lang file (hovering over my custom items in creative tab show translated name).

 

When I export the JAR using gradlew build instruction, the JAR contains all the assets organized in the way I expect (and seems same as other people's mod JARs I've inspected).  However, when running Minecraft with this mod the lang file doesn't work (hovering over my custom items in creative tab show "item.bootsofsafefalling.name" and such).  Also the mod logo file no longer shows in the mod options screen.  But all my other textures and sounds are working fine!

 

It seems that the lang file path is less tolerant to the difference between the Eclipse and JAR environment or something, whereas block textures seem to be able to find them.

 

Anyway, here's some relevant info.

 

Eclipse package structure:

http://s30.postimg.org/6i4lzamwh/Capture1.png

 

Resulting JAR top level structure:

http://s12.postimg.org/uu39q2lbx/Capture2.png

 

Resulting JAR en_lang location:

http://s11.postimg.org/4js0ipl9v/Capture3.png

 

Here is my build.gradle file contents:

buildscript {
    repositories {
        mavenCentral()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
    }
}

apply plugin: 'forge'

version = "1.7.10-1.0.0"
group= "com.blogspot.jabelarminecraft.magicbeans" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "magicbeans"

minecraft {
    version = "1.7.10-10.13.2.1277"
    runDir = "../run/assets"
}

dependencies {
    // 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

    // for more info...
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html

}

processResources
{
    // this will ensure that this task is redone when the versions change.
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    // replace stuff in mcmod.info, nothing else
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
                
        // replace version and mcversion
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }
        
    // copy everything else, thats not the mcmod.info
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

 

Here is en_us.lang file contents from Eclipse:

tile.magicbeanstalk.name=Magic Bean Stalk
tile.magicbeansvine.name=Magic Bean Vine
tile.magicbeanscloud.name=Cloud
item.magicbeans.name=Magic Beans
item.bootsofsafefalling.name=Boots of Safe Falling
entity.magicbeans.Giant.name=Giant

 

In the JAR the en_us.lang file seems to have same contents:

tile.magicbeanstalk.name=Magic Bean Stalk
tile.magicbeansvine.name=Magic Bean Vine
tile.magicbeanscloud.name=Cloud
item.magicbeans.name=Magic Beans
item.bootsofsafefalling.name=Boots of Safe Falling
entity.magicbeans.Giant.name=Giant

 

Maybe it is something about the way I specify the unlocalized names for the items.  One of the problematic items is instantiated in my main mod class like this:

    public final static ItemArmor bootsOfSafeFalling = (ItemArmor) new ItemArmor(ItemArmor.ArmorMaterial.CLOTH, 1, 3).setUnlocalizedName("bootsofsafefalling").setTextureName("minecraft:chainmail_boots");

 

And registered in my common proxy class like this:

        GameRegistry.registerItem(MagicBeans.bootsOfSafeFalling, "bootsOfSafeFalling");

 

What am I doing wrong? It's driving me crazy! Again, generally after exporting the JAR assets are working except for lang and mod logo, yet those files are in the JAR exactly where I expect them to be with same contents as Eclipse environment!

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Your language file should be name "en_US.lang" not "en_us.lang"

 

Yep, that was the problem.  Thanks!

 

I think I might have figured that out myself except that for some reason it works in Eclipse with the wrong name.  Does anyone have an explanation for that?  Why would en_us.lang work in Eclipse but only en_US.lang work in both Eclipse and JAR?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Windows' File System is case insensitive (en_us.lang and en_US.lang are the same file). Inside a jar file this is not applicable.

 

Thanks, I didn't know that!

 

By the way, for anyone who might find this thread later -- my second issue with the mod logo not working in JAR versus Eclipse had to do with the path I put the logo file in.  It should be put at same level as the mcmod.info itself (i.e. directly in resources folder, not in underlying assets folder).

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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