Handle EulerAngle

This commit is contained in:
libraryaddict 2021-05-04 23:06:55 +12:00
parent c1eb650b4a
commit 01cf995914

View file

@ -30,6 +30,7 @@ import org.bukkit.plugin.SimplePluginManager;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.io.*; import java.io.*;
@ -1089,6 +1090,8 @@ public class ReflectionManager {
return getNmsClass("IChatBaseComponent"); return getNmsClass("IChatBaseComponent");
} else if (Vector3F.class.isAssignableFrom(cl)) { } else if (Vector3F.class.isAssignableFrom(cl)) {
return getNmsClass("Vector3f"); return getNmsClass("Vector3f");
} else if (EulerAngle.class.isAssignableFrom(cl)) {
return getNmsClass("Vector3f");
} else if (Direction.class.isAssignableFrom(cl)) { } else if (Direction.class.isAssignableFrom(cl)) {
return getNmsClass("EnumDirection"); return getNmsClass("EnumDirection");
} else if (WrappedParticle.class.isAssignableFrom(cl)) { } else if (WrappedParticle.class.isAssignableFrom(cl)) {
@ -1152,6 +1155,14 @@ public class ReflectionManager {
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} else if (value instanceof EulerAngle) {
EulerAngle angle = (EulerAngle) value;
try {
return vector3FConstructor.newInstance((float) angle.getX(), (float) angle.getY(), (float) angle.getZ());
} catch (Exception ex) {
ex.printStackTrace();
}
} else if (value instanceof Direction) { } else if (value instanceof Direction) {
try { try {
return enumDirectionFrom.invoke(null, ((Direction) value).ordinal()); return enumDirectionFrom.invoke(null, ((Direction) value).ordinal());