Merge branch 'clans-beta' of ssh://184.154.0.242:7999/min/Mineplex into clans-beta

This commit is contained in:
NewGarbo 2015-11-28 09:04:15 +00:00
commit 0dceca5cfc
4 changed files with 107 additions and 40 deletions

View File

@ -21,6 +21,7 @@
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.PlayerCache" />
<element id="module-output" name="Mineplex.Game.Clans.Core" />
</root>
</artifact>
</component>

View File

@ -17,7 +17,6 @@
<module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerProcesses/Mineplex.ServerProcesses.iml" filepath="$PROJECT_DIR$/Mineplex.ServerProcesses/Mineplex.ServerProcesses.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" filepath="$PROJECT_DIR$/Mineplex.Votifier/Mineplex.Votifier.iml" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" filepath="$PROJECT_DIR$/Nautilus.Game.PvP/Nautilus.Game.PvP.iml" group="Legacy" />

View File

@ -651,6 +651,11 @@ public class UtilEnt
return CreatureLook(ent, UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec));
}
public static boolean CreatureLook(Entity ent, Vector target)
{
return CreatureLook(ent, UtilAlg.GetPitch(target), UtilAlg.GetYaw(target));
}
public static void setFakeHead(Entity ent, boolean fakeHead)
{
net.minecraft.server.v1_8_R3.Entity ec = ((CraftEntity) ent).getHandle();

View File

@ -1,40 +1,49 @@
package mineplex.core.mount.types;
import java.util.ArrayList;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseGuardian;
import mineplex.core.disguise.disguises.DisguiseMagmaCube;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
public class MountTitanData
{
private String _owner;
private Slime _head;
private LivingEntity _head;
private ArrayList<ArmorStand> _nodes;
public MountTitanData(Player player, String name)
public MountTitanData(DisguiseManager disguiseManager, Player player, String name)
{
_owner = player.getName();
// Nodes
_nodes = new ArrayList<ArmorStand>();
Location loc = player.getLocation();
loc.setYaw(0);
loc.setPitch(0);
for (int i = 0; i < 30; i++)
{
ArmorStand node = player.getWorld().spawn(player.getLocation(), ArmorStand.class);
ArmorStand node = player.getWorld().spawn(loc, ArmorStand.class);
node.setVisible(false);
node.setGravity(false);
@ -45,10 +54,19 @@ public class MountTitanData
}
// Head
_head = player.getWorld().spawn(player.getLocation(), MagmaCube.class);
_head.setSize(2);
_head = (LivingEntity) player.getWorld().spawnEntity(loc, EntityType.BAT);
UtilEnt.Vegetate(_head, true);
UtilEnt.silence(_head, true);
UtilEnt.setFakeHead(_head, true);
_head.setCustomName(player.getName() + "'s " + name);
((CraftLivingEntity) _head).getHandle().setMineplexInvisible(true);
DisguiseMagmaCube disguise = new DisguiseMagmaCube(_head);
disguise.SetSize(2);
disguiseManager.disguise(disguise);
}
public void mount(Player player, Entity entity)
@ -61,27 +79,68 @@ public class MountTitanData
{
// Head
if (_head.getPassenger() != null)
{
_head.setVelocity(_head.getPassenger().getLocation().getDirection().add(new Vector(0, 0.2, 0)));
Location infront = _head.getLocation().add(0, -1.5, 0);
UtilEnt.CreatureLook(_head, _head.getPassenger().getLocation().getDirection());
}
else
{
Player player = Bukkit.getPlayerExact(_owner);
if (player != null)
{
Vector moving = null;
if (UtilMath.offset(player, _head) > 12)
{
moving = _head.getLocation().getDirection().normalize();
Vector vec = moving.clone().subtract(UtilAlg.getTrajectory(player, _head)).normalize();
vec.setY(-vec.getY());
moving.add(vec.multiply(0.15));
}
else
{
moving = _head.getLocation().getDirection();
moving.setX(moving.getX() + UtilMath.rr(0.1, true));
moving.setY(moving.getY() + UtilMath.rr(0.3, true));
moving.setZ(moving.getZ() + UtilMath.rr(0.1, true));
}
moving.normalize().multiply(0.5);
UtilEnt.CreatureLook(_head, moving);
_head.setVelocity(moving);
}
}
Location infront = _head.getLocation().add(0, -1.3, 0);
infront.setYaw(0);
infront.setPitch(0);
// Move
for (int i = 0; i < 30; i++)
{
ArmorStand node = _nodes.get(i);
Location loc = node.getLocation();
// Move
if (i == 0)
node.teleport(infront);
else if (UtilMath.offset(node.getLocation(), infront) > 0.5)
node.teleport(infront.add(UtilAlg.getTrajectory(infront, node.getLocation()).multiply(0.5)));
infront = node.getLocation();
// Rotation
node.setHeadPose(UtilAlg.vectorToEuler(UtilAlg.getTrajectory(infront, node.getLocation())));
}
node.setHeadPose(UtilAlg.vectorToEuler(UtilAlg.getTrajectory(node.getLocation(), loc)));
infront = node.getLocation();
}
// Shuffle In
if (_head.getPassenger() == null)
@ -90,17 +149,20 @@ public class MountTitanData
{
ArmorStand node = _nodes.get(i);
Location loc = node.getLocation();
if (i > 0)
infront = _nodes.get(i - 1).getLocation();
else
infront = _head.getLocation().add(0, -1.5, 0);
infront = _head.getLocation().add(0, -1.3, 0);
node.teleport(infront);
}
}
}
node.setHeadPose(new EulerAngle(0, -UtilAlg.GetYaw(UtilAlg.getTrajectory(node.getLocation(), loc)), 0));
// node.setHeadPose(UtilAlg.vectorToEuler(UtilAlg.getTrajectory(node.getLocation(), loc)));
}
}
}
public void clean()
{