Class WorldEventType.Builder<T extends WorldEventInstance>

java.lang.Object
team.lodestar.lodestone.modules.toolkit.worldevent.WorldEventType.Builder<T>
Enclosing class:
WorldEventType

public static class WorldEventType.Builder<T extends WorldEventInstance> extends Object
  • Method Details

    • of

      public static <T extends WorldEventInstance> WorldEventType.Builder<T> of(WorldEventType.EventInstanceSupplier<T> supplier, net.minecraft.resources.ResourceLocation id)
      Creates a new world event type.
      Parameters:
      supplier - The supplier for the event instance.
      id - The ID of the event type.
      Returns:
      A new Builder instance for the specified event type.
    • clientSynced

      public WorldEventType.Builder<T> clientSynced(@Nullable Supplier<WorldEventRenderer<T>> rendererSupplier)
      Sets the event to be client-synced and assigns a renderer for the event. The event will be automatically synced upon creation in WorldEventInstance.sync(net.minecraft.world.level.Level).
      Parameters:
      rendererSupplier - The renderer supplier for the event. Set to null if you don't want a renderer for this world event.
      Returns:
      The builder instance with the clientSynced flag set and the renderer assigned.
    • clientSynced

      public WorldEventType.Builder<T> clientSynced()
      Sets the event to be client-synced without assigning a renderer. The event will be automatically synced upon creation in WorldEventInstance.sync(net.minecraft.world.level.Level).

      If you want to use a renderer, use clientSynced(Supplier) instead.

      Returns:
      The builder instance with the clientSynced flag set and no renderer assigned.
    • withCommandCodec

      public WorldEventType.Builder<T> withCommandCodec(CommandCodec<? extends WorldEventInstance> commandCodec)
      Sets the command codec for the world event type.

      If you never call this you won't be able to construct world events using commands (/lodestone worldevent create)

      Parameters:
      commandCodec - The command codec
      Returns:
      The builder instance with the command codec set.
    • build

      public WorldEventType build()
      Builds the WorldEventType with the specified parameters. Registers the renderer if it is set.
      Returns:
      The built WorldEventType.