Merge branch 'clans-beta' of http://184.154.0.242:7990/scm/min/mineplex into clans_custom_gear
This commit is contained in:
commit
7047bbf8f6
@ -7,8 +7,11 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Silverfish;
|
import org.bukkit.entity.Silverfish;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -19,6 +22,7 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
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 mineplex.core.common.util.UtilPlayer;
|
||||||
@ -41,6 +45,8 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
|||||||
|
|
||||||
private boolean _enabled = true;
|
private boolean _enabled = true;
|
||||||
|
|
||||||
|
private double _speed = 0.75;
|
||||||
|
|
||||||
private int _ticks = 0;
|
private int _ticks = 0;
|
||||||
|
|
||||||
public SnakeCreature(WorldEvent event, Location spawnLocation)
|
public SnakeCreature(WorldEvent event, Location spawnLocation)
|
||||||
@ -61,7 +67,7 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
|||||||
for (int i = 0; i < getHealth() / 50; i++)
|
for (int i = 0; i < getHealth() / 50; i++)
|
||||||
{
|
{
|
||||||
SnakeSegment tail = new SnakeSegment(getSpawnLocation().toVector().subtract(dir.clone().multiply(-i)),
|
SnakeSegment tail = new SnakeSegment(getSpawnLocation().toVector().subtract(dir.clone().multiply(-i)),
|
||||||
new ItemStack(i == 0 ? Material.EMERALD_BLOCK : Material.STONE));
|
new ItemStack(i == 0 ? Material.CHEST : Material.DROPPER));
|
||||||
|
|
||||||
_segments.add(tail);
|
_segments.add(tail);
|
||||||
}
|
}
|
||||||
@ -155,7 +161,7 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
|||||||
|
|
||||||
ArrayList<Packet> packets = new ArrayList<Packet>();
|
ArrayList<Packet> packets = new ArrayList<Packet>();
|
||||||
|
|
||||||
for (int i = _segments.size() - 1; i >= 0; i--)
|
for (int i = 0 ; i < _segments.size() ; i++)
|
||||||
{
|
{
|
||||||
SnakeSegment seg = _segments.get(i);
|
SnakeSegment seg = _segments.get(i);
|
||||||
|
|
||||||
@ -163,22 +169,13 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
|||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
Vector moveTo = UtilAlg.getTrajectory(vec, _waypoint.toVector());
|
Vector direction = UtilAlg.getTrajectory(vec, _waypoint.toVector());
|
||||||
|
|
||||||
// Vector target = vec.clone().add(moveTo.multiply(3));
|
|
||||||
//
|
|
||||||
// //MATHS
|
|
||||||
// double speed = 10d;
|
|
||||||
// double right = -Math.sin(_ticks/speed) * 4;
|
|
||||||
// double up = Math.cos(_ticks/speed) * 4;
|
|
||||||
//
|
|
||||||
// target.add(UtilAlg.getRight(vec).multiply(right));
|
|
||||||
// target.add(UtilAlg.getUp(vec).multiply(up));
|
|
||||||
|
|
||||||
_velocity.add(moveTo.normalize().multiply(0.04));
|
_velocity.add(direction.multiply(0.1 * _speed));
|
||||||
|
|
||||||
if (_velocity.length() > 0.5)
|
if (_velocity.length() > _speed)
|
||||||
_velocity.normalize().multiply(0.5);
|
_velocity.normalize().multiply(_speed);
|
||||||
|
|
||||||
// Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(moveTo));
|
// Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(moveTo));
|
||||||
|
|
||||||
@ -186,14 +183,23 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
|||||||
|
|
||||||
// Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(vec));
|
// Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(vec));
|
||||||
|
|
||||||
if (UtilMath.offset(vec, _waypoint.toVector()) < 5)
|
if (UtilMath.offset(vec, _waypoint.toVector()) < 6)
|
||||||
{
|
{
|
||||||
getNewWaypoint();
|
getNewWaypoint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vec = _segments.get(i - 1).getLocation();
|
Vector infront = _segments.get(i - 1).getLocation();
|
||||||
|
Vector behind = _segments.get(i - 1).getLastLocation();
|
||||||
|
|
||||||
|
vec = infront.clone().add(UtilAlg.getTrajectory(infront, behind).multiply(_seperator));
|
||||||
|
}
|
||||||
|
|
||||||
|
Block block = _waypoint.getWorld().getBlockAt(seg.getLocation().getBlockX(),seg.getLocation().getBlockY(),seg.getLocation().getBlockZ()).getRelative(BlockFace.UP);
|
||||||
|
if (block.getType() != Material.AIR && UtilBlock.isVisible(block))
|
||||||
|
{
|
||||||
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
packets.addAll(Arrays.asList(seg.moveEntity(vec)));
|
packets.addAll(Arrays.asList(seg.moveEntity(vec)));
|
||||||
@ -210,8 +216,19 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void command(PlayerCommandPreprocessEvent event)
|
public void command(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
if (event.getMessage().contains("start"))
|
if (event.getMessage().contains("speed"))
|
||||||
_enabled = true;
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_speed = Double.parseDouble(event.getMessage().split(" ")[1]);
|
||||||
|
|
||||||
|
Bukkit.broadcastMessage("SPEED " + _speed);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ public class SnakeSegment
|
|||||||
{
|
{
|
||||||
private int _entityId = UtilEnt.getNewEntityId();
|
private int _entityId = UtilEnt.getNewEntityId();
|
||||||
private Vector _entityLocation;
|
private Vector _entityLocation;
|
||||||
|
private Vector _entityLastLocation;
|
||||||
private ItemStack _item;
|
private ItemStack _item;
|
||||||
private Vector _prevDir = new Vector();
|
private Vector _prevDir = new Vector();
|
||||||
|
|
||||||
@ -35,6 +36,8 @@ public class SnakeSegment
|
|||||||
|
|
||||||
public Packet[] moveEntity(Vector newLocation)
|
public Packet[] moveEntity(Vector newLocation)
|
||||||
{
|
{
|
||||||
|
_entityLastLocation = _entityLocation.clone();
|
||||||
|
|
||||||
Vector toMove = newLocation.clone().subtract(_entityLocation);
|
Vector toMove = newLocation.clone().subtract(_entityLocation);
|
||||||
Packet packet1;
|
Packet packet1;
|
||||||
|
|
||||||
@ -76,9 +79,9 @@ public class SnakeSegment
|
|||||||
packet1 = teleportPacket;
|
packet1 = teleportPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
toMove.normalize();
|
Vector vec = new Vector(UtilAlg.GetPitch(toMove), UtilAlg.GetYaw(toMove), 0);
|
||||||
|
|
||||||
if (toMove.equals(_prevDir))
|
if (vec.equals(_prevDir))
|
||||||
{
|
{
|
||||||
return new Packet[]
|
return new Packet[]
|
||||||
{
|
{
|
||||||
@ -86,14 +89,14 @@ public class SnakeSegment
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_prevDir = toMove;
|
_prevDir = vec;
|
||||||
|
|
||||||
DataWatcher watcher = new DataWatcher(null);
|
DataWatcher watcher = new DataWatcher(null);
|
||||||
watcher.a(0, (byte) 32);
|
watcher.a(0, (byte) 0);
|
||||||
watcher.a(1, 0);
|
watcher.a(1, 0);
|
||||||
watcher.a(10, (byte) 0);
|
watcher.a(10, (byte) 0);
|
||||||
|
|
||||||
watcher.a(11, toMove);
|
watcher.a(11, vec);
|
||||||
|
|
||||||
for (int i = 12; i < 17; i++)
|
for (int i = 12; i < 17; i++)
|
||||||
{
|
{
|
||||||
@ -116,12 +119,17 @@ public class SnakeSegment
|
|||||||
return _entityLocation.clone();
|
return _entityLocation.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector getLastLocation()
|
||||||
|
{
|
||||||
|
return _entityLastLocation.clone();
|
||||||
|
}
|
||||||
|
|
||||||
public Packet[] getSpawn()
|
public Packet[] getSpawn()
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
|
|
||||||
DataWatcher watcher = new DataWatcher(null);
|
DataWatcher watcher = new DataWatcher(null);
|
||||||
watcher.a(0, (byte) 32);
|
watcher.a(0, (byte) 0);
|
||||||
watcher.a(1, 0);
|
watcher.a(1, 0);
|
||||||
|
|
||||||
packet.a = getId();
|
packet.a = getId();
|
||||||
|
@ -17,7 +17,7 @@ public class SpiderBoss extends WorldEvent
|
|||||||
public SpiderBoss(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager,
|
public SpiderBoss(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager,
|
||||||
Location cornerLocation)
|
Location cornerLocation)
|
||||||
{
|
{
|
||||||
super(damageManager, blockRestore, conditionManager, "Brood Mother", cornerLocation);
|
super(damageManager, blockRestore, conditionManager, "Brood Mother", cornerLocation, "schematic/Golem.schematic");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,7 +137,7 @@ public class SpiderCreature extends EventCreature<Spider>
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ability = (BossAbility) entry.getKey().getConstructor(GolemCreature.class).newInstance(this);
|
ability = (BossAbility) entry.getKey().getConstructor(SpiderCreature.class).newInstance(this);
|
||||||
|
|
||||||
if (ability.getTarget() == null)
|
if (ability.getTarget() == null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user