mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-03 08:49:32 +01:00
Fixed the error with a field being fetched in entity class
This commit is contained in:
parent
5c41c04dd8
commit
06b9734c3e
@ -416,13 +416,13 @@ public class PacketsManager {
|
|||||||
boolean hasInvun = false;
|
boolean hasInvun = false;
|
||||||
Object nmsEntity = ReflectionManager.getNmsEntity(entity);
|
Object nmsEntity = ReflectionManager.getNmsEntity(entity);
|
||||||
try {
|
try {
|
||||||
|
Class entityClass = ReflectionManager.getNmsClass("Entity");
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
Class entityClass = ReflectionManager.getNmsClass("Entity");
|
hasInvun = entityClass.getField("noDamageTicks").getInt(nmsEntity) == ReflectionManager
|
||||||
hasInvun = entityClass.getField("noDamageTicks").getInt(nmsEntity) == entityClass
|
.getNmsClass("EntityLiving").getField("maxNoDamageTicks")
|
||||||
.getField("maxNoDamageTicks").getInt(nmsEntity);
|
.getInt(nmsEntity);
|
||||||
} else {
|
} else {
|
||||||
hasInvun = (Boolean) ReflectionManager.getNmsClass("Entity")
|
hasInvun = (Boolean) entityClass.getMethod("isInvulnerable").invoke(nmsEntity);
|
||||||
.getMethod("isInvulnerable").invoke(nmsEntity);
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user