-
Notifications
You must be signed in to change notification settings - Fork 0
FML Setup Event
The FML Setup annotations provide a declarative way to register items and wood types that require special client-side setup during the FML client setup phase. These annotations automatically handle the registration of bow, crossbow, shield, instrument, and wood type objects for proper client-side initialization.
The FML Setup annotations are responsible for:
- Automatically registering items that require special client-side rendering setup
- Managing wood types that need client-side registration
- Eliminating manual event handler registration for common setup tasks
- Ensuring proper timing of client-side setup during the FML lifecycle
The FML Setup system operates through the following process:
- Annotation Processing: Each setup annotation is processed by its corresponding strategy implementation during the field scanning phase
-
Field Extraction: The annotated field value is extracted using reflection and added to the appropriate static list in
FMLClientSetupEventHandler -
Event Registration: All registered items are processed during the
FMLClientSetupEventusing dedicated client setup strategies - Client Setup: Each item type receives its specific client-side configuration (rendering properties, models, etc.)
The annotations are processed within the FMLClientSetupEventHandlerAnnotationProcessorAdapter scope, ensuring they execute at the correct time in the mod initialization lifecycle.
Apply the appropriate setup annotation to any static field that holds the item or wood type you want to register:
public final class ExampleItems {
@SetupBow
public static final DeferredItem<?> EXAMPLE_BOW = ITEM_FACTORY.createBow("example_bow");
@SetupCrossbow
public static final DeferredItem<?> EXAMPLE_CROSSBOW = ITEM_FACTORY.createCrossbow("example_crossbow");
@SetupShield
public static final DeferredItem<?> EXAMPLE_SHIELD = ITEM_FACTORY.createShield("example_shield");
@SetupInstrument
public static final DeferredItem<?> EXAMPLE_INSTRUMENT = ITEM_FACTORY.createInstrument("example_instrument", ExampleInstrumentTags.EXAMPLE);
}
public final class ExampleWoodTypes {
@SetupWoodType
public static final WoodType EXAMPLE_WOOD_TYPE = WoodTypeFactory.create("example", ExampleBlockSetTypes.EXAMPLE);
}- @SetupBow: Registers bow items for client-side setup and FOV modification handling
- @SetupCrossbow: Registers crossbow items for client-side setup
- @SetupShield: Registers shield items for client-side setup
- @SetupInstrument: Registers instrument items for client-side setup
- @SetupWoodType: Registers wood types for client-side setup
The FML Setup system can be extended by:
- Creating New Annotations: Define new field-level annotations following the same pattern
-
Implementing Strategies: Create new
FieldAnnotationStrategyimplementations that extend the system -
Adding Client Setup Strategies: Implement new
ClientSetupStrategyclasses for custom client-side logic -
Modifying Event Handlers: Extend
FMLClientSetupEventHandlerto support additional item types
Use FML Setup annotations when:
- Creating items that require special client-side rendering setup (bows, crossbows, shields, instruments)
- Defining custom wood types that need client-side registration
- You want to avoid manual event handler registration for common setup tasks
- You need to ensure proper timing of client-side initialization
🚀 Getting Started
🧩 Core Concepts
⚙️ Data Generation
- ⚙️ Advancement
- ⚙️ Damage Type
- ⚙️ Chest Loot Modifier
- ⚙️ Recipe
- ⚙️ Sound
- ⚙️ Jukebox Song
- ⚙️ Enchantment
- ⚙️ Trim Material
- ⚙️ Trim Pattern
- ⚙️ Banner Pattern
- ⚙️ Painting Variant
- ⚙️ Particle Sprite Set
- ⚙️ Wolf Variant
- ⚙️ Item Model
- ⚙️ Block Model
- ⚙️ Block Loot Table
- ⚙️ Tag
- ⚙️ Language Translation
- ⚙️ World Feature
- ⚙️ Custom Properties
🚨 Events
🛠 Engine Layers
🧪 Resources
- 🧪 Examples