Skip to content

Commit

Permalink
➕ reflection-remapper and reflection-mappings-shrieker
Browse files Browse the repository at this point in the history
Mappings are now automatically generated!

Support for mojang-mapped servers; closes #18
  • Loading branch information
SkytAsul committed Nov 2, 2024
1 parent 25f3cdb commit d79fc24
Show file tree
Hide file tree
Showing 7 changed files with 1,046 additions and 545 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/target
/.settings
.classpath
.project
.project
/rawMappings
/dependency-reduced-pom.xml
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ No ProtocolLib, no dependency, compatible from Minecraft 1.17 to 1.21!
![Glowing blocks animation](demo-blocks.gif)

## How to install?
### 1st method: copying the class
Copy the [GlowingEntities.java class](src/main/java/fr/skytasul/glowingentities/GlowingEntities.java) to your project
(and the [GlowingBlocks.java class](src/main/java/fr/skytasul/glowingentities/GlowingBlocks.java) if required).

### 2nd method: using maven
Add this requirement to your maven `pom.xml` file:

```xml
Expand All @@ -26,7 +21,7 @@ Add this requirement to your maven `pom.xml` file:
<scope>compile</scope>
</dependency>
```
Additionnally, you can use the maven shade plugin to relocate the classes location.
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.

> [!NOTE]
> Until 1.3.4, the util was under the groupId `io.github.skytasul`.
Expand Down
22 changes: 18 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>fr.skytasul</groupId>
<artifactId>glowingentities</artifactId>
<version>1.3.5</version>
<version>1.4</version>

<name>GlowingEntities</name>
<description>A Spigot util to easily make entities glow.</description>
Expand All @@ -22,7 +22,7 @@
<developer>
<name>SkytAsul</name>
<email>[email protected]</email>
<url>https://github.com/SkytAsul</url>
<url>https://skytasul.fr</url>
</developer>
</developers>

Expand Down Expand Up @@ -50,7 +50,21 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21-R0.1-SNAPSHOT</version>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>fr.skytasul</groupId>
<artifactId>reflection-remapper</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>fr.skytasul</groupId>
<artifactId>reflection-mappings-shrieker</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -114,7 +128,7 @@
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/fr/skytasul/glowingentities/GlowingBlocks.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package fr.skytasul.glowingentities;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
import fr.skytasul.glowingentities.GlowingEntities.Packets;
import io.papermc.paper.event.packet.PlayerChunkLoadEvent;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
Expand All @@ -16,8 +12,12 @@
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import fr.skytasul.glowingentities.GlowingEntities.Packets;
import io.papermc.paper.event.packet.PlayerChunkLoadEvent;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;

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

/**
* Initializes the Glowing blocks API.
*
*
* @param plugin plugin that will be used to register the events.
*/
public GlowingBlocks(@NotNull Plugin plugin) {
Expand All @@ -47,7 +47,7 @@ public GlowingBlocks(@NotNull Plugin plugin) {

/**
* Enables the Glowing blocks API.
*
*
* @see #disable()
*/
public void enable() {
Expand All @@ -66,7 +66,7 @@ public void enable() {
* <p>
* Methods such as {@link #setGlowing(Location, Player, ChatColor)} and
* {@link #unsetGlowing(Location, Player)} will no longer be usable.
*
*
* @see #enable()
*/
public void disable() {
Expand Down Expand Up @@ -102,7 +102,7 @@ private void testForPaper() {

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

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

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

/**
* Makes the block at the location passed as a parameter loose its glowing effect.
*
*
* @param block location of the block to remove glowing effect from
* @param receiver player which will no longer see the glowing effect
* @throws ReflectiveOperationException
Expand Down Expand Up @@ -200,7 +200,7 @@ public void onPlayerChunkLoad(PlayerChunkLoadEvent event) {
PlayerData playerData = glowing.get(event.getPlayer());
if (playerData == null)
return;

playerData.datas.forEach((location, blockData) -> {
if (Objects.equals(location.getWorld(), event.getWorld())
&& location.getBlockX() >> 4 == event.getChunk().getX()
Expand All @@ -224,7 +224,7 @@ public PlayerData(@NotNull Player player) {

private class GlowingBlockData {

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

Expand Down
Loading

0 comments on commit d79fc24

Please sign in to comment.