Class Gravity

java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.Gravity
All Implemented Interfaces:
Runnable, Toggleable, Listener

public class Gravity extends Trait implements Toggleable
Enable/disable Minecraft's gravity.
  • Constructor Details

    • Gravity

      public Gravity()
  • Method Details

    • gravitate

      public void gravitate(boolean gravitate)
      Set whether to disable gravity or not
      Parameters:
      gravitate - true = disable gravity, false = enable gravity
    • hasGravity

      public boolean hasGravity()
    • onSpawn

      public void onSpawn()
      Description copied from class: Trait
      Called when an NPC is spawned. NPC.getEntity() will return null until this is called. This is also called onAttach when the NPC is already spawned.
      Overrides:
      onSpawn in class Trait
    • run

      public void run()
      Description copied from class: Trait
      Called every tick if overridden.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Trait
    • setEnabled

      public void setEnabled(boolean enabled)
    • toggle

      public boolean toggle()
      Specified by:
      toggle in interface Toggleable