Posted January 10, 201411 yr When i try to add the RenderPlayerEvent to my event handler, i got this message when trying to launch Minecraft : 2014-01-10 11:09:09 [iNFO] [sTDERR] java.lang.InstantiationException 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30) 2014-01-10 11:09:09 [iNFO] [sTDERR] at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 2014-01-10 11:09:09 [iNFO] [sTDERR] at net.minecraftforge.event.EventBus.register(EventBus.java:76) 2014-01-10 11:09:09 [iNFO] [sTDERR] at net.minecraftforge.event.EventBus.register(EventBus.java:58) 2014-01-10 11:09:09 [iNFO] [sTDERR] at fr.stoneline.StoneLineMod.<init>(StoneLineMod.java:82) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 2014-01-10 11:09:09 [iNFO] [sTDERR] at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 2014-01-10 11:09:09 [iNFO] [sTDERR] at java.lang.Class.newInstance0(Class.java:357) 2014-01-10 11:09:09 [iNFO] [sTDERR] at java.lang.Class.newInstance(Class.java:310) 2014-01-10 11:09:09 [iNFO] [sTDERR] at cpw.mods.fml.common.ILanguageAdapter$JavaAdapter.getNewInstance(ILanguageAdapter.java:174) 2014-01-10 11:09:09 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:519) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2014-01-10 11:09:09 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267) 2014-01-10 11:09:09 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:194) 2014-01-10 11:09:09 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:174) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2014-01-10 11:09:09 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267) 2014-01-10 11:09:09 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:105) 2014-01-10 11:09:09 [iNFO] [sTDERR] at cpw.mods.fml.common.Loader.loadMods(Loader.java:509) 2014-01-10 11:09:09 [iNFO] [sTDERR] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:183) 2014-01-10 11:09:09 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:473) 2014-01-10 11:09:09 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:808) 2014-01-10 11:09:09 [iNFO] [sTDERR] at net.minecraft.client.main.Main.main(Main.java:93) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2014-01-10 11:09:09 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597) 2014-01-10 11:09:09 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) 2014-01-10 11:09:09 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.main(Launch.java:27) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2014-01-10 11:09:09 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2014-01-10 11:09:09 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597) 2014-01-10 11:09:09 [iNFO] [sTDERR] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Here is the event function : EntityExtendedPlayer represents the StoneLine Extended Player used to add abilities to the player and for the StoneLine Extended Inventory. isSitting is setted to true by server. I explain : Client press sit down key, Server retrieve packet, set the player as sitting. In a server tick handler, i'm parsing the player entries and for each sitting player, i send a packet to all tracking other entities and at the sitting player itself. Finally a packet is coming to all tracking players and to the sitting players ; for each client, it set the player's sitting variable to true. After in a render event (under), i destroy the current RenderPlayer, to prepare creation of a new RenderPlayer ! Like that, normally (and actually) other players will see the sitting players as not here (invisible because i cancell the render event). @ForgeSubscribe public void onRenderPlayer(RenderPlayerEvent event){ if (event.entity instanceof EntityPlayer){ EntityExtendedPlayer player = EntityExtendedPlayer.get((EntityPlayer)event.entity); if (player.isSitting){ event.setCanceled(true); } } }
January 10, 201411 yr Author Ok but there is only one event that handles player renderer. Are you telling that it's impossible to change the player render ?
January 10, 201411 yr Author Found them ! But this is useless... With many tests, i can assure you that making the player sitting down like Minefield in Minecraft Forge 1.6.4 (without base edit) is completely impossible ! The problem : - Server recieve correctly the sit command from client, - Server send correctly the packet to all tracking entities, - On client side there is no entity list, so the other player are not on the client ; and by that i can't get the instance of the sitting player in other's tracking player client. In other words : The client in multiplayer does not store any connected player of the server. So it's impossible to make other's seeing a different render on one player ! But this is giving another question : Why people can see others on server ? If there is no player list on client, How clients can render server entities ?
January 10, 201411 yr Author Thank you so much ! You solution does work on MCPC + 1.6.4 + PlayerAPI + SmartMouving and many other mods ! Only problem : Does not work in Singleplayer ! Now when i press the key : you see nothing ! The rendering is ok : Destroying and Deleting ModelPlayer & RenderPlayer instances ! The mini problem now is to recreate these instances... Because the garbage collector is removing these instances from the RAM... In plus don't press the Sneak key otherwise game will crash due to no ModelPlayer !
January 10, 201411 yr Author That's finished ! Now stevy is able to sit down in Multiplayer and Singleplayer !
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.