Let exp orbs be a little bit nicer

This commit is contained in:
Andrew 2013-08-20 05:45:25 +12:00
parent 505f996b46
commit 9b4e9b4b62
2 changed files with 47 additions and 42 deletions

View File

@ -129,7 +129,6 @@ public class Disguise {
fallSpeed = 0; fallSpeed = 0;
break; break;
case DROPPED_ITEM: case DROPPED_ITEM:
case EXPERIENCE_ORB:
case MAGMA_CUBE: case MAGMA_CUBE:
case PRIMED_TNT: case PRIMED_TNT:
fallSpeed = 0.2; fallSpeed = 0.2;
@ -139,6 +138,10 @@ public class Disguise {
case FALLING_BLOCK: case FALLING_BLOCK:
fallSpeed = 0.04; fallSpeed = 0.04;
break; break;
case EXPERIENCE_ORB:
fallSpeed = 0.0221;
movement = true;
break;
case SPIDER: case SPIDER:
case CAVE_SPIDER: case CAVE_SPIDER:
fallSpeed = 0.0040; fallSpeed = 0.0040;
@ -178,47 +181,50 @@ public class Disguise {
if (vector.getY() != 0 && !(vector.getY() < 0 && alwaysSendVelocity && entity.isOnGround())) { if (vector.getY() != 0 && !(vector.getY() < 0 && alwaysSendVelocity && entity.isOnGround())) {
return; return;
} }
PacketContainer lookPacket = null; if (getType() != DisguiseType.EXPERIENCE_ORB || !entity.isOnGround()) {
PacketContainer selfLookPacket = null; PacketContainer lookPacket = null;
if (getType() == DisguiseType.WITHER_SKULL) { PacketContainer selfLookPacket = null;
lookPacket = new PacketContainer(Packets.Server.ENTITY_LOOK); if (getType() == DisguiseType.WITHER_SKULL) {
StructureModifier<Object> mods = lookPacket.getModifier(); lookPacket = new PacketContainer(Packets.Server.ENTITY_LOOK);
mods.write(0, entity.getEntityId()); StructureModifier<Object> mods = lookPacket.getModifier();
Location loc = entity.getLocation();
mods.write(
4,
PacketsManager.getYaw(getType(), DisguiseType.getType(entity.getType()),
(byte) Math.floor(loc.getYaw() * 256.0F / 360.0F)));
mods.write(5, (byte) Math.floor(loc.getPitch() * 256.0F / 360.0F));
selfLookPacket = lookPacket.shallowClone();
}
for (EntityPlayer player : getPerverts()) {
PacketContainer packet = new PacketContainer(Packets.Server.ENTITY_VELOCITY);
StructureModifier<Object> mods = packet.getModifier();
if (entity == player.getBukkitEntity()) {
if (!viewSelfDisguise())
continue;
if (selfLookPacket != null) {
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(player.getBukkitEntity(),
selfLookPacket, false);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
mods.write(0, DisguiseAPI.getFakeDisguise(entity.getEntityId()));
} else
mods.write(0, entity.getEntityId()); mods.write(0, entity.getEntityId());
mods.write(1, (int) (vector.getX() * 8000)); Location loc = entity.getLocation();
mods.write(2, (int) (8000 * (vectorY * (double) player.ping * 0.069))); mods.write(
mods.write(3, (int) (vector.getZ() * 8000)); 4,
try { PacketsManager.getYaw(getType(), DisguiseType.getType(entity.getType()),
if (lookPacket != null) (byte) Math.floor(loc.getYaw() * 256.0F / 360.0F)));
ProtocolLibrary.getProtocolManager().sendServerPacket(player.getBukkitEntity(), lookPacket, mods.write(5, (byte) Math.floor(loc.getPitch() * 256.0F / 360.0F));
false); selfLookPacket = lookPacket.shallowClone();
ProtocolLibrary.getProtocolManager().sendServerPacket(player.getBukkitEntity(), packet, false); }
} catch (InvocationTargetException e) { for (EntityPlayer player : getPerverts()) {
e.printStackTrace(); PacketContainer packet = new PacketContainer(Packets.Server.ENTITY_VELOCITY);
StructureModifier<Object> mods = packet.getModifier();
if (entity == player.getBukkitEntity()) {
if (!viewSelfDisguise())
continue;
if (selfLookPacket != null) {
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(player.getBukkitEntity(),
selfLookPacket, false);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
mods.write(0, DisguiseAPI.getFakeDisguise(entity.getEntityId()));
} else
mods.write(0, entity.getEntityId());
mods.write(1, (int) (vector.getX() * 8000));
mods.write(2, (int) (8000 * (vectorY * (double) player.ping * 0.069)));
mods.write(3, (int) (vector.getZ() * 8000));
try {
if (lookPacket != null)
ProtocolLibrary.getProtocolManager().sendServerPacket(player.getBukkitEntity(),
lookPacket, false);
ProtocolLibrary.getProtocolManager()
.sendServerPacket(player.getBukkitEntity(), packet, false);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
} }
} }
// If we need to send more packets because else it still 'sinks' // If we need to send more packets because else it still 'sinks'

View File

@ -380,7 +380,6 @@ public class PacketsManager {
case EGG: case EGG:
case ENDER_PEARL: case ENDER_PEARL:
case ENDER_SIGNAL: case ENDER_SIGNAL:
case EXPERIENCE_ORB:
case FIREWORK: case FIREWORK:
case MINECART: case MINECART:
case MINECART_CHEST: case MINECART_CHEST: