Jump to content

Error AL lib: (EE) alc_cleanup: 1 device not closed


jewell012

Recommended Posts

I don't know whats wrong, no error shown in eclipse, I have looked up this problem and it seems to be between duplicates or something wrong with constructed but I cant find anything.

 

[14:31:27] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker

[14:31:27] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker

[14:31:27] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker

[14:31:28] [main/INFO] [FML]: Forge Mod Loader version 7.2.217.1147 for Minecraft 1.7.2 loading

[14:31:28] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.7.0_71, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

[14:31:28] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[14:31:28] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[14:31:28] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker

[14:31:28] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[14:31:28] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[14:31:28] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper

[14:31:28] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[14:31:31] [main/ERROR] [FML]: The minecraft jar file:/C:/Users/Chris/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.2.1147/forgeSrc-1.7.2-10.12.2.1147.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again!

[14:31:31] [main/ERROR] [FML]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem!

[14:31:31] [main/ERROR] [FML]: Technical information: ClientBrandRetriever was at jar:file:/C:/Users/Chris/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.2.1147/forgeSrc-1.7.2-10.12.2.1147.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it

[14:31:31] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing

[14:31:31] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper

[14:31:31] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker

[14:31:33] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

[14:31:35] [main/INFO]: Setting user: Player365

[14:31:39] [Client thread/INFO]: LWJGL Version: 2.9.0

[14:31:39] [Client thread/ERROR]: Couldn't set icon

javax.imageio.IIOException: Can't read input file!

at javax.imageio.ImageIO.read(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.client.Minecraft.readImage(Minecraft.java:629) ~[Minecraft.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:458) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:880) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

[14:31:43] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization

[14:31:43] [Client thread/INFO] [FML]: MinecraftForge v10.12.2.1147 Initialized

[14:31:43] [Client thread/INFO] [FML]: Replaced 182 ore recipies

[14:31:43] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization

[14:31:44] [Client thread/INFO] [FML]: Searching C:\Users\Chris\Desktop\MTD\eclipse\mods for mods

[14:31:48] [Client thread/ERROR] [FML]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error.  There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW!

[14:31:54] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[14:31:55] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Phantasy realms

[14:31:55] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[14:31:55] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations

[14:31:55] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

[14:31:56] [Client thread/INFO] [FML]: Applying holder lookups

[14:31:56] [Client thread/INFO] [FML]: Holder lookups applied

 

Starting up SoundSystem...

Initializing LWJGL OpenAL

    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

OpenAL initialized.

 

[14:31:58] [sound Library Loader/INFO]: Sound engine started

[14:31:59] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

[14:31:59] [Client thread/INFO]: Created: 512x512 textures/items-atlas

[14:31:59] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue

[14:31:59] [Client thread/ERROR] [FML]:

mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

FML{7.2.217.1147} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized

Forge{10.12.2.1147} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized

pr{0.01 ALPHA} [Phantasy realms] (bin) Unloaded->Constructed->Pre-initialized->Errored

[14:31:59] [Client thread/ERROR] [FML]: The following problems were captured during this phase

[14:31:59] [Client thread/ERROR] [FML]: Caught exception from pr

java.lang.NullPointerException

at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217) ~[NetworkRegistry.class:?]

at com.phantasyrealms.main.MainRegistry.load(MainRegistry.java:100) ~[MainRegistry.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?]

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?]

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?]

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) ~[guava-15.0.jar:?]

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) ~[guava-15.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:267) ~[guava-15.0.jar:?]

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:690) [Loader.class:?]

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:573) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:880) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

---- Minecraft Crash Report ----

// I'm sorry, Dave.

 

Time: 1/8/15 2:31 PM

Description: Initializing game

 

java.lang.NullPointerException: Initializing game

at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)

at com.phantasyrealms.main.MainRegistry.load(MainRegistry.java:100)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:690)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:573)

at net.minecraft.client.Minecraft.run(Minecraft.java:880)

at net.minecraft.client.main.Main.main(Main.java:112)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

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

 

-- Head --

Stacktrace:

at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)

at com.phantasyrealms.main.MainRegistry.load(MainRegistry.java:100)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:690)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:573)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:880)

at net.minecraft.client.main.Main.main(Main.java:112)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_71, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 975985056 bytes (930 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.03 FML v7.2.217.1147 Minecraft Forge 10.12.2.1147 4 mods loaded, 4 mods active

mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

FML{7.2.217.1147} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized

Forge{10.12.2.1147} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized

pr{0.01 ALPHA} [Phantasy realms] (bin) Unloaded->Constructed->Pre-initialized->Errored

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: GeForce 9800 GTX+/PCIe/SSE2 GL version 3.3.0, NVIDIA Corporation

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: ~~ERROR~~ NullPointerException: null

Profiler Position: N/A (disabled)

Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

Anisotropic Filtering: Off (1)

#@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Chris\Desktop\MTD\eclipse\.\crash-reports\crash-2015-01-08_14.31.59-client.txt

AL lib: (EE) alc_cleanup: 1 device not closed

 

Link to comment
Share on other sites

First of all, please update to 1.7.10.

 

And we can't help you without seeing your code.

 

[15:21:32] [main/INFO] [GradleStart]: Extra: []
[15:21:32] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --accessToken, {REDACTED}, --assetIndex, 1.7.10, --assetsDir, C:/Users/Chris/.gradle/caches/minecraft/assets, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker]
[15:21:32] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[15:21:32] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[15:21:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[15:21:32] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
[15:21:32] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1277 for Minecraft 1.7.10 loading
[15:21:32] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_71, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7
[15:21:32] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[15:21:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[15:21:32] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin
[15:21:32] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[15:21:32] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[15:21:32] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
[15:21:32] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[15:21:32] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[15:21:32] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
[15:21:33] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[15:21:36] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[15:21:36] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
[15:21:36] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
[15:21:38] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker
[15:21:38] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker
[15:21:38] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[15:21:43] [main/INFO]: Setting user: Player168
[15:21:46] [Client thread/INFO]: LWJGL Version: 2.9.1
[15:21:51] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
[15:21:51] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1277 Initialized
[15:21:51] [Client thread/INFO] [FML]: Replaced 183 ore recipies
[15:21:51] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
[15:21:51] [Client thread/INFO] [FML]: Config directory created successfully
[15:21:52] [Client thread/INFO] [FML]: Searching C:\Users\Chris\Desktop\MTD\eclipse\mods for mods
[15:22:02] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
[15:22:03] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, pr] at CLIENT
[15:22:03] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, pr] at SERVER
[15:22:04] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Phantasy realms
[15:22:04] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
[15:22:04] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations
[15:22:04] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[15:22:05] [Client thread/INFO] [FML]: Applying holder lookups
[15:22:05] [Client thread/INFO] [FML]: Holder lookups applied
[15:22:06] [sound Library Loader/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
[15:22:06] [sound Library Loader/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem...
[15:22:06] [Thread-5/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL
[15:22:06] [Thread-5/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[15:22:08] [Thread-5/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized.
[15:22:08] [sound Library Loader/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
[15:22:08] [sound Library Loader/INFO]: Sound engine started
[15:22:13] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
[15:22:14] [Client thread/INFO]: Created: 512x512 textures/items-atlas
[15:22:14] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
[15:22:14] [Client thread/ERROR] [FML]: 
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML{7.10.85.1277} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1277.jar) Unloaded->Constructed->Pre-initialized->Initialized
Forge{10.13.2.1277} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1277.jar) Unloaded->Constructed->Pre-initialized->Initialized
pr{0.01 ALPHA} [Phantasy realms] (bin) Unloaded->Constructed->Pre-initialized->Errored
[15:22:14] [Client thread/ERROR] [FML]: The following problems were captured during this phase
[15:22:14] [Client thread/ERROR] [FML]: Caught exception from pr
java.lang.NullPointerException
at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217) ~[forgeSrc-1.7.10-10.13.2.1277.jar:?]
at com.phantasyrealms.main.MainRegistry.load(MainRegistry.java:100) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forgeSrc-1.7.10-10.13.2.1277.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[forgeSrc-1.7.10-10.13.2.1277.jar:?]
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forgeSrc-1.7.10-10.13.2.1277.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691) [Loader.class:?]
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]
[15:22:14] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// My bad.

Time: 1/8/15 3:22 PM
Description: Initializing game

java.lang.NullPointerException: Initializing game
at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)
at com.phantasyrealms.main.MainRegistry.load(MainRegistry.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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 cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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 cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:586)
at net.minecraft.client.Minecraft.run(Minecraft.java:931)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)
at com.phantasyrealms.main.MainRegistry.load(MainRegistry.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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 cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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 cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:586)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:931)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_71, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 908883072 bytes (866 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.85.1277 Minecraft Forge 10.13.2.1277 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML{7.10.85.1277} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1277.jar) Unloaded->Constructed->Pre-initialized->Initialized
Forge{10.13.2.1277} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1277.jar) Unloaded->Constructed->Pre-initialized->Initialized
pr{0.01 ALPHA} [Phantasy realms] (bin) Unloaded->Constructed->Pre-initialized->Errored
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: GeForce 9800 GTX+/PCIe/SSE2 GL version 3.3.0, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
[15:22:14] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Chris\Desktop\MTD\eclipse\.\crash-reports\crash-2015-01-08_15.22.14-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed

 

I updated and does the error log say anything?

Link to comment
Share on other sites

java.lang.NullPointerException: Initializing game

at cpw.mods.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:217)

at com.phantasyrealms.main.MainRegistry.load(MainRegistry.java:100)

 

A shot in the dark: the variable you are using at line 100 in MainRegistry.load isn't being defined before attempting to register it as a Gui handler.

Link to comment
Share on other sites

Reading helps:

And we can't help you without seeing your code.

I dont know which class you specifically need to see... But here is everything

Main Registry

package com.phantasyrealms.main;


import java.io.File;

import org.apache.logging.log4j.LogManager;


import org.apache.logging.log4j.Logger;

import sun.net.NetworkServer;
import sun.security.krb5.Config;
import net.minecraftforge.common.MinecraftForge;

import com.phantasyrealms.entity.EntityBoomaMob;
import com.phantasyrealms.entity.PhantasyRealmsEntity;
import com.phantasyrealms.eventhandler.EventHandlerEntity;
import com.phantasyrealms.eventhandler.EventHandlerNetwork;
import com.phantasyrealms.item.PhantasyRealmsItems;
import com.phantasyrealms.lib.Strings;
import com.phantasyrealms.packethandling.PacketHandler;









import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.eventhandler.Event;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;

@Mod(modid = Strings.MODID, name = Strings.name, version = Strings.version)

public class MainRegistry {

public static final int GUI = 0;


@SidedProxy(clientSide = "com.phantasyrealms.main.ClientProxy", serverSide = "com.phantasyrealms.main.ServerProxy")
public static ServerProxy proxy;


@Instance(Strings.MODID)
public static MainRegistry modInstance;
public static Object instance;
public static File modDir;
public static EventHandlerEntity entityEventHandler;
public static EventHandlerNetwork entityEventNetwork;



public class RegisterKeyBindings
{

}

/**
 * Loads before
 * @param PostEvent
 */

@EventHandler
public static void PreLoad(FMLPreInitializationEvent PreEvent){
	PhantasyRealmsEntity.mainRegistry();
	proxy.registerRenderThings();
	PhantasyRealmsItems.mainRegistry();
	CraftingManager.mainRegistry();
	modDir = PreEvent.getModConfigurationDirectory();

	entityEventHandler = new EventHandlerEntity();
	entityEventNetwork = new EventHandlerNetwork();	
	MinecraftForge.EVENT_BUS.register(entityEventHandler);
	FMLCommonHandler.instance().bus().register(entityEventNetwork);
	PacketHandler.init();


}



/**
 * Loads during
 * @param event
 */
@EventHandler
public static void load(FMLInitializationEvent event){

	NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);


}

/**
 * Loads after
 * @param PostEvent
 */
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent){

}

}

 

ClientProxy

package com.phantasyrealms.main;

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelCreeper;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.storage.WorldInfo;

import com.phantasyrealms.entity.EntityBoomaMob;
import com.phantasyrealms.entity.EntityEvilSharkMob;
import com.phantasyrealms.entity.EntityGoBoomaMob;
import com.phantasyrealms.entity.EntityRagRappyMob;
import com.phantasyrealms.entity.EntityRappyMob;
import com.phantasyrealms.model.ModelBoomaMob;
import com.phantasyrealms.model.ModelEvilSharkMob;
import com.phantasyrealms.model.ModelGoBoomaMob;
import com.phantasyrealms.model.ModelRagRappyMob;
import com.phantasyrealms.model.ModelRappyMob;
import com.phantasyrealms.render.RenderBoomaMob;
import com.phantasyrealms.render.RenderEvilSharkMob;
import com.phantasyrealms.render.RenderGoBoomaMob;
import com.phantasyrealms.render.RenderRagRappyMob;
import com.phantasyrealms.render.RenderRappyMob;

import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;

public class ClientProxy extends ServerProxy{

public void registerRenderThings(){

	RenderingRegistry.registerEntityRenderingHandler(EntityGoBoomaMob.class, new RenderGoBoomaMob(new ModelGoBoomaMob(), 0));
	RenderingRegistry.registerEntityRenderingHandler(EntityBoomaMob.class, new RenderBoomaMob(new ModelBoomaMob(), 0));
	RenderingRegistry.registerEntityRenderingHandler(EntityRappyMob.class, new RenderRappyMob(new ModelRappyMob(), 0));
	RenderingRegistry.registerEntityRenderingHandler(EntityRagRappyMob.class, new RenderRagRappyMob(new ModelRagRappyMob(), 0));
	RenderingRegistry.registerEntityRenderingHandler(EntityEvilSharkMob.class, new RenderEvilSharkMob(new ModelEvilSharkMob(), 0));


}

// In your client proxy:
@Override
public EntityPlayer getPlayerEntity(MessageContext ctx) {
 // Note that if you simply return 'Minecraft.getMinecraft().thePlayer',
 // your packets will not work because you will be getting a client
 // player even when you are on the server! Sounds absurd, but it's true.

 // Solution is to double-check side before returning the player:
 return (ctx.side.isClient() ? Minecraft.getMinecraft().thePlayer : super.getPlayerEntity(ctx));
}


public int addArmor(String armor){
	return RenderingRegistry.addNewArmourRendererPrefix(armor);
}




}

 

ServerProxy

package com.phantasyrealms.main;


import com.phantasyrealms.eventhandler.KeyHandler;
import com.phantasyrealms.inventory.InventoryPR;

import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.storage.WorldInfo;


public class ServerProxy implements IGuiHandler {
public KeyHandler keyHandler;

public void registerHandlers() {}

public void registerRenderThings(){


}

 // In your server proxy (mine is named CommonProxy):
/**
 * Returns a side-appropriate EntityPlayer for use during message handling
 */
public EntityPlayer getPlayerEntity(MessageContext ctx) {
 return ctx.getServerHandler().playerEntity;
}



public int addArmor(String armor){
	return 0;
}

public static NBTTagCompound getEntityData(String saveKey) {
	// TODO Auto-generated method stub
	return null;
}


public void registerRenderers() {
	// TODO Auto-generated method stub

}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	return null;
}

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	switch (ID) {
		case MainRegistry.GUI: return new InventoryPR(player);
	}
	return null;
}

public Object getClientWorld() {
	// TODO Auto-generated method stub
	return null;
}







}

 

PlayerHandler

package com.phantasyrealms.lib;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.HashMap;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;

import com.google.common.io.Files;
import com.phantasyrealms.inventory.InventoryPR;

public class PlayerHandler {

private static HashMap<String, InventoryPR> playerPR = new HashMap<String, InventoryPR>();

public static void clearPlayerPR(EntityPlayer player) {
	playerPR.remove(player.getDisplayName());
}

public static InventoryPR getPlayerPR(EntityPlayer player) {
	if (!playerPR.containsKey(player.getDisplayName())) {
		InventoryPR inventory = new InventoryPR(player);
		playerPR.put(player.getDisplayName(), inventory);
	}
	return playerPR.get(player.getDisplayName());
}

public static void setPlayerPR(EntityPlayer player,
		InventoryPR inventory) {
	playerPR.put(player.getDisplayName(), inventory);
}

public static void loadPlayerPR(EntityPlayer player, File file1, File file2) {
	if (player != null && !player.worldObj.isRemote) {
		try {
			NBTTagCompound data = null;
			boolean save = false;
			if (file1 != null && file1.exists()) {
				try {
					FileInputStream fileinputstream = new FileInputStream(
							file1);
					data = CompressedStreamTools
							.readCompressed(fileinputstream);
					fileinputstream.close();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}

			if (file1 == null || !file1.exists() || data == null
					|| data.hasNoTags()) {
				if (file2 != null && file2.exists()) {
					try {
						FileInputStream fileinputstream = new FileInputStream(
								file2);
						data = CompressedStreamTools
								.readCompressed(fileinputstream);
						fileinputstream.close();
						save = true;
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}

			if (data != null) {
				InventoryPR inventory = new InventoryPR(player);
				inventory.readNBT(data);
				playerPR.put(player.getDisplayName(), inventory);
				if (save)
					savePlayerPR(player, file1, file2);
			}
		} catch (Exception exception1) {

			exception1.printStackTrace();
		}
	}
}

public static void savePlayerPR(EntityPlayer player, File file1, File file2) {
	if (player != null && !player.worldObj.isRemote) {
		try {
			if (file1 != null && file1.exists()) {
				try {
					Files.copy(file1, file2);
				} catch (Exception e) {
				}
			}

			try {
				if (file1 != null) {
					InventoryPR inventory = getPlayerPR(player);
					NBTTagCompound data = new NBTTagCompound();
					inventory.saveNBT(data);

					FileOutputStream fileoutputstream = new FileOutputStream(
							file1);
					CompressedStreamTools.writeCompressed(data,
							fileoutputstream);
					fileoutputstream.close();

				}
			} catch (Exception e) {
				e.printStackTrace();
				if (file1.exists()) {
					try {
						file1.delete();
					} catch (Exception e2) {
					}
				}
			}
		} catch (Exception exception1) {;
			exception1.printStackTrace();
		}
	}
}
}

 

PacketHandler

package com.phantasyrealms.packethandling;

import java.io.IOException;

import net.minecraft.entity.player.EntityPlayer;

import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import com.jcraft.jogg.Packet;
import com.phantasyrealms.lib.Strings;

import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;



public class PacketHandler
{
    public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Strings.MODID.toLowerCase());

    public static void init()
    {
        INSTANCE.registerMessage(PacketOpenPRInventory.class, PacketOpenPRInventory.class, 0, Side.SERVER);
        INSTANCE.registerMessage(PacketOpenNormalInventory.class, PacketOpenNormalInventory.class, 1, Side.SERVER);
        INSTANCE.registerMessage(PacketSyncPR.class, PacketSyncPR.class, 2, Side.CLIENT);
    }
    
    
}

 

PacketOpenNormalInventory

package com.phantasyrealms.packethandling;

import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;

public class PacketOpenNormalInventory implements IMessage, IMessageHandler<PacketOpenNormalInventory, IMessage> {

public PacketOpenNormalInventory() {}

public PacketOpenNormalInventory(EntityPlayer player) {}

@Override
public void toBytes(ByteBuf buffer) {}

@Override
public void fromBytes(ByteBuf buffer) {}

@Override
public IMessage onMessage(PacketOpenNormalInventory message, MessageContext ctx) {
	ctx.getServerHandler().playerEntity.openContainer.onContainerClosed(ctx.getServerHandler().playerEntity);		
	ctx.getServerHandler().playerEntity.openContainer = ctx.getServerHandler().playerEntity.inventoryContainer;
	return null;
}


}

 

PacketOpenPRInventory

package com.phantasyrealms.packethandling;

import com.phantasyrealms.main.MainRegistry;

import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;

public class PacketOpenPRInventory implements IMessage, IMessageHandler<PacketOpenPRInventory, IMessage> {

public PacketOpenPRInventory() {}

public PacketOpenPRInventory(EntityPlayer player) {}

@Override
public void toBytes(ByteBuf buffer) {}

@Override
public void fromBytes(ByteBuf buffer) {}

@Override
public IMessage onMessage(PacketOpenPRInventory message, MessageContext ctx) {
	ctx.getServerHandler().playerEntity.openGui(MainRegistry.instance, MainRegistry.GUI, ctx.getServerHandler().playerEntity.worldObj, (int)ctx.getServerHandler().playerEntity.posX, (int)ctx.getServerHandler().playerEntity.posY, (int)ctx.getServerHandler().playerEntity.posZ);
	return null;
}


}

 

PacketSyncPR

package com.phantasyrealms.packethandling;

import io.netty.buffer.ByteBuf;

import java.io.IOException;

import com.phantasyrealms.lib.PlayerHandler;
import com.phantasyrealms.main.MainRegistry;

import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.world.World;

public class PacketSyncPR implements IMessage, IMessageHandler<PacketSyncPR, IMessage> {

int slot;
int playerId;
ItemStack pr=null;

public PacketSyncPR() {}

public PacketSyncPR(EntityPlayer player, int slot) {
	this.slot = slot;
	this.pr = PlayerHandler.getPlayerPR(player).getStackInSlot(slot);
	this.playerId = player.getEntityId();
}

@Override
public void toBytes(ByteBuf buffer) {
	buffer.writeByte(slot);
	buffer.writeInt(playerId);
	ByteBufUtils.writeItemStack(buffer, pr);
}

@Override
public void fromBytes(ByteBuf buffer) 
{
	slot = buffer.readByte();
	playerId = buffer.readInt();
	pr = ByteBufUtils.readItemStack(buffer);
}

@Override
public IMessage onMessage(PacketSyncPR message, MessageContext ctx) {
	World world = (World) MainRegistry.proxy.getClientWorld();
	if (world==null) return null;
	Entity p = world.getEntityByID(message.playerId);
	if (p !=null && p instanceof EntityPlayer) {
		PlayerHandler.getPlayerPR((EntityPlayer) p).stackList[message.slot]=message.pr;
	}
	return null;
}


}

 

ContainerPlayerExpanded

package com.phantasyrealms.inventory;

import com.phantasyrealms.lib.PlayerHandler;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;

public class ContainerPlayerExpanded extends Container
{
    /**
     * The crafting matrix inventory.
     */
    public InventoryCrafting craftMatrix = new InventoryCrafting(this, 2, 2);
    public IInventory craftResult = new InventoryCraftResult();
    public InventoryPR pr;
    /**
     * Determines if inventory manipulation should be handled.
     */
    public boolean isLocalWorld;
    private final EntityPlayer thePlayer;

    public ContainerPlayerExpanded(InventoryPlayer playerInv, boolean par2, EntityPlayer player)
    {
        this.isLocalWorld = par2;
        this.thePlayer = player;
        pr = new InventoryPR(player);
        pr.setEventHandler(this);
        if (!player.worldObj.isRemote) {
        	pr.stackList = PlayerHandler.getPlayerPR(player).stackList;
        }
        
        this.addSlotToContainer(new SlotCrafting(playerInv.player, this.craftMatrix, this.craftResult, 0, 144, 36));
        int i;
        int j;

        for (i = 0; i < 2; ++i)
        {
            for (j = 0; j < 2; ++j)
            {
                this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 2, 106 + j * 18, 26 + i * 18));
            }
        }

        for (i = 0; i < 4; ++i)
        {
            final int k = i;
            this.addSlotToContainer(new Slot(playerInv, playerInv.getSizeInventory() - 1 - i, 8, 8 + i * 18)
            {
                @Override
                public int getSlotStackLimit() { return 1; }
                @Override
                public boolean isItemValid(ItemStack par1ItemStack)
                {
                    if (par1ItemStack == null) return false;
                    return par1ItemStack.getItem().isValidArmor(par1ItemStack, k, thePlayer);
                }
            });
        }
        
        this.addSlotToContainer(new SlotMag(pr,PRType.MAG,0,80,8 + 0 * 18));


        for (i = 0; i < 3; ++i)
        {
            for (j = 0; j < 9; ++j)
            {
                this.addSlotToContainer(new Slot(playerInv, j + (i + 1) * 9, 8 + j * 18, 84 + i * 18));
            }
        }

        for (i = 0; i < 9; ++i)
        {
            this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
        }

        this.onCraftMatrixChanged(this.craftMatrix);
        
    }

    /**
     * Callback for when the crafting matrix is changed.
     */
    @Override
    public void onCraftMatrixChanged(IInventory par1IInventory)
    {
        this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.thePlayer.worldObj));
    }

    /**
     * Called when the container is closed.
     */
    @Override
    public void onContainerClosed(EntityPlayer player)
    {
        super.onContainerClosed(player);
        for (int i = 0; i < 4; ++i)
        {
            ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

            if (itemstack != null)
            {
                player.dropPlayerItemWithRandomChoice(itemstack, false);
            }
        }

        this.craftResult.setInventorySlotContents(0, (ItemStack)null);
        if (!player.worldObj.isRemote) {
        	PlayerHandler.setPlayerPR(player, pr);
        }
    }

    @Override
    public boolean canInteractWith(EntityPlayer par1EntityPlayer)
    {
        return true;
    }

    /**
     * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
     */
    @Override
    public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
    {
        ItemStack itemstack = null;
        Slot slot = (Slot)this.inventorySlots.get(par2);

        if (slot != null && slot.getHasStack())
        {
            ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();

            if (par2 == 0)
            {
                if (!this.mergeItemStack(itemstack1, 9+4, 45+4, true))
                {
                    return null;
                }

                slot.onSlotChange(itemstack1, itemstack);
            }
            else if (par2 >= 1 && par2 < 5)
            {
                if (!this.mergeItemStack(itemstack1, 9+4, 45+4, false))
                {
                    return null;
                }
            }
            else if (par2 >= 5 && par2 < 9)
            {
                if (!this.mergeItemStack(itemstack1, 9+4, 45+4, false))
                {
                    return null;
                }
            }
            else if (itemstack.getItem() instanceof ItemArmor && 
            		!((Slot)this.inventorySlots.get(5 + ((ItemArmor)itemstack.getItem()).armorType)).getHasStack())
            {
                int j = 5 + ((ItemArmor)itemstack.getItem()).armorType;

                if (!this.mergeItemStack(itemstack1, j, j + 1, false))
                {
                    return null;
                }
            }
            else if (itemstack.getItem() instanceof IPR && 
            		((IPR)itemstack.getItem()).getPRType(itemstack)==PRType.MAG &&
    				((IPR)itemstack.getItem()).canEquip(itemstack, thePlayer) &&
            		!((Slot)this.inventorySlots.get(9)).getHasStack())
            {
                int j = 9;
                if (!this.mergeItemStack(itemstack1, j, j + 1, false))
                {
                    return null;
                }
            }
            else if (par2 >= 9+4 && par2 < 36+4)
            {
                if (!this.mergeItemStack(itemstack1, 36+4, 45+4, false))
                {
                    return null;
                }
            }
            else if (par2 >= 36+4 && par2 < 45+4)
            {
                if (!this.mergeItemStack(itemstack1, 9+4, 36+4, false))
                {
                    return null;
                }
            }
            else if (!this.mergeItemStack(itemstack1, 9+4, 45+4, false, slot))
            {
                return null;
            }

            if (itemstack1.stackSize == 0)
            {
                slot.putStack((ItemStack)null);
            }
            else
            {
                slot.onSlotChanged();
            }

            if (itemstack1.stackSize == itemstack.stackSize)
            {
                return null;
            }

            slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
        }

        return itemstack;
    }
    
    private void unequippr(ItemStack stack) {
//    	if (stack.getItem() instanceof IBauble) {
//    		((IBauble)stack.getItem()).onUnequipped(stack, thePlayer);
//    	}
    }
    
    
    
    @Override
public void putStacksInSlots(ItemStack[] p_75131_1_) {
	pr.blockEvents=true;
	super.putStacksInSlots(p_75131_1_);
}
    
    
    

protected boolean mergeItemStack(ItemStack par1ItemStack, int par2, int par3, boolean par4, Slot ss)
    {
        boolean flag1 = false;
        int k = par2;

        if (par4)
        {
            k = par3 - 1;
        }

        Slot slot;
        ItemStack itemstack1;

        if (par1ItemStack.isStackable())
        {
            while (par1ItemStack.stackSize > 0 && (!par4 && k < par3 || par4 && k >= par2))
            {
                slot = (Slot)this.inventorySlots.get(k);
                itemstack1 = slot.getStack();

                if (itemstack1 != null && itemstack1.getItem() == par1ItemStack.getItem() && (!par1ItemStack.getHasSubtypes() || par1ItemStack.getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(par1ItemStack, itemstack1))
                {
                    int l = itemstack1.stackSize + par1ItemStack.stackSize;
                    if (l <= par1ItemStack.getMaxStackSize())
                    {
                    	if (ss instanceof SlotMag) unequippr(par1ItemStack);
                    	par1ItemStack.stackSize = 0;
                        itemstack1.stackSize = l;
                        slot.onSlotChanged();
                        flag1 = true;
                    }
                    else if (itemstack1.stackSize < par1ItemStack.getMaxStackSize())
                    {
                    	if (ss instanceof SlotMag) unequippr(par1ItemStack);
                        par1ItemStack.stackSize -= par1ItemStack.getMaxStackSize() - itemstack1.stackSize;
                        itemstack1.stackSize = par1ItemStack.getMaxStackSize();
                        slot.onSlotChanged();
                        flag1 = true;
                    }
                }

                if (par4)
                {
                    --k;
                }
                else
                {
                    ++k;
                }
            }
        }

        if (par1ItemStack.stackSize > 0)
        {
            if (par4)
            {
                k = par3 - 1;
            }
            else
            {
                k = par2;
            }

            while (!par4 && k < par3 || par4 && k >= par2)
            {
                slot = (Slot)this.inventorySlots.get(k);
                itemstack1 = slot.getStack();

                if (itemstack1 == null)
                {
                	if (ss instanceof SlotMag) unequippr(par1ItemStack);
                    slot.putStack(par1ItemStack.copy());
                    slot.onSlotChanged();
                    par1ItemStack.stackSize = 0;
                    flag1 = true;
                    break;
                }

                if (par4)
                {
                    --k;
                }
                else
                {
                    ++k;
                }
            }
        }
        return flag1;
    }

    public boolean canMergeSlot(ItemStack par1ItemStack, Slot par2Slot)
    {
        return par2Slot.inventory != this.craftResult && super.canDragIntoSlot(par2Slot);
    }

}

 

InventoryPR

package com.phantasyrealms.inventory;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;

import com.phantasyrealms.main.MainRegistry;
import com.phantasyrealms.packethandling.PacketSyncPR;

import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.MathHelper;


public class InventoryPR implements IInventory {
public ItemStack[] stackList;
private Container eventHandler;
public WeakReference<EntityPlayer> player;
public boolean blockEvents=false;

public InventoryPR(EntityPlayer player) {
	this.stackList = new ItemStack[4];
	this.player = new WeakReference<EntityPlayer>(player);
}

public Container getEventHandler() {
	return eventHandler;
}

public void setEventHandler(Container eventHandler) {
	this.eventHandler = eventHandler;
}

/**
 * Returns the number of slots in the inventory.
 */
@Override
public int getSizeInventory() {
	return this.stackList.length;
}

/**
 * Returns the stack in slot i
 */
@Override
public ItemStack getStackInSlot(int par1) {
	return par1 >= this.getSizeInventory() ? null : this.stackList[par1];
}

/**
 * Returns the name of the inventory
 */
@Override
public String getInventoryName()
{
	return null;
}

/**
 * Returns if the inventory is named
 */
@Override
public boolean hasCustomInventoryName() {
	return false;
}

public IChatComponent getDisplayName() {
	return null;
}

/**
 * When some containers are closed they call this on each slot, then drop
 * whatever it returns as an EntityItem - like when you close a workbench
 * GUI.
 */
@Override
public ItemStack getStackInSlotOnClosing(int par1) {
	if (this.stackList[par1] != null) {
		ItemStack itemstack = this.stackList[par1];
		this.stackList[par1] = null;
		return itemstack;
	} else {
		return null;
	}
}

/**
 * Removes from an inventory slot (first arg) up to a specified number
 * (second arg) of items and returns them in a new stack.
 */
@Override
public ItemStack decrStackSize(int par1, int par2) {
	if (this.stackList[par1] != null) {
		ItemStack itemstack;

		if (this.stackList[par1].stackSize <= par2) {
			itemstack = this.stackList[par1];

			if (itemstack != null && itemstack.getItem() instanceof IPR) {
				((IPR) itemstack.getItem()).onUnequipped(itemstack,
						player.get());
			}

			this.stackList[par1] = null;

			if (eventHandler != null)
				this.eventHandler.onCraftMatrixChanged(this);
			syncSlotToClients(par1);
			return itemstack;
		} else {
			itemstack = this.stackList[par1].splitStack(par2);

			if (itemstack != null && itemstack.getItem() instanceof IPR) {
				((IPR) itemstack.getItem()).onUnequipped(itemstack,
						player.get());
			}

			if (this.stackList[par1].stackSize == 0) {
				this.stackList[par1] = null;
			}

			if (eventHandler != null)
				this.eventHandler.onCraftMatrixChanged(this);
			syncSlotToClients(par1);
			return itemstack;
		}
	} else {
		return null;
	}
}

/**
 * Sets the given item stack to the specified slot in the inventory (can be
 * crafting or armor sections).
 */
@Override
public void setInventorySlotContents(int par1, ItemStack stack) {

	if(!blockEvents && this.stackList[par1] != null) {
        	    ((IPR)stackList[par1].getItem()).onUnequipped(stackList[par1], player.get());
	}
	this.stackList[par1] = stack;
	if (!blockEvents && stack != null && stack.getItem() instanceof IPR) {
		((IPR) stack.getItem()).onEquipped(stack, player.get());
	}
	if (eventHandler != null)
		this.eventHandler.onCraftMatrixChanged(this);
	syncSlotToClients(par1);
}

/**
 * Returns the maximum stack size for a inventory slot.
 */
@Override
public int getInventoryStackLimit() {
	return 1;
}

/**
 * For tile entities, ensures the chunk containing the tile entity is saved
 * to disk later - the game won't think it hasn't changed and skip it.
 */
@Override
public void markDirty() {
	try {
		player.get().inventory.markDirty();
	} catch (Exception e) {
	}
}

/**
 * Do not make give this method the name canInteractWith because it clashes
 * with Container
 */
@Override
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) {
	return true;
}

@Override
public void openInventory() {

}

@Override
public void closeInventory() {

}

/**
 * Returns true if automation is allowed to insert the given stack (ignoring
 * stack size) into the given slot.
 */
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
	if (stack == null || !(stack.getItem() instanceof IPR)
			|| !((IPR) stack.getItem()).canEquip(stack, player.get()))
		return false;
	if (i == 0
			&& ((IPR) stack.getItem()).getPRType(stack) == PRType.MAG)
		return true;
	return false;
}

public int getField(int id) {
	return 0;
}

public void setField(int id, int value) {

}

public int getFieldCount() {
	return 0;
}

public void clear() {
	for(int i = 0; i < stackList.length; i++) {
		stackList[i] = null;
	}
}

public void saveNBT(EntityPlayer player) {
	NBTTagCompound tags = player.getEntityData();
	saveNBT(tags);
}

public void saveNBT(NBTTagCompound tags) {
	NBTTagList tagList = new NBTTagList();
	NBTTagCompound invSlot;
	for (int i = 0; i < this.stackList.length; ++i) {
		if (this.stackList[i] != null) {
			invSlot = new NBTTagCompound();
			invSlot.setByte("Slot", (byte) i);
			this.stackList[i].writeToNBT(invSlot);
			tagList.appendTag(invSlot);
		}
	}
	tags.setTag("PR.Inventory", tagList);
}

public void readNBT(EntityPlayer player) {
	NBTTagCompound tags = player.getEntityData();
	readNBT(tags);
}

public void readNBT(NBTTagCompound tags) {
	NBTTagList tagList = tags.getTagList("PR.Inventory", 10);
	for (int i = 0; i < tagList.tagCount(); ++i) {
		NBTTagCompound nbttagcompound = (NBTTagCompound) tagList
				.getCompoundTagAt(i);
		int j = nbttagcompound.getByte("Slot") & 255;
		ItemStack itemstack = ItemStack
				.loadItemStackFromNBT(nbttagcompound);
		if (itemstack != null) {
			this.stackList[j] = itemstack;
		}
	}
}

public void dropItems(ArrayList<EntityItem> drops) {
	for (int i = 0; i < 4; ++i) {
		if (this.stackList[i] != null) {
			EntityItem ei = new EntityItem(player.get().worldObj,
					player.get().posX, player.get().posY
							+ player.get().getEyeHeight(), player.get().posZ,
					this.stackList[i].copy());
			float f1 = player.get().worldObj.rand.nextFloat() * 0.5F;
			float f2 = player.get().worldObj.rand.nextFloat()
					* (float) Math.PI * 2.0F;
			ei.motionX = (double) (-MathHelper.sin(f2) * f1);
			ei.motionZ = (double) (MathHelper.cos(f2) * f1);
			ei.motionY = 0.20000000298023224D;
			drops.add(ei);
			this.stackList[i] = null;
			syncSlotToClients(i);
		}
	}
}

public void dropItemsAt(List<EntityItem> drops, Entity e) {
	for (int i = 0; i < 4; ++i) {
		if (this.stackList[i] != null) {
			EntityItem ei = new EntityItem(e.worldObj,
					e.posX, e.posY + e.getEyeHeight(), e.posZ,
					this.stackList[i].copy());
			float f1 = e.worldObj.rand.nextFloat() * 0.5F;
			float f2 = e.worldObj.rand.nextFloat() * (float) Math.PI * 2.0F;
			ei.motionX = (double) (-MathHelper.sin(f2) * f1);
			ei.motionZ = (double) (MathHelper.cos(f2) * f1);
			ei.motionY = 0.20000000298023224D;
			drops.add(ei);
			this.stackList[i] = null;
			syncSlotToClients(i);
		}
	}
}

public void syncSlotToClients(int slot) {
	try {
		if (MainRegistry.proxy.getClientWorld() == null) {
			com.phantasyrealms.packethandling.PacketHandler.INSTANCE.sendToAll(new PacketSyncPR(player.get(), slot));
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}



}

 

IPR

package com.phantasyrealms.inventory;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;

/**
* 
* This interface should be extended by items that can be worn in bauble slots
* 
* @author Azanor
*/

public interface IPR {

/**
 * This method return the type of bauble this is. 
 * Type is used to determine the slots it can go into.
 */
public PRType getPRType(ItemStack itemstack);

/**
 * This method is called once per tick if the bauble is being worn by a player
 */
public void onWornTick(ItemStack itemstack, EntityLivingBase player);

/**
 * This method is called when the bauble is equipped by a player
 */
public void onEquipped(ItemStack itemstack, EntityLivingBase player);

/**
 * This method is called when the bauble is unequipped by a player
 */
public void onUnequipped(ItemStack itemstack, EntityLivingBase player);

/**
 * can this bauble be placed in a bauble slot
 */
public boolean canEquip(ItemStack itemstack, EntityLivingBase player);

/**
 * Can this bauble be removed from a bauble slot
 */
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player);
}

 

PRAPI

package com.phantasyrealms.inventory;

import java.lang.reflect.Method;

import cpw.mods.fml.common.FMLLog;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;

/**
* @author Azanor
*/
public class PRAPI
{
static Method getPR;

/**
 * Retrieves the baubles inventory for the supplied player
 */
public static IInventory getMainRegistry(EntityPlayer player)
{
	IInventory ot = null;

    try
    {
        if(getPR == null) 
        {
            Class<?> fake = Class.forName("phantasyrealms.common.lib.PlayerHandler");
            getPR = fake.getMethod("getPlayerPR", EntityPlayer.class);
        }
        
        ot = (IInventory) getPR.invoke(null, player);
    } 
    catch(Exception ex) 
    { 
    	FMLLog.warning("[PR API] Could not invoke com.phantasyrealms.lib.PlayerHandler method getPlayerPR");
    }
    
	return ot;
}

}

 

PRType

package com.phantasyrealms.inventory;

public enum PRType {
MAG
}

 

SlotMag

package com.phantasyrealms.inventory;


import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;


public class SlotMag extends Slot
{

PRType type;

    public SlotMag(IInventory par2IInventory, PRType type, int par3, int par4, int par5)
    {
        super(par2IInventory, par3, par4, par5);
        this.type = type;
    }
    

    /**
     * Check if the stack is a valid item for this slot. Always true beside for the armor slots.
     */
    @Override
    public boolean isItemValid(ItemStack stack)
    {
    	return stack!=null && stack.getItem() !=null &&
        	   stack.getItem() instanceof IPR && 
        	   ((IPR)stack.getItem()).getPRType(stack)==this.type &&
        	   ((IPR)stack.getItem()).canEquip(stack, ((InventoryPR)this.inventory).player.get());
    }
    

@Override
public boolean canTakeStack(EntityPlayer player) {
	return this.getStack()!=null &&
		   ((IPR)this.getStack().getItem()).canUnequip(this.getStack(), player);
}


@Override
    public int getSlotStackLimit()
    {
        return 1;
    }
    
}

 

EventHandlerEntity

package com.phantasyrealms.eventhandler;

import java.io.File;
import java.io.IOException;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;







import com.google.common.io.Files;
import com.phantasyrealms.inventory.IPR;
import com.phantasyrealms.inventory.InventoryPR;
import com.phantasyrealms.lib.PlayerHandler;
import com.sun.swing.internal.plaf.basic.resources.basic_es;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class EventHandlerEntity {

@SubscribeEvent
public void playerTick(PlayerEvent.LivingUpdateEvent event) {

	// player events
	if (event.entity instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer) event.entity;

		InventoryPR PR = PlayerHandler.getPlayerPR(player);
		for (int a = 0; a < PR.getSizeInventory(); a++) {
			if (PR.getStackInSlot(a) != null
					&& PR.getStackInSlot(a).getItem() instanceof IPR) {
				((IPR) PR.getStackInSlot(a).getItem()).onWornTick(
						PR.getStackInSlot(a), player);
			}
		}

	}

}

@SubscribeEvent
public void playerDeath(PlayerDropsEvent event) {
	if (event.entity instanceof EntityPlayer
			&& !event.entity.worldObj.isRemote
			&& !event.entity.worldObj.getGameRules()
					.getGameRuleBooleanValue("keepInventory")) {
		PlayerHandler.getPlayerPR(event.entityPlayer).dropItemsAt(
				event.drops,event.entityPlayer);
	}

}

@SubscribeEvent
public void playerLoad(PlayerEvent.LoadFromFile event) {
	PlayerHandler.clearPlayerPR(event.entityPlayer);

	File file1 = getPlayerFile("baub", event.playerDirectory, event.entityPlayer.getDisplayName());
	if (!file1.exists()) {
		File filep = event.getPlayerFile("baub");
		if (filep.exists()) {
			try {
				Files.copy(filep, file1);					
				filep.delete();
				File fb = event.getPlayerFile("baubback");
				if (fb.exists()) fb.delete();					
			} catch (IOException e) {}
		} else {
			File filet = getLegacyFileFromPlayer(event.entityPlayer);
			if (filet.exists()) {
				try {
					Files.copy(filet, file1);
				} catch (IOException e) {}
			}
		}
	}

	PlayerHandler.loadPlayerPR(event.entityPlayer, file1, getPlayerFile("baubback", event.playerDirectory, event.entityPlayer.getDisplayName()));
	EventHandlerNetwork.syncPR(event.entityPlayer);
}

public File getPlayerFile(String suffix, File playerDirectory, String playername)
    {
        if ("dat".equals(suffix)) throw new IllegalArgumentException("The suffix 'dat' is reserved");
        return new File(playerDirectory, playername+"."+suffix);
    }

public static File getLegacyFileFromPlayer(EntityPlayer player)
    {
	try {
		File playersDirectory = new File(player.worldObj.getSaveHandler().getWorldDirectory(), "players");
		return new File(playersDirectory, player.getDisplayName() + ".baub");
	} catch (Exception e) { e.printStackTrace(); }
	return null;
    }

@SubscribeEvent
public void playerSave(PlayerEvent.SaveToFile event) {
	PlayerHandler.savePlayerPR(event.entityPlayer, 
			getPlayerFile("baub", event.playerDirectory, event.entityPlayer.getDisplayName()),
			getPlayerFile("baubback", event.playerDirectory, event.entityPlayer.getDisplayName()));
}

}

 

EventHandlerNetwork

package com.phantasyrealms.eventhandler;

import com.phantasyrealms.lib.PlayerHandler;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;


public class EventHandlerNetwork {

@SubscribeEvent    
public void playerLoggedInEvent (PlayerEvent.PlayerLoggedInEvent event)    {    
	Side side = FMLCommonHandler.instance().getEffectiveSide();        
	if (side == Side.SERVER)        {
		syncPR(event.player);
	}
}

public static void syncPR(EntityPlayer player) {
	for (int a = 0; a < 4; a++) {
		PlayerHandler.getPlayerPR(player).syncSlotToClients(a);
	}
}


}

 

GuiEvent

package com.phantasyrealms.eventhandler;

import java.lang.reflect.Method;

import com.phantasyrealms.packethandling.PacketHandler;
import com.phantasyrealms.packethandling.PacketOpenNormalInventory;
import com.phantasyrealms.packethandling.PacketOpenPRInventory;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.client.event.GuiScreenEvent;


public class GuiEvents {	

@SideOnly(value = Side.CLIENT)
@SubscribeEvent
public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {

	if (event.gui instanceof GuiInventory || event.gui instanceof GuiPlayerExpanded) {

		int xSize = 176;
	    int ySize = 166;

		int guiLeft = (event.gui.width - xSize) / 2;
        int guiTop = (event.gui.height - ySize) / 2;
        
        if (!event.gui.mc.thePlayer.getActivePotionEffects().isEmpty() && isNeiHidden()) {
        	guiLeft = 160 + (event.gui.width - xSize - 200) / 2;
        }

		event.buttonList.add(new GuiPRButton(55, guiLeft + 66, guiTop + 9, 10, 10, 
				I18n.format((event.gui instanceof GuiInventory)?"button.pr":"button.normal", new Object[0])));
	}

}

@SideOnly(value = Side.CLIENT)
@SubscribeEvent
public void guiPostAction(GuiScreenEvent.ActionPerformedEvent.Post event) {

	if (event.gui instanceof GuiInventory) {
		if (event.button.id == 55) {
			PacketHandler.INSTANCE.sendToServer(new PacketOpenPRInventory(event.gui.mc.thePlayer));
		}
	}

	if (event.gui instanceof GuiPlayerExpanded) {
		if (event.button.id == 55) {
			event.gui.mc.displayGuiScreen(new GuiInventory(event.gui.mc.thePlayer));
			PacketHandler.INSTANCE.sendToServer(new PacketOpenNormalInventory(event.gui.mc.thePlayer));
		}
	}
}

static Method isNEIHidden;
boolean isNeiHidden() {
	boolean hidden=true;
	try {
		if (isNEIHidden==null) {
			Class fake = Class.forName("codechicken.nei.NEIClientConfig");
		    isNEIHidden = fake.getMethod("isHidden");
		}
		hidden = (Boolean) isNEIHidden.invoke(null);
    } catch(Exception ex) { }		
	return hidden;
}
}

 

GuiPlayerExpanded

package com.phantasyrealms.eventhandler;

import java.io.IOException;

import org.lwjgl.opengl.GL11;

import com.phantasyrealms.inventory.ContainerPlayerExpanded;
import com.phantasyrealms.inventory.InventoryPR;
import com.phantasyrealms.lib.Strings;
import com.phantasyrealms.main.MainRegistry;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.achievement.GuiAchievements;
import net.minecraft.client.gui.achievement.GuiStats;
import net.minecraft.client.renderer.InventoryEffectRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation;


public class GuiPlayerExpanded extends InventoryEffectRenderer {

public static final ResourceLocation background = 
		new ResourceLocation(Strings.MODID + ":Gui.png");
    
/** x size of the inventory window in pixels. Defined as float, passed as int */
private float xSize_lo;

/** y size of the inventory window in pixels. Defined as float, passed as int. */
private float ySize_lo;



    public GuiPlayerExpanded(EntityPlayer player)
    {
        super(new ContainerPlayerExpanded(player.inventory, !player.worldObj.isRemote, player));
        this.allowUserInput = true;
    }

    /**
     * Called from the main game loop to update the screen.
     */
    @Override 
    public void updateScreen()
    {
    	try {
		((ContainerPlayerExpanded)inventorySlots).pr.blockEvents=false;
	} catch (Exception e) {	}
        this.updateActivePotionEffects();
    }

    
    
    private void updateActivePotionEffects() {
	// TODO Auto-generated method stub

}

/**
     * Adds the buttons (and other controls) to the screen in question.
     */
    @Override
    public void initGui()
    {
        this.buttonList.clear();
        super.initGui();
        
    }

    /**
     * Draw the foreground layer for the GuiContainer (everything in front of the items)
     */
    @Override
    protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
    {
        this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 106, 16, 4210752);
    }

    /**
     * Draws the screen and all the components in it.
     */
    @Override
    public void drawScreen(int par1, int par2, float par3)
    {
    super.drawScreen(par1, par2, par3);
    this.xSize_lo = (float)par1;
    this.ySize_lo = (float)par2;
    }
    @Override
    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
    {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(background);
    int k = (this.width - this.xSize) / 2;
    int l = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
    int i1;
    drawPlayerModel(k + 51, l + 75, 30, (float)(k + 51) - this.xSize_lo, (float)(l + 75 - 50) - this.ySize_lo, this.mc.thePlayer);
    }
    
    public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, EntityLivingBase entity) {
    	GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    	GL11.glPushMatrix();
    	GL11.glTranslatef(x, y, 50.0F);
    	GL11.glScalef(-scale, scale, scale);
    	GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    	float f2 = entity.renderYawOffset;
    	float f3 = entity.rotationYaw;
    	float f4 = entity.rotationPitch;
    	float f5 = entity.prevRotationYawHead;
    	float f6 = entity.rotationYawHead;
    	GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
    	RenderHelper.enableStandardItemLighting();
    	GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
    	GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F);
    	entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F;
    	entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F;
    	entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F;
    	entity.rotationYawHead = entity.rotationYaw;
    	entity.prevRotationYawHead = entity.rotationYaw;
    	GL11.glTranslatef(0.0F, entity.yOffset, 0.0F);
    	RenderManager.instance.playerViewY = 180.0F;
    	RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
    	entity.renderYawOffset = f2;
    	entity.rotationYaw = f3;
    	entity.rotationPitch = f4;
    	entity.prevRotationYawHead = f5;
    	entity.rotationYawHead = f6;
    	GL11.glPopMatrix();
    	RenderHelper.disableStandardItemLighting();
    	GL11.glDisable(GL11.GL_ALPHA_SCALE);
    	OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    	GL11.glDisable(GL11.GL_TEXTURE_2D);
    	OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    	}
    @Override
    protected void actionPerformed(GuiButton button)
    {
        if (button.id == 0)
        {
            this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter()));
        }

        if (button.id == 1)
        {
            this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter()));
        }
    }

@Override
protected void keyTyped(char par1, int par2) {
	if (par2 == MainRegistry.proxy.keyHandler.key.getKeyCode())
        {
            this.mc.thePlayer.closeScreen();
        } else
	super.keyTyped(par1, par2);
}
    
    
    
}

 

GuiPRButton

package com.phantasyrealms.eventhandler;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;

public class GuiPRButton extends GuiButton {

public GuiPRButton(int buttonId, int x, int y, int width, int height, String buttonText) {
	super(buttonId, x, y, width, height, buttonText);
}

public void drawButton(Minecraft mc, int xx, int yy)
    {
        if (this.visible)
        {
            FontRenderer fontrenderer = mc.fontRenderer;
            mc.getTextureManager().bindTexture(GuiPlayerExpanded.background);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            this.enabled = xx >= this.xPosition && yy >= this.yPosition && xx < this.xPosition + this.width && yy < this.yPosition + this.height;
            int k = this.getHoverState(this.enabled);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            
            
            if (k==1) {
            	this.drawTexturedModalRect(this.xPosition, this.yPosition, 200, 48, 10, 10);	
            } else {
            	this.drawTexturedModalRect(this.xPosition, this.yPosition, 210, 48, 10, 10);
            	this.drawCenteredString(fontrenderer, this.displayString, 
            			this.xPosition + 5, this.yPosition + this.height, 0xffffff);
            }
            
            this.mouseDragged(mc, xx, yy);
            
            
        }
    }

}

 

KeyHandler

package com.phantasyrealms.eventhandler;

import net.minecraft.client.settings.KeyBinding;









import org.lwjgl.input.Keyboard;

import com.phantasyrealms.packethandling.PacketHandler;
import com.phantasyrealms.packethandling.PacketOpenPRInventory;

import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class KeyHandler {

public KeyBinding key = new KeyBinding("Mag Inventory", 
		Keyboard.KEY_B, "key.categories.inventory");

public KeyHandler() {
	 ClientRegistry.registerKeyBinding(key);
}

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void playerTick(PlayerTickEvent event) {
	if (event.side == Side.SERVER) return;
	if (event.phase == Phase.START ) {
		if (key.isPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) {
				PacketHandler.INSTANCE.sendToServer(new PacketOpenPRInventory(event.player));
		}
	}
}
}

 

 

Link to comment
Share on other sites

When registering your GuiHandler you use the

instance

field, but you never initialize it.

 

I changed it but still a crash, am I not initializing it right?

 

MainRegistry

package com.phantasyrealms.main;


import java.io.File;

import org.apache.logging.log4j.LogManager;


import org.apache.logging.log4j.Logger;

import sun.net.NetworkServer;
import sun.security.krb5.Config;
import net.minecraftforge.common.MinecraftForge;

import com.phantasyrealms.entity.EntityBoomaMob;
import com.phantasyrealms.entity.PhantasyRealmsEntity;
import com.phantasyrealms.eventhandler.EventHandlerEntity;
import com.phantasyrealms.eventhandler.EventHandlerNetwork;
import com.phantasyrealms.item.PhantasyRealmsItems;
import com.phantasyrealms.lib.Strings;
import com.phantasyrealms.packethandling.PacketHandler;









import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.eventhandler.Event;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;

@Mod(modid = Strings.MODID, name = Strings.name, version = Strings.version)

public class MainRegistry {

public static final int GUI = 0;


@SidedProxy(clientSide = "com.phantasyrealms.main.ClientProxy", serverSide = "com.phantasyrealms.main.ServerProxy")
public static ServerProxy proxy;


@Instance(Strings.MODID)
public static MainRegistry modInstance;
public static Object instance;
public static File modDir;
public static EventHandlerEntity entityEventHandler;
public static EventHandlerNetwork entityEventNetwork;
public static ServerProxy GuiHandler;



public class RegisterKeyBindings
{

}

/**
 * Loads before
 * @param PostEvent
 */

@EventHandler
public static void PreLoad(FMLPreInitializationEvent PreEvent){
	PhantasyRealmsEntity.mainRegistry();
	proxy.registerRenderThings();
	PhantasyRealmsItems.mainRegistry();
	CraftingManager.mainRegistry();
	modDir = PreEvent.getModConfigurationDirectory();

	entityEventHandler = new EventHandlerEntity();
	entityEventNetwork = new EventHandlerNetwork();	
	MinecraftForge.EVENT_BUS.register(entityEventHandler);
	FMLCommonHandler.instance().bus().register(entityEventNetwork);

	NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
	GuiHandler.init();
	PacketHandler.init();


}



/**
 * Loads during
 * @param event
 */
@EventHandler
public static void load(FMLInitializationEvent event){



}

/**
 * Loads after
 * @param PostEvent
 */
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent){

}

}

 

ServerProxy

package com.phantasyrealms.main;


import com.phantasyrealms.eventhandler.KeyHandler;
import com.phantasyrealms.inventory.InventoryPR;
import com.phantasyrealms.packethandling.PacketOpenNormalInventory;
import com.phantasyrealms.packethandling.PacketOpenPRInventory;
import com.phantasyrealms.packethandling.PacketSyncPR;

import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.storage.WorldInfo;


public class ServerProxy implements IGuiHandler {
public KeyHandler keyHandler;




public void registerHandlers() {}

public void registerRenderThings(){


}

 // In your server proxy (mine is named CommonProxy):
/**
 * Returns a side-appropriate EntityPlayer for use during message handling
 */
public EntityPlayer getPlayerEntity(MessageContext ctx) {
 return ctx.getServerHandler().playerEntity;
}



public int addArmor(String armor){
	return 0;
}


@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	return null;
}

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	switch (ID) {
		case MainRegistry.GUI: return new InventoryPR(player);
	}
	return null;
}

public Object getClientWorld() {
	// TODO Auto-generated method stub
	return null;
}

    public static void init()
    {
    }








}

Link to comment
Share on other sites

Look at this part of code:

 

@Instance(Strings.MODID)
public static MainRegistry modInstance;
public static Object instance;

 

modInstance

is initialized by FML because you put the

@Instance

annotation on it.

instance

is not initialized, because, well, you don't initialize it.

 

Will you take a look at my KeyHandler code, and MainRegistry, the game runs fine now after initializing however the GUI doesn't pop up on button press, the button doesnt even show on the controls menu

 

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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