From 42cac092f61ddec6905862051c08de4c9653be28 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 24 Nov 2013 08:43:36 +1300 Subject: [PATCH] Modify the painting spawn packet to match the changes --- .../disguise/disguisetypes/FlagWatcher.java | 8 ++++---- .../libraryaddict/disguise/utilities/PacketsManager.java | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index 3824126d..a2fda793 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -143,6 +143,10 @@ public class FlagWatcher { return armor; } + protected Disguise getDisguise() { + return disguise; + } + private boolean getFlag(int i) { return ((Byte) getValue(0, (byte) 0) & 1 << i) != 0; } @@ -317,10 +321,6 @@ public class FlagWatcher { sendData(0); } - protected Disguise getDisguise() { - return disguise; - } - protected void setValue(int no, Object value) { entityValues.put(no, value); } diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index 81043c4a..5cf44df4 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -178,9 +178,7 @@ public class PacketsManager { mods.write(3, loc.getBlockZ()); mods.write(4, ((int) loc.getYaw()) % 4); int id = ((MiscDisguise) disguise).getData(); - if (id == -1) - id = new Random().nextInt(Art.values().length); - mods.write(5, ReflectionManager.getEnumArt(Art.values()[id % Art.values().length])); + mods.write(5, ReflectionManager.getEnumArt(Art.values()[id])); // Make the teleport packet to make it visible.. spawnPackets[1] = new PacketContainer(Packets.Server.ENTITY_TELEPORT); @@ -257,10 +255,11 @@ public class PacketsManager { int id = disguise.getType().getEntityId(); int data = 0; if (((MiscDisguise) disguise).getId() >= 0) { - if (((MiscDisguise) disguise).getData() >= 0) + if (((MiscDisguise) disguise).getData() >= 0) { data = (((MiscDisguise) disguise).getId() | ((MiscDisguise) disguise).getData() << 16); - else + } else { data = ((MiscDisguise) disguise).getId(); + } } // This won't actually work. // But if someone constructing the disguise uses it properly. It will work.