Class TicketHelper

java.lang.Object
net.neoforged.neoforge.common.world.chunk.TicketHelper

public class TicketHelper extends Object
Class to help mods remove no longer valid tickets before they are activated on load.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Map<net.minecraft.core.BlockPos,TicketSet>
     
    private final net.minecraft.resources.ResourceLocation
     
    private final Map<UUID,TicketSet>
     
    private final net.minecraft.world.level.TicketStorage
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TicketHelper(net.minecraft.world.level.TicketStorage saveData, net.minecraft.resources.ResourceLocation controllerId, Map<net.minecraft.core.BlockPos,TicketSet> blockTickets, Map<UUID,TicketSet> entityTickets)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<net.minecraft.core.BlockPos,TicketSet>
    Returns all "BLOCK" tickets this controller had registered and which block positions are forcing which chunks.
    Returns all "ENTITY" tickets this controller had registered and which entity (UUID) is forcing which chunks.
    void
    Removes all tickets that a given entity (UUID) was responsible for; both normal and ones forcing natural spawning.
    void
    removeAllTickets(net.minecraft.core.BlockPos owner)
    Removes all tickets that a given block was responsible for; both normal and ones forcing natural spawning.
    private <T extends Comparable<? super T>>
    void
    removeAllTickets(ForcedChunkManager.TicketTracker<T> tickets, T owner, @Nullable TicketSet existingTickets)
    Removes all tickets that a given owner was responsible for; both normal and ones forcing natural spawning.
    void
    removeTicket(UUID owner, long chunk, boolean forceNaturalSpawning)
    Removes the ticket for the given chunk that a given entity (UUID) was responsible for.
    void
    removeTicket(net.minecraft.core.BlockPos owner, long chunk, boolean forceNaturalSpawning)
    Removes the ticket for the given chunk that a given block was responsible for.
    private <T extends Comparable<? super T>>
    void
    removeTicket(ForcedChunkManager.TicketTracker<T> tickets, T owner, long chunk, boolean forceNaturalSpawning)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • blockTickets

      private final Map<net.minecraft.core.BlockPos,TicketSet> blockTickets
    • entityTickets

      private final Map<UUID,TicketSet> entityTickets
    • saveData

      private final net.minecraft.world.level.TicketStorage saveData
    • controllerId

      private final net.minecraft.resources.ResourceLocation controllerId
  • Constructor Details

    • TicketHelper

      TicketHelper(net.minecraft.world.level.TicketStorage saveData, net.minecraft.resources.ResourceLocation controllerId, Map<net.minecraft.core.BlockPos,TicketSet> blockTickets, Map<UUID,TicketSet> entityTickets)
  • Method Details

    • getBlockTickets

      public Map<net.minecraft.core.BlockPos,TicketSet> getBlockTickets()
      Returns all "BLOCK" tickets this controller had registered and which block positions are forcing which chunks.
      Returns:
      all "BLOCK" tickets this controller had registered and which block positions are forcing which chunks
    • getEntityTickets

      public Map<UUID,TicketSet> getEntityTickets()
      Returns all "ENTITY" tickets this controller had registered and which entity (UUID) is forcing which chunks.
      Returns:
      all "ENTITY" tickets this controller had registered and which entity (UUID) is forcing which chunks
    • removeAllTickets

      public void removeAllTickets(net.minecraft.core.BlockPos owner)
      Removes all tickets that a given block was responsible for; both normal and ones forcing natural spawning.
      Parameters:
      owner - Block that was responsible.
    • removeAllTickets

      public void removeAllTickets(UUID owner)
      Removes all tickets that a given entity (UUID) was responsible for; both normal and ones forcing natural spawning.
      Parameters:
      owner - Entity (UUID) that was responsible.
    • removeAllTickets

      private <T extends Comparable<? super T>> void removeAllTickets(ForcedChunkManager.TicketTracker<T> tickets, T owner, @Nullable @Nullable TicketSet existingTickets)
      Removes all tickets that a given owner was responsible for; both normal and ones forcing natural spawning.
    • removeTicket

      public void removeTicket(net.minecraft.core.BlockPos owner, long chunk, boolean forceNaturalSpawning)
      Removes the ticket for the given chunk that a given block was responsible for.
      Parameters:
      owner - block that was responsible
      chunk - chunk to remove ticket of
      forceNaturalSpawning - whether the ticket to remove represents a ticket that is forcing natural spawning
    • removeTicket

      public void removeTicket(UUID owner, long chunk, boolean forceNaturalSpawning)
      Removes the ticket for the given chunk that a given entity (UUID) was responsible for.
      Parameters:
      owner - entity (UUID) that was responsible
      chunk - chunk to remove ticket of
      forceNaturalSpawning - whether the ticket to remove represents a ticket that is forcing natural spawning
    • removeTicket

      private <T extends Comparable<? super T>> void removeTicket(ForcedChunkManager.TicketTracker<T> tickets, T owner, long chunk, boolean forceNaturalSpawning)