Posted November 15, 20159 yr I have piece of armour that increases the player's jump height when worn. I have achieved this by using the living jump event, which works fine in single player, but on multiplayer the effect triggers when the player wearing the item is attack or otherwise knocked back/upward. I am trying to avoid using keybinds, which is why I am using the jump event. I am just not sure why it fires when the jump key isn't pressed. I have tried checking is the player was recently hurt and not proceeding if true, but that doesn't seem like a great way to do it. I've been trying to fix this for several days, and that's the best I could come up with, so suggestions would be greatly appreciated.
November 15, 20159 yr Give the player jump boost for 0 tick whenever he is wearing the armor piece. If the player only requires one armor piece to activate the jump effect you can do this by overwriting the onArmorTick method in you ItemArmor class, and do it there. If the player requires more than one armor piece you'll have to do it in some event and check if the player is wearing the armor. I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.
November 15, 20159 yr Author I would rather do this without using the jump boost potion effect on armour tick, and like I said I have already got a working jump boost. My question wasn't how to make the player jump higher, but why does livingJump trigger when the player is knocked and how can I prevent it.
November 16, 20159 yr It's strange. I traced the jump event call hierarchy and there is one place that might be a bit buggy. In NetHandlerPlayServer, in the processPlayer(C03PlayerPacket) it calls a player jump() method based on the following logic: if (this.playerEntity.onGround && !packetIn.isOnGround() && d12 > 0.0D) { this.playerEntity.jump(); } And d12 is simply the player posY. I'm not really sure why it is checking if the Y position is greater than 0.0D because that position is down in the ground, I guess it is just to disallow jumping if you're falling through the bottom? What is interesting is that it isn't looking at the isJumping boolean, but simply based on if the player update says that the player isn't on the ground! So I think it may be a bug because I assume that the isOnGround() would also be false when knocked back, falling, and so forth. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
November 16, 20159 yr Author I had guessed it was something like checking the Y motion, or what not. Just thought it was really odd, as it seems like a bug. I can work around it with a keybind for my item, instead of livingJump (just didn't really want to), unless anyone has a good idea on a work around. Also, would it be a good idea to report this as a bug?
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.