Fix the Sledge Mount going through walls like a 👻
This commit is contained in:
parent
48ed0eb8ce
commit
996b7c6f66
@ -17,6 +17,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
@ -45,12 +46,14 @@ public class MountSledge extends Mount<MountSledgeData>
|
||||
@Override
|
||||
public MountSledgeData spawnMount(Player player)
|
||||
{
|
||||
Location location = player.getLocation().subtract(0, 0.5, 0);
|
||||
Location location = player.getLocation().subtract(0, 0.7, 0);
|
||||
ArmorStand front = player.getWorld().spawn(location, ArmorStand.class);
|
||||
ArmorStand back = player.getWorld().spawn(location, ArmorStand.class);
|
||||
|
||||
front.setVisible(false);
|
||||
front.setGravity(false);
|
||||
back.setVisible(false);
|
||||
back.setGravity(false);
|
||||
|
||||
front.getEquipment().setHelmet(FRONT);
|
||||
back.getEquipment().setHelmet(BACK);
|
||||
@ -75,6 +78,7 @@ public class MountSledge extends Mount<MountSledgeData>
|
||||
if (data.getOwner().getVehicle() == null)
|
||||
{
|
||||
toRemove.add(data.getOwner());
|
||||
continue;
|
||||
}
|
||||
|
||||
ArmorStand front = data.Front;
|
||||
@ -82,7 +86,14 @@ public class MountSledge extends Mount<MountSledgeData>
|
||||
|
||||
Location playerLocation = data.getOwner().getLocation();
|
||||
playerLocation.setPitch(0);
|
||||
Vector direction = playerLocation.getDirection().multiply(0.5);
|
||||
Vector direction = playerLocation.getDirection();
|
||||
|
||||
if (UtilBlock.fullSolid(playerLocation.clone().add(direction).getBlock()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
direction.multiply(0.5);
|
||||
|
||||
Location newLocation = back.getLocation().add(direction);
|
||||
((CraftEntity) back).getHandle().setPositionRotation(newLocation.getX(), newLocation.getY(), newLocation.getZ(), playerLocation.getYaw(), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user