> For the complete documentation index, see [llms.txt](https://ae.advancedplugins.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ae.advancedplugins.net/for-developers/create-custom-effects-2.md).

# Create Custom Targets

### Using AE's API for Target Registration

To integrate custom targets into the AdvancedEnchantments system, developers must utilize the `AEAPI` class from the `net.advancedplugins.ae.api` package. The crucial method in this process is `registerTarget`, defined in the `AEAPI` class.

#### `registerTarget` Method

{% code fullWidth="false" %}

```java
/**
 * Register a new target type.
 *
 * @param plugin Plugin that is registering the target type.
 * @param type   Target type to register.
 * @return true if the target type was registered, false if not.
 */
public static boolean registerTarget(JavaPlugin plugin, TargetType type) { }
```

{% endcode %}

This method is pivotal for registering new targets. It requires the plugin instance and the custom target as arguments. The method returns a boolean indicating the success or failure of the registration process.

### The `TargetType` Class

To create a custom target, developers must extend the `TargetType` class. This class serves as the base for all custom targets and provides several constructors and methods to define the targets' behavior.

All you need to do is return the target list. This is how an `ADD` target would look:

```java
public class AddTarget extends TargetType {

    public AddTarget() {
        super("Add");
    }

    @Override
    public TargetResults getTargets(String effect, String target, ExecutionTask task) {
        double x = Double.parseDouble(classifyTarget(target).getOrDefault(TargetArgument.X, "0.0"));
        double y = Double.parseDouble(classifyTarget(target).getOrDefault(TargetArgument.Y, "0.0"));
        double z = Double.parseDouble(classifyTarget(target).getOrDefault(TargetArgument.Z, "0.0"));

        Location loc = task.getBuilder().getMain().getLocation().clone().add(x, y, z);
        return TargetResults.builder().targetLocations(Collections.singletonList(loc)).build();
    }

}
```

Do note tht the classifyTarget method will work only for internal parameters. If you want any custom one's you will need to parse the arguments yourself
