Use getRawValue() instead of getValue(), fixes #520

This commit is contained in:
libraryaddict 2020-11-02 04:05:36 +13:00
parent a9bec1ef93
commit 4ef142b098
5 changed files with 12 additions and 10 deletions

View File

@ -295,7 +295,7 @@ public class FlagWatcher {
if (value != null) {
if (isEntityAnimationsAdded() && id == MetaIndex.ENTITY_META.getIndex()) {
value = addEntityAnimations((byte) value, (byte) watch.getValue());
value = addEntityAnimations((byte) value, (byte) watch.getRawValue());
doSneakCheck((Byte) value);
}
@ -314,7 +314,7 @@ public class FlagWatcher {
} else {
boolean isDirty = watch.getDirtyState();
watch = ReflectionManager.createWatchable(MetaIndex.getMetaIndex(this, id), watch.getValue());
watch = ReflectionManager.createWatchable(MetaIndex.getMetaIndex(this, id), watch.getRawValue());
if (watch == null) {
continue;
@ -325,7 +325,7 @@ public class FlagWatcher {
}
if (id == MetaIndex.ENTITY_META.getIndex()) {
doSneakCheck((Byte) watch.getValue());
doSneakCheck((Byte) watch.getRawValue());
}
}
@ -361,7 +361,7 @@ public class FlagWatcher {
for (WrappedWatchableObject watch : newList) {
// Its a health packet
if (watch.getIndex() == MetaIndex.LIVING_HEALTH.getIndex()) {
Object value = watch.getValue();
Object value = watch.getRawValue();
if (value instanceof Float) {
float newHealth = (Float) value;

View File

@ -2786,16 +2786,18 @@ public class DisguiseUtilities {
continue;
}
if (watchableObject.getValue() == null) {
Object object = watchableObject.getRawValue();
if (object == null) {
continue;
}
MetaIndex metaIndex = MetaIndex.getMetaIndex(disguiseWatcher, watchableObject.getIndex());
WrappedDataWatcher.WrappedDataWatcherObject obj =
ReflectionManager.createDataWatcherObject(metaIndex, watchableObject.getValue());
ReflectionManager.createDataWatcherObject(metaIndex, object);
newWatcher.setObject(obj, watchableObject.getValue());
newWatcher.setObject(obj, object);
}
} catch (Exception ex) {
ex.printStackTrace();

View File

@ -196,7 +196,7 @@ public class PacketHandlerEquipment implements IPacketHandler {
if (NmsVersion.v1_13.isSupported()) {
watcher.setValue((byte) 0);
} else {
watcher.setValue((byte) ((byte) watcher.getValue() & ~(1 << 4)));
watcher.setValue((byte) ((byte) watcher.getRawValue() & ~(1 << 4)));
}
}

View File

@ -122,7 +122,7 @@ public class PacketListenerViewSelfDisguise extends PacketAdapter {
continue;
}
byte b = (byte) watch.getValue();
byte b = (byte) watch.getRawValue();
// Add invisibility, remove glowing
byte a = (byte) ((b | 1 << 5) & ~(1 << 6));

View File

@ -1858,7 +1858,7 @@ public class ReflectionManager {
indexes.remove(flagType);
Object ourValue = ReflectionManager.convertInvalidMeta(flagType.getDefault());
Object nmsValue = ReflectionManager.convertInvalidMeta(watch.getValue());
Object nmsValue = ReflectionManager.convertInvalidMeta(watch.getRawValue());
if (ourValue.getClass() != nmsValue.getClass()) {
if (!loggedName) {