Final tweaks to random armorstand

This commit is contained in:
Mysticate 2015-12-06 17:09:33 -05:00
parent 88dcdaa445
commit 5e57caa94d

View File

@ -11,8 +11,8 @@ import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.util.EulerAngle;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.hologram.Hologram;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.game.Game;
@ -32,6 +32,9 @@ public class PlayerCopyPaintball
_owner = owner;
Location entLoc = owner.getLocation();
entLoc.setPitch(0F);
Host.CreatureAllowOverride = true;
_ent = owner.getWorld().spawn(owner.getLocation(), ArmorStand.class);
Host.CreatureAllowOverride = false;
@ -44,9 +47,15 @@ public class PlayerCopyPaintball
_ent.setBasePlate(false);
_ent.setVisible(false);
Location loc = owner.getLocation();
_ent.teleport(owner);
_ent.setHeadPose(new EulerAngle(Math.toRadians(UtilAlg.GetPitch(loc.getDirection())), Math.toRadians(UtilAlg.GetYaw(loc.getDirection())), 0));
//Rand pose
int rA = UtilMath.r(20) - 3;
int lA = UtilMath.r(20) - 3;
int rL = UtilMath.r(20) - 3;
int lL = UtilMath.r(20) - 3;
_ent.setRightArmPose(new EulerAngle(Math.toRadians(rA < 0 ? 360 - rA : rA), 0, Math.toRadians(Math.abs(rA))));
_ent.setRightLegPose(new EulerAngle(Math.toRadians(rL < 0 ? 360 - rL : rL), 0, Math.toRadians(Math.abs(rL))));
_ent.setLeftArmPose(new EulerAngle(Math.toRadians(lA < 0 ? 360 - lA : lA), 0, Math.toRadians(360 - Math.abs(lA))));
_ent.setLeftLegPose(new EulerAngle(Math.toRadians(lL < 0 ? 360 - lL : rA), 0, Math.toRadians(360 - Math.abs(lL))));
//Armor
_ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents());