Move the setting of watcher values for precaution down after a secondary watcher construction

This commit is contained in:
Andrew 2013-07-12 02:03:55 +12:00
parent d4c657eee6
commit a2c8042f4c

View File

@ -237,12 +237,6 @@ public class Disguise {
if (watcher instanceof AgeableWatcher && this instanceof MobDisguise) { if (watcher instanceof AgeableWatcher && this instanceof MobDisguise) {
((AgeableWatcher) watcher).setValue(12, ((MobDisguise) this).isAdult() ? 0 : -23999); ((AgeableWatcher) watcher).setValue(12, ((MobDisguise) this).isAdult() ? 0 : -23999);
} }
WatcherValues entity = WatcherValues.valueOf(type.name());
WatcherValues disguise = WatcherValues.valueOf(getType().name());
for (int i : entity.getValues()) {
if (disguise.getValue(i) != null && disguise.getValue(i).getClass() != entity.getValue(i).getClass())
watcher.setValue(i, disguise.getValue(i));
}
} catch (Exception ex) { } catch (Exception ex) {
if (throwError) if (throwError)
ex.printStackTrace(); ex.printStackTrace();
@ -252,6 +246,13 @@ public class Disguise {
else else
watcher = new FlagWatcher(entityId); watcher = new FlagWatcher(entityId);
} }
WatcherValues entity = WatcherValues.valueOf(getType().name());
WatcherValues disguise = WatcherValues.valueOf(getType().name());
for (int i : entity.getValues()) {
if (disguise.getValue(i) != null && disguise.getValue(i).getClass() != entity.getValue(i).getClass())
// watcher.setValue(i, disguise.getValue(i));
watcher.setValue(i, null);
}
} }
public DisguiseType getType() { public DisguiseType getType() {