Jump to content

Recommended Posts

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

Posted

It just returns an instance of EntityPlayer. I have already verified that .stepHeight value is being changed using debugging.

public EntityPlayer getThePlayer() {
        return thePlayer;
}

Posted

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.

Posted

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.

Posted

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.

Posted

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

Posted

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

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

Announcements



×
×
  • Create New...

Important Information

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