Add support for 1.8 disguises

This commit is contained in:
libraryaddict 2014-09-27 12:18:54 +12:00
parent 3d99e4975a
commit 8cecfe98d6
12 changed files with 328 additions and 32 deletions

View File

@ -10,11 +10,14 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader; import java.io.Reader;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import me.libraryaddict.disguise.commands.*; import me.libraryaddict.disguise.commands.*;
import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.DisguiseType; import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher; import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
import me.libraryaddict.disguise.disguisetypes.FutureDisguiseType;
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.GuardianWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.MinecartWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.MinecartWatcher;
@ -23,9 +26,11 @@ import me.libraryaddict.disguise.disguisetypes.watchers.TameableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
import me.libraryaddict.disguise.utilities.DisguiseSound; import me.libraryaddict.disguise.utilities.DisguiseSound;
import me.libraryaddict.disguise.utilities.DisguiseUtilities; import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.FakeBoundingBox;
import me.libraryaddict.disguise.utilities.PacketsManager; import me.libraryaddict.disguise.utilities.PacketsManager;
import me.libraryaddict.disguise.utilities.ReflectionManager; import me.libraryaddict.disguise.utilities.ReflectionManager;
import me.libraryaddict.disguise.utilities.DisguiseValues; import me.libraryaddict.disguise.utilities.DisguiseValues;
import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Ageable; import org.bukkit.entity.Ageable;
@ -149,7 +154,7 @@ public class LibsDisguises extends JavaPlugin {
*/ */
private void registerValues() { private void registerValues() {
for (DisguiseType disguiseType : DisguiseType.values()) { for (DisguiseType disguiseType : DisguiseType.values()) {
if (disguiseType.getEntityType() == null) { if (disguiseType.getEntityType() == null && !(disguiseType.is1_8() && LibVersion.is1_8())) {
continue; continue;
} }
Class watcherClass = null; Class watcherClass = null;
@ -176,6 +181,9 @@ public class LibsDisguises extends JavaPlugin {
case MAGMA_CUBE: case MAGMA_CUBE:
watcherClass = SlimeWatcher.class; watcherClass = SlimeWatcher.class;
break; break;
case ELDER_GUARDIAN:
watcherClass = GuardianWatcher.class;
break;
default: default:
watcherClass = Class.forName("me.libraryaddict.disguise.disguisetypes.watchers." watcherClass = Class.forName("me.libraryaddict.disguise.disguisetypes.watchers."
+ toReadable(disguiseType.name()) + "Watcher"); + toReadable(disguiseType.name()) + "Watcher");
@ -195,6 +203,28 @@ public class LibsDisguises extends JavaPlugin {
} }
} }
disguiseType.setWatcherClass(watcherClass); disguiseType.setWatcherClass(watcherClass);
if (DisguiseValues.getDisguiseValues(disguiseType) != null) {
continue;
}
if (disguiseType.is1_8()) {
int entitySize = 0;
FutureDisguiseType futureType = disguiseType.getFutureType();
DisguiseValues disguiseValues = new DisguiseValues(disguiseType, null, entitySize, futureType.getMaxHealth());
Object[] objs = disguiseType.getFutureType().getDataWatcher();
for (int i = 0; i < objs.length; i += 2) {
disguiseValues.setMetaValue((Integer) objs[i], objs[i + 1]);
}
// Get the bounding box
float[] box = futureType.getBoundingBox();
disguiseValues.setAdultBox(new FakeBoundingBox(box[0], box[1], box[2]));
/* if (disguiseType == DisguiseType.RABBIT) {
((Ageable) bukkitEntity).setBaby();
disguiseValues.setBabyBox(ReflectionManager.getBoundingBox(bukkitEntity));
}
disguiseValues.setEntitySize(ReflectionManager.getSize(bukkitEntity));*/
continue;
}
String nmsEntityName = toReadable(disguiseType.name()); String nmsEntityName = toReadable(disguiseType.name());
switch (disguiseType) { switch (disguiseType) {
case WITHER_SKELETON: case WITHER_SKELETON:
@ -234,9 +264,6 @@ public class LibsDisguises extends JavaPlugin {
default: default:
break; break;
} }
if (DisguiseValues.getDisguiseValues(disguiseType) != null) {
continue;
}
try { try {
Object nmsEntity = ReflectionManager.createEntityInstance(nmsEntityName); Object nmsEntity = ReflectionManager.createEntityInstance(nmsEntityName);
if (nmsEntity == null) { if (nmsEntity == null) {
@ -292,7 +319,6 @@ public class LibsDisguises extends JavaPlugin {
.print("[LibsDisguises] Development builds are available at (ProtocolLib) " .print("[LibsDisguises] Development builds are available at (ProtocolLib) "
+ "http://assets.comphenix.net/job/ProtocolLib/ and (LibsDisguises) http://ci.md-5.net/job/LibsDisguises/"); + "http://assets.comphenix.net/job/ProtocolLib/ and (LibsDisguises) http://ci.md-5.net/job/LibsDisguises/");
} }
System.out.print("[LibsDisguises] Note that these builds have not been reviewed by Bukkit for safety.");
ex.printStackTrace(); ex.printStackTrace();
} }

View File

@ -19,6 +19,7 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.PacketsManager; import me.libraryaddict.disguise.utilities.PacketsManager;
import me.libraryaddict.disguise.utilities.ReflectionManager; import me.libraryaddict.disguise.utilities.ReflectionManager;
import me.libraryaddict.disguise.utilities.DisguiseValues; import me.libraryaddict.disguise.utilities.DisguiseValues;
import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -63,7 +64,7 @@ public abstract class Disguise {
protected void createDisguise(DisguiseType newType) { protected void createDisguise(DisguiseType newType) {
if (getWatcher() != null) if (getWatcher() != null)
return; return;
if (newType.getEntityType() == null) { if (!(LibVersion.is1_8() && newType.is1_8()) && newType.getEntityType() == null) {
throw new RuntimeException( throw new RuntimeException(
"DisguiseType " "DisguiseType "
+ newType + newType
@ -634,8 +635,10 @@ public abstract class Disguise {
} }
Class nmsEntityClass = ReflectionManager.getNmsEntity(getEntity()).getClass(); Class nmsEntityClass = ReflectionManager.getNmsEntity(getEntity()).getClass();
Class nmsDisguiseClass = DisguiseValues.getNmsEntityClass(getType()); Class nmsDisguiseClass = DisguiseValues.getNmsEntityClass(getType());
if (nmsDisguiseClass != null) {
// If they both extend the same base class. They OBVIOUSLY share the same datavalue. Right..? // If they both extend the same base class. They OBVIOUSLY share the same datavalue. Right..?
if (baseClass != null && baseClass.isAssignableFrom(nmsDisguiseClass) && baseClass.isAssignableFrom(nmsEntityClass)) if (baseClass != null && baseClass.isAssignableFrom(nmsDisguiseClass)
&& baseClass.isAssignableFrom(nmsEntityClass))
continue; continue;
// So they don't extend a basic class. // So they don't extend a basic class.
@ -644,6 +647,7 @@ public abstract class Disguise {
// datawatchers. // datawatchers.
if (nmsEntityClass.isAssignableFrom(nmsDisguiseClass) || nmsDisguiseClass.isAssignableFrom(nmsEntityClass)) if (nmsEntityClass.isAssignableFrom(nmsDisguiseClass) || nmsDisguiseClass.isAssignableFrom(nmsEntityClass))
continue; continue;
}
// Well I can't find a reason I should leave it alone. They will probably conflict. // Well I can't find a reason I should leave it alone. They will probably conflict.
// Time to set the value to the disguises value so no conflicts! // Time to set the value to the disguises value so no conflicts!
getWatcher().setBackupValue(dataNo, disguiseValues.get(dataNo)); getWatcher().setBackupValue(dataNo, disguiseValues.get(dataNo));

View File

@ -2,6 +2,8 @@ package me.libraryaddict.disguise.disguisetypes;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -10,6 +12,8 @@ import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie; import org.bukkit.entity.Zombie;
public enum DisguiseType { public enum DisguiseType {
ARMOR_STAND(FutureDisguiseType.ARMOR_STAND),
ARROW(60), ARROW(60),
BAT, BAT,
@ -32,6 +36,8 @@ public enum DisguiseType {
EGG(62), EGG(62),
ELDER_GUARDIAN(FutureDisguiseType.ELDER_GUARDIAN),
ENDER_CRYSTAL(51), ENDER_CRYSTAL(51),
ENDER_DRAGON, ENDER_DRAGON,
@ -42,6 +48,8 @@ public enum DisguiseType {
ENDERMAN, ENDERMAN,
ENDERMITE(FutureDisguiseType.ENDERMITE),
EXPERIENCE_ORB, EXPERIENCE_ORB,
FALLING_BLOCK(70, 1), FALLING_BLOCK(70, 1),
@ -56,6 +64,8 @@ public enum DisguiseType {
GIANT, GIANT,
GUARDIAN(FutureDisguiseType.GUARDIAN),
HORSE, HORSE,
IRON_GOLEM, IRON_GOLEM,
@ -96,6 +106,8 @@ public enum DisguiseType {
PRIMED_TNT(50), PRIMED_TNT(50),
RABBIT(FutureDisguiseType.RABBIT),
SHEEP, SHEEP,
SILVERFISH, SILVERFISH,
@ -232,9 +244,10 @@ public enum DisguiseType {
private int defaultId, entityId; private int defaultId, entityId;
private EntityType entityType; private EntityType entityType;
private FutureDisguiseType futureType;
private Class<? extends FlagWatcher> watcherClass; private Class<? extends FlagWatcher> watcherClass;
private DisguiseType(int... ints) { private DisguiseType(FutureDisguiseType disguiseType, int... ints) {
for (int i = 0; i < ints.length; i++) { for (int i = 0; i < ints.length; i++) {
int value = ints[i]; int value = ints[i];
switch (i) { switch (i) {
@ -248,12 +261,29 @@ public enum DisguiseType {
break; break;
} }
} }
if (LibVersion.is1_8()) {
futureType = disguiseType;
}
}
private DisguiseType(int... ints) {
this(null, ints);
} }
public int getDefaultId() { public int getDefaultId() {
return defaultId; return defaultId;
} }
public Class<? extends Entity> getEntityClass() {
if (futureType != null) {
return futureType.getEntityClass();
}
if (entityType != null) {
return getEntityType().getEntityClass();
}
return Entity.class;
}
public int getEntityId() { public int getEntityId() {
return entityId; return entityId;
} }
@ -262,16 +292,28 @@ public enum DisguiseType {
return entityType; return entityType;
} }
public FutureDisguiseType getFutureType() {
return futureType;
}
public int getTypeId() {
return is1_8() ? futureType.getEntityId() : (int) getEntityType().getTypeId();
}
public Class getWatcherClass() { public Class getWatcherClass() {
return watcherClass; return watcherClass;
} }
public boolean is1_8() {
return futureType != null;
}
public boolean isMisc() { public boolean isMisc() {
return !getEntityType().isAlive(); return is1_8() ? !futureType.isAlive() : getEntityType() != null && !getEntityType().isAlive();
} }
public boolean isMob() { public boolean isMob() {
return getEntityType().isAlive() && this != DisguiseType.PLAYER; return is1_8() ? futureType.isAlive() : getEntityType() != null && getEntityType().isAlive() && !isPlayer();
} }
public boolean isPlayer() { public boolean isPlayer() {

View File

@ -0,0 +1,178 @@
package me.libraryaddict.disguise.disguisetypes;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster;
public enum FutureDisguiseType {
ARMOR_STAND(Entity.class, 30, 2, new float[] { 0F, 0F, 0F }, new Object[] {
1, (short) 300,
2, "",
3, (byte) 0,
4, (byte) 0,
6, 1F,
7, 0,
8, (byte) 0,
9, (byte) 0,
10, (byte) 0,
// 11,
// 12,
// 13,
// 14,
// 15,
// 16
}),
ELDER_GUARDIAN(Monster.class, 68, 80, new float[] { 0F, 0F, 0F }, new Object[] {
1, (short) 300,
2, "",
3, (byte) 0,
4, (byte) 0,
6, 1F,
7, 0,
8, (byte) 0,
9, (byte) 0,
15, (byte) 0,
16, 0 | 4,
17, 0
}),
ENDERMITE(Monster.class, 67, 8, new float[] { 0F, 0F, 0F }, new Object[] {
0, (byte) 0,
1, (short) 300,
2, "",
3, (byte) 0,
4, (byte) 0,
6, 1F,
7, 0,
8, (byte) 0,
9, (byte) 0,
15, (byte) 0
}),
GUARDIAN(Monster.class, 68, 30, new float[] { 0F, 0F, 0F }, new Object[] {
1, (short) 300,
2, "",
3, (byte) 0,
4, (byte) 0,
6, 1F,
7, 0,
8, (byte) 0,
9, (byte) 0,
15, (byte) 0,
16, 0,
17, 0
}),
RABBIT(Animals.class, 101, 10, new float[] { 0F, 0F, 0F }, new Object[] { 1, (short) 300,
2, "",
3, (byte) 0,
4, (byte) 0,
6, 1F,
7, 0,
8, (byte) 0,
9, (byte) 0,
12, (byte) 0,
15, (byte) 0,
18, (byte) 0
});
private float[] boundingBox;
private Object[] dataWatcher;
private Class<? extends Entity> entityClass;
private int entityId;
private float maxHealth;
private FutureDisguiseType(Class<? extends Entity> entityClass, int entityId, float maxHealth, float[] boundingBox,
Object[] watcherValues) {
this.entityClass = entityClass;
this.dataWatcher = watcherValues;
this.boundingBox = boundingBox;
if (watcherValues.length % 2 != 0) {
System.out.print("Error! " + name() + " has odd number of params!");
}
this.entityId = entityId;
}
public float[] getBoundingBox() {
return boundingBox;
}
public Object[] getDataWatcher() {
return dataWatcher;
}
public Class<? extends Entity> getEntityClass() {
return entityClass;
}
public int getEntityId() {
return entityId;
}
public float getMaxHealth() {
return maxHealth;
}
public boolean isAlive() {
return this != ARMOR_STAND;
}
}

View File

@ -6,7 +6,7 @@ import java.util.List;
import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.utilities.DisguiseUtilities; import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.ReflectionManager;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public abstract class TargetedDisguise extends Disguise { public abstract class TargetedDisguise extends Disguise {
@ -34,6 +34,8 @@ public abstract class TargetedDisguise extends Disguise {
} }
public boolean canSee(Player player) { public boolean canSee(Player player) {
if (getType() != null && (getType().is1_8() && !ReflectionManager.is1_8(player)))
return false;
return canSee(player.getName()); return canSee(player.getName());
} }

View File

@ -0,0 +1,11 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
public class ArmorStandWatcher extends LivingWatcher {
public ArmorStandWatcher(Disguise disguise) {
super(disguise);
}
}

View File

@ -0,0 +1,11 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
public class EndermiteWatcher extends LivingWatcher {
public EndermiteWatcher(Disguise disguise) {
super(disguise);
}
}

View File

@ -0,0 +1,11 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
public class GuardianWatcher extends LivingWatcher {
public GuardianWatcher(Disguise disguise) {
super(disguise);
}
}

View File

@ -0,0 +1,11 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
public class RabbitWatcher extends AgeableWatcher {
public RabbitWatcher(Disguise disguise) {
super(disguise);
}
}

View File

@ -14,6 +14,7 @@ import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
import me.libraryaddict.disguise.disguisetypes.MiscDisguise; import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
import me.libraryaddict.disguise.disguisetypes.MobDisguise; import me.libraryaddict.disguise.disguisetypes.MobDisguise;
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -22,7 +23,6 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Ageable; import org.bukkit.entity.Ageable;
import org.bukkit.entity.Animals; import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster; import org.bukkit.entity.Monster;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.permissions.PermissionAttachmentInfo;
@ -31,15 +31,15 @@ import org.bukkit.potion.PotionEffectType;
public abstract class BaseDisguiseCommand implements CommandExecutor { public abstract class BaseDisguiseCommand implements CommandExecutor {
public class DisguiseParseException extends Exception { public class DisguiseParseException extends Exception {
public DisguiseParseException(String string) { private static final long serialVersionUID = 1276971370793124510L;
super(string);
}
public DisguiseParseException() { public DisguiseParseException() {
super(); super();
} }
private static final long serialVersionUID = 1276971370793124510L; public DisguiseParseException(String string) {
super(string);
}
} }
@ -147,7 +147,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
} else { } else {
for (DisguiseType type : DisguiseType.values()) { for (DisguiseType type : DisguiseType.values()) {
HashMap<ArrayList<String>, Boolean> options = null; HashMap<ArrayList<String>, Boolean> options = null;
Class entityClass = type.getEntityType() == null ? Entity.class : type.getEntityType().getEntityClass(); Class entityClass = type.getEntityClass();
if (disguiseType.equals("mob")) { if (disguiseType.equals("mob")) {
if (type.isMob()) { if (type.isMob()) {
options = getOptions(perm); options = getOptions(perm);
@ -203,7 +203,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
} else { } else {
for (DisguiseType type : DisguiseType.values()) { for (DisguiseType type : DisguiseType.values()) {
boolean foundHim = false; boolean foundHim = false;
Class entityClass = type.getEntityType() == null ? Entity.class : type.getEntityType().getEntityClass(); Class entityClass = type.getEntityClass();
if (disguiseType.equals("mob")) { if (disguiseType.equals("mob")) {
if (type.isMob()) { if (type.isMob()) {
foundHim = true; foundHim = true;
@ -337,7 +337,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
throw new DisguiseParseException(ChatColor.RED + "Error! The disguise " + ChatColor.GREEN + args[0] throw new DisguiseParseException(ChatColor.RED + "Error! The disguise " + ChatColor.GREEN + args[0]
+ ChatColor.RED + " doesn't exist!"); + ChatColor.RED + " doesn't exist!");
} }
if (disguiseType.getEntityType() == null) { if (!(LibVersion.is1_8() && disguiseType.is1_8()) && disguiseType.getEntityType() == null) {
throw new DisguiseParseException(ChatColor.RED + "Error! This version of minecraft does not have that disguise!"); throw new DisguiseParseException(ChatColor.RED + "Error! This version of minecraft does not have that disguise!");
} }
if (!map.containsKey(disguiseType)) { if (!map.containsKey(disguiseType)) {

View File

@ -264,7 +264,7 @@ public class DisguiseUtilities {
destroyPacket.getIntegerArrays().write(0, new int[] { disguise.getEntity().getEntityId() }); destroyPacket.getIntegerArrays().write(0, new int[] { disguise.getEntity().getEntityId() });
for (Object p : cloned) { for (Object p : cloned) {
Player player = (Player) ReflectionManager.getBukkitEntity(p); Player player = (Player) ReflectionManager.getBukkitEntity(p);
if (player == disguise.getEntity() || disguise.canSee(player.getName())) { if (player == disguise.getEntity() || disguise.canSee(player)) {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, destroyPacket); ProtocolLibrary.getProtocolManager().sendServerPacket(player, destroyPacket);
} }
} }
@ -787,7 +787,7 @@ public class DisguiseUtilities {
HashSet cloned = (HashSet) trackedPlayers.clone(); HashSet cloned = (HashSet) trackedPlayers.clone();
for (final Object p : cloned) { for (final Object p : cloned) {
Player player = (Player) ReflectionManager.getBukkitEntity(p); Player player = (Player) ReflectionManager.getBukkitEntity(p);
if (disguise.getEntity() != player && disguise.canSee(player.getName())) { if (disguise.getEntity() != player && disguise.canSee(player)) {
clear.invoke(entityTrackerEntry, p); clear.invoke(entityTrackerEntry, p);
ProtocolLibrary.getProtocolManager().sendServerPacket(player, destroyPacket); ProtocolLibrary.getProtocolManager().sendServerPacket(player, destroyPacket);
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {

View File

@ -277,14 +277,14 @@ public class PacketsManager {
delayedPackets = new PacketContainer[] { delayedPacket }; delayedPackets = new PacketContainer[] { delayedPacket };
} }
} else if (disguise.getType().isMob()) { } else if (disguise.getType().isMob() || disguise.getType() == DisguiseType.ARMOR_STAND) {
DisguiseValues values = DisguiseValues.getDisguiseValues(disguise.getType()); DisguiseValues values = DisguiseValues.getDisguiseValues(disguise.getType());
Vector vec = disguisedEntity.getVelocity(); Vector vec = disguisedEntity.getVelocity();
spawnPackets[0] = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING); spawnPackets[0] = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
StructureModifier<Object> mods = spawnPackets[0].getModifier(); StructureModifier<Object> mods = spawnPackets[0].getModifier();
mods.write(0, disguisedEntity.getEntityId()); mods.write(0, disguisedEntity.getEntityId());
mods.write(1, (int) disguise.getType().getEntityType().getTypeId()); mods.write(1, disguise.getType().getTypeId()); // TODO
double d1 = 3.9D; double d1 = 3.9D;
double d2 = vec.getX(); double d2 = vec.getX();
double d3 = vec.getY(); double d3 = vec.getY();
@ -421,7 +421,7 @@ public class PacketsManager {
value = (byte) -(value + 128); value = (byte) -(value + 128);
break; break;
default: default:
if (disguiseType.isMisc()) { if (disguiseType.isMisc() && disguiseType != DisguiseType.ARMOR_STAND) {
value -= 64; value -= 64;
} }
break; break;