Fix the errors due to health being changed to a float
This commit is contained in:
parent
49b81b0deb
commit
86d728f90d
@ -410,9 +410,20 @@ public class PacketsManager {
|
|||||||
if (loc.equals(soundLoc)) {
|
if (loc.equals(soundLoc)) {
|
||||||
entitySound = DisguiseSound.getType(entity.getType().name());
|
entitySound = DisguiseSound.getType(entity.getType().name());
|
||||||
if (entitySound != null) {
|
if (entitySound != null) {
|
||||||
if (entity instanceof LivingEntity && ((LivingEntity) entity).getHealth() == 0) {
|
Object obj = null;
|
||||||
soundType = SoundType.DEATH;
|
if (entity instanceof LivingEntity) {
|
||||||
} else {
|
try {
|
||||||
|
obj = LivingEntity.class.getMethod("getHealth").invoke(entity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (obj instanceof Float && ((Float) obj) == 0 || ((Integer) obj) == 0) {
|
||||||
|
soundType = SoundType.DEATH;
|
||||||
|
} else {
|
||||||
|
obj = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
boolean hasInvun = false;
|
boolean hasInvun = false;
|
||||||
Object nmsEntity = ReflectionManager.getNmsEntity(entity);
|
Object nmsEntity = ReflectionManager.getNmsEntity(entity);
|
||||||
try {
|
try {
|
||||||
@ -529,9 +540,20 @@ public class PacketsManager {
|
|||||||
if (disSound == null)
|
if (disSound == null)
|
||||||
return;
|
return;
|
||||||
SoundType soundType = null;
|
SoundType soundType = null;
|
||||||
if (entity instanceof LivingEntity && ((LivingEntity) entity).getHealth() == 0) {
|
Object obj = null;
|
||||||
soundType = SoundType.DEATH;
|
if (entity instanceof LivingEntity) {
|
||||||
} else {
|
try {
|
||||||
|
obj = LivingEntity.class.getMethod("getHealth").invoke(entity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (obj instanceof Float && ((Float) obj) == 0 || ((Integer) obj) == 0) {
|
||||||
|
soundType = SoundType.DEATH;
|
||||||
|
} else {
|
||||||
|
obj = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
soundType = SoundType.HURT;
|
soundType = SoundType.HURT;
|
||||||
}
|
}
|
||||||
if (disSound.getSound(soundType) == null
|
if (disSound.getSound(soundType) == null
|
||||||
|
Loading…
Reference in New Issue
Block a user