_initExtension_ is called whenever G-Earth loads the extension, it's specially useful to init the _HashSupport_ and other features, we'll use it in the following examples
The _intercept_ method lets us intercept a packet from its id and modify it if we want to. Typically, we use this function call inside _initExtension_.
If (and only if) the _onClick_ method is overridden by your extension, G-Earth will display a green "Start" button next to your extension and the function will get called on-click. For form extensions, this option is automatically used to open the GUI. For non-gui extensions, this is an additional feature you could use.
_ChatConsole_ is a new G-Earth feature that allows us to use the in-game chat in order to easily communicate with the extension, it can read your input and write messages, you can also set a welcome message, we'll add it to our example.
(side note: the implementation of ChatConsole hides the whole thing from the Habbo servers, so all interaction stays local)
The main difference is that instead of extending from _Extension_ we'll extend from _ExtensionForm_. This introduces some changes, for example, in order to call to our extension in _main_, we'll call _runExtensionForm_ instead of the constructor.
```java
public class SampleExtension extends ExtensionForm {
public static void main(String[] args) {
runExtensionForm(args, SampleExtension.class);
}
}
```
Since _ExtensionForm_ is an abstract class, we'll have to implement _launchForm_ in order to setup the javafx components
```java
public ExtensionForm launchForm(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("sampleextension.fxml"));
Parent root = loader.load();
primaryStage.setTitle("Sample extension");
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
return loader.getController();
}
```
Assuming you've created the .fxml file, this code would be enough for G-Earth to load your extension.