Posted January 17, 201510 yr I had this working in 1.6, but for the life of me, I cannot get it working in 1.7. This is what I have tried: In SSP: Case 1: Client Thread: player.stepHeight = 1.0F Server Thread: player.stepHeight = 0.5F Outcome: Works Case 2: Client Thread: player.stepHeight = 0.5F Server Thread: player.stepHeight = 1.0F Outcome: Does not work Case 1: Client Thread: player.stepHeight = 1.0F Server Thread: player.stepHeight = 1.0F Outcome: Does not work In SMP: Case 1: Client: player.stepHeight = 1.0F Server: player.stepHeight = 0.5F Outcome: Does not work Case 2: Client: player.stepHeight = 0.5F Server: player.stepHeight = 1.0F Outcome: Does not work Case 1: Client: player.stepHeight = 1.0F Server: player.stepHeight = 1.0F Outcome: Does not work How do I get the step height modified in both SSP and SMP? This is the code I am running inside of a LivingEntityUpdate event handler. And I have verified through debugging the values are what I expect them to be. if (this.getExtraData().getInteger("agility_toggle") == 1) { this.getThePlayer().stepHeight = Math.min(2.0F, 0.5F + (this.getSkillList().agility.getEffectiveLevel() - 20) * 0.05F); } else { this.getThePlayer().stepHeight = 0.5F; }
January 17, 201510 yr Show the code for getThePlayer() Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
January 18, 201510 yr Author It just returns an instance of EntityPlayer. I have already verified that .stepHeight value is being changed using debugging. public EntityPlayer getThePlayer() { return thePlayer; }
January 18, 201510 yr Where do you create the field "thePlayer". If you use something like Minecraft.getMinecraft().thePlayer, it only works on the client side. It might be helpful to look at how Vazkii does it. Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
January 18, 201510 yr Author If it is client side, thePlayer comes from Minecraft.getMinecraft().thePlayer. If it is server side, it comes from the PlayerEvent.PlayerLoggedInEvent event. This class is basically a wrapper class for EntityPlayer.
January 18, 201510 yr PlayerLoggedInEvent happens for every player that logs in to the server, though, so if you do a direct assignation, you would only ever be able to return one player out of all the players online. Might explain why you are having trouble getting it to work multiplayer, though I thought that the player's step height only mattered on the client. http://i.imgur.com/NdrFdld.png[/img]
January 19, 201510 yr Author That is what I thought too. Here is how I am trying to trigger it: When a player logs in, we create an instance of a wrapper class around entityPlayer to tracker a bunch of stuff. That instance is store in a data structure for tracking players we can retrieve at a latter point and time. An instance of this class is also created locally too. We use the proxy too access the wrapper. The player presses a KeyBind (client side obviously) and it toggles a flag that will override the player stepHeight in LivingEntityUpdate event. That all happens client side and it was not working, so I added a packet to send server side to override it server side in that LivingEntityUpdate event also.
January 19, 201510 yr Ok, so? Did it work? Or is there still a problem? Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
January 19, 201510 yr The player presses a KeyBind (client side obviously) and it toggles a flag that will override the player stepHeight in LivingEntityUpdate event. That all happens client side and it was not working, so I added a packet to send server side to override it server side in that LivingEntityUpdate event also. Sounds like you may have a problem with how you are storing the player. At any rate, I have an item in one of my mods that increases the player's step height - I do so only on the client side and it works fine. You should try toggling the step height directly on the client (you don't need any update event to mess with this): @SubscribeEvent public void onKeyInput(KeyInputEvent event) { Minecraft mc = Minecraft.getMinecraft(); // or store the instance as a class field if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == mc.gameSettings.keyBindWhatever.getKeyCode()) { mc.thePlayer.stepHeight += (yourToggleFlag ? 1.0F : -1.0F); } } http://i.imgur.com/NdrFdld.png[/img]
January 20, 201510 yr Author At any rate, I have an item in one of my mods that increases the player's step height - I do so only on the client side and it works fine. And you have no problems with in SMP? I will try it out and let you know if I have any issues with it.
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.