diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index c27d464d7..9e095ec1e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -8,6 +8,8 @@ import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityBlaze import net.minecraft.entity.player.EntityPlayer +import net.minecraft.item.ItemStack +import net.minecraft.potion.Potion import net.minecraft.util.AxisAlignedBB object EntityUtils { @@ -118,4 +120,10 @@ object EntityUtils { if (inventory == null) return false return inventory.any { it != null && it.getSkullTexture() == skin } } + + fun EntityPlayer.isNPC() = uniqueID == null || uniqueID.version() != 4 + + fun EntityLivingBase.hasPotionEffect(potion: Potion) = getActivePotionEffect(potion) != null + + fun EntityLivingBase.getArmorInventory(): Array<ItemStack?>? = if (this is EntityPlayer) inventory.armorInventory else null }
\ No newline at end of file |