Fix antlers when sneaking
This commit is contained in:
parent
883ca4876a
commit
131cb12620
@ -24,7 +24,6 @@ public class OutfitReindeerAntlers extends OutfitReindeer
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.DEAD_BUSH);
|
||||
private static final EulerAngle LEFT_POS = new EulerAngle(Math.PI / 2D, 0, Math.PI / 4D);
|
||||
private static final EulerAngle RIGHT_POS = new EulerAngle(-LEFT_POS.getX(), 0, LEFT_POS.getZ());
|
||||
private static final double HEIGHT = 0.6;
|
||||
|
||||
private final Map<Player, Pair<ArmorStand, ArmorStand>> _antlers;
|
||||
|
||||
@ -79,11 +78,12 @@ public class OutfitReindeerAntlers extends OutfitReindeer
|
||||
|
||||
private void updateRotation(Player player, ArmorStand left, ArmorStand right)
|
||||
{
|
||||
Location location = player.getLocation().add(0, HEIGHT, 0);
|
||||
Location location = player.getLocation().add(0, player.isSneaking() ? 0.3 : 0.6, 0);
|
||||
Vector direction = location.getDirection();
|
||||
direction.setY(0);
|
||||
|
||||
left.teleport(location.clone().add(direction).add(UtilAlg.getLeft(direction)));
|
||||
right.teleport(location.clone().add(direction.multiply(-0.5)));
|
||||
right.teleport(location.clone().add(direction.multiply(-0.4)));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.core.gadget.set.suits;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,11 +20,13 @@ import mineplex.core.gadget.gadgets.outfit.reindeer.OutfitReindeerChest;
|
||||
import mineplex.core.gadget.gadgets.outfit.reindeer.OutfitReindeerHooves;
|
||||
import mineplex.core.gadget.gadgets.outfit.reindeer.OutfitReindeerLegs;
|
||||
import mineplex.core.gadget.types.GadgetSet;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
public class SetReindeerSuit extends GadgetSet
|
||||
{
|
||||
|
||||
private static final Vector VELOCITY = new Vector(0, 2, 0);
|
||||
private static final long COOLDOWN = TimeUnit.SECONDS.toMillis(8);
|
||||
|
||||
public SetReindeerSuit(GadgetManager manager)
|
||||
{
|
||||
@ -39,7 +43,7 @@ public class SetReindeerSuit extends GadgetSet
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (event.isSneaking() || !isActive(player))
|
||||
if (event.isSneaking() || !isActive(player) || !Recharge.Instance.use(player, getName(), COOLDOWN, true, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user