mirror of
https://github.com/ViaVersion/ViaRewind-Legacy-Support.git
synced 2025-01-21 20:51:40 +01:00
Fix AreaEffectCloudEmulator spawn logic on 1.20.5+ servers (#83)
This commit is contained in:
parent
081c9c9a6f
commit
3030d07fec
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package com.viaversion.viarewind.legacysupport.feature;
|
package com.viaversion.viarewind.legacysupport.feature;
|
||||||
|
|
||||||
|
import com.viaversion.viarewind.legacysupport.util.NMSUtil;
|
||||||
import com.viaversion.viaversion.api.Via;
|
import com.viaversion.viaversion.api.Via;
|
||||||
import com.viaversion.viarewind.legacysupport.BukkitPlugin;
|
import com.viaversion.viarewind.legacysupport.BukkitPlugin;
|
||||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||||
@ -45,6 +46,9 @@ public class AreaEffectCloudEmulator implements Listener {
|
|||||||
effectClouds.forEach(cloud -> {
|
effectClouds.forEach(cloud -> {
|
||||||
final Location location = cloud.getLocation();
|
final Location location = cloud.getLocation();
|
||||||
final float radius = cloud.getRadius();
|
final float radius = cloud.getRadius();
|
||||||
|
final Object data = NMSUtil.NEWER_THAN_V1_20_5
|
||||||
|
? cloud.getColor()
|
||||||
|
: null;
|
||||||
|
|
||||||
float area = (float) Math.PI * radius * radius;
|
float area = (float) Math.PI * radius * radius;
|
||||||
|
|
||||||
@ -67,7 +71,8 @@ public class AreaEffectCloudEmulator implements Listener {
|
|||||||
cloud.getParticle(),
|
cloud.getParticle(),
|
||||||
location.getX() + f3, location.getY(), location.getZ() + f6,
|
location.getX() + f3, location.getY(), location.getZ() + f6,
|
||||||
0,
|
0,
|
||||||
r / 255f, g / 255f, b / 255f
|
r / 255f, g / 255f, b / 255f,
|
||||||
|
data
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ public class NMSUtil {
|
|||||||
public static String nmsVersionPackage;
|
public static String nmsVersionPackage;
|
||||||
private static Field playerConnectionField;
|
private static Field playerConnectionField;
|
||||||
|
|
||||||
|
public static final boolean NEWER_THAN_V1_20_5 = BukkitPlugin.getInstance().getServerProtocol().newerThanOrEqualTo(ProtocolVersion.v1_20_5);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if (BukkitPlugin.getInstance().getServerProtocol().olderThan(ProtocolVersion.v1_17)) {
|
if (BukkitPlugin.getInstance().getServerProtocol().olderThan(ProtocolVersion.v1_17)) {
|
||||||
nmsVersionPackage = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
nmsVersionPackage = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||||
|
Loading…
Reference in New Issue
Block a user