Jump to content

ClassDefNotFoundError: EntityClientPlayerMP - Why?


Bedrock_Miner

Recommended Posts

Heyho Guys!

 

I have tested my mod which works fine on CombinedClient on a Server and, of course  ;D , got an error:

 

[19:07:41] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLServerTweaker
[19:07:41] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLServerTweaker
[19:07:41] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLServerTweaker
[19:07:42] [main/INFO] [FML]: Forge Mod Loader version 7.10.18.1180 for Minecraft 1.7.10 loading
[19:07:42] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_60-ea, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7
[19:07:42] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[19:07:42] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[19:07:42] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
[19:07:42] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[19:07:42] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
[19:07:42] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
[19:07:43] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[19:07:45] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[19:07:45] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
[19:07:45] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
[19:07:47] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[19:07:58] [server thread/INFO]: Starting minecraft server version 1.7.10
[19:07:58] [server thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
[19:07:58] [server thread/INFO] [FML]: MinecraftForge v10.13.0.1180 Initialized
[19:07:59] [server thread/INFO] [FML]: Replaced 182 ore recipies
[19:07:59] [server thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
[19:07:59] [server thread/INFO] [FML]: Searching C:\Users\Julian\git\Magicum\Magicum\mods for mods
[19:08:02] [server 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!
[19:08:08] [server thread/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
[19:08:10] [server thread/INFO] [FML]: Processing ObjectHolder annotations
[19:08:10] [server thread/INFO] [FML]: Found 341 ObjectHolder annotations
[19:08:10] [server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[19:08:10] [server thread/INFO] [minersbasic]: Starting Version 1.0.0 of Miner's Basic.
[19:08:10] [server thread/INFO] [magicum]: Using PotionHelper...
[19:08:10] [server thread/INFO] [minersbasic]: Extended PotionArray. 15 new potions can be stored now.
[19:08:11] [server thread/INFO] [FML]: Applying holder lookups
[19:08:11] [server thread/INFO] [FML]: Holder lookups applied
[19:08:11] [server thread/INFO]: Loading properties
[19:08:11] [server thread/INFO]: Default game type: SURVIVAL
[19:08:11] [server thread/INFO]: Generating keypair
[19:08:11] [server thread/INFO]: Starting Minecraft server on *:25565
[19:08:12] [server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[19:08:12] [server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[19:08:12] [server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[19:08:12] [server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.
[19:08:12] [server thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
[19:08:12] [server thread/ERROR] [FML]: 
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML{7.10.18.1180} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized
Forge{10.13.0.1180} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized
minersbasic{1.0.0} [Miner's Basic] (bin) Unloaded->Constructed->Pre-initialized->Initialized
magicum{pre-0.1.0} [Magicum] (bin) Unloaded->Constructed->Pre-initialized->Errored
[19:08:12] [server thread/ERROR] [FML]: The following problems were captured during this phase
[19:08:12] [server thread/ERROR] [FML]: Caught exception from magicum
java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP
at com.bedrockminer.magicum.codex.entries.CodexEntry.<clinit>(CodexEntry.java:84) ~[CodexEntry.class:?]
at com.bedrockminer.magicum.codex.entries.CodexEntryList.<clinit>(CodexEntryList.java:13) ~[CodexEntryList.class:?]
at com.bedrockminer.magicum.codex.Codex.initCodex(Codex.java:62) ~[Codex.class:?]
at com.bedrockminer.magicum.CommonProxy.init(CommonProxy.java:60) ~[CommonProxy.class:?]
at com.bedrockminer.magicum.Main.init(Main.java:37) ~[Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
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) ~[LoadController.class:?]
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
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.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:97) [FMLServerHandler.class:?]
at cpw.mods.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:318) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:213) [DedicatedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) [MinecraftServer$2.class:?]
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityClientPlayerMP
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) ~[launchwrapper-1.9.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_60-ea]
... 37 more
Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/entity/EntityClientPlayerMP for invalid side SERVER
at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50) ~[forgeSrc-1.7.10-10.13.0.1180.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276) ~[launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174) ~[launchwrapper-1.9.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_60-ea]
... 37 more
[19:08:12] [server thread/ERROR]: Encountered an unexpected exception
cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP
at cpw.mods.fml.common.LoadController.transition(LoadController.java:162) ~[LoadController.class:?]
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:692) ~[Loader.class:?]
at cpw.mods.fml.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:97) ~[FMLServerHandler.class:?]
at cpw.mods.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:318) ~[FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:213) ~[DedicatedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) [MinecraftServer$2.class:?]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP
at com.bedrockminer.magicum.codex.entries.CodexEntry.<clinit>(CodexEntry.java:84) ~[CodexEntry.class:?]
at com.bedrockminer.magicum.codex.entries.CodexEntryList.<clinit>(CodexEntryList.java:13) ~[CodexEntryList.class:?]
at com.bedrockminer.magicum.codex.Codex.initCodex(Codex.java:62) ~[Codex.class:?]
at com.bedrockminer.magicum.CommonProxy.init(CommonProxy.java:60) ~[CommonProxy.class:?]
at com.bedrockminer.magicum.Main.init(Main.java:37) ~[Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
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) ~[LoadController.class:?]
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
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:?]
... 5 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityClientPlayerMP
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) ~[launchwrapper-1.9.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_60-ea]
at com.bedrockminer.magicum.codex.entries.CodexEntry.<clinit>(CodexEntry.java:84) ~[CodexEntry.class:?]
at com.bedrockminer.magicum.codex.entries.CodexEntryList.<clinit>(CodexEntryList.java:13) ~[CodexEntryList.class:?]
at com.bedrockminer.magicum.codex.Codex.initCodex(Codex.java:62) ~[Codex.class:?]
at com.bedrockminer.magicum.CommonProxy.init(CommonProxy.java:60) ~[CommonProxy.class:?]
at com.bedrockminer.magicum.Main.init(Main.java:37) ~[Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
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) ~[LoadController.class:?]
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
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:?]
... 5 more
Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/entity/EntityClientPlayerMP for invalid side SERVER
at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50) ~[forgeSrc-1.7.10-10.13.0.1180.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276) ~[launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174) ~[launchwrapper-1.9.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_60-ea]
at com.bedrockminer.magicum.codex.entries.CodexEntry.<clinit>(CodexEntry.java:84) ~[CodexEntry.class:?]
at com.bedrockminer.magicum.codex.entries.CodexEntryList.<clinit>(CodexEntryList.java:13) ~[CodexEntryList.class:?]
at com.bedrockminer.magicum.codex.Codex.initCodex(Codex.java:62) ~[Codex.class:?]
at com.bedrockminer.magicum.CommonProxy.init(CommonProxy.java:60) ~[CommonProxy.class:?]
at com.bedrockminer.magicum.Main.init(Main.java:37) ~[Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[FMLModContainer.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
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) ~[LoadController.class:?]
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60-ea]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60-ea]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60-ea]
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:?]
... 5 more
[19:08:12] [server thread/ERROR]: This crash report has been saved to: C:\Users\Julian\git\Magicum\Magicum\.\crash-reports\crash-2014-11-21_19.08.12-server.txt
[19:08:12] [server thread/WARN] [FML]: Can't revert to frozen GameData state without freezing first.
[19:08:12] [server thread/INFO] [FML]: Applying holder lookups
[19:08:12] [server thread/INFO] [FML]: Holder lookups applied
[19:08:12] [server thread/INFO] [FML]: The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED. Errors may have been discarded.
[19:08:12] [server thread/INFO] [FML]: The state engine was in incorrect state ERRORED and forced into state AVAILABLE. Errors may have been discarded.

 

The stacktrace points to the class for my custom Achievement (CodexEntry.class) (This class has nothing to do with Achievement.class). This class is needed on both client and server.

The line the error shows is:

private static GuiRenderer g = GuiRenderer.instance;

The GuiRenderer here is a class created by me which does not use EntityClientPlayerMP, so I do not understand why this causes the Error. Anyway, here is the code of GuiRenderer and its superclasses:

 

package com.bedrockminer.minersbasic.client.gui;

import java.nio.DoubleBuffer;
import java.util.Iterator;
import java.util.List;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.bedrockminer.minersbasic.client.render.Color;
import com.bedrockminer.minersbasic.client.render.GLUtil;
import com.bedrockminer.minersbasic.client.render.ObjectRenderer;
import com.bedrockminer.minersbasic.position.Normal;
import com.bedrockminer.minersbasic.position.Point;
import com.bedrockminer.minersbasic.position.TexPos;
import com.bedrockminer.minersbasic.position.Vertex;

public class GuiRenderer extends ObjectRenderer {

public static final GuiRenderer instance = new GuiRenderer();

protected GuiRenderer() {}

public static double zLevel = 0;
public static Minecraft mc = Minecraft.getMinecraft();
public static FontRenderer font = mc.fontRenderer;
public static RenderItem itemRenderer = new RenderItem();

public static final ResourceLocation optionsBackground = new ResourceLocation("textures/gui/options_background.png");

public static boolean autoreset = true;

/** Generates 2D Controlpoints from a Array of Points */
public static DoubleBuffer controlpoints(Point[] vertices) {
	return controlpoints(vertices, 0, 0);
}

/** Generates 2D Controlpoints from a Array of Points */
public static DoubleBuffer controlpoints(Point[] vertices, double xoffset, double yoffset) {
	DoubleBuffer buffer = BufferUtils.createDoubleBuffer(vertices.length * 3);
	for (int i = 0; i < vertices.length; i ++) {
		buffer.put(i * 3, vertices[i].x + xoffset);
		buffer.put(i * 3 + 1, vertices[i].y + yoffset);
		buffer.put(i * 3 + 2, zLevel);
	}
	return buffer;
}

/** Generates 2D Controlpoints from a Array of Points and doubles each one */
public static DoubleBuffer controlpointsDouble(Point[] vertices) {
	return controlpointsDouble(vertices, 0, 0);
}

/** Generates 2D Controlpoints from a Array of Points and doubles each one */
public static DoubleBuffer controlpointsDouble(Point[] vertices, double xoffset, double yoffset) {
	DoubleBuffer buffer = BufferUtils.createDoubleBuffer(vertices.length * 6);
	for (int i = 0; i < vertices.length; i ++) {
		buffer.put(i * 6, vertices[i].x + xoffset);
		buffer.put(i * 6 + 1, vertices[i].y + yoffset);
		buffer.put(i * 6 + 2, zLevel);
		buffer.put(i * 6 + 3, vertices[i].x + xoffset);
		buffer.put(i * 6 + 4, vertices[i].y + yoffset);
		buffer.put(i * 6 + 5, zLevel);
	}
	return buffer;
}

/** draws the default GUI background */
public static void drawBackground(GuiScreen gui) {
	if (mc.theWorld != null) {
		drawGradientRect(0, 0, gui.width, gui.height, new Color(0.1, 0.1, 0.1, 0.7), new Color(0.1, 0.1, 0.1, 0.);
    } else {
		drawOptionsBackground(gui);
	}
}

/** Draws a textbox of a list of Strings */
public static void drawHoveringText(GuiScreen gui, List<String> list, int x, int y, boolean offset) {
	if (!list.isEmpty())
        {
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL11.GL_LIGHTING);
            int width = 0;
            Iterator<String> iterator = list.iterator();

            while (iterator.hasNext())
            {
                String s = iterator.next();
                int line_width = font.getStringWidth(s);

                if (line_width > width)
                {
                    width = line_width;
                }
            }

            int xStart = x + (offset ? 12 : 0);
            int yStart = y - (offset ? 12 : 0);
            int height = 8;

            if (list.size() > 1)
            {
                height += 2 + (list.size() - 1) * 10;
            }

            if (xStart + width > gui.width)
            {
                xStart -= (offset ? 28 : 0) + width;
            }

            if (yStart + height + 6 > gui.height)
            {
                yStart = gui.height - height - 6;
            }

            double prevZ = zLevel;
            zLevel = 300;
            itemRenderer.zLevel = 300;
            Color j1 = Color.fromInt(-267386864);
            drawGradientRect(xStart - 3, yStart - 4, xStart + width + 3, yStart - 3, j1, j1);
            drawGradientRect(xStart - 3, yStart + height + 3, xStart + width + 3, yStart + height + 4, j1, j1);
            drawGradientRect(xStart - 3, yStart - 3, xStart + width + 3, yStart + height + 3, j1, j1);
            drawGradientRect(xStart - 4, yStart - 3, xStart - 3, yStart + height + 3, j1, j1);
            drawGradientRect(xStart + width + 3, yStart - 3, xStart + width + 4, yStart + height + 3, j1, j1);
            Color k1 = Color.fromInt(1347420415);
            Color l1 = Color.fromInt((k1.toInt() & 16711422) >> 1 | k1.toInt() & -16777216);
            drawGradientRect(xStart - 3, yStart - 3 + 1, xStart - 3 + 1, yStart + height + 3 - 1, k1, l1);
            drawGradientRect(xStart + width + 2, yStart - 3 + 1, xStart + width + 3, yStart + height + 3 - 1, k1, l1);
            drawGradientRect(xStart - 3, yStart - 3, xStart + width + 3, yStart - 3 + 1, k1, k1);
            drawGradientRect(xStart - 3, yStart + height + 2, xStart + width + 3, yStart + height + 3, l1, l1);

            zLevel = 350;
            for (int i2 = 0; i2 < list.size(); ++i2)
            {
                String s1 = list.get(i2);
                drawString(s1, xStart, yStart, Color.WHITE, true);

                if (i2 == 0)
                {
                    yStart += 2;
                }

                yStart += 10;
            }

            zLevel = prevZ;
            itemRenderer.zLevel = 0.0F;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            reset();
        }
}

/** draws an ItemStack */
public static void drawItemStack(ItemStack stack, int x, int y, String countText) {
    double prevZ = zLevel;
    zLevel = 200.0F;
    itemRenderer.zLevel = 200.0F;
    itemRenderer.renderItemAndEffectIntoGUI(font, mc.getTextureManager(), stack, x, y);
    itemRenderer.renderItemOverlayIntoGUI(font, mc.getTextureManager(), stack, x, y, countText);
    zLevel = prevZ;
    itemRenderer.zLevel = 0.0F;
    reset();
}

/** draws an ItemStack with the stack size automatically added*/
public static void drawItemStack(ItemStack stack, int x, int y) {
    drawItemStack(stack, x, y, stack.stackSize == 1 ? "" : ("" + stack.stackSize));
}

/** Draws a line */
public static void drawLine(int x1, int y1, int x2, int y2) {
	renderLine(new Vertex(x1, y1, zLevel), new Vertex(x2, y2, zLevel));
}

/** draws the Options background */
public static void drawOptionsBackground(GuiScreen gui)
    {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_FOG);
        bindTexture(optionsBackground);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        float f = 32.0F;
        t.startDrawingQuads();
        t.setColorOpaque_I(4210752);
        t.addVertexWithUV(0.0D, gui.height, 0.0D, 0.0D, gui.height / f);
        t.addVertexWithUV(gui.width, gui.height, 0.0D, gui.width / f, gui.height / f);
        t.addVertexWithUV(gui.width, 0.0D, 0.0D, gui.width / f, 0.0);
        t.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0);
        t.draw();
    }

/** Draws a String with LineWrap */
public static void drawSplitString(String text, int x, int y, int width, Color color) {
	GLUtil.translate(0, 0, zLevel);
	font.drawSplitString(text, x, y, width, color.toInt());
	GLUtil.translate(0, 0, -zLevel);
	autoReset();
}

/** Draws a aligned String */
public static void drawString(String text, int x, int y, Align align, Color color, boolean shadow) {
	int width = font.getStringWidth(text);
	if (align == Align.CENTER) x -= width / 2;
	if (align == Align.RIGHT) x -= width;
	drawString(text, x, y, color, shadow);
}

/** Draws a String onto the Gui */
public static void drawString(String text, int x, int y, Color color, boolean shadow) {
	GLUtil.translate(0, 0, zLevel);
	font.drawString(text, x, y, color.toInt(), shadow);
	GLUtil.translate(0, 0, -zLevel);
	autoReset();
}

/** Renders a Rectangle from a 256 * 256 Texture */
public static void drawTexturedRect(int x, int y, int u, int v, int width, int height) {
	startDrawingQuads();
	renderQuadFace(new Vertex(x + width, y, zLevel), new Vertex(x, y, zLevel), new Vertex(x, y + height, zLevel), new Normal(0, 0, 1), new TexPos(u / 256.0, v / 256.0, (u + width) / 256.0, (v + height) / 256.0, width, height));
	draw();
}

/** Renders a rectanlge with texture from an icon */
public static void drawTexturedRect(int x, int y, IIcon icon, int width, int height) {
	startDrawingQuads();
	renderQuadFace(new Vertex(x + width, y, zLevel), new Vertex(x, y, zLevel), new Vertex(x, y + height, zLevel), new Normal(0, 0, 1), new TexPos(icon));
	draw();
}

/** Renders a Rectangle from a custom sized Texture */
public static void drawTexturedRect(int x, int y, int imgwidth, int imgheight, int u, int v, int width, int height) {
	startDrawingQuads();
	renderQuadFace(new Vertex(x + width, y, zLevel), new Vertex(x, y, zLevel), new Vertex(x, y + height, zLevel), new Normal(0, 0, 1), new TexPos(u / (double) imgwidth, v / (double) imgheight, (u + width) / (double) imgwidth, (v + height) / (double) imgheight, imgwidth, imgheight));
	draw();
}

/** Draws a Tooltip for an ItemStack */
public static void drawTooltip(GuiScreen gui, ItemStack stack, int x, int y) {
	@SuppressWarnings("unchecked")
	List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);

        for (int i = 0; i < list.size(); ++i)
        {
            if (i == 0)
            {
                list.set(i, stack.getRarity().rarityColor + list.get(i));
            }
            else
            {
                list.set(i, EnumChatFormatting.GRAY + list.get(i));
            }
        }

        drawHoveringText(gui, list, x, y, true);
        reset();
}

/** Returns the width of the char */
public static int getCharWidth(char text) {
	return font.getCharWidth(text);
}

/** Returns the width of the string */
public static int getStringWidth(String text) {
	return font.getStringWidth(text);
}

/** Returns whether the first point is inside the box between the second ones */
public static boolean isPointInside(int x, int y, int x1, int y1, int x2, int y2) {
	return x > x1 && x < x2 && y > y1 && y < y2;
}

/** Resets the state of the GUI renderer to default */
public static void reset() {
	GLUtil.defaultSettings(false);
	GLUtil.resetColor();
}

/**
     * Draws a rectangle with a vertical gradient between the specified colors.
     */
    public static void drawGradientRect(int x1, int y1, int x2, int y2, Color c1, Color c2)
    {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        t.startDrawingQuads();
        t.setColorRGBA_F((float) c1.r, (float) c1.g, (float) c1.b, (float) c1.a);
        t.addVertex(x2, y1, zLevel);
        t.addVertex(x1, y1, zLevel);
        t.setColorRGBA_F((float) c2.r, (float) c2.g, (float) c2.b, (float) c2.a);
        t.addVertex(x1, y2, zLevel);
        t.addVertex(x2, y2, zLevel);
        t.draw();
        GL11.glShadeModel(GL11.GL_FLAT);
        reset();
    }

private static void autoReset() {
	if (autoreset)
		reset();
}

public static enum Align {
	LEFT, CENTER, RIGHT
}
}

package com.bedrockminer.minersbasic.client.render;

import java.nio.DoubleBuffer;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;

import com.bedrockminer.minersbasic.position.Normal;
import com.bedrockminer.minersbasic.position.TexPos;
import com.bedrockminer.minersbasic.position.Vertex;

public class ObjectRenderer extends GLUtil {

public static final ObjectRenderer instance = new ObjectRenderer();

protected ObjectRenderer() {}

public static Tessellator t = Tessellator.instance;

public static boolean stretchTextures = false;
public static int curveresolution = 12;

/** Resets the settings */
public static void resetState() {
	stretchTextures = false;
	curveresolution = 12;
}

/** Starts the Tessellator to draw Quadraliterals*/
public static void startDrawingQuads() {
	t.startDrawingQuads();
}

/** Stops the Tessellator */
public static void draw() {
	t.draw();
}

/** Sets the Normal of the Tessellator */
public static void setNormal(Normal n) {
	t.setNormal((float) n.x, (float) n.y, (float) n.z);
}

/** Renders a face with given UV. ABCD Clockwise, starting at upper left Vertex */
public static void renderQuadFace(Vertex A, Vertex B, Vertex C, Vertex D, Normal n, TexPos texture)
{
	setNormal(n);
	t.addVertexWithUV(A.x, A.y, A.z, texture.U, texture.v);
	t.addVertexWithUV(B.x, B.y, B.z, texture.u, texture.v);
	t.addVertexWithUV(C.x, C.y, C.z, texture.u, texture.V);
	t.addVertexWithUV(D.x, D.y, D.z, texture.U, texture.V);
}

/** Renders a rectangle face with given texture between the given points A, B, C. D is calculated automatically. ABC Clockwise, starting at upper left Vertex */
public static void renderQuadFace(Vertex A, Vertex B, Vertex C, Normal n, TexPos texture)
{
	renderQuadFace(A, B, C, new Vertex(A.x + C.x - B.x, A.y + C.y - B.y, A.z + C.z - B.z), n, texture);
}

/** Renders an axis aligned box.*/
public static void renderAABox(Vertex min, Vertex max, TexPos tex) {
	renderAABoxWalls(min, max, tex);
	renderAABoxTopAndBot(min, max, tex);
}

/** Renders the walls of an axis aligned box.*/
public static void renderAABoxWalls(Vertex min, Vertex max, TexPos tex) {
	renderQuadFace(new Vertex(min.x, max.y, min.z), new Vertex(max.x, max.y, min.z), new Vertex(max.x, min.y, min.z), new Vertex(min.x, min.y, min.z), new Normal(0, 0, -1), stretchTextures ? tex : tex.clone().interpolate(min.x, min.y, max.x, max.y));
	renderQuadFace(new Vertex(max.x, max.y, min.z), new Vertex(max.x, max.y, max.z), new Vertex(max.x, min.y, max.z), new Vertex(max.x, min.y, min.z), new Normal(1, 0, 0), stretchTextures ? tex : tex.clone().interpolate(min.z, min.y, max.z, max.y));
	renderQuadFace(new Vertex(max.x, max.y, max.z), new Vertex(min.x, max.y, max.z), new Vertex(min.x, min.y, max.z), new Vertex(max.x, min.y, max.z), new Normal(0, 0, 1), stretchTextures ? tex : tex.clone().interpolate(min.x, min.y, max.x, max.y));
	renderQuadFace(new Vertex(min.x, max.y, max.z), new Vertex(min.x, max.y, min.z), new Vertex(min.x, min.y, min.z), new Vertex(min.x, min.y, max.z), new Normal(-1, 0, 0), stretchTextures ? tex : tex.clone().interpolate(min.z, min.y, max.z, max.y));
}

/** Renders top and bottom of an axis aligned box. */
public static void renderAABoxTopAndBot(Vertex min, Vertex max, TexPos tex) {
	renderQuadFace(new Vertex(min.x, max.y, max.z), new Vertex(max.x, max.y, max.z), new Vertex(max.x, max.y, min.z), new Vertex(min.x, max.y, min.z), new Normal(0, 1, 0), stretchTextures ? tex : tex.clone().interpolate(min.x, min.z, max.x, max.z));
	renderQuadFace(new Vertex(min.x, min.y, min.z), new Vertex(max.x, min.y, min.z), new Vertex(max.x, min.y, max.z), new Vertex(min.x, min.y, max.z), new Normal(0, -1, 0), stretchTextures ? tex : tex.clone().interpolate(min.x, min.z, max.x, max.z));
}

/** Renders an Itemstack's Item. Tessellator needs to be off.*/
public static void renderItem(ItemStack stack, float thickness) {
	Item item = stack.getItem();
	IIcon icon = item.getIconIndex(stack);
	ItemRenderer.renderItemIn2D(t, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), thickness);
}

/** Renders a face with thickness. Tessellator needs to be off*/
public static void renderSolidifiedFace(IIcon icon, float thickness) {
	GL11.glTranslatef(0.0F, 0.0F, 0.5F * thickness);
	ItemRenderer.renderItemIn2D(t, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), thickness);
	GL11.glTranslatef(0.0F, 0.0F, 0.5F * -thickness);
}

/** Renders a Line between two Points */
public static void renderLine(Vertex A, Vertex B) {
	GL11.glBegin(GL11.GL_LINE_STRIP);
	GL11.glVertex3d(A.x, A.y, A.z);
	GL11.glVertex3d(B.x, B.y, B.z);
	GL11.glEnd();
}

/** Renders a bezier curve from the given Controlpoints */
public static void renderCurve(DoubleBuffer controlpoints) {
	GL11.glMap1d(GL11.GL_MAP1_VERTEX_3, 0.0, 1.0, 3, controlpoints.capacity() / 3, controlpoints);
	GL11.glEnable(GL11.GL_MAP1_VERTEX_3);
	GL11.glBegin(GL11.GL_LINE_STRIP);
	for (int i = 0; i < curveresolution; i ++) {
		GL11.glEvalCoord1d((double) i / curveresolution);
	}
	GL11.glEnd();
	GL11.glDisable(GL11.GL_MAP1_VERTEX_3);
}

/** Generates Controlpoints from a Array of Vertices */
public static DoubleBuffer controlpoints(Vertex[] vertices) {
	DoubleBuffer buffer = BufferUtils.createDoubleBuffer(vertices.length * 3);
	for (int i = 0; i < vertices.length; i ++) {
		buffer.put(i * 3, vertices[i].x);
		buffer.put(i * 3 + 1, vertices[i].y);
		buffer.put(i * 3 + 2, vertices[i].z);
	}
	return buffer;
}

/** Generates Controlpoints from a Array of Vertices and doubles each one */
public static DoubleBuffer controlpointsDouble(Vertex[] vertices) {
	DoubleBuffer buffer = BufferUtils.createDoubleBuffer(vertices.length * 6);
	for (int i = 0; i < vertices.length; i ++) {
		buffer.put(i * 6, vertices[i].x);
		buffer.put(i * 6 + 1, vertices[i].y);
		buffer.put(i * 6 + 2, vertices[i].z);
		buffer.put(i * 6 + 3, vertices[i].x);
		buffer.put(i * 6 + 4, vertices[i].y);
		buffer.put(i * 6 + 5, vertices[i].z);
	}
	return buffer;
}

/** sets the ResourceLocation as the active texture */
public static void bindTexture(ResourceLocation texture) {
	Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
}

/** sets the ResourceLocation for Blocks as active Texture */
public static void bindBlockTexture() {
	Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
}

/** sets the ResourceLocation for Items as active Texture */
public static void bindItemTexture() {
	Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationItemsTexture);
}
}

package com.bedrockminer.minersbasic.client.render;

import org.lwjgl.opengl.GL11;

import com.bedrockminer.minersbasic.position.Vertex;

public class GLUtil {

public static final GLUtil instance = new GLUtil();

protected GLUtil() {}

/** Restores the default Settings for GL */
public static void defaultSettings(boolean lighting) {
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_ALPHA_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	defaultBlendFunc();
	enableLighting(lighting);
}

/** Sets the rendering color to this value */
public static void setColor(Color c) {
	GL11.glColor4d(c.r, c.g, c.b, c.a);
}

/** Resets the color to a default value of {@link Color#WHITE white} */
public static void resetColor() {
	setColor(Color.WHITE);
}

/** Translates the current GLMatrix */
public static void translate(double x, double y, double z) {
	GL11.glTranslated(x, y, z);
}

/** Rotates the current GLMatrix */
public static void rotate(double angle, double x, double y, double z) {
	GL11.glRotated(angle, x, y, z);
}

/** Rotates the current GLMatrix around the center point*/
public static void rotateAround(Vertex center, double angle, double x, double y, double z) {
	GL11.glTranslated(center.x, center.y, center.z);
	GL11.glRotated(angle, x, y, z);
	GL11.glTranslated(-center.x, -center.y, -center.z);
}

/** Scales the current GLMatrix */
public static void scale(double x, double y, double z) {
	GL11.glScaled(x, y, z);
}

/** Pushes a new GLMatrix */
public static void pushMatrix() {
	GL11.glPushMatrix();
}

/** Pops the current Matrix */
public static void popMatrix() {
	GL11.glPopMatrix();
}

/** Enables or Disables the given cap based on the boolean value */
public static void enableCap(boolean enable, int cap) {
	if (enable)
		GL11.glEnable(cap);
	else
		GL11.glDisable(cap);
}

/** En-/Disables the GL Lighting */
public static void enableLighting(boolean enable) {
	enableCap(enable, GL11.GL_LIGHTING);
}

/** En-/Disables Blending */
public static void enableBlend(boolean enable) {
	enableCap(enable, GL11.GL_BLEND);
}

/** En-/Disables the GL Scissoring */
public static void enableScissors(boolean enable) {
	enableCap(enable, GL11.GL_SCISSOR_TEST);
}

/** Disables the Texture */
public static void disableTexture() {
	GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
}

/** Sets the range for GL Scissoring */
public static void setScissors(int x, int y, int width, int height) {
	GL11.glScissor(x, y, width, height);
}

/** Restores the default Blend Func */
public static void defaultBlendFunc() {
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
}

 

 

I already tried to add a

@SideOnly(Side.CLIENT)

in front of the declaration but this didn't work either.

 

I hope anyone can understand what's going on there..

If you need more code, just write.

 

Yours, _B_M_

Link to comment
Share on other sites

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.ItemRenderer;

import net.minecraft.client.renderer.Tessellator;

import net.minecraft.client.renderer.texture.TextureMap;

 

None of these classes exist on the server, merely instantiating your class will cause the server to crash due to missing references.  You will see this a lot with inter-mod compatibility.  You must create a unique class for EACH mod API you want to use because if that mod is not present and you call a function in a class that merely contains the imports will cause Minecraft to crash, even if the code that uses the imported classes isn't called.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

OK, understood ;)

But actually I don't want to copy every single method from GuiRenderer into the client proxy. Is there any workaround which would return the instance of the class itself (on client side of course)? I actually can't imagine a method without the need to import the (ClientOnly) class in the CommonProxy or the place where you need it. Do you think, there is a way to create a method that I can use the syntax:

Main.proxy.gui().anyRenderingMethodFromGuiUtil()

or even better, with a reference to the proxy:

p.gui().anyRenderingMethod()

Is something like this possible?

 

Thoughts about it:

  • gui() must not return GuiUtil itself, otherwise I have to import it.
  • the returned class can not be casted to GuiUtil, otherwise I have to import it again
  • the returned class must have the rendering methods implemented.
  • -> No way around copying everything (?)
  • Maybe gui() returns either GuiUtilCaller or GuiUtil which then needs to be a subclass of GuiUtilCaller

Link to comment
Share on other sites

That's because I added the rendering stuff directly to that class. I should probably change this...

package com.bedrockminer.magicum.codex.entries;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

import com.bedrockminer.magicum.Magicum;
import com.bedrockminer.magicum.client.gui.GuiCodexMagicum;
import com.bedrockminer.magicum.codex.Codex;
import com.bedrockminer.magicum.codex.CodexPage;
import com.bedrockminer.magicum.element.Elements;
import com.bedrockminer.magicum.extendedproperties.PropertiesCodex;
import com.bedrockminer.minersbasic.client.gui.GuiRenderer;
import com.bedrockminer.minersbasic.client.render.Color;
import com.bedrockminer.minersbasic.items.ItemTemplate;
import com.bedrockminer.minersbasic.log.Log;
import com.bedrockminer.minersbasic.position.Point;
import com.google.gson.stream.JsonReader;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class CodexEntry {

/** A unique ID for this Codex Entry */
private final int ID;
/** The internal name of this Codex Entry */
private final String name;
/** These IDs are required to display the Entry */
private int[] requiredIDs = new int[0];

/** X Position on screen */
private final int x;
/** Y Position on Screen */
private final int y;
/** Colour of the Connecting lines */
private int lineColour = Color.BLACK.toInt();
/** List of all Lines. Lines are stored as a List of Control Vertices */
private List<Point[]> lines = new ArrayList<Point[]>();
/** If true the entry has a special symbol */
private boolean hasSpecialLayout = false;

/** If true the Entry has a special research that has to be completed before ready to craft */
private boolean needsResearch = false;
/** List of Items that are shown as a tooltip as help for the Research */
private ItemStack[] researchHelpItems = new ItemStack[0];
/** List of Elements that are shown as a tooltip as help for the Research */
private Elements[] researchHelpElements = new Elements[0];

/** Localized Title of the Entry */
private String title = "";
/** Localized Description of the Entry */
private String desc = "";
/** Localized Pages of the Entry */
private String[] pages = new String[0];
/** Data for the Commands of this Object */
private Object[] command_data = new Object[0];
/** Optional special Text shown when completing a research for this Entry. Not used if equals "" */
private String researchText = "";
/** Optional special Text shown when completing crafting for this Entry. Not used if equals "" */
private String craftingText = "";

/** If true the iconItem is used for rendering, otherwise the coordinates */
private boolean isIconItem = false;
/** Itemstack to show as the entry's Icon */
private ItemStack iconItem = null;
/** Entry's Icon's x coordinate */
private int iconX = 1;
/** Entry's Icon's y coordinate */
private int iconY = 1;

private static GuiRenderer g = GuiRenderer.instance;

protected static ResourceLocation icons = new ResourceLocation(Magicum.MODID, "codex/codex_icons.png");
protected static ResourceLocation labels = new ResourceLocation(Magicum.MODID, "codex/achievement_labels.png");

public CodexEntry(int ID, String name, int x, int y) {
	this.ID = ID;
	this.title = this.name = name;
	this.x = x;
	this.y = y;
	Codex.registerEntry(this);
}

/** Adds a Line Rendering to this Entry */
public CodexEntry addLine(Point ... vertices) {
	this.lines.add(vertices);
	return this;
}

/** Adds this Codex Entry to the given CodexPage */
public CodexEntry addToCodexPage(CodexPage page) {
	page.add(this);
	return this;
}

public void checkDependencies(EntityPlayer player) {
	if (PropertiesCodex.get(player).codexList.get(this.getID()) <= (this.needsResearch() ? Codex.HIDDEN : Codex.RESEARCHED)) {
		boolean reveal = true;
		for (int i : this.getRequiredIDs()) {
			if (i == -1 || PropertiesCodex.get(player).codexList.get(i) < Codex.RESEARCHED || (PropertiesCodex.get(player).codexList.get(i) < Codex.COMPLETE && !Codex.entryList.get(i).needsResearch)) {
				reveal = false;
				break;
			}
		}
		if (reveal) {
			if (this.needsResearch())
				this.reveal(player);
			else
				this.completeResearch(player);
		}
	}
}

/** Sets the given Codex Entry for the given Player to the status {@link Codex#COMPLETE} if it is not completed. */
public void completeCraft(EntityPlayer player) {
	if (PropertiesCodex.get(player).codexList.get(this.getID()) < Codex.COMPLETE) {
		PropertiesCodex.get(player).codexList.set(this.getID(), Codex.COMPLETE);
		if (player instanceof EntityPlayerMP) {
			Codex.sendCodexChanges((EntityPlayerMP) player, this);
			Codex.publishCompletion((EntityPlayerMP) player, this);
		}
		Codex.updateCodexDependencies(player);
	}
}

/** Sets the given Codex Entry for the given Player to the status {@link Codex#RESEARCHED} if it is only visible or hidden. */
public void completeResearch(EntityPlayer player) {
	if (PropertiesCodex.get(player).codexList.get(this.getID()) < Codex.RESEARCHED) {
		PropertiesCodex.get(player).codexList.set(this.getID(), Codex.RESEARCHED);
		if (player instanceof EntityPlayerMP)
			Codex.sendCodexChanges((EntityPlayerMP) player, this);
		Codex.updateCodexDependencies(player);
	}
}

public Object[] getCommand_data() {
	return this.command_data;
}

/**
 * @return the ID
 */
public int getID() {
	return this.ID;
}

/** Returns the message shown as achievement when completing this codex entry.
 * Used in translations with either "text.codex." or "chat.codex.achievement." as prefix*/
public String getMessage() {
	return "text.codex.completion.entry_complete";
}

/**
 * @return the Name
 */
public String getName() {
	return this.name;
}

/**
 * @return The localized Pages of this Entry
 */
public String[] getPages() {
	return this.pages;
}

/**
 * @return the requiredIDs
 */
public int[] getRequiredIDs() {
	return this.requiredIDs;
}

/** @return The unlocalized String to show in the tooltip concerning the status of this entry*/
public String getStatusText(byte state) {
	if (state < Codex.COMPLETE && !this.needsResearch())
		return "text.codex.status.not_completed";
	if (state == Codex.RESEARCHED)
		return "text.codex.status.researched";
	if (state == Codex.COMPLETE)
		return "text.codex.status.completed";
	return "text.codex.status.needs_research";
}

/**
 * @return The localized Title of this Entry
 */
public String getTitle() {
	return this.title;
}

public int getX() {
	return this.x;
}

public int getY() {
	return this.y;
}

@Override
public int hashCode() {
	return this.ID;
}

public boolean hasSpecialLayout() {
	return this.hasSpecialLayout;
}

public void loadFromAssets(String languageCode) {
	ResourceLocation res = new ResourceLocation(Magicum.MODID, "codex/lang/" + languageCode + "/" + this.getName() + ".json");

	try {
		Minecraft.getMinecraft().getResourceManager().getResource(res);
	} catch (IOException e1) {
		res = new ResourceLocation(Magicum.MODID, "codex/lang/en_US/" + this.getName() + ".json");
	}

	try {
		JsonReader reader = new JsonReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream(), "UTF-8"));
		reader.beginObject();
		while (reader.hasNext()) {
			String identifier = reader.nextName();

			if (identifier.equals("title")) {
				this.title = reader.nextString();
			} else if (identifier.equals("desc")) {
				this.desc = reader.nextString();
			} else if (identifier.equals("icon_item")) {
				ItemTemplate temp = ItemTemplate.createFromString(reader.nextString());
				if (temp != null) {
					this.iconItem = temp.createStack();
					this.isIconItem = true;
				}
			} else if (identifier.equals("icon_x")) {
				this.iconX = reader.nextInt();
				this.isIconItem = false;
			} else if (identifier.equals("icon_y")) {
				this.iconY = reader.nextInt();
				this.isIconItem = false;
			} else if (identifier.equals("pages")) {
				reader.beginArray();
				List<String> data = new ArrayList<String>();
				while (reader.hasNext()) {
					data.add(reader.nextString());
				}
				reader.endArray();
				this.pages = new String[data.size()];
				data.toArray(this.pages);
			} else if (identifier.equals("command_data")) {
				reader.beginArray();
				List<String> data = new ArrayList<String>();
				while (reader.hasNext()) {
					data.add(reader.nextString());
				}
				reader.endArray();
				this.command_data = new Object[data.size()];
				for (int i = 0; i < data.size(); i ++) {
					if (data.get(i).startsWith("resource:")) {
						this.command_data[i] = new ResourceLocation(Magicum.MODID, data.get(i).substring(9));
					} else if (data.get(i).startsWith("stack:")) {
						ItemTemplate tmp = ItemTemplate.createFromString(data.get(i).substring(6));
						if (tmp != null)
							this.command_data[i] = tmp.createStack();
					}
				}
			} else {
				reader.skipValue();
			}
		}
		reader.endObject();
		reader.close();
	}
	catch (FileNotFoundException e) {
		Log.warn(Magicum.MODID, "Resource File Missing: %s", res.toString());
	}
	catch (IOException e) {
		Log.error(Magicum.MODID, "Encountered IOException");
		e.printStackTrace();
	}
}

/**
 * @return the needsResearch
 */
public boolean needsResearch() {
	return this.needsResearch;
}

@SideOnly(Side.CLIENT)
public void onEntryClicked(GuiCodexMagicum gui, Minecraft mc) {
	if (Codex.getStatusFor(mc.thePlayer, this) >= Codex.RESEARCHED)
		gui.showEntryPage(this.getID());
}

@SideOnly(Side.CLIENT)
public void renderLinesToCodex(GuiCodexMagicum gui, Minecraft mc, int x0, int y0) {
	this.g.reset();
	GL11.glLineWidth(gui.scale);
	this.g.disableTexture();

	if (Codex.getStatusFor(mc.thePlayer, this) <= 1) {
		Color c = Color.fromInt(this.lineColour);
		c.r /= 3.0;
		c.g /= 3.0;
		c.b /= 3.0;
		if (Codex.getStatusFor(mc.thePlayer, this) == 0)
			c.a = 0.15;
		this.g.setColor(c);
	} else {
		this.g.setColor(Color.fromInt(this.lineColour));
	}

	for (Point[] line : this.lines) {
		if (line.length > 2) {
			this.g.renderCurve(this.g.controlpoints(line, x0, y0));
		} else {
			GL11.glBegin(GL11.GL_LINE_STRIP);
			GL11.glVertex3d(line[0].x + x0, line[0].y + y0, this.g.zLevel);
			GL11.glVertex3d(line[1].x + x0, line[1].y + y0, this.g.zLevel);
			GL11.glEnd();
		}
	}
}

@SideOnly(Side.CLIENT)
public void renderEntry(Minecraft mc, int x, int y) {
	if (Codex.getStatusFor(mc.thePlayer, this) > 0) {
		this.g.bindTexture(this.icons);
		this.g.reset();
		if (Codex.getStatusFor(mc.thePlayer, this) == Codex.VISIBLE)
			this.g.setColor(new Color(0.25, 0.25, 0.25));
		if (Codex.getStatusFor(mc.thePlayer, this) == Codex.RESEARCHED) {
			double value = 0.85 + 0.15 * Math.sin(Minecraft.getSystemTime() / 200.0 + this.getID());
			this.g.setColor(new Color(value, value, value));
		}
		this.g.drawTexturedRect(x, y, (Codex.getStatusFor(mc.thePlayer, this) - 1) * 26, this.hasSpecialLayout ? 26 : 0, 26, 26);
		this.renderEntryIcon(mc, x + 5, y + 5);
	} else {
		this.g.bindTexture(this.icons);
		this.g.reset();
		this.g.setColor(new Color(0.25, 0.25, 0.25, 0.15));
		this.g.drawTexturedRect(x, y, 0, this.hasSpecialLayout ? 26 : 0, 26, 26);
	}
}

@SideOnly(Side.CLIENT)
public void renderEntryIcon(Minecraft mc, int x, int y) {
	if (this.isIconItem) {
		this.g.drawItemStack(this.iconItem, x, y, "");
	} else {
		this.g.bindTexture(this.labels);
		this.g.drawTexturedRect(x, y, this.iconX * 16, this.iconY * 16, 16, 16);
	}
}

@SideOnly(Side.CLIENT)
public void renderEntryTooltip(GuiCodexMagicum gui, Minecraft mc, int x, int y) {
	byte state = Codex.getStatusFor(mc.thePlayer, this);
	List<String> strings = new ArrayList<String>();
	strings.add(this.title);
	strings.add("" + EnumChatFormatting.GRAY + this.desc);
	strings.add("" + EnumChatFormatting.DARK_GRAY + EnumChatFormatting.ITALIC + I18n.format(this.getStatusText(state)));
	List<ItemStack> items = new ArrayList<ItemStack>();
	for (ItemStack s : this.researchHelpItems)
		items.add(s);
	List<Elements> elements = new ArrayList<Elements>();
	for (Elements e : this.researchHelpElements)
		elements.add(e);
	if (state == Codex.HIDDEN)
		return;
	if (state == Codex.VISIBLE) {
		gui.drawAdvancedTooltip(strings, items, elements, x, y, mc.fontRenderer);
	}
	if (state >= Codex.RESEARCHED) {
		gui.drawAdvancedTooltip(strings, new ArrayList<ItemStack>(), new ArrayList<Elements>(), x, y, mc.fontRenderer);
	}
}

/** Sets the given Codex Entry for the given Player to the status {@link Codex#VISIBLE} if it is hidden. */
public void reveal(EntityPlayer player) {
	if (PropertiesCodex.get(player).codexList.get(this.getID()) < Codex.VISIBLE) {
		PropertiesCodex.get(player).codexList.set(this.getID(), Codex.VISIBLE);
		Codex.updateCodexDependencies(player);
		if (player instanceof EntityPlayerMP)
			Codex.sendCodexChanges((EntityPlayerMP) player, this);
	}
}

/** Sets the colour of the lines */
public CodexEntry setLineColour(int lineColour) {
	this.lineColour = lineColour;
	return this;
}

/** Sets the required IDs to display this Entry.*/
public CodexEntry setRequiredIDs(int... requiredIDs) {
	this.requiredIDs = requiredIDs;
	return this;
}

/** Activates the Research Requirement for this Entry */
public CodexEntry setResearch(boolean needsResearch) {
	this.needsResearch = needsResearch;
	return this;
}

/** Sets the help information for this Entry */
public CodexEntry setResearchHelp(Elements... researchHelpElements) {
	this.researchHelpElements = researchHelpElements;
	return this;
}

/** Sets the help information for this Entry */
public CodexEntry setResearchHelp(ItemStack... researchHelpItems) {
	this.researchHelpItems = researchHelpItems;
	return this;
}

/** Activates the special layout for this Entry */
public CodexEntry setSpecialLayout(boolean hasSpecialLayout) {
	this.hasSpecialLayout = hasSpecialLayout;
	return this;
}

public boolean shouldBeAnnounced() {
	return true;
}

public boolean shouldShowCompletedOverlay() {
	return true;
}
}

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • KILAT77 : Waspada Situs Scam dengan Withdraw Yang Tidak Dibayar Di era digital saat ini, banyak orang yang mencari keberuntungan melalui situs perjudian online. Namun, dibalik gemerlap janji-janji manis kemenangan, ada bahaya yang mengintai. Salah satu situs yang patut diwaspadai adalah KILAT77. Situs ini mendapat reputasi buruk karena banyak laporan dari pengguna yang mengklaim bahwa mereka tidak bisa menarik dana kemenangan mereka. Dalam artikel ini, kita akan membahas mengapa ROTER88 dianggap sebagai situs scam dan bagaimana Anda bisa melindungi diri dari penipuan serupa. Pengalaman Pengguna: Penarikan Tidak Dibayar Beberapa pengguna telah melaporkan pengalaman buruk mereka dengan KILAT77. Mereka mengaku bahwa setelah memenangkan sejumlah uang dan mencoba menariknya, proses penarikan mereka ditolak tanpa alasan yang jelas. Bahkan, beberapa pengguna melaporkan bahwa akun mereka tiba-tiba diblokir setelah mencoba melakukan penarikan, sehingga mereka kehilangan akses ke dana mereka sama sekali.
    • It is a dupe mod issue Remove Rubidium - you are already using Embeddium which is a fork of Rubidium
    • I made a block entity in forge 1.20.1, I want to prevent hopper from taking input slot item, i tried to override the extractItem method, it prevented hopper from taking input slot item, but the player also unable to take/change the item in input slot unless the slot is empty. public class FluidSeparatorBlockEntity extends BlockEntity implements MenuProvider { private static final int INPUT_SLOT = 0; private final CustomItemHandler itemHandler = new CustomItemHandler(3){ @Override protected void onContentsChanged(int slot) { setChanged(); } @Override public boolean isItemValid(int slot, @NotNull ItemStack stack) { return slot == INPUT_SLOT; } @Override public @NotNull ItemStack extractItem(int slot, int amount, boolean simulate) { if (slot == INPUT_SLOT) { return ItemStack.EMPTY; } return super.extractItem(slot, amount, simulate); } }; private LazyOptional<IItemHandler> lazyItemHandler = LazyOptional.empty(); protected final ContainerData data; private int progress = 0; private int maxProgress = 78; public FluidSeparatorBlockEntity(BlockPos pPos, BlockState pBlockState) { super(ModBlockEntities.FLUID_SEPARATOR_BE.get(), pPos, pBlockState); this.data = new ContainerData() { @Override public int get(int pIndex) { return switch (pIndex) { case 0 -> FluidSeparatorBlockEntity.this.progress; case 1, 2 -> FluidSeparatorBlockEntity.this.maxProgress; default -> 0; }; } @Override public void set(int pIndex, int pValue) { switch (pIndex) { case 0 -> FluidSeparatorBlockEntity.this.progress = pValue; case 1, 2 -> FluidSeparatorBlockEntity.this.maxProgress = pValue; } } @Override public int getCount() { return 3; } }; } @Override public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) { if(cap == ForgeCapabilities.ITEM_HANDLER) { return lazyItemHandler.cast(); } return super.getCapability(cap, side); } @Override public void onLoad() { super.onLoad(); lazyItemHandler = LazyOptional.of(() -> itemHandler); } @Override public void invalidateCaps() { super.invalidateCaps(); lazyItemHandler.invalidate(); } public void drops() { SimpleContainer inventory = new SimpleContainer(itemHandler.getSlots()); for(int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, itemHandler.getStackInSlot(i)); } Containers.dropContents(this.level, this.worldPosition, inventory); } @Override public Component getDisplayName() { return Component.translatable("block.chemmaster.fluid_separator"); } @Nullable @Override public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) { return new FluidSeparatorMenu(pContainerId, pPlayerInventory, this, this.data); } @Override protected void saveAdditional(CompoundTag pTag) { pTag.put("inventory", itemHandler.serializeNBT()); pTag.putInt("fluid_separator.progress", progress); super.saveAdditional(pTag); } @Override public void load(CompoundTag pTag) { super.load(pTag); itemHandler.deserializeNBT(pTag.getCompound("inventory")); progress = pTag.getInt("fluid_separator.progress"); } public void tick(Level pLevel, BlockPos pPos, BlockState pState) { ItemStack inputStack = this.itemHandler.getStackInSlot(INPUT_SLOT); if (inputStack.getCount() < 2) { resetProgress(); return; } if(hasRecipe()) { increaseCraftingProgress(); setChanged(pLevel, pPos, pState); if(hasProgressFinished()) { craftItem(); resetProgress(); } } else { resetProgress(); } } private void resetProgress() { progress = 0; } private void craftItem() { Optional<FluidSeparatingRecipe> recipe = getCurrentRecipe(); if (recipe.isPresent()) { List<ItemStack> results = recipe.get().getOutputs(); ItemStack inputStack = this.itemHandler.getStackInSlot(INPUT_SLOT); if (inputStack.getCount() < 2) { // If there are not enough items, do not proceed with crafting return; } // Extract the input item from the input slot this.itemHandler.internalExtractItem(INPUT_SLOT, 2, false); // Loop through each result item and find suitable output slots for (ItemStack result : results) { int outputSlot = findSuitableOutputSlot(result); if (outputSlot != -1) { this.itemHandler.setStackInSlot(outputSlot, new ItemStack(result.getItem(), this.itemHandler.getStackInSlot(outputSlot).getCount() + result.getCount())); } else { // Handle the case where no suitable output slot is found // This can be logging an error, throwing an exception, or any other handling logic System.err.println("No suitable output slot found for item: " + result); } } } } private int findSuitableOutputSlot(ItemStack result) { // Implement logic to find a suitable output slot for the given result // Return the slot index or -1 if no suitable slot is found for (int i = 0; i < this.itemHandler.getSlots(); i++) { // Ensure we do not place the output item in the input slot if (i == INPUT_SLOT) { continue; } ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || (stackInSlot.getItem() == result.getItem() && stackInSlot.getCount() + result.getCount() <= stackInSlot.getMaxStackSize())) { return i; } } return -1; } private boolean hasRecipe() { Optional<FluidSeparatingRecipe> recipe = getCurrentRecipe(); if (recipe.isEmpty()) { return false; } List<ItemStack> results = recipe.get().getOutputs(); for (ItemStack result : results) { if (!canInsertAmountIntoOutputSlot(result) || !canInsertItemIntoOutputSlot(result.getItem())) { return false; } } return true; } private Optional<FluidSeparatingRecipe> getCurrentRecipe(){ SimpleContainer inventory = new SimpleContainer(this.itemHandler.getSlots()); for (int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, this.itemHandler.getStackInSlot(i)); } return this.level.getRecipeManager().getRecipeFor(FluidSeparatingRecipe.Type.INSTANCE, inventory, level); } private boolean canInsertAmountIntoOutputSlot(ItemStack result) { for (int i = 1; i < this.itemHandler.getSlots(); i++) { ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || (stackInSlot.getItem() == result.getItem() && stackInSlot.getCount() + result.getCount() <= stackInSlot.getMaxStackSize())) { return true; } } return false; } private boolean canInsertItemIntoOutputSlot(Item item) { for (int i = 1; i < this.itemHandler.getSlots(); i++) { ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || stackInSlot.getItem() == item) { return true; } } return false; } private boolean hasProgressFinished() { return progress >= maxProgress; } private void increaseCraftingProgress() { progress++; } }  
    • No dice. Unfortunately this fix didn't work, thank you though.
  • Topics

×
×
  • Create New...

Important Information

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