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"); + " instead");
} }
createDisguise(disguiseType); createDisguise(disguiseType);
this.id = getType().getDefaultId(); this.id = getType().getEntityId();
this.data = getType().getEntityId(); this.data = getType().getDefaultId();
switch (disguiseType) { switch (disguiseType) {
// The only disguises which should use a custom data. // The only disguises which should use a custom data.
case PAINTING: case PAINTING:

View File

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