Skip to content

Commit

Permalink
documentation and website
Browse files Browse the repository at this point in the history
  • Loading branch information
unldenis committed Oct 5, 2024
1 parent 9df9db3 commit 2f37367
Show file tree
Hide file tree
Showing 4 changed files with 557 additions and 167 deletions.
170 changes: 3 additions & 167 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,174 +1,10 @@
# HoloEasy

HoloEasy is a simple, modern and high-performant Java and Kotlin Minecraft Hologram library for 1.8-1.20.4 servers.

Lightweight replacement for Holographic Display. HoloEasy only uses packets instead of registering the entity in the actual Minecraft server.
<p align="center">
<img src="preview/gif.gif" alt="holoeasy video"/>
</p>

## Quickstart

### Requirements
* ProtocolLib installed on your server

### Add dependency
#### Maven

```xml
<dependency>
<groupId>com.github.unldenis.holoeasy</groupId>
<artifactId>holoeasy-core</artifactId>
<version>4.0.0</version>
</dependency>

<!-- For java projects include also the kotlin stdlib -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.9.21</version>
</dependency>
```

#### Gradle

```kotlin
implementation("com.github.unldenis.holoeasy:holoeasy-core:4.0.0")

// For java projects include also the kotlin stdlib
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.21")

```

Make sure you include the <a href="https://jitpack.io/">repository</a> as well.





## Hello World

### Kotlin
```kotlin
class HelloWorldHologram(location: Location) : Hologram(location) {
var line = textLine("Hello World")
}

// When you need
val hologram = HelloWorldHologram(location)
hologram.show()
```

### Java
```java
public class HelloWorldHologram extends Hologram {

ITextLine line = textLine("Hello World");

public HelloWorldHologram(@NotNull Location location) {
super(location);
}

}

// When you need
HelloWorldHologram hologram = new HelloWorldHologram(location);
hologram.show();
```

## Deep into holoeasy

### Kotlin
```kotlin
class MyHolo(location: Location) : Hologram(location) {

private val clickCount = mutableStateOf(0) // can be any type

val counter = textLine("Clicked {} times", TextLineModifiers()
.args(clickCount)
.clickable { _ -> clickCount.update { it + 1 } })

var status= blockLine(ItemStack(Material.RED_DYE))

}

// Create new hologram
val myHolo = MyHolo(location)
myHolo.show()

Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, Runnable {
// access lines
myHolo.status.update(ItemStack(Material.GREEN_DYE))
}, 20L * 5)
```

### Java
```java
class MyHolo extends Hologram {

private final MutableState<Integer> clickCount = mutableStateOf(0); // can be any type

public ITextLine counter = textLine("Clicked {} times", new TextLineModifiers()
.args(clickCount)
.clickable(player -> clickCount.update(it -> it + 1)));
public ILine<ItemStack> status = blockLine(new ItemStack(Material.RED_DYE));

public MyHolo(@NotNull Location location) {
super(location);
}
}

// Create new hologram
MyHolo myHolo = new MyHolo(location);
myHolo.show();

Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> {
// access lines
myHolo.status.update(new ItemStack(Material.GREEN_DYE));
}, 20L * 5);
```

## Custom pool

### Kotlin
```kotlin
// you can use a Pool or a org.bukkit.Plugin
val pool = HoloEasy.startInteractivePool(this, 60.0,
minHitDistance = 0.5f, /* optional */
maxHitDistance = 5f, /* optional */
clickAction = ClickAction.LEFT_CLICK /* optional */
)

// show on the right pool
hologram.show(pool)
```

### Java
```java
// you can use a Pool or a org.bukkit.Plugin
IHologramPool pool = HoloEasy.startInteractivePool(60, 0.5f, 5f);

// show on the right pool
hologram.show(pool);
```

## Serialization

### Kotlin
```kotlin
val serialized: Map<String, Any> = hologram.serialize()

val deserialized : HelloWorldHologram = Hologram.deserialize(serialized)
deserialized.show()
```

### Java
```java
Map<String, Object> serialized = hologram.serialize();

HelloWorldHologram deserialized = Hologram.deserialize(serialized, HelloWorldHologram.class);
deserialized.show();;
```
## Documentation

Visit https://www.holoeasy.dev to view the documentation.

## History
Are you using a version older than 4.0.0? You can find the documentation <a href="https://github.com/unldenis/holoeasy/tree/3.4.4">here</a>.
Expand Down
172 changes: 172 additions & 0 deletions website/hello-world/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>HoloEasy</title>
<link rel="preconnect" href="https://rsms.me/" />
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />

<style>
:root {
font-family: Inter, sans-serif;
font-feature-settings: "liga" 1, "calt" 1; /* fix for Chrome */
}
@supports (font-variation-settings: normal) {
:root {
font-family: InterVariable, sans-serif;
}
}
</style>

<!-- For stability in production, it's recommended that you hardcode the latest version in the CDN link. -->

<link
rel="stylesheet"
href="https://unpkg.com/franken-ui/dist/css/core.min.css"
/>

<script>
const htmlElement = document.documentElement;

if (
localStorage.getItem("mode") === "dark" ||
(!("mode" in localStorage) &&
window.matchMedia("(prefers-color-scheme: dark)").matches)
) {
htmlElement.classList.add("dark");
} else {
htmlElement.classList.remove("dark");
}

htmlElement.classList.add(
localStorage.getItem("theme") || "uk-theme-zinc"
);
</script>

<script
type="module"
src="https://unpkg.com/franken-ui/dist/js/core.iife.js"
></script>
<script
type="module"
src="https://unpkg.com/franken-ui/dist/js/icon.iife.js"
></script>

<!-- Includi il tema Funky di PrismJS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-twilight.min.css" rel="stylesheet" />

<!-- PrismJS JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-java.min.js"></script>

<style>
/* Imposta una dimensione del font più piccola per il codice evidenziato */
pre[class*="language-"], code[class*="language-"] {
font-size: 12px; /* Cambia 12px con la dimensione che preferisci */
}
</style>
</head>
<body class="bg-background text-foreground">
<!-- START CODING HERE -->
<div class="uk-flex uk-flex-wrap uk-flex-wrap-around">
<div class="uk-width-1-5">

<!-- THEME SWITCHER -->
<div class="uk-inline uk-margin-top uk-margin-small-bottom">
<button
class="uk-icon-button uk-icon-button-small uk-icon-button-outline"
>
<uk-icon icon="palette" uk-cloak></uk-icon>
</button>
<div
class="uk-card uk-card-body uk-card-default uk-drop uk-width-large"
uk-drop="mode: click; offset: 8; pos: bottom-center"
>
<div class="uk-card-title uk-margin-medium-bottom">Customize</div>
<uk-theme-switcher></uk-theme-switcher>
</div>
</div>
<!-- END THEME SWITCHER-->
<div class="">
<ul class="uk-nav-default" uk-nav>
<li class="uk-parent">
<a href="#">Prologue <span uk-nav-parent-icon></span></a>
<ul class="uk-nav-sub">
<li><a href="../">Introduction</a></li>
<li><a href="#">Changelog</a></li>
</ul>
</li>
<li class="uk-parent">
<a href="#">Getting Started <span uk-nav-parent-icon></span></a>
<ul class="uk-nav-sub">
<li><a href="../installation">Installation</a></li>
<li class="uk-active"><a href="">Hello World</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="uk-width-3-5">

<div class="uk-section">
<div class="uk-container">
<h1 class="uk-h1">Hello World</h1>
<p class="uk-text-lead uk-paragraph">
Your first hologram.
</p>


<h2 class="uk-h2 uk-margin-medium">Start programming</h2>


<p class="uk-paragraph">
<strong>1.</strong> Register HoloEasy api.
</p>

<div class="uk-paragraph">
<pre><code class="language-java">HoloEasy.bind(org.bukkit.plugin.Plugin);</code></pre>
</div>

<p class="uk-paragraph">
<strong>2.</strong> Define your first Hologram class.
</p>

<div class="uk-paragraph">
<pre><code class="language-java">public class HelloWorldHologram extends Hologram {

ITextLine line = textLine("Hello World");

public HelloWorldHologram(@NotNull Location location) {
super(location);
}

}</code></pre>
</div>


<p class="uk-paragraph">
<strong>3.</strong> Now spawn a hologram.
</p>

<div class="uk-paragraph">
<pre><code class="language-java">HelloWorldHologram hologram = new HelloWorldHologram(location);
hologram.show();</code></pre>
</div>

<p class="uk-paragraph">
<strong>4.</strong> Once you’re done, you may now proceed <a class="uk-link" href="">creating your first hologram</a>.
</p>



<!-- GRADLE-->

</div>
</div>

</div>
</div>
<!-- END -->
</body>
</html>
Loading

0 comments on commit 2f37367

Please sign in to comment.