Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 31 additions & 16 deletions content/docs/en/guides/plugin/setting-up-env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,24 @@ You can now try the command `mvn -version` to verify Maven is installed correctl

## Setting Up Your Workspace

### 1. Add HytaleServer.jar Dependency
### 1. Clone the Plugin Template

Instead of creating an empty directory, we'll use the official Hytale plugin template:

```bash
# Clone the template repository
git clone https://github.com/HytaleModding/plugin-template.git MyFirstMod
cd MyFirstMod
```

### 2. Open in IntelliJ IDEA

1. Open IntelliJ IDEA
2. Click "Open" and navigate to your `MyFirstMod` directory
3. IntelliJ will automatically detect it as a Maven project
4. Wait for the project to index and dependencies to download

### 3. Add HytaleServer.jar Dependency

Before you can start modding, you need to add the HytaleServer.jar file as a dependency:

Expand All @@ -73,21 +90,19 @@ Before you can start modding, you need to add the HytaleServer.jar file as a dep
- Click on the **+ icon**
- Select the **HytaleServer.jar** you downloaded

### 2. Clone the Plugin Template
### 4. Add the HytaleServer to your Artifacts

Instead of creating an empty directory, we'll use the official Hytale plugin template:
<Callout type="warning">
This is a temporary workaround until Hypixel provides an official Maven repository for HytaleServer.jar
</Callout>

Run this command in your console

```bash
# Clone the template repository
git clone https://github.com/HytaleModding/plugin-template.git MyFirstMod
cd MyFirstMod
mvn install:install-file -Dfile=[ROUTE TO HytaleServer.jar] -DgroupId=com.hypixel.hytale -DartifactId=HytaleServer-parent -Dversion=1.0-SNAPSHOT -Dpackaging=jar
```
### 3. Open in IntelliJ IDEA

1. Open IntelliJ IDEA
2. Click "Open" and navigate to your `MyFirstMod` directory
3. IntelliJ will automatically detect it as a Maven project
4. Wait for the project to index and dependencies to download
Replace `[ROUTE TO HytaleServer.jar]` with the actual path to the `HytaleServer.jar` file on your system.

## Next Steps

Expand All @@ -97,8 +112,8 @@ Now that you have your development environment set up with the plugin template:
2. **Explore the code structure** - Familiarize yourself with the template's organization
3. **Start modding** - Begin writing your first Hytale plugin!

The plugin template includes:
- Pre-configured Gradle build system
- Example plugin structure
- Essential dependencies
- Development tools configuration
Learn how to:
- [Create Commands](./creating-commands)
- [Create Events](./creating-events)

and more! Explore the documentation to learn about all available features and best practices.
237 changes: 237 additions & 0 deletions content/docs/en/guides/plugin/text-hologram.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
---
title: "Title Holograms"
description: "Learn how to create title holograms."
authors:
- name: "Bird"
link: "https://discord.com/users/495709580068651009"
---

# Overview

In this guide, you'll learn how to create a **title hologram** using an entity nameplate.

## Steps

1. Open and equip the **Entity Grabber Tool**.

![tile-hologram-1](/assets/guides/tile-hologram-1.png)

<Callout>
This tool will be used later to **adjust the position of the nameplate**, so it’s useful to keep it equipped throughout the process.
</Callout>

---

2. Spawn a **small entity** (for example, rubble or a similar object), then **scale it down** to lowest possible value.

![tile-hologram-2](/assets/guides/tile-hologram-2.png)

---

3. Hover over the entity you just spawned and run the following command:

```
/entity nameplate "Text Here"
```

![tile-hologram-3](/assets/guides/tile-hologram-3.png)

---

Your title hologram should now be visible in the world, floating where the entity is placed.

![tile-hologram-4](/assets/guides/tile-hologram-4.png)

---

## Bonus Section - Creating Title Holograms With Code

This section shows how to create the same title hologram using a **server plugin command** instead of in-game tools.

The example below creates a command called `/titlehologram` that spawns an invisible entity with a floating nameplate at the player’s location.

```java
package org.example.plugin;

import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.math.vector.Transform;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.basecommands.CommandBase;
import com.hypixel.hytale.server.core.entity.UUIDComponent;
import com.hypixel.hytale.server.core.entity.entities.ProjectileComponent;
import com.hypixel.hytale.server.core.entity.nameplate.Nameplate;
import com.hypixel.hytale.server.core.modules.entity.component.Intangible;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.modules.entity.tracker.NetworkId;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.Universe;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;

import javax.annotation.Nonnull;
import java.util.UUID;

public class TitleHologramCommand extends CommandBase {

public TitleHologramCommand() {
super("TitleHologram", "Create a title hologram.");
}

@Override
protected void executeSync(@Nonnull CommandContext ctx) {

UUID playerUUID = ctx.sender().getUuid();
PlayerRef playerRef = Universe.get().getPlayer(playerUUID);
World world = Universe.get().getWorld(playerRef.getWorldUuid());
Transform playerTransform = playerRef.getTransform();

world.execute(() -> {

Holder<EntityStore> holder = EntityStore.REGISTRY.newHolder();
ProjectileComponent projectileComponent = new ProjectileComponent("Projectile");
holder.putComponent(ProjectileComponent.getComponentType(), projectileComponent);
holder.putComponent(TransformComponent.getComponentType(), new TransformComponent(playerTransform.getPosition().clone(), playerTransform.getRotation().clone()));
holder.ensureComponent(UUIDComponent.getComponentType());
holder.ensureComponent(Intangible.getComponentType());

if (projectileComponent.getProjectile() == null) {
projectileComponent.initialize();
if (projectileComponent.getProjectile() == null) {
return;
}
}
holder.addComponent(NetworkId.getComponentType(), new NetworkId(world.getEntityStore().getStore().getExternalData().takeNextNetworkId()));
holder.addComponent(Nameplate.getComponentType(), new Nameplate("Testing Holograms"));

world.getEntityStore().getStore().addEntity(holder, com.hypixel.hytale.component.AddReason.SPAWN);
});
}
}
```

---

### 1. Getting the Player and World

```java
UUID playerUUID = ctx.sender().getUuid();
PlayerRef playerRef = Universe.get().getPlayer(playerUUID);
World world = Universe.get().getWorld(playerRef.getWorldUuid());
Transform playerTransform = playerRef.getTransform();
```

This retrieves:

| Value | Purpose |
| ----------------- | ------------------------------------- |
| `playerUUID` | The unique ID of the command sender |
| `playerRef` | A server-side reference to the player |
| `world` | The world the player is currently in |
| `playerTransform` | The player’s position and rotation |

This allows the hologram to be spawned **exactly where the player is standing**.

---

### 2. Spawning on the World Thread

```java
world.execute(() -> {
```

All entity operations must run on the world thread.
Everything inside this block executes safely on the correct game thread.

---

### 3. Creating the Entity

```java
Holder<EntityStore> holder = EntityStore.REGISTRY.newHolder();
ProjectileComponent projectileComponent = new ProjectileComponent("Projectile");
```

The projectile is only used as a **valid entity shell**.
It will never move or behave like a real projectile.

---

### 4. Setting Position & Components

```java
holder.putComponent(ProjectileComponent.getComponentType(), projectileComponent);
holder.putComponent(TransformComponent.getComponentType(), new TransformComponent(playerTransform.getPosition().clone(), playerTransform.getRotation().clone()));
holder.ensureComponent(UUIDComponent.getComponentType());
holder.ensureComponent(Intangible.getComponentType());
```

This builds an invisible, stationary entity at the player’s position.

| Component | Purpose |
| --------------------- | ------------------------------------------------ |
| `ProjectileComponent` | Provides a valid entity shell |
| `TransformComponent` | Sets the entity’s position and rotation |
| `UUIDComponent` | Gives the entity a unique identity |
| `Intangible` | Makes the entity non-collidable and unselectable |

The hologram will appear exactly at the player’s position and cannot be interacted with physically.

---

### 5. Initializing the Projectile

```java
if (projectileComponent.getProjectile() == null) {
projectileComponent.initialize();
if (projectileComponent.getProjectile() == null) {
return;
}
}
```

This ensures the projectile entity is fully created.
If initialization fails, the hologram will not spawn.

---

### 6. Setting Network & Nameplate Components

```java
holder.addComponent(
NetworkId.getComponentType(),
new NetworkId(
world.getEntityStore()
.getStore()
.getExternalData()
.takeNextNetworkId()
)
);

holder.addComponent(
Nameplate.getComponentType(),
new Nameplate("Testing Holograms")
);
```

These final components make the hologram visible and give it its text.

| Component | Purpose |
| --------------------- | ------------------------------- |
| `NetworkId` | Allows the entity to be synced |
| `Nameplate` | The actual hologram text |

---

### 7. Spawning the Entity

```java
world.getEntityStore()
.getStore()
.addEntity(holder, com.hypixel.hytale.component.AddReason.SPAWN);
```

This inserts the hologram entity into the world, making it active and visible.

---

![tile-hologram-5](/assets/guides/tile-hologram-5.png)
Loading