Class SidedListProvider<T>

java.lang.Object
etithespirit.orimod.util.collection.SidedListProvider<T>
Type Parameters:
T - The type of element to store.

public final class SidedListProvider<T> extends Object
A provider of two, distinct List instances, one for each side of the game. This is strictly useful in singleplayer setups, where a statically bound list benefits a class and a different list is needed on the client and server for thread safety or to differentiate between a reference for the server vs for the client.
Author:
Eti
  • Constructor Details

    • SidedListProvider

      public SidedListProvider()
      Construct a new provider without strict element tracking.
  • Method Details

    • getListForSide

      public List<T> getListForSide(boolean isClient) throws IllegalArgumentException
      Returns the list appropriate for this side.
      Parameters:
      isClient - Whether or not to return the client list.
      Returns:
      The list appropriate for the current side, be it a client vs. dedicated/integrated server.
      Throws:
      IllegalArgumentException - If isClient is true and this is running in a dedicated (not integrated) server build of Minecraft.