Skip to main content
Version: GeckoLib5

DataTickets

DataTickets are "Keys" to data stored in the GeoRenderState.

Overview

When storing or retrieving data from a GeoRenderState, GeckoLib requires that you provide a DataTicket to identify the data. This acts as the identifier for the specific data point.

Creating a DataTicket

To create a DataTicket, create a public static final field of type DataTicket somewhere relevant to you. For example, if your DataTicket is related to your entity, you might put it in your entity class.

Then, you create the DataTicket instance, using one of the two available factory methods:

If your DataTicket does not have a generic type:

public static final DataTicket<Boolean> EXAMPLE_BOOLEAN_TICKET = DataTicket.create("example_boolean", Boolean.class);

Built-in DataTickets

GeckoLib provides and uses a number of built-in DataTickets.
These can be found in the DataTickets class.

Third-Party DataTickets

If you need to utilise a DataTicket that another mod has created, you don't need to add a hard-dependency on that mod. Instead, you can simply create a new DataTicket with the same id, and GeckoLib will automatically give you the same DataTicket that the other mod has.

Using a DataTicket

Once you have created a DataTicket, you can use it to store or retrieve data from a GeoRenderState instance.