potion.setShooter((LivingEntity)source); Object potionHandle = getHandle(potion); Object damageSource = class_DamageSource_getMagicSourceMethod.invoke(null, potionHandle, sourceHandle);
/** * Fires a potion from the NPC at a target. */ public void firePotion(ItemStack potion, Location target, Vector lead) { sentinel.stats_potionsThrown++; HashMap.SimpleEntry<Location, Vector> start = sentinel.getLaunchDetail(target, lead); Entity entpotion; if (SentinelTarget.v1_9) { entpotion = start.getKey().getWorld().spawnEntity(start.getKey(), potion.getType() == Material.SPLASH_POTION ? EntityType.SPLASH_POTION : EntityType.LINGERING_POTION); } else { entpotion = start.getKey().getWorld().spawnEntity(start.getKey(), EntityType.SPLASH_POTION); } ((ThrownPotion) entpotion).setShooter(getLivingEntity()); ((ThrownPotion) entpotion).setItem(potion); entpotion.setVelocity(sentinel.fixForAcc(start.getValue())); sentinel.swingWeapon(); }