Skip to main content

TicketValidation

Trait TicketValidation 

pub trait TicketValidation {
    // Required methods
    fn block_tickets(&self) -> Vec<([i32; 3], TicketSet)>;
    fn entity_tickets(&self) -> Vec<(u128, TicketSet)>;
    fn remove_block_tickets(&mut self, pos: [i32; 3]) -> usize;
    fn remove_entity_tickets(&mut self, uuid: u128) -> usize;
    fn remove_block_ticket(
        &mut self,
        pos: [i32; 3],
        chunk: [i32; 2],
        natural_spawning: bool,
    ) -> bool;
    fn remove_entity_ticket(
        &mut self,
        uuid: u128,
        chunk: [i32; 2],
        natural_spawning: bool,
    ) -> bool;
}
Expand description

The tickets one controller loaded, as validate_tickets hands them out (NeoForge’s TicketHelper, one for each controller). Every call acts as the mod marked as running, and only the controller’s owning mod sees or removes anything, block owners and entity owners apart. The game releases what was removed once the hook returns.

Required Methods§

fn block_tickets(&self) -> Vec<([i32; 3], TicketSet)>

The controller’s block tickets: each block position with the chunks it holds without and with natural spawning (TicketHelper.getBlockTickets’ TicketSet: nonNaturalSpawning, naturalSpawning), in position order.

fn entity_tickets(&self) -> Vec<(u128, TicketSet)>

The controller’s entity tickets: each entity UUID with the chunks it holds without and with natural spawning (TicketHelper.getEntityTickets), in UUID order.

fn remove_block_tickets(&mut self, pos: [i32; 3]) -> usize

Remove every ticket the block holds, of both kinds (removeAllTickets(BlockPos)): how many went.

fn remove_entity_tickets(&mut self, uuid: u128) -> usize

Remove every ticket the entity holds, of both kinds (removeAllTickets(UUID)).

fn remove_block_ticket( &mut self, pos: [i32; 3], chunk: [i32; 2], natural_spawning: bool, ) -> bool

Remove the block’s ticket of one kind on one chunk (removeTicket(BlockPos, ChunkPos, forceNaturalSpawning)): whether it held one. The other kind on the chunk stays.

fn remove_entity_ticket( &mut self, uuid: u128, chunk: [i32; 2], natural_spawning: bool, ) -> bool

Remove the entity’s ticket of one kind on one chunk (removeTicket(UUID, ChunkPos, forceNaturalSpawning)).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§