VoltzEngine-Project / Engine

Minecraft modding core lib
Other
13 stars 11 forks source link

Can't set client class field on server #7

Closed ams2990 closed 9 years ago

ams2990 commented 9 years ago

In PotionUtility.java#L24, the code tries to assign to the field "potionTypes" of class net.minecraft.potion.Potion. Clearly the field doesn't exist in the class, but I can't even find where the class is loaded from. AFAIK, that's a client class and shouldn't even exist on the server. Clearly it does because we're getting a NoSuchFieldException and not a NoClassDefFoundError. Either way, the potion array is not getting expanded like you are intending. If this is meant to be client-side only behavior, please modify the code so the reflective call is not made on the server.

The stack trace:

[06:12:22] [Server thread/ERROR]: catching
java.lang.NoSuchFieldException: potionTypes
    at java.lang.Class.getField(Class.java:1703) ~[?:1.8.0_40]
    at com.builtbroken.mc.lib.helper.ReflectionUtility.setMCField(ReflectionUtility.java:104) ~[ReflectionUtility.class:1.7.10-0.3.3b16]
    at com.builtbroken.mc.lib.helper.ReflectionUtility.setMCFieldWithCatch(ReflectionUtility.java:79) [ReflectionUtility.class:1.7.10-0.3.3b16]
    at com.builtbroken.mc.lib.helper.PotionUtility.resizePotionArray(PotionUtility.java:24) [PotionUtility.class:1.7.10-0.3.3b16]
    at com.builtbroken.mc.core.Engine.preInit(Engine.java:154) [Engine.class:1.7.10-0.3.3b16]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_40]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_40]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_40]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_40]
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) [FMLModContainer.class:git-Cauldron-Reloaded-1.7.10-1.1343.01.0]
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_40]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_40]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [minecraft_server.1.7.10.jar:?]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [minecraft_server.1.7.10.jar:?]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [minecraft_server.1.7.10.jar:?]
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [minecraft_server.1.7.10.jar:?]
    at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraft_server.1.7.10.jar:?]
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) [LoadController.class:git-Cauldron-Reloaded-1.7.10-1.1343.01.0]
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) [LoadController.class:git-Cauldron-Reloaded-1.7.10-1.1343.01.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_40]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_40]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_40]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_40]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [minecraft_server.1.7.10.jar:?]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [minecraft_server.1.7.10.jar:?]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [minecraft_server.1.7.10.jar:?]
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [minecraft_server.1.7.10.jar:?]
    at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraft_server.1.7.10.jar:?]
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:git-Cauldron-Reloaded-1.7.10-1.1343.01.0]
    at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) [Loader.class:git-Cauldron-Reloaded-1.7.10-1.1343.01.0]
    at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88) [FMLServerHandler.class:git-Cauldron-Reloaded-1.7.10-1.1343.01.0]
    at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:318) [FMLCommonHandler.class:git-Cauldron-Reloaded-1.7.10-1.1343.01.0]
    at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:176) [lt.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:620) [MinecraftServer.class:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_40]
DarkGuardsman commented 9 years ago

Its not so much the field doesn't exist but rather its renamed. The ReflectionUtility we use is not working correctly and has yet be fixed. What it should be doing is changing the name "potionTypes" to "field_76425_a".

ams2990 commented 9 years ago

So what's the impact of this not being fixed? I see the code is trying to expand the size of the internal potion array. What will that code path failing do?

DarkGuardsman commented 9 years ago

Nothing right now, which is why it has not been fixed. The code dates back from when Voltz Engine use to be called Resonant Engine. I keep the code around as it does work, but the reflection fails outside the dev workspace.

That being said I'll see if i can correct it sometime today, or apply a less noticeable crash log.

DarkGuardsman commented 9 years ago

Should be fixed now