Fix the id and data crap so its no longer broken

This commit is contained in:
libraryaddict 2014-06-06 14:16:16 +12:00
parent 7b5d998e25
commit 4b06deec1b
2 changed files with 10 additions and 12 deletions

View File

@ -47,8 +47,8 @@ public class MiscDisguise extends TargetedDisguise {
+ " instead");
}
createDisguise(disguiseType);
this.id = getType().getDefaultId();
this.data = getType().getEntityId();
this.id = getType().getEntityId();
this.data = getType().getDefaultId();
switch (disguiseType) {
// The only disguises which should use a custom data.
case PAINTING:

View File

@ -274,18 +274,16 @@ public class PacketsManager {
} else if (disguise.getType().isMisc()) {
int id = disguise.getType().getEntityId();
int data = 0;
if (((MiscDisguise) disguise).getId() >= 0) {
if (((MiscDisguise) disguise).getData() >= 0) {
data = (((MiscDisguise) disguise).getId() | ((MiscDisguise) disguise).getData() << 16);
} else {
data = ((MiscDisguise) disguise).getId();
}
int data = ((MiscDisguise) disguise).getData();
if (disguise.getType() == DisguiseType.FALLING_BLOCK) {
data = (((MiscDisguise) disguise).getId() | data << 16);
} else if (data < 0) {
data = 0;
}
// This won't actually work.
// But if someone constructing the disguise uses it properly. It will work.
if (disguise.getType() == DisguiseType.FISHING_HOOK)
// If the MiscDisguise data isn't set. Then no entity id was provided, so default to the owners entity id
if (disguise.getType() == DisguiseType.FISHING_HOOK && data == 0) {
data = disguisedEntity.getEntityId();
}
/* else if (disguise.getType() == DisguiseType.ITEM_FRAME) {
data = (int) loc.getYaw();
if (data < 0)