Read desc
Changed minecarts to appear lower to the ground Changed the player constructor so its compatible with 1.7 Changed the vechile spawn to use the constructor cos YOLO
This commit is contained in:
parent
9c305f09da
commit
5c41c04dd8
@ -127,7 +127,7 @@ public class PacketsManager {
|
|||||||
public static PacketContainer[] constructSpawnPackets(Disguise disguise, Entity disguisedEntity) {
|
public static PacketContainer[] constructSpawnPackets(Disguise disguise, Entity disguisedEntity) {
|
||||||
if (disguise.getEntity() == null)
|
if (disguise.getEntity() == null)
|
||||||
disguise.setEntity(disguisedEntity);
|
disguise.setEntity(disguisedEntity);
|
||||||
// net.minecraft.server.v1_6_R3.Entity nmsEntity = ((CraftEntity) disguisedEntity).getHandle();
|
Object nmsEntity = ReflectionManager.getNmsEntity(disguisedEntity);
|
||||||
ArrayList<PacketContainer> packets = new ArrayList<PacketContainer>();
|
ArrayList<PacketContainer> packets = new ArrayList<PacketContainer>();
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
int slot = i - 1;
|
int slot = i - 1;
|
||||||
@ -195,22 +195,25 @@ public class PacketsManager {
|
|||||||
} else if (disguise.getType().isPlayer()) {
|
} else if (disguise.getType().isPlayer()) {
|
||||||
|
|
||||||
spawnPackets[0] = new PacketContainer(Packets.Server.NAMED_ENTITY_SPAWN);
|
spawnPackets[0] = new PacketContainer(Packets.Server.NAMED_ENTITY_SPAWN);
|
||||||
StructureModifier<Object> mods = spawnPackets[0].getModifier();
|
StructureModifier<String> stringMods = spawnPackets[0].getStrings();
|
||||||
mods.write(0, disguisedEntity.getEntityId());
|
for (int i = 0; i < stringMods.size(); i++) {
|
||||||
mods.write(1, ((PlayerDisguise) disguise).getName());
|
stringMods.write(i, ((PlayerDisguise) disguise).getName());
|
||||||
mods.write(2, ((PlayerDisguise) disguise).getName());
|
}
|
||||||
mods.write(3, (int) Math.floor(loc.getX() * 32));
|
StructureModifier<Integer> intMods = spawnPackets[0].getIntegers();
|
||||||
mods.write(4, (int) Math.floor(loc.getY() * 32));
|
intMods.write(0, disguisedEntity.getEntityId());
|
||||||
mods.write(5, (int) Math.floor(loc.getZ() * 32));
|
intMods.write(1, (int) Math.floor(loc.getX() * 32));
|
||||||
mods.write(6, yaw);
|
intMods.write(2, (int) Math.floor(loc.getY() * 32));
|
||||||
mods.write(7, (byte) (int) (loc.getPitch() * 256F / 360F));
|
intMods.write(3, (int) Math.floor(loc.getZ() * 32));
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
if (disguisedEntity instanceof Player && ((Player) disguisedEntity).getItemInHand() != null) {
|
if (disguisedEntity instanceof Player && ((Player) disguisedEntity).getItemInHand() != null) {
|
||||||
item = ((Player) disguisedEntity).getItemInHand();
|
item = ((Player) disguisedEntity).getItemInHand();
|
||||||
} else if (disguisedEntity instanceof LivingEntity) {
|
} else if (disguisedEntity instanceof LivingEntity) {
|
||||||
item = ((LivingEntity) disguisedEntity).getEquipment().getItemInHand();
|
item = ((LivingEntity) disguisedEntity).getEquipment().getItemInHand();
|
||||||
}
|
}
|
||||||
mods.write(8, (item == null || item.getType() == Material.AIR ? 0 : item.getTypeId()));
|
intMods.write(4, (item == null || item.getType() == Material.AIR ? 0 : item.getTypeId()));
|
||||||
|
StructureModifier<Byte> byteMods = spawnPackets[0].getBytes();
|
||||||
|
byteMods.write(0, yaw);
|
||||||
|
byteMods.write(1, (byte) (int) (loc.getPitch() * 256F / 360F));
|
||||||
spawnPackets[0].getDataWatcherModifier().write(0,
|
spawnPackets[0].getDataWatcherModifier().write(0,
|
||||||
createDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher()));
|
createDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher()));
|
||||||
|
|
||||||
@ -246,12 +249,8 @@ public class PacketsManager {
|
|||||||
mods.write(7, (int) (d4 * 8000.0D));
|
mods.write(7, (int) (d4 * 8000.0D));
|
||||||
mods.write(8, yaw);
|
mods.write(8, yaw);
|
||||||
mods.write(9, (byte) (int) (loc.getPitch() * 256.0F / 360.0F));
|
mods.write(9, (byte) (int) (loc.getPitch() * 256.0F / 360.0F));
|
||||||
// if (nmsEntity instanceof EntityLiving)
|
|
||||||
// mods.write(10, (byte) (int) (((EntityLiving) nmsEntity).aA * 256.0F / 360.0F));
|
|
||||||
spawnPackets[0].getDataWatcherModifier().write(0,
|
spawnPackets[0].getDataWatcherModifier().write(0,
|
||||||
createDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher()));
|
createDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher()));
|
||||||
// Theres a list sometimes written with this. But no problems have appeared!
|
|
||||||
// Probably just the metadata to be sent. But the next meta packet after fixes that anyways.
|
|
||||||
|
|
||||||
} else if (disguise.getType().isMisc()) {
|
} else if (disguise.getType().isMisc()) {
|
||||||
|
|
||||||
@ -272,38 +271,10 @@ public class PacketsManager {
|
|||||||
if (data < 0)
|
if (data < 0)
|
||||||
data = -data;
|
data = -data;
|
||||||
}
|
}
|
||||||
spawnPackets[0] = new PacketContainer(Packets.Server.VEHICLE_SPAWN);
|
spawnPackets[0] = ProtocolLibrary.getProtocolManager()
|
||||||
StructureModifier<Object> mods = spawnPackets[0].getModifier();
|
.createPacketConstructor(Packets.Server.VEHICLE_SPAWN, nmsEntity, id, data).createPacket(nmsEntity, id, data);
|
||||||
mods.write(0, disguisedEntity.getEntityId());
|
spawnPackets[0].getModifier().write(2, (int) Math.floor(loc.getY() * 32D));
|
||||||
mods.write(1, (int) Math.floor(loc.getX() * 32D));
|
spawnPackets[0].getModifier().write(8, yaw);
|
||||||
mods.write(2, (int) Math.floor(loc.getY() * 32D));
|
|
||||||
mods.write(3, (int) Math.floor(loc.getZ() * 32D));
|
|
||||||
if (data > 0) {
|
|
||||||
Vector vec = disguisedEntity.getVelocity();
|
|
||||||
double d1 = vec.getX();
|
|
||||||
double d2 = vec.getY();
|
|
||||||
double d3 = vec.getZ();
|
|
||||||
double d4 = 3.9D;
|
|
||||||
if (d1 < -d4)
|
|
||||||
d1 = -d4;
|
|
||||||
if (d2 < -d4)
|
|
||||||
d2 = -d4;
|
|
||||||
if (d3 < -d4)
|
|
||||||
d3 = -d4;
|
|
||||||
if (d1 > d4)
|
|
||||||
d1 = d4;
|
|
||||||
if (d2 > d4)
|
|
||||||
d2 = d4;
|
|
||||||
if (d3 > d4)
|
|
||||||
d3 = d4;
|
|
||||||
mods.write(4, (int) (d1 * 8000.0D));
|
|
||||||
mods.write(5, (int) (d2 * 8000.0D));
|
|
||||||
mods.write(6, (int) (d3 * 8000.0D));
|
|
||||||
}
|
|
||||||
mods.write(7, (int) Math.floor(loc.getPitch() * 256.0F / 360.0F));
|
|
||||||
mods.write(8, yaw);
|
|
||||||
mods.write(9, id);
|
|
||||||
mods.write(10, data);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (spawnPackets[1] == null) {
|
if (spawnPackets[1] == null) {
|
||||||
@ -385,18 +356,19 @@ public class PacketsManager {
|
|||||||
case BAT:
|
case BAT:
|
||||||
if (entity instanceof LivingEntity)
|
if (entity instanceof LivingEntity)
|
||||||
return ((LivingEntity) entity).getEyeHeight();
|
return ((LivingEntity) entity).getEyeHeight();
|
||||||
case ARROW:
|
|
||||||
case BOAT:
|
|
||||||
case EGG:
|
|
||||||
case ENDER_PEARL:
|
|
||||||
case ENDER_SIGNAL:
|
|
||||||
case FIREWORK:
|
|
||||||
case MINECART:
|
case MINECART:
|
||||||
case MINECART_CHEST:
|
case MINECART_CHEST:
|
||||||
case MINECART_FURNACE:
|
case MINECART_FURNACE:
|
||||||
case MINECART_HOPPER:
|
case MINECART_HOPPER:
|
||||||
case MINECART_MOB_SPAWNER:
|
case MINECART_MOB_SPAWNER:
|
||||||
case MINECART_TNT:
|
case MINECART_TNT:
|
||||||
|
return 0.4;
|
||||||
|
case ARROW:
|
||||||
|
case BOAT:
|
||||||
|
case EGG:
|
||||||
|
case ENDER_PEARL:
|
||||||
|
case ENDER_SIGNAL:
|
||||||
|
case FIREWORK:
|
||||||
case PAINTING:
|
case PAINTING:
|
||||||
case SMALL_FIREBALL:
|
case SMALL_FIREBALL:
|
||||||
case SNOWBALL:
|
case SNOWBALL:
|
||||||
|
Loading…
Reference in New Issue
Block a user