Closed jaymepechan closed 9 years ago
This is kind of problem is most likely to be solved on the MinecraftForge repo.
Do I only need to copy the one .jar file over to the mods directory for Minecraft or do I need something else to make it work? All the other mods work fine. and this works fine in the VM with VS.
Yes, when you want to use your mod outside of a development environment (for example, throw it in the mods folder of an existing modpack), you'll need to build a jar that can bind to the obfuscated version of Minecraft. Normal Minecraft is obfuscated so Blocks.dirt doesn't exist, and instead has an unintelligible field name of characters.
I haven't found a way to do that in the IDE yet (basically a release build), but you can run gradlew build
from the command line inside the directory of your project. The resulting jar will be placed in the build/libs directory and will be named according to the archivesBaseName
and version
properties inside your build.gradle file.
Thanks so much droidix! That was the missing link. Too bad they don't add a release build to the template that runs this. Seems like it would be easy enough. I appreciate the info though.
I compiled the template and it works fine in the emulator when pressing F5 but it throws exception when running it on regular Minecraft. I don't get why it doesn't work. I noted that if I comment out the 1 line of code that actually does something in the template, it does work just fine...
System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName());
I'm new to Minecraft development so it may be that I'm missing something obvious. Why wouldn't this template work in normal minecraft?
Thanks
---- Minecraft Crash Report ---- // Daisy, daisy...
Time: 5/19/15 12:32 PM Description: There was a severe problem during mod loading that has caused the game to fail
net.minecraftforge.fml.common.LoaderException: java.lang.NoSuchFieldError: dirt at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:163) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:709) at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:312) at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:491) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:325) at net.minecraft.client.main.Main.main(SourceFile:120) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.NoSuchFieldError: dirt at com.example.examplemod.ExampleMod.init(ExampleMod.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:707) ... 10 more
A detailed walkthrough of the error, its code path and all known details is as follows:
-- System Details -- Details: Minecraft Version: 1.8 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_25, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 124659264 bytes (118 MB) / 285126656 bytes (271 MB) up to 1060372480 bytes (1011 MB) JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.10 FML v8.99.4.1410 Minecraft Forge 11.14.1.1410 4 mods loaded, 4 mods active mcp{9.05} Minecraft Coder Pack Unloaded->Constructed->Pre-initialized->Initialized FML{8.99.4.1410} Forge Mod Loader Unloaded->Constructed->Pre-initialized->Initialized Forge{11.14.1.1410} Minecraft Forge Unloaded->Constructed->Pre-initialized->Initialized examplemod{1.0} Example Mod Unloaded->Constructed->Pre-initialized->Errored Loaded coremods (and transformers): GL info: ' Vendor: 'Intel' Version: '4.3.0 - Build 10.18.15.4204' Renderer: 'Intel(R) HD Graphics 5000'