Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6616

Cancellable StriderTemperatureChangeEvent

    XMLWordPrintable

Details

    • New Feature
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • None
    • None
    • None
    • All versions 1.16.1+ (I'm not listing all the versions)
    • Yes

    Description

      The StriderTemperatureChangeEvent is tedious/ineffective to use for the purposes of keeping a strider in the non-shivering state, requiring it to be set with a short delay every time the event fires. If you try to do it during the event, it just doesn't work, as the state finishes changing when the event concludes. If you try to do it after a 0 tick delay (so right when the current thread finishes) it... turns into a funky strobe boi.

       

      // Literally does nothing
      @EventHandler public void onStriderTemperatureChangeEvent(StriderTemperatureChangeEvent event) {
        Bukkit.getLogger().info("temp changed");
        Strider strider = event.getEntity();
        if (event.isShivering()) {
          strider.setShivering(false);
        }
      }
      
      // Strobe boi
      @EventHandler
      public void onStriderTemperatureChangeEvent(StriderTemperatureChangeEvent event) {
        Bukkit.getLogger().info("temp changed");
        Strider strider = event.getEntity();
        if (event.isShivering()) {
          Bukkit.getScheduler().runTaskLater(plugin, () -> strider.setShivering(false), 0L);
        }
      }

       

      Could the event just be cancellable, to simplify the process of locking a strider in a particular state?

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            kattreinkyle@gmail.com Kyle
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: