类 SimpleTicket<T>

java.lang.Object
net.neoforged.neoforge.common.ticket.SimpleTicket<T>
类型参数:
T - The type that will be used to check if your ticket matches
直接已知子类:
AABBTicket

public abstract class SimpleTicket<T> extends Object
Common class for a simple ticket based system.
  • 字段详细资料

    • masterManager

      @Nullable private @Nullable ITicketManager<T> masterManager
    • dummyManagers

      private ITicketManager<T>[] dummyManagers
    • isValid

      protected boolean isValid
  • 构造器详细资料

    • SimpleTicket

      public SimpleTicket()
  • 方法详细资料

    • setManager

      @SafeVarargs public final void setManager(ITicketManager<T> masterManager, ITicketManager<T>... dummyManagers)
      Internal method that sets the collection from the managing system.
      Should not be called if you just want to register a ticket to a system like the FarmlandWaterManager
    • isValid

      public boolean isValid()
      Checks if your ticket is still registered in the system.
    • invalidate

      public void invalidate()
      Removes the ticket from the managing system. After this call, any calls to isValid() should return false unless it is registered again using validate()
    • unload

      public boolean unload(ITicketManager<T> unloadingManager)
      Called by the managing system when a ticket wishes to unload all of it's tickets, e.g. on chunk unload
      The ticket must not remove itself from the manager that is calling the unload! The ticket must ensure that it removes itself from all of it's dummies when returning true
      参数:
      unloadingManager - The manager that is unloading this ticket
      返回:
      true if this ticket can be removed, false if not.
    • validate

      public void validate()
      Re-adds your ticket to the system.
    • matches

      public abstract boolean matches(T toMatch)
    • forEachManager

      protected final void forEachManager(Consumer<ITicketManager<T>> consumer)
    • getMasterManager

      protected final ITicketManager<T> getMasterManager()
    • getDummyManagers

      protected final ITicketManager<T>[] getDummyManagers()