From 4b06deec1b54bde5d3a94638e26d0b792ee66110 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 6 Jun 2014 14:16:16 +1200 Subject: [PATCH] Fix the id and data crap so its no longer broken --- .../disguise/disguisetypes/MiscDisguise.java | 4 ++-- .../disguise/utilities/PacketsManager.java | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java index 7f77223e..3c7a8a15 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java @@ -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: diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index 46cce0dc..11546d38 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -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)