From a8dd4accc6275457b86d0b1761eba8633846dd10 Mon Sep 17 00:00:00 2001 From: unldenis Date: Mon, 7 Oct 2024 22:11:17 +0200 Subject: [PATCH] base concepts documentation created --- website/animation/index.html | 2 +- website/base-concepts/index.html | 108 +++++++++++++++++++++++++------ website/blockline/index.html | 2 +- website/hello-world/index.html | 2 +- website/installation/index.html | 2 +- website/pool/index.html | 2 +- website/serialization/index.html | 2 +- website/state/index.html | 2 +- website/textline/index.html | 2 +- 9 files changed, 95 insertions(+), 29 deletions(-) diff --git a/website/animation/index.html b/website/animation/index.html index 6437ef3..436359a 100644 --- a/website/animation/index.html +++ b/website/animation/index.html @@ -65,7 +65,7 @@ diff --git a/website/base-concepts/index.html b/website/base-concepts/index.html index cef3ca0..a882477 100644 --- a/website/base-concepts/index.html +++ b/website/base-concepts/index.html @@ -1,11 +1,11 @@ - - + + HoloEasy - - + + @@ -117,12 +116,12 @@ Concepts @@ -133,15 +132,82 @@
-

Base Concepts

+

Base Concepts

+

+ Learn how to use HoloEasy in your projects. +

+ + + +

Hologram

+ +

+ The main class is Hologram. This is an abstract class, so to define your holograms you must extend this class. +

+ +

+ A hologram is composed of lines, defined by the ILine<*> interface. The lines can be either text or an item/block. + As you saw in the Hello World example, the Hologram class provides these two methods, textLine and blockLine, which should preferably be assigned to a class field; however, you can also call them in the constructor. The order of the fields will correspond to the order of the lines in the hologram. +

+ +
+ Having them as fields or accessible through a getter allows you to retrieve information or perform actions on a specific line. +
+ +
+
public class MyHolo extends Hologram {
+
+    public ITextLine counter = textLine("Hello World");
+    public ILine<ItemStack> status = blockLine(new ItemStack(Material.RED_DYE));
+
+    public MyHolo(@NotNull Location location) {
+        super(location);
+    }
+}
+ +

+ In this example, the hologram will display the text "Hello World" with a RED_DYE dropped below it. + For more complex lines, take a look at TextLine and BlockLine. + Once we've created our hologram class, we can instantiate it. This does not mean the hologram is visible yet. +

+ +

Pool

+ +

+ The structure of the hologram has been defined. But before proceeding, you need to understand what you require. + Do you need a hologram visible to all players within a certain radius? Or do you need a hologram to be shown to one or more specific players? +

+ +

+ In the first case, you may want to use a Pool. + A Pool is a container for holograms and manages showing them asynchronously to players within a certain radius of the holograms, while hiding them from players who are too far away or leave the server. + A Pool can be interactive, allowing you to click on lines (if defined that way in the class), or not. + If you don't have any specific needs, you can show the hologram with the show method. +

+ +
+
MyHolo hologram = new MyHolo(location);
+hologram.show();
+ +

+ In this case, the hologram is added and displayed using the Standard Pool. + This pool is accessible from the HoloEasy class, from which you can obtain all the holograms in this pool. +

+ +

+ It is always possible to create one or more Pools for greater flexibility and customization. Here you can read the documentation on pools. +

+ +

Custom Logic

+

+ As mentioned earlier, if you're not using a Pool, it is your responsibility to manage the hologram's visibility. + In this case, the Hologram class provides two methods: show(Player) and hide(Player). +

+ + + -
- -
- This documentation is a work in progress. -
-
diff --git a/website/blockline/index.html b/website/blockline/index.html index 2c58822..f7c46ad 100644 --- a/website/blockline/index.html +++ b/website/blockline/index.html @@ -65,7 +65,7 @@ diff --git a/website/hello-world/index.html b/website/hello-world/index.html index 0f2efd4..03a8bf1 100644 --- a/website/hello-world/index.html +++ b/website/hello-world/index.html @@ -63,7 +63,7 @@ diff --git a/website/installation/index.html b/website/installation/index.html index 0a2c7d7..23ae842 100644 --- a/website/installation/index.html +++ b/website/installation/index.html @@ -65,7 +65,7 @@ diff --git a/website/pool/index.html b/website/pool/index.html index 38900e4..9bb46bb 100644 --- a/website/pool/index.html +++ b/website/pool/index.html @@ -65,7 +65,7 @@ diff --git a/website/serialization/index.html b/website/serialization/index.html index 9d39e62..071ff25 100644 --- a/website/serialization/index.html +++ b/website/serialization/index.html @@ -65,7 +65,7 @@ diff --git a/website/state/index.html b/website/state/index.html index 3ce633c..4d77e58 100644 --- a/website/state/index.html +++ b/website/state/index.html @@ -65,7 +65,7 @@ diff --git a/website/textline/index.html b/website/textline/index.html index 5842fb9..552c196 100644 --- a/website/textline/index.html +++ b/website/textline/index.html @@ -65,7 +65,7 @@