Entrypoints are a specific type of extension that allows mods to inject code that will run as the game is starting up. They can be thought of as like the `main()` function in a full Program, and are primarily used for adding things to registries, declaring callbacks and events, and other tasks your mod needs to do once during startup.
## `MainExtension`
The `MainExtension` entrypoint contains the core of your mod's initialization code. `MainExtension` will run during the startup sequence on both the server and the client, and thus should be populated with things like registrations (i.e. of blocks, items, entities) and events that are triggered on both the server and client side.
The first step to creating a MainExtension entrypoint is to create a class. This should usually be in the root package of your mod, but does not have to be. For this example, we will create a class called `ExampleInit` that implements the interface `MainExtension`:
```java
package com.example.examplemod;
public class ExampleInit implements MainExtension {
...
}
```
Once this class is created, add it under the `[frog.extensions]` table in your `frog.mod.toml` file with the key `init`:
```toml
[frog.extensions]
...
init = "com/example/examplemod/ExampleInit"
...
```
The interface `MainExtension` contains one method, called `onInit`. It takes one `ModProperties` object and returns `void`. We will implement this method by adding a Logger and printing a message:
public final Logger LOGGER = LoggerFactory.getLogger("ExampleMod");
public class ExampleInit implements MainExtension {
@Override
public void onInit(ModProperties mod) {
LOGGER.info("ribbit world");
}
}
```
Now, when we launch the game with the example mod installed, we will see that message sent when our mod is initialized.
## `ClientExtension`
The `ClientExtension` is very similar to the `MainExtension` in its function as an entrypoint, except it will only run if the mod is installed on the client. This is primarily used for modifying the behavior of rendering, like through custom models or renderers, as well as keybinds and other interactions that are only processed on the client side. To create a ClientExtension entrypoint, the process is very similar; first, we will create a class implementing the interface `ClientExtension`. This class should be annotated with the `@ClientOnly` annotation so that it is only loaded into the classpath on the client. Usually it should be placed in a package specifically for client-related classes.
`ServerExtension` is very similar to `ClientExtension` in implementation, except it runs only on the dedicated server. It does **not** run on the internal server. To create a ServerExtension entrypoint, create a class implementing `ServerExtension` annotated with `@ServerOnly`.