Entity Dismount Jitter

Discussion in 'Plugin Development' started by _TheTimelord_, Apr 13, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    _TheTimelord_

    Hey,

    I've been working on a plugin that involves using an armorstand as a way to move the player, and I've been having the player riding the armor stand. However, I ran into the issue of the EntityDismountEvent not having a cancel method. I worked around this by making a custom event, and used some suggestions from other threads I found online to be able to block the event. When the entity that the player is riding is sitting still, the only effect from pressing shift is the slight lowering of the player's viewpoint. However, I have encountered an issue that I believe may be due to client prediction: While moving, pressing shift causes the player to lag slightly behind the armorstand. Holding it down creates a visually awful effect, as the screen jumps rapidly between a viewpoint of where the player started holding down shift, and where they should currently be (on the armorstand). As I mentioned, it's possible this is due to the client predicting the dismount effect, however I have no way of knowing for sure. Can anybody here confirm whether or not this an unsolvable issue, or if I'm simply not canceling the method correctly? For reference, I'm overriding the ability to dismount the player from the armorstand using a custom entity.
     
  2. Offline

    Ragnarok_

    @_TheTimelord_
    Can I see some of you're code? Maybe I'll see what you're trying to do better.
     
  3. Offline

    _TheTimelord_

    @Ragnarok_
    Well, I'm hoping to avoid posting it as much as possible, as it's not exactly simple stuff and I wouldn't mind keeping as much of what I've been able to figure out with it private as I can. However, basically what you need to know is this:
    • I'm using a custom event to be able to cancel the player's dismount of the entity
    • When that event is canceled, I use "entity.a(this, true)" to cancel the dismount from the entity.
    • This works perfectly, the player remains on the entity when the entity is standing still.
    • The issue comes in when the entity is moving. The player jitters back and forth between the location where they started holding down shift and the location where the entity currently is, creating an effect so flashy that I honestly believe it could induce seizures in some people.
    • I'm trying to see if this issue is just client side, with the client expecting to dismount and so rendering from where it tried to dismount at, only to discover it's not there, rinse and repeat creating a laggy effect, or if the issue is somehow solvable and I'm just missing it.
    The issue isn't related to the code, as I can see that what I'm attempting to do functions perfectly when the entity the player is riding is standing still. The problem is when the player holds down shift (or, briefly, when they tap shift), the client renders momentarily from where the shift was pressed, which, when held down, is truly horrendously jarring.

    If you do require more code, I can consider sending some to you via PM.
     
    Last edited: Apr 13, 2017
  4. Offline

    Zombie_Striker

    @_TheTimelord_
    Listen to VehicleExitEvent. If the player is trying to dismount an armorstand, cancel the event.
     
  5. Offline

    _TheTimelord_

    @Zombie_Striker
    Note the name of the event you're listing: VehicleExitEvent. Unless the entity in question is a vehicle, that event isn't fired. And since most entities aren't vehicles (this isn't), this won't work here.

    And before anybody else suggests it, I am aware of the existence of an EntityDismountEvent. However, that event doesn't contain a setCancelled() method for some ungodly reason, even though it has an unused private bool for whether or not it's cancelled...
     
    Last edited: Apr 13, 2017
Thread Status:
Not open for further replies.

Share This Page