Skip to content

Commit d79fc24

Browse files
committed
➕ reflection-remapper and reflection-mappings-shrieker
Mappings are now automatically generated! Support for mojang-mapped servers; closes #18
1 parent 25f3cdb commit d79fc24

File tree

7 files changed

+1046
-545
lines changed

7 files changed

+1046
-545
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
/target
33
/.settings
44
.classpath
5-
.project
5+
.project
6+
/rawMappings
7+
/dependency-reduced-pom.xml

README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ No ProtocolLib, no dependency, compatible from Minecraft 1.17 to 1.21!
1111
![Glowing blocks animation](demo-blocks.gif)
1212

1313
## How to install?
14-
### 1st method: copying the class
15-
Copy the [GlowingEntities.java class](src/main/java/fr/skytasul/glowingentities/GlowingEntities.java) to your project
16-
(and the [GlowingBlocks.java class](src/main/java/fr/skytasul/glowingentities/GlowingBlocks.java) if required).
17-
18-
### 2nd method: using maven
1914
Add this requirement to your maven `pom.xml` file:
2015

2116
```xml
@@ -26,7 +21,7 @@ Add this requirement to your maven `pom.xml` file:
2621
<scope>compile</scope>
2722
</dependency>
2823
```
29-
Additionnally, you can use the maven shade plugin to relocate the classes location.
24+
Then, configure the maven shade plugin to relocate the classes location. You can also use the Spigot library resolver to download the library, or Paper's plugin loader.
3025

3126
> [!NOTE]
3227
> Until 1.3.4, the util was under the groupId `io.github.skytasul`.

pom.xml

+18-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>fr.skytasul</groupId>
77
<artifactId>glowingentities</artifactId>
8-
<version>1.3.5</version>
8+
<version>1.4</version>
99

1010
<name>GlowingEntities</name>
1111
<description>A Spigot util to easily make entities glow.</description>
@@ -22,7 +22,7 @@
2222
<developer>
2323
<name>SkytAsul</name>
2424
<email>[email protected]</email>
25-
<url>https://github.com/SkytAsul</url>
25+
<url>https://skytasul.fr</url>
2626
</developer>
2727
</developers>
2828

@@ -50,7 +50,21 @@
5050
<dependency>
5151
<groupId>io.papermc.paper</groupId>
5252
<artifactId>paper-api</artifactId>
53-
<version>1.21-R0.1-SNAPSHOT</version>
53+
<version>1.17-R0.1-SNAPSHOT</version>
54+
<scope>provided</scope>
55+
</dependency>
56+
57+
<dependency>
58+
<groupId>fr.skytasul</groupId>
59+
<artifactId>reflection-remapper</artifactId>
60+
<version>1.0.0</version>
61+
<scope>compile</scope>
62+
</dependency>
63+
64+
<dependency>
65+
<groupId>fr.skytasul</groupId>
66+
<artifactId>reflection-mappings-shrieker</artifactId>
67+
<version>1.0.0</version>
5468
<scope>provided</scope>
5569
</dependency>
5670

@@ -114,7 +128,7 @@
114128
<plugin>
115129
<groupId>org.sonatype.central</groupId>
116130
<artifactId>central-publishing-maven-plugin</artifactId>
117-
<version>0.5.0</version>
131+
<version>0.6.0</version>
118132
<extensions>true</extensions>
119133
<configuration>
120134
<publishingServerId>central</publishingServerId>

src/main/java/fr/skytasul/glowingentities/GlowingBlocks.java

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package fr.skytasul.glowingentities;
22

3-
import java.util.HashMap;
4-
import java.util.Map;
5-
import java.util.Objects;
6-
import java.util.UUID;
7-
import java.util.concurrent.ThreadLocalRandom;
8-
import java.util.concurrent.atomic.AtomicInteger;
3+
import fr.skytasul.glowingentities.GlowingEntities.Packets;
4+
import io.papermc.paper.event.packet.PlayerChunkLoadEvent;
95
import org.bukkit.Bukkit;
106
import org.bukkit.ChatColor;
117
import org.bukkit.Location;
@@ -16,8 +12,12 @@
1612
import org.bukkit.event.Listener;
1713
import org.bukkit.plugin.Plugin;
1814
import org.jetbrains.annotations.NotNull;
19-
import fr.skytasul.glowingentities.GlowingEntities.Packets;
20-
import io.papermc.paper.event.packet.PlayerChunkLoadEvent;
15+
import java.util.HashMap;
16+
import java.util.Map;
17+
import java.util.Objects;
18+
import java.util.UUID;
19+
import java.util.concurrent.ThreadLocalRandom;
20+
import java.util.concurrent.atomic.AtomicInteger;
2121

2222
/**
2323
* An extension of {@link GlowingEntities} to make blocks glow as well!
@@ -34,7 +34,7 @@ public class GlowingBlocks implements Listener {
3434

3535
/**
3636
* Initializes the Glowing blocks API.
37-
*
37+
*
3838
* @param plugin plugin that will be used to register the events.
3939
*/
4040
public GlowingBlocks(@NotNull Plugin plugin) {
@@ -47,7 +47,7 @@ public GlowingBlocks(@NotNull Plugin plugin) {
4747

4848
/**
4949
* Enables the Glowing blocks API.
50-
*
50+
*
5151
* @see #disable()
5252
*/
5353
public void enable() {
@@ -66,7 +66,7 @@ public void enable() {
6666
* <p>
6767
* Methods such as {@link #setGlowing(Location, Player, ChatColor)} and
6868
* {@link #unsetGlowing(Location, Player)} will no longer be usable.
69-
*
69+
*
7070
* @see #enable()
7171
*/
7272
public void disable() {
@@ -102,7 +102,7 @@ private void testForPaper() {
102102

103103
/**
104104
* Makes the {@link Block} passed as a parameter glow with the specified color.
105-
*
105+
*
106106
* @param block block to make glow
107107
* @param receiver player which will see the block glowing
108108
* @param color color of the glowing effect
@@ -115,7 +115,7 @@ public void setGlowing(@NotNull Block block, @NotNull Player receiver, @NotNull
115115

116116
/**
117117
* Makes the block at the location passed as a parameter glow with the specified color.
118-
*
118+
*
119119
* @param block location of the block to make glow
120120
* @param receiver player which will see the block glowing
121121
* @param color color of the glowing effect
@@ -145,7 +145,7 @@ public void setGlowing(@NotNull Location block, @NotNull Player receiver, @NotNu
145145

146146
/**
147147
* Makes the {@link Block} passed as a parameter loose its glowing effect.
148-
*
148+
*
149149
* @param block block to remove glowing effect from
150150
* @param receiver player which will no longer see the glowing effect
151151
* @throws ReflectiveOperationException
@@ -156,7 +156,7 @@ public void unsetGlowing(@NotNull Block block, @NotNull Player receiver) throws
156156

157157
/**
158158
* Makes the block at the location passed as a parameter loose its glowing effect.
159-
*
159+
*
160160
* @param block location of the block to remove glowing effect from
161161
* @param receiver player which will no longer see the glowing effect
162162
* @throws ReflectiveOperationException
@@ -200,7 +200,7 @@ public void onPlayerChunkLoad(PlayerChunkLoadEvent event) {
200200
PlayerData playerData = glowing.get(event.getPlayer());
201201
if (playerData == null)
202202
return;
203-
203+
204204
playerData.datas.forEach((location, blockData) -> {
205205
if (Objects.equals(location.getWorld(), event.getWorld())
206206
&& location.getBlockX() >> 4 == event.getChunk().getX()
@@ -224,7 +224,7 @@ public PlayerData(@NotNull Player player) {
224224

225225
private class GlowingBlockData {
226226

227-
private static final byte FLAGS = 1 << 5;
227+
private static final byte FLAGS = 1 << 5; // invisibility flag
228228
private static final AtomicInteger ENTITY_ID_COUNTER =
229229
new AtomicInteger(ThreadLocalRandom.current().nextInt(1_000_000, 2_000_000_000));
230230

0 commit comments

Comments
 (0)