Posted July 8, 201411 yr Caution: new to Minecraft modding. I've created a basic mod that works if I launch Minecraft through Eclipse, hurray. However, I'm lost for trying to package it up to put in my regular Minecraft installation or share with others. I tried File -> Export... -> Java-JAR -> and packaging up my .class files and the mcmod.info, and the structure inside the JAR file produced looks like (for instance) the one for ChickenShed, which works. But if I copy my JAR to my mod folder and run Minecraft, it barfs on loading with "Caused by: java.lang.NoSuchFieldError: wool" which is pretty basic... public void load(FMLInitializationEvent event) { proxy.registerRenderers(); ItemStack woolStack = new ItemStack(Blocks.wool); // dies here ItemStack stringStack = new ItemStack(Items.string ); // string ItemStack bigStringStack = new ItemStack(Items.string, 4 ); // 4 string GameRegistry.addShapelessRecipe(bigStringStack, woolStack); GameRegistry.addShapedRecipe(woolStack, "xx","xx", 'x', stringStack); } What do I need to do different in my mod to have it work outside the Forge/Gradle/Eclipse environment?
July 8, 201411 yr To package a mod, you should(if you have setup the build.gradle file correctly) just have to run "gradlew build" from the command line. I don't use Eclipse, so I don't know if the "Export as Jar" uses this command or not. I would run this just in case it doesn't. Hopefully this helps a bit. ~zombiepig333
July 8, 201411 yr Author Aha! THAT's what changed from the old tutorials! Simple idea too, and I'm a big fan of simple. For the curious bystander, it puts your built packages in \forge\build\classes\main\ and it makes your .jar in \forge\build\libs\ Buuut my JAR doesn't get registered as a mod. At least it doesn't make minecraft crash? It does look like gradlew didn't pick up my mcmod.info and possibly not even the @Mod info from my mod class, since it made a .jar called modid-1.0.jar and the mcmod.info in it was a blank file. I'll look at my build.gradlew - I probably haven't set it up right.
July 8, 201411 yr Author Yes, I use the default setup exactly as you described. I haven't done Java development in a decade, baring a brief excursion a few years ago, so I'm just not touching anything unless I have to and until I know what I'm doing. Code, I can handle; everything else (build management, for example...) not so much My objects and resource are D:\Games\forge-1.7.10-10.13.0.1170-src\src\main\resources\mcmod.info D:\Games\forge-1.7.10-10.13.0.1170-src\src\main\java\org\syndaryl\minecraft\simplestring\CommonProxy.java D:\Games\forge-1.7.10-10.13.0.1170-src\src\main\java\org\syndaryl\minecraft\simplestring\SimpleString.java D:\Games\forge-1.7.10-10.13.0.1170-src\src\main\java\org\syndaryl\minecraft\simplestring\client\ClientProxy.java and the two proxies are just the generic ones from the Forge Wiki tutorial by Havvy et al; since I just have two recipes in there, there's nothing to actually DO in either one, but I'll go mess with those later once I know how to actually make my mod go. My build.gradle is (now) 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.0.0" group= "org.syndaryl.minecraft.simplestring" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "[1.7.10]SyndarylSimpleString" minecraft { version = "1.7.10-10.13.0.1170" assetDir = "eclipse/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' } } my SimpleString.java is package org.syndaryl.minecraft.simplestring; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; // used in 1.6.2 //import cpw.mods.fml.common.Mod.PreInit; // used in 1.5.2 //import cpw.mods.fml.common.Mod.Init; // used in 1.5.2 //import cpw.mods.fml.common.Mod.PostInit; // used in 1.5.2 import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; //import cpw.mods.fml.common.network.NetworkMod; // not used in 1.7 @Mod(modid="SyndarylSimpleString", name="Simple String Mod", version="1.0.0") //@NetworkMod(clientSideRequired=true) // not used in 1.7 public class SimpleString { // The instance of your mod that Forge uses. @Instance(value = "SyndarylSimpleString") public static SimpleString instance; // Says where the client and server 'proxy' code is loaded. @SidedProxy(clientSide="syndaryl.minecraft.simplestring.client.ClientProxy", serverSide="syndaryl.minecraft.simplestring.CommonProxy") public static CommonProxy proxy; @EventHandler // used in 1.6.2 //@PreInit // used in 1.5.2 public void preInit(FMLPreInitializationEvent event) { // Stub Method } @EventHandler // used in 1.6.2 //@Init // used in 1.5.2 public void load(FMLInitializationEvent event) { proxy.registerRenderers(); ItemStack woolStack = new ItemStack(Blocks.wool); ItemStack stringStack = new ItemStack(Items.string ); // string ItemStack bigStringStack = new ItemStack(Items.string, 4 ); // 4 string GameRegistry.addShapelessRecipe(bigStringStack, woolStack); GameRegistry.addShapedRecipe(woolStack, "xx","xx", 'x', stringStack); } @EventHandler // used in 1.6.2 //@PostInit // used in 1.5.2 public void postInit(FMLPostInitializationEvent event) { // Stub Method } } And my mcmod.info is now [ { "modid": "SyndarylSimpleString", "name": "Simple String Mod", "description": "Create wool from string and vice versa.", "version": "${version}", "mcversion": "${mcversion}", "url": "", "updateUrl": "", "authorList": ["Syndaryl"], "credits": "The Forge and FML guys, for making this example", "logoFile": "", "screenshots": [], "dependencies": [] } ] Now, when I run "gradlew build" from D:\Games\forge-1.7.10-10.13.0.1170-src\ it makes D:\Games\forge-1.7.10-10.13.0.1170-src\build\libs\[1.7.10]SyndarylSimpleString-1.0.jar which looks coherent when I peek inside it and now it has my new mcmod.info, but it doesn't seem to do anything in Minecraft. At least it doesn't crash any more? I also tried manually zipping up the gradlew-produced class files and adding the mcmod.info by hand, as per the tutorial at http://www.minecraftforge.net/wiki/Releasing_Mods (as if the class files had been built by the MCP scripts instead) but no joy there, either. No crash, but no joy. EDIT: Oh hey. Of course after hitting send, I think I see something. I refactored my classes to a better namespace, and missed updating the @SidedProxy() - but the actual proxy objects DID go to the new namespace and so aren't where it's being told to look. I'm baffled why that doesn't generate errors, at build time or at run time, but LO AND BEHOLD it's in my mod list now! aaaand now Mincraft crashed again but it's not blaming me for once. ("Ticking memory connection"?)
July 8, 201411 yr Author Doesn't seem to be related to my mod, because when I shut down and restarted it didn't reproduce... but hey. This is my minecraft crash-report, where do I find the forge one? ---- Minecraft Crash Report ---- // Oops. Time: 08/07/14 12:22 PM Description: Ticking memory connection java.lang.NullPointerException: Ticking memory connection at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:101) at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:659) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:186) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at cpw.mods.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:101) at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@5d8a0e95 Stacktrace: at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:659) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:186) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_55, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 1477598752 bytes (1409 MB) / 1756889088 bytes (1675 MB) up to 7635730432 bytes (7282 MB) JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx8G AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 1, tcache: 18, allocated: 12, tallocated: 95 FML: MCP v9.05 FML v7.10.11.1170 Minecraft Forge 10.13.0.1170 Optifine OptiFine_1.7.10_HD_U_A4 14 mods loaded, 14 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.11.1170} [Forge Mod Loader] (forge-1.7.10-10.13.0.1170.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.0.1170} [Minecraft Forge] (forge-1.7.10-10.13.0.1170.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available CodeChickenCore{1.0.1.8} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available NotEnoughItems{1.0.2.15} [Not Enough Items] (NotEnoughItems-1.7.10-1.0.2.15-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available VeinMiner_coremod{${version}_build-${buildnumber}} [Core mod] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available bspkrsCore{6.13} [bspkrsCore] ([1.7.10]bspkrsCore-universal-6.13.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FloatingRuins{1.7.10.r01} [FloatingRuins] ([1.7.10]FloatingRuins-universal-1.7.10.r01.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SyndarylSimpleString{1.0.0} [simple String Mod] ([1.7.10]SyndarylSimpleString-1.0.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available ChickenShed{1.1.3} [Chicken Shed] ([1.7.2] ChickenShed (v1.1.3).jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available BiomesOPlenty{2.0.2} [biomes O' Plenty] (BiomesOPlenty-1.7.10-2.0.2.897-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available VeinMiner{0.16.1} [Vein Miner] (VeinMiner-1.7.10_0.16.1.15.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available VeinMinerModSupport{0.16.1} [Mod Support] (VeinMiner-1.7.10_0.16.1.15.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available YAFM{1.0.3} [Yet Another Food Mod] (yafm-1.0.3.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Syndaryl'/156, l='Copy of Forge Experimental', x=292.16, y=108.00, z=1010.45]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge'
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.