Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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;
        }

  • 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;
}

  • 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.

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.

  • 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.

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);
}
}

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.