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;
|
||||
Object nmsEntity = ReflectionManager.getNmsEntity(entity);
|
||||
try {
|
||||
if (entity instanceof LivingEntity) {
|
||||
Class entityClass = ReflectionManager.getNmsClass("Entity");
|
||||
hasInvun = entityClass.getField("noDamageTicks").getInt(nmsEntity) == entityClass
|
||||
.getField("maxNoDamageTicks").getInt(nmsEntity);
|
||||
if (entity instanceof LivingEntity) {
|
||||
hasInvun = entityClass.getField("noDamageTicks").getInt(nmsEntity) == ReflectionManager
|
||||
.getNmsClass("EntityLiving").getField("maxNoDamageTicks")
|
||||
.getInt(nmsEntity);
|
||||
} else {
|
||||
hasInvun = (Boolean) ReflectionManager.getNmsClass("Entity")
|
||||
.getMethod("isInvulnerable").invoke(nmsEntity);
|
||||
hasInvun = (Boolean) entityClass.getMethod("isInvulnerable").invoke(nmsEntity);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user