titan stuff
I HATE YOU SNAKE.
This commit is contained in:
parent
f55b6761a8
commit
0871663498
@ -443,6 +443,11 @@ public class UtilAlg
|
|||||||
|
|
||||||
public static EulerAngle vectorToEuler(Vector vector)
|
public static EulerAngle vectorToEuler(Vector vector)
|
||||||
{
|
{
|
||||||
return new EulerAngle(Math.toRadians(GetPitch(vector)), Math.toRadians(GetYaw(vector)), 0);
|
//JUST MAKE SURE THE ARMOR STAND ISNT ROTATED.
|
||||||
|
|
||||||
|
return new EulerAngle(
|
||||||
|
Math.toRadians(UtilAlg.GetPitch(vector)),
|
||||||
|
Math.toRadians(UtilAlg.GetYaw(vector)),
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,9 @@ public class MorphTitan extends MorphGadget
|
|||||||
{
|
{
|
||||||
super(manager, "Elder Guardian Morph", new String[]
|
super(manager, "Elder Guardian Morph", new String[]
|
||||||
{
|
{
|
||||||
C.cWhite + "From deep withinsdngsg",
|
C.cWhite + "From the depths of the sea, the",
|
||||||
|
C.cWhite + "Elder Guardian posseses powers",
|
||||||
|
C.cWhite + "more amazing than any seen before!",
|
||||||
" ",
|
" ",
|
||||||
C.cRed + "Unlocked with Titan Rank",
|
C.cRed + "Unlocked with Titan Rank",
|
||||||
},
|
},
|
||||||
@ -208,9 +210,9 @@ public class MorphTitan extends MorphGadget
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void titanOwner(PlayerJoinEvent event)
|
public void titanOwner(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
// if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
||||||
// {
|
{
|
||||||
// Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,10 @@ import org.bukkit.entity.Horse.Style;
|
|||||||
import org.bukkit.entity.Horse.Variant;
|
import org.bukkit.entity.Horse.Variant;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
@ -115,12 +118,22 @@ public class MountTitan extends Mount<MountTitanData>
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void target(EntityDamageEvent event)
|
||||||
|
{
|
||||||
|
for (MountTitanData data : _active.values())
|
||||||
|
{
|
||||||
|
if (data.ownsEntity(event.getEntity()))
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void titanOwner(PlayerJoinEvent event)
|
public void titanOwner(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
// if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
||||||
// {
|
{
|
||||||
// Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,9 @@ package mineplex.core.mount.types;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -15,6 +17,7 @@ import org.bukkit.entity.MagmaCube;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Slime;
|
import org.bukkit.entity.Slime;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.EulerAngle;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class MountTitanData
|
public class MountTitanData
|
||||||
@ -22,32 +25,40 @@ public class MountTitanData
|
|||||||
private String _owner;
|
private String _owner;
|
||||||
|
|
||||||
private Slime _head;
|
private Slime _head;
|
||||||
|
|
||||||
private ArrayList<ArmorStand> _nodes;
|
private ArrayList<ArmorStand> _nodes;
|
||||||
|
|
||||||
public MountTitanData(Player player, String name)
|
public MountTitanData(Player player, String name)
|
||||||
{
|
{
|
||||||
_owner = player.getName();
|
_owner = player.getName();
|
||||||
|
|
||||||
|
Location loc = player.getLocation();
|
||||||
|
loc.setPitch(0);
|
||||||
|
loc.setYaw(0);
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
_nodes = new ArrayList<ArmorStand>();
|
_nodes = new ArrayList<ArmorStand>();
|
||||||
|
|
||||||
for (int i=0 ; i<30 ; i++)
|
for (int i=0 ; i<30 ; i++)
|
||||||
{
|
{
|
||||||
ArmorStand node = player.getWorld().spawn(player.getLocation(), ArmorStand.class);
|
ArmorStand node = loc.getWorld().spawn(loc, ArmorStand.class);
|
||||||
|
|
||||||
node.setVisible(false);
|
node.setVisible(false);
|
||||||
node.setGravity(false);
|
node.setGravity(false);
|
||||||
|
node.setGhost(true);
|
||||||
|
|
||||||
node.setHelmet(new ItemStack(Material.REDSTONE_BLOCK));
|
node.setHelmet(new ItemStack(Material.NETHERRACK));
|
||||||
|
|
||||||
|
UtilEnt.setFakeHead(node, true);
|
||||||
|
|
||||||
_nodes.add(node);
|
_nodes.add(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Head
|
//Head
|
||||||
_head = player.getWorld().spawn(player.getLocation(), MagmaCube.class);
|
_head = player.getWorld().spawn(loc, MagmaCube.class);
|
||||||
_head.setSize(2);
|
_head.setSize(2);
|
||||||
|
UtilEnt.ghost(_head, true, false);
|
||||||
|
|
||||||
_head.setCustomName(player.getName() + "'s " + name);
|
_head.setCustomName(player.getName() + "'s " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,10 +69,10 @@ public class MountTitanData
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
//Head
|
//Head
|
||||||
if (_head.getPassenger() != null)
|
if (_head.getPassenger() != null)
|
||||||
_head.setVelocity(_head.getPassenger().getLocation().getDirection().add(new Vector(0,0.2,0)));
|
_head.setVelocity(_head.getPassenger().getLocation().getDirection().multiply(0.5).add(new Vector(0,0.2,0)));
|
||||||
|
|
||||||
Location infront = _head.getLocation().add(0, -1.5, 0);
|
Location infront = _head.getLocation().add(0, -1.5, 0);
|
||||||
|
|
||||||
@ -70,42 +81,55 @@ public class MountTitanData
|
|||||||
{
|
{
|
||||||
ArmorStand node = _nodes.get(i);
|
ArmorStand node = _nodes.get(i);
|
||||||
|
|
||||||
|
Location old = node.getLocation();
|
||||||
|
|
||||||
|
infront.setPitch(node.getLocation().getPitch());
|
||||||
|
infront.setYaw(node.getLocation().getYaw());
|
||||||
|
|
||||||
//Move
|
//Move
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
node.teleport(infront);
|
node.teleport(infront);
|
||||||
else if (UtilMath.offset(node.getLocation(), infront) > 0.5)
|
else if (UtilMath.offset(node.getLocation(), infront) > 0.6)
|
||||||
node.teleport(infront.add(UtilAlg.getTrajectory(infront, node.getLocation()).multiply(0.5)));
|
node.teleport(infront.add(UtilAlg.getTrajectory(infront, node.getLocation()).multiply(0.6)));
|
||||||
|
|
||||||
|
//Rotation
|
||||||
|
Vector vector = UtilAlg.getTrajectory(old, node.getLocation());
|
||||||
|
|
||||||
|
node.setHeadPose(new EulerAngle(
|
||||||
|
Math.toRadians(UtilAlg.GetPitch(vector)),
|
||||||
|
Math.toRadians(UtilAlg.GetYaw(vector)),
|
||||||
|
0));
|
||||||
|
|
||||||
infront = node.getLocation();
|
infront = node.getLocation();
|
||||||
|
|
||||||
//Rotation
|
|
||||||
node.setHeadPose(UtilAlg.vectorToEuler(UtilAlg.getTrajectory(infront, node.getLocation())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Shuffle In
|
//Shuffle In
|
||||||
if (_head.getPassenger() == null)
|
if (_head.getPassenger() == null)
|
||||||
{
|
{
|
||||||
for (int i=_nodes.size()-1 ; i>=0 ; i--)
|
for (int i=_nodes.size()-1 ; i>=0 ; i--)
|
||||||
{
|
{
|
||||||
ArmorStand node = _nodes.get(i);
|
ArmorStand node = _nodes.get(i);
|
||||||
|
|
||||||
if (i>0)
|
if (i>0)
|
||||||
infront = _nodes.get(i-1).getLocation();
|
infront = _nodes.get(i-1).getLocation();
|
||||||
else
|
else
|
||||||
infront = _head.getLocation().add(0, -1.5, 0);
|
infront = _head.getLocation().add(0, -1.5, 0);
|
||||||
|
|
||||||
|
infront.setPitch(node.getLocation().getPitch());
|
||||||
|
infront.setYaw(node.getLocation().getYaw());
|
||||||
|
|
||||||
node.teleport(infront);
|
node.teleport(infront);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void clean()
|
public void clean()
|
||||||
{
|
{
|
||||||
_head.remove();
|
_head.remove();
|
||||||
|
|
||||||
for (ArmorStand stand : _nodes)
|
for (ArmorStand stand : _nodes)
|
||||||
stand.remove();
|
stand.remove();
|
||||||
}
|
}
|
||||||
@ -114,4 +138,9 @@ public class MountTitanData
|
|||||||
{
|
{
|
||||||
return _owner.equals(player.getName());
|
return _owner.equals(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean ownsEntity(Entity ent)
|
||||||
|
{
|
||||||
|
return (_head.equals(ent) || _nodes.contains(ent));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,8 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
|||||||
|
|
||||||
if (rank.has(Rank.TITAN))
|
if (rank.has(Rank.TITAN))
|
||||||
{
|
{
|
||||||
// if (!Get(p).GetPets().containsKey(EntityType.SKELETON))
|
if (!Get(p).GetPets().containsKey(EntityType.SKELETON))
|
||||||
// Get(p).GetPets().put(EntityType.SKELETON, "Guardian");
|
Get(p).GetPets().put(EntityType.SKELETON, "Guardian");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user