Interface NoDurability


@NonExtendable public interface NoDurability
No Durability for an elytra, and a catch of a glide dropped in mid-air: one engine per flight (Elytra.noDurability(NoDurability.Owner)), enabled while it flies. Only one runs at a time: of those enabled, the last one enabled for a pilot's flight, else the last one enabled; the others wait meanwhile.

The server wears an elytra by one for every 20 ticks of gliding without a break. Where Grim simulates the glide (2b2t), the elytra is swapped for a chestplate in the off hand or hotbar while you glide, so the server stops the glide on its next tick; the client keeps gliding through that (GlideHold), and every 8 ticks the elytra goes back on just long enough to start the glide again (jump pressed, as vanilla starts one). The server never glides you for more than a tick in one go. Rockets used meanwhile go out in those moments, when the server takes them; something to eat waits for the swapping to stop. Swaps only run with room around you, and not into chunks Grim doesn't count as yours yet. Elsewhere (no anti-cheat, or one that doesn't simulate the glide, like NoCheatPlus) the glide is broken with two glide starts instead, holding still for a tick, and no chestplate is needed.

The catch, on either way: the glide stopping in mid-air with nothing a player would stop it for opens the elytra again at once, unless you'd land without hurting.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Who runs it: whether swapping is on, and where its messages go.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    chestplateAtHand(boolean mayStop)
    Whether the chestplate (or, while it's worn, the elytra) is at hand to swap with, bringing it into the hotbar if not (see ChestSwap.ensurePair(boolean)); warns the owner once when it can't be.
    boolean
    Whether swaps had to wait for chunks Grim doesn't count as yours lately: a fast flight should slow down.
    void
    Stops, with the elytra back on and the glide started again if the server had stopped it.
    void
    Starts watching the glide; listens for input, item use and setbacks on its own from now.
    boolean
    Whether the elytra and chestplate are being swapped (or the elytra put back for good) right now.
    void
    Call once a tick while enabled, in TickEvent.Pre before the tick's actions (Priority.BEFORE_ACTIONS + 10) and after your own flight: a restart sends held ping answers, which have to go first.
  • Method Details

    • enable

      void enable()
      Starts watching the glide; listens for input, item use and setbacks on its own from now.
    • disable

      void disable()
      Stops, with the elytra back on and the glide started again if the server had stopped it.
    • tick

      void tick()
      Call once a tick while enabled, in TickEvent.Pre before the tick's actions (Priority.BEFORE_ACTIONS + 10) and after your own flight: a restart sends held ping answers, which have to go first.
    • swapping

      boolean swapping()
      Whether the elytra and chestplate are being swapped (or the elytra put back for good) right now.
    • chunksLate

      boolean chunksLate()
      Whether swaps had to wait for chunks Grim doesn't count as yours lately: a fast flight should slow down.
    • chestplateAtHand

      boolean chestplateAtHand(boolean mayStop)
      Whether the chestplate (or, while it's worn, the elytra) is at hand to swap with, bringing it into the hotbar if not (see ChestSwap.ensurePair(boolean)); warns the owner once when it can't be.